@bioturing/components 0.30.0 → 0.32.0

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.
Files changed (36) hide show
  1. package/dist/components/choice-list/component.js +26 -28
  2. package/dist/components/choice-list/component.js.map +1 -1
  3. package/dist/components/code-block/component.js +10 -10
  4. package/dist/components/combobox/component.js +148 -143
  5. package/dist/components/combobox/component.js.map +1 -1
  6. package/dist/components/command-palette/component.js +79 -0
  7. package/dist/components/command-palette/component.js.map +1 -0
  8. package/dist/components/command-palette/style.css +1 -0
  9. package/dist/components/dropdown-menu/component.js +119 -189
  10. package/dist/components/dropdown-menu/component.js.map +1 -1
  11. package/dist/components/dropdown-menu/item.css +1 -1
  12. package/dist/components/dropdown-menu/item.js +82 -60
  13. package/dist/components/dropdown-menu/item.js.map +1 -1
  14. package/dist/components/dropdown-menu/style.css +1 -1
  15. package/dist/components/dropdown-menu/useDropdownMenu.js +127 -0
  16. package/dist/components/dropdown-menu/useDropdownMenu.js.map +1 -0
  17. package/dist/components/input/component.js +24 -23
  18. package/dist/components/input/component.js.map +1 -1
  19. package/dist/components/keyboard-shortcut/component.js +72 -0
  20. package/dist/components/keyboard-shortcut/component.js.map +1 -0
  21. package/dist/components/keyboard-shortcut/style.css +1 -0
  22. package/dist/components/loader/component.js +15 -0
  23. package/dist/components/loader/component.js.map +1 -0
  24. package/dist/components/loader/style.css +1 -0
  25. package/dist/components/popup-panel/style.css +1 -1
  26. package/dist/components/scroll-area/component.js +83 -64
  27. package/dist/components/scroll-area/component.js.map +1 -1
  28. package/dist/components/select/component.js.map +1 -1
  29. package/dist/components/theme-provider/style.css +1 -1
  30. package/dist/components/toast/style.css +1 -1
  31. package/dist/index.d.ts +236 -66
  32. package/dist/index.js +203 -197
  33. package/dist/index.js.map +1 -1
  34. package/dist/metadata.js +47 -2
  35. package/dist/metadata.js.map +1 -1
  36. package/package.json +2 -2
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import { jsxs as p, jsx as t } from "react/jsx-runtime";
2
+ import { jsxs as v, jsx as t } from "react/jsx-runtime";
3
3
  import { Command as d } from "../cmdk/index.js";
4
- import { useMemo as P, useContext as v, useCallback as b } from "react";
5
- import './style.css';/* empty css */
4
+ import { useMemo as P, useContext as b, useCallback as p } from "react";
6
5
  import { FormItemInputContext as x } from "antd/es/form/context";
7
6
  import R from "antd/es/config-provider/DisabledContext";
7
+ import './style.css';/* empty css */
8
8
  import { Radio as T } from "../radio/component.js";
9
9
  import { useControlledState as q } from "../hooks/useControlledState.js";
10
10
  import { useCls as w } from "../utils/antdUtils.js";
@@ -14,7 +14,7 @@ import { Checkbox as S } from "../checkbox/component.js";
14
14
  import { ScrollArea as H } from "../scroll-area/component.js";
15
15
  import { reactNodeToString as J } from "../utils/reactToString.js";
16
16
  const ae = ({
17
- items: i,
17
+ options: i,
18
18
  multiple: a,
19
19
  value: g,
20
20
  defaultValue: C,
@@ -28,25 +28,23 @@ const ae = ({
28
28
  getItemKeywords: m,
29
29
  ...j
30
30
  }) => {
31
- const [l, c] = q(
31
+ const [l, n] = q(
32
32
  g,
33
33
  A,
34
34
  C
35
- ), s = P(() => a ? Array.isArray(l) ? l : l ? [l] : [] : Array.isArray(l) ? l.length > 0 ? [l[0]] : [] : l ? [l] : [], [l, a]), {
36
- status: B
37
- } = v(x), E = v(R), F = V || B, o = D || E, n = w(), L = b(() => {
35
+ ), s = P(() => a ? Array.isArray(l) ? l : l ? [l] : [] : Array.isArray(l) ? l.length > 0 ? [l[0]] : [] : l ? [l] : [], [l, a]), { status: B } = b(x), E = b(R), F = V || B, c = D || E, o = w(), L = p(() => {
38
36
  if (a) {
39
37
  const e = i.map((r) => r.value).filter(Boolean);
40
- c(e);
38
+ n(e);
41
39
  }
42
- }, [a, i, c]), M = b(() => {
43
- a && c([]);
44
- }, [a, c]);
45
- return /* @__PURE__ */ p(
40
+ }, [a, i, n]), M = p(() => {
41
+ a && n([]);
42
+ }, [a, n]);
43
+ return /* @__PURE__ */ v(
46
44
  d,
47
45
  {
48
- className: z(n("choice-list"), N),
49
- "data-disabled": o,
46
+ className: z(o("choice-list"), N),
47
+ "data-disabled": c,
50
48
  "data-status": F,
51
49
  ...j,
52
50
  children: [
@@ -59,8 +57,8 @@ const ae = ({
59
57
  G.Search,
60
58
  {
61
59
  allowClear: !0,
62
- disabled: o,
63
- className: n("choice-list-search"),
60
+ disabled: c,
61
+ className: o("choice-list-search"),
64
62
  placeholder: y
65
63
  }
66
64
  )
@@ -75,9 +73,9 @@ const ae = ({
75
73
  return /* @__PURE__ */ t(
76
74
  "div",
77
75
  {
78
- className: n("choice-list-item"),
76
+ className: o("choice-list-item"),
79
77
  onClick: () => {
80
- o || (h || u ? M() : L());
78
+ c || (h || u ? M() : L());
81
79
  },
82
80
  children: /* @__PURE__ */ t(
83
81
  S,
@@ -85,31 +83,31 @@ const ae = ({
85
83
  tabIndex: -1,
86
84
  checked: u,
87
85
  indeterminate: h,
88
- disabled: o,
86
+ disabled: c,
89
87
  children: "Select All"
90
88
  }
91
89
  )
92
90
  }
93
91
  );
94
92
  })(),
95
- /* @__PURE__ */ t(H, { className: n("choice-list-items"), fadeEdges: !0, children: /* @__PURE__ */ p(d.List, { children: [
96
- /* @__PURE__ */ t(d.Empty, { className: n("choice-list-empty"), children: "No results found." }),
93
+ /* @__PURE__ */ t(H, { className: o("choice-list-items"), fadeEdges: !0, children: /* @__PURE__ */ v(d.List, { children: [
94
+ /* @__PURE__ */ t(d.Empty, { className: o("choice-list-empty"), children: "No results found." }),
97
95
  i.map((e) => /* @__PURE__ */ t(
98
96
  d.Item,
99
97
  {
100
- className: n("choice-list-item"),
98
+ className: o("choice-list-item"),
101
99
  keywords: m ? m(e) : [e.value || "", J(e.label)],
102
100
  value: e.value,
103
101
  "data-in-choice": e.value ? s.includes(e.value) : !1,
104
102
  onSelect: (r) => {
105
- if (!o)
103
+ if (!c)
106
104
  if (a) {
107
105
  const u = s.includes(r) ? s.filter((h) => h !== r) : [.../* @__PURE__ */ new Set([...s, r])];
108
- c(
106
+ n(
109
107
  u
110
108
  );
111
109
  } else
112
- c(
110
+ n(
113
111
  r
114
112
  );
115
113
  },
@@ -118,7 +116,7 @@ const ae = ({
118
116
  {
119
117
  tabIndex: -1,
120
118
  checked: e.value ? s.includes(e.value) : !1,
121
- disabled: o,
119
+ disabled: c,
122
120
  children: e.label
123
121
  }
124
122
  ) : /* @__PURE__ */ t(
@@ -126,7 +124,7 @@ const ae = ({
126
124
  {
127
125
  tabIndex: -1,
128
126
  checked: e.value ? s.includes(e.value) : !1,
129
- disabled: o,
127
+ disabled: c,
130
128
  children: e.label
131
129
  }
132
130
  )
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sources":["../../../src/components/choice-list/component.tsx"],"sourcesContent":["\"use client\";\nimport { Command, CommandProps } from \"../cmdk\";\nimport { Input } from \"../input\";\nimport { useCallback, useMemo, useContext } from \"react\";\nimport { useCls, cn, reactNodeToString } from \"../utils\";\nimport { useControlledState } from \"../hooks\";\nimport { Radio } from \"../radio\";\nimport { Checkbox } from \"../checkbox\";\nimport { ScrollArea } from \"../scroll-area\";\n\nimport \"./style.css\";\nimport { FormItemInputContext } from \"antd/es/form/context\";\nimport DisabledContext from \"antd/es/config-provider/DisabledContext\";\n\nexport type ChoiceListItem = {\n label: React.ReactNode;\n value?: string;\n};\n\nexport interface ChoiceListProps<M extends boolean = false>\n extends Omit<CommandProps, \"value\" | \"onChange\" | \"defaultValue\"> {\n items: ChoiceListItem[];\n multiple?: M;\n value?: M extends true ? string[] : string;\n defaultValue?: M extends true ? string[] : string;\n onChange?: (value: M extends true ? string[] : string) => void;\n searchProps?: React.ComponentProps<typeof Command.Input>;\n /**\n * Show select all option when in multiple mode\n * @default false\n */\n showSelectAll?: boolean;\n placeholder?: string;\n /**\n * Whether the choice list is disabled\n * @default false\n */\n disabled?: boolean;\n /**\n * Validation status\n */\n status?: \"error\" | \"warning\" | \"success\" | \"validating\";\n /**\n * Function to extract keywords from the item for search filtering\n * @default (item) => [item.value, reactNodeToString(item.label)]\n */\n getItemKeywords?: (item: ChoiceListItem) => string[];\n}\n\nexport const ChoiceList = <M extends boolean = false>({\n items,\n multiple,\n value,\n defaultValue,\n onChange,\n searchProps = { placeholder: \"Search...\" },\n showSelectAll = false,\n className,\n placeholder = \"Search\",\n disabled: disabledProp = false,\n status: statusProp,\n getItemKeywords,\n ...rest\n}: ChoiceListProps<M>) => {\n const [internalValue, setInternalValue] = useControlledState(\n value,\n onChange,\n defaultValue,\n );\n\n const usedValue = useMemo(() => {\n if (multiple) {\n // Ensure we always return an array for multiple mode\n if (Array.isArray(internalValue)) {\n return internalValue;\n }\n return internalValue ? [internalValue as string] : [];\n } else {\n // For single mode, convert to array for consistent usage\n if (Array.isArray(internalValue)) {\n return internalValue.length > 0 ? [internalValue[0]] : [];\n }\n return internalValue ? [internalValue as string] : [];\n }\n }, [internalValue, multiple]);\n\n // Get form context values\n const {\n status: contextStatus,\n } = useContext(FormItemInputContext);\n const contextDisabled = useContext(DisabledContext);\n\n // Merge context values with props\n const mergedStatus = statusProp || contextStatus;\n const disabled = disabledProp || contextDisabled;\n\n const cls = useCls();\n\n const handleSelectAll = useCallback(() => {\n if (multiple) {\n const allValues = items\n .map((item) => item.value)\n .filter(Boolean) as string[];\n setInternalValue(allValues as M extends true ? string[] : string);\n }\n }, [multiple, items, setInternalValue]);\n\n const handleDeselectAll = useCallback(() => {\n if (multiple) {\n setInternalValue([] as M extends true ? string[] : string);\n }\n }, [multiple, setInternalValue]);\n\n return (\n <Command \n className={cn(cls(\"choice-list\"), className)} \n data-disabled={disabled}\n data-status={mergedStatus}\n {...rest}\n >\n <FormItemInputContext.Provider value={{}}>\n <Command.Input\n render={\n // isolate the input from the form context\n <Input.Search\n allowClear\n disabled={disabled}\n className={cls(\"choice-list-search\")}\n placeholder={placeholder}\n />\n }\n {...searchProps}\n />\n </FormItemInputContext.Provider>\n {showSelectAll &&\n multiple &&\n items.length > 0 &&\n (() => {\n const allValues = items\n .map((item) => item.value)\n .filter(Boolean) as string[];\n const selectedFromAll = usedValue.filter((val) =>\n allValues.includes(val),\n );\n const checked =\n selectedFromAll.length === allValues.length && allValues.length > 0;\n const indeterminate =\n selectedFromAll.length > 0 &&\n selectedFromAll.length < allValues.length;\n\n return (\n <div\n className={cls(\"choice-list-item\")}\n onClick={() => {\n if (disabled) return;\n if (indeterminate || checked) {\n handleDeselectAll();\n } else {\n handleSelectAll();\n }\n }}\n >\n <Checkbox\n tabIndex={-1}\n checked={checked}\n indeterminate={indeterminate}\n disabled={disabled}\n >\n Select All\n </Checkbox>\n </div>\n );\n })()}\n <ScrollArea className={cls(\"choice-list-items\")} fadeEdges>\n <Command.List>\n <Command.Empty className={cls(\"choice-list-empty\")}>\n No results found.\n </Command.Empty>\n {items.map((item) => (\n <Command.Item\n key={item.value}\n className={cls(\"choice-list-item\")}\n keywords={getItemKeywords ? getItemKeywords(item) : [item.value || '', reactNodeToString(item.label)]}\n value={item.value}\n data-in-choice={item.value ? usedValue.includes(item.value) : false}\n onSelect={(newValue) => {\n if (disabled) return;\n if (multiple) {\n const newValues = usedValue.includes(newValue)\n ? usedValue.filter((value) => value !== newValue)\n : [...new Set([...usedValue, newValue])];\n setInternalValue(\n newValues as M extends true ? string[] : string,\n );\n } else {\n setInternalValue(\n newValue as M extends true ? string[] : string,\n );\n }\n }}\n >\n {multiple ? (\n <Checkbox\n tabIndex={-1}\n checked={item.value ? usedValue.includes(item.value) : false}\n disabled={disabled}\n >\n {item.label}\n </Checkbox>\n ) : (\n <Radio \n tabIndex={-1} \n checked={item.value ? usedValue.includes(item.value) : false}\n disabled={disabled}\n >\n {item.label}\n </Radio>\n )}\n </Command.Item>\n ))}\n </Command.List>\n </ScrollArea>\n </Command>\n );\n};\n"],"names":["ChoiceList","items","multiple","value","defaultValue","onChange","searchProps","showSelectAll","className","placeholder","disabledProp","statusProp","getItemKeywords","rest","internalValue","setInternalValue","useControlledState","usedValue","useMemo","contextStatus","useContext","FormItemInputContext","contextDisabled","DisabledContext","mergedStatus","disabled","cls","useCls","handleSelectAll","useCallback","allValues","item","handleDeselectAll","jsxs","Command","cn","jsx","Input","selectedFromAll","val","checked","indeterminate","Checkbox","ScrollArea","reactNodeToString","newValue","newValues","Radio"],"mappings":";;;;;;;;;;;;;;;AAiDO,MAAMA,KAAa,CAA4B;AAAA,EACpD,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC,IAAc,EAAE,aAAa,YAAY;AAAA,EACzC,eAAAC,IAAgB;AAAA,EAChB,WAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,UAAUC,IAAe;AAAA,EACzB,QAAQC;AAAA,EACR,iBAAAC;AAAA,EACA,GAAGC;AACL,MAA0B;AAClB,QAAA,CAACC,GAAeC,CAAgB,IAAIC;AAAA,IACxCb;AAAA,IACAE;AAAA,IACAD;AAAA,EACF,GAEMa,IAAYC,EAAQ,MACpBhB,IAEE,MAAM,QAAQY,CAAa,IACtBA,IAEFA,IAAgB,CAACA,CAAuB,IAAI,CAAC,IAGhD,MAAM,QAAQA,CAAa,IACtBA,EAAc,SAAS,IAAI,CAACA,EAAc,CAAC,CAAC,IAAI,CAAC,IAEnDA,IAAgB,CAACA,CAAuB,IAAI,CAAC,GAErD,CAACA,GAAeZ,CAAQ,CAAC,GAGtB;AAAA,IACJ,QAAQiB;AAAA,EAAA,IACNC,EAAWC,CAAoB,GAC7BC,IAAkBF,EAAWG,CAAe,GAG5CC,IAAeb,KAAcQ,GAC7BM,IAAWf,KAAgBY,GAE3BI,IAAMC,EAAO,GAEbC,IAAkBC,EAAY,MAAM;AACxC,QAAI3B,GAAU;AACN,YAAA4B,IAAY7B,EACf,IAAI,CAAC8B,MAASA,EAAK,KAAK,EACxB,OAAO,OAAO;AACjB,MAAAhB,EAAiBe,CAA+C;AAAA,IAAA;AAAA,EAEjE,GAAA,CAAC5B,GAAUD,GAAOc,CAA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A,gBAAA;AAAA,kBACC,UAAU;AAAA,kBACV,SAAShB,EAAK,QAAQd,EAAU,SAASc,EAAK,KAAK,IAAI;AAAA,kBACvD,UAAAN;AAAA,kBAEC,UAAKM,EAAA;AAAA,gBAAA;AAAA,cAAA;AAAA,YACR;AAAA,YApCGA,EAAK;AAAA,UAuCb,CAAA;AAAA,QAAA,EAAA,CACH,EACF,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
1
+ {"version":3,"file":"component.js","sources":["../../../src/components/choice-list/component.tsx"],"sourcesContent":["\"use client\";\nimport { Command, CommandProps } from \"../cmdk\";\nimport { Input } from \"../input\";\nimport { useCallback, useMemo, useContext } from \"react\";\nimport { useCls, cn, reactNodeToString } from \"../utils\";\nimport { useControlledState } from \"../hooks\";\nimport { Radio } from \"../radio\";\nimport { Checkbox } from \"../checkbox\";\nimport { ScrollArea } from \"../scroll-area\";\n\nimport { FormItemInputContext } from \"antd/es/form/context\";\nimport DisabledContext from \"antd/es/config-provider/DisabledContext\";\n\nexport type ChoiceListOption = {\n label: React.ReactNode;\n value?: string;\n};\n\nimport \"./style.css\";\n\nexport interface ChoiceListProps<M extends boolean = false>\n extends Omit<CommandProps, \"value\" | \"onChange\" | \"defaultValue\"> {\n options: ChoiceListOption[];\n multiple?: M;\n value?: M extends true ? string[] : string;\n defaultValue?: M extends true ? string[] : string;\n onChange?: (value: M extends true ? string[] : string) => void;\n searchProps?: React.ComponentProps<typeof Command.Input>;\n /**\n * Show select all option when in multiple mode\n * @default false\n */\n showSelectAll?: boolean;\n placeholder?: string;\n /**\n * Whether the choice list is disabled\n * @default false\n */\n disabled?: boolean;\n /**\n * Validation status\n */\n status?: \"error\" | \"warning\" | \"success\" | \"validating\";\n /**\n * Function to extract keywords from the item for search filtering\n * @default (item) => [item.value, reactNodeToString(item.label)]\n */\n getItemKeywords?: (item: ChoiceListOption) => string[];\n}\n\nexport const ChoiceList = <M extends boolean = false>({\n options,\n multiple,\n value,\n defaultValue,\n onChange,\n searchProps = { placeholder: \"Search...\" },\n showSelectAll = false,\n className,\n placeholder = \"Search\",\n disabled: disabledProp = false,\n status: statusProp,\n getItemKeywords,\n ...rest\n}: ChoiceListProps<M>) => {\n const [internalValue, setInternalValue] = useControlledState(\n value,\n onChange,\n defaultValue\n );\n\n const usedValue = useMemo(() => {\n if (multiple) {\n // Ensure we always return an array for multiple mode\n if (Array.isArray(internalValue)) {\n return internalValue;\n }\n return internalValue ? [internalValue as string] : [];\n } else {\n // For single mode, convert to array for consistent usage\n if (Array.isArray(internalValue)) {\n return internalValue.length > 0 ? [internalValue[0]] : [];\n }\n return internalValue ? [internalValue as string] : [];\n }\n }, [internalValue, multiple]);\n\n // Get form context values\n const { status: contextStatus } = useContext(FormItemInputContext);\n const contextDisabled = useContext(DisabledContext);\n\n // Merge context values with props\n const mergedStatus = statusProp || contextStatus;\n const disabled = disabledProp || contextDisabled;\n\n const cls = useCls();\n\n const handleSelectAll = useCallback(() => {\n if (multiple) {\n const allValues = options\n .map((item) => item.value)\n .filter(Boolean) as string[];\n setInternalValue(allValues as M extends true ? string[] : string);\n }\n }, [multiple, options, setInternalValue]);\n\n const handleDeselectAll = useCallback(() => {\n if (multiple) {\n setInternalValue([] as M extends true ? string[] : string);\n }\n }, [multiple, setInternalValue]);\n\n return (\n <Command\n className={cn(cls(\"choice-list\"), className)}\n data-disabled={disabled}\n data-status={mergedStatus}\n {...rest}\n >\n <FormItemInputContext.Provider value={{}}>\n <Command.Input\n render={\n // isolate the input from the form context\n <Input.Search\n allowClear\n disabled={disabled}\n className={cls(\"choice-list-search\")}\n placeholder={placeholder}\n />\n }\n {...searchProps}\n />\n </FormItemInputContext.Provider>\n {showSelectAll &&\n multiple &&\n options.length > 0 &&\n (() => {\n const allValues = options\n .map((item) => item.value)\n .filter(Boolean) as string[];\n const selectedFromAll = usedValue.filter((val) =>\n allValues.includes(val)\n );\n const checked =\n selectedFromAll.length === allValues.length && allValues.length > 0;\n const indeterminate =\n selectedFromAll.length > 0 &&\n selectedFromAll.length < allValues.length;\n\n return (\n <div\n className={cls(\"choice-list-item\")}\n onClick={() => {\n if (disabled) return;\n if (indeterminate || checked) {\n handleDeselectAll();\n } else {\n handleSelectAll();\n }\n }}\n >\n <Checkbox\n tabIndex={-1}\n checked={checked}\n indeterminate={indeterminate}\n disabled={disabled}\n >\n Select All\n </Checkbox>\n </div>\n );\n })()}\n <ScrollArea className={cls(\"choice-list-items\")} fadeEdges>\n <Command.List>\n <Command.Empty className={cls(\"choice-list-empty\")}>\n No results found.\n </Command.Empty>\n {options.map((item) => (\n <Command.Item\n key={item.value}\n className={cls(\"choice-list-item\")}\n keywords={\n getItemKeywords\n ? getItemKeywords(item)\n : [item.value || \"\", reactNodeToString(item.label)]\n }\n value={item.value}\n data-in-choice={\n item.value ? usedValue.includes(item.value) : false\n }\n onSelect={(newValue) => {\n if (disabled) return;\n if (multiple) {\n const newValues = usedValue.includes(newValue)\n ? usedValue.filter((value) => value !== newValue)\n : [...new Set([...usedValue, newValue])];\n setInternalValue(\n newValues as M extends true ? string[] : string\n );\n } else {\n setInternalValue(\n newValue as M extends true ? string[] : string\n );\n }\n }}\n >\n {multiple ? (\n <Checkbox\n tabIndex={-1}\n checked={item.value ? usedValue.includes(item.value) : false}\n disabled={disabled}\n >\n {item.label}\n </Checkbox>\n ) : (\n <Radio\n tabIndex={-1}\n checked={item.value ? usedValue.includes(item.value) : false}\n disabled={disabled}\n >\n {item.label}\n </Radio>\n )}\n </Command.Item>\n ))}\n </Command.List>\n </ScrollArea>\n </Command>\n );\n};\n"],"names":["ChoiceList","options","multiple","value","defaultValue","onChange","searchProps","showSelectAll","className","placeholder","disabledProp","statusProp","getItemKeywords","rest","internalValue","setInternalValue","useControlledState","usedValue","useMemo","contextStatus","useContext","FormItemInputContext","contextDisabled","DisabledContext","mergedStatus","disabled","cls","useCls","handleSelectAll","useCallback","allValues","item","handleDeselectAll","jsxs","Command","cn","jsx","Input","selectedFromAll","val","checked","indeterminate","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AAAA,gBAAA;AAAA,cAAA;AAAA,YACR;AAAA,YA1CGA,EAAK;AAAA,UA6Cb,CAAA;AAAA,QAAA,EAAA,CACH,EACF,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
@@ -5,11 +5,11 @@ import { Highlight as J, themes as K } from "prism-react-renderer";
5
5
  import { useState as p, useEffect as Q, useCallback as I } from "react";
6
6
  import { ThemeProvider as R } from "../theme-provider/component.js";
7
7
  import './style.css';/* empty css */
8
- import { WithAntdTokens as U } from "../utils/WithAntdTokens.js";
9
- import { Segmented as V } from "../segmented/component.js";
10
- import { useControlledState as X } from "../hooks/useControlledState.js";
11
- import { reactNodeToString as Y } from "../utils/reactToString.js";
12
- import { useCls as Z } from "../utils/antdUtils.js";
8
+ import { Segmented as U } from "../segmented/component.js";
9
+ import { useControlledState as V } from "../hooks/useControlledState.js";
10
+ import { reactNodeToString as X } from "../utils/reactToString.js";
11
+ import { useCls as Y } from "../utils/antdUtils.js";
12
+ import { WithAntdTokens as Z } from "../utils/WithAntdTokens.js";
13
13
  import { clsx as H } from "../utils/cn.js";
14
14
  import { IconButton as N } from "../icon-button/component.js";
15
15
  import { ScrollArea as oo } from "../scroll-area/component.js";
@@ -30,7 +30,7 @@ const vo = ({
30
30
  onCopy: C,
31
31
  ...A
32
32
  }) => {
33
- const [l, y] = X(
33
+ const [l, y] = V(
34
34
  j,
35
35
  x,
36
36
  b
@@ -51,7 +51,7 @@ const vo = ({
51
51
  y
52
52
  ]);
53
53
  const [T, u] = p(a), [D, S] = p(!1), E = I(() => {
54
- const t = c || Y(m);
54
+ const t = c || X(m);
55
55
  try {
56
56
  navigator.clipboard.writeText(t).then(() => {
57
57
  u(g), S(!0), C && C(t);
@@ -61,15 +61,15 @@ const vo = ({
61
61
  }
62
62
  }, [c, m, g, C]), F = I(() => {
63
63
  u(a), S(!1);
64
- }, [a]), d = Z();
64
+ }, [a]), d = Y();
65
65
  return /* @__PURE__ */ o(R, { theme: "dark", children: /* @__PURE__ */ q(
66
- U,
66
+ Z,
67
67
  {
68
68
  className: H(d("code-block"), O, e == null ? void 0 : e.root),
69
69
  ...A,
70
70
  children: [
71
71
  f && /* @__PURE__ */ o("div", { className: d("code-block-header", e == null ? void 0 : e.header), children: /* @__PURE__ */ o(
72
- V,
72
+ U,
73
73
  {
74
74
  value: l,
75
75
  onChange: y,
@@ -1,232 +1,237 @@
1
1
  "use client";
2
- import { jsxs as ce, Fragment as ue, jsx as p } from "react/jsx-runtime";
3
- import { forwardRef as fe, useState as _, useContext as K, useCallback as i, useMemo as x } from "react";
4
- import { useControlled as be } from "@base-ui-components/utils/useControlled";
5
- import { FormItemInputContext as me } from "antd/es/form/context";
6
- import pe from "antd/es/config-provider/DisabledContext";
2
+ import { jsxs as ne, Fragment as se, jsx as m } from "react/jsx-runtime";
3
+ import ae from "antd/es/config-provider/DisabledContext";
4
+ import { FormItemInputContext as de } from "antd/es/form/context";
5
+ import { forwardRef as ie, useContext as j, useCallback as v, useMemo as h } from "react";
6
+ import { DropdownMenuDivider as ce } from "../dropdown-menu/divider.js";
7
7
  import './style.css';/* empty css */
8
- import { DropdownMenuDivider as xe } from "../dropdown-menu/divider.js";
9
- import { DropdownMenuItem as ye } from "../dropdown-menu/item.js";
10
- import { DropdownMenu as ge } from "../dropdown-menu/component.js";
11
- import { SelectTrigger as ve } from "../select-trigger/component.js";
12
- import { useControlledState as he } from "../hooks/useControlledState.js";
13
- import { useCls as Ce } from "../utils/antdUtils.js";
14
- import { clsx as y } from "../utils/cn.js";
15
- const Ae = ({
16
- options: g = [],
17
- value: R,
18
- defaultValue: w,
19
- onChange: v,
20
- placeholder: $ = "Select...",
21
- disabled: B = !1,
22
- status: E,
23
- allowClear: S = !1,
24
- multiple: t = !1,
25
- maxTagCount: ke,
26
- showSearch: d = !0,
8
+ import { DropdownMenuItem as fe } from "../dropdown-menu/item.js";
9
+ import { DropdownMenu as ue } from "../dropdown-menu/component.js";
10
+ import { SelectTrigger as me } from "../select-trigger/component.js";
11
+ import { useControlledState as P } from "../hooks/useControlledState.js";
12
+ import { useCls as be } from "../utils/antdUtils.js";
13
+ import { clsx as b } from "../utils/cn.js";
14
+ import { reactNodeToString as xe } from "../utils/reactToString.js";
15
+ const ye = ({
16
+ options: o = [],
17
+ value: _,
18
+ defaultValue: V,
19
+ onChange: c,
20
+ placeholder: K = "Select...",
21
+ disabled: $ = !1,
22
+ status: B,
23
+ allowClear: E = !1,
24
+ multiple: l = !1,
25
+ maxTagCount: he,
26
+ showSearch: p = !0,
27
27
  open: W,
28
28
  onOpenChange: q,
29
29
  placement: z = "bottomLeft",
30
30
  className: G,
31
- classNames: a,
31
+ classNames: d,
32
32
  size: H = "middle",
33
- loading: Ie = !1,
34
- optionRender: De,
35
- filterOption: h = !0,
36
- onSearch: C,
37
- dropdownRender: Me,
33
+ loading: pe = !1,
34
+ optionRender: ge,
35
+ onSearch: Ce,
36
+ dropdownRender: Ae,
38
37
  clearIcon: J,
39
38
  suffixIcon: Q,
40
39
  dropdownMenuProps: U,
41
- triggerProps: A,
40
+ triggerProps: x,
42
41
  searchProps: X,
43
- showSelectionSummary: F = !1,
44
- selectionSummaryRender: V,
45
- showSelectAll: L = !1,
46
- selectAllRender: we,
42
+ showSelectionSummary: D = !1,
43
+ selectionSummaryRender: g,
44
+ showSelectAll: O = !1,
45
+ selectAllRender: ke,
46
+ optionLabelRender: y,
47
+ getOptionKeywords: S = (r) => [
48
+ String(r.value),
49
+ xe(r.label)
50
+ ],
47
51
  ...Y
48
52
  }, Z) => {
49
- const [N] = _(
50
- w !== void 0 ? w : t ? [] : void 0
51
- ), [l, O] = be({
52
- controlled: R,
53
- default: N,
54
- name: "value"
55
- }), [T, j] = he(
53
+ const [r, w] = P(
54
+ _,
55
+ c,
56
+ V !== void 0 ? V : l ? [] : void 0
57
+ ), [M, T] = P(
56
58
  W,
57
59
  q,
58
60
  !1
59
- ), [c, ee] = _(""), u = Ce(), {
60
- status: te
61
+ ), f = be(), {
62
+ status: L
61
63
  // hasFeedback,
62
64
  // feedbackIcon,
63
- } = K(me), le = K(pe), re = E || te, oe = B || le, n = i(
65
+ } = j(de), R = j(ae), N = B || L, ee = $ || R, s = v(
64
66
  (e) => {
65
- O(e), v == null || v(e);
67
+ w(e), c == null || c(e);
66
68
  },
67
- [O, v]
68
- ), P = i(
69
+ [w, c]
70
+ ), F = v(
69
71
  (e) => {
70
- if (t) {
71
- const r = Array.isArray(l) ? l : [], b = r.includes(e) ? r.filter((m) => m !== e) : [...r, e];
72
- n(b);
72
+ if (l) {
73
+ const t = Array.isArray(r) ? r : [], n = t.includes(e) ? t.filter((i) => i !== e) : [...t, e];
74
+ s(n);
73
75
  } else
74
- n(e);
76
+ s(e);
75
77
  },
76
- [t, l, n]
77
- ), ne = i(
78
- (e) => {
79
- ee(e), C == null || C(e);
80
- },
81
- [C]
82
- );
83
- i(
84
- (e) => t ? Array.isArray(l) && l.includes(e) : l === e,
85
- [t, l]
86
- );
87
- const o = x(() => !d || !c ? g : g.filter((e) => typeof h == "function" ? h(c, e) : h === !1 ? !0 : (typeof e.label == "string" ? e.label : String(e.value)).toLowerCase().includes(c.toLowerCase())), [g, d, c, h]), k = i(() => {
88
- if (t) {
89
- const e = o.map((r) => r.value);
90
- n(e);
78
+ [l, r, s]
79
+ ), C = v(() => {
80
+ if (l) {
81
+ const e = o.map((t) => t.value);
82
+ s(e);
91
83
  }
92
- }, [t, o, n]), I = i(() => {
93
- t && n([]);
94
- }, [t, n]), se = x(() => o.map((e) => ({
84
+ }, [l, o, s]), A = v(() => {
85
+ l && s([]);
86
+ }, [l, s]), te = h(() => o.map((e) => ({
95
87
  type: "item",
88
+ // todo: make this type better
96
89
  key: e.value,
97
90
  icon: e.icon,
98
91
  label: e.label,
99
92
  disabled: e.disabled,
100
- onClick: () => !e.disabled && P(e.value)
101
- })), [o, P]), ae = x(() => {
102
- if (!L || !t || o.length === 0)
93
+ onClick: () => !e.disabled && F(e.value)
94
+ })), [o, F]), le = h(() => {
95
+ if (!O || !l || o.length === 0)
103
96
  return null;
104
- const e = Array.isArray(l) ? l : [], r = o.map((M) => M.value), b = e.filter(
105
- (M) => r.includes(M)
106
- ), m = b.length === o.length && o.length > 0, D = b.length > 0 && b.length < o.length;
107
- return /* @__PURE__ */ ce(ue, { children: [
108
- /* @__PURE__ */ p(
109
- ye,
97
+ const e = Array.isArray(r) ? r : [], t = o.map((I) => I.value), n = e.filter(
98
+ (I) => t.includes(I)
99
+ ), i = n.length === o.length && o.length > 0, k = n.length > 0 && n.length < o.length;
100
+ return /* @__PURE__ */ ne(se, { children: [
101
+ /* @__PURE__ */ m(
102
+ fe,
110
103
  {
111
104
  item: {
112
105
  type: "item",
113
106
  key: "select_all",
114
107
  label: "Select All",
115
108
  onClick: () => {
116
- D || m ? I() : k();
109
+ k || i ? A() : C();
117
110
  }
118
111
  },
119
- inCombobox: d,
120
- selected: m,
112
+ inCombobox: p,
113
+ selected: i,
121
114
  showCheckbox: !0,
122
- indeterminate: D,
115
+ indeterminate: k,
123
116
  renderAsNativeElement: !0,
124
117
  onSelect: () => {
125
- D || m ? I() : k();
118
+ k || i ? A() : C();
126
119
  }
127
120
  },
128
121
  "select_all"
129
122
  ),
130
- /* @__PURE__ */ p(xe, {})
123
+ /* @__PURE__ */ m(ce, {})
131
124
  ] });
132
125
  }, [
133
- L,
134
- t,
135
- o,
126
+ O,
136
127
  l,
137
- d,
138
- I,
139
- k
140
- ]), f = x(() => Array.isArray(l) ? l : l ? [l] : [], [l]), s = f.map((e) => g.find((r) => r.value === e)).filter(Boolean), { displayValue: ie, displayPrefix: de } = x(() => {
141
- if (s.length === 0)
128
+ o,
129
+ r,
130
+ p,
131
+ A,
132
+ C
133
+ ]), u = h(() => Array.isArray(r) ? r : r ? [r] : [], [r]), a = u.map((e) => o.find((t) => t.value === e)).filter(Boolean), { displayValue: re, displayPrefix: oe } = h(() => {
134
+ if (a.length === 0)
142
135
  return { displayValue: void 0, displayPrefix: void 0 };
143
- if (t) {
144
- const r = `${s.length} ${s.length === 1 ? "item" : "items"} selected`;
145
- return F ? V ? {
146
- displayValue: V(f),
136
+ if (l) {
137
+ const t = `${a.length} ${a.length === 1 ? "item" : "items"} selected`;
138
+ return D ? g ? {
139
+ displayValue: g(u),
147
140
  displayPrefix: void 0
148
141
  } : {
149
- displayValue: r,
142
+ displayValue: t,
150
143
  // TODO: Create icon component for multiple selection summary
151
144
  displayPrefix: void 0
152
- } : s.length === 1 ? {
153
- displayValue: s[0].label,
154
- displayPrefix: s[0].icon
145
+ } : a.length === 1 ? {
146
+ displayValue: a[0].label,
147
+ displayPrefix: a[0].icon
155
148
  } : {
156
- displayValue: r,
149
+ displayValue: t,
157
150
  displayPrefix: void 0
158
151
  };
159
152
  }
160
- const e = s[0];
153
+ const e = a[0];
161
154
  return {
162
155
  displayValue: e == null ? void 0 : e.label,
163
156
  displayPrefix: e == null ? void 0 : e.icon
164
157
  };
165
158
  }, [
166
- s,
167
- t,
168
- F,
169
- V,
170
- f
159
+ a,
160
+ l,
161
+ D,
162
+ g,
163
+ u
171
164
  ]);
172
- return /* @__PURE__ */ p("div", { ref: Z, className: y(u("combobox"), G), ...Y, children: /* @__PURE__ */ p(
173
- ge,
165
+ return /* @__PURE__ */ m("div", { ref: Z, className: b(f("combobox"), G), ...Y, children: /* @__PURE__ */ m(
166
+ ue,
174
167
  {
175
- items: se,
176
- open: T,
177
- onOpenChange: j,
168
+ items: te,
169
+ open: M,
170
+ onOpenChange: T,
178
171
  placement: z,
179
- showSearch: d,
172
+ showSearch: p,
180
173
  searchProps: {
181
174
  placeholder: "Search options...",
182
- onValueChange: ne,
183
- value: c,
184
175
  ...X
185
176
  },
186
- className: y(u("combobox-dropdown")),
177
+ className: b(f("combobox-dropdown")),
187
178
  classNames: {
188
- trigger: y(u("combobox-trigger-wrapper")),
189
- popup: y(u("combobox-popup")),
190
- item: y(u("combobox-option"), a == null ? void 0 : a.option),
191
- ...a
179
+ trigger: b(f("combobox-trigger-wrapper")),
180
+ popup: b(f("combobox-popup")),
181
+ item: b(f("combobox-option"), d == null ? void 0 : d.option),
182
+ ...d
192
183
  },
193
184
  popupMatchTriggerWidth: !0,
194
- keepOpenOnSelect: t,
195
- highlightedItemKey: t ? void 0 : f[0],
196
- showCheckbox: t,
197
- beforeList: ae,
198
- selectedItemKeys: f,
185
+ keepOpenOnSelect: l,
186
+ highlightedItemKey: l ? void 0 : u[0],
187
+ showCheckbox: l,
188
+ beforeList: le,
189
+ selectedItemKeys: u,
190
+ getItemKeywords: S ? (e) => {
191
+ const t = o.find(
192
+ (n) => n.value === e.key
193
+ );
194
+ return t ? S(t) : [];
195
+ } : void 0,
196
+ itemLabelRender: y ? (e, t) => {
197
+ const n = o.find(
198
+ (i) => i.value === e.key
199
+ );
200
+ return n ? y == null ? void 0 : y(n, t) : null;
201
+ } : void 0,
199
202
  ...U,
200
- children: /* @__PURE__ */ p(
201
- ve,
203
+ children: /* @__PURE__ */ m(
204
+ me,
202
205
  {
203
- value: ie,
204
- prefix: de,
205
- placeholder: $,
206
- disabled: oe,
207
- status: re,
208
- open: T,
206
+ value: re,
207
+ prefix: oe,
208
+ placeholder: K,
209
+ disabled: ee,
210
+ status: N,
211
+ open: M,
209
212
  size: H,
210
- allowClear: S,
213
+ allowClear: E,
211
214
  suffixIcon: Q,
212
215
  clearIcon: J,
213
216
  classNames: {
214
- trigger: a == null ? void 0 : a.trigger,
215
- ...A == null ? void 0 : A.classNames
217
+ trigger: d == null ? void 0 : d.trigger,
218
+ ...x == null ? void 0 : x.classNames
219
+ },
220
+ onClear: () => {
221
+ s(l ? [] : void 0);
216
222
  },
217
- onClear: () => n(t ? [] : void 0),
218
- onOpenChange: j,
223
+ onOpenChange: T,
219
224
  role: "combobox",
220
- ...A
225
+ ...x
221
226
  }
222
227
  )
223
228
  }
224
229
  ) });
225
- }, Ve = fe(Ae), qe = Object.assign(Ve, {
230
+ }, ve = ie(ye), Be = Object.assign(ve, {
226
231
  // Add any sub components here if needed
227
232
  });
228
233
  export {
229
- qe as Combobox,
230
- qe as default
234
+ Be as Combobox,
235
+ Be as default
231
236
  };
232
237
  //# sourceMappingURL=component.js.map