asterui 0.12.49 → 0.12.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Alert.js +18 -18
- package/dist/components/Alert.js.map +1 -1
- package/dist/components/Autocomplete.js +115 -114
- package/dist/components/Autocomplete.js.map +1 -1
- package/dist/components/Avatar.js +33 -32
- package/dist/components/Avatar.js.map +1 -1
- package/dist/components/Badge.js +99 -99
- package/dist/components/Badge.js.map +1 -1
- package/dist/components/Breadcrumb.js +12 -11
- package/dist/components/Breadcrumb.js.map +1 -1
- package/dist/components/Browser.js +10 -10
- package/dist/components/Browser.js.map +1 -1
- package/dist/components/Button.js +80 -79
- package/dist/components/Button.js.map +1 -1
- package/dist/components/Card.d.ts +2 -0
- package/dist/components/Card.js +111 -110
- package/dist/components/Card.js.map +1 -1
- package/dist/components/Carousel.js +59 -59
- package/dist/components/Carousel.js.map +1 -1
- package/dist/components/Cascader.js +175 -174
- package/dist/components/Cascader.js.map +1 -1
- package/dist/components/Chat.js +27 -27
- package/dist/components/Chat.js.map +1 -1
- package/dist/components/Checkbox.js +98 -97
- package/dist/components/Checkbox.js.map +1 -1
- package/dist/components/Code.js +11 -11
- package/dist/components/Code.js.map +1 -1
- package/dist/components/Collapse.js +46 -46
- package/dist/components/Collapse.js.map +1 -1
- package/dist/components/ColorPicker.d.ts +1 -1
- package/dist/components/ColorPicker.js +93 -91
- package/dist/components/ColorPicker.js.map +1 -1
- package/dist/components/Command.js +120 -120
- package/dist/components/Command.js.map +1 -1
- package/dist/components/ConfigProvider.d.ts +1 -1
- package/dist/components/ConfigProvider.js +9 -9
- package/dist/components/ConfigProvider.js.map +1 -1
- package/dist/components/ContextMenu.js +33 -33
- package/dist/components/ContextMenu.js.map +1 -1
- package/dist/components/CopyButton.js +74 -73
- package/dist/components/CopyButton.js.map +1 -1
- package/dist/components/Countdown.js +60 -59
- package/dist/components/Countdown.js.map +1 -1
- package/dist/components/DatePicker.d.ts +1 -1
- package/dist/components/DatePicker.js +54 -53
- package/dist/components/DatePicker.js.map +1 -1
- package/dist/components/Diff.js +10 -10
- package/dist/components/Diff.js.map +1 -1
- package/dist/components/Divider.js +21 -20
- package/dist/components/Divider.js.map +1 -1
- package/dist/components/Dock.js +28 -27
- package/dist/components/Dock.js.map +1 -1
- package/dist/components/Drawer.js +43 -43
- package/dist/components/Drawer.js.map +1 -1
- package/dist/components/Dropdown.js +127 -127
- package/dist/components/Dropdown.js.map +1 -1
- package/dist/components/Empty.js +16 -15
- package/dist/components/Empty.js.map +1 -1
- package/dist/components/Fieldset.js +11 -10
- package/dist/components/Fieldset.js.map +1 -1
- package/dist/components/FileInput.js +30 -29
- package/dist/components/FileInput.js.map +1 -1
- package/dist/components/Filter.d.ts +1 -1
- package/dist/components/Filter.js +32 -30
- package/dist/components/Filter.js.map +1 -1
- package/dist/components/FloatButton.js +83 -83
- package/dist/components/FloatButton.js.map +1 -1
- package/dist/components/Footer.js +14 -13
- package/dist/components/Footer.js.map +1 -1
- package/dist/components/Form.js +133 -132
- package/dist/components/Form.js.map +1 -1
- package/dist/components/Hero.js +12 -11
- package/dist/components/Hero.js.map +1 -1
- package/dist/components/HoverGallery.js +7 -7
- package/dist/components/HoverGallery.js.map +1 -1
- package/dist/components/Image.js +40 -40
- package/dist/components/Image.js.map +1 -1
- package/dist/components/Input.js +171 -169
- package/dist/components/Input.js.map +1 -1
- package/dist/components/InputNumber.js +84 -83
- package/dist/components/InputNumber.js.map +1 -1
- package/dist/components/Join.js +11 -10
- package/dist/components/Join.js.map +1 -1
- package/dist/components/Kbd.js +15 -15
- package/dist/components/Kbd.js.map +1 -1
- package/dist/components/List.d.ts +1 -1
- package/dist/components/List.js +75 -72
- package/dist/components/List.js.map +1 -1
- package/dist/components/Loading.d.ts +1 -1
- package/dist/components/Loading.js +31 -29
- package/dist/components/Loading.js.map +1 -1
- package/dist/components/Mask.js +31 -31
- package/dist/components/Mask.js.map +1 -1
- package/dist/components/Mention.js +61 -61
- package/dist/components/Mention.js.map +1 -1
- package/dist/components/Menu.js +84 -84
- package/dist/components/Menu.js.map +1 -1
- package/dist/components/Message.js +30 -29
- package/dist/components/Message.js.map +1 -1
- package/dist/components/Modal.js +117 -116
- package/dist/components/Modal.js.map +1 -1
- package/dist/components/MonthCalendar.d.ts +31 -0
- package/dist/components/MonthCalendar.js +205 -0
- package/dist/components/MonthCalendar.js.map +1 -0
- package/dist/components/Navbar.js +25 -25
- package/dist/components/Navbar.js.map +1 -1
- package/dist/components/Notification.js +56 -55
- package/dist/components/Notification.js.map +1 -1
- package/dist/components/OTPInput.js +69 -68
- package/dist/components/OTPInput.js.map +1 -1
- package/dist/components/Pagination.d.ts +1 -1
- package/dist/components/Pagination.js +60 -58
- package/dist/components/Pagination.js.map +1 -1
- package/dist/components/Phone.js +10 -10
- package/dist/components/Phone.js.map +1 -1
- package/dist/components/Popconfirm.js +60 -60
- package/dist/components/Popconfirm.js.map +1 -1
- package/dist/components/Progress.js +17 -17
- package/dist/components/Progress.js.map +1 -1
- package/dist/components/QRCode.js +23 -23
- package/dist/components/QRCode.js.map +1 -1
- package/dist/components/RadialProgress.js +17 -17
- package/dist/components/RadialProgress.js.map +1 -1
- package/dist/components/Radio.js +41 -40
- package/dist/components/Radio.js.map +1 -1
- package/dist/components/Range.d.ts +1 -1
- package/dist/components/Range.js +39 -37
- package/dist/components/Range.js.map +1 -1
- package/dist/components/Rating.js +79 -78
- package/dist/components/Rating.js.map +1 -1
- package/dist/components/ResponsiveDrawer.js +27 -27
- package/dist/components/ResponsiveDrawer.js.map +1 -1
- package/dist/components/RichTextEditor.d.ts +32 -0
- package/dist/components/RichTextEditor.js +335 -0
- package/dist/components/RichTextEditor.js.map +1 -0
- package/dist/components/Segmented.d.ts +1 -1
- package/dist/components/Segmented.js +48 -46
- package/dist/components/Segmented.js.map +1 -1
- package/dist/components/Select.js +55 -54
- package/dist/components/Select.js.map +1 -1
- package/dist/components/Skeleton.js +9 -9
- package/dist/components/Skeleton.js.map +1 -1
- package/dist/components/Splitter.js +1 -3
- package/dist/components/Splitter.js.map +1 -1
- package/dist/components/Stat.js +17 -16
- package/dist/components/Stat.js.map +1 -1
- package/dist/components/Status.js +29 -29
- package/dist/components/Status.js.map +1 -1
- package/dist/components/Steps.js +61 -61
- package/dist/components/Steps.js.map +1 -1
- package/dist/components/Table.js +256 -256
- package/dist/components/Table.js.map +1 -1
- package/dist/components/Tabs.js +65 -65
- package/dist/components/Tabs.js.map +1 -1
- package/dist/components/Tag.js +147 -147
- package/dist/components/Tag.js.map +1 -1
- package/dist/components/TextRotate.js +6 -6
- package/dist/components/TextRotate.js.map +1 -1
- package/dist/components/Textarea.js +35 -34
- package/dist/components/Textarea.js.map +1 -1
- package/dist/components/ThemeController.d.ts +1 -1
- package/dist/components/ThemeController.js +71 -68
- package/dist/components/ThemeController.js.map +1 -1
- package/dist/components/TimePicker.d.ts +1 -1
- package/dist/components/TimePicker.js +133 -129
- package/dist/components/TimePicker.js.map +1 -1
- package/dist/components/Timeline.js +79 -79
- package/dist/components/Timeline.js.map +1 -1
- package/dist/components/Toggle.js +33 -32
- package/dist/components/Toggle.js.map +1 -1
- package/dist/components/Tooltip.js +25 -25
- package/dist/components/Tooltip.js.map +1 -1
- package/dist/components/Tour.js +126 -126
- package/dist/components/Tour.js.map +1 -1
- package/dist/components/Transfer.js +93 -92
- package/dist/components/Transfer.js.map +1 -1
- package/dist/components/Tree.js +200 -200
- package/dist/components/Tree.js.map +1 -1
- package/dist/components/TreeSelect.js +255 -254
- package/dist/components/TreeSelect.js.map +1 -1
- package/dist/components/Typography.js +71 -70
- package/dist/components/Typography.js.map +1 -1
- package/dist/components/Upload.js +81 -81
- package/dist/components/Upload.js.map +1 -1
- package/dist/components/WeekCalendar.d.ts +35 -0
- package/dist/components/WeekCalendar.js +204 -0
- package/dist/components/WeekCalendar.js.map +1 -0
- package/dist/components/Window.js +7 -7
- package/dist/components/Window.js.map +1 -1
- package/dist/editor.d.ts +1 -0
- package/dist/editor.js +5 -0
- package/dist/editor.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +211 -207
- package/dist/index.js.map +1 -1
- package/package.json +30 -1
|
@@ -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'\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=\"loading loading-spinner loading-xs\" />\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=\"checkbox checkbox-sm checkbox-primary\"\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 = 'No results found',\n dropdownRender,\n popupClassName = '',\n className = '',\n 'data-testid': testId,\n ...rest\n },\n ref\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 (disabled) 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 = !disabled\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 disabled,\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 {notFoundContent}\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={disabled || 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={disabled}\n tabIndex={disabled ? -1 : 0}\n className={[\n 'input flex items-center gap-2 cursor-pointer flex-wrap',\n sizeClasses[size],\n variantClass,\n borderClass,\n disabled && 'input-disabled opacity-50 cursor-not-allowed',\n open && !borderClass && 'border-primary',\n ]\n .filter(Boolean)\n .join(' ')}\n onClick={() => !disabled && 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 && !disabled && (\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=\"input input-sm 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":["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","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":";;AA0BA,MAAMA,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,GACPC,GACAC,IAAgC,CAAA,GAChCN,GACwD;AACxD,QAAMO,IAAiE,CAAA;AAEvE,SAAAF,EAAK,QAAQ,CAACP,MAAS;AACrB,UAAMU,IAAQX,EAAcC,GAAM,SAASE,CAAU,GAC/CS,IAAWZ,EAAcC,GAAM,YAAYE,CAAU,GACrDU,IAAc,CAAC,GAAGJ,GAAYE,CAAK;AACzC,IAAAD,EAAO,KAAK,EAAE,MAAAT,GAAM,MAAMY,GAAa,GACnCD,KACFF,EAAO,KAAK,GAAGH,GAAYK,GAAUC,GAAaV,CAAU,CAAC;AAAA,EAEjE,CAAC,GAEMO;AACT;AAGA,SAASI,GAAWN,GAAsBL,GAA6C;AACrF,QAAMY,IAAiB,CAAA,GACjBC,IAAW,CAACC,MAA0B;AAC1C,IAAAA,EAAM,QAAQ,CAAChB,MAAS;AACtB,YAAMiB,IAAMlB,EAAcC,GAAM,OAAOE,CAAU,GAC3CS,IAAWZ,EAAcC,GAAM,YAAYE,CAAU;AAC3D,MAAAY,EAAK,KAAKG,CAAG,GACTN,OAAmBA,CAAQ;AAAA,IACjC,CAA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,cAAc;AAGlB,MAAMwH,KAAsB,OAAO,OAAOxH,IAAY;AAAA,EAC3D,UAAAlE;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AACF,CAAC;"}
|
|
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'\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 = 'No results found',\n dropdownRender,\n popupClassName = '',\n className = '',\n 'data-testid': testId,\n ...rest\n },\n ref\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 (disabled) 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 = !disabled\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 disabled,\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 {notFoundContent}\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={disabled || 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={disabled}\n tabIndex={disabled ? -1 : 0}\n className={[\n dInput,\n 'flex items-center gap-2 cursor-pointer flex-wrap',\n sizeClasses[size],\n variantClass,\n borderClass,\n disabled && `${dInputDisabled} opacity-50 cursor-not-allowed`,\n open && !borderClass && 'border-primary',\n ]\n .filter(Boolean)\n .join(' ')}\n onClick={() => !disabled && 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 && !disabled && (\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","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":";;AAYA,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,GACPC,GACAC,IAAgC,CAAA,GAChCN,GACwD;AACxD,QAAMO,IAAiE,CAAA;AAEvE,SAAAF,EAAK,QAAQ,CAACP,MAAS;AACrB,UAAMU,IAAQX,EAAcC,GAAM,SAASE,CAAU,GAC/CS,IAAWZ,EAAcC,GAAM,YAAYE,CAAU,GACrDU,IAAc,CAAC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kD;AAAA,cACJ,WAAW,4GAA4GP,EAAc;AAAA,cACrI,eAAa,GAAG5D,CAAU;AAAA,cAGzB,UAAA;AAAA,gBAAAgC,KACC,gBAAAhB,EAAC,OAAA,EAAI,WAAU,gCACb,UAAA,gBAAAA;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACC,KAAK+D;AAAA,oBACL,MAAK;AAAA,oBACL,WAAW,GAAG7H,EAAM,IAAIC,EAAQ;AAAA,oBAChC,aAAY;AAAA,oBACZ,OAAO8H;AAAA,oBACP,UAAUyC;AAAA,oBACV,SAAS,CAAC,MAAM,EAAE,gBAAA;AAAA,oBAClB,cAAW;AAAA,oBACX,eAAa,GAAG1H,CAAU;AAAA,kBAAA;AAAA,gBAAA,GAE9B;AAAA,gBAID2D,KAAiBA,GAAemF,EAAe,IAAIA;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACtD;AAAA,MAAA;AAAA,IAAA;AAAA,EAIR;AACF;AAEAvH,GAAW,cAAc;AAGlB,MAAMwH,KAAsB,OAAO,OAAOxH,IAAY;AAAA,EAC3D,UAAAlE;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AACF,CAAC;"}
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as t, jsxs as u, Fragment as C } from "react/jsx-runtime";
|
|
2
2
|
import { useState as g } from "react";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const v = "btn", N = "btn-ghost", w = "btn-xs", k = "link", B = "link-primary";
|
|
4
|
+
function f({ text: n }) {
|
|
5
|
+
const [e, c] = g(!1);
|
|
6
|
+
return /* @__PURE__ */ t(
|
|
6
7
|
"button",
|
|
7
8
|
{
|
|
8
9
|
onClick: async () => {
|
|
9
10
|
try {
|
|
10
|
-
await navigator.clipboard.writeText(
|
|
11
|
+
await navigator.clipboard.writeText(n), c(!0), setTimeout(() => c(!1), 2e3);
|
|
11
12
|
} catch (s) {
|
|
12
13
|
console.error("Failed to copy:", s);
|
|
13
14
|
}
|
|
14
15
|
},
|
|
15
|
-
className:
|
|
16
|
+
className: `${v} ${N} ${w} ml-2 opacity-0 group-hover:opacity-100 transition-opacity`,
|
|
16
17
|
title: "Copy to clipboard",
|
|
17
|
-
children:
|
|
18
|
+
children: e ? /* @__PURE__ */ t("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ t(
|
|
18
19
|
"path",
|
|
19
20
|
{
|
|
20
21
|
fillRule: "evenodd",
|
|
@@ -22,13 +23,13 @@ function f({ text: a }) {
|
|
|
22
23
|
clipRule: "evenodd"
|
|
23
24
|
}
|
|
24
25
|
) }) : /* @__PURE__ */ u("svg", { className: "w-4 h-4", fill: "currentColor", viewBox: "0 0 20 20", children: [
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
/* @__PURE__ */
|
|
26
|
+
/* @__PURE__ */ t("path", { d: "M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z" }),
|
|
27
|
+
/* @__PURE__ */ t("path", { d: "M6 3a2 2 0 00-2 2v11a2 2 0 002 2h8a2 2 0 002-2V5a2 2 0 00-2-2 3 3 0 01-3 3H9a3 3 0 01-3-3z" })
|
|
27
28
|
] })
|
|
28
29
|
}
|
|
29
30
|
);
|
|
30
31
|
}
|
|
31
|
-
function
|
|
32
|
+
function j({ children: n, size: e = "base", className: c = "", ...o }) {
|
|
32
33
|
const m = [
|
|
33
34
|
// Prose classes (only apply if @tailwindcss/typography is installed)
|
|
34
35
|
"prose dark:prose-invert max-w-none",
|
|
@@ -40,38 +41,38 @@ function v({ children: a, size: t = "base", className: r = "", ...l }) {
|
|
|
40
41
|
lg: "prose-lg text-lg",
|
|
41
42
|
xl: "prose-xl text-xl",
|
|
42
43
|
"2xl": "prose-2xl text-2xl"
|
|
43
|
-
}[
|
|
44
|
-
|
|
44
|
+
}[e],
|
|
45
|
+
c
|
|
45
46
|
].filter(Boolean).join(" ");
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
+
return /* @__PURE__ */ t("div", { className: m, ...o, children: n });
|
|
47
48
|
}
|
|
48
|
-
function
|
|
49
|
-
const
|
|
49
|
+
function $({ level: n = 1, children: e, copyable: c, ellipsis: o, className: s = "", id: m, ...r }) {
|
|
50
|
+
const l = typeof e == "string" ? e : "", i = m || (l ? l.toLowerCase().replace(/\s+/g, "-") : void 0), h = {
|
|
50
51
|
1: "text-4xl font-bold mb-4",
|
|
51
52
|
2: "text-3xl font-bold mb-3",
|
|
52
53
|
3: "text-2xl font-semibold mb-3",
|
|
53
54
|
4: "text-xl font-semibold mb-2",
|
|
54
55
|
5: "text-lg font-semibold mb-2"
|
|
55
|
-
}, p =
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
}, p = o ? "truncate" : "", d = `group ${h[n]} ${p} ${s}`.trim(), x = /* @__PURE__ */ u(C, { children: [
|
|
57
|
+
e,
|
|
58
|
+
c && /* @__PURE__ */ t(f, { text: l })
|
|
58
59
|
] });
|
|
59
|
-
switch (
|
|
60
|
+
switch (n) {
|
|
60
61
|
case 1:
|
|
61
|
-
return /* @__PURE__ */
|
|
62
|
+
return /* @__PURE__ */ t("h1", { id: i, className: d, ...r, children: x });
|
|
62
63
|
case 2:
|
|
63
|
-
return /* @__PURE__ */
|
|
64
|
+
return /* @__PURE__ */ t("h2", { id: i, className: d, ...r, children: x });
|
|
64
65
|
case 3:
|
|
65
|
-
return /* @__PURE__ */
|
|
66
|
+
return /* @__PURE__ */ t("h3", { id: i, className: d, ...r, children: x });
|
|
66
67
|
case 4:
|
|
67
|
-
return /* @__PURE__ */
|
|
68
|
+
return /* @__PURE__ */ t("h4", { id: i, className: d, ...r, children: x });
|
|
68
69
|
case 5:
|
|
69
|
-
return /* @__PURE__ */
|
|
70
|
+
return /* @__PURE__ */ t("h5", { id: i, className: d, ...r, children: x });
|
|
70
71
|
default:
|
|
71
|
-
return /* @__PURE__ */
|
|
72
|
+
return /* @__PURE__ */ t("h1", { id: i, className: d, ...r, children: x });
|
|
72
73
|
}
|
|
73
74
|
}
|
|
74
|
-
const
|
|
75
|
+
const M = {
|
|
75
76
|
1: "line-clamp-1",
|
|
76
77
|
2: "line-clamp-2",
|
|
77
78
|
3: "line-clamp-3",
|
|
@@ -79,70 +80,70 @@ const w = {
|
|
|
79
80
|
5: "line-clamp-5",
|
|
80
81
|
6: "line-clamp-6"
|
|
81
82
|
};
|
|
82
|
-
function
|
|
83
|
-
const [
|
|
83
|
+
function T({ children: n, ellipsis: e, copyable: c, size: o, align: s, className: m = "", ...r }) {
|
|
84
|
+
const [l, i] = g(!1), h = typeof n == "string" ? n : "", p = typeof e == "object", d = p && e.rows || 3, x = p ? e.expandable : !1, a = Math.min(Math.max(d, 1), 6), y = [
|
|
84
85
|
"group",
|
|
85
86
|
"mb-4",
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
e && !l ? M[a] : "",
|
|
88
|
+
o === "sm" && "text-sm",
|
|
89
|
+
o === "base" && "text-base",
|
|
90
|
+
o === "lg" && "text-lg",
|
|
91
|
+
o === "xl" && "text-xl",
|
|
92
|
+
o === "2xl" && "text-2xl",
|
|
92
93
|
s === "left" && "text-left",
|
|
93
94
|
s === "center" && "text-center",
|
|
94
95
|
s === "right" && "text-right",
|
|
95
96
|
m
|
|
96
97
|
].filter(Boolean).join(" ");
|
|
97
|
-
return /* @__PURE__ */ u("div", { ...
|
|
98
|
+
return /* @__PURE__ */ u("div", { ...r, children: [
|
|
98
99
|
/* @__PURE__ */ u("p", { className: y, children: [
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
n,
|
|
101
|
+
c && /* @__PURE__ */ t(f, { text: h })
|
|
101
102
|
] }),
|
|
102
|
-
|
|
103
|
+
x && e && /* @__PURE__ */ t(
|
|
103
104
|
"button",
|
|
104
105
|
{
|
|
105
106
|
onClick: () => {
|
|
106
|
-
i(!
|
|
107
|
+
i(!l), p && e.onExpand && e.onExpand();
|
|
107
108
|
},
|
|
108
109
|
className: "text-primary text-sm hover:underline",
|
|
109
|
-
children:
|
|
110
|
+
children: l ? "Show less" : "Show more"
|
|
110
111
|
}
|
|
111
112
|
)
|
|
112
113
|
] });
|
|
113
114
|
}
|
|
114
|
-
function
|
|
115
|
-
children:
|
|
116
|
-
code:
|
|
117
|
-
mark:
|
|
118
|
-
strong:
|
|
115
|
+
function L({
|
|
116
|
+
children: n,
|
|
117
|
+
code: e,
|
|
118
|
+
mark: c,
|
|
119
|
+
strong: o,
|
|
119
120
|
italic: s,
|
|
120
121
|
underline: m,
|
|
121
|
-
delete:
|
|
122
|
-
type:
|
|
122
|
+
delete: r,
|
|
123
|
+
type: l = "default",
|
|
123
124
|
copyable: i,
|
|
124
125
|
className: h = "",
|
|
125
126
|
...p
|
|
126
127
|
}) {
|
|
127
|
-
const
|
|
128
|
+
const d = typeof n == "string" ? n : "", x = {
|
|
128
129
|
default: "",
|
|
129
130
|
secondary: "text-base-content/70",
|
|
130
131
|
success: "text-success",
|
|
131
132
|
warning: "text-warning",
|
|
132
133
|
error: "text-error"
|
|
133
134
|
};
|
|
134
|
-
let
|
|
135
|
-
|
|
136
|
-
const b = `group inline ${
|
|
135
|
+
let a = n;
|
|
136
|
+
e && (a = /* @__PURE__ */ t("code", { className: "px-1.5 py-0.5 bg-base-200 rounded text-sm font-mono", children: a })), c && (a = /* @__PURE__ */ t("mark", { className: "bg-warning/30 px-1", children: a })), o && (a = /* @__PURE__ */ t("strong", { className: "font-bold", children: a })), s && (a = /* @__PURE__ */ t("em", { className: "italic", children: a })), m && (a = /* @__PURE__ */ t("u", { className: "underline", children: a })), r && (a = /* @__PURE__ */ t("del", { className: "line-through opacity-70", children: a }));
|
|
137
|
+
const b = `group inline ${x[l]} ${h}`.trim();
|
|
137
138
|
return /* @__PURE__ */ u("span", { className: b, ...p, children: [
|
|
138
|
-
|
|
139
|
-
i && /* @__PURE__ */
|
|
139
|
+
a,
|
|
140
|
+
i && /* @__PURE__ */ t(f, { text: d })
|
|
140
141
|
] });
|
|
141
142
|
}
|
|
142
|
-
function
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
function E({ href: n = "#", children: e, target: c, external: o, size: s, className: m = "", ...r }) {
|
|
144
|
+
const l = o || n && n.startsWith("http"), i = c || (l ? "_blank" : void 0), h = l ? "noopener noreferrer" : void 0, p = [
|
|
145
|
+
k,
|
|
146
|
+
B,
|
|
146
147
|
s === "sm" && "text-sm",
|
|
147
148
|
s === "base" && "text-base",
|
|
148
149
|
s === "lg" && "text-lg",
|
|
@@ -153,29 +154,29 @@ function B({ href: a = "#", children: t, target: r, external: l, size: s, classN
|
|
|
153
154
|
return /* @__PURE__ */ u(
|
|
154
155
|
"a",
|
|
155
156
|
{
|
|
156
|
-
href:
|
|
157
|
+
href: n,
|
|
157
158
|
target: i,
|
|
158
159
|
rel: h,
|
|
159
160
|
className: p,
|
|
160
|
-
...
|
|
161
|
+
...r,
|
|
161
162
|
children: [
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
/* @__PURE__ */
|
|
165
|
-
/* @__PURE__ */
|
|
163
|
+
e,
|
|
164
|
+
l && /* @__PURE__ */ u("svg", { className: "w-3 h-3 inline-block ml-1", fill: "currentColor", viewBox: "0 0 20 20", children: [
|
|
165
|
+
/* @__PURE__ */ t("path", { d: "M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z" }),
|
|
166
|
+
/* @__PURE__ */ t("path", { d: "M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z" })
|
|
166
167
|
] })
|
|
167
168
|
]
|
|
168
169
|
}
|
|
169
170
|
);
|
|
170
171
|
}
|
|
171
|
-
const
|
|
172
|
-
Title:
|
|
173
|
-
Paragraph:
|
|
174
|
-
Text:
|
|
175
|
-
Link:
|
|
172
|
+
const V = Object.assign(j, {
|
|
173
|
+
Title: $,
|
|
174
|
+
Paragraph: T,
|
|
175
|
+
Text: L,
|
|
176
|
+
Link: E
|
|
176
177
|
});
|
|
177
178
|
export {
|
|
178
|
-
|
|
179
|
-
|
|
179
|
+
V as Typography,
|
|
180
|
+
V as default
|
|
180
181
|
};
|
|
181
182
|
//# sourceMappingURL=Typography.js.map
|