@homecode/ui 4.21.0 → 4.21.2
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.
|
@@ -89,10 +89,10 @@ function Autocomplete(props) {
|
|
|
89
89
|
fetchOptions(val);
|
|
90
90
|
return true;
|
|
91
91
|
};
|
|
92
|
-
const handleSelect = (
|
|
93
|
-
setSearchValue(
|
|
92
|
+
const handleSelect = (option) => {
|
|
93
|
+
setSearchValue(option.label);
|
|
94
94
|
setOptions([]);
|
|
95
|
-
onSelect(
|
|
95
|
+
onSelect(option);
|
|
96
96
|
// set input caret to the end
|
|
97
97
|
requestAnimationFrame(() => {
|
|
98
98
|
const input = inputRef.current;
|
|
@@ -105,9 +105,7 @@ function Autocomplete(props) {
|
|
|
105
105
|
const { focusedIndex, setFocusedIndex } = useListKeyboardControl({
|
|
106
106
|
isActive: isOpen,
|
|
107
107
|
itemsCount: options.length,
|
|
108
|
-
onSelect: index =>
|
|
109
|
-
handleSelect(options[index].label);
|
|
110
|
-
},
|
|
108
|
+
onSelect: index => handleSelect(options[index]),
|
|
111
109
|
});
|
|
112
110
|
const fetchOptions = debounce(async (inputValue) => {
|
|
113
111
|
if (!inputValue) {
|
|
@@ -140,7 +138,7 @@ function Autocomplete(props) {
|
|
|
140
138
|
const optionsList = useMemo(() => {
|
|
141
139
|
if (!options.length)
|
|
142
140
|
return null;
|
|
143
|
-
return (jsx(Menu, { className: S.options, size: size, offset: { y: { before: 20, after: 20 } }, children: options.map((option, index) => (jsx(Menu.Item, { focused: focusedIndex === index, className: S.option, onClick: () => handleSelect(option
|
|
141
|
+
return (jsx(Menu, { className: S.options, size: size, offset: { y: { before: 20, after: 20 } }, children: options.map((option, index) => (jsx(Menu.Item, { focused: focusedIndex === index, className: S.option, onClick: () => handleSelect(option), onMouseEnter: () => setFocusedIndex(index), children: option.label }, option.id))) }));
|
|
144
142
|
}, [options, focusedIndex]);
|
|
145
143
|
return (jsx(Popup, { className: classes, isOpen: isOpen, focusControl: true, size: size, direction: "bottom", ...popupProps, trigger: jsxs("div", { className: inputWrapperClassName, children: [jsx(Input, { ref: inputRef,
|
|
146
144
|
// @ts-ignore
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import styleInject from '../../../node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".Shimmer_root__XaY5r{height:100%;left:0;overflow:hidden;pointer-events:none;position:absolute;top:0;width:100%}.Shimmer_inner__zssMV{animation:Shimmer_shimmer__hGfzF 1.5s linear infinite;background:linear-gradient(90deg,transparent,hsla(0,0%,100%,.2) 50%,transparent);inset:0;position:absolute}.Shimmer_size-s__EYKhC{border-radius:4px}.Shimmer_round__rwhjn.Shimmer_size-s__EYKhC{border-radius:15px}.Shimmer_size-m__AYziL{border-radius:6px}.Shimmer_round__rwhjn.Shimmer_size-m__AYziL{border-radius:20px}.Shimmer_size-l__GqE0a{border-radius:8px}.Shimmer_round__rwhjn.Shimmer_size-l__GqE0a{border-radius:25px}@keyframes Shimmer_shimmer__hGfzF{0%{transform:translateX(-100%)}20%{transform:translateX(100%)}to{transform:translateX(100%)}}";
|
|
3
|
+
var css_248z = ".Shimmer_root__XaY5r{height:100%;left:0;overflow:hidden;pointer-events:none;position:absolute;top:0;width:100%}.Shimmer_inner__zssMV{animation:Shimmer_shimmer__hGfzF 1.5s linear infinite;background:linear-gradient(90deg,transparent,hsla(0,0%,100%,.2) 50%,transparent);background:linear-gradient(90deg,transparent 0,var(--shimmer-color,var(--accent-color-alpha-200,hsla(0,0%,100%,.2))) 50%,transparent 100%);inset:0;position:absolute}.Shimmer_size-s__EYKhC{border-radius:4px}.Shimmer_round__rwhjn.Shimmer_size-s__EYKhC{border-radius:15px}.Shimmer_size-m__AYziL{border-radius:6px}.Shimmer_round__rwhjn.Shimmer_size-m__AYziL{border-radius:20px}.Shimmer_size-l__GqE0a{border-radius:8px}.Shimmer_round__rwhjn.Shimmer_size-l__GqE0a{border-radius:25px}@keyframes Shimmer_shimmer__hGfzF{0%{transform:translateX(-100%)}20%{transform:translateX(100%)}to{transform:translateX(100%)}}";
|
|
4
4
|
var S = {"root":"Shimmer_root__XaY5r","inner":"Shimmer_inner__zssMV","shimmer":"Shimmer_shimmer__hGfzF","size-s":"Shimmer_size-s__EYKhC","round":"Shimmer_round__rwhjn","size-m":"Shimmer_size-m__AYziL","size-l":"Shimmer_size-l__GqE0a"};
|
|
5
5
|
styleInject(css_248z);
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ export type Props = FormControl<Value, HTMLInputElement> & {
|
|
|
12
12
|
size?: Size;
|
|
13
13
|
value: Value;
|
|
14
14
|
getOptions: (value: Value) => Promise<Option[]>;
|
|
15
|
-
onSelect: (
|
|
15
|
+
onSelect: (option: Option) => void;
|
|
16
16
|
debounceDelay?: number;
|
|
17
17
|
inputProps?: Partial<InputProps>;
|
|
18
18
|
popupProps?: Partial<PopupProps>;
|