@homecode/ui 4.30.12 → 4.30.13
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.
|
@@ -18,7 +18,7 @@ import useEvent from '../../hooks/useEvent.js';
|
|
|
18
18
|
import S from './Select.styl.js';
|
|
19
19
|
|
|
20
20
|
function Select2(props) {
|
|
21
|
-
const { className, value, onChange, onChipClick, onSearchChange, disableTriggerArrow, inputProps, popupProps, scrollProps, size = 'm', round, optionClassName, additionalOptions = [], options, variant, label, additionalLabel, error, blur, disabled, trigger, required, hideRequiredStar, isSearchable, presets = [], selectAllButton, clearButton, showSelectedCount, disableLabel, selectedChipRemoveTooltip, selectedChipIds, } = props;
|
|
21
|
+
const { className, value, onChange, onChipClick, onSearchChange, disableTriggerArrow, inputProps, popupProps, scrollProps, size = 'm', round, optionClassName, additionalOptions = [], options, variant, label, additionalLabel, error, blur, disabled, trigger, required, hideRequiredStar, isSearchable, presets = [], selectAllButton, clearButton, showSelectedCount, disableLabel, selectedChipRemoveTooltip, selectedChipIds, onOpen, onClose, } = props;
|
|
22
22
|
const isMultiple$1 = isMultiple(value);
|
|
23
23
|
const closeOnSelect = props.closeOnSelect ?? !isMultiple$1;
|
|
24
24
|
const contentRef = useRef(null);
|
|
@@ -66,7 +66,6 @@ function Select2(props) {
|
|
|
66
66
|
}
|
|
67
67
|
};
|
|
68
68
|
const setItemFocus = index => {
|
|
69
|
-
console.log('setItemFocus::', index);
|
|
70
69
|
focusedItemId.current = items[index]?.id;
|
|
71
70
|
setFocusedItemIndex(index);
|
|
72
71
|
};
|
|
@@ -108,12 +107,16 @@ function Select2(props) {
|
|
|
108
107
|
if (focusedItemIndex === -1) {
|
|
109
108
|
setItemFocus(0);
|
|
110
109
|
}
|
|
110
|
+
popupProps?.onOpen?.();
|
|
111
|
+
onOpen?.();
|
|
111
112
|
};
|
|
112
113
|
const onPopupClose = () => {
|
|
113
114
|
setIsOpen(false);
|
|
114
115
|
setSearchVal('');
|
|
115
116
|
setIsSearchActive(false);
|
|
116
117
|
setItemFocus(0);
|
|
118
|
+
popupProps?.onClose?.();
|
|
119
|
+
onClose?.();
|
|
117
120
|
};
|
|
118
121
|
const onFocus = () => {
|
|
119
122
|
setIsFocused(true);
|
|
@@ -24,7 +24,7 @@ export type PresetButtonProps = {
|
|
|
24
24
|
};
|
|
25
25
|
type SelectPopupProps = Omit<PopupProps, 'disabled' | 'direction' | 'autoClose' | 'onOpen' | 'onClose' | 'trigger' | 'content'> & Partial<{
|
|
26
26
|
direction: PopupProps['direction'];
|
|
27
|
-
}
|
|
27
|
+
}> & Partial<Pick<PopupProps, 'onOpen' | 'onClose'>>;
|
|
28
28
|
type Selected = Record<string, true | Id[]>;
|
|
29
29
|
export type Value = Id | Id[] | null;
|
|
30
30
|
type InheritedInputProps = Partial<Pick<InputProps, 'onFocus' | 'onBlur'>>;
|