dhre-component-lib 0.8.14 → 0.8.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +12 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -21703,6 +21703,16 @@ const Search = ({ searchIcon, crossIcon, disabled = false, onSearch, onSelectSug
|
|
|
21703
21703
|
useEffect(() => {
|
|
21704
21704
|
queryRef.current = query;
|
|
21705
21705
|
}, [query]);
|
|
21706
|
+
useEffect(() => {
|
|
21707
|
+
if (!!suggestions?.length && query.length >= 3 && shouldShowAll) {
|
|
21708
|
+
setShowSuggestions(true);
|
|
21709
|
+
setFilteredSuggestions(suggestions);
|
|
21710
|
+
}
|
|
21711
|
+
else {
|
|
21712
|
+
setFilteredSuggestions([]);
|
|
21713
|
+
setShowSuggestions(false);
|
|
21714
|
+
}
|
|
21715
|
+
}, [suggestions]);
|
|
21706
21716
|
const handleChange = (e) => {
|
|
21707
21717
|
if (disabled)
|
|
21708
21718
|
return;
|
|
@@ -21733,8 +21743,8 @@ const Search = ({ searchIcon, crossIcon, disabled = false, onSearch, onSelectSug
|
|
|
21733
21743
|
onSearch(queryRef.current);
|
|
21734
21744
|
}, 500);
|
|
21735
21745
|
setTimeoutId(newTimeoutId);
|
|
21736
|
-
if (suggestions && value) {
|
|
21737
|
-
const filtered =
|
|
21746
|
+
if (suggestions && value && !shouldShowAll) {
|
|
21747
|
+
const filtered = suggestions.filter((suggestion) => suggestion.title.toLowerCase().includes(value.toLowerCase()));
|
|
21738
21748
|
setFilteredSuggestions(filtered);
|
|
21739
21749
|
setShowSuggestions(true);
|
|
21740
21750
|
}
|