@bioturing/components 0.31.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.
- package/dist/components/choice-list/component.js.map +1 -1
- package/dist/components/combobox/component.js +163 -159
- package/dist/components/combobox/component.js.map +1 -1
- package/dist/components/dropdown-menu/component.js +26 -24
- package/dist/components/dropdown-menu/component.js.map +1 -1
- package/dist/components/dropdown-menu/item.js +67 -58
- package/dist/components/dropdown-menu/item.js.map +1 -1
- package/dist/components/dropdown-menu/useDropdownMenu.js +58 -55
- package/dist/components/dropdown-menu/useDropdownMenu.js.map +1 -1
- package/dist/components/input/component.js +24 -23
- package/dist/components/input/component.js.map +1 -1
- package/dist/components/scroll-area/component.js +83 -64
- package/dist/components/scroll-area/component.js.map +1 -1
- package/dist/components/select/component.js.map +1 -1
- package/dist/index.d.ts +60 -19
- package/package.json +2 -2
|
@@ -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 { 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","Checkbox","ScrollArea","reactNodeToString","newValue","newValues","Radio"],"mappings":";;;;;;;;;;;;;;;AAkDO,MAAMA,KAAa,CAA4B;AAAA,EACpD,SAAAC;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,EAAE,QAAQiB,MAAkBC,EAAWC,CAAoB,GAC3DC,IAAkBF,EAAWG,CAAe,GAG5CC,IAAeb,KAAcQ,GAC7BM,IAAWf,KAAgBY,GAE3BI,IAAMC,EAAO,GAEbC,IAAkBC,EAAY,MAAM;AACxC,QAAI3B,GAA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AAAA,kBACV,SAASX,EAAK,QAAQd,EAAU,SAASc,EAAK,KAAK,IAAI;AAAA,kBACvD,UAAAN;AAAA,kBAEC,UAAKM,EAAA;AAAA,gBAAA;AAAA,cAAA,IAGR,gBAAAK;AAAA,gBAACW;AAAA,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,YA1CGA,EAAK;AAAA,UA6Cb,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","Checkbox","ScrollArea","reactNodeToString","newValue","newValues","Radio"],"mappings":";;;;;;;;;;;;;;;AAkDO,MAAMA,KAAa,CAA4B;AAAA,EACpD,SAAAC;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,EAAE,QAAQiB,MAAkBC,EAAWC,CAAoB,GAC3DC,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,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cAAA,IAGR,gBAAAK;AAAA,gBAACW;AAAA,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,YA1CGA,EAAK;AAAA,UA6Cb,CAAA;AAAA,QAAA,EAAA,CACH,EACF,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -1,233 +1,237 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
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 {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
Ve(V.label)
|
|
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
|
+
open: W,
|
|
28
|
+
onOpenChange: q,
|
|
29
|
+
placement: z = "bottomLeft",
|
|
30
|
+
className: G,
|
|
31
|
+
classNames: d,
|
|
32
|
+
size: H = "middle",
|
|
33
|
+
loading: pe = !1,
|
|
34
|
+
optionRender: ge,
|
|
35
|
+
onSearch: Ce,
|
|
36
|
+
dropdownRender: Ae,
|
|
37
|
+
clearIcon: J,
|
|
38
|
+
suffixIcon: Q,
|
|
39
|
+
dropdownMenuProps: U,
|
|
40
|
+
triggerProps: x,
|
|
41
|
+
searchProps: X,
|
|
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)
|
|
51
50
|
],
|
|
52
|
-
...
|
|
53
|
-
},
|
|
54
|
-
const [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}), [j, K] = Ce(
|
|
51
|
+
...Y
|
|
52
|
+
}, Z) => {
|
|
53
|
+
const [r, w] = P(
|
|
54
|
+
_,
|
|
55
|
+
c,
|
|
56
|
+
V !== void 0 ? V : l ? [] : void 0
|
|
57
|
+
), [M, T] = P(
|
|
58
|
+
W,
|
|
61
59
|
q,
|
|
62
|
-
z,
|
|
63
60
|
!1
|
|
64
|
-
),
|
|
65
|
-
status:
|
|
61
|
+
), f = be(), {
|
|
62
|
+
status: L
|
|
66
63
|
// hasFeedback,
|
|
67
64
|
// feedbackIcon,
|
|
68
|
-
} =
|
|
65
|
+
} = j(de), R = j(ae), N = B || L, ee = $ || R, s = v(
|
|
69
66
|
(e) => {
|
|
70
|
-
|
|
67
|
+
w(e), c == null || c(e);
|
|
71
68
|
},
|
|
72
|
-
[
|
|
73
|
-
),
|
|
69
|
+
[w, c]
|
|
70
|
+
), F = v(
|
|
74
71
|
(e) => {
|
|
75
|
-
if (
|
|
76
|
-
const
|
|
77
|
-
n
|
|
72
|
+
if (l) {
|
|
73
|
+
const t = Array.isArray(r) ? r : [], n = t.includes(e) ? t.filter((i) => i !== e) : [...t, e];
|
|
74
|
+
s(n);
|
|
78
75
|
} else
|
|
79
|
-
|
|
76
|
+
s(e);
|
|
80
77
|
},
|
|
81
|
-
[
|
|
82
|
-
),
|
|
83
|
-
(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
[C]
|
|
87
|
-
), r = x(() => !i || !d ? g : g.filter((e) => typeof h == "function" ? h(d, e) : h === !1 ? !0 : (typeof e.label == "string" ? e.label : String(e.value)).toLowerCase().includes(d.toLowerCase())), [g, i, d, h]), I = p(() => {
|
|
88
|
-
if (t) {
|
|
89
|
-
const e = r.map((l) => l.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
|
-
}, [
|
|
93
|
-
|
|
94
|
-
}, [
|
|
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 &&
|
|
101
|
-
})), [
|
|
102
|
-
if (!
|
|
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(
|
|
105
|
-
(
|
|
106
|
-
),
|
|
107
|
-
return /* @__PURE__ */
|
|
108
|
-
/* @__PURE__ */
|
|
109
|
-
|
|
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
|
-
|
|
109
|
+
k || i ? A() : C();
|
|
117
110
|
}
|
|
118
111
|
},
|
|
119
|
-
inCombobox:
|
|
120
|
-
selected:
|
|
112
|
+
inCombobox: p,
|
|
113
|
+
selected: i,
|
|
121
114
|
showCheckbox: !0,
|
|
122
|
-
indeterminate:
|
|
115
|
+
indeterminate: k,
|
|
123
116
|
renderAsNativeElement: !0,
|
|
124
117
|
onSelect: () => {
|
|
125
|
-
|
|
118
|
+
k || i ? A() : C();
|
|
126
119
|
}
|
|
127
120
|
},
|
|
128
121
|
"select_all"
|
|
129
122
|
),
|
|
130
|
-
/* @__PURE__ */
|
|
123
|
+
/* @__PURE__ */ m(ce, {})
|
|
131
124
|
] });
|
|
132
125
|
}, [
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
r,
|
|
126
|
+
O,
|
|
127
|
+
l,
|
|
136
128
|
o,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
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 (
|
|
144
|
-
const
|
|
145
|
-
return
|
|
146
|
-
displayValue:
|
|
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:
|
|
142
|
+
displayValue: t,
|
|
150
143
|
// TODO: Create icon component for multiple selection summary
|
|
151
144
|
displayPrefix: void 0
|
|
152
|
-
} :
|
|
153
|
-
displayValue:
|
|
154
|
-
displayPrefix:
|
|
145
|
+
} : a.length === 1 ? {
|
|
146
|
+
displayValue: a[0].label,
|
|
147
|
+
displayPrefix: a[0].icon
|
|
155
148
|
} : {
|
|
156
|
-
displayValue:
|
|
149
|
+
displayValue: t,
|
|
157
150
|
displayPrefix: void 0
|
|
158
151
|
};
|
|
159
152
|
}
|
|
160
|
-
const e =
|
|
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
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
159
|
+
a,
|
|
160
|
+
l,
|
|
161
|
+
D,
|
|
162
|
+
g,
|
|
170
163
|
u
|
|
171
164
|
]);
|
|
172
|
-
return /* @__PURE__ */
|
|
173
|
-
|
|
165
|
+
return /* @__PURE__ */ m("div", { ref: Z, className: b(f("combobox"), G), ...Y, children: /* @__PURE__ */ m(
|
|
166
|
+
ue,
|
|
174
167
|
{
|
|
175
|
-
items:
|
|
176
|
-
open:
|
|
177
|
-
onOpenChange:
|
|
178
|
-
placement:
|
|
179
|
-
showSearch:
|
|
168
|
+
items: te,
|
|
169
|
+
open: M,
|
|
170
|
+
onOpenChange: T,
|
|
171
|
+
placement: z,
|
|
172
|
+
showSearch: p,
|
|
180
173
|
searchProps: {
|
|
181
174
|
placeholder: "Search options...",
|
|
182
|
-
|
|
183
|
-
value: d,
|
|
184
|
-
...Y
|
|
175
|
+
...X
|
|
185
176
|
},
|
|
186
|
-
className:
|
|
177
|
+
className: b(f("combobox-dropdown")),
|
|
187
178
|
classNames: {
|
|
188
|
-
trigger:
|
|
189
|
-
popup:
|
|
190
|
-
item:
|
|
191
|
-
...
|
|
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:
|
|
195
|
-
highlightedItemKey:
|
|
196
|
-
showCheckbox:
|
|
197
|
-
beforeList:
|
|
185
|
+
keepOpenOnSelect: l,
|
|
186
|
+
highlightedItemKey: l ? void 0 : u[0],
|
|
187
|
+
showCheckbox: l,
|
|
188
|
+
beforeList: le,
|
|
198
189
|
selectedItemKeys: u,
|
|
199
|
-
getItemKeywords:
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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,
|
|
202
|
+
...U,
|
|
203
|
+
children: /* @__PURE__ */ m(
|
|
204
|
+
me,
|
|
203
205
|
{
|
|
204
|
-
value:
|
|
205
|
-
prefix:
|
|
206
|
-
placeholder:
|
|
207
|
-
disabled:
|
|
208
|
-
status:
|
|
209
|
-
open:
|
|
210
|
-
size:
|
|
211
|
-
allowClear:
|
|
212
|
-
suffixIcon:
|
|
213
|
-
clearIcon:
|
|
206
|
+
value: re,
|
|
207
|
+
prefix: oe,
|
|
208
|
+
placeholder: K,
|
|
209
|
+
disabled: ee,
|
|
210
|
+
status: N,
|
|
211
|
+
open: M,
|
|
212
|
+
size: H,
|
|
213
|
+
allowClear: E,
|
|
214
|
+
suffixIcon: Q,
|
|
215
|
+
clearIcon: J,
|
|
214
216
|
classNames: {
|
|
215
|
-
trigger:
|
|
216
|
-
...
|
|
217
|
+
trigger: d == null ? void 0 : d.trigger,
|
|
218
|
+
...x == null ? void 0 : x.classNames
|
|
219
|
+
},
|
|
220
|
+
onClear: () => {
|
|
221
|
+
s(l ? [] : void 0);
|
|
217
222
|
},
|
|
218
|
-
|
|
219
|
-
onOpenChange: K,
|
|
223
|
+
onOpenChange: T,
|
|
220
224
|
role: "combobox",
|
|
221
|
-
...
|
|
225
|
+
...x
|
|
222
226
|
}
|
|
223
227
|
)
|
|
224
228
|
}
|
|
225
229
|
) });
|
|
226
|
-
},
|
|
230
|
+
}, ve = ie(ye), Be = Object.assign(ve, {
|
|
227
231
|
// Add any sub components here if needed
|
|
228
232
|
});
|
|
229
233
|
export {
|
|
230
|
-
|
|
231
|
-
|
|
234
|
+
Be as Combobox,
|
|
235
|
+
Be as default
|
|
232
236
|
};
|
|
233
237
|
//# sourceMappingURL=component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.js","sources":["../../../src/components/combobox/component.tsx"],"sourcesContent":["\"use client\";\nimport React, {\n forwardRef,\n useCallback,\n useMemo,\n useState,\n useContext,\n} from \"react\";\nimport { useControlled } from \"@base-ui-components/utils/useControlled\";\nimport { FormItemInputContext } from \"antd/es/form/context\";\nimport { ValidateStatus } from \"antd/es/form/FormItem\";\nimport DisabledContext from \"antd/es/config-provider/DisabledContext\";\nimport { clsx, reactNodeToString, useCls } from \"../utils\";\nimport { SelectTrigger } from \"../select-trigger\";\nimport {\n DropdownMenu,\n DropdownMenuProps,\n DropdownMenuItem,\n type DropdownMenuItemType,\n} from \"../dropdown-menu\";\nimport type { PopoverProps } from \"antd/es/popover\";\n\n// Import component-specific styles\nimport \"./style.css\";\nimport { useControlledState } from \"../hooks\";\nimport { DropdownMenuDivider } from \"../dropdown-menu/divider\";\n\nexport interface ComboboxOption {\n value: string | number;\n label: React.ReactNode;\n disabled?: boolean;\n icon?: React.ReactNode;\n}\n\nexport interface ComboboxProps {\n /** Array of options to be displayed in the combobox */\n options?: ComboboxOption[];\n /** Current value of the combobox */\n value?: string | number | Array<string | number>;\n /** Default value when uncontrolled */\n defaultValue?: string | number | Array<string | number>;\n /** Callback when value changes */\n onChange?: (value: string | number | Array<string | number>) => void;\n /** Placeholder text for the input */\n placeholder?: string;\n /** Whether the combobox is disabled */\n disabled?: boolean;\n /** Validation status */\n status?: ValidateStatus;\n /** Whether to allow clearing the selection */\n allowClear?: boolean;\n /** Whether to allow multiple selections */\n multiple?: boolean;\n /** Maximum number of tags to show */\n maxTagCount?: number;\n /** Whether to show search functionality */\n showSearch?: boolean;\n /** Controlled open state */\n open?: boolean;\n /** Callback when open state changes */\n onOpenChange?: (open: boolean) => void;\n /** Placement of the dropdown */\n placement?: PopoverProps[\"placement\"];\n /** Custom className for the component */\n className?: string;\n /** Custom class names for different parts */\n classNames?: {\n trigger?: string;\n input?: string;\n option?: string;\n optionIcon?: string;\n optionText?: string;\n };\n /** Size of the combobox */\n size?: \"small\" | \"middle\" | \"large\";\n /** Loading state */\n loading?: boolean;\n /** Custom render for options */\n optionRender?: (\n option: ComboboxOption,\n props: React.HTMLAttributes<HTMLElement>\n ) => React.ReactElement;\n /** Filter function for search */\n filterOption?: boolean | ((input: string, option: ComboboxOption) => boolean);\n /** Callback when search input changes */\n onSearch?: (value: string) => void;\n /** Custom dropdown render */\n dropdownRender?: (menu: React.ReactElement) => React.ReactElement;\n /** Custom clear icon */\n clearIcon?: React.ReactNode;\n /** Custom suffix icon */\n suffixIcon?: React.ReactNode;\n /**\n * Props to pass to the dropdown menu\n */\n dropdownMenuProps?: DropdownMenuProps;\n /**\n * Props to pass to the combobox trigger\n */\n triggerProps?: React.ComponentPropsWithoutRef<typeof SelectTrigger>;\n searchProps?: {\n placeholder?: string;\n onValueChange?: (value: string) => void;\n value?: string;\n };\n /**\n * Show selection summary instead of individual tags when multiple\n * @default false\n */\n showSelectionSummary?: boolean;\n /**\n * Render function for the selection summary in multiple case\n * @default (selectedValues) => `${selectedValues.length} items selected`\n */\n selectionSummaryRender?: (\n selectedValues: Array<string | number>\n ) => React.ReactNode;\n /**\n * Show select all option when in multiple mode\n * @default false\n */\n showSelectAll?: boolean;\n /**\n * Render function for the select all option\n */\n selectAllRender?: (props: {\n onSelectAll: () => void;\n onDeselectAll: () => void;\n checked: boolean;\n indeterminate: boolean;\n }) => React.ReactNode;\n /**\n * Function to extract keywords from the item for search filtering\n * @default (option) => [String(option.key), reactNodeToString(option.label)]\n */\n getOptionKeywords?: (\n option: DropdownMenuItemType & { type: \"item\" }\n ) => string[];\n}\n\nconst ComboboxInner = (\n {\n options = [],\n value: controlledValue,\n defaultValue,\n onChange,\n placeholder = \"Select...\",\n disabled: disabledProp = false,\n status: statusProp,\n allowClear = false,\n multiple = false,\n maxTagCount,\n showSearch = true,\n open: controlledOpen,\n onOpenChange,\n placement = \"bottomLeft\",\n className,\n classNames,\n size = \"middle\",\n loading: _loading = false,\n optionRender,\n filterOption = true,\n onSearch,\n dropdownRender,\n clearIcon,\n suffixIcon,\n dropdownMenuProps,\n triggerProps,\n searchProps,\n showSelectionSummary = false,\n selectionSummaryRender,\n showSelectAll = false,\n selectAllRender,\n getOptionKeywords = (option: DropdownMenuItemType & { type: \"item\" }) => [\n String(option.key),\n reactNodeToString(option.label),\n ],\n ...rest\n }: ComboboxProps,\n ref: React.ForwardedRef<HTMLDivElement>\n) => {\n const [initialDefaultValue] = useState(\n defaultValue !== undefined ? defaultValue : multiple ? [] : undefined\n );\n const [value, setValue] = useControlled({\n controlled: controlledValue,\n default: initialDefaultValue,\n name: \"value\",\n });\n\n const [open, setOpen] = useControlledState(\n controlledOpen,\n onOpenChange,\n false\n );\n const [searchValue, setSearchValue] = useState(\"\");\n const cls = useCls();\n\n // Get form context values\n const {\n status: contextStatus,\n // hasFeedback,\n // feedbackIcon,\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 handleValueChange = useCallback(\n (newValue: string | number | Array<string | number>) => {\n setValue(newValue);\n onChange?.(newValue);\n },\n [setValue, onChange]\n );\n\n const handleOptionSelect = useCallback(\n (optionValue: string | number) => {\n if (multiple) {\n const currentValues = Array.isArray(value) ? value : [];\n const newValues = currentValues.includes(optionValue)\n ? currentValues.filter((v) => v !== optionValue)\n : [...currentValues, optionValue];\n handleValueChange(newValues);\n } else {\n handleValueChange(optionValue);\n // onOpenChange?.(false);\n }\n },\n [multiple, value, handleValueChange]\n );\n\n const handleSearchChange = useCallback(\n (newValue: string) => {\n setSearchValue(newValue);\n onSearch?.(newValue);\n },\n [onSearch]\n );\n\n // Filter options based on search\n const filteredOptions = useMemo(() => {\n if (!showSearch || !searchValue) return options;\n\n return options.filter((option) => {\n if (typeof filterOption === \"function\") {\n return filterOption(searchValue, option);\n }\n if (filterOption === false) return true;\n\n const label =\n typeof option.label === \"string\" ? option.label : String(option.value);\n return label.toLowerCase().includes(searchValue.toLowerCase());\n });\n }, [options, showSearch, searchValue, filterOption]);\n\n const handleSelectAll = useCallback(() => {\n if (multiple) {\n const allValues = filteredOptions.map((option) => option.value);\n handleValueChange(allValues);\n }\n }, [multiple, filteredOptions, handleValueChange]);\n\n const handleDeselectAll = useCallback(() => {\n if (multiple) {\n handleValueChange([]);\n }\n }, [multiple, handleValueChange]);\n\n // Convert options to DropdownMenu items\n const dropdownItems: DropdownMenuItemType[] = useMemo(() => {\n return filteredOptions.map((option) => {\n return {\n type: \"item\",\n key: option.value,\n icon: option.icon,\n label: option.label,\n disabled: option.disabled,\n onClick: () => !option.disabled && handleOptionSelect(option.value),\n };\n });\n }, [filteredOptions, handleOptionSelect]);\n\n // Select all component for beforeList\n const selectAllComponent = useMemo(() => {\n if (!showSelectAll || !multiple || filteredOptions.length === 0) {\n return null;\n }\n\n const selectedValues = Array.isArray(value) ? value : [];\n const filteredOptionValues = filteredOptions.map((opt) => opt.value);\n const selectedFromFiltered = selectedValues.filter((val) =>\n filteredOptionValues.includes(val)\n );\n const checked =\n selectedFromFiltered.length === filteredOptions.length &&\n filteredOptions.length > 0;\n const indeterminate =\n selectedFromFiltered.length > 0 &&\n selectedFromFiltered.length < filteredOptions.length;\n\n const selectAllItem: DropdownMenuItemType & { type: \"item\" } = {\n type: \"item\",\n key: \"select_all\",\n label: \"Select All\",\n onClick: () => {\n if (indeterminate || checked) {\n handleDeselectAll();\n } else {\n handleSelectAll();\n }\n },\n };\n\n return (\n <>\n <DropdownMenuItem\n key=\"select_all\"\n item={selectAllItem}\n inCombobox={showSearch}\n selected={checked}\n showCheckbox\n indeterminate={indeterminate}\n renderAsNativeElement\n onSelect={() => {\n if (indeterminate || checked) {\n handleDeselectAll();\n } else {\n handleSelectAll();\n }\n }}\n />\n <DropdownMenuDivider />\n </>\n );\n }, [\n showSelectAll,\n multiple,\n filteredOptions,\n value,\n showSearch,\n handleDeselectAll,\n handleSelectAll,\n ]);\n\n // Prepare trigger data\n const selectedValues = useMemo(() => {\n return Array.isArray(value) ? value : value ? [value] : [];\n }, [value]);\n const selectedOptions = selectedValues\n .map((val) => options.find((opt) => opt.value === val))\n .filter(Boolean);\n\n // Generate display value and prefix for SelectTrigger\n const { displayValue, displayPrefix } = useMemo(() => {\n if (selectedOptions.length === 0) {\n return { displayValue: undefined, displayPrefix: undefined };\n }\n\n if (multiple) {\n const summaryText = `${selectedOptions.length} ${\n selectedOptions.length === 1 ? \"item\" : \"items\"\n } selected`;\n if (showSelectionSummary) {\n if (selectionSummaryRender) {\n return {\n displayValue: selectionSummaryRender(selectedValues),\n displayPrefix: undefined,\n };\n }\n // Default summary with icons\n return {\n displayValue: summaryText,\n // TODO: Create icon component for multiple selection summary\n displayPrefix: undefined,\n };\n }\n // For non-summary multiple selection\n return selectedOptions.length === 1\n ? {\n displayValue: selectedOptions[0].label,\n displayPrefix: selectedOptions[0].icon,\n }\n : {\n displayValue: summaryText,\n displayPrefix: undefined,\n };\n }\n\n // Single selection\n const selectedOption = selectedOptions[0];\n return {\n displayValue: selectedOption?.label,\n displayPrefix: selectedOption?.icon,\n };\n }, [\n selectedOptions,\n multiple,\n showSelectionSummary,\n selectionSummaryRender,\n selectedValues,\n ]);\n\n return (\n <div ref={ref} className={clsx(cls(\"combobox\"), className)} {...rest}>\n <DropdownMenu\n items={dropdownItems}\n open={open}\n onOpenChange={setOpen}\n placement={placement}\n showSearch={showSearch}\n searchProps={{\n placeholder: \"Search options...\",\n onValueChange: handleSearchChange,\n value: searchValue,\n ...searchProps,\n }}\n className={clsx(cls(\"combobox-dropdown\"))}\n classNames={{\n trigger: clsx(cls(\"combobox-trigger-wrapper\")),\n popup: clsx(cls(\"combobox-popup\")),\n item: clsx(cls(\"combobox-option\"), classNames?.option),\n ...classNames,\n }}\n popupMatchTriggerWidth\n keepOpenOnSelect={multiple}\n highlightedItemKey={multiple ? undefined : selectedValues[0]}\n showCheckbox={multiple}\n beforeList={selectAllComponent}\n selectedItemKeys={selectedValues}\n getItemKeywords={getOptionKeywords}\n {...dropdownMenuProps}\n >\n <SelectTrigger\n value={displayValue}\n prefix={displayPrefix}\n placeholder={placeholder}\n disabled={disabled}\n status={mergedStatus}\n open={open}\n size={size}\n allowClear={allowClear}\n suffixIcon={suffixIcon}\n clearIcon={clearIcon}\n classNames={{\n trigger: classNames?.trigger,\n ...triggerProps?.classNames,\n }}\n onClear={() => handleValueChange(multiple ? [] : undefined)}\n onOpenChange={setOpen}\n role=\"combobox\"\n {...triggerProps}\n />\n </DropdownMenu>\n </div>\n );\n};\n\nconst MainCombobox = forwardRef(ComboboxInner);\n\nexport const Combobox = Object.assign(MainCombobox, {\n // Add any sub components here if needed\n});\n\nexport default Combobox;\n"],"names":["ComboboxInner","options","controlledValue","defaultValue","onChange","placeholder","disabledProp","statusProp","allowClear","multiple","maxTagCount","showSearch","controlledOpen","onOpenChange","placement","className","classNames","size","_loading","optionRender","filterOption","onSearch","dropdownRender","clearIcon","suffixIcon","dropdownMenuProps","triggerProps","searchProps","showSelectionSummary","selectionSummaryRender","showSelectAll","selectAllRender","getOptionKeywords","option","reactNodeToString","rest","ref","initialDefaultValue","useState","value","setValue","useControlled","open","setOpen","useControlledState","searchValue","setSearchValue","cls","useCls","contextStatus","useContext","FormItemInputContext","contextDisabled","DisabledContext","mergedStatus","disabled","handleValueChange","useCallback","newValue","handleOptionSelect","optionValue","currentValues","newValues","v","handleSearchChange","filteredOptions","useMemo","handleSelectAll","allValues","handleDeselectAll","dropdownItems","selectAllComponent","selectedValues","filteredOptionValues","opt","selectedFromFiltered","val","checked","indeterminate","jsxs","Fragment","jsx","DropdownMenuItem","DropdownMenuDivider","selectedOptions","displayValue","displayPrefix","summaryText","selectedOption","clsx","DropdownMenu","SelectTrigger","MainCombobox","forwardRef","Combobox"],"mappings":";;;;;;;;;;;;;;;AA4IA,MAAMA,KAAgB,CACpB;AAAA,EACE,SAAAC,IAAU,CAAC;AAAA,EACX,OAAOC;AAAA,EACP,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,UAAUC,IAAe;AAAA,EACzB,QAAQC;AAAA,EACR,YAAAC,IAAa;AAAA,EACb,UAAAC,IAAW;AAAA,EACX,aAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,MAAMC;AAAA,EACN,cAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,SAASC,KAAW;AAAA,EACpB,cAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,sBAAAC,IAAuB;AAAA,EACvB,wBAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,iBAAAC;AAAA,EACA,mBAAAC,IAAoB,CAACC,MAAoD;AAAA,IACvE,OAAOA,EAAO,GAAG;AAAA,IACjBC,GAAkBD,EAAO,KAAK;AAAA,EAChC;AAAA,EACA,GAAGE;AACL,GACAC,OACG;AACG,QAAA,CAACC,CAAmB,IAAIC;AAAA,IAC5BnC,MAAiB,SAAYA,IAAeM,IAAW,CAAA,IAAK;AAAA,EAC9D,GACM,CAAC8B,GAAOC,CAAQ,IAAIC,GAAc;AAAA,IACtC,YAAYvC;AAAA,IACZ,SAASmC;AAAA,IACT,MAAM;AAAA,EAAA,CACP,GAEK,CAACK,GAAMC,CAAO,IAAIC;AAAA,IACtBhC;AAAA,IAC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R,MAAAZ;AAAA,UACA,MAAAzB;AAAA,UACA,YAAAT;AAAA,UACA,YAAAgB;AAAA,UACA,WAAAD;AAAA,UACA,YAAY;AAAA,YACV,SAASP,KAAA,gBAAAA,EAAY;AAAA,YACrB,GAAGU,KAAA,gBAAAA,EAAc;AAAA,UACnB;AAAA,UACA,SAAS,MAAM8B,EAAkB/C,IAAW,CAAA,IAAK,MAAS;AAAA,UAC1D,cAAckC;AAAA,UACd,MAAK;AAAA,UACJ,GAAGjB;AAAA,QAAA;AAAA,MAAA;AAAA,IACN;AAAA,EAAA,GAEJ;AAEJ,GAEMkE,KAAeC,GAAW7F,EAAa,GAEhC8F,KAAW,OAAO,OAAOF,IAAc;AAAA;AAEpD,CAAC;"}
|
|
1
|
+
{"version":3,"file":"component.js","sources":["../../../src/components/combobox/component.tsx"],"sourcesContent":["\"use client\";\nimport DisabledContext from \"antd/es/config-provider/DisabledContext\";\nimport { FormItemInputContext } from \"antd/es/form/context\";\nimport { ValidateStatus } from \"antd/es/form/FormItem\";\nimport type { PopoverProps } from \"antd/es/popover\";\nimport React, {\n ForwardedRef,\n forwardRef,\n useCallback,\n useContext,\n useMemo,\n} from \"react\";\nimport {\n DropdownMenu,\n DropdownMenuItem,\n DropdownMenuProps,\n type DropdownMenuItemType,\n} from \"../dropdown-menu\";\nimport { SelectTrigger } from \"../select-trigger\";\nimport { clsx, reactNodeToString, useCls } from \"../utils\";\n\n// Import component-specific styles\nimport { DropdownMenuDivider } from \"../dropdown-menu/divider\";\nimport { useControlledState } from \"../hooks\";\nimport \"./style.css\";\n\nexport type ComboboxOption<\n T extends React.Key,\n O extends Record<string, unknown> = {},\n> = {\n value: T;\n label: React.ReactNode;\n disabled?: boolean;\n icon?: React.ReactNode;\n} & O;\n\nexport interface ComboboxProps<\n T extends React.Key,\n M extends boolean,\n O extends Record<string, unknown> = {},\n> {\n /** Array of options to be displayed in the combobox */\n options?: ComboboxOption<T, O>[];\n /** Current value of the combobox */\n value?: M extends true ? T[] : T;\n /** Default value when uncontrolled */\n defaultValue?: M extends true ? T[] : T;\n /** Callback when value changes */\n onChange?: (value: M extends true ? T[] : T) => void;\n /** Placeholder text for the input */\n placeholder?: string;\n /** Whether the combobox is disabled */\n disabled?: boolean;\n /** Validation status */\n status?: ValidateStatus;\n /** Whether to allow clearing the selection */\n allowClear?: boolean;\n /** Whether to allow multiple selections */\n multiple?: M;\n /** Maximum number of tags to show */\n maxTagCount?: number;\n /** Whether to show search functionality */\n showSearch?: boolean;\n /** Controlled open state */\n open?: boolean;\n /** Callback when open state changes */\n onOpenChange?: (open: boolean) => void;\n /** Placement of the dropdown */\n placement?: PopoverProps[\"placement\"];\n /** Custom className for the component */\n className?: string;\n /** Custom class names for different parts */\n classNames?: {\n trigger?: string;\n input?: string;\n option?: string;\n optionIcon?: string;\n optionText?: string;\n };\n /** Size of the combobox */\n size?: \"small\" | \"middle\" | \"large\";\n /** Loading state */\n loading?: boolean;\n /** Custom render for options */\n optionRender?: (\n option: ComboboxOption<T, O>,\n props: React.HTMLAttributes<HTMLElement>,\n ) => React.ReactElement;\n /** Filter function for search */\n filterOption?:\n | boolean\n | ((input: string, option: ComboboxOption<T, O>) => boolean);\n /** Callback when search input changes */\n onSearch?: (value: string) => void;\n /** Custom dropdown render */\n dropdownRender?: (menu: React.ReactElement) => React.ReactElement;\n /** Custom clear icon */\n clearIcon?: React.ReactNode;\n /** Custom suffix icon */\n suffixIcon?: React.ReactNode;\n /**\n * Props to pass to the dropdown menu\n */\n dropdownMenuProps?: DropdownMenuProps;\n /**\n * Props to pass to the combobox trigger\n */\n triggerProps?: React.ComponentPropsWithoutRef<typeof SelectTrigger>;\n searchProps?: {\n placeholder?: string;\n onValueChange?: (value: string) => void;\n value?: string;\n };\n /**\n * Show selection summary instead of individual tags when multiple\n * @default false\n */\n showSelectionSummary?: boolean;\n /**\n * Render function for the selection summary in multiple case\n * @default (selectedValues) => `${selectedValues.length} items selected`\n */\n selectionSummaryRender?: (selectedValues: T[]) => React.ReactNode;\n /**\n * Show select all option when in multiple mode\n * @default false\n */\n showSelectAll?: boolean;\n /**\n * Render function for the select all option\n */\n selectAllRender?: (props: {\n onSelectAll: () => void;\n onDeselectAll: () => void;\n checked: boolean;\n indeterminate: boolean;\n }) => React.ReactNode;\n /**\n * Function to extract keywords from the item for search filtering\n * @default (option) => [String(option.key), reactNodeToString(option.label)]\n */\n getOptionKeywords?: (option: ComboboxOption<T, O>) => string[];\n /**\n * Render function for the option label\n */\n optionLabelRender?: (\n option: ComboboxOption<T, O>,\n props?: React.HTMLAttributes<HTMLElement>,\n ) => React.ReactElement;\n}\n\nconst ComboboxInner = <\n T extends React.Key,\n M extends boolean,\n O extends Record<string, unknown> = {},\n>(\n {\n options = [],\n value: controlledValue,\n defaultValue,\n onChange,\n placeholder = \"Select...\",\n disabled: disabledProp = false,\n status: statusProp,\n allowClear = false,\n multiple = false as M,\n maxTagCount,\n showSearch = true,\n open: controlledOpen,\n onOpenChange,\n placement = \"bottomLeft\",\n className,\n classNames,\n size = \"middle\",\n loading: _loading = false,\n optionRender,\n onSearch,\n dropdownRender,\n clearIcon,\n suffixIcon,\n dropdownMenuProps,\n triggerProps,\n searchProps,\n showSelectionSummary = false,\n selectionSummaryRender,\n showSelectAll = false,\n selectAllRender,\n optionLabelRender,\n getOptionKeywords = (option: ComboboxOption<T, O>) => [\n String(option.value),\n reactNodeToString(option.label),\n ],\n ...rest\n }: ComboboxProps<T, M, O>,\n ref: React.ForwardedRef<HTMLDivElement>,\n) => {\n const [value, setValue] = useControlledState(\n controlledValue,\n onChange,\n defaultValue !== undefined ? defaultValue : multiple ? [] : undefined,\n );\n\n const [open, setOpen] = useControlledState(\n controlledOpen,\n onOpenChange,\n false,\n );\n const cls = useCls();\n\n // Get form context values\n const {\n status: contextStatus,\n // hasFeedback,\n // feedbackIcon,\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 handleValueChange = useCallback(\n (newValue: M extends true ? T[] : T) => {\n setValue(newValue);\n onChange?.(newValue);\n },\n [setValue, onChange],\n );\n\n const handleOptionSelect = useCallback(\n (optionValue: T) => {\n if (multiple) {\n const currentValues = (Array.isArray(value) ? value : []) as T[];\n const newValues = currentValues.includes(optionValue)\n ? currentValues.filter((v) => v !== optionValue)\n : [...currentValues, optionValue];\n (handleValueChange as (v: T[]) => void)(newValues);\n } else {\n (handleValueChange as (v: T) => void)(optionValue);\n // onOpenChange?.(false);\n }\n },\n [multiple, value, handleValueChange],\n );\n\n const handleSelectAll = useCallback(() => {\n if (multiple) {\n const allValues = options.map((option) => option.value);\n (handleValueChange as (v: T[]) => void)(allValues);\n }\n }, [multiple, options, handleValueChange]);\n\n const handleDeselectAll = useCallback(() => {\n if (multiple) {\n (handleValueChange as (v: T[]) => void)([]);\n }\n }, [multiple, handleValueChange]);\n\n // Convert options to DropdownMenu items\n const dropdownItems: DropdownMenuItemType[] = useMemo(() => {\n return options.map((option) => {\n return {\n type: \"item\",\n // todo: make this type better\n key: option.value as React.Key,\n icon: option.icon,\n label: option.label,\n disabled: option.disabled,\n onClick: () => !option.disabled && handleOptionSelect(option.value),\n };\n });\n }, [options, handleOptionSelect]);\n\n // Select all component for beforeList\n const selectAllComponent = useMemo(() => {\n if (!showSelectAll || !multiple || options.length === 0) {\n return null;\n }\n\n const selectedValues = Array.isArray(value) ? value : [];\n const filteredOptionValues = options.map((opt) => opt.value);\n const selectedFromFiltered = selectedValues.filter((val) =>\n filteredOptionValues.includes(val),\n );\n const checked =\n selectedFromFiltered.length === options.length && options.length > 0;\n const indeterminate =\n selectedFromFiltered.length > 0 &&\n selectedFromFiltered.length < options.length;\n\n const selectAllItem: DropdownMenuItemType & { type: \"item\" } = {\n type: \"item\",\n key: \"select_all\",\n label: \"Select All\",\n onClick: () => {\n if (indeterminate || checked) {\n handleDeselectAll();\n } else {\n handleSelectAll();\n }\n },\n };\n\n return (\n <>\n <DropdownMenuItem\n key=\"select_all\"\n item={selectAllItem}\n inCombobox={showSearch}\n selected={checked}\n showCheckbox\n indeterminate={indeterminate}\n renderAsNativeElement\n onSelect={() => {\n if (indeterminate || checked) {\n handleDeselectAll();\n } else {\n handleSelectAll();\n }\n }}\n />\n <DropdownMenuDivider />\n </>\n );\n }, [\n showSelectAll,\n multiple,\n options,\n value,\n showSearch,\n handleDeselectAll,\n handleSelectAll,\n ]);\n\n // Prepare trigger data\n const selectedValues = useMemo(() => {\n return Array.isArray(value) ? value : value ? [value] : [];\n }, [value]);\n const selectedOptions = selectedValues\n .map((val) => options.find((opt) => opt.value === val))\n .filter(Boolean);\n\n // Generate display value and prefix for SelectTrigger\n const { displayValue, displayPrefix } = useMemo(() => {\n if (selectedOptions.length === 0) {\n return { displayValue: undefined, displayPrefix: undefined };\n }\n\n if (multiple) {\n const summaryText = `${selectedOptions.length} ${\n selectedOptions.length === 1 ? \"item\" : \"items\"\n } selected`;\n if (showSelectionSummary) {\n if (selectionSummaryRender) {\n return {\n displayValue: selectionSummaryRender(selectedValues),\n displayPrefix: undefined,\n };\n }\n // Default summary with icons\n return {\n displayValue: summaryText,\n // TODO: Create icon component for multiple selection summary\n displayPrefix: undefined,\n };\n }\n // For non-summary multiple selection\n return selectedOptions.length === 1\n ? {\n displayValue: selectedOptions[0].label,\n displayPrefix: selectedOptions[0].icon,\n }\n : {\n displayValue: summaryText,\n displayPrefix: undefined,\n };\n }\n\n // Single selection\n const selectedOption = selectedOptions[0];\n return {\n displayValue: selectedOption?.label,\n displayPrefix: selectedOption?.icon,\n };\n }, [\n selectedOptions,\n multiple,\n showSelectionSummary,\n selectionSummaryRender,\n selectedValues,\n ]);\n\n return (\n <div ref={ref} className={clsx(cls(\"combobox\"), className)} {...rest}>\n <DropdownMenu\n items={dropdownItems}\n open={open}\n onOpenChange={setOpen}\n placement={placement}\n showSearch={showSearch}\n searchProps={{\n placeholder: \"Search options...\",\n ...searchProps,\n }}\n className={clsx(cls(\"combobox-dropdown\"))}\n classNames={{\n trigger: clsx(cls(\"combobox-trigger-wrapper\")),\n popup: clsx(cls(\"combobox-popup\")),\n item: clsx(cls(\"combobox-option\"), classNames?.option),\n ...classNames,\n }}\n popupMatchTriggerWidth\n keepOpenOnSelect={multiple}\n highlightedItemKey={multiple ? undefined : selectedValues[0]}\n showCheckbox={multiple}\n beforeList={selectAllComponent}\n selectedItemKeys={selectedValues}\n getItemKeywords={\n getOptionKeywords\n ? (item) => {\n const selectedOption = options.find(\n (option) => option.value === item.key,\n );\n if (!selectedOption) {\n return [];\n }\n return getOptionKeywords(selectedOption);\n }\n : undefined\n }\n itemLabelRender={\n optionLabelRender\n ? (item, props) => {\n const selectedOption = options.find(\n (option) => option.value === item.key,\n );\n if (!selectedOption) {\n return null;\n }\n return optionLabelRender?.(selectedOption, props);\n }\n : undefined\n }\n {...dropdownMenuProps}\n >\n <SelectTrigger\n value={displayValue}\n prefix={displayPrefix}\n placeholder={placeholder}\n disabled={disabled}\n status={mergedStatus}\n open={open}\n size={size}\n allowClear={allowClear}\n suffixIcon={suffixIcon}\n clearIcon={clearIcon}\n classNames={{\n trigger: classNames?.trigger,\n ...triggerProps?.classNames,\n }}\n onClear={() => {\n if (multiple) {\n (handleValueChange as (v: T[]) => void)([]);\n } else {\n handleValueChange(undefined);\n }\n }}\n onOpenChange={setOpen}\n role=\"combobox\"\n {...triggerProps}\n />\n </DropdownMenu>\n </div>\n );\n};\n\nconst MainCombobox = forwardRef(ComboboxInner) as <\n T extends React.Key,\n M extends boolean,\n O extends Record<string, unknown> = {},\n>(\n props: ComboboxProps<T, M, O> & { ref?: ForwardedRef<HTMLDivElement> },\n) => ReturnType<typeof ComboboxInner>;\n\nexport const Combobox = Object.assign(MainCombobox, {\n // Add any sub components here if needed\n});\n\nexport default Combobox;\n"],"names":["ComboboxInner","options","controlledValue","defaultValue","onChange","placeholder","disabledProp","statusProp","allowClear","multiple","maxTagCount","showSearch","controlledOpen","onOpenChange","placement","className","classNames","size","_loading","optionRender","onSearch","dropdownRender","clearIcon","suffixIcon","dropdownMenuProps","triggerProps","searchProps","showSelectionSummary","selectionSummaryRender","showSelectAll","selectAllRender","optionLabelRender","getOptionKeywords","option","reactNodeToString","rest","ref","value","setValue","useControlledState","open","setOpen","cls","useCls","contextStatus","useContext","FormItemInputContext","contextDisabled","DisabledContext","mergedStatus","disabled","handleValueChange","useCallback","newValue","handleOptionSelect","optionValue","currentValues","newValues","v","handleSelectAll","allValues","handleDeselectAll","dropdownItems","useMemo","selectAllComponent","selectedValues","filteredOptionValues","opt","selectedFromFiltered","val","checked","indeterminate","jsxs","Fragment","jsx","DropdownMenuItem","DropdownMenuDivider","selectedOptions","displayValue","displayPrefix","summaryText","selectedOption","clsx","DropdownMenu","item","props","SelectTrigger","MainCombobox","forwardRef","Combobox"],"mappings":";;;;;;;;;;;;;;AAuJA,MAAMA,KAAgB,CAKpB;AAAA,EACE,SAAAC,IAAU,CAAC;AAAA,EACX,OAAOC;AAAA,EACP,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,UAAUC,IAAe;AAAA,EACzB,QAAQC;AAAA,EACR,YAAAC,IAAa;AAAA,EACb,UAAAC,IAAW;AAAA,EACX,aAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,MAAMC;AAAA,EACN,cAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,SAASC,KAAW;AAAA,EACpB,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC;AAAA,EACA,sBAAAC,IAAuB;AAAA,EACvB,wBAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,iBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,mBAAAC,IAAoB,CAACC,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