diff --git a/package-lock.json b/package-lock.json index 1d6d29b9..494f04a0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@xola/ui-kit", - "version": "2.1.13", + "version": "2.1.14", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@xola/ui-kit", - "version": "2.1.13", + "version": "2.1.14", "license": "MIT", "dependencies": { "@headlessui/react": "^1.4.0", diff --git a/package.json b/package.json index 99cf87bc..c8484b45 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@xola/ui-kit", - "version": "2.1.13", + "version": "2.1.14", "description": "Xola UI Kit", "license": "MIT", "files": [ diff --git a/src/components/Search.jsx b/src/components/Search.jsx index c00f2e10..7f9eb754 100644 --- a/src/components/Search.jsx +++ b/src/components/Search.jsx @@ -37,6 +37,7 @@ export const Search = ({ shouldStayOpen = false, shouldDestroyOnClose = true, shouldHideMenu = false, + minChars = 0, ...rest }) => { const [showShortcutKey, setShowShortcutKey] = useState(true); @@ -123,7 +124,7 @@ export const Search = ({ // Show dropdown only when `isOpen` is set to `true` and there are items in the list. const open = (isOpen || !canClose || shouldStayOpen) && itemList.length > 0 && !shouldHideMenu; - const noResultFound = open && !isLoading && itemList.length <= 1; + const noResultFound = open && !isLoading && itemList.length <= 1 && inputValue.length >= minChars; // Keyboard shortcuts. useHotkeys(isOSX ? "cmd+k" : "ctrl+k", (event) => { @@ -190,7 +191,13 @@ export const Search = ({ highlightedIndex === index ? "bg-blue-light text-white" : "", )} > - Show all results for {inputValue} + {inputValue.length >= minChars ? ( + <> + Show all results for {inputValue} + + ) : ( + `Enter at least ${minChars} characters to begin search` + )} {isLoading ? ( diff --git a/src/icons/Logos/XIcon.jsx b/src/icons/Logos/XIcon.jsx new file mode 100644 index 00000000..5f6f7131 --- /dev/null +++ b/src/icons/Logos/XIcon.jsx @@ -0,0 +1,15 @@ +import React from "react"; +import { createIcon } from "../../helpers/icon"; + +export const XIcon = createIcon((props) => { + return ( + + + + ); +}); + +XIcon.tags = ["logo", "social media", "x"]; diff --git a/src/index.js b/src/index.js index 153ee416..3c0cbc2c 100644 --- a/src/index.js +++ b/src/index.js @@ -262,6 +262,7 @@ export { WarningTriangleIcon } from "./icons/WarningTriangleIcon"; export { WeightIcon } from "./icons/WeightIcon"; export { WifiIcon } from "./icons/WifiIcon"; export { WriteIcon } from "./icons/WriteIcon"; +export { XIcon } from "./icons/Logos/XIcon"; export { XolaBotIcon } from "./icons/XolaBotIcon"; export { XrayIcon } from "./icons/XrayIcon"; export { YelpIcon } from "./icons/Logos/YelpIcon";