@clickhouse/click-ui 0.0.131 → 0.0.132
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.
- package/dist/click-ui.es.js +126 -2
- package/dist/click-ui.umd.js +126 -2
- package/dist/components/Select/CheckboxMultiSelect.d.ts +10 -0
- package/dist/components/Select/common/InternalSelect.d.ts +2 -1
- package/dist/components/Select/common/types.d.ts +2 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/click-ui.es.js
CHANGED
|
@@ -36469,6 +36469,8 @@ const InternalSelect = ({
|
|
|
36469
36469
|
sortable = false,
|
|
36470
36470
|
placeholder = "Select an option",
|
|
36471
36471
|
multiple,
|
|
36472
|
+
checkbox,
|
|
36473
|
+
selectLabel,
|
|
36472
36474
|
showSearch = false,
|
|
36473
36475
|
container,
|
|
36474
36476
|
...props
|
|
@@ -36635,7 +36637,10 @@ const InternalSelect = ({
|
|
|
36635
36637
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(FormElementContainer, { children: [
|
|
36636
36638
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectPopoverRoot, { open: open2, onOpenChange, modal: true, children: [
|
|
36637
36639
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(StyledSelectTrigger, { id: id ?? defaultId, $error: !!error2, disabled, "data-testid": "select-trigger", children: [
|
|
36638
|
-
isInitialized && /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { children: selectedValues.length === 0 ? placeholder : multiple ? /* @__PURE__ */ jsxRuntimeExports.jsx(MultiSelectValue, { disabled: disabled ?? false, onSelect, selectedValues, sortable: !disabled && sortable, valueNode: valueNode.current, onChange }) : /* @__PURE__ */ jsxRuntimeExports.jsx(SingleSelectValue, { valueNode:
|
|
36640
|
+
isInitialized && /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { children: selectedValues.length === 0 ? placeholder : multiple ? /* @__PURE__ */ jsxRuntimeExports.jsx(MultiSelectValue, { disabled: disabled ?? false, onSelect, selectedValues, sortable: !disabled && sortable, valueNode: valueNode.current, onChange }) : /* @__PURE__ */ jsxRuntimeExports.jsx(SingleSelectValue, { valueNode: checkbox && selectLabel ? {
|
|
36641
|
+
label: selectLabel,
|
|
36642
|
+
value: selectLabel
|
|
36643
|
+
} : valueNode.current.get(selectedValues[0]), value: selectedValues[0] }) }),
|
|
36639
36644
|
/* @__PURE__ */ jsxRuntimeExports.jsx(SvgImage, { name: "sort", size: "sm" })
|
|
36640
36645
|
] }),
|
|
36641
36646
|
form && /* @__PURE__ */ jsxRuntimeExports.jsx(HiddenSelectElement, { multiple, name: name2, form, value: selectedValues, onChange: () => null, children: list.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: item.value, disabled: item.disabled, children: item.value }, item.value)) }),
|
|
@@ -36657,8 +36662,16 @@ const InternalSelect = ({
|
|
|
36657
36662
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(SelectGroup, { ...groupProps, children: itemList.map(({
|
|
36658
36663
|
label: label2,
|
|
36659
36664
|
...itemProps
|
|
36660
|
-
}, itemIndex) =>
|
|
36665
|
+
}, itemIndex) => {
|
|
36666
|
+
if (checkbox) {
|
|
36667
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(MultiSelectCheckboxItem, { ...itemProps, children: label2 }, `select-${id}-group-${index2}-item-${itemIndex}`);
|
|
36668
|
+
}
|
|
36669
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { ...itemProps, children: label2 }, `select-${id}-group-${index2}-item-${itemIndex}`);
|
|
36670
|
+
}) }, `select-${id}-group-${index2}`);
|
|
36661
36671
|
} else {
|
|
36672
|
+
if (checkbox) {
|
|
36673
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(MultiSelectCheckboxItem, { ...props2 }, `select-${id}-item-${index2}`);
|
|
36674
|
+
}
|
|
36662
36675
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { ...props2 }, `select-${id}-item-${index2}`);
|
|
36663
36676
|
}
|
|
36664
36677
|
}) : children }) }),
|
|
@@ -36744,6 +36757,70 @@ const SelectItem = forwardRef(({
|
|
|
36744
36757
|
] });
|
|
36745
36758
|
});
|
|
36746
36759
|
SelectItem.displayName = "Select.Item";
|
|
36760
|
+
const MultiSelectCheckboxItem = forwardRef(({
|
|
36761
|
+
disabled = false,
|
|
36762
|
+
children,
|
|
36763
|
+
icon,
|
|
36764
|
+
iconDir = "end",
|
|
36765
|
+
label,
|
|
36766
|
+
onMouseOver: onMouseOverProp,
|
|
36767
|
+
onSelect: onSelectProp,
|
|
36768
|
+
separator,
|
|
36769
|
+
value = "",
|
|
36770
|
+
...props
|
|
36771
|
+
}, forwardedRef) => {
|
|
36772
|
+
const {
|
|
36773
|
+
highlighted,
|
|
36774
|
+
updateHighlighted,
|
|
36775
|
+
isHidden,
|
|
36776
|
+
selectedValues,
|
|
36777
|
+
onSelect
|
|
36778
|
+
} = useOption();
|
|
36779
|
+
const onSelectValue = () => {
|
|
36780
|
+
if (!disabled) {
|
|
36781
|
+
onSelect(value);
|
|
36782
|
+
if (typeof onSelectProp == "function") {
|
|
36783
|
+
onSelectProp(value);
|
|
36784
|
+
}
|
|
36785
|
+
}
|
|
36786
|
+
};
|
|
36787
|
+
const onMouseOver = (e) => {
|
|
36788
|
+
if (onMouseOverProp) {
|
|
36789
|
+
onMouseOverProp(e);
|
|
36790
|
+
}
|
|
36791
|
+
if (!disabled) {
|
|
36792
|
+
updateHighlighted(value);
|
|
36793
|
+
}
|
|
36794
|
+
};
|
|
36795
|
+
if (isHidden(value)) {
|
|
36796
|
+
return null;
|
|
36797
|
+
}
|
|
36798
|
+
const isChecked = selectedValues.includes(value);
|
|
36799
|
+
const onChange = () => {
|
|
36800
|
+
onSelect(value);
|
|
36801
|
+
};
|
|
36802
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
36803
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(GenericMenuItem, { ...props, "data-value": value, onClick: onSelectValue, onMouseOver, ref: forwardedRef, "data-disabled": disabled ? true : void 0, "data-highlighted": highlighted == value ? "true" : void 0, "data-testid": `multi-select-checkbox-${value}`, "cui-select-item": "", children: [
|
|
36804
|
+
icon && iconDir === "start" && /* @__PURE__ */ jsxRuntimeExports.jsx(Checkbox, { checked: isChecked, "data-testid": "multi-select-checkbox", disabled, label: label ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: {
|
|
36805
|
+
display: "flex",
|
|
36806
|
+
justifyContent: "center"
|
|
36807
|
+
}, children: [
|
|
36808
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SvgImage, { name: icon, size: "sm" }),
|
|
36809
|
+
label
|
|
36810
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: {
|
|
36811
|
+
display: "flex",
|
|
36812
|
+
justifyContent: "center"
|
|
36813
|
+
}, children: [
|
|
36814
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SvgImage, { name: icon, size: "sm" }),
|
|
36815
|
+
children
|
|
36816
|
+
] }), onClick: onChange }),
|
|
36817
|
+
icon && iconDir === "end" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconWrapper$3, { icon, iconDir: "end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Checkbox, { checked: isChecked, "data-testid": "multi-select-checkbox", disabled, label: label ?? children, onClick: onChange }) }),
|
|
36818
|
+
!icon && /* @__PURE__ */ jsxRuntimeExports.jsx(Checkbox, { checked: isChecked, "data-testid": "multi-select-checkbox", disabled, label: label ?? children, onClick: onChange })
|
|
36819
|
+
] }),
|
|
36820
|
+
separator && /* @__PURE__ */ jsxRuntimeExports.jsx(Separator$1, { size: "sm" })
|
|
36821
|
+
] });
|
|
36822
|
+
});
|
|
36823
|
+
MultiSelectCheckboxItem.displayName = "Select.Item";
|
|
36747
36824
|
const Select = ({
|
|
36748
36825
|
value: valueProp,
|
|
36749
36826
|
defaultValue,
|
|
@@ -36836,6 +36913,52 @@ const MultiSelect = ({
|
|
|
36836
36913
|
};
|
|
36837
36914
|
MultiSelect.Group = SelectGroup;
|
|
36838
36915
|
MultiSelect.Item = SelectItem;
|
|
36916
|
+
const CheckboxMultiSelect = ({
|
|
36917
|
+
value: valueProp,
|
|
36918
|
+
defaultValue,
|
|
36919
|
+
onSelect: onSelectProp,
|
|
36920
|
+
options,
|
|
36921
|
+
children,
|
|
36922
|
+
onOpenChange: onOpenChangeProp,
|
|
36923
|
+
selectLabel,
|
|
36924
|
+
...props
|
|
36925
|
+
}) => {
|
|
36926
|
+
const [selectedValues, setSelectedValues] = useState(valueProp ?? defaultValue ?? []);
|
|
36927
|
+
const [open2, setOpen] = useState(false);
|
|
36928
|
+
const onOpenChange = useCallback((open22) => {
|
|
36929
|
+
setOpen(open22);
|
|
36930
|
+
if (typeof onOpenChangeProp === "function") {
|
|
36931
|
+
onOpenChangeProp(open22);
|
|
36932
|
+
}
|
|
36933
|
+
}, [onOpenChangeProp]);
|
|
36934
|
+
useEffect(() => {
|
|
36935
|
+
setSelectedValues(valueProp ?? []);
|
|
36936
|
+
}, [valueProp]);
|
|
36937
|
+
const onChange = useCallback((values, type) => {
|
|
36938
|
+
setSelectedValues(values);
|
|
36939
|
+
if (typeof onSelectProp === "function") {
|
|
36940
|
+
onSelectProp(values, type);
|
|
36941
|
+
}
|
|
36942
|
+
}, [onSelectProp]);
|
|
36943
|
+
const onSelect = useCallback((value, type) => {
|
|
36944
|
+
let newValues = [];
|
|
36945
|
+
if (selectedValues.includes(value)) {
|
|
36946
|
+
newValues = selectedValues.filter((currentValue) => currentValue !== value);
|
|
36947
|
+
} else {
|
|
36948
|
+
newValues = [...selectedValues, value];
|
|
36949
|
+
}
|
|
36950
|
+
onChange(newValues, type);
|
|
36951
|
+
}, [onChange, selectedValues]);
|
|
36952
|
+
const conditionalProps = {};
|
|
36953
|
+
if (options) {
|
|
36954
|
+
conditionalProps.options = options;
|
|
36955
|
+
} else {
|
|
36956
|
+
conditionalProps.children = children;
|
|
36957
|
+
}
|
|
36958
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(InternalSelect, { onChange, value: selectedValues, open: open2, onOpenChange, onSelect, checkbox: true, selectLabel, ...conditionalProps, ...props });
|
|
36959
|
+
};
|
|
36960
|
+
CheckboxMultiSelect.Group = SelectGroup;
|
|
36961
|
+
CheckboxMultiSelect.Item = MultiSelectCheckboxItem;
|
|
36839
36962
|
const $89eedd556c436f6a$var$DEFAULT_ORIENTATION = "horizontal";
|
|
36840
36963
|
const $89eedd556c436f6a$var$ORIENTATIONS = [
|
|
36841
36964
|
"horizontal",
|
|
@@ -47628,6 +47751,7 @@ export {
|
|
|
47628
47751
|
CardPromotion,
|
|
47629
47752
|
CardSecondary,
|
|
47630
47753
|
Checkbox,
|
|
47754
|
+
CheckboxMultiSelect,
|
|
47631
47755
|
ClickUIProvider,
|
|
47632
47756
|
CodeBlock,
|
|
47633
47757
|
ConfirmationDialog,
|
package/dist/click-ui.umd.js
CHANGED
|
@@ -36486,6 +36486,8 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
|
|
|
36486
36486
|
sortable = false,
|
|
36487
36487
|
placeholder = "Select an option",
|
|
36488
36488
|
multiple,
|
|
36489
|
+
checkbox,
|
|
36490
|
+
selectLabel,
|
|
36489
36491
|
showSearch = false,
|
|
36490
36492
|
container,
|
|
36491
36493
|
...props
|
|
@@ -36652,7 +36654,10 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
|
|
|
36652
36654
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(FormElementContainer, { children: [
|
|
36653
36655
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(SelectPopoverRoot, { open: open2, onOpenChange, modal: true, children: [
|
|
36654
36656
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(StyledSelectTrigger, { id: id ?? defaultId, $error: !!error2, disabled, "data-testid": "select-trigger", children: [
|
|
36655
|
-
isInitialized && /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { children: selectedValues.length === 0 ? placeholder : multiple ? /* @__PURE__ */ jsxRuntimeExports.jsx(MultiSelectValue, { disabled: disabled ?? false, onSelect, selectedValues, sortable: !disabled && sortable, valueNode: valueNode.current, onChange }) : /* @__PURE__ */ jsxRuntimeExports.jsx(SingleSelectValue, { valueNode:
|
|
36657
|
+
isInitialized && /* @__PURE__ */ jsxRuntimeExports.jsx(SelectValue, { children: selectedValues.length === 0 ? placeholder : multiple ? /* @__PURE__ */ jsxRuntimeExports.jsx(MultiSelectValue, { disabled: disabled ?? false, onSelect, selectedValues, sortable: !disabled && sortable, valueNode: valueNode.current, onChange }) : /* @__PURE__ */ jsxRuntimeExports.jsx(SingleSelectValue, { valueNode: checkbox && selectLabel ? {
|
|
36658
|
+
label: selectLabel,
|
|
36659
|
+
value: selectLabel
|
|
36660
|
+
} : valueNode.current.get(selectedValues[0]), value: selectedValues[0] }) }),
|
|
36656
36661
|
/* @__PURE__ */ jsxRuntimeExports.jsx(SvgImage, { name: "sort", size: "sm" })
|
|
36657
36662
|
] }),
|
|
36658
36663
|
form && /* @__PURE__ */ jsxRuntimeExports.jsx(HiddenSelectElement, { multiple, name: name2, form, value: selectedValues, onChange: () => null, children: list.map((item) => /* @__PURE__ */ jsxRuntimeExports.jsx("option", { value: item.value, disabled: item.disabled, children: item.value }, item.value)) }),
|
|
@@ -36674,8 +36679,16 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
|
|
|
36674
36679
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(SelectGroup, { ...groupProps, children: itemList.map(({
|
|
36675
36680
|
label: label2,
|
|
36676
36681
|
...itemProps
|
|
36677
|
-
}, itemIndex) =>
|
|
36682
|
+
}, itemIndex) => {
|
|
36683
|
+
if (checkbox) {
|
|
36684
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(MultiSelectCheckboxItem, { ...itemProps, children: label2 }, `select-${id}-group-${index2}-item-${itemIndex}`);
|
|
36685
|
+
}
|
|
36686
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { ...itemProps, children: label2 }, `select-${id}-group-${index2}-item-${itemIndex}`);
|
|
36687
|
+
}) }, `select-${id}-group-${index2}`);
|
|
36678
36688
|
} else {
|
|
36689
|
+
if (checkbox) {
|
|
36690
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(MultiSelectCheckboxItem, { ...props2 }, `select-${id}-item-${index2}`);
|
|
36691
|
+
}
|
|
36679
36692
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { ...props2 }, `select-${id}-item-${index2}`);
|
|
36680
36693
|
}
|
|
36681
36694
|
}) : children }) }),
|
|
@@ -36761,6 +36774,70 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
|
|
|
36761
36774
|
] });
|
|
36762
36775
|
});
|
|
36763
36776
|
SelectItem.displayName = "Select.Item";
|
|
36777
|
+
const MultiSelectCheckboxItem = React.forwardRef(({
|
|
36778
|
+
disabled = false,
|
|
36779
|
+
children,
|
|
36780
|
+
icon,
|
|
36781
|
+
iconDir = "end",
|
|
36782
|
+
label,
|
|
36783
|
+
onMouseOver: onMouseOverProp,
|
|
36784
|
+
onSelect: onSelectProp,
|
|
36785
|
+
separator,
|
|
36786
|
+
value = "",
|
|
36787
|
+
...props
|
|
36788
|
+
}, forwardedRef) => {
|
|
36789
|
+
const {
|
|
36790
|
+
highlighted,
|
|
36791
|
+
updateHighlighted,
|
|
36792
|
+
isHidden,
|
|
36793
|
+
selectedValues,
|
|
36794
|
+
onSelect
|
|
36795
|
+
} = useOption();
|
|
36796
|
+
const onSelectValue = () => {
|
|
36797
|
+
if (!disabled) {
|
|
36798
|
+
onSelect(value);
|
|
36799
|
+
if (typeof onSelectProp == "function") {
|
|
36800
|
+
onSelectProp(value);
|
|
36801
|
+
}
|
|
36802
|
+
}
|
|
36803
|
+
};
|
|
36804
|
+
const onMouseOver = (e) => {
|
|
36805
|
+
if (onMouseOverProp) {
|
|
36806
|
+
onMouseOverProp(e);
|
|
36807
|
+
}
|
|
36808
|
+
if (!disabled) {
|
|
36809
|
+
updateHighlighted(value);
|
|
36810
|
+
}
|
|
36811
|
+
};
|
|
36812
|
+
if (isHidden(value)) {
|
|
36813
|
+
return null;
|
|
36814
|
+
}
|
|
36815
|
+
const isChecked = selectedValues.includes(value);
|
|
36816
|
+
const onChange = () => {
|
|
36817
|
+
onSelect(value);
|
|
36818
|
+
};
|
|
36819
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
36820
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(GenericMenuItem, { ...props, "data-value": value, onClick: onSelectValue, onMouseOver, ref: forwardedRef, "data-disabled": disabled ? true : void 0, "data-highlighted": highlighted == value ? "true" : void 0, "data-testid": `multi-select-checkbox-${value}`, "cui-select-item": "", children: [
|
|
36821
|
+
icon && iconDir === "start" && /* @__PURE__ */ jsxRuntimeExports.jsx(Checkbox, { checked: isChecked, "data-testid": "multi-select-checkbox", disabled, label: label ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: {
|
|
36822
|
+
display: "flex",
|
|
36823
|
+
justifyContent: "center"
|
|
36824
|
+
}, children: [
|
|
36825
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SvgImage, { name: icon, size: "sm" }),
|
|
36826
|
+
label
|
|
36827
|
+
] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: {
|
|
36828
|
+
display: "flex",
|
|
36829
|
+
justifyContent: "center"
|
|
36830
|
+
}, children: [
|
|
36831
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(SvgImage, { name: icon, size: "sm" }),
|
|
36832
|
+
children
|
|
36833
|
+
] }), onClick: onChange }),
|
|
36834
|
+
icon && iconDir === "end" && /* @__PURE__ */ jsxRuntimeExports.jsx(IconWrapper$3, { icon, iconDir: "end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Checkbox, { checked: isChecked, "data-testid": "multi-select-checkbox", disabled, label: label ?? children, onClick: onChange }) }),
|
|
36835
|
+
!icon && /* @__PURE__ */ jsxRuntimeExports.jsx(Checkbox, { checked: isChecked, "data-testid": "multi-select-checkbox", disabled, label: label ?? children, onClick: onChange })
|
|
36836
|
+
] }),
|
|
36837
|
+
separator && /* @__PURE__ */ jsxRuntimeExports.jsx(Separator$1, { size: "sm" })
|
|
36838
|
+
] });
|
|
36839
|
+
});
|
|
36840
|
+
MultiSelectCheckboxItem.displayName = "Select.Item";
|
|
36764
36841
|
const Select = ({
|
|
36765
36842
|
value: valueProp,
|
|
36766
36843
|
defaultValue,
|
|
@@ -36853,6 +36930,52 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
|
|
|
36853
36930
|
};
|
|
36854
36931
|
MultiSelect.Group = SelectGroup;
|
|
36855
36932
|
MultiSelect.Item = SelectItem;
|
|
36933
|
+
const CheckboxMultiSelect = ({
|
|
36934
|
+
value: valueProp,
|
|
36935
|
+
defaultValue,
|
|
36936
|
+
onSelect: onSelectProp,
|
|
36937
|
+
options: options2,
|
|
36938
|
+
children,
|
|
36939
|
+
onOpenChange: onOpenChangeProp,
|
|
36940
|
+
selectLabel,
|
|
36941
|
+
...props
|
|
36942
|
+
}) => {
|
|
36943
|
+
const [selectedValues, setSelectedValues] = React.useState(valueProp ?? defaultValue ?? []);
|
|
36944
|
+
const [open2, setOpen] = React.useState(false);
|
|
36945
|
+
const onOpenChange = React.useCallback((open22) => {
|
|
36946
|
+
setOpen(open22);
|
|
36947
|
+
if (typeof onOpenChangeProp === "function") {
|
|
36948
|
+
onOpenChangeProp(open22);
|
|
36949
|
+
}
|
|
36950
|
+
}, [onOpenChangeProp]);
|
|
36951
|
+
React.useEffect(() => {
|
|
36952
|
+
setSelectedValues(valueProp ?? []);
|
|
36953
|
+
}, [valueProp]);
|
|
36954
|
+
const onChange = React.useCallback((values, type) => {
|
|
36955
|
+
setSelectedValues(values);
|
|
36956
|
+
if (typeof onSelectProp === "function") {
|
|
36957
|
+
onSelectProp(values, type);
|
|
36958
|
+
}
|
|
36959
|
+
}, [onSelectProp]);
|
|
36960
|
+
const onSelect = React.useCallback((value, type) => {
|
|
36961
|
+
let newValues = [];
|
|
36962
|
+
if (selectedValues.includes(value)) {
|
|
36963
|
+
newValues = selectedValues.filter((currentValue) => currentValue !== value);
|
|
36964
|
+
} else {
|
|
36965
|
+
newValues = [...selectedValues, value];
|
|
36966
|
+
}
|
|
36967
|
+
onChange(newValues, type);
|
|
36968
|
+
}, [onChange, selectedValues]);
|
|
36969
|
+
const conditionalProps = {};
|
|
36970
|
+
if (options2) {
|
|
36971
|
+
conditionalProps.options = options2;
|
|
36972
|
+
} else {
|
|
36973
|
+
conditionalProps.children = children;
|
|
36974
|
+
}
|
|
36975
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(InternalSelect, { onChange, value: selectedValues, open: open2, onOpenChange, onSelect, checkbox: true, selectLabel, ...conditionalProps, ...props });
|
|
36976
|
+
};
|
|
36977
|
+
CheckboxMultiSelect.Group = SelectGroup;
|
|
36978
|
+
CheckboxMultiSelect.Item = MultiSelectCheckboxItem;
|
|
36856
36979
|
const $89eedd556c436f6a$var$DEFAULT_ORIENTATION = "horizontal";
|
|
36857
36980
|
const $89eedd556c436f6a$var$ORIENTATIONS = [
|
|
36858
36981
|
"horizontal",
|
|
@@ -47644,6 +47767,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
47644
47767
|
exports2.CardPromotion = CardPromotion;
|
|
47645
47768
|
exports2.CardSecondary = CardSecondary;
|
|
47646
47769
|
exports2.Checkbox = Checkbox;
|
|
47770
|
+
exports2.CheckboxMultiSelect = CheckboxMultiSelect;
|
|
47647
47771
|
exports2.ClickUIProvider = ClickUIProvider;
|
|
47648
47772
|
exports2.CodeBlock = CodeBlock;
|
|
47649
47773
|
exports2.ConfirmationDialog = ConfirmationDialog;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MultiSelectProps } from "..";
|
|
3
|
+
export interface CheckboxMultiSelectProps extends MultiSelectProps {
|
|
4
|
+
selectLabel?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const CheckboxMultiSelect: {
|
|
7
|
+
({ value: valueProp, defaultValue, onSelect: onSelectProp, options, children, onOpenChange: onOpenChangeProp, selectLabel, ...props }: CheckboxMultiSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
Group: import("react").ForwardRefExoticComponent<import("./common/types").SelectGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
Item: import("react").ForwardRefExoticComponent<import("./common/types").SelectItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
10
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SelectContainerProps, SelectGroupProps, SelectItemProps } from "./types";
|
|
3
|
-
export declare const InternalSelect: ({ label, children, orientation, dir, disabled, id, error, value: selectedValues, onChange, onSelect, open, onOpenChange, name, form, allowCreateOption, customText, options, sortable, placeholder, multiple, showSearch, container, ...props }: SelectContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export declare const InternalSelect: ({ label, children, orientation, dir, disabled, id, error, value: selectedValues, onChange, onSelect, open, onOpenChange, name, form, allowCreateOption, customText, options, sortable, placeholder, multiple, checkbox, selectLabel, showSearch, container, ...props }: SelectContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export declare const SelectGroup: import("react").ForwardRefExoticComponent<SelectGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
5
5
|
export declare const SelectItem: import("react").ForwardRefExoticComponent<SelectItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export declare const MultiSelectCheckboxItem: import("react").ForwardRefExoticComponent<SelectItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -60,6 +60,8 @@ interface InternalSelectProps extends PopoverProps, Omit<HTMLAttributes<HTMLDivE
|
|
|
60
60
|
sortable?: boolean;
|
|
61
61
|
onSelect: (value: string, type?: SelectionType) => void;
|
|
62
62
|
multiple?: boolean;
|
|
63
|
+
checkbox?: boolean;
|
|
64
|
+
selectLabel?: string;
|
|
63
65
|
placeholder?: string;
|
|
64
66
|
showSearch?: boolean;
|
|
65
67
|
customText?: string;
|
|
@@ -41,6 +41,7 @@ export { RadioGroup } from "./RadioGroup/RadioGroup";
|
|
|
41
41
|
export { SearchField } from "./Input/SearchField";
|
|
42
42
|
export { Select } from "./Select/SingleSelect";
|
|
43
43
|
export { MultiSelect } from "./Select/MultiSelect";
|
|
44
|
+
export { CheckboxMultiSelect } from "./Select/CheckboxMultiSelect";
|
|
44
45
|
export { default as Separator } from "./Separator/Separator";
|
|
45
46
|
export { SidebarNavigationItem } from "./SidebarNavigationItem/SidebarNavigationItem";
|
|
46
47
|
export { SidebarCollapsibleItem } from "./SidebarCollapsibleItem/SidebarCollapsibleItem";
|
|
@@ -32,6 +32,7 @@ export type { Menu, SplitButtonProps } from "./SplitButton/SplitButton";
|
|
|
32
32
|
export type { ToastProps } from "./Toast/Toast";
|
|
33
33
|
export type { SelectOptionListItem } from "./Select/common/types";
|
|
34
34
|
export type { MultiSelectProps } from "./Select/MultiSelect";
|
|
35
|
+
export type { CheckboxMultiSelectProps } from "./Select/CheckboxMultiSelect";
|
|
35
36
|
export type { PanelProps } from "./Panel/Panel";
|
|
36
37
|
export type { FlyoutProps, FlyoutFooterProps, FlyoutHeaderProps } from "./Flyout/Flyout";
|
|
37
38
|
export type { DialogContentProps } from "./Dialog/Dialog";
|