Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Using Force UI as a dependency in package.json -

```json
"dependencies": {
"@bsf/force-ui": "git+https://github.com/brainstormforce/force-ui#1.7.5"
"@bsf/force-ui": "git+https://github.com/brainstormforce/force-ui#1.7.6"
}
```

Expand All @@ -28,7 +28,7 @@ npm install
Or you can directly run the following command to install the package -

```bash
npm i -S @bsf/force-ui@git+https://github.com/brainstormforce/force-ui.git#1.7.5
npm i -S @bsf/force-ui@git+https://github.com/brainstormforce/force-ui.git#1.7.6
```

<br />
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 1.7.6 - 11th September, 2025
- Improvements: Atom - Select - Improved search logic.


Version 1.7.5 - 25th August, 2025
- New: Template - UAE Dashboard
- New: Template - UAE Widgets
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bsf/force-ui",
"version": "1.7.5",
"version": "1.7.6",
"description": "Library of components for the BSF project",
"main": "./dist/force-ui.cjs.js",
"module": "./dist/force-ui.es.js",
Expand Down
30 changes: 26 additions & 4 deletions src/components/select/utils.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,43 @@
import { type ReactNode } from 'react';
import { type ReactNode, isValidElement } from 'react';

/**
* Get text content of a node
* @param {ReactNode} node - React node
* @return {string} text content of the node
*/
export const getTextContent = ( node: ReactNode ): string => {
if ( typeof node === 'string' ) {
return node;
// Handle null, undefined, boolean
if ( node === null || typeof node === 'boolean' ) {
return '';
}

// Handle string and number
if ( typeof node === 'string' || typeof node === 'number' ) {
return node.toString();
}

// Handle arrays of React nodes
if ( Array.isArray( node ) ) {
return node.map( getTextContent ).join( ' ' ).trim();
}

// Handle React elements (JSX components)
if ( isValidElement( node ) ) {
// Recursively get text from children
if ( node.props && node.props.children ) {
return getTextContent( node.props.children );
}
return '';
}

// Handle objects with textContent property (DOM nodes)
if ( typeof node === 'object' && 'textContent' in node! ) {
return node.textContent?.toString().toLowerCase() || '';
}

// Handle objects with children property
if ( typeof node === 'object' && 'children' in node! ) {
return getTextContent( node.children );
return getTextContent( ( node as { children: ReactNode } ).children );
}

return '';
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"force-ui": "1.7.5"
"force-ui": "1.7.6"
}