@homecode/ui 4.30.10 → 4.30.12
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.
|
@@ -105,7 +105,7 @@ function Autocomplete(props) {
|
|
|
105
105
|
? filteredItems
|
|
106
106
|
: itemsWithoutFilter.length
|
|
107
107
|
? itemsWithoutFilter
|
|
108
|
-
: items ?? [];
|
|
108
|
+
: (items ?? []);
|
|
109
109
|
const displayCount = displayItems.length;
|
|
110
110
|
const hasMore = totalCount > 0 && displayCount < totalCount;
|
|
111
111
|
const classes = cn(S.root, className, popupProps.className);
|
|
@@ -272,6 +272,9 @@ function Autocomplete(props) {
|
|
|
272
272
|
if (typeof value !== 'string')
|
|
273
273
|
return;
|
|
274
274
|
setSearchValue(value);
|
|
275
|
+
if (selectable && value) {
|
|
276
|
+
setSelectedLabel(value);
|
|
277
|
+
}
|
|
275
278
|
if (!value) {
|
|
276
279
|
savedScrollTopRef.current = undefined;
|
|
277
280
|
setCurrentFilter('');
|
|
@@ -288,7 +291,7 @@ function Autocomplete(props) {
|
|
|
288
291
|
setScrollTop(0); // Reset scroll when filter changes
|
|
289
292
|
fetchOptions(value, 0);
|
|
290
293
|
}
|
|
291
|
-
}, [value]);
|
|
294
|
+
}, [value, selectable]);
|
|
292
295
|
useEffect(() => {
|
|
293
296
|
if (selectable && !value) {
|
|
294
297
|
setSelectedId(null);
|
|
@@ -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, } = 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;
|
|
22
22
|
const isMultiple$1 = isMultiple(value);
|
|
23
23
|
const closeOnSelect = props.closeOnSelect ?? !isMultiple$1;
|
|
24
24
|
const contentRef = useRef(null);
|
|
@@ -180,7 +180,7 @@ function Select2(props) {
|
|
|
180
180
|
const label = getLabel(id);
|
|
181
181
|
if (!label)
|
|
182
182
|
return null;
|
|
183
|
-
return (jsx(Chip, { className: S.chip, size: size, onRemove: () => onItemToggle(id), onClick: () => onChipClick?.(id), removeTooltip: selectedChipRemoveTooltip, children: label }, id));
|
|
183
|
+
return (jsx(Chip, { className: S.chip, size: size, selected: selectedChipIds?.includes(id), onRemove: () => onItemToggle(id), onClick: () => onChipClick?.(id), removeTooltip: selectedChipRemoveTooltip, children: label }, id));
|
|
184
184
|
});
|
|
185
185
|
};
|
|
186
186
|
const triggerArrow = useMemo(() => {
|