@homecode/ui 4.20.0-beta-4 → 4.20.0-beta-6
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.
|
@@ -69,8 +69,10 @@ function Select2(props) {
|
|
|
69
69
|
focusedItemId.current = items[index]?.id;
|
|
70
70
|
setFocusedItemIndex(index);
|
|
71
71
|
};
|
|
72
|
+
const [isSearchActive, setIsSearchActive] = useState(false);
|
|
72
73
|
const handleSearchChange = (e, value) => {
|
|
73
74
|
setSearchVal(value);
|
|
75
|
+
setIsSearchActive(true);
|
|
74
76
|
onSearchChange?.(value);
|
|
75
77
|
setNewItems(options.filter(filterOption));
|
|
76
78
|
};
|
|
@@ -108,6 +110,8 @@ function Select2(props) {
|
|
|
108
110
|
};
|
|
109
111
|
const onPopupClose = () => {
|
|
110
112
|
setIsOpen(false);
|
|
113
|
+
setSearchVal('');
|
|
114
|
+
setIsSearchActive(false);
|
|
111
115
|
setItemFocus(0);
|
|
112
116
|
};
|
|
113
117
|
const onFocus = () => {
|
|
@@ -177,7 +181,7 @@ function Select2(props) {
|
|
|
177
181
|
const renderTriggerInput = () => {
|
|
178
182
|
return (jsx(Input, { ...triggerProps, ...inputProps,
|
|
179
183
|
// TODO: autoComplete
|
|
180
|
-
addonRight: triggerArrow, error: isErrorVisible, value: isFocused ? searchVal : selectedLabel, onChange: handleSearchChange, label: getFieldLabel(label) }));
|
|
184
|
+
addonRight: triggerArrow, error: isErrorVisible, value: isFocused && isSearchActive ? searchVal : selectedLabel, onChange: handleSearchChange, label: getFieldLabel(label) }));
|
|
181
185
|
};
|
|
182
186
|
const renderAdditionalLabel = () => {
|
|
183
187
|
return null;
|