@homecode/ui 4.30.13 → 4.30.14
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, onOpen, onClose, } = props;
|
|
21
|
+
const { className, value, onChange, onChipClick, onSearchChange, disableTriggerArrow, inputProps, popupProps, scrollProps, size = 'm', round, optionClassName, selectedChipClassName, 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);
|
|
@@ -183,7 +183,7 @@ function Select2(props) {
|
|
|
183
183
|
const label = getLabel(id);
|
|
184
184
|
if (!label)
|
|
185
185
|
return null;
|
|
186
|
-
return (jsx(Chip, { className: S.chip, size: size, selected: selectedChipIds?.includes(id), onRemove: () => onItemToggle(id), onClick: () => onChipClick?.(id), removeTooltip: selectedChipRemoveTooltip, children: label }, id));
|
|
186
|
+
return (jsx(Chip, { className: cn(S.chip, selectedChipIds?.includes(id) && selectedChipClassName, ids.items[id]?.chipClassName), size: size, selected: selectedChipIds?.includes(id), onRemove: () => onItemToggle(id), onClick: () => onChipClick?.(id), removeTooltip: selectedChipRemoveTooltip, children: label }, id));
|
|
187
187
|
});
|
|
188
188
|
};
|
|
189
189
|
const triggerArrow = useMemo(() => {
|
|
@@ -12,6 +12,8 @@ export type Option = {
|
|
|
12
12
|
sortingKey?: string | number;
|
|
13
13
|
children?: Option[];
|
|
14
14
|
render?: (label: string) => string;
|
|
15
|
+
/** Applied to the selected chip in multi-select mode */
|
|
16
|
+
chipClassName?: string;
|
|
15
17
|
};
|
|
16
18
|
type Preset = {
|
|
17
19
|
label: string;
|
|
@@ -34,6 +36,7 @@ export type Props = FormControl<Value> & InheritedInputProps & {
|
|
|
34
36
|
closeOnSelect?: boolean;
|
|
35
37
|
optionsClassName?: string;
|
|
36
38
|
optionClassName?: string;
|
|
39
|
+
selectedChipClassName?: string;
|
|
37
40
|
additionalLabel?: ReactNode;
|
|
38
41
|
size?: Size;
|
|
39
42
|
variant?: 'default' | 'outlined';
|