@clickhouse/click-ui 0.0.130 → 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.
@@ -1785,6 +1785,13 @@ const India = (props) => /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { xmlns:
1785
1785
  /* @__PURE__ */ jsxRuntimeExports.jsx("clipPath", { id: "indiaFlagClipPath2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "#fff", d: "M0 0h30v20H0z" }) })
1786
1786
  ] })
1787
1787
  ] });
1788
+ const Japan = (props) => /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "30", height: "20", viewBox: "0 0 30 20", fill: "none", ...props, children: [
1789
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("g", { clipPath: "url(#clip0_8004_401)", children: [
1790
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M30 0H0V20H30V0Z", fill: "white" }),
1791
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M15 16C18.3137 16 21 13.3137 21 10C21 6.68629 18.3137 4 15 4C11.6863 4 9 6.68629 9 10C9 13.3137 11.6863 16 15 16Z", fill: "#BC002D" })
1792
+ ] }),
1793
+ /* @__PURE__ */ jsxRuntimeExports.jsx("defs", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("clipPath", { id: "clip0_8004_401", children: /* @__PURE__ */ jsxRuntimeExports.jsx("rect", { width: "30", height: "20", fill: "white" }) }) })
1794
+ ] });
1788
1795
  const Netherlands = (props) => /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: 30, height: 20, viewBox: "0 0 30 20", fill: "none", ...props, children: [
1789
1796
  /* @__PURE__ */ jsxRuntimeExports.jsxs("g", { clipPath: "url(#netherlandsFlagClipPath)", children: [
1790
1797
  /* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "#21468B", d: "M30 0H0v20h30V0Z" }),
@@ -2262,6 +2269,7 @@ const FlagList = {
2262
2269
  gb: GreatBritain,
2263
2270
  ie: Ireland,
2264
2271
  in: India,
2272
+ jp: Japan,
2265
2273
  nl: Netherlands,
2266
2274
  sg: Singapore,
2267
2275
  za: SouthAfrica,
@@ -36461,6 +36469,8 @@ const InternalSelect = ({
36461
36469
  sortable = false,
36462
36470
  placeholder = "Select an option",
36463
36471
  multiple,
36472
+ checkbox,
36473
+ selectLabel,
36464
36474
  showSearch = false,
36465
36475
  container,
36466
36476
  ...props
@@ -36627,7 +36637,10 @@ const InternalSelect = ({
36627
36637
  /* @__PURE__ */ jsxRuntimeExports.jsxs(FormElementContainer, { children: [
36628
36638
  /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectPopoverRoot, { open: open2, onOpenChange, modal: true, children: [
36629
36639
  /* @__PURE__ */ jsxRuntimeExports.jsxs(StyledSelectTrigger, { id: id ?? defaultId, $error: !!error2, disabled, "data-testid": "select-trigger", children: [
36630
- 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: valueNode.current.get(selectedValues[0]), value: selectedValues[0] }) }),
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] }) }),
36631
36644
  /* @__PURE__ */ jsxRuntimeExports.jsx(SvgImage, { name: "sort", size: "sm" })
36632
36645
  ] }),
36633
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)) }),
@@ -36649,8 +36662,16 @@ const InternalSelect = ({
36649
36662
  return /* @__PURE__ */ jsxRuntimeExports.jsx(SelectGroup, { ...groupProps, children: itemList.map(({
36650
36663
  label: label2,
36651
36664
  ...itemProps
36652
- }, itemIndex) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { ...itemProps, children: label2 }, `select-${id}-group-${index2}-item-${itemIndex}`)) }, `select-${id}-group-${index2}`);
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}`);
36653
36671
  } else {
36672
+ if (checkbox) {
36673
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(MultiSelectCheckboxItem, { ...props2 }, `select-${id}-item-${index2}`);
36674
+ }
36654
36675
  return /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { ...props2 }, `select-${id}-item-${index2}`);
36655
36676
  }
36656
36677
  }) : children }) }),
@@ -36736,6 +36757,70 @@ const SelectItem = forwardRef(({
36736
36757
  ] });
36737
36758
  });
36738
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";
36739
36824
  const Select = ({
36740
36825
  value: valueProp,
36741
36826
  defaultValue,
@@ -36828,6 +36913,52 @@ const MultiSelect = ({
36828
36913
  };
36829
36914
  MultiSelect.Group = SelectGroup;
36830
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;
36831
36962
  const $89eedd556c436f6a$var$DEFAULT_ORIENTATION = "horizontal";
36832
36963
  const $89eedd556c436f6a$var$ORIENTATIONS = [
36833
36964
  "horizontal",
@@ -47620,6 +47751,7 @@ export {
47620
47751
  CardPromotion,
47621
47752
  CardSecondary,
47622
47753
  Checkbox,
47754
+ CheckboxMultiSelect,
47623
47755
  ClickUIProvider,
47624
47756
  CodeBlock,
47625
47757
  ConfirmationDialog,
@@ -1802,6 +1802,13 @@ var __publicField = (obj, key, value) => {
1802
1802
  /* @__PURE__ */ jsxRuntimeExports.jsx("clipPath", { id: "indiaFlagClipPath2", children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "#fff", d: "M0 0h30v20H0z" }) })
1803
1803
  ] })
1804
1804
  ] });
1805
+ const Japan = (props) => /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "30", height: "20", viewBox: "0 0 30 20", fill: "none", ...props, children: [
1806
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("g", { clipPath: "url(#clip0_8004_401)", children: [
1807
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M30 0H0V20H30V0Z", fill: "white" }),
1808
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M15 16C18.3137 16 21 13.3137 21 10C21 6.68629 18.3137 4 15 4C11.6863 4 9 6.68629 9 10C9 13.3137 11.6863 16 15 16Z", fill: "#BC002D" })
1809
+ ] }),
1810
+ /* @__PURE__ */ jsxRuntimeExports.jsx("defs", { children: /* @__PURE__ */ jsxRuntimeExports.jsx("clipPath", { id: "clip0_8004_401", children: /* @__PURE__ */ jsxRuntimeExports.jsx("rect", { width: "30", height: "20", fill: "white" }) }) })
1811
+ ] });
1805
1812
  const Netherlands = (props) => /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: 30, height: 20, viewBox: "0 0 30 20", fill: "none", ...props, children: [
1806
1813
  /* @__PURE__ */ jsxRuntimeExports.jsxs("g", { clipPath: "url(#netherlandsFlagClipPath)", children: [
1807
1814
  /* @__PURE__ */ jsxRuntimeExports.jsx("path", { fill: "#21468B", d: "M30 0H0v20h30V0Z" }),
@@ -2279,6 +2286,7 @@ var __publicField = (obj, key, value) => {
2279
2286
  gb: GreatBritain,
2280
2287
  ie: Ireland,
2281
2288
  in: India,
2289
+ jp: Japan,
2282
2290
  nl: Netherlands,
2283
2291
  sg: Singapore,
2284
2292
  za: SouthAfrica,
@@ -36478,6 +36486,8 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
36478
36486
  sortable = false,
36479
36487
  placeholder = "Select an option",
36480
36488
  multiple,
36489
+ checkbox,
36490
+ selectLabel,
36481
36491
  showSearch = false,
36482
36492
  container,
36483
36493
  ...props
@@ -36644,7 +36654,10 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
36644
36654
  /* @__PURE__ */ jsxRuntimeExports.jsxs(FormElementContainer, { children: [
36645
36655
  /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectPopoverRoot, { open: open2, onOpenChange, modal: true, children: [
36646
36656
  /* @__PURE__ */ jsxRuntimeExports.jsxs(StyledSelectTrigger, { id: id ?? defaultId, $error: !!error2, disabled, "data-testid": "select-trigger", children: [
36647
- 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: valueNode.current.get(selectedValues[0]), value: selectedValues[0] }) }),
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] }) }),
36648
36661
  /* @__PURE__ */ jsxRuntimeExports.jsx(SvgImage, { name: "sort", size: "sm" })
36649
36662
  ] }),
36650
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)) }),
@@ -36666,8 +36679,16 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
36666
36679
  return /* @__PURE__ */ jsxRuntimeExports.jsx(SelectGroup, { ...groupProps, children: itemList.map(({
36667
36680
  label: label2,
36668
36681
  ...itemProps
36669
- }, itemIndex) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { ...itemProps, children: label2 }, `select-${id}-group-${index2}-item-${itemIndex}`)) }, `select-${id}-group-${index2}`);
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}`);
36670
36688
  } else {
36689
+ if (checkbox) {
36690
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(MultiSelectCheckboxItem, { ...props2 }, `select-${id}-item-${index2}`);
36691
+ }
36671
36692
  return /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { ...props2 }, `select-${id}-item-${index2}`);
36672
36693
  }
36673
36694
  }) : children }) }),
@@ -36753,6 +36774,70 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
36753
36774
  ] });
36754
36775
  });
36755
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";
36756
36841
  const Select = ({
36757
36842
  value: valueProp,
36758
36843
  defaultValue,
@@ -36845,6 +36930,52 @@ Please read the updated README.md at https://github.com/SortableJS/react-sortabl
36845
36930
  };
36846
36931
  MultiSelect.Group = SelectGroup;
36847
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;
36848
36979
  const $89eedd556c436f6a$var$DEFAULT_ORIENTATION = "horizontal";
36849
36980
  const $89eedd556c436f6a$var$ORIENTATIONS = [
36850
36981
  "horizontal",
@@ -47636,6 +47767,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
47636
47767
  exports2.CardPromotion = CardPromotion;
47637
47768
  exports2.CardSecondary = CardSecondary;
47638
47769
  exports2.Checkbox = Checkbox;
47770
+ exports2.CheckboxMultiSelect = CheckboxMultiSelect;
47639
47771
  exports2.ClickUIProvider = ClickUIProvider;
47640
47772
  exports2.CodeBlock = CodeBlock;
47641
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;
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ declare const Japan: (props: React.SVGAttributes<SVGElement>) => React.ReactElement;
3
+ export default Japan;
@@ -1,6 +1,6 @@
1
1
  import { SVGAttributes } from "react";
2
2
  import { IconSize } from '../../../components/Icon/types';
3
- export type FlagName = "au" | "br" | "ca" | "de" | "eu" | "gb" | "in" | "ie" | "nl" | "sg" | "sw" | "usa" | "uk" | "za";
3
+ export type FlagName = "au" | "br" | "ca" | "de" | "eu" | "gb" | "in" | "ie" | "jp" | "nl" | "sg" | "sw" | "usa" | "uk" | "za";
4
4
  export interface FlagProps extends Omit<SVGAttributes<SVGElement>, "size"> {
5
5
  name: FlagName;
6
6
  size?: IconSize;
@@ -14,6 +14,7 @@ export declare const FlagList: {
14
14
  gb: (props: SVGAttributes<SVGElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
15
15
  ie: (props: SVGAttributes<SVGElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
16
16
  in: (props: SVGAttributes<SVGElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
17
+ jp: (props: SVGAttributes<SVGElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
17
18
  nl: (props: SVGAttributes<SVGElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
18
19
  sg: (props: SVGAttributes<SVGElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
19
20
  za: (props: SVGAttributes<SVGElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
@@ -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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clickhouse/click-ui",
3
- "version": "0.0.130",
3
+ "version": "0.0.132",
4
4
  "description": "Official ClickHouse design system react library",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",