diff --git a/README.md b/README.md index 46fd8286..a2baafe5 100644 --- a/README.md +++ b/README.md @@ -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" } ``` @@ -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 ```
diff --git a/changelog.txt b/changelog.txt index 40d8f925..2aab836e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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 diff --git a/package-lock.json b/package-lock.json index 315d0745..95ce9181 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@bsf/force-ui", - "version": "1.7.5", + "version": "1.7.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@bsf/force-ui", - "version": "1.7.5", + "version": "1.7.6", "license": "ISC", "dependencies": { "@emotion/is-prop-valid": "^1.3.0", diff --git a/package.json b/package.json index 84c20896..77814fa1 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/components/select/utils.ts b/src/components/select/utils.ts index 23a0896e..2b18d816 100644 --- a/src/components/select/utils.ts +++ b/src/components/select/utils.ts @@ -1,4 +1,4 @@ -import { type ReactNode } from 'react'; +import { type ReactNode, isValidElement } from 'react'; /** * Get text content of a node @@ -6,16 +6,38 @@ import { type ReactNode } from 'react'; * @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 ''; diff --git a/version.json b/version.json index 24659c2e..5e07b1fd 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "force-ui": "1.7.5" + "force-ui": "1.7.6" }