asterui 0.12.63 → 0.12.64

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":"TreeSelect.js","sources":["../../src/components/TreeSelect.tsx"],"sourcesContent":["import React, {\n useState,\n useCallback,\n useRef,\n useEffect,\n useMemo,\n forwardRef,\n useId,\n} from 'react'\nimport type { TreeDataNode } from './Tree'\nimport { useConfig } from '../providers/ConfigProvider'\n\n// DaisyUI classes\nconst dCheckbox = 'checkbox'\nconst dCheckboxSm = 'checkbox-sm'\nconst dCheckboxPrimary = 'checkbox-primary'\nconst dLoading = 'loading'\nconst dLoadingSpinner = 'loading-spinner'\nconst dLoadingXs = 'loading-xs'\nconst dInput = 'input'\nconst dInputSm = 'input-sm'\nconst dInputDisabled = 'input-disabled'\n\nexport type TreeSelectSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'\nexport type TreeSelectColor =\n | 'primary'\n | 'secondary'\n | 'accent'\n | 'neutral'\n | 'info'\n | 'success'\n | 'warning'\n | 'error'\nexport type TreeSelectStatus = 'error' | 'warning'\nexport type TreeSelectVariant = 'outlined' | 'filled' | 'borderless'\nexport type ShowCheckedStrategy = 'SHOW_ALL' | 'SHOW_PARENT' | 'SHOW_CHILD'\n\n// Static strategy constants\nconst SHOW_ALL: ShowCheckedStrategy = 'SHOW_ALL'\nconst SHOW_PARENT: ShowCheckedStrategy = 'SHOW_PARENT'\nconst SHOW_CHILD: ShowCheckedStrategy = 'SHOW_CHILD'\n\nexport interface TreeSelectFieldNames {\n label?: string\n value?: string\n children?: string\n}\n\n/** Value type when labelInValue is true */\nexport interface LabeledValue {\n value: string\n label: React.ReactNode\n}\n\nexport interface TreeSelectProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {\n treeData: TreeDataNode[]\n value?: string | string[] | LabeledValue | LabeledValue[]\n defaultValue?: string | string[] | LabeledValue | LabeledValue[]\n onChange?: (\n value: string | string[] | LabeledValue | LabeledValue[],\n labels: React.ReactNode[],\n extra?: { triggerValue: string; triggerNode: TreeDataNode }\n ) => void\n multiple?: boolean\n treeCheckable?: boolean\n treeCheckStrictly?: boolean\n showCheckedStrategy?: ShowCheckedStrategy\n showSearch?: boolean\n searchValue?: string\n onSearch?: (value: string) => void\n filterTreeNode?: (searchValue: string, node: TreeDataNode) => boolean\n placeholder?: string\n allowClear?: boolean\n disabled?: boolean\n treeDefaultExpandAll?: boolean\n treeDefaultExpandedKeys?: string[]\n treeExpandedKeys?: string[]\n onTreeExpand?: (expandedKeys: string[]) => void\n size?: TreeSelectSize\n color?: TreeSelectColor\n status?: TreeSelectStatus\n /** Visual variant style */\n variant?: TreeSelectVariant\n /** Ghost style with no background */\n ghost?: boolean\n /** Maximum number of tags to show (multiple/treeCheckable mode) */\n maxTagCount?: number | 'responsive'\n maxTagPlaceholder?: React.ReactNode | ((omittedValues: string[]) => React.ReactNode)\n /** Maximum number of selections allowed */\n maxCount?: number\n /** Return object with value and label instead of just value */\n labelInValue?: boolean\n /** Custom tag render function */\n tagRender?: (props: {\n label: React.ReactNode\n value: string\n closable: boolean\n onClose: () => void\n }) => React.ReactNode\n treeLine?: boolean\n /** Show tree node icon */\n treeIcon?: boolean\n loadData?: (node: TreeDataNode) => Promise<void>\n fieldNames?: TreeSelectFieldNames\n open?: boolean\n onDropdownVisibleChange?: (open: boolean) => void\n suffixIcon?: React.ReactNode\n switcherIcon?: React.ReactNode | ((props: { expanded: boolean }) => React.ReactNode)\n notFoundContent?: React.ReactNode\n dropdownRender?: (menu: React.ReactNode) => React.ReactNode\n popupClassName?: string\n 'data-testid'?: string\n}\n\n// Helper to get field value based on fieldNames\nfunction getFieldValue(\n node: TreeDataNode,\n field: 'title' | 'key' | 'children',\n fieldNames?: TreeSelectFieldNames\n): unknown {\n if (field === 'title') {\n const labelField = fieldNames?.label || 'title'\n return (node as unknown as Record<string, unknown>)[labelField]\n }\n if (field === 'key') {\n const valueField = fieldNames?.value || 'key'\n return (node as unknown as Record<string, unknown>)[valueField]\n }\n if (field === 'children') {\n const childrenField = fieldNames?.children || 'children'\n return (node as unknown as Record<string, unknown>)[childrenField]\n }\n return undefined\n}\n\n// Helper to flatten tree data for search\nfunction flattenTree(\n data: TreeDataNode[],\n parentPath: React.ReactNode[] = [],\n fieldNames?: TreeSelectFieldNames\n): Array<{ node: TreeDataNode; path: React.ReactNode[] }> {\n const result: Array<{ node: TreeDataNode; path: React.ReactNode[] }> = []\n\n data.forEach((node) => {\n const title = getFieldValue(node, 'title', fieldNames) as React.ReactNode\n const children = getFieldValue(node, 'children', fieldNames) as TreeDataNode[] | undefined\n const currentPath = [...parentPath, title]\n result.push({ node, path: currentPath })\n if (children) {\n result.push(...flattenTree(children, currentPath, fieldNames))\n }\n })\n\n return result\n}\n\n// Helper to get all keys\nfunction getAllKeys(data: TreeDataNode[], fieldNames?: TreeSelectFieldNames): string[] {\n const keys: string[] = []\n const traverse = (nodes: TreeDataNode[]) => {\n nodes.forEach((node) => {\n const key = getFieldValue(node, 'key', fieldNames) as string\n const children = getFieldValue(node, 'children', fieldNames) as TreeDataNode[] | undefined\n keys.push(key)\n if (children) traverse(children)\n })\n }\n traverse(data)\n return keys\n}\n\n// Helper to find node by key\nfunction findNode(\n data: TreeDataNode[],\n key: string,\n fieldNames?: TreeSelectFieldNames\n): TreeDataNode | null {\n for (const node of data) {\n const nodeKey = getFieldValue(node, 'key', fieldNames) as string\n const children = getFieldValue(node, 'children', fieldNames) as TreeDataNode[] | undefined\n if (nodeKey === key) return node\n if (children) {\n const found = findNode(children, key, fieldNames)\n if (found) return found\n }\n }\n return null\n}\n\n// Helper to get all descendant keys\nfunction getDescendantKeys(node: TreeDataNode, fieldNames?: TreeSelectFieldNames): string[] {\n const keys: string[] = []\n const traverse = (n: TreeDataNode) => {\n const children = getFieldValue(n, 'children', fieldNames) as TreeDataNode[] | undefined\n if (children) {\n children.forEach((child) => {\n const childKey = getFieldValue(child, 'key', fieldNames) as string\n keys.push(childKey)\n traverse(child)\n })\n }\n }\n traverse(node)\n return keys\n}\n\n// Helper to get parent keys for a node\nfunction getParentKeys(\n data: TreeDataNode[],\n targetKey: string,\n fieldNames?: TreeSelectFieldNames,\n parentKeys: string[] = []\n): string[] | null {\n for (const node of data) {\n const nodeKey = getFieldValue(node, 'key', fieldNames) as string\n const children = getFieldValue(node, 'children', fieldNames) as TreeDataNode[] | undefined\n if (nodeKey === targetKey) return parentKeys\n if (children) {\n const found = getParentKeys(children, targetKey, fieldNames, [...parentKeys, nodeKey])\n if (found) return found\n }\n }\n return null\n}\n\ninterface TreeSelectNodeProps {\n node: TreeDataNode\n level: number\n expanded: boolean\n selected: boolean\n checked: boolean\n indeterminate: boolean\n treeCheckable: boolean\n treeLine: boolean\n treeIcon: boolean\n focused: boolean\n loading: boolean\n baseTestId: string\n id: string\n fieldNames?: TreeSelectFieldNames\n switcherIcon?: React.ReactNode | ((props: { expanded: boolean }) => React.ReactNode)\n onToggle: (key: string) => void\n onSelect: (key: string, node: TreeDataNode) => void\n onCheck: (key: string, node: TreeDataNode) => void\n renderChildren: (children: TreeDataNode[], level: number) => React.ReactNode\n}\n\nfunction TreeSelectNode({\n node,\n level,\n expanded,\n selected,\n checked,\n indeterminate,\n treeCheckable,\n treeLine,\n treeIcon: showTreeIcon,\n focused,\n loading,\n baseTestId,\n id,\n fieldNames,\n switcherIcon,\n onToggle,\n onSelect,\n onCheck,\n renderChildren,\n}: TreeSelectNodeProps) {\n const children = getFieldValue(node, 'children', fieldNames) as TreeDataNode[] | undefined\n const title = getFieldValue(node, 'title', fieldNames) as React.ReactNode\n const key = getFieldValue(node, 'key', fieldNames) as string\n const nodeIcon = node.icon\n const hasChildren = children && children.length > 0\n const isLeaf = node.isLeaf ?? !hasChildren\n\n const handleToggle = (e: React.MouseEvent) => {\n e.stopPropagation()\n if (!isLeaf) {\n onToggle(key)\n }\n }\n\n const handleSelect = () => {\n if (!node.disabled) {\n if (treeCheckable) {\n onCheck(key, node)\n } else {\n onSelect(key, node)\n }\n }\n }\n\n const handleCheck = (e: React.MouseEvent) => {\n e.stopPropagation()\n if (!node.disabled) {\n onCheck(key, node)\n }\n }\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n handleSelect()\n }\n }\n\n const renderSwitcherIcon = () => {\n if (loading) {\n return (\n <span className={`${dLoading} ${dLoadingSpinner} ${dLoadingXs}`} />\n )\n }\n\n if (switcherIcon) {\n if (typeof switcherIcon === 'function') {\n return switcherIcon({ expanded })\n }\n return switcherIcon\n }\n\n return (\n <svg\n className={`w-3 h-3 transition-transform ${expanded ? 'rotate-90' : ''}`}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M9 5l7 7-7 7\" />\n </svg>\n )\n }\n\n return (\n <div\n className=\"tree-select-node\"\n role=\"treeitem\"\n id={id}\n aria-selected={selected || checked}\n aria-expanded={hasChildren ? expanded : undefined}\n data-testid={`${baseTestId}-option-${key}`}\n data-state={selected || checked ? 'selected' : 'unselected'}\n data-disabled={node.disabled || undefined}\n >\n <div\n className={[\n 'flex items-center py-1.5 px-2 cursor-pointer hover:bg-base-200 transition-colors outline-none',\n (selected || checked) && 'bg-primary/10 text-primary',\n node.disabled && 'opacity-50 cursor-not-allowed',\n focused && 'ring-2 ring-primary ring-inset',\n treeLine && level > 0 && 'border-l border-base-300 ml-2',\n ]\n .filter(Boolean)\n .join(' ')}\n style={{ paddingLeft: `${level * 16 + 8}px` }}\n onClick={handleSelect}\n onKeyDown={handleKeyDown}\n tabIndex={-1}\n >\n {/* Expand/Collapse icon */}\n <span\n className={[\n 'w-4 h-4 flex items-center justify-center flex-shrink-0 mr-1',\n !isLeaf && 'cursor-pointer',\n ]\n .filter(Boolean)\n .join(' ')}\n onClick={handleToggle}\n aria-hidden=\"true\"\n >\n {!isLeaf && renderSwitcherIcon()}\n </span>\n\n {/* Checkbox for treeCheckable mode */}\n {treeCheckable && (\n <span className=\"mr-2 flex-shrink-0\" onClick={handleCheck}>\n <input\n type=\"checkbox\"\n className={`${dCheckbox} ${dCheckboxSm} ${dCheckboxPrimary}`}\n checked={checked}\n ref={(el) => {\n if (el) el.indeterminate = indeterminate\n }}\n disabled={node.disabled}\n onChange={handleSelect}\n aria-label={typeof title === 'string' ? title : undefined}\n tabIndex={-1}\n />\n </span>\n )}\n\n {/* Node icon */}\n {showTreeIcon && nodeIcon && (\n <span className=\"mr-1.5 flex-shrink-0 flex items-center\">{nodeIcon}</span>\n )}\n\n {/* Title */}\n <span className=\"flex-1 truncate select-none text-sm\">{title}</span>\n </div>\n\n {/* Children */}\n {hasChildren && expanded && (\n <div role=\"group\">{renderChildren(children!, level + 1)}</div>\n )}\n </div>\n )\n}\n\nconst sizeClasses: Record<TreeSelectSize, string> = {\n xs: 'min-h-6 text-xs',\n sm: 'min-h-8 text-sm',\n md: 'min-h-10 text-base',\n lg: 'min-h-12 text-lg',\n xl: 'min-h-14 text-xl',\n}\n\nconst colorClasses: Record<TreeSelectColor, string> = {\n primary: 'border-primary focus-within:border-primary',\n secondary: 'border-secondary focus-within:border-secondary',\n accent: 'border-accent focus-within:border-accent',\n neutral: 'border-neutral focus-within:border-neutral',\n info: 'border-info focus-within:border-info',\n success: 'border-success focus-within:border-success',\n warning: 'border-warning focus-within:border-warning',\n error: 'border-error focus-within:border-error',\n}\n\nconst statusClasses: Record<TreeSelectStatus, string> = {\n error: 'border-error focus-within:border-error',\n warning: 'border-warning focus-within:border-warning',\n}\n\nconst variantClasses: Record<TreeSelectVariant, string> = {\n outlined: 'border border-base-300',\n filled: 'bg-base-200 border-transparent',\n borderless: 'border-transparent',\n}\n\nexport const TreeSelect = forwardRef<HTMLDivElement, TreeSelectProps>(\n (\n {\n treeData,\n value: controlledValue,\n defaultValue = [],\n onChange,\n multiple = false,\n treeCheckable = false,\n treeCheckStrictly = false,\n showCheckedStrategy = 'SHOW_ALL',\n showSearch = false,\n searchValue: controlledSearchValue,\n onSearch,\n filterTreeNode,\n placeholder = 'Please select',\n allowClear = true,\n disabled = false,\n treeDefaultExpandAll = false,\n treeDefaultExpandedKeys = [],\n treeExpandedKeys: controlledExpandedKeys,\n onTreeExpand,\n size = 'md',\n color,\n status,\n variant = 'outlined',\n ghost = false,\n maxTagCount,\n maxTagPlaceholder,\n maxCount,\n labelInValue = false,\n tagRender,\n treeLine = false,\n treeIcon = false,\n loadData,\n fieldNames,\n open: controlledOpen,\n onDropdownVisibleChange,\n suffixIcon,\n switcherIcon,\n notFoundContent,\n dropdownRender,\n popupClassName = '',\n className = '',\n 'data-testid': testId,\n ...rest\n },\n ref\n ) => {\n const { componentSize, componentDisabled, renderEmpty } = useConfig()\n const effectiveSize = size ?? (componentSize as TreeSelectSize) ?? 'md'\n const effectiveDisabled = disabled ?? componentDisabled ?? false\n const effectiveNotFoundContent = notFoundContent ?? renderEmpty?.('TreeSelect') ?? 'No results found'\n\n const baseTestId = testId ?? 'treeselect'\n const instanceId = useId()\n const listboxId = `${instanceId}-listbox`\n const [isOpen, setIsOpen] = useState(false)\n const [internalSearchValue, setInternalSearchValue] = useState('')\n const [focusedKey, setFocusedKey] = useState<string | null>(null)\n const [loadingKeys, setLoadingKeys] = useState<Set<string>>(new Set())\n const containerRef = useRef<HTMLDivElement>(null)\n const inputRef = useRef<HTMLInputElement>(null)\n const triggerRef = useRef<HTMLDivElement>(null)\n\n const searchValue = controlledSearchValue ?? internalSearchValue\n const open = controlledOpen ?? isOpen\n\n // Normalize value to array - handle labelInValue format\n const normalizeValue = (val: string | string[] | LabeledValue | LabeledValue[] | undefined): string[] => {\n if (val === undefined) return []\n if (Array.isArray(val)) {\n return val.map((v) => (typeof v === 'object' && v !== null ? v.value : v))\n }\n if (typeof val === 'object' && val !== null) {\n return [(val as LabeledValue).value]\n }\n return [val as string]\n }\n\n const initialValue = normalizeValue(defaultValue)\n const [internalValue, setInternalValue] = useState<string[]>(initialValue)\n\n const value = controlledValue !== undefined ? normalizeValue(controlledValue) : internalValue\n\n // Expanded keys\n const initialExpandedKeys = useMemo(() => {\n if (treeDefaultExpandAll) return getAllKeys(treeData, fieldNames)\n return treeDefaultExpandedKeys\n }, [treeData, treeDefaultExpandAll, treeDefaultExpandedKeys, fieldNames])\n\n const [internalExpandedKeys, setInternalExpandedKeys] = useState<string[]>(initialExpandedKeys)\n const expandedKeys = controlledExpandedKeys ?? internalExpandedKeys\n\n // Get flattened visible nodes for keyboard navigation\n const visibleNodes = useMemo(() => {\n const nodes: { key: string; node: TreeDataNode }[] = []\n const traverse = (data: TreeDataNode[]) => {\n data.forEach((node) => {\n const key = getFieldValue(node, 'key', fieldNames) as string\n const children = getFieldValue(node, 'children', fieldNames) as\n | TreeDataNode[]\n | undefined\n nodes.push({ key, node })\n if (children && expandedKeys.includes(key)) {\n traverse(children)\n }\n })\n }\n traverse(treeData)\n return nodes\n }, [treeData, expandedKeys, fieldNames])\n\n const setOpen = useCallback(\n (newOpen: boolean) => {\n if (controlledOpen === undefined) {\n setIsOpen(newOpen)\n }\n onDropdownVisibleChange?.(newOpen)\n },\n [controlledOpen, onDropdownVisibleChange]\n )\n\n // Close on click outside\n useEffect(() => {\n const handleClickOutside = (e: MouseEvent) => {\n if (containerRef.current && !containerRef.current.contains(e.target as Node)) {\n setOpen(false)\n if (controlledSearchValue === undefined) {\n setInternalSearchValue('')\n }\n }\n }\n\n document.addEventListener('mousedown', handleClickOutside)\n return () => document.removeEventListener('mousedown', handleClickOutside)\n }, [setOpen, controlledSearchValue])\n\n // Focus management\n useEffect(() => {\n if (open && showSearch && inputRef.current) {\n inputRef.current.focus()\n } else if (open && triggerRef.current) {\n triggerRef.current.focus()\n }\n }, [open, showSearch])\n\n // Initialize focused key when opening\n useEffect(() => {\n if (open && visibleNodes.length > 0) {\n if (value.length > 0) {\n setFocusedKey(value[0])\n } else {\n setFocusedKey(visibleNodes[0].key)\n }\n } else if (!open) {\n setFocusedKey(null)\n }\n }, [open, visibleNodes, value])\n\n // Filter tree data based on search\n const filteredData = useMemo(() => {\n if (!searchValue) return treeData\n\n const flatNodes = flattenTree(treeData, [], fieldNames)\n const matchingKeys = new Set<string>()\n\n flatNodes.forEach(({ node }) => {\n const title = getFieldValue(node, 'title', fieldNames)\n const key = getFieldValue(node, 'key', fieldNames) as string\n\n let isMatch = false\n if (filterTreeNode) {\n isMatch = filterTreeNode(searchValue, node)\n } else {\n const titleStr = typeof title === 'string' ? title : String(title)\n isMatch = titleStr.toLowerCase().includes(searchValue.toLowerCase())\n }\n\n if (isMatch) {\n matchingKeys.add(key)\n }\n })\n\n // Include parent keys of matching nodes\n const filterTree = (nodes: TreeDataNode[]): TreeDataNode[] => {\n return nodes\n .map((node) => {\n const children = getFieldValue(node, 'children', fieldNames) as\n | TreeDataNode[]\n | undefined\n const key = getFieldValue(node, 'key', fieldNames) as string\n const hasMatchingChildren = children && filterTree(children).length > 0\n const isMatch = matchingKeys.has(key)\n\n if (isMatch || hasMatchingChildren) {\n return {\n ...node,\n children: children ? filterTree(children) : undefined,\n }\n }\n return null\n })\n .filter(Boolean) as TreeDataNode[]\n }\n\n return filterTree(treeData)\n }, [treeData, searchValue, filterTreeNode, fieldNames])\n\n const handleToggle = useCallback(\n async (key: string) => {\n const node = findNode(treeData, key, fieldNames)\n\n // Handle async loading\n if (loadData && node) {\n const children = getFieldValue(node, 'children', fieldNames) as\n | TreeDataNode[]\n | undefined\n if (!children || children.length === 0) {\n setLoadingKeys((prev) => new Set(prev).add(key))\n try {\n await loadData(node)\n } finally {\n setLoadingKeys((prev) => {\n const next = new Set(prev)\n next.delete(key)\n return next\n })\n }\n }\n }\n\n const newKeys = expandedKeys.includes(key)\n ? expandedKeys.filter((k) => k !== key)\n : [...expandedKeys, key]\n\n if (controlledExpandedKeys === undefined) {\n setInternalExpandedKeys(newKeys)\n }\n onTreeExpand?.(newKeys)\n },\n [expandedKeys, controlledExpandedKeys, onTreeExpand, loadData, treeData, fieldNames]\n )\n\n const handleSelect = useCallback(\n (key: string, triggerNode: TreeDataNode) => {\n let newValue: string[]\n\n if (multiple) {\n if (value.includes(key)) {\n newValue = value.filter((k) => k !== key)\n } else {\n // Check maxCount limit\n if (maxCount !== undefined && value.length >= maxCount) {\n return // Don't add more if at limit\n }\n newValue = [...value, key]\n }\n } else {\n newValue = [key]\n setOpen(false)\n if (controlledSearchValue === undefined) {\n setInternalSearchValue('')\n }\n }\n\n if (controlledValue === undefined) {\n setInternalValue(newValue)\n }\n\n const labels = newValue.map((k) => {\n const node = findNode(treeData, k, fieldNames)\n return node ? getFieldValue(node, 'title', fieldNames) as React.ReactNode : k\n })\n\n // Build return value based on labelInValue setting\n if (labelInValue) {\n const labeledValues: LabeledValue[] = newValue.map((k) => {\n const node = findNode(treeData, k, fieldNames)\n return {\n value: k,\n label: node ? getFieldValue(node, 'title', fieldNames) as React.ReactNode : k,\n }\n })\n onChange?.(\n multiple ? labeledValues : labeledValues[0] || { value: '', label: '' },\n labels,\n { triggerValue: key, triggerNode }\n )\n } else {\n onChange?.(multiple ? newValue : newValue[0] || '', labels, { triggerValue: key, triggerNode })\n }\n },\n [\n value,\n multiple,\n maxCount,\n controlledValue,\n onChange,\n treeData,\n setOpen,\n controlledSearchValue,\n fieldNames,\n labelInValue,\n ]\n )\n\n const handleCheck = useCallback(\n (key: string, triggerNode: TreeDataNode) => {\n const isChecked = value.includes(key)\n let newValue = [...value]\n\n if (treeCheckStrictly) {\n // No parent-child association\n if (isChecked) {\n newValue = newValue.filter((k) => k !== key)\n } else {\n // Check maxCount limit\n if (maxCount !== undefined && value.length >= maxCount) {\n return // Don't add more if at limit\n }\n newValue.push(key)\n }\n } else {\n const descendantKeys = getDescendantKeys(triggerNode, fieldNames)\n\n if (isChecked) {\n newValue = newValue.filter((k) => k !== key && !descendantKeys.includes(k))\n } else {\n // Check maxCount limit for adding multiple\n const keysToAdd = [key, ...descendantKeys.filter((dk) => !newValue.includes(dk))]\n if (maxCount !== undefined && newValue.length + keysToAdd.length > maxCount) {\n // Add only up to maxCount\n const remainingSlots = maxCount - newValue.length\n if (remainingSlots <= 0) return\n keysToAdd.slice(0, remainingSlots).forEach((k) => newValue.push(k))\n } else {\n newValue.push(key)\n descendantKeys.forEach((dk) => {\n if (!newValue.includes(dk)) newValue.push(dk)\n })\n }\n }\n }\n\n if (controlledValue === undefined) {\n setInternalValue(newValue)\n }\n\n const labels = newValue.map((k) => {\n const n = findNode(treeData, k, fieldNames)\n return n ? getFieldValue(n, 'title', fieldNames) as React.ReactNode : k\n })\n\n // Build return value based on labelInValue setting\n if (labelInValue) {\n const labeledValues: LabeledValue[] = newValue.map((k) => {\n const node = findNode(treeData, k, fieldNames)\n return {\n value: k,\n label: node ? getFieldValue(node, 'title', fieldNames) as React.ReactNode : k,\n }\n })\n onChange?.(labeledValues, labels, { triggerValue: key, triggerNode })\n } else {\n onChange?.(newValue, labels, { triggerValue: key, triggerNode })\n }\n },\n [value, controlledValue, onChange, treeData, treeCheckStrictly, fieldNames, maxCount, labelInValue]\n )\n\n const handleClear = (e: React.MouseEvent) => {\n e.stopPropagation()\n const newValue: string[] = []\n\n if (controlledValue === undefined) {\n setInternalValue(newValue)\n }\n\n if (labelInValue) {\n onChange?.(multiple || treeCheckable ? [] : { value: '', label: '' }, [])\n } else {\n onChange?.(multiple || treeCheckable ? newValue : '', [])\n }\n }\n\n const removeTag = (key: string, e: React.MouseEvent) => {\n e.stopPropagation()\n const newValue = value.filter((k) => k !== key)\n\n if (controlledValue === undefined) {\n setInternalValue(newValue)\n }\n\n const labels = newValue.map((k) => {\n const n = findNode(treeData, k, fieldNames)\n return n ? getFieldValue(n, 'title', fieldNames) as React.ReactNode : k\n })\n\n if (labelInValue) {\n const labeledValues: LabeledValue[] = newValue.map((k) => {\n const node = findNode(treeData, k, fieldNames)\n return {\n value: k,\n label: node ? getFieldValue(node, 'title', fieldNames) as React.ReactNode : k,\n }\n })\n onChange?.(\n multiple || treeCheckable ? labeledValues : labeledValues[0] || { value: '', label: '' },\n labels\n )\n } else {\n onChange?.(multiple || treeCheckable ? newValue : newValue[0] || '', labels)\n }\n }\n\n const handleSearchChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = e.target.value\n if (controlledSearchValue === undefined) {\n setInternalSearchValue(newValue)\n }\n onSearch?.(newValue)\n }\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n if (effectiveDisabled) return\n\n switch (e.key) {\n case 'Enter':\n case ' ':\n if (!open) {\n e.preventDefault()\n setOpen(true)\n } else if (focusedKey) {\n e.preventDefault()\n const node = findNode(treeData, focusedKey, fieldNames)\n if (node && !node.disabled) {\n if (treeCheckable) {\n handleCheck(focusedKey, node)\n } else {\n handleSelect(focusedKey, node)\n }\n }\n }\n break\n\n case 'Escape':\n e.preventDefault()\n setOpen(false)\n if (controlledSearchValue === undefined) {\n setInternalSearchValue('')\n }\n triggerRef.current?.focus()\n break\n\n case 'ArrowDown':\n e.preventDefault()\n if (!open) {\n setOpen(true)\n } else {\n const currentIndex = visibleNodes.findIndex((n) => n.key === focusedKey)\n const nextIndex = currentIndex < visibleNodes.length - 1 ? currentIndex + 1 : 0\n setFocusedKey(visibleNodes[nextIndex]?.key || null)\n }\n break\n\n case 'ArrowUp':\n e.preventDefault()\n if (open) {\n const currentIndex = visibleNodes.findIndex((n) => n.key === focusedKey)\n const prevIndex = currentIndex > 0 ? currentIndex - 1 : visibleNodes.length - 1\n setFocusedKey(visibleNodes[prevIndex]?.key || null)\n }\n break\n\n case 'ArrowRight':\n if (open && focusedKey) {\n e.preventDefault()\n const node = findNode(treeData, focusedKey, fieldNames)\n const children = node\n ? (getFieldValue(node, 'children', fieldNames) as TreeDataNode[] | undefined)\n : undefined\n if (children && children.length > 0 && !expandedKeys.includes(focusedKey)) {\n handleToggle(focusedKey)\n }\n }\n break\n\n case 'ArrowLeft':\n if (open && focusedKey) {\n e.preventDefault()\n if (expandedKeys.includes(focusedKey)) {\n handleToggle(focusedKey)\n } else {\n // Move to parent\n const parentKeys = getParentKeys(treeData, focusedKey, fieldNames)\n if (parentKeys && parentKeys.length > 0) {\n setFocusedKey(parentKeys[parentKeys.length - 1])\n }\n }\n }\n break\n\n case 'Home':\n if (open) {\n e.preventDefault()\n setFocusedKey(visibleNodes[0]?.key || null)\n }\n break\n\n case 'End':\n if (open) {\n e.preventDefault()\n setFocusedKey(visibleNodes[visibleNodes.length - 1]?.key || null)\n }\n break\n }\n }\n\n const getCheckedState = useCallback(\n (node: TreeDataNode): { checked: boolean; indeterminate: boolean } => {\n const key = getFieldValue(node, 'key', fieldNames) as string\n const children = getFieldValue(node, 'children', fieldNames) as TreeDataNode[] | undefined\n\n if (treeCheckStrictly) {\n return { checked: value.includes(key), indeterminate: false }\n }\n\n if (!children || children.length === 0) {\n return { checked: value.includes(key), indeterminate: false }\n }\n\n const descendantKeys = getDescendantKeys(node, fieldNames)\n const checkedDescendants = descendantKeys.filter((k) => value.includes(k))\n\n if (checkedDescendants.length === 0) {\n return { checked: value.includes(key), indeterminate: false }\n }\n\n if (checkedDescendants.length === descendantKeys.length) {\n return { checked: true, indeterminate: false }\n }\n\n return { checked: false, indeterminate: true }\n },\n [value, treeCheckStrictly, fieldNames]\n )\n\n const renderNodes = useCallback(\n (nodes: TreeDataNode[], level: number): React.ReactNode => {\n return nodes.map((node) => {\n const key = getFieldValue(node, 'key', fieldNames) as string\n const { checked, indeterminate } = getCheckedState(node)\n\n return (\n <TreeSelectNode\n key={key}\n node={node}\n level={level}\n expanded={expandedKeys.includes(key)}\n selected={value.includes(key)}\n checked={checked}\n indeterminate={indeterminate}\n treeCheckable={treeCheckable}\n treeLine={treeLine}\n treeIcon={treeIcon}\n focused={focusedKey === key}\n loading={loadingKeys.has(key)}\n baseTestId={baseTestId}\n id={`${instanceId}-option-${key}`}\n fieldNames={fieldNames}\n switcherIcon={switcherIcon}\n onToggle={handleToggle}\n onSelect={handleSelect}\n onCheck={handleCheck}\n renderChildren={renderNodes}\n />\n )\n })\n },\n [\n expandedKeys,\n value,\n treeCheckable,\n treeLine,\n treeIcon,\n focusedKey,\n loadingKeys,\n baseTestId,\n instanceId,\n fieldNames,\n switcherIcon,\n handleToggle,\n handleSelect,\n handleCheck,\n getCheckedState,\n ]\n )\n\n // Display value with showCheckedStrategy\n const displayValue = useMemo(() => {\n if (value.length === 0) return null\n\n let displayKeys = value\n\n if ((treeCheckable || multiple) && showCheckedStrategy !== 'SHOW_ALL') {\n if (showCheckedStrategy === 'SHOW_PARENT') {\n // Only show parent nodes when all children are selected\n displayKeys = value.filter((key) => {\n const parentKeys = getParentKeys(treeData, key, fieldNames)\n if (!parentKeys) return true\n // Check if any parent is fully selected\n return !parentKeys.some((pk) => value.includes(pk))\n })\n } else if (showCheckedStrategy === 'SHOW_CHILD') {\n // Only show leaf nodes\n displayKeys = value.filter((key) => {\n const node = findNode(treeData, key, fieldNames)\n if (!node) return true\n const children = getFieldValue(node, 'children', fieldNames) as\n | TreeDataNode[]\n | undefined\n return !children || children.length === 0\n })\n }\n }\n\n if (multiple || treeCheckable) {\n let keysToShow = displayKeys\n let hiddenCount = 0\n\n if (maxTagCount !== undefined && maxTagCount !== 'responsive') {\n if (displayKeys.length > maxTagCount) {\n keysToShow = displayKeys.slice(0, maxTagCount)\n hiddenCount = displayKeys.length - maxTagCount\n }\n }\n\n const tags = keysToShow.map((key) => {\n const node = findNode(treeData, key, fieldNames)\n const title = node ? getFieldValue(node, 'title', fieldNames) : key\n const label = title as React.ReactNode\n const closable = !effectiveDisabled\n const onClose = () => {\n const fakeEvent = { stopPropagation: () => {} } as React.MouseEvent\n removeTag(key, fakeEvent)\n }\n\n // Use custom tagRender if provided\n if (tagRender) {\n return (\n <React.Fragment key={key}>\n {tagRender({ label, value: key, closable, onClose })}\n </React.Fragment>\n )\n }\n\n return (\n <span\n key={key}\n className=\"inline-flex items-center gap-1 px-2 py-0.5 bg-base-200 rounded text-sm mr-1 mb-1\"\n data-testid={`${baseTestId}-tag-${key}`}\n >\n {label}\n {closable && (\n <button\n type=\"button\"\n className=\"hover:text-error\"\n onClick={(e) => removeTag(key, e)}\n aria-label={`Remove ${typeof title === 'string' ? title : key}`}\n >\n <svg\n className=\"w-3 h-3\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M6 18L18 6M6 6l12 12\"\n />\n </svg>\n </button>\n )}\n </span>\n )\n })\n\n if (hiddenCount > 0) {\n const hiddenKeys = displayKeys.slice(maxTagCount as number)\n const placeholder =\n typeof maxTagPlaceholder === 'function'\n ? maxTagPlaceholder(hiddenKeys)\n : maxTagPlaceholder || `+${hiddenCount} more`\n\n tags.push(\n <span\n key=\"__more__\"\n className=\"inline-flex items-center px-2 py-0.5 bg-base-200 rounded text-sm mr-1 mb-1\"\n >\n {placeholder}\n </span>\n )\n }\n\n return tags\n }\n\n const node = findNode(treeData, value[0], fieldNames)\n const title = node ? getFieldValue(node, 'title', fieldNames) : value[0]\n return title as React.ReactNode\n }, [\n value,\n treeData,\n multiple,\n treeCheckable,\n showCheckedStrategy,\n maxTagCount,\n maxTagPlaceholder,\n baseTestId,\n fieldNames,\n effectiveDisabled,\n tagRender,\n ])\n\n const borderClass = status ? statusClasses[status] : color ? colorClasses[color] : ''\n const variantClass = ghost ? 'bg-transparent border-transparent' : variantClasses[variant]\n\n const dropdownContent = (\n <div className=\"py-1\" role=\"tree\" aria-label=\"Tree options\">\n {filteredData.length > 0 ? (\n renderNodes(filteredData, 0)\n ) : (\n <div\n className=\"px-4 py-2 text-base-content/50 text-sm text-center\"\n data-testid={`${baseTestId}-empty`}\n >\n {effectiveNotFoundContent}\n </div>\n )}\n </div>\n )\n\n return (\n <div\n ref={(node) => {\n containerRef.current = node\n if (typeof ref === 'function') {\n ref(node)\n } else if (ref) {\n ref.current = node\n }\n }}\n className={`relative ${className}`}\n data-testid={baseTestId}\n data-state={open ? 'open' : 'closed'}\n data-disabled={effectiveDisabled || undefined}\n onKeyDown={handleKeyDown}\n {...rest}\n >\n {/* Trigger */}\n <div\n ref={triggerRef}\n role=\"combobox\"\n aria-expanded={open}\n aria-haspopup=\"tree\"\n aria-owns={open ? listboxId : undefined}\n aria-activedescendant={open && focusedKey ? `${instanceId}-option-${focusedKey}` : undefined}\n aria-disabled={effectiveDisabled}\n tabIndex={effectiveDisabled ? -1 : 0}\n className={[\n dInput,\n 'flex items-center gap-2 cursor-pointer flex-wrap',\n sizeClasses[effectiveSize],\n variantClass,\n borderClass,\n effectiveDisabled && `${dInputDisabled} opacity-50 cursor-not-allowed`,\n open && !borderClass && 'border-primary',\n ]\n .filter(Boolean)\n .join(' ')}\n onClick={() => !effectiveDisabled && setOpen(!open)}\n data-testid={`${baseTestId}-trigger`}\n >\n <div className=\"flex-1 flex flex-wrap items-center gap-1 min-w-0\">\n {displayValue || <span className=\"text-base-content/50\">{placeholder}</span>}\n </div>\n\n {/* Clear button */}\n {allowClear && value.length > 0 && !effectiveDisabled && (\n <button\n type=\"button\"\n className=\"hover:text-error flex-shrink-0\"\n onClick={handleClear}\n aria-label=\"Clear selection\"\n data-testid={`${baseTestId}-clear`}\n >\n <svg\n className=\"w-4 h-4\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M6 18L18 6M6 6l12 12\"\n />\n </svg>\n </button>\n )}\n\n {/* Suffix icon / Dropdown arrow */}\n {suffixIcon || (\n <svg\n className={`w-4 h-4 flex-shrink-0 transition-transform ${open ? 'rotate-180' : ''}`}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M19 9l-7 7-7-7\"\n />\n </svg>\n )}\n </div>\n\n {/* Dropdown */}\n {open && (\n <div\n id={listboxId}\n className={`absolute z-50 mt-1 w-full bg-base-100 border border-base-300 rounded-lg shadow-lg max-h-64 overflow-auto ${popupClassName}`}\n data-testid={`${baseTestId}-dropdown`}\n >\n {/* Search input */}\n {showSearch && (\n <div className=\"p-2 border-b border-base-300\">\n <input\n ref={inputRef}\n type=\"text\"\n className={`${dInput} ${dInputSm} w-full`}\n placeholder=\"Search...\"\n value={searchValue}\n onChange={handleSearchChange}\n onClick={(e) => e.stopPropagation()}\n aria-label=\"Search tree options\"\n data-testid={`${baseTestId}-search`}\n />\n </div>\n )}\n\n {/* Tree */}\n {dropdownRender ? dropdownRender(dropdownContent) : dropdownContent}\n </div>\n )}\n </div>\n )\n }\n)\n\nTreeSelect.displayName = 'TreeSelect'\n\n// Attach static strategy constants to TreeSelect\nexport const TreeSelectComponent = Object.assign(TreeSelect, {\n SHOW_ALL,\n SHOW_PARENT,\n SHOW_CHILD,\n})\n\nexport { TreeSelectComponent as default }\n"],"names":["dCheckbox","dCheckboxSm","dCheckboxPrimary","dLoading","dLoadingSpinner","dLoadingXs","dInput","dInputSm","dInputDisabled","SHOW_ALL","SHOW_PARENT","SHOW_CHILD","getFieldValue","node","field","fieldNames","labelField","valueField","childrenField","flattenTree","data","parentPath","result","title","children","currentPath","getAllKeys","keys","traverse","nodes","key","findNode","nodeKey","found","getDescendantKeys","n","child","childKey","getParentKeys","targetKey","parentKeys","TreeSelectNode","level","expanded","selected","checked","indeterminate","treeCheckable","treeLine","showTreeIcon","focused","loading","baseTestId","id","switcherIcon","onToggle","onSelect","onCheck","renderChildren","nodeIcon","hasChildren","isLeaf","handleToggle","e","handleSelect","handleCheck","handleKeyDown","renderSwitcherIcon","jsx","jsxs","el","sizeClasses","colorClasses","statusClasses","variantClasses","TreeSelect","forwardRef","treeData","controlledValue","defaultValue","onChange","multiple","treeCheckStrictly","showCheckedStrategy","showSearch","controlledSearchValue","onSearch","filterTreeNode","placeholder","allowClear","disabled","treeDefaultExpandAll","treeDefaultExpandedKeys","controlledExpandedKeys","onTreeExpand","size","color","status","variant","ghost","maxTagCount","maxTagPlaceholder","maxCount","labelInValue","tagRender","treeIcon","loadData","controlledOpen","onDropdownVisibleChange","suffixIcon","notFoundContent","dropdownRender","popupClassName","className","testId","rest","ref","componentSize","componentDisabled","renderEmpty","useConfig","effectiveSize","effectiveDisabled","effectiveNotFoundContent","instanceId","useId","listboxId","isOpen","setIsOpen","useState","internalSearchValue","setInternalSearchValue","focusedKey","setFocusedKey","loadingKeys","setLoadingKeys","containerRef","useRef","inputRef","triggerRef","searchValue","open","normalizeValue","val","v","initialValue","internalValue","setInternalValue","value","initialExpandedKeys","useMemo","internalExpandedKeys","setInternalExpandedKeys","expandedKeys","visibleNodes","setOpen","useCallback","newOpen","useEffect","handleClickOutside","filteredData","flatNodes","matchingKeys","isMatch","filterTree","hasMatchingChildren","prev","next","newKeys","k","triggerNode","newValue","labels","labeledValues","isChecked","descendantKeys","keysToAdd","dk","remainingSlots","handleClear","removeTag","handleSearchChange","currentIndex","nextIndex","prevIndex","getCheckedState","checkedDescendants","renderNodes","displayValue","displayKeys","pk","keysToShow","hiddenCount","tags","label","closable","onClose","React","hiddenKeys","borderClass","variantClass","dropdownContent","TreeSelectComponent"],"mappings":";;;AAaA,MAAMA,KAAY,YACZC,KAAc,eACdC,KAAmB,oBACnBC,KAAW,WACXC,KAAkB,mBAClBC,KAAa,cACbC,KAAS,SACTC,KAAW,YACXC,KAAiB,kBAiBjBC,KAAgC,YAChCC,KAAmC,eACnCC,KAAkC;AA4ExC,SAASC,EACPC,GACAC,GACAC,GACS;AACT,MAAID,MAAU,SAAS;AACrB,UAAME,IAAaD,GAAY,SAAS;AACxC,WAAQF,EAA4CG,CAAU;AAAA,EAChE;AACA,MAAIF,MAAU,OAAO;AACnB,UAAMG,IAAaF,GAAY,SAAS;AACxC,WAAQF,EAA4CI,CAAU;AAAA,EAChE;AACA,MAAIH,MAA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":["../../src/components/TreeSelect.tsx"],"sourcesContent":["import React, {\n useState,\n useCallback,\n useRef,\n useEffect,\n useMemo,\n forwardRef,\n useId,\n} from 'react'\nimport type { TreeDataNode } from './Tree'\nimport { useConfig } from '../providers/ConfigProvider'\n\n// DaisyUI classes\nconst dCheckbox = 'checkbox'\nconst dCheckboxSm = 'checkbox-sm'\nconst dCheckboxPrimary = 'checkbox-primary'\nconst dLoading = 'loading'\nconst dLoadingSpinner = 'loading-spinner'\nconst dLoadingXs = 'loading-xs'\nconst dInput = 'input'\nconst dInputSm = 'input-sm'\nconst dInputDisabled = 'input-disabled'\n\nexport type TreeSelectSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl'\nexport type TreeSelectColor =\n | 'primary'\n | 'secondary'\n | 'accent'\n | 'neutral'\n | 'info'\n | 'success'\n | 'warning'\n | 'error'\nexport type TreeSelectStatus = 'error' | 'warning'\nexport type TreeSelectVariant = 'outlined' | 'filled' | 'borderless'\nexport type ShowCheckedStrategy = 'SHOW_ALL' | 'SHOW_PARENT' | 'SHOW_CHILD'\n\n// Static strategy constants\nconst SHOW_ALL: ShowCheckedStrategy = 'SHOW_ALL'\nconst SHOW_PARENT: ShowCheckedStrategy = 'SHOW_PARENT'\nconst SHOW_CHILD: ShowCheckedStrategy = 'SHOW_CHILD'\n\nexport interface TreeSelectFieldNames {\n label?: string\n value?: string\n children?: string\n}\n\n/** Value type when labelInValue is true */\nexport interface LabeledValue {\n value: string\n label: React.ReactNode\n}\n\nexport interface TreeSelectProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {\n treeData: TreeDataNode[]\n value?: string | string[] | LabeledValue | LabeledValue[]\n defaultValue?: string | string[] | LabeledValue | LabeledValue[]\n onChange?: (\n value: string | string[] | LabeledValue | LabeledValue[],\n labels: React.ReactNode[],\n extra?: { triggerValue: string; triggerNode: TreeDataNode }\n ) => void\n multiple?: boolean\n treeCheckable?: boolean\n treeCheckStrictly?: boolean\n showCheckedStrategy?: ShowCheckedStrategy\n showSearch?: boolean\n searchValue?: string\n onSearch?: (value: string) => void\n filterTreeNode?: (searchValue: string, node: TreeDataNode) => boolean\n placeholder?: string\n allowClear?: boolean\n disabled?: boolean\n treeDefaultExpandAll?: boolean\n treeDefaultExpandedKeys?: string[]\n treeExpandedKeys?: string[]\n onTreeExpand?: (expandedKeys: string[]) => void\n size?: TreeSelectSize\n color?: TreeSelectColor\n status?: TreeSelectStatus\n /** Visual variant style */\n variant?: TreeSelectVariant\n /** Ghost style with no background */\n ghost?: boolean\n /** Maximum number of tags to show (multiple/treeCheckable mode) */\n maxTagCount?: number | 'responsive'\n maxTagPlaceholder?: React.ReactNode | ((omittedValues: string[]) => React.ReactNode)\n /** Maximum number of selections allowed */\n maxCount?: number\n /** Return object with value and label instead of just value */\n labelInValue?: boolean\n /** Custom tag render function */\n tagRender?: (props: {\n label: React.ReactNode\n value: string\n closable: boolean\n onClose: () => void\n }) => React.ReactNode\n treeLine?: boolean\n /** Show tree node icon */\n treeIcon?: boolean\n loadData?: (node: TreeDataNode) => Promise<void>\n fieldNames?: TreeSelectFieldNames\n open?: boolean\n onDropdownVisibleChange?: (open: boolean) => void\n suffixIcon?: React.ReactNode\n switcherIcon?: React.ReactNode | ((props: { expanded: boolean }) => React.ReactNode)\n notFoundContent?: React.ReactNode\n dropdownRender?: (menu: React.ReactNode) => React.ReactNode\n popupClassName?: string\n 'data-testid'?: string\n}\n\n// Helper to get field value based on fieldNames\nfunction getFieldValue(\n node: TreeDataNode,\n field: 'title' | 'key' | 'children',\n fieldNames?: TreeSelectFieldNames\n): unknown {\n if (field === 'title') {\n const labelField = fieldNames?.label || 'title'\n return (node as unknown as Record<string, unknown>)[labelField]\n }\n if (field === 'key') {\n const valueField = fieldNames?.value || 'key'\n return (node as unknown as Record<string, unknown>)[valueField]\n }\n if (field === 'children') {\n const childrenField = fieldNames?.children || 'children'\n return (node as unknown as Record<string, unknown>)[childrenField]\n }\n return undefined\n}\n\n// Helper to flatten tree data for search\nfunction flattenTree(\n data: TreeDataNode[],\n parentPath: React.ReactNode[] = [],\n fieldNames?: TreeSelectFieldNames\n): Array<{ node: TreeDataNode; path: React.ReactNode[] }> {\n const result: Array<{ node: TreeDataNode; path: React.ReactNode[] }> = []\n\n data.forEach((node) => {\n const title = getFieldValue(node, 'title', fieldNames) as React.ReactNode\n const children = getFieldValue(node, 'children', fieldNames) as TreeDataNode[] | undefined\n const currentPath = [...parentPath, title]\n result.push({ node, path: currentPath })\n if (children) {\n result.push(...flattenTree(children, currentPath, fieldNames))\n }\n })\n\n return result\n}\n\n// Helper to get all keys\nfunction getAllKeys(data: TreeDataNode[], fieldNames?: TreeSelectFieldNames): string[] {\n const keys: string[] = []\n const traverse = (nodes: TreeDataNode[]) => {\n nodes.forEach((node) => {\n const key = getFieldValue(node, 'key', fieldNames) as string\n const children = getFieldValue(node, 'children', fieldNames) as TreeDataNode[] | undefined\n keys.push(key)\n if (children) traverse(children)\n })\n }\n traverse(data)\n return keys\n}\n\n// Helper to find node by key\nfunction findNode(\n data: TreeDataNode[],\n key: string,\n fieldNames?: TreeSelectFieldNames\n): TreeDataNode | null {\n for (const node of data) {\n const nodeKey = getFieldValue(node, 'key', fieldNames) as string\n const children = getFieldValue(node, 'children', fieldNames) as TreeDataNode[] | undefined\n if (nodeKey === key) return node\n if (children) {\n const found = findNode(children, key, fieldNames)\n if (found) return found\n }\n }\n return null\n}\n\n// Helper to get all descendant keys\nfunction getDescendantKeys(node: TreeDataNode, fieldNames?: TreeSelectFieldNames): string[] {\n const keys: string[] = []\n const traverse = (n: TreeDataNode) => {\n const children = getFieldValue(n, 'children', fieldNames) as TreeDataNode[] | undefined\n if (children) {\n children.forEach((child) => {\n const childKey = getFieldValue(child, 'key', fieldNames) as string\n keys.push(childKey)\n traverse(child)\n })\n }\n }\n traverse(node)\n return keys\n}\n\n// Helper to get parent keys for a node\nfunction getParentKeys(\n data: TreeDataNode[],\n targetKey: string,\n fieldNames?: TreeSelectFieldNames,\n parentKeys: string[] = []\n): string[] | null {\n for (const node of data) {\n const nodeKey = getFieldValue(node, 'key', fieldNames) as string\n const children = getFieldValue(node, 'children', fieldNames) as TreeDataNode[] | undefined\n if (nodeKey === targetKey) return parentKeys\n if (children) {\n const found = getParentKeys(children, targetKey, fieldNames, [...parentKeys, nodeKey])\n if (found) return found\n }\n }\n return null\n}\n\ninterface TreeSelectNodeProps {\n node: TreeDataNode\n level: number\n expanded: boolean\n selected: boolean\n checked: boolean\n indeterminate: boolean\n treeCheckable: boolean\n treeLine: boolean\n treeIcon: boolean\n focused: boolean\n loading: boolean\n baseTestId: string\n id: string\n fieldNames?: TreeSelectFieldNames\n switcherIcon?: React.ReactNode | ((props: { expanded: boolean }) => React.ReactNode)\n onToggle: (key: string) => void\n onSelect: (key: string, node: TreeDataNode) => void\n onCheck: (key: string, node: TreeDataNode) => void\n renderChildren: (children: TreeDataNode[], level: number) => React.ReactNode\n}\n\nfunction TreeSelectNode({\n node,\n level,\n expanded,\n selected,\n checked,\n indeterminate,\n treeCheckable,\n treeLine,\n treeIcon: showTreeIcon,\n focused,\n loading,\n baseTestId,\n id,\n fieldNames,\n switcherIcon,\n onToggle,\n onSelect,\n onCheck,\n renderChildren,\n}: TreeSelectNodeProps) {\n const children = getFieldValue(node, 'children', fieldNames) as TreeDataNode[] | undefined\n const title = getFieldValue(node, 'title', fieldNames) as React.ReactNode\n const key = getFieldValue(node, 'key', fieldNames) as string\n const nodeIcon = node.icon\n const hasChildren = children && children.length > 0\n const isLeaf = node.isLeaf ?? !hasChildren\n\n const handleToggle = (e: React.MouseEvent) => {\n e.stopPropagation()\n if (!isLeaf) {\n onToggle(key)\n }\n }\n\n const handleSelect = () => {\n if (!node.disabled) {\n if (treeCheckable) {\n onCheck(key, node)\n } else {\n onSelect(key, node)\n }\n }\n }\n\n const handleCheck = (e: React.MouseEvent) => {\n e.stopPropagation()\n if (!node.disabled) {\n onCheck(key, node)\n }\n }\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n handleSelect()\n }\n }\n\n const renderSwitcherIcon = () => {\n if (loading) {\n return (\n <span className={`${dLoading} ${dLoadingSpinner} ${dLoadingXs}`} />\n )\n }\n\n if (switcherIcon) {\n if (typeof switcherIcon === 'function') {\n return switcherIcon({ expanded })\n }\n return switcherIcon\n }\n\n return (\n <svg\n className={`w-3 h-3 transition-transform ${expanded ? 'rotate-90' : ''}`}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M9 5l7 7-7 7\" />\n </svg>\n )\n }\n\n return (\n <div\n className=\"tree-select-node\"\n role=\"treeitem\"\n id={id}\n aria-selected={selected || checked}\n aria-checked={treeCheckable ? (indeterminate ? 'mixed' : checked) : undefined}\n aria-expanded={hasChildren ? expanded : undefined}\n data-testid={`${baseTestId}-option-${key}`}\n data-state={selected || checked ? 'selected' : 'unselected'}\n data-disabled={node.disabled || undefined}\n >\n <div\n className={[\n 'flex items-center py-1.5 px-2 cursor-pointer hover:bg-base-200 transition-colors outline-none',\n (selected || checked) && 'bg-primary/10 text-primary',\n node.disabled && 'opacity-50 cursor-not-allowed',\n focused && 'ring-2 ring-primary ring-inset',\n treeLine && level > 0 && 'border-l border-base-300 ml-2',\n ]\n .filter(Boolean)\n .join(' ')}\n style={{ paddingLeft: `${level * 16 + 8}px` }}\n onClick={handleSelect}\n onKeyDown={handleKeyDown}\n tabIndex={-1}\n >\n {/* Expand/Collapse icon */}\n <span\n className={[\n 'w-4 h-4 flex items-center justify-center flex-shrink-0 mr-1',\n !isLeaf && 'cursor-pointer',\n ]\n .filter(Boolean)\n .join(' ')}\n onClick={handleToggle}\n aria-hidden=\"true\"\n >\n {!isLeaf && renderSwitcherIcon()}\n </span>\n\n {/* Checkbox for treeCheckable mode */}\n {treeCheckable && (\n <span className=\"mr-2 flex-shrink-0\" onClick={handleCheck}>\n <input\n type=\"checkbox\"\n className={`${dCheckbox} ${dCheckboxSm} ${dCheckboxPrimary}`}\n checked={checked}\n ref={(el) => {\n if (el) el.indeterminate = indeterminate\n }}\n disabled={node.disabled}\n onChange={handleSelect}\n aria-label={typeof title === 'string' ? title : undefined}\n tabIndex={-1}\n />\n </span>\n )}\n\n {/* Node icon */}\n {showTreeIcon && nodeIcon && (\n <span className=\"mr-1.5 flex-shrink-0 flex items-center\">{nodeIcon}</span>\n )}\n\n {/* Title */}\n <span className=\"flex-1 truncate select-none text-sm\">{title}</span>\n </div>\n\n {/* Children */}\n {hasChildren && expanded && (\n <div role=\"group\">{renderChildren(children!, level + 1)}</div>\n )}\n </div>\n )\n}\n\nconst sizeClasses: Record<TreeSelectSize, string> = {\n xs: 'min-h-6 text-xs',\n sm: 'min-h-8 text-sm',\n md: 'min-h-10 text-base',\n lg: 'min-h-12 text-lg',\n xl: 'min-h-14 text-xl',\n}\n\nconst colorClasses: Record<TreeSelectColor, string> = {\n primary: 'border-primary focus-within:border-primary',\n secondary: 'border-secondary focus-within:border-secondary',\n accent: 'border-accent focus-within:border-accent',\n neutral: 'border-neutral focus-within:border-neutral',\n info: 'border-info focus-within:border-info',\n success: 'border-success focus-within:border-success',\n warning: 'border-warning focus-within:border-warning',\n error: 'border-error focus-within:border-error',\n}\n\nconst statusClasses: Record<TreeSelectStatus, string> = {\n error: 'border-error focus-within:border-error',\n warning: 'border-warning focus-within:border-warning',\n}\n\nconst variantClasses: Record<TreeSelectVariant, string> = {\n outlined: 'border border-base-300',\n filled: 'bg-base-200 border-transparent',\n borderless: 'border-transparent',\n}\n\nexport const TreeSelect = forwardRef<HTMLDivElement, TreeSelectProps>(\n (\n {\n treeData,\n value: controlledValue,\n defaultValue = [],\n onChange,\n multiple = false,\n treeCheckable = false,\n treeCheckStrictly = false,\n showCheckedStrategy = 'SHOW_ALL',\n showSearch = false,\n searchValue: controlledSearchValue,\n onSearch,\n filterTreeNode,\n placeholder = 'Please select',\n allowClear = true,\n disabled = false,\n treeDefaultExpandAll = false,\n treeDefaultExpandedKeys = [],\n treeExpandedKeys: controlledExpandedKeys,\n onTreeExpand,\n size = 'md',\n color,\n status,\n variant = 'outlined',\n ghost = false,\n maxTagCount,\n maxTagPlaceholder,\n maxCount,\n labelInValue = false,\n tagRender,\n treeLine = false,\n treeIcon = false,\n loadData,\n fieldNames,\n open: controlledOpen,\n onDropdownVisibleChange,\n suffixIcon,\n switcherIcon,\n notFoundContent,\n dropdownRender,\n popupClassName = '',\n className = '',\n 'data-testid': testId,\n ...rest\n },\n ref\n ) => {\n const { componentSize, componentDisabled, renderEmpty } = useConfig()\n const effectiveSize = size ?? (componentSize as TreeSelectSize) ?? 'md'\n const effectiveDisabled = disabled ?? componentDisabled ?? false\n const effectiveNotFoundContent = notFoundContent ?? renderEmpty?.('TreeSelect') ?? 'No results found'\n\n const baseTestId = testId ?? 'treeselect'\n const instanceId = useId()\n const listboxId = `${instanceId}-listbox`\n const [isOpen, setIsOpen] = useState(false)\n const [internalSearchValue, setInternalSearchValue] = useState('')\n const [focusedKey, setFocusedKey] = useState<string | null>(null)\n const [loadingKeys, setLoadingKeys] = useState<Set<string>>(new Set())\n const containerRef = useRef<HTMLDivElement>(null)\n const inputRef = useRef<HTMLInputElement>(null)\n const triggerRef = useRef<HTMLDivElement>(null)\n\n const searchValue = controlledSearchValue ?? internalSearchValue\n const open = controlledOpen ?? isOpen\n\n // Normalize value to array - handle labelInValue format\n const normalizeValue = (val: string | string[] | LabeledValue | LabeledValue[] | undefined): string[] => {\n if (val === undefined) return []\n if (Array.isArray(val)) {\n return val.map((v) => (typeof v === 'object' && v !== null ? v.value : v))\n }\n if (typeof val === 'object' && val !== null) {\n return [(val as LabeledValue).value]\n }\n return [val as string]\n }\n\n const initialValue = normalizeValue(defaultValue)\n const [internalValue, setInternalValue] = useState<string[]>(initialValue)\n\n const value = controlledValue !== undefined ? normalizeValue(controlledValue) : internalValue\n\n // Expanded keys\n const initialExpandedKeys = useMemo(() => {\n if (treeDefaultExpandAll) return getAllKeys(treeData, fieldNames)\n return treeDefaultExpandedKeys\n }, [treeData, treeDefaultExpandAll, treeDefaultExpandedKeys, fieldNames])\n\n const [internalExpandedKeys, setInternalExpandedKeys] = useState<string[]>(initialExpandedKeys)\n const expandedKeys = controlledExpandedKeys ?? internalExpandedKeys\n\n // Get flattened visible nodes for keyboard navigation\n const visibleNodes = useMemo(() => {\n const nodes: { key: string; node: TreeDataNode }[] = []\n const traverse = (data: TreeDataNode[]) => {\n data.forEach((node) => {\n const key = getFieldValue(node, 'key', fieldNames) as string\n const children = getFieldValue(node, 'children', fieldNames) as\n | TreeDataNode[]\n | undefined\n nodes.push({ key, node })\n if (children && expandedKeys.includes(key)) {\n traverse(children)\n }\n })\n }\n traverse(treeData)\n return nodes\n }, [treeData, expandedKeys, fieldNames])\n\n const setOpen = useCallback(\n (newOpen: boolean) => {\n if (controlledOpen === undefined) {\n setIsOpen(newOpen)\n }\n onDropdownVisibleChange?.(newOpen)\n },\n [controlledOpen, onDropdownVisibleChange]\n )\n\n // Close on click outside\n useEffect(() => {\n const handleClickOutside = (e: MouseEvent) => {\n if (containerRef.current && !containerRef.current.contains(e.target as Node)) {\n setOpen(false)\n if (controlledSearchValue === undefined) {\n setInternalSearchValue('')\n }\n }\n }\n\n document.addEventListener('mousedown', handleClickOutside)\n return () => document.removeEventListener('mousedown', handleClickOutside)\n }, [setOpen, controlledSearchValue])\n\n // Focus management\n useEffect(() => {\n if (open && showSearch && inputRef.current) {\n inputRef.current.focus()\n } else if (open && triggerRef.current) {\n triggerRef.current.focus()\n }\n }, [open, showSearch])\n\n // Initialize focused key when opening\n useEffect(() => {\n if (open && visibleNodes.length > 0) {\n if (value.length > 0) {\n setFocusedKey(value[0])\n } else {\n setFocusedKey(visibleNodes[0].key)\n }\n } else if (!open) {\n setFocusedKey(null)\n }\n }, [open, visibleNodes, value])\n\n // Filter tree data based on search\n const filteredData = useMemo(() => {\n if (!searchValue) return treeData\n\n const flatNodes = flattenTree(treeData, [], fieldNames)\n const matchingKeys = new Set<string>()\n\n flatNodes.forEach(({ node }) => {\n const title = getFieldValue(node, 'title', fieldNames)\n const key = getFieldValue(node, 'key', fieldNames) as string\n\n let isMatch = false\n if (filterTreeNode) {\n isMatch = filterTreeNode(searchValue, node)\n } else {\n const titleStr = typeof title === 'string' ? title : String(title)\n isMatch = titleStr.toLowerCase().includes(searchValue.toLowerCase())\n }\n\n if (isMatch) {\n matchingKeys.add(key)\n }\n })\n\n // Include parent keys of matching nodes\n const filterTree = (nodes: TreeDataNode[]): TreeDataNode[] => {\n return nodes\n .map((node) => {\n const children = getFieldValue(node, 'children', fieldNames) as\n | TreeDataNode[]\n | undefined\n const key = getFieldValue(node, 'key', fieldNames) as string\n const hasMatchingChildren = children && filterTree(children).length > 0\n const isMatch = matchingKeys.has(key)\n\n if (isMatch || hasMatchingChildren) {\n return {\n ...node,\n children: children ? filterTree(children) : undefined,\n }\n }\n return null\n })\n .filter(Boolean) as TreeDataNode[]\n }\n\n return filterTree(treeData)\n }, [treeData, searchValue, filterTreeNode, fieldNames])\n\n const handleToggle = useCallback(\n async (key: string) => {\n const node = findNode(treeData, key, fieldNames)\n\n // Handle async loading\n if (loadData && node) {\n const children = getFieldValue(node, 'children', fieldNames) as\n | TreeDataNode[]\n | undefined\n if (!children || children.length === 0) {\n setLoadingKeys((prev) => new Set(prev).add(key))\n try {\n await loadData(node)\n } finally {\n setLoadingKeys((prev) => {\n const next = new Set(prev)\n next.delete(key)\n return next\n })\n }\n }\n }\n\n const newKeys = expandedKeys.includes(key)\n ? expandedKeys.filter((k) => k !== key)\n : [...expandedKeys, key]\n\n if (controlledExpandedKeys === undefined) {\n setInternalExpandedKeys(newKeys)\n }\n onTreeExpand?.(newKeys)\n },\n [expandedKeys, controlledExpandedKeys, onTreeExpand, loadData, treeData, fieldNames]\n )\n\n const handleSelect = useCallback(\n (key: string, triggerNode: TreeDataNode) => {\n let newValue: string[]\n\n if (multiple) {\n if (value.includes(key)) {\n newValue = value.filter((k) => k !== key)\n } else {\n // Check maxCount limit\n if (maxCount !== undefined && value.length >= maxCount) {\n return // Don't add more if at limit\n }\n newValue = [...value, key]\n }\n } else {\n newValue = [key]\n setOpen(false)\n if (controlledSearchValue === undefined) {\n setInternalSearchValue('')\n }\n }\n\n if (controlledValue === undefined) {\n setInternalValue(newValue)\n }\n\n const labels = newValue.map((k) => {\n const node = findNode(treeData, k, fieldNames)\n return node ? getFieldValue(node, 'title', fieldNames) as React.ReactNode : k\n })\n\n // Build return value based on labelInValue setting\n if (labelInValue) {\n const labeledValues: LabeledValue[] = newValue.map((k) => {\n const node = findNode(treeData, k, fieldNames)\n return {\n value: k,\n label: node ? getFieldValue(node, 'title', fieldNames) as React.ReactNode : k,\n }\n })\n onChange?.(\n multiple ? labeledValues : labeledValues[0] || { value: '', label: '' },\n labels,\n { triggerValue: key, triggerNode }\n )\n } else {\n onChange?.(multiple ? newValue : newValue[0] || '', labels, { triggerValue: key, triggerNode })\n }\n },\n [\n value,\n multiple,\n maxCount,\n controlledValue,\n onChange,\n treeData,\n setOpen,\n controlledSearchValue,\n fieldNames,\n labelInValue,\n ]\n )\n\n const handleCheck = useCallback(\n (key: string, triggerNode: TreeDataNode) => {\n const isChecked = value.includes(key)\n let newValue = [...value]\n\n if (treeCheckStrictly) {\n // No parent-child association\n if (isChecked) {\n newValue = newValue.filter((k) => k !== key)\n } else {\n // Check maxCount limit\n if (maxCount !== undefined && value.length >= maxCount) {\n return // Don't add more if at limit\n }\n newValue.push(key)\n }\n } else {\n const descendantKeys = getDescendantKeys(triggerNode, fieldNames)\n\n if (isChecked) {\n newValue = newValue.filter((k) => k !== key && !descendantKeys.includes(k))\n } else {\n // Check maxCount limit for adding multiple\n const keysToAdd = [key, ...descendantKeys.filter((dk) => !newValue.includes(dk))]\n if (maxCount !== undefined && newValue.length + keysToAdd.length > maxCount) {\n // Add only up to maxCount\n const remainingSlots = maxCount - newValue.length\n if (remainingSlots <= 0) return\n keysToAdd.slice(0, remainingSlots).forEach((k) => newValue.push(k))\n } else {\n newValue.push(key)\n descendantKeys.forEach((dk) => {\n if (!newValue.includes(dk)) newValue.push(dk)\n })\n }\n }\n }\n\n if (controlledValue === undefined) {\n setInternalValue(newValue)\n }\n\n const labels = newValue.map((k) => {\n const n = findNode(treeData, k, fieldNames)\n return n ? getFieldValue(n, 'title', fieldNames) as React.ReactNode : k\n })\n\n // Build return value based on labelInValue setting\n if (labelInValue) {\n const labeledValues: LabeledValue[] = newValue.map((k) => {\n const node = findNode(treeData, k, fieldNames)\n return {\n value: k,\n label: node ? getFieldValue(node, 'title', fieldNames) as React.ReactNode : k,\n }\n })\n onChange?.(labeledValues, labels, { triggerValue: key, triggerNode })\n } else {\n onChange?.(newValue, labels, { triggerValue: key, triggerNode })\n }\n },\n [value, controlledValue, onChange, treeData, treeCheckStrictly, fieldNames, maxCount, labelInValue]\n )\n\n const handleClear = (e: React.MouseEvent) => {\n e.stopPropagation()\n const newValue: string[] = []\n\n if (controlledValue === undefined) {\n setInternalValue(newValue)\n }\n\n if (labelInValue) {\n onChange?.(multiple || treeCheckable ? [] : { value: '', label: '' }, [])\n } else {\n onChange?.(multiple || treeCheckable ? newValue : '', [])\n }\n }\n\n const removeTag = (key: string, e: React.MouseEvent) => {\n e.stopPropagation()\n const newValue = value.filter((k) => k !== key)\n\n if (controlledValue === undefined) {\n setInternalValue(newValue)\n }\n\n const labels = newValue.map((k) => {\n const n = findNode(treeData, k, fieldNames)\n return n ? getFieldValue(n, 'title', fieldNames) as React.ReactNode : k\n })\n\n if (labelInValue) {\n const labeledValues: LabeledValue[] = newValue.map((k) => {\n const node = findNode(treeData, k, fieldNames)\n return {\n value: k,\n label: node ? getFieldValue(node, 'title', fieldNames) as React.ReactNode : k,\n }\n })\n onChange?.(\n multiple || treeCheckable ? labeledValues : labeledValues[0] || { value: '', label: '' },\n labels\n )\n } else {\n onChange?.(multiple || treeCheckable ? newValue : newValue[0] || '', labels)\n }\n }\n\n const handleSearchChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = e.target.value\n if (controlledSearchValue === undefined) {\n setInternalSearchValue(newValue)\n }\n onSearch?.(newValue)\n }\n\n const handleKeyDown = (e: React.KeyboardEvent) => {\n if (effectiveDisabled) return\n\n switch (e.key) {\n case 'Enter':\n case ' ':\n if (!open) {\n e.preventDefault()\n setOpen(true)\n } else if (focusedKey) {\n e.preventDefault()\n const node = findNode(treeData, focusedKey, fieldNames)\n if (node && !node.disabled) {\n if (treeCheckable) {\n handleCheck(focusedKey, node)\n } else {\n handleSelect(focusedKey, node)\n }\n }\n }\n break\n\n case 'Escape':\n e.preventDefault()\n setOpen(false)\n if (controlledSearchValue === undefined) {\n setInternalSearchValue('')\n }\n triggerRef.current?.focus()\n break\n\n case 'ArrowDown':\n e.preventDefault()\n if (!open) {\n setOpen(true)\n } else {\n const currentIndex = visibleNodes.findIndex((n) => n.key === focusedKey)\n const nextIndex = currentIndex < visibleNodes.length - 1 ? currentIndex + 1 : 0\n setFocusedKey(visibleNodes[nextIndex]?.key || null)\n }\n break\n\n case 'ArrowUp':\n e.preventDefault()\n if (open) {\n const currentIndex = visibleNodes.findIndex((n) => n.key === focusedKey)\n const prevIndex = currentIndex > 0 ? currentIndex - 1 : visibleNodes.length - 1\n setFocusedKey(visibleNodes[prevIndex]?.key || null)\n }\n break\n\n case 'ArrowRight':\n if (open && focusedKey) {\n e.preventDefault()\n const node = findNode(treeData, focusedKey, fieldNames)\n const children = node\n ? (getFieldValue(node, 'children', fieldNames) as TreeDataNode[] | undefined)\n : undefined\n if (children && children.length > 0 && !expandedKeys.includes(focusedKey)) {\n handleToggle(focusedKey)\n }\n }\n break\n\n case 'ArrowLeft':\n if (open && focusedKey) {\n e.preventDefault()\n if (expandedKeys.includes(focusedKey)) {\n handleToggle(focusedKey)\n } else {\n // Move to parent\n const parentKeys = getParentKeys(treeData, focusedKey, fieldNames)\n if (parentKeys && parentKeys.length > 0) {\n setFocusedKey(parentKeys[parentKeys.length - 1])\n }\n }\n }\n break\n\n case 'Home':\n if (open) {\n e.preventDefault()\n setFocusedKey(visibleNodes[0]?.key || null)\n }\n break\n\n case 'End':\n if (open) {\n e.preventDefault()\n setFocusedKey(visibleNodes[visibleNodes.length - 1]?.key || null)\n }\n break\n }\n }\n\n const getCheckedState = useCallback(\n (node: TreeDataNode): { checked: boolean; indeterminate: boolean } => {\n const key = getFieldValue(node, 'key', fieldNames) as string\n const children = getFieldValue(node, 'children', fieldNames) as TreeDataNode[] | undefined\n\n if (treeCheckStrictly) {\n return { checked: value.includes(key), indeterminate: false }\n }\n\n if (!children || children.length === 0) {\n return { checked: value.includes(key), indeterminate: false }\n }\n\n const descendantKeys = getDescendantKeys(node, fieldNames)\n const checkedDescendants = descendantKeys.filter((k) => value.includes(k))\n\n if (checkedDescendants.length === 0) {\n return { checked: value.includes(key), indeterminate: false }\n }\n\n if (checkedDescendants.length === descendantKeys.length) {\n return { checked: true, indeterminate: false }\n }\n\n return { checked: false, indeterminate: true }\n },\n [value, treeCheckStrictly, fieldNames]\n )\n\n const renderNodes = useCallback(\n (nodes: TreeDataNode[], level: number): React.ReactNode => {\n return nodes.map((node) => {\n const key = getFieldValue(node, 'key', fieldNames) as string\n const { checked, indeterminate } = getCheckedState(node)\n\n return (\n <TreeSelectNode\n key={key}\n node={node}\n level={level}\n expanded={expandedKeys.includes(key)}\n selected={value.includes(key)}\n checked={checked}\n indeterminate={indeterminate}\n treeCheckable={treeCheckable}\n treeLine={treeLine}\n treeIcon={treeIcon}\n focused={focusedKey === key}\n loading={loadingKeys.has(key)}\n baseTestId={baseTestId}\n id={`${instanceId}-option-${key}`}\n fieldNames={fieldNames}\n switcherIcon={switcherIcon}\n onToggle={handleToggle}\n onSelect={handleSelect}\n onCheck={handleCheck}\n renderChildren={renderNodes}\n />\n )\n })\n },\n [\n expandedKeys,\n value,\n treeCheckable,\n treeLine,\n treeIcon,\n focusedKey,\n loadingKeys,\n baseTestId,\n instanceId,\n fieldNames,\n switcherIcon,\n handleToggle,\n handleSelect,\n handleCheck,\n getCheckedState,\n ]\n )\n\n // Display value with showCheckedStrategy\n const displayValue = useMemo(() => {\n if (value.length === 0) return null\n\n let displayKeys = value\n\n if ((treeCheckable || multiple) && showCheckedStrategy !== 'SHOW_ALL') {\n if (showCheckedStrategy === 'SHOW_PARENT') {\n // Only show parent nodes when all children are selected\n displayKeys = value.filter((key) => {\n const parentKeys = getParentKeys(treeData, key, fieldNames)\n if (!parentKeys) return true\n // Check if any parent is fully selected\n return !parentKeys.some((pk) => value.includes(pk))\n })\n } else if (showCheckedStrategy === 'SHOW_CHILD') {\n // Only show leaf nodes\n displayKeys = value.filter((key) => {\n const node = findNode(treeData, key, fieldNames)\n if (!node) return true\n const children = getFieldValue(node, 'children', fieldNames) as\n | TreeDataNode[]\n | undefined\n return !children || children.length === 0\n })\n }\n }\n\n if (multiple || treeCheckable) {\n let keysToShow = displayKeys\n let hiddenCount = 0\n\n if (maxTagCount !== undefined && maxTagCount !== 'responsive') {\n if (displayKeys.length > maxTagCount) {\n keysToShow = displayKeys.slice(0, maxTagCount)\n hiddenCount = displayKeys.length - maxTagCount\n }\n }\n\n const tags = keysToShow.map((key) => {\n const node = findNode(treeData, key, fieldNames)\n const title = node ? getFieldValue(node, 'title', fieldNames) : key\n const label = title as React.ReactNode\n const closable = !effectiveDisabled\n const onClose = () => {\n const fakeEvent = { stopPropagation: () => {} } as React.MouseEvent\n removeTag(key, fakeEvent)\n }\n\n // Use custom tagRender if provided\n if (tagRender) {\n return (\n <React.Fragment key={key}>\n {tagRender({ label, value: key, closable, onClose })}\n </React.Fragment>\n )\n }\n\n return (\n <span\n key={key}\n className=\"inline-flex items-center gap-1 px-2 py-0.5 bg-base-200 rounded text-sm mr-1 mb-1\"\n data-testid={`${baseTestId}-tag-${key}`}\n >\n {label}\n {closable && (\n <button\n type=\"button\"\n className=\"hover:text-error\"\n onClick={(e) => removeTag(key, e)}\n aria-label={`Remove ${typeof title === 'string' ? title : key}`}\n >\n <svg\n className=\"w-3 h-3\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M6 18L18 6M6 6l12 12\"\n />\n </svg>\n </button>\n )}\n </span>\n )\n })\n\n if (hiddenCount > 0) {\n const hiddenKeys = displayKeys.slice(maxTagCount as number)\n const placeholder =\n typeof maxTagPlaceholder === 'function'\n ? maxTagPlaceholder(hiddenKeys)\n : maxTagPlaceholder || `+${hiddenCount} more`\n\n tags.push(\n <span\n key=\"__more__\"\n className=\"inline-flex items-center px-2 py-0.5 bg-base-200 rounded text-sm mr-1 mb-1\"\n >\n {placeholder}\n </span>\n )\n }\n\n return tags\n }\n\n const node = findNode(treeData, value[0], fieldNames)\n const title = node ? getFieldValue(node, 'title', fieldNames) : value[0]\n return title as React.ReactNode\n }, [\n value,\n treeData,\n multiple,\n treeCheckable,\n showCheckedStrategy,\n maxTagCount,\n maxTagPlaceholder,\n baseTestId,\n fieldNames,\n effectiveDisabled,\n tagRender,\n ])\n\n const borderClass = status ? statusClasses[status] : color ? colorClasses[color] : ''\n const variantClass = ghost ? 'bg-transparent border-transparent' : variantClasses[variant]\n\n const dropdownContent = (\n <div className=\"py-1\" role=\"tree\" aria-label=\"Tree options\">\n {filteredData.length > 0 ? (\n renderNodes(filteredData, 0)\n ) : (\n <div\n className=\"px-4 py-2 text-base-content/50 text-sm text-center\"\n data-testid={`${baseTestId}-empty`}\n >\n {effectiveNotFoundContent}\n </div>\n )}\n </div>\n )\n\n return (\n <div\n ref={(node) => {\n containerRef.current = node\n if (typeof ref === 'function') {\n ref(node)\n } else if (ref) {\n ref.current = node\n }\n }}\n className={`relative ${className}`}\n data-testid={baseTestId}\n data-state={open ? 'open' : 'closed'}\n data-disabled={effectiveDisabled || undefined}\n onKeyDown={handleKeyDown}\n {...rest}\n >\n {/* Trigger */}\n <div\n ref={triggerRef}\n role=\"combobox\"\n aria-expanded={open}\n aria-haspopup=\"tree\"\n aria-owns={open ? listboxId : undefined}\n aria-activedescendant={open && focusedKey ? `${instanceId}-option-${focusedKey}` : undefined}\n aria-disabled={effectiveDisabled}\n tabIndex={effectiveDisabled ? -1 : 0}\n className={[\n dInput,\n 'flex items-center gap-2 cursor-pointer flex-wrap',\n sizeClasses[effectiveSize],\n variantClass,\n borderClass,\n effectiveDisabled && `${dInputDisabled} opacity-50 cursor-not-allowed`,\n open && !borderClass && 'border-primary',\n ]\n .filter(Boolean)\n .join(' ')}\n onClick={() => !effectiveDisabled && setOpen(!open)}\n data-testid={`${baseTestId}-trigger`}\n >\n <div className=\"flex-1 flex flex-wrap items-center gap-1 min-w-0\">\n {displayValue || <span className=\"text-base-content/50\">{placeholder}</span>}\n </div>\n\n {/* Clear button */}\n {allowClear && value.length > 0 && !effectiveDisabled && (\n <button\n type=\"button\"\n className=\"hover:text-error flex-shrink-0\"\n onClick={handleClear}\n aria-label=\"Clear selection\"\n data-testid={`${baseTestId}-clear`}\n >\n <svg\n className=\"w-4 h-4\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M6 18L18 6M6 6l12 12\"\n />\n </svg>\n </button>\n )}\n\n {/* Suffix icon / Dropdown arrow */}\n {suffixIcon || (\n <svg\n className={`w-4 h-4 flex-shrink-0 transition-transform ${open ? 'rotate-180' : ''}`}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n aria-hidden=\"true\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth={2}\n d=\"M19 9l-7 7-7-7\"\n />\n </svg>\n )}\n </div>\n\n {/* Dropdown */}\n {open && (\n <div\n id={listboxId}\n className={`absolute z-50 mt-1 w-full bg-base-100 border border-base-300 rounded-lg shadow-lg max-h-64 overflow-auto ${popupClassName}`}\n data-testid={`${baseTestId}-dropdown`}\n >\n {/* Search input */}\n {showSearch && (\n <div className=\"p-2 border-b border-base-300\">\n <input\n ref={inputRef}\n type=\"text\"\n className={`${dInput} ${dInputSm} w-full`}\n placeholder=\"Search...\"\n value={searchValue}\n onChange={handleSearchChange}\n onClick={(e) => e.stopPropagation()}\n aria-label=\"Search tree options\"\n data-testid={`${baseTestId}-search`}\n />\n </div>\n )}\n\n {/* Tree */}\n {dropdownRender ? dropdownRender(dropdownContent) : dropdownContent}\n </div>\n )}\n </div>\n )\n }\n)\n\nTreeSelect.displayName = 'TreeSelect'\n\n// Attach static strategy constants to TreeSelect\nexport const TreeSelectComponent = Object.assign(TreeSelect, {\n SHOW_ALL,\n SHOW_PARENT,\n SHOW_CHILD,\n})\n\nexport { TreeSelectComponent as default }\n"],"names":["dCheckbox","dCheckboxSm","dCheckboxPrimary","dLoading","dLoadingSpinner","dLoadingXs","dInput","dInputSm","dInputDisabled","SHOW_ALL","SHOW_PARENT","SHOW_CHILD","getFieldValue","node","field","fieldNames","labelField","valueField","childrenField","flattenTree","data","parentPath","result","title","children","currentPath","getAllKeys","keys","traverse","nodes","key","findNode","nodeKey","found","getDescendantKeys","n","child","childKey","getParentKeys","targetKey","parentKeys","TreeSelectNode","level","expanded","selected","checked","indeterminate","treeCheckable","treeLine","showTreeIcon","focused","loading","baseTestId","id","switcherIcon","onToggle","onSelect","onCheck","renderChildren","nodeIcon","hasChildren","isLeaf","handleToggle","e","handleSelect","handleCheck","handleKeyDown","renderSwitcherIcon","jsx","jsxs","el","sizeClasses","colorClasses","statusClasses","variantClasses","TreeSelect","forwardRef","treeData","controlledValue","defaultValue","onChange","multiple","treeCheckStrictly","showCheckedStrategy","showSearch","controlledSearchValue","onSearch","filterTreeNode","placeholder","allowClear","disabled","treeDefaultExpandAll","treeDefaultExpandedKeys","controlledExpandedKeys","onTreeExpand","size","color","status","variant","ghost","maxTagCount","maxTagPlaceholder","maxCount","labelInValue","tagRender","treeIcon","loadData","controlledOpen","onDropdownVisibleChange","suffixIcon","notFoundContent","dropdownRender","popupClassName","className","testId","rest","ref","componentSize","componentDisabled","renderEmpty","useConfig","effectiveSize","effectiveDisabled","effectiveNotFoundContent","instanceId","useId","listboxId","isOpen","setIsOpen","useState","internalSearchValue","setInternalSearchValue","focusedKey","setFocusedKey","loadingKeys","setLoadingKeys","containerRef","useRef","inputRef","triggerRef","searchValue","open","normalizeValue","val","v","initialValue","internalValue","setInternalValue","value","initialExpandedKeys","useMemo","internalExpandedKeys","setInternalExpandedKeys","expandedKeys","visibleNodes","setOpen","useCallback","newOpen","useEffect","handleClickOutside","filteredData","flatNodes","matchingKeys","isMatch","filterTree","hasMatchingChildren","prev","next","newKeys","k","triggerNode","newValue","labels","labeledValues","isChecked","descendantKeys","keysToAdd","dk","remainingSlots","handleClear","removeTag","handleSearchChange","currentIndex","nextIndex","prevIndex","getCheckedState","checkedDescendants","renderNodes","displayValue","displayKeys","pk","keysToShow","hiddenCount","tags","label","closable","onClose","React","hiddenKeys","borderClass","variantClass","dropdownContent","TreeSelectComponent"],"mappings":";;;AAaA,MAAMA,KAAY,YACZC,KAAc,eACdC,KAAmB,oBACnBC,KAAW,WACXC,KAAkB,mBAClBC,KAAa,cACbC,KAAS,SACTC,KAAW,YACXC,KAAiB,kBAiBjBC,KAAgC,YAChCC,KAAmC,eACnCC,KAAkC;AA4ExC,SAASC,EACPC,GACAC,GACAC,GACS;AACT,MAAID,MAAU,SAAS;AACrB,UAAME,IAAaD,GAAY,SAAS;AACxC,WAAQF,EAA4CG,CAAU;AAAA,EAChE;AACA,MAAIF,MAAU,OAAO;AACnB,UAAMG,IAAaF,GAAY,SAAS;AACxC,WAAQF,EAA4CI,CAAU;AAAA,EAChE;AACA,MAAIH,MAAU,YAAY;AACxB,UAAMI,IAAgBH,GAAY,YAAY;AAC9C,WAAQF,EAA4CK,CAAa;AAAA,EACnE;AAEF;AAGA,SAASC,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Me
45
45
  export { Countdown } from './components/Countdown';
46
46
  export type { CountdownProps } from './components/Countdown';
47
47
  export { DatePicker } from './components/DatePicker';
48
- export type { DatePickerProps } from './components/DatePicker';
48
+ export type { DatePickerProps, DateRangePickerProps, DateRangeValue } from './components/DatePicker';
49
49
  export { MonthCalendar } from './components/MonthCalendar';
50
50
  export type { MonthCalendarProps, CalendarEvent, CalendarLocale } from './components/MonthCalendar';
51
51
  export { WeekCalendar } from './components/WeekCalendar';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asterui",
3
- "version": "0.12.63",
3
+ "version": "0.12.64",
4
4
  "description": "React UI component library with DaisyUI",
5
5
  "homepage": "https://asterui.com",
6
6
  "repository": {