@bioturing/components 0.46.1 → 0.46.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sources":["../../../src/components/combobox/component.tsx"],"sourcesContent":["\"use client\";\nimport { Combobox as BaseCombobox } from \"@base-ui/react/combobox\";\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 useRef,\n useState,\n} from \"react\";\nimport { BaseMenuItem } from \"../base-menu\";\nimport { useControlledState } from \"../hooks\";\nimport { SelectTrigger } from \"../select-trigger\";\nimport { clsx, reactNodeToString, useCls } from \"../utils\";\n\nimport { XIcon } from \"@bioturing/assets\";\nimport { BaseMenu } from \"../base-menu\";\nimport { Empty } from \"../empty\";\nimport { splitBySeparators } from \"./utils\";\nimport \"./style.css\";\n\n// Module-level static renderers — avoid recreating on every render\nconst positionerRender = (props: React.ComponentProps<\"div\">) => <BaseMenu.Root {...props} />;\nconst popupRender = (props: React.ComponentProps<\"div\">) => <BaseMenu.Popup {...props} />;\nconst separatorRender = (props: React.ComponentProps<\"div\">) => <BaseMenu.Divider {...props} />;\nconst listRender = (props: React.ComponentProps<\"div\">) => <BaseMenu.List {...props} />;\n\nexport type ComboboxOption<T extends React.Key, O extends Record<string, unknown> = {}> = {\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 list?: string;\n portal?: 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 /**\n * Filter function for search\n * - `true` or `undefined`: default filtering (splits by tokenSeparators if provided)\n * - `false`: disables filtering\n * - custom function: `(input, option) => boolean`\n * @default true\n */\n filterOption?: boolean | ((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 // * 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 * Whether the popup width should match the trigger width.\n * When `false`, the popup can exceed the trigger width to fit long option labels.\n * @default true\n */\n popupMatchSelectWidth?: boolean;\n /**\n * Allow adding items by typing the exact label or value and pressing Enter.\n * @default false\n */\n addOnEnter?: boolean;\n /**\n * Characters to split input by when adding multiple items on Enter.\n * Only applies when `addOnEnter` and `multiple` are true.\n * @default undefined\n */\n tokenSeparators?: string[];\n /**\n * Automatically highlight the first matching item while filtering.\n * When enabled in single-select mode, Enter selects the highlighted\n * item natively and `addOnEnter` is ignored to avoid conflicts.\n * @default true\n */\n autoHighlight?: boolean;\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 showSearch: _showSearch = true,\n open: controlledOpen,\n onOpenChange,\n className,\n classNames,\n size = \"middle\",\n optionRender,\n onSearch,\n clearIcon,\n suffixIcon,\n placement = \"bottomLeft\",\n // showSelectionSummary: _showSelectionSummary = false,\n // selectionSummaryRender,\n showSelectAll = false,\n optionLabelRender,\n getOptionKeywords: _getOptionKeywords = (option: ComboboxOption<T, O>) => [\n String(option.value),\n reactNodeToString(option.label),\n ],\n popupMatchSelectWidth = true,\n addOnEnter = false,\n tokenSeparators,\n autoHighlight = true,\n filterOption,\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 ? ([] as T[]) : undefined,\n );\n\n const [open, setOpen] = useControlledState(controlledOpen, onOpenChange, false);\n\n const cls = useCls();\n const inputContainerRef = useRef<HTMLDivElement>(null);\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 handleValueChange = useCallback(\n (newValue: M extends true ? T[] : T) => {\n setValue(newValue);\n onChange?.(newValue);\n },\n [setValue, onChange],\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 const handleClear = useCallback(() => {\n if (multiple) {\n (handleValueChange as (v: T[]) => void)([]);\n } else {\n (handleValueChange as (v: T) => void)(undefined as T);\n }\n }, [multiple, handleValueChange]);\n\n // Prepare selected values\n const selectedValues = useMemo(() => {\n return Array.isArray(value) ? value : value ? [value] : [];\n }, [value]);\n\n // Build a Map for O(1) option lookups.\n // `options.find()` was being called 7+ times per render and inside\n // the hot `filter` path on every keystroke.\n const optionMap = useMemo(() => {\n const map = new Map<T, ComboboxOption<T, O>>();\n for (const opt of options) {\n map.set(opt.value, opt);\n }\n return map;\n }, [options]);\n\n // Select all option logic\n const selectAllOption = useMemo(() => {\n if (!showSelectAll || !multiple || options.length === 0) {\n return null;\n }\n\n const selectedFromFiltered = selectedValues.filter((val) => optionMap.has(val as T));\n const checked = selectedFromFiltered.length === options.length && options.length > 0;\n const indeterminate =\n selectedFromFiltered.length > 0 && selectedFromFiltered.length < options.length;\n\n return {\n checked,\n indeterminate,\n onToggle: () => {\n if (indeterminate || checked) {\n handleDeselectAll();\n } else {\n handleSelectAll();\n }\n },\n };\n }, [showSelectAll, multiple, options, optionMap, selectedValues, handleDeselectAll, handleSelectAll]);\n\n // Convert options to Base UI format\n const baseUIItems = useMemo(() => options.map((opt) => opt.value), [options]);\n\n // Get display value for SelectTrigger\n const displayValue = useMemo(() => {\n if (multiple) {\n return selectedValues.length > 0\n ? `${selectedValues.length} item${selectedValues.length === 1 ? \"\" : \"s\"} selected`\n : null;\n } else {\n const selectedOption = optionMap.get(selectedValues[0] as T);\n return selectedOption?.label || null;\n }\n }, [multiple, selectedValues, optionMap]);\n\n const inputClassName = clsx(\n cls(\"combobox-input\"),\n cls(`combobox-input-${size}`),\n mergedStatus && cls(`combobox-input-${mergedStatus}`),\n classNames?.input,\n );\n\n const itemToStringLabel = useCallback(\n (itemValue: T) => {\n const option = optionMap.get(itemValue);\n return reactNodeToString(option?.label || String(itemValue));\n },\n [optionMap],\n );\n\n const [searchValue, setSearchValue] = useState(\"\");\n\n const findOptionByInput = useCallback(\n (input: string): ComboboxOption<T, O> | undefined => {\n const trimmed = input.trim();\n if (!trimmed) return undefined;\n const lowerTrimmed = trimmed.toLowerCase();\n\n // Fast path: exact match by value (O(1))\n for (const [val, opt] of optionMap) {\n if (String(val).toLowerCase() === lowerTrimmed) {\n return opt;\n }\n }\n // Fallback: match by label\n for (const opt of optionMap.values()) {\n if (reactNodeToString(opt.label).toLowerCase() === lowerTrimmed) {\n return opt;\n }\n }\n return undefined;\n },\n [optionMap],\n );\n\n const handleAddOnEnter = useCallback(\n (input: string): boolean => {\n if (!addOnEnter || !input.trim()) return false;\n\n const tokens =\n multiple && tokenSeparators && tokenSeparators.length > 0\n ? splitBySeparators(input, tokenSeparators)\n : [input.trim()];\n\n const matchedValues: T[] = [];\n for (const token of tokens) {\n const option = findOptionByInput(token);\n if (option && !option.disabled) {\n matchedValues.push(option.value);\n }\n }\n\n if (matchedValues.length === 0) return false;\n\n if (multiple) {\n const current = Array.isArray(value) ? [...value] : [];\n const newValues = [...new Set([...current, ...matchedValues])];\n (handleValueChange as (v: T[]) => void)(newValues);\n } else {\n (handleValueChange as (v: T) => void)(matchedValues[0]);\n setOpen(false);\n }\n\n return true;\n },\n [\n addOnEnter,\n multiple,\n tokenSeparators,\n findOptionByInput,\n value,\n handleValueChange,\n setOpen,\n ],\n );\n\n const hasSeparator = useMemo(() => {\n if (!tokenSeparators || tokenSeparators.length === 0) return false;\n return tokenSeparators.some((sep) => searchValue.includes(sep));\n }, [searchValue, tokenSeparators]);\n\n const effectiveAutoHighlight = multiple ? autoHighlight && !hasSeparator : autoHighlight;\n\n const createInputKeyDownHandler = useCallback(\n (currentSearchValue: string) => (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === \"Enter\" && addOnEnter && currentSearchValue) {\n // In single-select mode with autoHighlight, let Base UI handle Enter\n // to select the natively highlighted item instead of exact matching.\n if (!multiple && autoHighlight) return;\n\n const matched = handleAddOnEnter(currentSearchValue);\n if (matched) {\n event.preventDefault();\n setSearchValue(\"\");\n onSearch?.(\"\");\n }\n }\n },\n [addOnEnter, autoHighlight, multiple, handleAddOnEnter, onSearch],\n );\n\n const mergedFilter = useMemo(() => {\n if (filterOption === false) {\n return null;\n }\n\n if (typeof filterOption === \"function\") {\n return (itemValue: T, query: string) => {\n const option = optionMap.get(itemValue);\n return filterOption(query, option);\n };\n }\n\n return (itemValue: T, query: string) => {\n if (!query) return true;\n const option = optionMap.get(itemValue);\n if (!option) return false;\n\n const tokens =\n tokenSeparators && tokenSeparators.length > 0\n ? splitBySeparators(query, tokenSeparators)\n : [query];\n\n const keywords = _getOptionKeywords(option).map((k) => k.toLowerCase());\n\n return tokens.some((token) => {\n const lowerToken = token.toLowerCase();\n return keywords.some((keyword) => keyword.includes(lowerToken));\n });\n };\n }, [filterOption, optionMap, tokenSeparators, _getOptionKeywords]);\n\n return (\n <div ref={ref} className={clsx(cls(\"combobox\"), className)} {...rest}>\n <BaseCombobox.Root<T, M>\n value={\n (multiple ? selectedValues : (selectedValues[0] ?? null)) as M extends true\n ? T[]\n : T | null\n }\n onValueChange={(newValue) => {\n if (multiple) {\n (handleValueChange as (v: T[]) => void)(\n Array.isArray(newValue) ? (newValue as T[]) : [],\n );\n } else {\n (handleValueChange as (v: T) => void)(newValue as T);\n }\n }}\n inputValue={searchValue}\n onInputValueChange={(val: string) => {\n setSearchValue(val);\n onSearch?.(val);\n }}\n open={open}\n onOpenChange={setOpen}\n multiple={multiple}\n disabled={disabled}\n autoHighlight={effectiveAutoHighlight}\n items={baseUIItems}\n itemToStringLabel={itemToStringLabel}\n filter={mergedFilter}\n >\n {/* Single Selection Layout using SelectTrigger compound components */}\n {!multiple ? (\n <SelectTrigger.Root\n ref={inputContainerRef}\n as=\"div\"\n size={size}\n disabled={disabled}\n open={open}\n status={mergedStatus}\n placeholder={placeholder}\n displayValue={displayValue}\n allowClear={allowClear}\n suffixIcon={suffixIcon}\n clearIcon={clearIcon}\n onClear={handleClear}\n onOpenChange={setOpen}\n className={clsx(classNames?.trigger, cls(\"combobox-trigger-single\"))}\n >\n <SelectTrigger.Content\n contentRender={({ className, children, ...rest }) => (\n <BaseCombobox.Input\n placeholder={placeholder}\n className={clsx(className, inputClassName)}\n disabled={disabled}\n onKeyDown={createInputKeyDownHandler(searchValue)}\n {...rest}\n />\n )}\n />\n <SelectTrigger.Clear\n render={(props) => <BaseCombobox.Clear {...props}></BaseCombobox.Clear>}\n />\n <SelectTrigger.Arrow\n render={(props, { icon }) => (\n <BaseCombobox.Trigger {...props}>\n <BaseCombobox.Icon>{icon}</BaseCombobox.Icon>\n </BaseCombobox.Trigger>\n )}\n />\n </SelectTrigger.Root>\n ) : (\n /* Multiple Selection Layout using SelectTrigger compound components */\n <SelectTrigger.Root\n ref={inputContainerRef}\n size={size}\n disabled={disabled}\n open={open}\n status={mergedStatus}\n placeholder={placeholder}\n displayValue={displayValue}\n allowClear={allowClear}\n suffixIcon={suffixIcon}\n clearIcon={clearIcon}\n onClear={handleClear}\n onOpenChange={setOpen}\n className={clsx(classNames?.trigger, cls(\"combobox-trigger-multiple\"))}\n as=\"div\"\n >\n <SelectTrigger.Content\n contentRender={({ className, children, ...rest }) => (\n <BaseCombobox.Chips className={clsx(cls(\"combobox-chips\"), className)} {...rest}>\n <BaseCombobox.Value>\n {(selectedItems) => (\n <>\n {selectedItems.map((item: T) => {\n const option = optionMap.get(item);\n return (\n <BaseCombobox.Chip key={item} className={clsx(cls(\"combobox-chip\"))}>\n {option?.icon && (\n <span className={clsx(cls(\"combobox-chip-icon\"))}>\n {option.icon}\n </span>\n )}\n <span className={clsx(cls(\"combobox-chip-text\"))}>\n {option\n ? optionLabelRender\n ? optionLabelRender(option)\n : option.label\n : item}\n </span>\n <BaseCombobox.ChipRemove\n className={clsx(cls(\"combobox-chip-remove\"))}\n >\n <XIcon />\n </BaseCombobox.ChipRemove>\n </BaseCombobox.Chip>\n );\n })}\n\n <BaseCombobox.Input\n placeholder={selectedItems.length > 0 ? \"\" : placeholder}\n className={inputClassName}\n disabled={disabled}\n onKeyDown={createInputKeyDownHandler(searchValue)}\n />\n </>\n )}\n </BaseCombobox.Value>\n </BaseCombobox.Chips>\n )}\n />\n <SelectTrigger.Clear\n render={(props) => <BaseCombobox.Clear {...props}></BaseCombobox.Clear>}\n />\n <SelectTrigger.Arrow\n render={(props, { icon }) => (\n <BaseCombobox.Trigger {...props}>\n <BaseCombobox.Icon>{icon}</BaseCombobox.Icon>\n </BaseCombobox.Trigger>\n )}\n />\n </SelectTrigger.Root>\n )}\n\n <BaseCombobox.Portal>\n <BaseCombobox.Positioner\n anchor={inputContainerRef.current}\n sideOffset={4}\n side={placement.startsWith(\"top\") ? \"top\" : \"bottom\"}\n align={\n placement.endsWith(\"Right\")\n ? \"end\"\n : placement === \"top\" || placement === \"bottom\"\n ? \"center\"\n : \"start\"\n }\n render={positionerRender}\n >\n <BaseCombobox.Popup\n className={clsx(\n cls(\"combobox-popup\"),\n !popupMatchSelectWidth && cls(\"combobox-popup--auto-width\"),\n classNames?.portal,\n )}\n render={popupRender}\n >\n {/* Select All Option */}\n {selectAllOption && (\n <>\n <BaseMenuItem\n as=\"button\"\n type=\"button\"\n className={clsx(cls(\"combobox-select-all\"))}\n selected={selectAllOption.checked}\n onClick={selectAllOption.onToggle}\n indeterminate={selectAllOption.indeterminate}\n showCheckbox\n >\n Select All\n </BaseMenuItem>\n <BaseCombobox.Separator render={separatorRender} />\n </>\n )}\n <BaseCombobox.List\n className={clsx(cls(\"combobox-list\"), classNames?.list)}\n render={listRender}\n >\n {(item: T) => {\n const option = optionMap.get(item);\n if (!option) return null;\n const isSelected = (selectedValues as T[]).includes(item);\n return optionRender ? (\n optionRender(option, {})\n ) : (\n <BaseMenuItem\n key={option.value}\n disabled={option.disabled}\n selected={isSelected}\n showCheckbox={multiple}\n icon={option.icon}\n classNames={{\n root: clsx(classNames?.option),\n icon: classNames?.optionIcon,\n text: classNames?.optionText,\n }}\n labelRender={\n optionLabelRender\n ? (props: React.HTMLAttributes<HTMLElement>) =>\n optionLabelRender(option, props)\n : undefined\n }\n render={(props: React.HTMLAttributes<HTMLElement>) => (\n <BaseCombobox.Item\n value={item as T}\n disabled={option.disabled}\n {...props}\n data-disabled={option.disabled}\n data-selected={isSelected}\n />\n )}\n >\n {option.label}\n </BaseMenuItem>\n );\n }}\n </BaseCombobox.List>\n\n <BaseCombobox.Empty className={clsx(cls(\"combobox-empty\"))}>\n <Empty description=\"No options found\" />\n </BaseCombobox.Empty>\n </BaseCombobox.Popup>\n </BaseCombobox.Positioner>\n </BaseCombobox.Portal>\n </BaseCombobox.Root>\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":["positionerRender","props","jsx","BaseMenu","popupRender","separatorRender","listRender","ComboboxInner","options","controlledValue","defaultValue","onChange","placeholder","disabledProp","statusProp","allowClear","multiple","_showSearch","controlledOpen","onOpenChange","className","classNames","size","optionRender","onSearch","clearIcon","suffixIcon","placement","showSelectAll","optionLabelRender","_getOptionKeywords","option","reactNodeToString","popupMatchSelectWidth","addOnEnter","tokenSeparators","autoHighlight","filterOption","rest","ref","value","setValue","useControlledState","open","setOpen","cls","useCls","inputContainerRef","useRef","contextStatus","useContext","FormItemInputContext","contextDisabled","DisabledContext","mergedStatus","disabled","handleValueChange","useCallback","newValue","handleSelectAll","allValues","handleDeselectAll","handleClear","selectedValues","useMemo","optionMap","map","opt","selectAllOption","selectedFromFiltered","val","checked","indeterminate","baseUIItems","displayValue","inputClassName","clsx","itemToStringLabel","itemValue","searchValue","setSearchValue","useState","findOptionByInput","input","trimmed","lowerTrimmed","handleAddOnEnter","tokens","splitBySeparators","matchedValues","token","current","newValues","hasSeparator","sep","effectiveAutoHighlight","createInputKeyDownHandler","currentSearchValue","event","mergedFilter","query","keywords","k","lowerToken","keyword","jsxs","BaseCombobox","SelectTrigger","children","selectedItems","Fragment","item","XIcon","icon","BaseMenuItem","isSelected","Empty","MainCombobox","forwardRef","Combobox"],"mappings":";;;;;;;;;;;;;;;;;AA2BA,MAAMA,KAAmB,CAACC,MAAuC,gBAAAC,EAACC,EAAS,MAAT,EAAe,GAAGF,GAAO,GACrFG,KAAc,CAACH,MAAuC,gBAAAC,EAACC,EAAS,OAAT,EAAgB,GAAGF,GAAO,GACjFI,KAAkB,CAACJ,MAAuC,gBAAAC,EAACC,EAAS,SAAT,EAAkB,GAAGF,GAAO,GACvFK,KAAa,CAACL,MAAuC,gBAAAC,EAACC,EAAS,MAAT,EAAe,GAAGF,GAAO,GA8I/EM,KAAgB,CAKpB;AAAA,EACE,SAAAC,IAAU,CAAA;AAAA,EACV,OAAOC;AAAA,EACP,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,UAAUC,KA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A,8BAClB,MAAMA,GAAY;AAAA,4BAAA;AAAA,4BAEpB,aACEQ,IACI,CAAC5B,MACC4B,EAAkBE,GAAQ9B,CAAK,IACjC;AAAA,4BAEN,QAAQ,CAACA,MACP,gBAAAC;AAAA,8BAACwG,EAAa;AAAA,8BAAb;AAAA,gCACC,OAAOK;AAAA,gCACP,UAAUhF,EAAO;AAAA,gCAChB,GAAG9B;AAAA,gCACJ,iBAAe8B,EAAO;AAAA,gCACtB,iBAAeoF;AAAA,8BAAA;AAAA,4BAAA;AAAA,4BAIlB,UAAApF,EAAO;AAAA,0BAAA;AAAA,0BA1BHA,EAAO;AAAA,wBAAA;AAAA,sBA6BlB;AAAA,oBAAA;AAAA,kBAAA;AAAA,kBAGF,gBAAA7B,EAACwG,EAAa,OAAb,EAAmB,WAAW9B,EAAK/B,EAAI,gBAAgB,CAAC,GACvD,UAAA,gBAAA3C,EAACkH,IAAA,EAAM,aAAY,oBAAmB,EAAA,CACxC;AAAA,gBAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UACF;AAAA,QAAA,EACF,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ,GAEMC,KAAeC,GAAW/G,EAAa,GAQhCgH,KAAW,OAAO,OAAOF,IAAc;AAAA;AAEpD,CAAC;"}
1
+ {"version":3,"file":"component.js","sources":["../../../src/components/combobox/component.tsx"],"sourcesContent":["\"use client\";\nimport { Combobox as BaseCombobox } from \"@base-ui/react/combobox\";\nimport DisabledContext from \"antd/es/config-provider/DisabledContext\";\nimport { FormItemInputContext } from \"antd/es/form/context\";\nimport React, {\n ForwardedRef,\n forwardRef,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { BaseMenuItem } from \"../base-menu\";\nimport { useControlledState } from \"../hooks\";\nimport { ScrollArea } from \"../scroll-area\";\nimport { SelectTrigger } from \"../select-trigger\";\nimport { clsx, reactNodeToString, useCls } from \"../utils\";\n\nimport { XIcon } from \"@bioturing/assets\";\nimport { BaseMenu } from \"../base-menu\";\nimport { Empty } from \"../empty\";\nimport type { ComboboxOption, ComboboxProps } from \"./types\";\nimport { splitBySeparators } from \"./utils\";\nimport { useComboboxTokenInput } from \"./use-combobox-token-input\";\nimport \"./style.css\";\n\nexport type { ComboboxOption, ComboboxProps } from \"./types\";\n\n// Module-level static renderers — avoid recreating on every render\nconst positionerRender = (props: React.ComponentProps<\"div\">) => <BaseMenu.Root {...props} />;\nconst popupRender = (props: React.ComponentProps<\"div\">) => <BaseMenu.Popup {...props} />;\nconst separatorRender = (props: React.ComponentProps<\"div\">) => <BaseMenu.Divider {...props} />;\nconst listRender = (props: React.ComponentProps<\"div\">) => <BaseMenu.List {...props} />;\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 showSearch: _showSearch = true,\n open: controlledOpen,\n onOpenChange,\n className,\n classNames,\n size = \"middle\",\n optionRender,\n onSearch,\n clearIcon,\n suffixIcon,\n placement = \"bottomLeft\",\n // showSelectionSummary: _showSelectionSummary = false,\n // selectionSummaryRender,\n showSelectAll = false,\n optionLabelRender,\n getOptionKeywords: _getOptionKeywords = (option: ComboboxOption<T, O>) => [\n String(option.value),\n reactNodeToString(option.label),\n ],\n popupMatchSelectWidth = true,\n addOnEnter = false,\n tokenSeparators,\n autoHighlight = true,\n filterOption,\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 ? ([] as T[]) : undefined,\n );\n\n const [open, setOpen] = useControlledState(controlledOpen, onOpenChange, false);\n\n const cls = useCls();\n const inputContainerRef = useRef<HTMLDivElement>(null);\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 handleValueChange = useCallback(\n (newValue: M extends true ? T[] : T) => {\n setValue(newValue);\n onChange?.(newValue);\n },\n [setValue, onChange],\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 const handleClear = useCallback(() => {\n if (multiple) {\n (handleValueChange as (v: T[]) => void)([]);\n } else {\n (handleValueChange as (v: T) => void)(undefined as T);\n }\n }, [multiple, handleValueChange]);\n\n // Prepare selected values\n const selectedValues = useMemo(() => {\n return Array.isArray(value) ? value : value ? [value] : [];\n }, [value]);\n\n // Build a Map for O(1) option lookups.\n // `options.find()` was being called 7+ times per render and inside\n // the hot `filter` path on every keystroke.\n const optionMap = useMemo(() => {\n const map = new Map<T, ComboboxOption<T, O>>();\n for (const opt of options) {\n map.set(opt.value, opt);\n }\n return map;\n }, [options]);\n\n // Select all option logic\n const selectAllOption = useMemo(() => {\n if (!showSelectAll || !multiple || options.length === 0) {\n return null;\n }\n\n const selectedFromFiltered = selectedValues.filter((val) => optionMap.has(val as T));\n const checked = selectedFromFiltered.length === options.length && options.length > 0;\n const indeterminate =\n selectedFromFiltered.length > 0 && selectedFromFiltered.length < options.length;\n\n return {\n checked,\n indeterminate,\n onToggle: () => {\n if (indeterminate || checked) {\n handleDeselectAll();\n } else {\n handleSelectAll();\n }\n },\n };\n }, [showSelectAll, multiple, options, optionMap, selectedValues, handleDeselectAll, handleSelectAll]);\n\n // Convert options to Base UI format\n const baseUIItems = useMemo(() => options.map((opt) => opt.value), [options]);\n\n // Get display value for SelectTrigger\n const displayValue = useMemo(() => {\n if (multiple) {\n return selectedValues.length > 0\n ? `${selectedValues.length} item${selectedValues.length === 1 ? \"\" : \"s\"} selected`\n : null;\n } else {\n const selectedOption = optionMap.get(selectedValues[0] as T);\n return selectedOption?.label || null;\n }\n }, [multiple, selectedValues, optionMap]);\n\n const inputClassName = clsx(\n cls(\"combobox-input\"),\n cls(`combobox-input-${size}`),\n mergedStatus && cls(`combobox-input-${mergedStatus}`),\n classNames?.input,\n );\n\n const itemToStringLabel = useCallback(\n (itemValue: T) => {\n const option = optionMap.get(itemValue);\n return reactNodeToString(option?.label || String(itemValue));\n },\n [optionMap],\n );\n\n const [searchValue, setSearchValue] = useState(\"\");\n\n const { handleAddOnEnter, handleInputValueChange } = useComboboxTokenInput<T, O>({\n addOnEnter,\n multiple,\n tokenSeparators,\n optionMap,\n value: value as T | T[] | undefined,\n handleValueChange: handleValueChange as (nextValue: T | T[]) => void,\n setOpen,\n setSearchValue,\n onSearch,\n });\n\n const hasTokenSeparators = Boolean(tokenSeparators?.length);\n const effectiveAutoHighlight = multiple && hasTokenSeparators ? false : autoHighlight;\n\n const createInputKeyDownHandler = useCallback(\n (currentSearchValue: string) => (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === \"Enter\" && addOnEnter && currentSearchValue) {\n // In single-select mode with autoHighlight, let Base UI handle Enter\n // to select the natively highlighted item instead of exact matching.\n if (!multiple && autoHighlight) return;\n\n const matched = handleAddOnEnter(currentSearchValue);\n if (matched) {\n event.preventDefault();\n setSearchValue(\"\");\n onSearch?.(\"\");\n }\n }\n },\n [addOnEnter, autoHighlight, multiple, handleAddOnEnter, onSearch],\n );\n\n const mergedFilter = useMemo(() => {\n if (filterOption === false) {\n return null;\n }\n\n if (typeof filterOption === \"function\") {\n return (itemValue: T, query: string) => {\n const option = optionMap.get(itemValue);\n return filterOption(query, option);\n };\n }\n\n return (itemValue: T, query: string) => {\n if (!query) return true;\n const option = optionMap.get(itemValue);\n if (!option) return false;\n\n const tokens =\n tokenSeparators && tokenSeparators.length > 0\n ? splitBySeparators(query, tokenSeparators)\n : [query];\n\n const keywords = _getOptionKeywords(option).map((k) => k.toLowerCase());\n\n const matchingTokenCount = tokens.filter((token) => {\n const lowerToken = token.toLowerCase();\n return keywords.some((keyword) => keyword.includes(lowerToken));\n }).length;\n\n if (matchingTokenCount === 0) return false;\n if (tokens.length > 1 && matchingTokenCount > 1) {\n const lowerQuery = query.toLowerCase();\n return keywords.some((keyword) => keyword.includes(lowerQuery));\n }\n return true;\n };\n }, [filterOption, optionMap, tokenSeparators, _getOptionKeywords]);\n\n return (\n <div ref={ref} className={clsx(cls(\"combobox\"), className)} {...rest}>\n <BaseCombobox.Root<T, M>\n value={\n (multiple ? selectedValues : (selectedValues[0] ?? null)) as M extends true\n ? T[]\n : T | null\n }\n onValueChange={(newValue) => {\n if (multiple) {\n (handleValueChange as (v: T[]) => void)(\n Array.isArray(newValue) ? (newValue as T[]) : [],\n );\n } else {\n (handleValueChange as (v: T) => void)(newValue as T);\n }\n }}\n inputValue={searchValue}\n onInputValueChange={handleInputValueChange}\n open={open}\n onOpenChange={setOpen}\n multiple={multiple}\n disabled={disabled}\n autoHighlight={effectiveAutoHighlight}\n items={baseUIItems}\n itemToStringLabel={itemToStringLabel}\n filter={mergedFilter}\n >\n {/* Single Selection Layout using SelectTrigger compound components */}\n {!multiple ? (\n <SelectTrigger.Root\n ref={inputContainerRef}\n as=\"div\"\n size={size}\n disabled={disabled}\n open={open}\n status={mergedStatus}\n placeholder={placeholder}\n displayValue={displayValue}\n allowClear={allowClear}\n suffixIcon={suffixIcon}\n clearIcon={clearIcon}\n onClear={handleClear}\n onOpenChange={setOpen}\n className={clsx(classNames?.trigger, cls(\"combobox-trigger-single\"))}\n >\n <SelectTrigger.Content\n contentRender={({ className, children, ...rest }) => (\n <BaseCombobox.Input\n placeholder={placeholder}\n className={clsx(className, inputClassName)}\n disabled={disabled}\n onKeyDown={createInputKeyDownHandler(searchValue)}\n {...rest}\n />\n )}\n />\n <SelectTrigger.Clear\n render={(props) => <BaseCombobox.Clear {...props}></BaseCombobox.Clear>}\n />\n <SelectTrigger.Arrow\n render={(props, { icon }) => (\n <BaseCombobox.Trigger {...props}>\n <BaseCombobox.Icon>{icon}</BaseCombobox.Icon>\n </BaseCombobox.Trigger>\n )}\n />\n </SelectTrigger.Root>\n ) : (\n /* Multiple Selection Layout using SelectTrigger compound components */\n <SelectTrigger.Root\n ref={inputContainerRef}\n size={size}\n disabled={disabled}\n open={open}\n status={mergedStatus}\n placeholder={placeholder}\n displayValue={displayValue}\n allowClear={allowClear}\n suffixIcon={suffixIcon}\n clearIcon={clearIcon}\n onClear={handleClear}\n onOpenChange={setOpen}\n className={clsx(classNames?.trigger, cls(\"combobox-trigger-multiple\"))}\n as=\"div\"\n >\n <SelectTrigger.Content\n contentRender={({ className, children, ...rest }) => (\n <BaseCombobox.Chips className={clsx(cls(\"combobox-chips\"), className)} {...rest}>\n <BaseCombobox.Value>\n {(selectedItems) => (\n <>\n {selectedItems.map((item: T) => {\n const option = optionMap.get(item);\n return (\n <BaseCombobox.Chip key={item} className={clsx(cls(\"combobox-chip\"))}>\n {option?.icon && (\n <span className={clsx(cls(\"combobox-chip-icon\"))}>\n {option.icon}\n </span>\n )}\n <span className={clsx(cls(\"combobox-chip-text\"))}>\n {option\n ? optionLabelRender\n ? optionLabelRender(option)\n : option.label\n : item}\n </span>\n <BaseCombobox.ChipRemove\n className={clsx(cls(\"combobox-chip-remove\"))}\n >\n <XIcon />\n </BaseCombobox.ChipRemove>\n </BaseCombobox.Chip>\n );\n })}\n\n <BaseCombobox.Input\n placeholder={selectedItems.length > 0 ? \"\" : placeholder}\n className={inputClassName}\n disabled={disabled}\n onKeyDown={createInputKeyDownHandler(searchValue)}\n />\n </>\n )}\n </BaseCombobox.Value>\n </BaseCombobox.Chips>\n )}\n />\n <SelectTrigger.Clear\n render={(props) => <BaseCombobox.Clear {...props}></BaseCombobox.Clear>}\n />\n <SelectTrigger.Arrow\n render={(props, { icon }) => (\n <BaseCombobox.Trigger {...props}>\n <BaseCombobox.Icon>{icon}</BaseCombobox.Icon>\n </BaseCombobox.Trigger>\n )}\n />\n </SelectTrigger.Root>\n )}\n\n <BaseCombobox.Portal>\n <BaseCombobox.Positioner\n anchor={inputContainerRef.current}\n sideOffset={4}\n side={placement.startsWith(\"top\") ? \"top\" : \"bottom\"}\n align={\n placement.endsWith(\"Right\")\n ? \"end\"\n : placement === \"top\" || placement === \"bottom\"\n ? \"center\"\n : \"start\"\n }\n render={positionerRender}\n >\n <BaseCombobox.Popup\n className={clsx(\n cls(\"combobox-popup\"),\n !popupMatchSelectWidth && cls(\"combobox-popup--auto-width\"),\n classNames?.portal,\n )}\n render={popupRender}\n >\n <div className={clsx(cls(\"combobox-container\"))}>\n {/* Select All Option */}\n {selectAllOption && (\n <>\n <BaseMenuItem\n as=\"button\"\n type=\"button\"\n className={clsx(cls(\"combobox-select-all\"))}\n selected={selectAllOption.checked}\n onClick={selectAllOption.onToggle}\n indeterminate={selectAllOption.indeterminate}\n showCheckbox\n >\n Select All\n </BaseMenuItem>\n <BaseCombobox.Separator render={separatorRender} />\n </>\n )}\n <ScrollArea fadeEdges>\n <BaseCombobox.List\n className={clsx(cls(\"combobox-list\"), classNames?.list)}\n render={listRender}\n >\n {(item: T) => {\n const option = optionMap.get(item);\n if (!option) return null;\n const isSelected = (selectedValues as T[]).includes(item);\n return optionRender ? (\n optionRender(option, {})\n ) : (\n <BaseMenuItem\n key={option.value}\n disabled={option.disabled}\n selected={isSelected}\n showCheckbox={multiple}\n icon={option.icon}\n classNames={{\n root: clsx(classNames?.option),\n icon: classNames?.optionIcon,\n text: classNames?.optionText,\n }}\n labelRender={\n optionLabelRender\n ? (props: React.HTMLAttributes<HTMLElement>) =>\n optionLabelRender(option, props)\n : undefined\n }\n render={(props: React.HTMLAttributes<HTMLElement>) => (\n <BaseCombobox.Item\n value={item as T}\n disabled={option.disabled}\n {...props}\n data-disabled={option.disabled}\n data-selected={isSelected}\n />\n )}\n >\n {option.label}\n </BaseMenuItem>\n );\n }}\n </BaseCombobox.List>\n\n <BaseCombobox.Empty className={clsx(cls(\"combobox-empty\"))}>\n <Empty description=\"No options found\" />\n </BaseCombobox.Empty>\n </ScrollArea>\n </div>\n </BaseCombobox.Popup>\n </BaseCombobox.Positioner>\n </BaseCombobox.Portal>\n </BaseCombobox.Root>\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":["positionerRender","props","jsx","BaseMenu","popupRender","separatorRender","listRender","ComboboxInner","options","controlledValue","defaultValue","onChange","placeholder","disabledProp","statusProp","allowClear","multiple","_showSearch","controlledOpen","onOpenChange","className","classNames","size","optionRender","onSearch","clearIcon","suffixIcon","placement","showSelectAll","optionLabelRender","_getOptionKeywords","option","reactNodeToString","popupMatchSelectWidth","addOnEnter","tokenSeparators","autoHighlight","filterOption","rest","ref","value","setValue","useControlledState","open","setOpen","cls","useCls","inputContainerRef","useRef","contextStatus","useContext","FormItemInputContext","contextDisabled","DisabledContext","mergedStatus","disabled","handleValueChange","useCallback","newValue","handleSelectAll","allValues","handleDeselectAll","handleClear","selectedValues","useMemo","optionMap","map","opt","selectAllOption","selectedFromFiltered","val","checked","indeterminate","baseUIItems","displayValue","inputClassName","clsx","itemToStringLabel","itemValue","searchValue","setSearchValue","useState","handleAddOnEnter","handleInputValueChange","useComboboxTokenInput","hasTokenSeparators","effectiveAutoHighlight","createInputKeyDownHandler","currentSearchValue","event","mergedFilter","query","tokens","splitBySeparators","keywords","k","matchingTokenCount","token","lowerToken","keyword","lowerQuery","jsxs","BaseCombobox","SelectTrigger","children","selectedItems","Fragment","item","XIcon","icon","BaseMenuItem","ScrollArea","isSelected","Empty","MainCombobox","forward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BHA,EAAO;AAAA,0BAAA;AAAA,wBA6BlB;AAAA,sBAAA;AAAA,oBAAA;AAAA,oBAGF,gBAAA7B,EAACoG,EAAa,OAAb,EAAmB,WAAW1B,EAAK/B,EAAI,gBAAgB,CAAC,GACvD,UAAA,gBAAA3C,EAAC+G,IAAA,EAAM,aAAY,oBAAmB,EAAA,CACxC;AAAA,kBAAA,EAAA,CACF;AAAA,gBAAA,EAAA,CACF;AAAA,cAAA;AAAA,YAAA;AAAA,UACF;AAAA,QAAA,EACF,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ,GAEMC,KAAeC,GAAW5G,EAAa,GAQhC6G,KAAW,OAAO,OAAOF,IAAc;AAAA;AAEpD,CAAC;"}
@@ -1,3 +1,3 @@
1
1
  export { Combobox, default } from './component';
2
- export type { ComboboxProps, ComboboxOption } from './component';
2
+ export type { ComboboxProps, ComboboxOption } from './types';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/combobox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/combobox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC"}
@@ -1 +1 @@
1
- @layer components{.ds-combobox{position:relative;display:inline-block;width:100%}.ds-combobox-popup{width:var(--anchor-width)}.ds-combobox-popup--auto-width{width:max-content;min-width:var(--anchor-width);max-width:var(--available-width)}.ds-combobox-input{flex:1;border:none;outline:none;background:transparent;color:var(--ds-color-text);min-width:0}.ds-combobox-input::placeholder{color:var(--ds-color-text-placeholder)}.ds-combobox-divider{border:none;border-bottom:1px solid var(--ds-color-split);margin:.25rem 0}.ds-combobox-chip{display:inline-flex;align-items:center;gap:.25rem;background:var(--ds-color-fill-secondary);border-radius:var(--ds-border-radius-sm);padding:.25rem .5rem;font-size:var(--ds-font-size);color:var(--ds-color-text);max-width:100%;min-width:0;height:var(--ds-control-line-height)}.ds-combobox-chip-icon{display:flex;align-items:center;flex-shrink:0;font-size:.75rem}.ds-combobox-chip-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ds-combobox-chip-remove{display:flex;align-items:center;justify-content:center;padding:.125rem;border-radius:var(--ds-border-radius-lg);cursor:pointer;color:var(--ds-color-text-secondary);transition:all .2s var(--ds-motion-ease-out);background:none;border:none;font-size:.875rem;line-height:1}.ds-combobox-chip-remove:hover{background:var(--ds-control-item-bg-hover);color:var(--ds-color-text)}.ds-combobox-chips-container .ds-combobox-input{flex:1;min-width:120px;border:none;background:transparent;padding:.25rem 0;margin:0}.ds-combobox-chips{display:flex;flex-wrap:wrap;gap:.375rem}.ds-select-trigger-small .ds-combobox-chips{gap:.25rem}.ds-combobox-trigger-multiple.ds-select-trigger-has-value .ds-select-trigger-content{padding-left:.5rem}.ds-combobox[data-disabled=true] .ds-combobox-chip{background-color:var(--ds-color-bg-disabled);color:var(--ds-color-text-disabled)}.ds-combobox[data-disabled=true] .ds-combobox-chip-remove{cursor:not-allowed;color:var(--ds-color-text-disabled)}.ds-combobox-empty{padding:1rem}.ds-combobox-empty:empty{display:none}}
1
+ @layer components{.ds-combobox{position:relative;display:inline-block;width:100%}.ds-combobox-popup{width:var(--anchor-width)}.ds-combobox-popup--auto-width{width:max-content;min-width:var(--anchor-width);max-width:var(--available-width)}.ds-combobox-input{flex:1;border:none;outline:none;background:transparent;color:var(--ds-color-text);min-width:0}.ds-combobox-input::placeholder{color:var(--ds-color-text-placeholder)}.ds-combobox-divider{border:none;border-bottom:1px solid var(--ds-color-split);margin:.25rem 0}.ds-combobox-chip{display:inline-flex;align-items:center;gap:.25rem;background:var(--ds-color-fill-secondary);border-radius:var(--ds-border-radius-sm);padding:.25rem .5rem;font-size:var(--ds-font-size);color:var(--ds-color-text);max-width:100%;min-width:0;height:var(--ds-control-line-height)}.ds-combobox-chip-icon{display:flex;align-items:center;flex-shrink:0;font-size:.75rem}.ds-combobox-chip-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ds-combobox-chip-remove{display:flex;align-items:center;justify-content:center;padding:.125rem;border-radius:var(--ds-border-radius-lg);cursor:pointer;color:var(--ds-color-text-secondary);transition:all .2s var(--ds-motion-ease-out);background:none;border:none;font-size:.875rem;line-height:1}.ds-combobox-chip-remove:hover{background:var(--ds-control-item-bg-hover);color:var(--ds-color-text)}.ds-combobox-chips-container .ds-combobox-input{flex:1;min-width:120px;border:none;background:transparent;padding:.25rem 0;margin:0}.ds-combobox-chips{display:flex;flex-wrap:wrap;gap:.375rem}.ds-select-trigger-small .ds-combobox-chips{gap:.25rem}.ds-combobox-trigger-multiple.ds-select-trigger-has-value .ds-select-trigger-content{padding-left:.5rem}.ds-combobox[data-disabled=true] .ds-combobox-chip{background-color:var(--ds-color-bg-disabled);color:var(--ds-color-text-disabled)}.ds-combobox[data-disabled=true] .ds-combobox-chip-remove{cursor:not-allowed;color:var(--ds-color-text-disabled)}.ds-combobox-empty{padding:1rem}.ds-combobox-empty:empty{display:none}.ds-combobox-container{display:flex;flex-direction:column;flex-shrink:1;min-height:0;gap:.25rem}.ds-combobox-popup .ds-menu-item-show-checkbox[data-selected=true]{background:transparent}.ds-combobox-popup .ds-menu-item-show-checkbox[data-selected=true]:hover,.ds-combobox-popup .ds-menu-item-show-checkbox[data-selected=true][data-highlighted],.ds-combobox-popup .ds-menu-item-show-checkbox[data-selected=true][data-active=true]{background:var(--ds-control-item-bg-active)}.ds-combobox-popup .ds-menu-item-show-checkbox:not([data-selected=true]):hover,.ds-combobox-popup .ds-menu-item-show-checkbox:not([data-selected=true])[data-highlighted],.ds-combobox-popup .ds-menu-item-show-checkbox:not([data-selected=true])[data-active=true]{background:var(--ds-control-item-bg-hover)}.ds-combobox-popup .ds-menu-item-base[data-selected=true] .ds-menu-item-text{font-weight:600}}
@@ -0,0 +1,121 @@
1
+ import { ValidateStatus } from 'antd/es/form/FormItem';
2
+ import { PopoverProps } from 'antd/es/popover';
3
+ import { Key, ReactElement, ReactNode, HTMLAttributes } from 'react';
4
+ export type ComboboxOption<T extends Key, O extends Record<string, unknown> = {}> = {
5
+ value: T;
6
+ label: ReactNode;
7
+ disabled?: boolean;
8
+ icon?: ReactNode;
9
+ } & O;
10
+ export interface ComboboxProps<T extends Key, M extends boolean, O extends Record<string, unknown> = {}> {
11
+ /** Array of options to be displayed in the combobox */
12
+ options?: ComboboxOption<T, O>[];
13
+ /** Current value of the combobox */
14
+ value?: M extends true ? T[] : T;
15
+ /** Default value when uncontrolled */
16
+ defaultValue?: M extends true ? T[] : T;
17
+ /** Callback when value changes */
18
+ onChange?: (value: M extends true ? T[] : T) => void;
19
+ /** Placeholder text for the input */
20
+ placeholder?: string;
21
+ /** Whether the combobox is disabled */
22
+ disabled?: boolean;
23
+ /** Validation status */
24
+ status?: ValidateStatus;
25
+ /** Whether to allow clearing the selection */
26
+ allowClear?: boolean;
27
+ /** Whether to allow multiple selections */
28
+ multiple?: M;
29
+ /** Maximum number of tags to show */
30
+ maxTagCount?: number;
31
+ /** Whether to show search functionality */
32
+ showSearch?: boolean;
33
+ /** Controlled open state */
34
+ open?: boolean;
35
+ /** Callback when open state changes */
36
+ onOpenChange?: (open: boolean) => void;
37
+ /** Placement of the dropdown */
38
+ placement?: PopoverProps["placement"];
39
+ /** Custom className for the component */
40
+ className?: string;
41
+ /** Custom class names for different parts */
42
+ classNames?: {
43
+ trigger?: string;
44
+ input?: string;
45
+ option?: string;
46
+ optionIcon?: string;
47
+ optionText?: string;
48
+ list?: string;
49
+ portal?: string;
50
+ };
51
+ /** Size of the combobox */
52
+ size?: "small" | "middle" | "large";
53
+ /** Loading state */
54
+ loading?: boolean;
55
+ /** Custom render for options */
56
+ optionRender?: (option: ComboboxOption<T, O>, props: HTMLAttributes<HTMLElement>) => ReactElement;
57
+ /**
58
+ * Filter function for search
59
+ * - `true` or `undefined`: default filtering (splits by tokenSeparators if provided)
60
+ * - `false`: disables filtering
61
+ * - custom function: `(input, option) => boolean`
62
+ * @default true
63
+ */
64
+ filterOption?: boolean | ((input: string, option: ComboboxOption<T, O>) => boolean);
65
+ /** Callback when search input changes */
66
+ onSearch?: (value: string) => void;
67
+ /** Custom dropdown render */
68
+ dropdownRender?: (menu: ReactElement) => ReactElement;
69
+ /** Custom clear icon */
70
+ clearIcon?: ReactNode;
71
+ /** Custom suffix icon */
72
+ suffixIcon?: ReactNode;
73
+ /**
74
+ * Show select all option when in multiple mode
75
+ * @default false
76
+ */
77
+ showSelectAll?: boolean;
78
+ /**
79
+ * Render function for the select all option
80
+ */
81
+ selectAllRender?: (props: {
82
+ onSelectAll: () => void;
83
+ onDeselectAll: () => void;
84
+ checked: boolean;
85
+ indeterminate: boolean;
86
+ }) => ReactNode;
87
+ /**
88
+ * Function to extract keywords from the item for search filtering
89
+ * @default (option) => [String(option.key), reactNodeToString(option.label)]
90
+ */
91
+ getOptionKeywords?: (option: ComboboxOption<T, O>) => string[];
92
+ /**
93
+ * Render function for the option label
94
+ */
95
+ optionLabelRender?: (option: ComboboxOption<T, O>, props?: HTMLAttributes<HTMLElement>) => ReactElement;
96
+ /**
97
+ * Whether the popup width should match the trigger width.
98
+ * When `false`, the popup can exceed the trigger width to fit long option labels.
99
+ * @default true
100
+ */
101
+ popupMatchSelectWidth?: boolean;
102
+ /**
103
+ * Allow adding items by typing the exact label or value and pressing Enter.
104
+ * @default false
105
+ */
106
+ addOnEnter?: boolean;
107
+ /**
108
+ * Characters to split input by when adding multiple items on Enter.
109
+ * Only applies when `addOnEnter` and `multiple` are true.
110
+ * @default undefined
111
+ */
112
+ tokenSeparators?: string[];
113
+ /**
114
+ * Automatically highlight the first matching item while filtering.
115
+ * When enabled in single-select mode, Enter selects the highlighted
116
+ * item natively and `addOnEnter` is ignored to avoid conflicts.
117
+ * @default true
118
+ */
119
+ autoHighlight?: boolean;
120
+ }
121
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/combobox/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE1E,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE,IAAI;IAClF,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,GAAG,CAAC,CAAC;AAEN,MAAM,WAAW,aAAa,CAC5B,CAAC,SAAS,GAAG,EACb,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,EAAE;IAEtC,uDAAuD;IACvD,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;IACjC,oCAAoC;IACpC,KAAK,CAAC,EAAE,CAAC,SAAS,IAAI,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IACjC,sCAAsC;IACtC,YAAY,CAAC,EAAE,CAAC,SAAS,IAAI,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IACxC,kCAAkC;IAClC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,S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} from 'react';
2
+ import { ComboboxOption } from './types';
3
+ type InputValueChangeDetails = {
4
+ event?: Event & {
5
+ inputType?: string;
6
+ };
7
+ cancel?: () => void;
8
+ };
9
+ interface UseComboboxTokenInputProps<T extends Key, O extends Record<string, unknown>> {
10
+ addOnEnter: boolean;
11
+ multiple: boolean;
12
+ tokenSeparators?: string[];
13
+ optionMap: Map<T, ComboboxOption<T, O>>;
14
+ value: T | T[] | undefined;
15
+ handleValueChange: (value: T | T[]) => void;
16
+ setOpen: (open: boolean) => void;
17
+ setSearchValue: (value: string) => void;
18
+ onSearch?: (value: string) => void;
19
+ }
20
+ export declare function useComboboxTokenInput<T extends Key, O extends Record<string, unknown>>({ addOnEnter, multiple, tokenSeparators, optionMap, value, handleValueChange, setOpen, setSearchValue, onSearch, }: UseComboboxTokenInputProps<T, O>): {
21
+ handleAddOnEnter: (input: string) => boolean;
22
+ handleInputValueChange: (val: string, eventDetails?: InputValueChangeDetails) => void;
23
+ };
24
+ export {};
25
+ //# sourceMappingURL=use-combobox-token-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-combobox-token-input.d.ts","sourceRoot":"","sources":["../../../src/components/combobox/use-combobox-token-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAQ9C,KAAK,uBAAuB,GAAG;IAC7B,KAAK,CAAC,EAAE,KAAK,GAAG;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,UAAU,0BAA0B,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IACnF,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,SAAS,EAAE,GAAG,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACxC,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,SAAS,CAAC;IAC3B,iBAAiB,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC;IAC5C,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACjC,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,wBAAgB,qBAAqB,CACnC,CAAC,SAAS,GAAG,EACb,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,EACA,UAAU,EACV,QAAQ,EACR,eAAe,EACf,SAAS,EACT,KAAK,EACL,iBAAiB,EACjB,OAAO,EACP,cAAc,EACd,QAAQ,GACT,EAAE,0BAA0B,CAAC,CAAC,EAAE,CAAC,CAAC;8BAOvB,MAAM,KAAG,OAAO;kCAiClB,MAAM,iBAAiB,uBAAuB;EAoBvD"}
@@ -0,0 +1,52 @@
1
+ import { useCallback as m } from "react";
2
+ import { findOptionByInput as w, splitBySeparators as x, hasTokenSeparator as B, isPasteInputEvent as T } from "./utils.js";
3
+ function O({
4
+ addOnEnter: y,
5
+ multiple: f,
6
+ tokenSeparators: t,
7
+ optionMap: I,
8
+ value: o,
9
+ handleValueChange: r,
10
+ setOpen: g,
11
+ setSearchValue: u,
12
+ onSearch: d
13
+ }) {
14
+ const A = m(
15
+ (n) => w(n, I),
16
+ [I]
17
+ ), e = m(
18
+ (n) => {
19
+ if (!y || !n.trim()) return !1;
20
+ const i = f && t && t.length > 0 ? x(n, t) : [n.trim()], c = [];
21
+ for (const b of i) {
22
+ const s = A(b);
23
+ s && !s.disabled && c.push(s.value);
24
+ }
25
+ if (c.length === 0) return !1;
26
+ if (f) {
27
+ const b = Array.isArray(o) ? [...o] : [], s = [.../* @__PURE__ */ new Set([...b, ...c])];
28
+ r(s);
29
+ } else
30
+ r(c[0]), g(!1);
31
+ return !0;
32
+ },
33
+ [y, f, t, A, o, r, g]
34
+ ), h = m(
35
+ (n, i) => {
36
+ if (f && t && t.length > 0 && B(n, t) && T(i?.event)) {
37
+ i?.cancel?.(), u(n), d?.(n);
38
+ return;
39
+ }
40
+ u(n), d?.(n);
41
+ },
42
+ [f, t, u, d]
43
+ );
44
+ return {
45
+ handleAddOnEnter: e,
46
+ handleInputValueChange: h
47
+ };
48
+ }
49
+ export {
50
+ O as useComboboxTokenInput
51
+ };
52
+ //# sourceMappingURL=use-combobox-token-input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-combobox-token-input.js","sources":["../../../src/components/combobox/use-combobox-token-input.ts"],"sourcesContent":["import { useCallback, type Key } from \"react\";\nimport type { ComboboxOption } from \"./types\";\nimport {\n findOptionByInput,\n hasTokenSeparator,\n isPasteInputEvent,\n splitBySeparators,\n} from \"./utils\";\n\ntype InputValueChangeDetails = {\n event?: Event & { inputType?: string };\n cancel?: () => void;\n};\n\ninterface UseComboboxTokenInputProps<T extends Key, O extends Record<string, unknown>> {\n addOnEnter: boolean;\n multiple: boolean;\n tokenSeparators?: string[];\n optionMap: Map<T, ComboboxOption<T, O>>;\n value: T | T[] | undefined;\n handleValueChange: (value: T | T[]) => void;\n setOpen: (open: boolean) => void;\n setSearchValue: (value: string) => void;\n onSearch?: (value: string) => void;\n}\n\nexport function useComboboxTokenInput<\n T extends Key,\n O extends Record<string, unknown>,\n>({\n addOnEnter,\n multiple,\n tokenSeparators,\n optionMap,\n value,\n handleValueChange,\n setOpen,\n setSearchValue,\n onSearch,\n}: UseComboboxTokenInputProps<T, O>) {\n const findMatchingOption = useCallback(\n (input: string) => findOptionByInput(input, optionMap),\n [optionMap],\n );\n\n const handleAddOnEnter = useCallback(\n (input: string): boolean => {\n if (!addOnEnter || !input.trim()) return false;\n\n const tokens =\n multiple && tokenSeparators && tokenSeparators.length > 0\n ? splitBySeparators(input, tokenSeparators)\n : [input.trim()];\n\n const matchedValues: T[] = [];\n for (const token of tokens) {\n const option = findMatchingOption(token);\n if (option && !option.disabled) {\n matchedValues.push(option.value);\n }\n }\n\n if (matchedValues.length === 0) return false;\n\n if (multiple) {\n const current = Array.isArray(value) ? [...value] : [];\n const newValues = [...new Set([...current, ...matchedValues])];\n handleValueChange(newValues);\n } else {\n handleValueChange(matchedValues[0]);\n setOpen(false);\n }\n\n return true;\n },\n [addOnEnter, multiple, tokenSeparators, findMatchingOption, value, handleValueChange, setOpen],\n );\n\n const handleInputValueChange = useCallback(\n (val: string, eventDetails?: InputValueChangeDetails) => {\n if (multiple && tokenSeparators && tokenSeparators.length > 0) {\n if (hasTokenSeparator(val, tokenSeparators) && isPasteInputEvent(eventDetails?.event)) {\n eventDetails?.cancel?.();\n setSearchValue(val);\n onSearch?.(val);\n return;\n }\n }\n\n setSearchValue(val);\n onSearch?.(val);\n },\n [multiple, tokenSeparators, setSearchValue, onSearch],\n );\n\n return {\n handleAddOnEnter,\n handleInputValueChange,\n };\n}\n"],"names":["useComboboxTokenInput","addOnEnter","multiple","tokenSeparators","optionMap","value","handleValueChange","setOpen","setSearchValue","onSearch","findMatchingOption","useCallback","input","findOptionByInput","handleAddOnEnter","tokens","splitBySeparators","matchedValues","token","option","current","newValues","handleInputValueChange","val","eventDetails","hasTokenSeparator","isPasteInputEvent"],"mappings":";;AA0BO,SAASA,EAGd;AAAA,EACA,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,OAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,UAAAC;AACF,GAAqC;AACnC,QAAMC,IAAqBC;AAAA,IACzB,CAACC,MAAkBC,EAAkBD,GAAOR,CAAS;AAAA,IACrD,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AAA;AAEJ;"}
@@ -1,2 +1,9 @@
1
+ import { Key } from 'react';
2
+ import { ComboboxOption } from './types';
1
3
  export declare function splitBySeparators(input: string, separators: string[]): string[];
4
+ export declare function hasTokenSeparator(input: string, separators?: string[]): boolean;
5
+ export declare function isPasteInputEvent(event?: Event & {
6
+ inputType?: string;
7
+ }): boolean;
8
+ export declare function findOptionByInput<T extends Key, O extends Record<string, unknown>>(input: string, optionMap: Map<T, ComboboxOption<T, O>>): ComboboxOption<T, O> | undefined;
2
9
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/combobox/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAM/E"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/combobox/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAO/E;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAG/E;AAED,wBAAgB,iBAAiB,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAEjF;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChF,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,GAAG,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GACtC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAiBlC"}
@@ -1,10 +1,31 @@
1
- function p(e, o) {
1
+ import { reactNodeToString as f } from "../utils/reactToString.js";
2
+ function s(e, r) {
2
3
  let t = [e];
3
- for (const r of o)
4
- t = t.flatMap((l) => l.split(r));
5
- return t.map((r) => r.trim()).filter(Boolean);
4
+ for (const o of r)
5
+ o && (t = t.flatMap((n) => n.split(o)));
6
+ return t.map((o) => o.trim()).filter(Boolean);
7
+ }
8
+ function a(e, r) {
9
+ return !r || r.length === 0 ? !1 : r.some((t) => t && e.includes(t));
10
+ }
11
+ function l(e) {
12
+ return e?.inputType === "insertFromPaste" || e?.type === "paste";
13
+ }
14
+ function p(e, r) {
15
+ const t = e.trim();
16
+ if (!t) return;
17
+ const o = t.toLowerCase();
18
+ for (const [n, i] of r)
19
+ if (String(n).toLowerCase() === o)
20
+ return i;
21
+ for (const n of r.values())
22
+ if (f(n.label).toLowerCase() === o)
23
+ return n;
6
24
  }
7
25
  export {
8
- p as splitBySeparators
26
+ p as findOptionByInput,
27
+ a as hasTokenSeparator,
28
+ l as isPasteInputEvent,
29
+ s as splitBySeparators
9
30
  };
10
31
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../../src/components/combobox/utils.ts"],"sourcesContent":["export function splitBySeparators(input: string, separators: string[]): string[] {\n let result: string[] = [input];\n for (const sep of separators) {\n result = result.flatMap((part) => part.split(sep));\n }\n return result.map((t) => t.trim()).filter(Boolean);\n}\n"],"names":["splitBySeparators","input","separators","result","sep","part","t"],"mappings":"AAAO,SAASA,EAAkBC,GAAeC,GAAgC;AAC/E,MAAIC,IAAmB,CAACF,CAAK;AAC7B,aAAWG,KAAOF;AAChB,IAAAC,IAASA,EAAO,QAAQ,CAACE,MAASA,EAAK,MAAMD,CAAG,CAAC;AAEnD,SAAOD,EAAO,IAAI,CAACG,MAAMA,EAAE,KAAA,CAAM,EAAE,OAAO,OAAO;AACnD;"}
1
+ {"version":3,"file":"utils.js","sources":["../../../src/components/combobox/utils.ts"],"sourcesContent":["import type { Key } from \"react\";\nimport { reactNodeToString } from \"../utils\";\nimport type { ComboboxOption } from \"./types\";\n\nexport function splitBySeparators(input: string, separators: string[]): string[] {\n let result: string[] = [input];\n for (const sep of separators) {\n if (!sep) continue;\n result = result.flatMap((part) => part.split(sep));\n }\n return result.map((t) => t.trim()).filter(Boolean);\n}\n\nexport function hasTokenSeparator(input: string, separators?: string[]): boolean {\n if (!separators || separators.length === 0) return false;\n return separators.some((sep) => sep && input.includes(sep));\n}\n\nexport function isPasteInputEvent(event?: Event & { inputType?: string }): boolean {\n return event?.inputType === \"insertFromPaste\" || event?.type === \"paste\";\n}\n\nexport function findOptionByInput<T extends Key, O extends Record<string, unknown>>(\n input: string,\n optionMap: Map<T, ComboboxOption<T, O>>,\n): ComboboxOption<T, O> | undefined {\n const trimmed = input.trim();\n if (!trimmed) return undefined;\n const lowerTrimmed = trimmed.toLowerCase();\n\n for (const [val, opt] of optionMap) {\n if (String(val).toLowerCase() === lowerTrimmed) {\n return opt;\n }\n }\n\n for (const opt of optionMap.values()) {\n if (reactNodeToString(opt.label).toLowerCase() === lowerTrimmed) {\n return opt;\n }\n }\n return undefined;\n}\n"],"names":["splitBySeparators","input","separators","result","sep","part","t","hasTokenSeparator","isPasteInputEvent","event","findOptionByInput","optionMap","trimmed","lowerTrimmed","val","opt","reactNodeToString"],"mappings":";AAIO,SAASA,EAAkBC,GAAeC,GAAgC;AAC/E,MAAIC,IAAmB,CAACF,CAAK;AAC7B,aAAWG,KAAOF;AAChB,IAAKE,MACLD,IAASA,EAAO,QAAQ,CAACE,MAASA,EAAK,MAAMD,CAAG,CAAC;AAEnD,SAAOD,EAAO,IAAI,CAACG,MAAMA,EAAE,KAAA,CAAM,EAAE,OAAO,OAAO;AACnD;AAEO,SAASC,EAAkBN,GAAeC,GAAgC;AAC/E,SAAI,CAACA,KAAcA,EAAW,WAAW,IAAU,KAC5CA,EAAW,KAAK,CAACE,MAAQA,KAAOH,EAAM,SAASG,CAAG,CAAC;AAC5D;AAEO,SAASI,EAAkBC,GAAiD;AACjF,SAAOA,GAAO,cAAc,qBAAqBA,GAAO,SAAS;AACnE;AAEO,SAASC,EACdT,GACAU,GACkC;AAClC,QAAMC,IAAUX,EAAM,KAAA;AACtB,MAAI,CAACW,EAAS;AACd,QAAMC,IAAeD,EAAQ,YAAA;AAE7B,aAAW,CAACE,GAAKC,CAAG,KAAKJ;AACvB,QAAI,OAAOG,CAAG,EAAE,YAAA,MAAkBD;AAChC,aAAOE;AAIX,aAAWA,KAAOJ,EAAU;AAC1B,QAAIK,EAAkBD,EAAI,KAAK,EAAE,YAAA,MAAkBF;AACjD,aAAOE;AAIb;"}
@@ -1 +1 @@
1
- @layer components{.ds-select-trigger{position:relative;display:inline-flex;align-items:center;cursor:pointer;width:100%;background-color:var(--ds-control-color-bg);border:1px solid var(--ds-control-color-border);border-radius:var(--ds-control-border-radius);transition:var(--ds-control-transition);text-align:left}.ds-select-trigger:focus,.ds-select-trigger:focus-visible{outline:none}.ds-select-trigger:hover:not(.ds-select-trigger-disabled){border-color:var(--ds-control-color-border-hover)}.ds-select-trigger:focus,.ds-select-trigger:focus-visible,.ds-select-trigger-focused{border:var(--ds-control-border-active);box-shadow:var(--ds-control-shadow-active)}.ds-select-trigger-open{border:var(--ds-control-border-active)}.ds-select-trigger-disabled{background-color:var(--ds-control-color-bg-disabled);cursor:not-allowed;color:var(--ds-control-color-text-disabled)}.ds-select-trigger-disabled .ds-select-trigger-text{cursor:not-allowed}.ds-select-trigger-error{border:var(--ds-control-border-error-active)}.ds-select-trigger-error:focus,.ds-select-trigger-error:focus-visible,.ds-select-trigger-error.ds-select-trigger-focused{border:var(--ds-control-border-error-active);box-shadow:var(--ds-control-shadow-error-active)}.ds-select-trigger-warning{border:var(--ds-control-border-warning-active)}.ds-select-trigger-warning:focus,.ds-select-trigger-warning:focus-visible,.ds-select-trigger-warning.ds-select-trigger-focused{border:var(--ds-control-border-warning-active);box-shadow:var(--ds-control-shadow-warning-active)}.ds-select-trigger-value{flex:1;color:var(--ds-control-color-text);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-align:left}.ds-select-trigger-value-with-prefix{display:flex;align-items:center;gap:8px;flex:1;min-width:0}.ds-select-trigger-placeholder{flex:1;color:var(--ds-control-color-text-placeholder);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-align:left}.ds-select-trigger-suffix{display:flex;align-items:center;justify-content:center;width:var(--ds-control-icon-size);height:var(--ds-control-icon-size);position:relative;font-size:var(--ds-control-icon-size);flex-shrink:0}.ds-select-trigger-arrow,.ds-select-trigger-clear{position:absolute;top:50%;right:var(--ds-trigger-padding-inline);transform:translateY(-50%);display:flex;align-items:center;justify-content:center;color:var(--ds-control-color-icon);width:var(--ds-control-icon-size);height:var(--ds-control-icon-size)}.ds-select-trigger-arrow-icon{display:flex;align-items:center;justify-content:center;transition:transform .2s ease}.ds-select-trigger-open .ds-select-trigger-arrow-icon{transform:rotate(180deg)}.ds-select-trigger-clear{pointer-events:none;opacity:0;transition:opacity .2s ease}.ds-select-trigger-clear:hover{color:var(--ds-control-color-icon-hover)}.ds-select-trigger-clear-icon{display:flex;align-items:center;justify-content:center}.ds-select-trigger-allow-clear.ds-select-trigger-has-value:hover .ds-select-trigger-arrow{opacity:0;pointer-events:none}.ds-select-trigger-allow-clear.ds-select-trigger-has-value:hover .ds-select-trigger-clear{pointer-events:auto;opacity:1}.ds-select-trigger-small{--ds-trigger-padding: var(--ds-control-padding-small);--ds-trigger-padding-inline: var(--ds-control-padding-inline-small);--ds-trigger-padding-block: var(--ds-control-padding-block-small);min-height:var(--ds-control-min-height-small);line-height:var(--ds-control-line-height)}.ds-select-trigger-middle{--ds-trigger-padding: var(--ds-control-padding-middle);--ds-trigger-padding-inline: var(--ds-control-padding-inline-middle);--ds-trigger-padding-block: var(--ds-control-padding-block-middle);min-height:var(--ds-control-min-height-middle);line-height:var(--ds-control-line-height)}.ds-select-trigger-large{--ds-trigger-padding: var(--ds-control-padding-large);--ds-trigger-padding-inline: var(--ds-control-padding-inline-large);--ds-trigger-padding-block: var(--ds-control-padding-block-large);min-height:var(--ds-control-min-height-large);line-height:var(--ds-control-line-height)}.ds-select-trigger-content{display:flex;align-items:center;flex:1;min-width:0;overflow:hidden;padding:var(--ds-trigger-padding-block) calc(var(--ds-trigger-padding-inline) + 1rem) var(--ds-trigger-padding-block) var(--ds-trigger-padding-inline);max-width:100%}.ds-select-trigger-text{min-width:0;max-width:100%}}
1
+ @layer components{.ds-select-trigger{position:relative;display:inline-flex;align-items:center;cursor:pointer;width:100%;background-color:var(--ds-control-color-bg);border:1px solid var(--ds-control-color-border);border-radius:var(--ds-control-border-radius);transition:var(--ds-control-transition);text-align:left}.ds-select-trigger:focus,.ds-select-trigger:focus-visible{outline:none}.ds-select-trigger:hover:not(.ds-select-trigger-disabled){border-color:var(--ds-control-color-border-hover)}.ds-select-trigger:focus,.ds-select-trigger:focus-visible,.ds-select-trigger-focused{border:var(--ds-control-border-active);box-shadow:var(--ds-control-shadow-active)}.ds-select-trigger-open{border:var(--ds-control-border-active)}.ds-select-trigger-disabled{background-color:var(--ds-control-color-bg-disabled);cursor:not-allowed;color:var(--ds-control-color-text-disabled)}.ds-select-trigger-disabled .ds-select-trigger-text{cursor:not-allowed}.ds-select-trigger-error{border:var(--ds-control-border-error-active)}.ds-select-trigger-error:focus,.ds-select-trigger-error:focus-visible,.ds-select-trigger-error.ds-select-trigger-focused{border:var(--ds-control-border-error-active);box-shadow:var(--ds-control-shadow-error-active)}.ds-select-trigger-warning{border:var(--ds-control-border-warning-active)}.ds-select-trigger-warning:focus,.ds-select-trigger-warning:focus-visible,.ds-select-trigger-warning.ds-select-trigger-focused{border:var(--ds-control-border-warning-active);box-shadow:var(--ds-control-shadow-warning-active)}.ds-select-trigger-value{flex:1;color:var(--ds-control-color-text);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-align:left}.ds-select-trigger-value-with-prefix{display:flex;align-items:center;gap:8px;flex:1;min-width:0}.ds-select-trigger-placeholder{flex:1;color:var(--ds-control-color-text-placeholder);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;text-align:left}.ds-select-trigger-suffix{display:flex;align-items:center;justify-content:center;width:var(--ds-control-icon-size);height:var(--ds-control-icon-size);position:relative;font-size:var(--ds-control-icon-size);flex-shrink:0}.ds-select-trigger-arrow,.ds-select-trigger-clear{position:absolute;top:50%;right:var(--ds-trigger-padding-inline);transform:translateY(-50%);display:flex;align-items:center;justify-content:center;color:var(--ds-control-color-icon);width:var(--ds-control-icon-size);height:var(--ds-control-icon-size)}.ds-select-trigger-arrow-icon{display:flex;align-items:center;justify-content:center;transition:transform .2s ease}.ds-select-trigger-open .ds-select-trigger-arrow-icon{transform:rotate(180deg)}.ds-select-trigger-clear{pointer-events:none;opacity:0;transition:opacity .2s ease}.ds-select-trigger-clear:hover{color:var(--ds-control-color-icon-hover)}.ds-select-trigger-clear-icon{display:flex;align-items:center;justify-content:center}.ds-select-trigger-allow-clear.ds-select-trigger-has-value:hover .ds-select-trigger-arrow{opacity:0;pointer-events:none}.ds-select-trigger-allow-clear.ds-select-trigger-has-value:hover .ds-select-trigger-clear{pointer-events:auto;opacity:1}.ds-select-trigger-small{--ds-trigger-padding: var(--ds-control-padding-small);--ds-trigger-padding-inline: var(--ds-control-padding-inline-small);--ds-trigger-padding-block: var(--ds-control-padding-block-small);min-height:var(--ds-control-min-height-small);line-height:var(--ds-control-line-height);border-radius:var(--ds-control-border-radius-sm)}.ds-select-trigger-middle{--ds-trigger-padding: var(--ds-control-padding-middle);--ds-trigger-padding-inline: var(--ds-control-padding-inline-middle);--ds-trigger-padding-block: var(--ds-control-padding-block-middle);min-height:var(--ds-control-min-height-middle);line-height:var(--ds-control-line-height)}.ds-select-trigger-large{--ds-trigger-padding: var(--ds-control-padding-large);--ds-trigger-padding-inline: var(--ds-control-padding-inline-large);--ds-trigger-padding-block: var(--ds-control-padding-block-large);min-height:var(--ds-control-min-height-large);line-height:var(--ds-control-line-height);border-radius:var(--ds-control-border-radius-lg)}.ds-select-trigger-content{display:flex;align-items:center;flex:1;min-width:0;overflow:hidden;padding:var(--ds-trigger-padding-block) calc(var(--ds-trigger-padding-inline) + 1rem) var(--ds-trigger-padding-block) var(--ds-trigger-padding-inline);max-width:100%}.ds-select-trigger-text{min-width:0;max-width:100%}}
@@ -1 +1 @@
1
- @layer components{@keyframes ds-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.ds-theme-provider{--ds-modal-padding: 24px;--ds-modal-edge-padding: 16px;--ds-popup-panel-padding: 16px;--ds-scrollbar-width: auto;--ds-scrollbar-width-legacy: 15;--ds-box-shadow-popover-arrow: 0px 0px 1px 0px var(--ds-modal-color-border), 2px 2px 5px rgba(0, 0, 0, .05);--ds-control-border-radius: 6px;--ds-control-transition: all .2s;--ds-control-padding-small: 1px 8px;--ds-control-padding-middle: 5px 12px;--ds-control-padding-large: 9px 12px;--ds-control-padding-inline-small: 8px;--ds-control-padding-block-small: 1px;--ds-control-padding-inline-middle: 12px;--ds-control-padding-block-middle: 5px;--ds-control-padding-inline-large: 12px;--ds-control-padding-block-large: 9px;--ds-control-min-height-small: 24px;--ds-control-min-height-middle: 32px;--ds-control-min-height-large: 40px;--ds-control-line-height: 20px;--ds-control-color-border-hover: var(--ds-color-primary-hover);--ds-control-color-border-focus: var(--ds-color-primary);--ds-control-color-bg-disabled: var(--ds-color-bg-container-disabled);--ds-control-color-text-disabled: var(--ds-color-text-disabled);--ds-control-icon-size: 12px;--ds-control-color-bg: var(--ds-color-bg-container);--ds-control-color-border: var(--ds-color-border);--ds-control-color-border-active: var(--ds-color-primary);--ds-control-color-border-error-active: var(--ds-color-error);--ds-control-color-border-warning-active: var(--ds-color-warning);--ds-control-color-icon: var(--ds-color-text-quaternary);--ds-control-color-icon-hover: var(--ds-color-icon-hover);--ds-control-border: 1px solid var(--ds-control-color-border);--ds-control-border-active: 1px solid var(--ds-control-color-border-active);--ds-control-border-error-active: 1px solid var(--ds-control-color-border-error-active);--ds-control-border-warning-active: 1px solid var(--ds-control-color-border-warning-active);--ds-control-shadow-active: 0 0 0 2px color-mix(in oklab, var(--ds-color-primary) 20%, transparent);--ds-form-label-required-mark-color: var(--ds-color-error);--ds-control-shadow-error-active: 0 0 0 2px color-mix(in oklab, var(--ds-color-error) 20%, transparent);--ds-control-shadow-warning-active: 0 0 0 2px color-mix(in oklab, var(--ds-color-warning) 20%, transparent);--ds-control-color-text-placeholder: var(--ds-color-text-placeholder);--ds-button-bg-secondary: #fafafa;--ds-button-bg-gradient-top: rgba(0, 0, 0, .02);--ds-button-bg-gradient-bottom: rgba(255, 255, 255, 0);--ds-button-bg-gradient-primary-top: rgba(255, 255, 255, .07);--ds-button-bg-gradient-primary-bottom: rgba(255, 255, 255, 0);--ds-button-shadow-default: 0 0 0 0 transparent;--ds-button-shadow-default-inner: inset 0 1px 0 1px #ffffff;--ds-button-shadow-solid: 0 0 0 0 transparent;--ds-button-shadow-solid-hover: 0 0 0 0 transparent;--ds-button-shadow-solid-active: 0 0 0 0 transparent;--ds-button-shadow-solid-inner: inset 0 1px 0 1px rgba(255, 255, 255, .12);--ds-color-primary-fg: hsl(217 80% 40%);--ds-color-primary-fg-hover: hsl(217 80% 55%);--ds-color-primary-fg-active: hsl(217 80% 30%);--ds-color-error-fg: hsl(5 68% 45%);--ds-color-error-fg-hover: hsl(5 68% 50%);--ds-color-error-fg-active: hsl(5 68% 40%);--ds-inter: "Inter", Helvetica, Arial, sans-serif;--ds-roboto-mono: "Roboto Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--ds-animate-spin: ds-spin 1s linear infinite;--ds-z-index-base: 0;--ds-z-index-sticky-element: 520;--ds-z-index-scrollbar: 530;--ds-z-index-panel: 540;--ds-z-index-modal: 1000;--ds-z-index-modal-mask: 1000;--ds-z-index-message: 1010;--ds-z-index-notification: 1010;--ds-z-index-popover: 1030;--ds-z-index-popup: 1030;--ds-z-index-dropdown: 1050;--ds-z-index-picker: 1050;--ds-z-index-popconfirm: 1060;--ds-z-index-tooltip: 1070;--ds-z-index-toast: 2000;--ds-segment-color-bg-active: #ffffff;--ds-scrollbar-color-thumb: rgba(0, 0, 0, .2);--ds-scrollbar-color-track: rgba(0, 0, 0, 0);--ds-color-base-solid: #000000;--ds-color-table-fixed-column-shadow: rgb(0 0 0 / 10%);--ds-modal-color-border: rgba(0, 0, 0, .07)}@supports (font-variation-settings: normal){.ds-theme-provider{--ds-inter: "InterVariable", Inter, Helvetica, Arial, sans-serif;--ds-roboto-mono: "Roboto Mono Variable", Roboto Mono, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;font-optical-sizing:auto}}.ds-theme-provider.dark{--ds-modal-color-border: rgba(255, 255, 255, .1);--ds-segment-color-bg-active: #424248;--ds-scrollbar-color-thumb: rgba(255, 255, 255, .2);--ds-scrollbar-color-track: rgba(0, 0, 0, 0);--ds-color-base-solid: #ffffff;--ds-color-table-fixed-column-shadow: rgb(0 0 0 / 20%);--ds-button-bg-secondary: hsl(240, 6.5%, 17%);--ds-button-bg-gradient-top: rgba(255, 255, 255, .03);--ds-button-bg-gradient-bottom: rgba(255, 255, 255, 0);--ds-button-bg-gradient-primary-top: rgba(255, 255, 255, .12);--ds-button-bg-gradient-primary-bottom: rgba(255, 255, 255, 0);--ds-button-shadow-default: 0 0 0 0 transparent;--ds-button-shadow-default-inner: 0 0 0 0 transparent;--ds-button-shadow-solid: 0 0 0 0 transparent;--ds-button-shadow-solid-hover: 0 0 0 0 transparent;--ds-button-shadow-solid-active: 0 0 0 0 transparent;--ds-button-shadow-solid-inner: inset 0 1px 0 1px rgba(255, 255, 255, .14);--ds-color-primary-fg: hsl(211 95% 60%);--ds-color-primary-fg-hover: hsl(211 95% 65%);--ds-color-primary-fg-active: hsl(211 95% 58%);--ds-color-error-fg: hsl(4 72% 59%);--ds-color-error-fg-hover: hsl(4 72% 64%);--ds-color-error-fg-active: hsl(4 72% 56%)}}
1
+ @layer components{@keyframes ds-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.ds-theme-provider{--ds-modal-padding: 24px;--ds-modal-edge-padding: 16px;--ds-popup-panel-padding: 16px;--ds-scrollbar-width: auto;--ds-scrollbar-width-legacy: 15;--ds-box-shadow-popover-arrow: 0px 0px 1px 0px var(--ds-modal-color-border), 2px 2px 5px rgba(0, 0, 0, .05);--ds-control-border-radius: 6px;--ds-control-border-radius-sm: 4px;--ds-control-border-radius-lg: 8px;--ds-control-transition: all .2s;--ds-control-padding-small: 1px 8px;--ds-control-padding-middle: 5px 12px;--ds-control-padding-large: 9px 12px;--ds-control-padding-inline-small: 8px;--ds-control-padding-block-small: 1px;--ds-control-padding-inline-middle: 12px;--ds-control-padding-block-middle: 5px;--ds-control-padding-inline-large: 12px;--ds-control-padding-block-large: 9px;--ds-control-min-height-small: 24px;--ds-control-min-height-middle: 32px;--ds-control-min-height-large: 40px;--ds-control-line-height: 20px;--ds-control-color-border-hover: var(--ds-color-primary-hover);--ds-control-color-border-focus: var(--ds-color-primary);--ds-control-color-bg-disabled: var(--ds-color-bg-container-disabled);--ds-control-color-text-disabled: var(--ds-color-text-disabled);--ds-control-icon-size: 12px;--ds-control-color-bg: var(--ds-color-bg-container);--ds-control-color-border: var(--ds-color-border);--ds-control-color-border-active: var(--ds-color-primary);--ds-control-color-border-error-active: var(--ds-color-error);--ds-control-color-border-warning-active: var(--ds-color-warning);--ds-control-color-icon: var(--ds-color-text-quaternary);--ds-control-color-icon-hover: var(--ds-color-icon-hover);--ds-control-border: 1px solid var(--ds-control-color-border);--ds-control-border-active: 1px solid var(--ds-control-color-border-active);--ds-control-border-error-active: 1px solid var(--ds-control-color-border-error-active);--ds-control-border-warning-active: 1px solid var(--ds-control-color-border-warning-active);--ds-control-shadow-active: 0 0 0 2px color-mix(in oklab, var(--ds-color-primary) 20%, transparent);--ds-form-label-required-mark-color: var(--ds-color-error);--ds-control-shadow-error-active: 0 0 0 2px color-mix(in oklab, var(--ds-color-error) 20%, transparent);--ds-control-shadow-warning-active: 0 0 0 2px color-mix(in oklab, var(--ds-color-warning) 20%, transparent);--ds-control-color-text-placeholder: var(--ds-color-text-placeholder);--ds-button-bg-secondary: #fafafa;--ds-button-bg-gradient-top: rgba(0, 0, 0, .02);--ds-button-bg-gradient-bottom: rgba(255, 255, 255, 0);--ds-button-bg-gradient-primary-top: rgba(255, 255, 255, .07);--ds-button-bg-gradient-primary-bottom: rgba(255, 255, 255, 0);--ds-button-shadow-default: 0 0 0 0 transparent;--ds-button-shadow-default-inner: inset 0 1px 0 1px #ffffff;--ds-button-shadow-solid: 0 0 0 0 transparent;--ds-button-shadow-solid-hover: 0 0 0 0 transparent;--ds-button-shadow-solid-active: 0 0 0 0 transparent;--ds-button-shadow-solid-inner: inset 0 1px 0 1px rgba(255, 255, 255, .12);--ds-color-primary-fg: hsl(217 80% 40%);--ds-color-primary-fg-hover: hsl(217 80% 55%);--ds-color-primary-fg-active: hsl(217 80% 30%);--ds-color-error-fg: hsl(5 68% 45%);--ds-color-error-fg-hover: hsl(5 68% 50%);--ds-color-error-fg-active: hsl(5 68% 40%);--ds-inter: "Inter", Helvetica, Arial, sans-serif;--ds-roboto-mono: "Roboto Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--ds-animate-spin: ds-spin 1s linear infinite;--ds-z-index-base: 0;--ds-z-index-sticky-element: 520;--ds-z-index-scrollbar: 530;--ds-z-index-panel: 540;--ds-z-index-modal: 1000;--ds-z-index-modal-mask: 1000;--ds-z-index-message: 1010;--ds-z-index-notification: 1010;--ds-z-index-popover: 1030;--ds-z-index-popup: 1030;--ds-z-index-dropdown: 1050;--ds-z-index-picker: 1050;--ds-z-index-popconfirm: 1060;--ds-z-index-tooltip: 1070;--ds-z-index-toast: 2000;--ds-segment-color-bg-active: #ffffff;--ds-scrollbar-color-thumb: rgba(0, 0, 0, .2);--ds-scrollbar-color-track: rgba(0, 0, 0, 0);--ds-color-base-solid: #000000;--ds-color-table-fixed-column-shadow: rgb(0 0 0 / 10%);--ds-modal-color-border: rgba(0, 0, 0, .07)}@supports (font-variation-settings: normal){.ds-theme-provider{--ds-inter: "InterVariable", Inter, Helvetica, Arial, sans-serif;--ds-roboto-mono: "Roboto Mono Variable", Roboto Mono, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;font-optical-sizing:auto}}.ds-theme-provider.dark{--ds-modal-color-border: rgba(255, 255, 255, .1);--ds-segment-color-bg-active: #424248;--ds-scrollbar-color-thumb: rgba(255, 255, 255, .2);--ds-scrollbar-color-track: rgba(0, 0, 0, 0);--ds-color-base-solid: #ffffff;--ds-color-table-fixed-column-shadow: rgb(0 0 0 / 20%);--ds-button-bg-secondary: hsl(240, 6.5%, 17%);--ds-button-bg-gradient-top: rgba(255, 255, 255, .03);--ds-button-bg-gradient-bottom: rgba(255, 255, 255, 0);--ds-button-bg-gradient-primary-top: rgba(255, 255, 255, .12);--ds-button-bg-gradient-primary-bottom: rgba(255, 255, 255, 0);--ds-button-shadow-default: 0 0 0 0 transparent;--ds-button-shadow-default-inner: 0 0 0 0 transparent;--ds-button-shadow-solid: 0 0 0 0 transparent;--ds-button-shadow-solid-hover: 0 0 0 0 transparent;--ds-button-shadow-solid-active: 0 0 0 0 transparent;--ds-button-shadow-solid-inner: inset 0 1px 0 1px rgba(255, 255, 255, .14);--ds-color-primary-fg: hsl(211 95% 60%);--ds-color-primary-fg-hover: hsl(211 95% 65%);--ds-color-primary-fg-active: hsl(211 95% 58%);--ds-color-error-fg: hsl(4 72% 59%);--ds-color-error-fg-hover: hsl(4 72% 64%);--ds-color-error-fg-active: hsl(4 72% 56%)}}
@@ -6,5 +6,5 @@ export type TooltipProps = AntTooltipProps & {
6
6
  */
7
7
  arrow?: AntTooltipProps["arrow"];
8
8
  };
9
- export declare const Tooltip: ({ arrow, ...rest }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const Tooltip: import('react').ForwardRefExoticComponent<TooltipProps & import('react').RefAttributes<HTMLElement>>;
10
10
  //# sourceMappingURL=component.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/component.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,YAAY,IAAI,eAAe,EACrC,MAAM,iBAAiB,CAAC;AAGzB,OAAO,aAAa,CAAC;AAGrB,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG;IAC3C;;;OAGG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;CAClC,CAAC;AAGF,eAAO,MAAM,OAAO,GAAI,oBAA4B,YAAY,4CAE/D,CAAC"}
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/component.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,YAAY,IAAI,eAAe,EACrC,MAAM,iBAAiB,CAAC;AAGzB,OAAO,aAAa,CAAC;AAIrB,MAAM,MAAM,YAAY,GAAG,eAAe,GAAG;IAC3C;;;OAGG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC;CAClC,CAAC;AAMF,eAAO,MAAM,OAAO,sGAkBnB,CAAC"}
@@ -1,9 +1,19 @@
1
1
  "use client";
2
- import { jsx as r } from "react/jsx-runtime";
3
- import i from "antd/es/tooltip";
2
+ import { jsx as l } from "react/jsx-runtime";
3
+ import m from "antd/es/tooltip";
4
4
  import './style.css';/* empty css */
5
- const l = ({ arrow: o = !1, ...t }) => /* @__PURE__ */ r(i, { arrow: o, ...t });
5
+ import { forwardRef as f, useRef as p, useImperativeHandle as s } from "react";
6
+ const a = f(
7
+ ({ arrow: o = !1, children: r, ...n }, i) => {
8
+ const e = p(null);
9
+ return s(i, () => {
10
+ const t = e.current?.nativeElement;
11
+ return t instanceof Element ? t : null;
12
+ }), /* @__PURE__ */ l(m, { arrow: o, ...n, ref: e, children: r });
13
+ }
14
+ );
15
+ a.displayName = "Tooltip";
6
16
  export {
7
- l as Tooltip
17
+ a as Tooltip
8
18
  };
9
19
  //# sourceMappingURL=component.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sources":["../../../src/components/tooltip/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n default as AntTooltip,\n type TooltipProps as AntTooltipProps,\n} from \"antd/es/tooltip\";\n\n// Import component-specific styles\nimport \"./style.css\";\n\n// Define props interface extending Ant Design's TooltipProps\nexport type TooltipProps = AntTooltipProps & {\n /**\n * Arrow config for of the tooltip\n * @default false\n */\n arrow?: AntTooltipProps[\"arrow\"];\n};\n\n// Create Tooltip component\nexport const Tooltip = ({ arrow = false, ...rest }: TooltipProps) => {\n return <AntTooltip arrow={arrow} {...rest} />;\n};\n"],"names":["Tooltip","arrow","rest","jsx","AntTooltip"],"mappings":";;;;AAmBO,MAAMA,IAAU,CAAC,EAAE,OAAAC,IAAQ,IAAO,GAAGC,QACnC,gBAAAC,EAACC,GAAA,EAAW,OAAAH,GAAe,GAAGC,EAAA,CAAM;"}
1
+ {"version":3,"file":"component.js","sources":["../../../src/components/tooltip/component.tsx"],"sourcesContent":["\"use client\";\nimport {\n default as AntTooltip,\n TooltipRef,\n type TooltipProps as AntTooltipProps,\n} from \"antd/es/tooltip\";\n\n// Import component-specific styles\nimport \"./style.css\";\nimport { forwardRef, useRef, useImperativeHandle } from \"react\";\n\n// Define props interface extending Ant Design's TooltipProps\nexport type TooltipProps = AntTooltipProps & {\n /**\n * Arrow config for of the tooltip\n * @default false\n */\n arrow?: AntTooltipProps[\"arrow\"];\n};\n\n// Create Tooltip component\n// Bridge antd's object ref (TooltipRef) to expose the underlying nativeElement\n// as the forwarded ref. Base UI Popover.Trigger and floating-ui expect a real\n// DOM node for positioning and dismiss handling, not an object wrapper.\nexport const Tooltip = forwardRef<HTMLElement, TooltipProps>(\n ({ arrow = false, children, ...rest }, ref) => {\n const tooltipRef = useRef<TooltipRef>(null);\n\n useImperativeHandle(ref, () => {\n const nativeElement = tooltipRef.current?.nativeElement;\n if (nativeElement instanceof Element) {\n return nativeElement as HTMLElement;\n }\n return null;\n });\n\n return (\n <AntTooltip arrow={arrow} {...rest} ref={tooltipRef}>\n {children}\n </AntTooltip>\n );\n },\n);\n\nTooltip.displayName = \"Tooltip\";\n"],"names":["Tooltip","forwardRef","arrow","children","rest","ref","tooltipRef","useRef","useImperativeHandle","nativeElement","AntTooltip"],"mappings":";;;;;AAwBO,MAAMA,IAAUC;AAAA,EACrB,CAAC,EAAE,OAAAC,IAAQ,IAAO,UAAAC,GAAU,GAAGC,EAAA,GAAQC,MAAQ;AAC7C,UAAMC,IAAaC,EAAmB,IAAI;AAE1C,WAAAC,EAAoBH,GAAK,MAAM;AAC7B,YAAMI,IAAgBH,EAAW,SAAS;AAC1C,aAAIG,aAAyB,UACpBA,IAEF;AAAA,IACT,CAAC,qBAGEC,GAAA,EAAW,OAAAR,GAAe,GAAGE,GAAM,KAAKE,GACtC,UAAAH,GACH;AAAA,EAEJ;AACF;AAEAH,EAAQ,cAAc;"}