@mortenbrudvik/waveui 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +339 -40
- package/dist/components/data-display/List.cjs +1 -1
- package/dist/components/data-display/List.cjs.map +1 -1
- package/dist/components/data-display/List.mjs +405 -219
- package/dist/components/data-display/List.mjs.map +1 -1
- package/dist/components/data-display/List.registry.cjs +1 -1
- package/dist/components/data-display/List.registry.cjs.map +1 -1
- package/dist/components/data-display/List.registry.mjs +12 -6
- package/dist/components/data-display/List.registry.mjs.map +1 -1
- package/dist/components/input/Combobox.cjs +1 -1
- package/dist/components/input/Combobox.cjs.map +1 -1
- package/dist/components/input/Combobox.mjs +163 -148
- package/dist/components/input/Combobox.mjs.map +1 -1
- package/dist/components/input/Dropdown.cjs +1 -1
- package/dist/components/input/Dropdown.cjs.map +1 -1
- package/dist/components/input/Dropdown.mjs +132 -117
- package/dist/components/input/Dropdown.mjs.map +1 -1
- package/dist/components/input/Label.cjs +1 -1
- package/dist/components/input/Label.cjs.map +1 -1
- package/dist/components/input/Label.mjs +1 -0
- package/dist/components/input/Label.mjs.map +1 -1
- package/dist/components/input/Listbox.cjs +1 -1
- package/dist/components/input/Listbox.cjs.map +1 -1
- package/dist/components/input/Listbox.mjs +90 -78
- package/dist/components/input/Listbox.mjs.map +1 -1
- package/dist/components/input/Option.cjs +1 -1
- package/dist/components/input/Option.cjs.map +1 -1
- package/dist/components/input/Option.data.cjs +2 -0
- package/dist/components/input/Option.data.cjs.map +1 -0
- package/dist/components/input/Option.data.mjs +114 -0
- package/dist/components/input/Option.data.mjs.map +1 -0
- package/dist/components/input/Option.mjs +21 -17
- package/dist/components/input/Option.mjs.map +1 -1
- package/dist/components/layout/FlatTree.cjs +2 -0
- package/dist/components/layout/FlatTree.cjs.map +1 -0
- package/dist/components/layout/FlatTree.context.cjs +2 -0
- package/dist/components/layout/FlatTree.context.cjs.map +1 -0
- package/dist/components/layout/FlatTree.context.mjs +20 -0
- package/dist/components/layout/FlatTree.context.mjs.map +1 -0
- package/dist/components/layout/FlatTree.item.cjs +2 -0
- package/dist/components/layout/FlatTree.item.cjs.map +1 -0
- package/dist/components/layout/FlatTree.item.mjs +90 -0
- package/dist/components/layout/FlatTree.item.mjs.map +1 -0
- package/dist/components/layout/FlatTree.mjs +276 -0
- package/dist/components/layout/FlatTree.mjs.map +1 -0
- package/dist/components/layout/Tree.core.cjs +1 -1
- package/dist/components/layout/Tree.core.cjs.map +1 -1
- package/dist/components/layout/Tree.core.mjs +166 -165
- package/dist/components/layout/Tree.core.mjs.map +1 -1
- package/dist/components/layout/Tree.selection.cjs +1 -1
- package/dist/components/layout/Tree.selection.cjs.map +1 -1
- package/dist/components/layout/Tree.selection.mjs +11 -57
- package/dist/components/layout/Tree.selection.mjs.map +1 -1
- package/dist/components/layout/useFlatTree.cjs +2 -0
- package/dist/components/layout/useFlatTree.cjs.map +1 -0
- package/dist/components/layout/useFlatTree.mjs +83 -0
- package/dist/components/layout/useFlatTree.mjs.map +1 -0
- package/dist/components/portal/Portal.cjs +1 -1
- package/dist/components/portal/Portal.cjs.map +1 -1
- package/dist/components/portal/Portal.mjs +12 -11
- package/dist/components/portal/Portal.mjs.map +1 -1
- package/dist/components/provider/WaveProvider.cjs +1 -1
- package/dist/components/provider/WaveProvider.cjs.map +1 -1
- package/dist/components/provider/WaveProvider.mjs +59 -35
- package/dist/components/provider/WaveProvider.mjs.map +1 -1
- package/dist/components/table/DataGrid.cjs +1 -1
- package/dist/components/table/DataGrid.cjs.map +1 -1
- package/dist/components/table/DataGrid.context.cjs +2 -0
- package/dist/components/table/DataGrid.context.cjs.map +1 -0
- package/dist/components/table/DataGrid.context.mjs +74 -0
- package/dist/components/table/DataGrid.context.mjs.map +1 -0
- package/dist/components/table/DataGrid.header.cjs +2 -0
- package/dist/components/table/DataGrid.header.cjs.map +1 -0
- package/dist/components/table/DataGrid.header.mjs +168 -0
- package/dist/components/table/DataGrid.header.mjs.map +1 -0
- package/dist/components/table/DataGrid.mjs +488 -591
- package/dist/components/table/DataGrid.mjs.map +1 -1
- package/dist/components/table/DataGrid.sizing.cjs +2 -0
- package/dist/components/table/DataGrid.sizing.cjs.map +1 -0
- package/dist/components/table/DataGrid.sizing.mjs +187 -0
- package/dist/components/table/DataGrid.sizing.mjs.map +1 -0
- package/dist/components/table/DataGrid.store.cjs +2 -0
- package/dist/components/table/DataGrid.store.cjs.map +1 -0
- package/dist/components/table/DataGrid.store.mjs +108 -0
- package/dist/components/table/DataGrid.store.mjs.map +1 -0
- package/dist/components/table/DataGrid.window.cjs +2 -0
- package/dist/components/table/DataGrid.window.cjs.map +1 -0
- package/dist/components/table/DataGrid.window.mjs +165 -0
- package/dist/components/table/DataGrid.window.mjs.map +1 -0
- package/dist/components/table/Table.cjs +1 -1
- package/dist/components/table/Table.cjs.map +1 -1
- package/dist/components/table/Table.mjs +74 -72
- package/dist/components/table/Table.mjs.map +1 -1
- package/dist/components/table/Table.resize.cjs +2 -0
- package/dist/components/table/Table.resize.cjs.map +1 -0
- package/dist/components/table/Table.resize.mjs +98 -0
- package/dist/components/table/Table.resize.mjs.map +1 -0
- package/dist/components/table/useGridNavigation.cjs +1 -1
- package/dist/components/table/useGridNavigation.cjs.map +1 -1
- package/dist/components/table/useGridNavigation.mjs +343 -140
- package/dist/components/table/useGridNavigation.mjs.map +1 -1
- package/dist/components/table/useTableColumnSizing.cjs +2 -0
- package/dist/components/table/useTableColumnSizing.cjs.map +1 -0
- package/dist/components/table/useTableColumnSizing.mjs +76 -0
- package/dist/components/table/useTableColumnSizing.mjs.map +1 -0
- package/dist/components/table/useTableFeatures.cjs +2 -0
- package/dist/components/table/useTableFeatures.cjs.map +1 -0
- package/dist/components/table/useTableFeatures.mjs +110 -0
- package/dist/components/table/useTableFeatures.mjs.map +1 -0
- package/dist/components/table/useTableSelection.cjs +2 -0
- package/dist/components/table/useTableSelection.cjs.map +1 -0
- package/dist/components/table/useTableSelection.mjs +39 -0
- package/dist/components/table/useTableSelection.mjs.map +1 -0
- package/dist/components/table/useTableSort.cjs +2 -0
- package/dist/components/table/useTableSort.cjs.map +1 -0
- package/dist/components/table/useTableSort.mjs +58 -0
- package/dist/components/table/useTableSort.mjs.map +1 -0
- package/dist/components/typography/Text.cjs +1 -1
- package/dist/components/typography/Text.cjs.map +1 -1
- package/dist/components/typography/Text.mjs +11 -7
- package/dist/components/typography/Text.mjs.map +1 -1
- package/dist/hooks/useActiveDescendant.cjs +1 -1
- package/dist/hooks/useActiveDescendant.cjs.map +1 -1
- package/dist/hooks/useActiveDescendant.mjs +33 -25
- package/dist/hooks/useActiveDescendant.mjs.map +1 -1
- package/dist/hooks/useListbox.cjs +1 -1
- package/dist/hooks/useListbox.cjs.map +1 -1
- package/dist/hooks/useListbox.mjs +140 -130
- package/dist/hooks/useListbox.mjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.cjs +1 -1
- package/dist/hooks/useRovingTabIndex.cjs.map +1 -1
- package/dist/hooks/useRovingTabIndex.mjs +1 -1
- package/dist/hooks/useRovingTabIndex.mjs.map +1 -1
- package/dist/hooks/useSelection.cjs +2 -0
- package/dist/hooks/useSelection.cjs.map +1 -0
- package/dist/hooks/useSelection.mjs +57 -0
- package/dist/hooks/useSelection.mjs.map +1 -0
- package/dist/hooks/useVirtualWindow.cjs +2 -0
- package/dist/hooks/useVirtualWindow.cjs.map +1 -0
- package/dist/hooks/useVirtualWindow.mjs +102 -0
- package/dist/hooks/useVirtualWindow.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1799 -63
- package/dist/index.d.ts +1799 -63
- package/dist/index.mjs +150 -136
- package/dist/lib/brand.cjs +2 -0
- package/dist/lib/brand.cjs.map +1 -0
- package/dist/lib/brand.mjs +358 -0
- package/dist/lib/brand.mjs.map +1 -0
- package/dist/lib/classNames.cjs +1 -1
- package/dist/lib/classNames.cjs.map +1 -1
- package/dist/lib/classNames.mjs +68 -49
- package/dist/lib/classNames.mjs.map +1 -1
- package/dist/lib/cn.cjs +1 -1
- package/dist/lib/cn.cjs.map +1 -1
- package/dist/lib/cn.mjs +5 -1
- package/dist/lib/cn.mjs.map +1 -1
- package/dist/lib/columnSizing.cjs +2 -0
- package/dist/lib/columnSizing.cjs.map +1 -0
- package/dist/lib/columnSizing.mjs +27 -0
- package/dist/lib/columnSizing.mjs.map +1 -0
- package/dist/lib/flatTree.cjs +2 -0
- package/dist/lib/flatTree.cjs.map +1 -0
- package/dist/lib/flatTree.mjs +118 -0
- package/dist/lib/flatTree.mjs.map +1 -0
- package/dist/lib/selection.cjs +2 -0
- package/dist/lib/selection.cjs.map +1 -0
- package/dist/lib/selection.mjs +28 -0
- package/dist/lib/selection.mjs.map +1 -0
- package/dist/lib/tokens.cjs +2 -0
- package/dist/lib/tokens.cjs.map +1 -0
- package/dist/lib/tokens.mjs +43 -0
- package/dist/lib/tokens.mjs.map +1 -0
- package/dist/lib/treeCascade.cjs +2 -0
- package/dist/lib/treeCascade.cjs.map +1 -0
- package/dist/lib/treeCascade.mjs +52 -0
- package/dist/lib/treeCascade.mjs.map +1 -0
- package/dist/lib/virtual.cjs +2 -0
- package/dist/lib/virtual.cjs.map +1 -0
- package/dist/lib/virtual.mjs +54 -0
- package/dist/lib/virtual.mjs.map +1 -0
- package/dist/lib/waveTokens.cjs +2 -0
- package/dist/lib/waveTokens.cjs.map +1 -0
- package/dist/lib/waveTokens.mjs +24 -0
- package/dist/lib/waveTokens.mjs.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +3 -1
- package/src/styles/tokens.css +210 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tree.core.cjs","names":["isHiddenInput","isHiddenByCss","React","useControllable","useEventCallback","toggleCheck","isDev","useRovingTabIndex","useMergedRefs","TreeContext","TreeParentContext","TreeCheckForcedContext","cn","treeClassNames","composeEventHandlers","TreeLabelContext","isOwnEvent","isEditableTarget","getArrowIntent","getDirection","treeItemClassNames","useTreeContext","useId","isElementOfType","slotRendersContent","renderSlot","useCollapsePresence","ChevronRightIcon","collectItems","computeCheckStates","forcedColors","SubtractIcon","CheckIcon","joinIds","TreeItemContext","materialiseSlotContent","require_runtime","require_cn","require_children","require_dev","require_slot","require_composeEventHandlers","require_classNames","require_useEventCallback","require_useControllable","require_useId","require_direction","require_focus","require_useRovingTabIndex","require_useMergedRefs","require_aria","require_styles","require_icons","require_events","require_useCollapsePresence","require_Tree_context","require_Tree_selection","react","react_jsx_runtime","EMPTY","ITEM_IN_LABEL_MESSAGE","warnDuplicateValue","value","SELECTED_WITH_MULTIPLE_MESSAGE","CHECKED_WITHOUT_MULTIPLE_MESSAGE","SINGLE_WITHOUT_SELECTED_MESSAGE","forestInTreeOrder","entries","entry","a","b","TREE_ITEM_SELECTOR","ACTION_ITEM_SELECTOR","ACTIONS_ON_ITEM_FOCUS","ASIDE_OFF_ON_ITEM_FOCUS","ACTIONS_VISIBILITY","ASIDE_OFF_WITH_ACTIONS","END_CELL_SHARED","focusFirstAction","toolbar","item","cssHidden","el","concealed","marker","TreeRoot","rest","initialExpanded","defaultExpandedItems","expandedList","setExpandedList","expandedItems","onExpandedItemsChange","next","expanded","toggle","prev","v","expand","added","values","activate","onItemSelect","initialChecked","defaultCheckedItems","pendingDetails","checkedList","setCheckedList","checkedItems","onCheckedItemsChange","checked","topLevel","registerTopLevel","toggleChecked","forest","previous","effectiveSelected","selectionMode","selected","hasCheckedProps","focusedItem","setFocusedItem","valueCounts","registerValue","counts","count","remaining","context","current","getTabIndex","focusValue","navigationMode","motion","mergedRef","ref","containerProps","handleKeyDown","event","syncTypeaheadText","handleKeyDownCapture","handleBlur","className","onKeyDown","onKeyDownCapture","onFocus","onBlur","tree","label","treeitem","personaName","text","isOwnKeyEvent","target","isOwnClick","TreeItemActions","treegrid","rovingRef","rovingKeyDown","rovingFocus","popupFocus","setPopupFocus","frame","handleToolbarFocus","handleToolbarBlur","popup","labelledBy","isPrev","onReturn","TreeItem","props","typeaheadText","ctx","parent","insideLabel","isExpanded","labelId","asideId","ancestorListed","itemRef","layoutIds","setLayoutIds","registerLayout","ids","itemContext","nameId","nestedItems","labelContent","firstChildValue","children","child","keyed","key","iconNode","icon","iconAfterNode","iconAfter","hasAside","aside","hasActions","actions","hasChildren","leaf","groupRef","isGroupMounted","collapseRef","collapsePresenceProps","collapseClassName","chevron","expandIcon","multiple","ownNode","checkState","selectionEntry","isTopLevel","isSelected","isCurrent","handleClick","onClick","siblings","intent","focusedAction","inOwnActions","handleFocus","handleActionsBlur","action","active","checkbox","radio","indicator","groupListed"],"sources":["../../../src/components/layout/Tree.core.tsx"],"sourcesContent":["import * as React from 'react';\nimport { joinIds } from '../../lib/aria';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { treeClassNames, treeItemClassNames } from '../../lib/classNames';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { isDev, warnOnce } from '../../lib/dev';\nimport { getArrowIntent, getDirection } from '../../lib/direction';\nimport { isEditableTarget, isOwnEvent } from '../../lib/events';\nimport { isHiddenInput } from '../../lib/focus';\nimport { CheckIcon, ChevronRightIcon, SubtractIcon } from '../../lib/icons';\nimport type { MotionSlot, SelectionMode } from '../../lib/types';\nimport { materialiseSlotContent, renderSlot, slotRendersContent, type Slot } from '../../lib/slot';\nimport { forcedColors } from '../../lib/styles';\nimport { useCollapsePresence } from '../../hooks/useCollapsePresence';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useEventCallback } from '../../hooks/useEventCallback';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { isHiddenByCss, useRovingTabIndex } from '../../hooks/useRovingTabIndex';\nimport {\n TreeCheckForcedContext,\n TreeContext,\n TreeItemContext,\n TreeLabelContext,\n TreeParentContext,\n useTreeContext,\n type PersonaLayoutIds,\n type TreeContextValue,\n type TreeItemContextValue,\n type TreeSelectionEntry,\n} from './Tree.context';\nimport {\n collectItems,\n computeCheckStates,\n toggleCheck,\n type CheckState,\n type TreeNode,\n} from './Tree.selection';\n\nconst EMPTY: readonly string[] = [];\n\nconst ITEM_IN_LABEL_MESSAGE =\n 'Tree.Item was rendered inside the label of another Tree.Item, so it is not part of that ' +\n \"item's child group: the parent cannot expand, its name includes the nested text, and a \" +\n 'treeitem sits inside a label (axe aria-required-parent). A Tree.Item finds its nested items ' +\n 'among its own children (written directly, in Fragments, or returned by a render function such ' +\n 'as `children.map(renderNode)`), but not inside a component that renders Tree.Item itself. ' +\n 'Build a data-driven tree with a render function instead of a recursive component.';\n\nfunction warnDuplicateValue(value: string): void {\n warnOnce(\n `Tree:duplicate:${value}`,\n `Tree: several items share the value \"${value}\". Item values must be unique within a Tree; ` +\n 'items with the same value share their expanded, selected and focus state.',\n );\n}\n\nconst SELECTED_WITH_MULTIPLE_MESSAGE =\n 'Tree: `selected` has no effect with selectionMode=\"multiple\"; use `checkedItems`, and ' +\n '`current` for the item the user is on.';\n\nconst CHECKED_WITHOUT_MULTIPLE_MESSAGE =\n 'Tree: `checkedItems` and `defaultCheckedItems` need selectionMode=\"multiple\"; without it the ' +\n 'tree draws no checkboxes and ignores them.';\n\nconst SINGLE_WITHOUT_SELECTED_MESSAGE =\n 'Tree: selectionMode=\"single\" draws a radio on every item for `selected`; pass `selected` ' +\n '(null while nothing is selected) and update it from `onItemSelect`.';\n\n/** The registered top-level subtrees in document order, which is the tree order of their items. */\nfunction forestInTreeOrder(\n entries: ReadonlySet<React.RefObject<TreeSelectionEntry | null>> | null,\n): TreeNode[] {\n if (!entries) return [];\n return Array.from(entries, (entry) => entry.current)\n .filter((entry): entry is TreeSelectionEntry => entry !== null)\n .sort((a, b) => {\n if (!a.element || !b.element || a.element === b.element) return 0;\n return a.element.compareDocumentPosition(b.element) & Node.DOCUMENT_POSITION_FOLLOWING\n ? -1\n : 1;\n })\n .map((entry) => entry.node);\n}\n\n/**\n * The tree's own items for the tab stop and the arrow keys: the treeitems. A row's actions are a\n * roving container of their own, which the default selector would count as one more item.\n */\nconst TREE_ITEM_SELECTOR = '[role=\"treeitem\"]';\n\n/** Every focusable control a row's actions can hold (Toolbar's rule). */\nconst ACTION_ITEM_SELECTOR = 'button, [href], input, select, textarea, [role=\"button\"], [tabindex]';\n\n/**\n * Shows a row's actions while focus is on its item (also after a click) or inside the item's own\n * row, never in its child group (a grandchild of the item: the group sits in its collapse\n * element), so Tab and the treegrid arrows reach them. The item's `:focus-within`, not its\n * `:focus`: while focus moves from the item into an action, Chromium has already ended the item's\n * `:focus` (but keeps `:focus-within` on it, the common ancestor) when it checks that the action\n * can take focus, and a hidden action refuses it.\n */\nconst ACTIONS_ON_ITEM_FOCUS =\n '[&:focus-within:not(:has(>*>[role=group]_:focus))>[data-tree-row]_[data-tree-actions]]:visible';\n\n/** Makes the aside invisible while its actions show for focus, where they take its place. */\nconst ASIDE_OFF_ON_ITEM_FOCUS =\n '[@media(hover:hover)]:not-forced-colors:[&:focus-within:not(:has(>*>[role=group]_:focus))>[data-tree-row]_[data-tree-aside]]:invisible';\n\n/**\n * The actions stay invisible until the row is hovered or the item or an action has focus, and\n * always show in forced colors and without hover (touch). An invisible action takes no focus.\n * They also show while a surface opened from an action is open (its trigger is expanded) and\n * while focus is in such a surface (`data-focus-in-popup`), so the surface's focus return, which\n * runs after its trigger already reports it closed, reaches the action.\n */\nconst ACTIONS_VISIBILITY =\n 'invisible group-hover/row:visible focus-within:visible forced-colors:visible [@media(hover:none)]:visible has-[[aria-expanded=true]]:visible data-[focus-in-popup]:visible';\n\n/** The aside gives way to the actions where the two share one place. */\nconst ASIDE_OFF_WITH_ACTIONS =\n 'not-forced-colors:group-hover/row:invisible [@media(hover:hover)]:not-forced-colors:group-focus-within/end:invisible [@media(hover:hover)]:not-forced-colors:group-has-[[aria-expanded=true]]/end:invisible [@media(hover:hover)]:not-forced-colors:group-has-[[data-focus-in-popup]]/end:invisible';\n\n/** Aside and actions share one cell, and sit side by side where the actions always show. */\nconst END_CELL_SHARED = '[&>*]:[grid-area:1/1] forced-colors:flex [@media(hover:none)]:flex';\n\n/**\n * Focuses the first action of an item's own row that takes focus, trying them in order and\n * skipping what the roving hook skips: natively disabled, marked `data-roving-disabled`,\n * `aria-disabled` unless focusable-disabled, hidden form inputs, anything inside a `hidden` or\n * `inert` element of the toolbar, and what CSS hides (the hook's own `isHiddenByCss`). `false` when\n * focus did not move into the row's actions.\n */\nfunction focusFirstAction(item: HTMLElement): boolean {\n const toolbar = item.querySelector<HTMLElement>(':scope > [data-tree-row] [data-tree-actions]');\n if (!toolbar) return false;\n const cssHidden = new Map<Element, boolean>();\n for (const el of Array.from(toolbar.querySelectorAll<HTMLElement>(ACTION_ITEM_SELECTOR))) {\n if (isHiddenInput(el) || el.matches(':disabled')) continue;\n const concealed = el.closest('[hidden], [inert]');\n if (concealed && toolbar.contains(concealed)) continue;\n const marker = el.getAttribute('data-roving-disabled');\n if (marker !== null && marker !== 'false') continue;\n if (\n el.getAttribute('aria-disabled') === 'true' &&\n !el.hasAttribute('data-disabled-focusable')\n ) {\n continue;\n }\n if (isHiddenByCss(el, toolbar, cssHidden)) continue;\n el.focus();\n if (el.ownerDocument.activeElement === el) return true;\n }\n return false;\n}\n\n/* ------------------------------------------------------------------ */\n/* Tree */\n/* ------------------------------------------------------------------ */\n\n/** The second argument of `onCheckedItemsChange`. */\nexport interface TreeCheckedItemsChangeDetails {\n /** The item that was toggled. */\n value: string;\n /** Its new state (a toggle never leaves it mixed). */\n checked: boolean;\n /** The DOM event of the toggle: a keyboard event for Space, a mouse event for a click. */\n event: Event;\n}\n\n/** Properties for the Tree component. */\nexport interface TreeProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Controlled list of expanded item values. */\n expandedItems?: readonly string[];\n /**\n * Item values that are expanded initially (uncontrolled).\n * @default []\n */\n defaultExpandedItems?: readonly string[];\n /** Called with the new list of expanded item values when an item expands or collapses. */\n onExpandedItemsChange?: (expandedItems: string[]) => void;\n /**\n * Called with an item's value every time it is activated (a click on its row, Enter, or Space\n * unless the tree has checkboxes), also when the same item is activated again.\n */\n onItemSelect?: (value: string) => void;\n /**\n * Value of the selected item. When set (also to `null`), every item carries `aria-selected`, and\n * the selected item is where keyboard focus enters the tree. It has no effect with\n * `selectionMode=\"multiple\"` (a development warning): items carry `aria-checked` instead. With\n * `selectionMode=\"single\"` every item carries `aria-selected` even while it is not set (a\n * development warning: the radios need it).\n */\n selected?: string | null;\n /** Value of the current item (for example the open page): it gets `aria-current=\"true\"`. */\n current?: string | null;\n /**\n * How items are selected. `'none'`: activation only (0.7; `selected` highlights one item).\n * `'single'`: a radio indicator on every item for `selected`/`onItemSelect`. `'multiple'`: a\n * checkbox on every item, bound to `checkedItems`; checking an item checks its descendants, and a\n * parent shows checked, mixed or unchecked from them. Fluent's `'multiselect'` is `'multiple'`.\n * @default 'none'\n */\n selectionMode?: 'none' | SelectionMode;\n /** Controlled checked items (`selectionMode=\"multiple\"`); see the cascade rule in the component docs. */\n checkedItems?: readonly string[];\n /**\n * Initially checked items (uncontrolled).\n * @default []\n */\n defaultCheckedItems?: readonly string[];\n /**\n * Called with every checked item (in tree order) when a check changes (Fluent's `onCheckedChange`).\n * WaveUI always passes `details`; it is typed optional until 1.0.\n */\n onCheckedItemsChange?: (checkedItems: string[], details?: TreeCheckedItemsChangeDetails) => void;\n /**\n * `'tree'`: Tab from a focused item enters its actions. `'treegrid'`: the \"next\" arrow\n * (ArrowRight, ArrowLeft in RTL) moves into an item's actions and \"previous\" returns; on an\n * expanded parent \"next\" no longer moves to the first child (ArrowDown does). The roles stay\n * `tree` and `treeitem` (Fluent's `navigationMode`).\n * @default 'tree'\n */\n navigationMode?: 'tree' | 'treegrid';\n /**\n * Replaces the collapse of every child group in the tree (Fluent's `Tree collapseMotion`), on\n * the element around each `role=\"group\"` element: by default the space a group takes opens\n * from nothing and closes back to it, with a fade, over the normal duration (200 ms) with the\n * max easy-ease curve, both ways. `null` turns it off (a group appears and disappears at once);\n * a class string or `{ className }` replaces it, written as `MotionSlot` describes. A\n * `WaveProvider` with `motion=\"none\"` turns the default off, and a value here still applies\n * under it. The expand chevron's turn is not part of it, and a nested `Tree` takes its own.\n * @default the collapse described above\n */\n motion?: MotionSlot | null;\n /** Ref to the `role=\"tree\"` element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nexport const TreeRoot = ({\n expandedItems,\n defaultExpandedItems,\n onExpandedItemsChange,\n onItemSelect,\n selected,\n current,\n selectionMode = 'none',\n navigationMode = 'tree',\n checkedItems,\n defaultCheckedItems,\n onCheckedItemsChange,\n motion,\n className,\n children,\n onKeyDown,\n onKeyDownCapture,\n onFocus,\n onBlur,\n ref,\n ...rest\n}: TreeProps) => {\n const [initialExpanded] = React.useState<readonly string[]>(() => defaultExpandedItems ?? EMPTY);\n const [expandedList, setExpandedList] = useControllable<readonly string[]>(\n expandedItems,\n initialExpanded,\n (next) => onExpandedItemsChange?.([...next]),\n );\n const expanded = React.useMemo(() => new Set(expandedList), [expandedList]);\n\n const toggle = React.useCallback(\n (value: string) => {\n setExpandedList((prev) =>\n prev.includes(value) ? prev.filter((v) => v !== value) : [...prev, value],\n );\n },\n [setExpandedList],\n );\n\n const expand = React.useCallback(\n (values: readonly string[]) => {\n setExpandedList((prev) => {\n const added = values.filter((v) => !prev.includes(v));\n return added.length > 0 ? [...prev, ...added] : prev;\n });\n },\n [setExpandedList],\n );\n\n const activate = useEventCallback((value: string) => {\n onItemSelect?.(value);\n });\n\n // Checked items (`selectionMode=\"multiple\"`). useControllable passes the value only, so a toggle\n // hands `details` to the change callback through a ref it writes and clears in the same event.\n const [initialChecked] = React.useState<readonly string[]>(() => defaultCheckedItems ?? EMPTY);\n const pendingDetails = React.useRef<TreeCheckedItemsChangeDetails | undefined>(undefined);\n const [checkedList, setCheckedList] = useControllable<readonly string[]>(\n checkedItems,\n initialChecked,\n (next) => onCheckedItemsChange?.([...next], pendingDetails.current),\n );\n const checked = React.useMemo(() => new Set(checkedList), [checkedList]);\n\n // The top-level items' subtrees (each item scans its own children), read when a check toggles:\n // they give the emitted list its tree order.\n const topLevel = React.useRef<Set<React.RefObject<TreeSelectionEntry | null>> | null>(null);\n const registerTopLevel = React.useCallback(\n (entry: React.RefObject<TreeSelectionEntry | null>) => {\n topLevel.current ??= new Set();\n const entries = topLevel.current;\n entries.add(entry);\n return () => {\n entries.delete(entry);\n };\n },\n [],\n );\n const toggleChecked = useEventCallback((value: string, event: Event) => {\n const forest = forestInTreeOrder(topLevel.current);\n setCheckedList((previous) => {\n const next = toggleCheck(forest, previous, value);\n pendingDetails.current = { value, checked: next.includes(value), event };\n return next;\n });\n pendingDetails.current = undefined;\n });\n\n // An item carries aria-checked or aria-selected, never both (APG); in single mode every item\n // carries aria-selected from the first render, so the radios and the state agree.\n const effectiveSelected =\n selectionMode === 'multiple'\n ? undefined\n : selectionMode === 'single'\n ? (selected ?? null)\n : selected;\n\n React.useEffect(() => {\n if (selectionMode === 'multiple' && selected !== undefined) {\n warnOnce('Tree:selected-with-multiple', SELECTED_WITH_MULTIPLE_MESSAGE);\n }\n }, [selectionMode, selected]);\n React.useEffect(() => {\n if (selectionMode === 'single' && selected === undefined) {\n warnOnce('Tree:single-without-selected', SINGLE_WITHOUT_SELECTED_MESSAGE);\n }\n }, [selectionMode, selected]);\n const hasCheckedProps = checkedItems !== undefined || defaultCheckedItems !== undefined;\n React.useEffect(() => {\n if (selectionMode !== 'multiple' && hasCheckedProps) {\n warnOnce('Tree:checked-without-multiple', CHECKED_WITHOUT_MULTIPLE_MESSAGE);\n }\n }, [selectionMode, hasCheckedProps]);\n\n // The item that has focus while focus is inside the tree: it holds the tab stop, so Shift+Tab\n // leaves the tree. Cleared when focus leaves; the next entry goes to `selected`, else the first.\n const [focusedItem, setFocusedItem] = React.useState<string | null>(null);\n\n // How many mounted items carry each value (written from the items' effects only).\n const valueCounts = React.useRef<Map<string, number> | null>(null);\n const registerValue = React.useCallback((value: string) => {\n if (!isDev) return () => {};\n valueCounts.current ??= new Map();\n const counts = valueCounts.current;\n const count = (counts.get(value) ?? 0) + 1;\n counts.set(value, count);\n if (count > 1) warnDuplicateValue(value);\n return () => {\n const remaining = (counts.get(value) ?? 1) - 1;\n if (remaining > 0) counts.set(value, remaining);\n else counts.delete(value);\n };\n }, []);\n\n const { containerProps, getTabIndex, focusValue } = useRovingTabIndex({\n activeValue: focusedItem ?? effectiveSelected ?? null,\n itemSelector: TREE_ITEM_SELECTOR,\n orientation: 'vertical',\n loop: false,\n typeahead: true,\n });\n\n const context = React.useMemo<TreeContextValue>(\n () => ({\n expanded,\n toggle,\n expand,\n activate,\n selected: effectiveSelected,\n current,\n getTabIndex,\n focusValue,\n onItemFocus: setFocusedItem,\n focusedItem,\n navigationMode,\n registerValue,\n selectionMode,\n checked,\n toggleChecked,\n registerTopLevel,\n motion,\n }),\n [\n expanded,\n toggle,\n expand,\n activate,\n effectiveSelected,\n current,\n getTabIndex,\n focusValue,\n focusedItem,\n navigationMode,\n registerValue,\n selectionMode,\n checked,\n toggleChecked,\n registerTopLevel,\n motion,\n ],\n );\n\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, containerProps.ref);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n // Typeahead reads `data-roving-text` at key time: fill it from each item's label first.\n if (event.key.length === 1) syncTypeaheadText(event.currentTarget);\n containerProps.onKeyDown(event);\n };\n\n // A Space that continues a search is typeahead too, taken before the item would activate on it.\n const handleKeyDownCapture = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === ' ') syncTypeaheadText(event.currentTarget);\n containerProps.onKeyDownCapture(event);\n };\n\n const handleBlur = (event: React.FocusEvent<HTMLDivElement>) => {\n const next = event.relatedTarget as Node | null;\n if (!next || !event.currentTarget.contains(next)) setFocusedItem(null);\n };\n\n return (\n <TreeContext.Provider value={context}>\n <TreeParentContext.Provider value={null}>\n <TreeCheckForcedContext.Provider value={false}>\n <div\n role=\"tree\"\n data-selection-mode={selectionMode}\n aria-multiselectable={selectionMode === 'multiple' ? true : undefined}\n className={cn(treeClassNames.root, 'text-body-1', className)}\n {...rest}\n data-roving-container=\"\"\n onKeyDown={composeEventHandlers(onKeyDown, handleKeyDown)}\n onKeyDownCapture={composeEventHandlers(onKeyDownCapture, handleKeyDownCapture)}\n onFocus={composeEventHandlers(onFocus, containerProps.onFocus, {\n checkDefaultPrevented: false,\n })}\n onBlur={composeEventHandlers(onBlur, handleBlur, { checkDefaultPrevented: false })}\n ref={mergedRef}\n >\n {/* A Tree has its own items, also when it renders inside a label (a portaled popup). */}\n <TreeLabelContext.Provider value={false}>{children}</TreeLabelContext.Provider>\n </div>\n </TreeCheckForcedContext.Provider>\n </TreeParentContext.Provider>\n </TreeContext.Provider>\n );\n};\nTreeRoot.displayName = 'Tree';\n\n/* ------------------------------------------------------------------ */\n/* Tree.Item */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the TreeItem sub-component. */\nexport interface TreeItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Unique value identifying this tree item. */\n value: string;\n /**\n * Icon displayed before the label. Rendered in a `<span>` hidden from assistive technology\n * (`aria-hidden`); pass a slot object (`{ className, children, … }`) to customise it. A falsy\n * icon (`''`, `0`) or a list of nothing renders no span.\n */\n icon?: Slot<'span'>;\n /** Icon after the label (decorative, `aria-hidden`; a falsy value renders nothing, as `icon`). */\n iconAfter?: Slot<'span'>;\n /**\n * Replaces the expand chevron (decorative). `null`/`undefined` keep the chevron; `false`, or\n * anything that renders nothing, hides it (`aria-expanded` still reports the state). Not rotated.\n */\n expandIcon?: Slot<'span'>;\n /**\n * Non-interactive content at the end of the row, such as a count or a badge. It describes the item\n * (`aria-describedby`); it hides while the actions show on hover or focus.\n */\n aside?: React.ReactNode;\n /**\n * Buttons at the end of the row (a toolbar named by the item's label). Shown while the row is\n * hovered or the item or its actions have focus, and always in forced colors and without hover\n * (touch). Tab reaches them from the focused item (`navigationMode=\"tree\"`), or the arrow keys do\n * (`\"treegrid\"`). Keys and clicks on them never activate or check the item.\n *\n * They also stay shown while a Menu, Popover or Dialog rendered inside them holds focus or its\n * trigger among them is expanded, so its focus return reaches the action. A dialog your app\n * renders elsewhere and opens from an action through state (a \"Delete…\" menu item that opens a\n * confirm Dialog) closes after the actions have hidden again (on devices with hover, outside\n * forced colors): a hidden action cannot take focus, so focus returns to the nearest element\n * that can, normally the item. Render such a Dialog inside `actions` (its `Dialog.Trigger`\n * there, or the controlled Dialog next to the Menu that opens it) to return focus to the action;\n * `finalFocusRef` cannot name it, since it is still hidden when the dialog closes.\n */\n actions?: React.ReactNode;\n /**\n * Renders the item as a leaf even when it has nested `Tree.Item`s: they are not rendered, and\n * the item has no `aria-expanded` and does not expand. An item is expandable only while it has\n * nested items, so `leaf={false}` does not make an item without them expandable. To load the\n * children on first expansion, give the item a placeholder child (a \"Loading…\" `Tree.Item`)\n * until they arrive.\n * @default false\n */\n leaf?: boolean;\n /** Ref to the `role=\"treeitem\"` element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * Sets the typeahead text (`data-roving-text`, read by the roving hook) of every rendered\n * treeitem to the text of its label (a persona layout's name when the label holds one), so neither\n * the icon nor the nested items take part. A consumer `data-roving-text` on a Tree.Item is kept on\n * its label and wins.\n */\nfunction syncTypeaheadText(tree: HTMLElement): void {\n tree.querySelectorAll<HTMLElement>('[role=\"treeitem\"]').forEach((treeitem) => {\n const label = treeitem.querySelector<HTMLElement>(\n ':scope > [data-tree-row] > [data-tree-label]',\n );\n if (!label) return;\n // A persona layout's name is the item's name, so it is its typeahead text too (not the media,\n // such as an avatar's initials, or the description).\n const personaName = label.querySelector<HTMLElement>('[data-tree-persona-name]');\n const text =\n label.getAttribute('data-roving-text') ?? personaName?.textContent ?? label.textContent ?? '';\n if (treeitem.getAttribute('data-roving-text') !== text) {\n treeitem.setAttribute('data-roving-text', text);\n }\n });\n}\n\n/**\n * Whether a keyboard event belongs to this treeitem: its target (the focused element) is this\n * treeitem or inside its row, not a nested item and not the row's actions (their keys are theirs).\n */\nfunction isOwnKeyEvent(event: React.KeyboardEvent<HTMLElement>): boolean {\n const target = event.target as Element | null;\n if (target?.closest?.('[data-tree-actions]')) return false;\n return target?.closest?.('[role=\"treeitem\"]') === event.currentTarget;\n}\n\n/**\n * Whether a click landed on this treeitem's own row (or on the treeitem element itself). Clicks\n * in its child group, including the indentation gutter beside the nested rows, clicks on nested\n * items, on its checkbox and on its actions are not its own.\n *\n * While the child group exits, its collapse element is `inert`, which hit-tests like an element\n * the pointer passes through: a pointer click in the group's box lands on the treeitem element\n * itself, and is not its own either (it would expand the item again and activate it). A click\n * without a pointer (`detail` 0: Enter on a focused item, a screen reader's click) still is.\n */\nfunction isOwnClick(event: React.MouseEvent<HTMLElement>): boolean {\n const target = event.target as Element | null;\n if (target === event.currentTarget) {\n return event.detail === 0 || !event.currentTarget.querySelector(':scope > [inert]');\n }\n if (target?.closest?.('[data-tree-checkbox], [data-tree-actions]')) return false;\n return target?.closest?.('[data-tree-row]')?.parentElement === event.currentTarget;\n}\n\ninterface TreeItemActionsProps {\n /** Id of the element that names the item. */\n labelledBy: string;\n /**\n * `'last-focused'` while the actions hold a Tab stop (their item has focus, tree mode), else\n * `'none'`.\n */\n tabStop: 'last-focused' | 'none';\n /** `'treegrid'`: the arrows do not wrap, and \"previous\" on the first action returns to the item. */\n navigationMode: 'tree' | 'treegrid';\n /** Moves focus back to the item. */\n onReturn: () => void;\n children: React.ReactNode;\n}\n\n/**\n * A row's actions: the consumer's controls rove with the arrow keys and hold at most one Tab\n * stop. A key pressed on an action is the action's: ArrowDown and ArrowUp on an action that opens\n * a popup (`aria-haspopup`) never move focus to another item. In treegrid navigation, \"previous\"\n * on the first action returns to the item.\n */\nconst TreeItemActions = ({\n labelledBy,\n tabStop,\n navigationMode,\n onReturn,\n children,\n}: TreeItemActionsProps) => {\n const treegrid = navigationMode === 'treegrid';\n const {\n containerProps: { ref: rovingRef },\n handleKeyDown: rovingKeyDown,\n handleFocus: rovingFocus,\n } = useRovingTabIndex({\n itemSelector: ACTION_ITEM_SELECTOR,\n manageTabIndex: true,\n orientation: 'horizontal',\n loop: !treegrid,\n tabStop,\n });\n\n // Focus in a surface opened from an action (a Menu, Popover or Dialog rendered in a portal, whose\n // focus events reach the toolbar through the React tree): `'inside'`. Once focus leaves such a\n // surface for anywhere but the toolbar, `'leaving'` until the next frame, because the surface's\n // focus return comes later in that close (its layout phase, or a microtask).\n const [popupFocus, setPopupFocus] = React.useState<'inside' | 'leaving' | null>(null);\n React.useEffect(() => {\n if (popupFocus !== 'leaving') return;\n const frame = requestAnimationFrame(() => setPopupFocus(null));\n return () => cancelAnimationFrame(frame);\n }, [popupFocus]);\n\n const handleToolbarFocus = (event: React.FocusEvent<HTMLSpanElement>) => {\n rovingFocus(event);\n setPopupFocus(event.currentTarget.contains(event.target) ? null : 'inside');\n };\n\n const handleToolbarBlur = (event: React.FocusEvent<HTMLSpanElement>) => {\n // An action's own blur: its focus-within reveal decides.\n if (event.currentTarget.contains(event.target)) return;\n const next = event.relatedTarget;\n // Back to an action: its focus clears the hold.\n if (next instanceof Node && event.currentTarget.contains(next)) return;\n setPopupFocus('leaving');\n };\n\n /** Whether the key is treegrid's \"previous\" for an action (the roving order settles it). */\n const handleKeyDown = (event: React.KeyboardEvent<HTMLSpanElement>): boolean => {\n // A key from a popup an action opened reaches here through the React tree: not ours.\n if (event.defaultPrevented || !isOwnEvent(event)) return false;\n const target = event.target as HTMLElement;\n const popup = target.getAttribute('aria-haspopup');\n if (\n (event.key === 'ArrowDown' || event.key === 'ArrowUp') &&\n popup !== null &&\n popup !== 'false'\n ) {\n event.preventDefault();\n return false;\n }\n if (!treegrid || event.altKey || event.ctrlKey || event.metaKey || isEditableTarget(target)) {\n return false;\n }\n const intent = getArrowIntent(event.key, {\n orientation: 'horizontal',\n dir: getDirection(event.currentTarget),\n });\n return intent === 'prev';\n };\n\n const handleToolbarKeyDown = (event: React.KeyboardEvent<HTMLSpanElement>) => {\n const isPrev = handleKeyDown(event);\n if (event.defaultPrevented) return;\n rovingKeyDown(event);\n // \"Previous\" that the roving order did not take (the first action it reaches) returns.\n if (isPrev && event.target === document.activeElement) {\n event.preventDefault();\n onReturn();\n }\n };\n\n return (\n <span\n role=\"toolbar\"\n aria-labelledby={labelledBy}\n aria-orientation=\"horizontal\"\n data-tree-actions=\"\"\n data-roving-container=\"\"\n ref={rovingRef}\n data-focus-in-popup={popupFocus === null ? undefined : ''}\n onKeyDown={handleToolbarKeyDown}\n onFocus={handleToolbarFocus}\n onBlur={handleToolbarBlur}\n className={cn(\n treeItemClassNames.actions,\n 'inline-flex items-center gap-1',\n ACTIONS_VISIBILITY,\n )}\n >\n {children}\n </span>\n );\n};\nTreeItemActions.displayName = 'TreeItemActions';\n\n/**\n * One node of a Tree. Text and other content are the label; nested `Tree.Item` children form its\n * child group, which is shown while the item is expanded.\n *\n * The child group renders as the only child of a collapse element (its stable class\n * `wave-tree-item__collapse`), which opens and closes the group's space (the Tree's `motion`) and\n * has no box of its own while the item is expanded, so the group lays out in the item as before.\n * An item expanded by default appears without motion. After a collapse the group stays in the\n * document until the collapse ends, `inert` (its items leave the arrow keys and typeahead at once)\n * while the item already reports itself collapsed; expanding the item again during the collapse\n * keeps the same group. Focus inside the group when the item collapses moves to the item. A\n * pointer click that falls through the exiting group onto the item (an `inert` element lets the\n * pointer through) is not the item's: it neither expands nor activates it.\n *\n * Nested items must be `Tree.Item` elements among the item's own children: written directly, in\n * Fragments, or returned by a render function (`{node.children.map(renderNode)}`). A component\n * that renders `Tree.Item` itself (a recursive `<NodeView node={child} />`) is not recognised:\n * its output becomes part of the label, so the parent cannot expand (a development warning names\n * this). Render data-driven trees with a render function instead. The checks of a\n * `selectionMode=\"multiple\"` tree cascade by the same rule, so an item that such a component\n * renders is not checked with its parent.\n *\n * `ref` and every other prop land on the `role=\"treeitem\"` element, which contains the label row\n * and the child group (in its collapse element). Its `onClick` receives only clicks on its own\n * row (not on its child group or nested items) and its `onKeyDown` only keys pressed while focus\n * is on it or in its row; both run before the built-in behaviour (call `event.preventDefault()`\n * to skip it). In a checkbox tree, a click on the item's checkbox toggles its check and is not\n * passed to `onClick`, and neither is a click on its actions; `onKeyDown` receives no keys pressed\n * in the actions. Its other event handlers (`onFocus`, `onDoubleClick`, `onContextMenu` and the\n * rest) are not filtered: as DOM events bubble, they also receive events from its child group and\n * nested items (compare `event.target` with `event.currentTarget` to tell them apart).\n *\n * `actions` render in a toolbar at the end of the row, named by the item; keys and clicks on them\n * belong to them and never activate or check the item. `aside` sits before them and describes the\n * item.\n *\n * The item is named by its label (`aria-labelledby`), not by its icon or nested items; an\n * `aria-label` or `aria-labelledby` prop replaces that name. Typeahead matches the label text too\n * (a `data-roving-text` prop replaces it).\n */\nexport const TreeItem = ({\n value,\n icon,\n iconAfter,\n expandIcon,\n aside,\n actions,\n leaf = false,\n className,\n children,\n onClick,\n onKeyDown,\n onFocus,\n onBlur,\n ref,\n ...props\n}: TreeItemProps) => {\n const { 'data-roving-text': typeaheadText, ...rest } = props as typeof props & {\n 'data-roving-text'?: string;\n };\n const ctx = useTreeContext('Tree.Item');\n const parent = React.useContext(TreeParentContext);\n const insideLabel = React.useContext(TreeLabelContext);\n const isExpanded = ctx.expanded.has(value);\n const labelId = useId('tree-item-label');\n const asideId = useId('tree-item-aside');\n const ancestorListed = React.useContext(TreeCheckForcedContext);\n const itemRef = React.useRef<HTMLDivElement>(null);\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, itemRef);\n // A Tree.ItemPersonaLayout in the label registers its name and description: the item is named\n // by the name only and described by the description.\n const [layoutIds, setLayoutIds] = React.useState<PersonaLayoutIds | null>(null);\n const registerLayout = React.useCallback((ids: PersonaLayoutIds) => {\n setLayoutIds(ids);\n return () => setLayoutIds((current) => (current === ids ? null : current));\n }, []);\n const itemContext = React.useMemo<TreeItemContextValue>(\n () => ({ registerLayout }),\n [registerLayout],\n );\n const nameId = layoutIds?.nameId ?? labelId;\n\n const { registerValue, registerTopLevel } = ctx;\n React.useEffect(() => registerValue(value), [registerValue, value]);\n React.useEffect(() => {\n if (insideLabel) warnOnce('Tree.Item:inside-label', ITEM_IN_LABEL_MESSAGE);\n }, [insideLabel]);\n\n // Nested Tree.Items (and, as in 0.4, nested Trees) form the child group; the rest is the label.\n // Parts are identified through their element type, so parts written in a Server Component\n // (lazy references) count too.\n const nestedItems: React.ReactNode[] = [];\n const labelContent: React.ReactNode[] = [];\n let firstChildValue: string | undefined;\n flattenChildren(children).forEach(({ key, node: child }) => {\n const keyed = <React.Fragment key={key}>{child}</React.Fragment>;\n if (isElementOfType<TreeItemProps>(child, TreeItem)) {\n firstChildValue ??= child.props.value;\n nestedItems.push(keyed);\n } else if (isElementOfType(child, TreeRoot)) {\n nestedItems.push(keyed);\n } else {\n labelContent.push(keyed);\n }\n });\n\n // A falsy icon (`icon={name && <Icon />}` with `name` '' or a count of 0) is no icon, as in 0.4\n // and as in Avatar, and so is a collection whose items render nothing: no empty span adds a gap\n // to the row. The check does not consume a generator: renderSlot still renders its items.\n const iconNode =\n icon && slotRendersContent(icon)\n ? renderSlot(icon, 'span', cn(treeItemClassNames.icon, 'inline-flex shrink-0'), {\n 'aria-hidden': true,\n })\n : null;\n const iconAfterNode =\n iconAfter && slotRendersContent(iconAfter)\n ? renderSlot(iconAfter, 'span', cn(treeItemClassNames.iconAfter, 'inline-flex shrink-0'), {\n 'aria-hidden': true,\n })\n : null;\n // No empty aside and no empty toolbar (`actions={cond && <Button />}` with `cond` false).\n const hasAside = slotRendersContent(aside);\n const hasActions = slotRendersContent(actions);\n const hasChildren = nestedItems.length > 0 && !leaf;\n\n // The child group renders in a collapse element (the presence element) while the item is\n // expanded and, after a collapse, until that element's motion ends; focus inside the group when\n // the item collapses moves to this item, which the roving hook then treats as the focused item.\n const groupRef = React.useRef<HTMLDivElement | null>(null);\n const {\n isMounted: isGroupMounted,\n wrapperRef: collapseRef,\n presenceProps: collapsePresenceProps,\n className: collapseClassName,\n } = useCollapsePresence(hasChildren && isExpanded, {\n motion: ctx.motion,\n partRef: groupRef,\n getTrigger: () => itemRef.current,\n });\n\n // The optional-indicator slot rule (C-SLOTS): `null`/`undefined` keep the chevron, `false` or\n // content that renders nothing hides it (the spacer keeps the column), and a custom glyph is\n // rendered as given, not rotated.\n let chevron: React.ReactNode = <span className=\"w-3 shrink-0\" aria-hidden=\"true\" />;\n if (hasChildren && (expandIcon === undefined || expandIcon === null)) {\n chevron = (\n <ChevronRightIcon\n className={cn(\n treeItemClassNames.expandIcon,\n 'shrink-0 transition-transform motion-reduce:transition-none',\n isExpanded ? 'rotate-90' : 'wave-rtl:-scale-x-100',\n )}\n />\n );\n } else if (hasChildren && slotRendersContent(expandIcon)) {\n chevron = renderSlot(\n expandIcon,\n 'span',\n cn(treeItemClassNames.expandIcon, 'inline-flex shrink-0'),\n { 'aria-hidden': true },\n );\n }\n\n // Checkbox tree: the item computes its state from its own subtree (the child-group rule) and\n // the checked list, so every state renders on the server and needs no other item. A top-level\n // item also hands its subtree to the root, which orders a toggle's list by it.\n const multiple = ctx.selectionMode === 'multiple';\n const ownNode = React.useMemo<TreeNode | null>(\n () =>\n multiple\n ? {\n value,\n children: leaf ? [] : collectItems(children, { item: TreeItem, tree: TreeRoot }),\n }\n : null,\n [multiple, value, leaf, children],\n );\n const checkState: CheckState | undefined = ownNode\n ? computeCheckStates([ownNode], ctx.checked, ancestorListed).get(value)\n : undefined;\n const selectionEntry = React.useRef<TreeSelectionEntry | null>(null);\n React.useLayoutEffect(() => {\n selectionEntry.current = ownNode ? { node: ownNode, element: itemRef.current } : null;\n });\n const isTopLevel = parent === null && !insideLabel;\n React.useLayoutEffect(\n () => (multiple && isTopLevel ? registerTopLevel(selectionEntry) : undefined),\n [multiple, isTopLevel, registerTopLevel],\n );\n const isSelected = ctx.selected !== undefined ? ctx.selected === value : undefined;\n const isCurrent = ctx.current !== undefined && ctx.current !== null && ctx.current === value;\n\n const activate = () => {\n if (hasChildren) ctx.toggle(value);\n ctx.activate(value);\n };\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n if (!isOwnClick(event)) return;\n onClick?.(event);\n if (!event.defaultPrevented) activate();\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (!isOwnKeyEvent(event)) return;\n onKeyDown?.(event);\n if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return;\n\n switch (event.key) {\n case 'Enter':\n event.preventDefault();\n activate();\n return;\n case ' ':\n event.preventDefault();\n // A checkbox tree toggles the focused item's check (APG); the other modes activate.\n if (checkState !== undefined) ctx.toggleChecked(value, event.nativeEvent);\n else activate();\n return;\n case '*': {\n event.preventDefault();\n const siblings = event.currentTarget.parentElement?.querySelectorAll<HTMLElement>(\n ':scope > [role=\"treeitem\"][aria-expanded=\"false\"][data-roving-value]',\n );\n ctx.expand(\n Array.from(siblings ?? [], (el) => el.getAttribute('data-roving-value') ?? '').filter(\n Boolean,\n ),\n );\n return;\n }\n default:\n }\n\n const intent = getArrowIntent(event.key, {\n orientation: 'horizontal',\n dir: getDirection(event.currentTarget),\n });\n if (intent === 'next') {\n event.preventDefault();\n if (hasChildren && !isExpanded) {\n ctx.toggle(value);\n return;\n }\n // Treegrid navigation moves into the row's actions, also from an open parent (Down reaches\n // its first child), where APG's tree moves to the first child.\n if (ctx.navigationMode === 'treegrid' && focusFirstAction(event.currentTarget)) return;\n if (hasChildren && firstChildValue !== undefined) ctx.focusValue(firstChildValue);\n } else if (intent === 'prev') {\n event.preventDefault();\n if (hasChildren && isExpanded) ctx.toggle(value);\n else if (parent !== null) ctx.focusValue(parent);\n }\n };\n\n // Focus in the actions: tracked from the events, because a removed element fires no reliable\n // blur. A blur that leaves for another element, or from an element still in the document, ends it.\n const focusedAction = React.useRef<Element | null>(null);\n const inOwnActions = (event: React.FocusEvent<HTMLElement>) =>\n (event.target as Element).closest('[data-tree-actions]')?.closest('[role=\"treeitem\"]') ===\n event.currentTarget;\n // Focus on the item, or on one of its own actions (a click), makes it the active item.\n const handleFocus = (event: React.FocusEvent<HTMLDivElement>) => {\n if (event.target === event.currentTarget || inOwnActions(event)) ctx.onItemFocus(value);\n if (inOwnActions(event)) focusedAction.current = event.target as Element;\n };\n\n const handleActionsBlur = (event: React.FocusEvent<HTMLDivElement>) => {\n if (inOwnActions(event) && (event.relatedTarget !== null || event.target.isConnected)) {\n focusedAction.current = null;\n }\n };\n // An action that had focus is gone (no longer in the document) and focus fell to the page: it\n // goes to the item instead. Focus anywhere else ends the record at the next render.\n React.useLayoutEffect(() => {\n const action = focusedAction.current;\n if (!action) return;\n const item = itemRef.current;\n const active = item?.ownerDocument.activeElement;\n if (active && active !== item.ownerDocument.body) {\n focusedAction.current = null;\n } else if (item && !action.isConnected) {\n focusedAction.current = null;\n item.focus({ preventScroll: true });\n }\n });\n\n // The checkbox never takes focus (APG: focus stays on tree items): a press on it focuses its\n // item instead, and its click toggles the check without activating the item.\n const keepFocusOnItem = (event: React.MouseEvent<HTMLSpanElement>) => {\n event.preventDefault();\n itemRef.current?.focus({ preventScroll: true });\n };\n const handleCheckboxClick = (event: React.MouseEvent<HTMLSpanElement>) => {\n ctx.toggleChecked(value, event.nativeEvent);\n };\n\n const checkbox =\n checkState === undefined ? null : (\n <span\n role=\"checkbox\"\n aria-checked={checkState === 'mixed' ? 'mixed' : checkState === 'checked'}\n aria-labelledby={nameId}\n tabIndex={-1}\n data-tree-checkbox=\"\"\n onMouseDown={keepFocusOnItem}\n onClick={handleCheckboxClick}\n className={cn(\n treeItemClassNames.indicator,\n // Checkbox's box: 16px inside a 24px target (the pseudo-element), WCAG 2.5.8.\n 'relative inline-flex size-4 shrink-0 items-center justify-center rounded-xs border transition-colors motion-reduce:transition-none',\n 'before:absolute before:-inset-1',\n checkState === 'unchecked'\n ? cn('border-stroke-accessible bg-transparent', forcedColors.control)\n : 'border-primary bg-primary text-primary-foreground forced-colors:border-[Highlight] forced-colors:bg-[Highlight]',\n )}\n >\n {checkState === 'mixed' ? (\n <SubtractIcon size={12} className={forcedColors.selectedLeaf} />\n ) : checkState === 'checked' ? (\n <CheckIcon size={12} className={forcedColors.selectedLeaf} />\n ) : null}\n </span>\n );\n\n // Single mode: a decorative radio (the treeitem's aria-selected carries the state). A click on\n // it is a click on the row, so it activates the item.\n const radio =\n ctx.selectionMode === 'single' ? (\n <span\n aria-hidden=\"true\"\n className={cn(\n treeItemClassNames.indicator,\n 'inline-flex size-4 shrink-0 items-center justify-center rounded-full border transition-colors motion-reduce:transition-none',\n isSelected\n ? 'border-2 border-primary forced-colors:border-[Highlight]'\n : cn('border-stroke-accessible', forcedColors.control),\n )}\n >\n {isSelected && (\n <span className={cn('block size-2 rounded-full bg-primary', forcedColors.selectedLeaf)} />\n )}\n </span>\n ) : null;\n // A tree item shows its checkbox in multiple mode, its radio in single mode, and nothing else.\n const indicator = checkbox ?? radio;\n\n // Items in this item's group are checked when the list checks this item or an ancestor.\n const groupListed = ancestorListed || (multiple && ctx.checked.has(value));\n\n return (\n <div\n role=\"treeitem\"\n aria-selected={isSelected}\n aria-current={isCurrent ? true : undefined}\n data-checked={checkState === 'checked' ? '' : undefined}\n data-mixed={checkState === 'mixed' ? '' : undefined}\n className={cn(\n treeItemClassNames.root,\n // The focus ring is drawn on the row: an outline on the treeitem would surround its\n // whole subtree.\n 'block outline-none',\n '[&:focus-visible>[data-tree-row]]:outline-2 [&:focus-visible>[data-tree-row]]:-outline-offset-2 [&:focus-visible>[data-tree-row]]:outline-ring',\n hasActions && ACTIONS_ON_ITEM_FOCUS,\n hasActions && hasAside && ASIDE_OFF_ON_ITEM_FOCUS,\n className,\n )}\n {...rest}\n // Named by its label only: the treeitem also contains its icon and its child group. A\n // consumer aria-labelledby or aria-label replaces it.\n aria-labelledby={\n rest['aria-labelledby'] ?? (rest['aria-label'] === undefined ? nameId : undefined)\n }\n // The aside describes the item, after a consumer description.\n aria-describedby={joinIds(\n rest['aria-describedby'],\n hasAside ? asideId : undefined,\n layoutIds?.descriptionId,\n )}\n aria-expanded={hasChildren ? isExpanded : undefined}\n // From the checked list, after the rest props, so a consumer cannot contradict it.\n aria-checked={\n checkState === undefined\n ? undefined\n : checkState === 'mixed'\n ? 'mixed'\n : checkState === 'checked'\n }\n tabIndex={ctx.getTabIndex(value)}\n data-roving-value={value}\n data-selected={isSelected ? '' : undefined}\n data-current={isCurrent ? '' : undefined}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n onFocus={(event) =>\n composeEventHandlers(onFocus, handleFocus, { checkDefaultPrevented: false })(event)\n }\n onBlur={(event) =>\n composeEventHandlers(onBlur, handleActionsBlur, { checkDefaultPrevented: false })(event)\n }\n ref={mergedRef}\n >\n <div\n data-tree-row=\"\"\n className={cn(\n treeItemClassNames.row,\n 'flex cursor-pointer items-center gap-1.5 rounded px-2 py-1 hover:bg-subtle-hover',\n hasActions && 'group/row',\n isSelected && cn('bg-subtle-selected font-semibold', forcedColors.selectedContainer),\n )}\n >\n {chevron}\n {indicator}\n {iconNode}\n <span\n id={labelId}\n data-tree-label=\"\"\n data-roving-text={typeaheadText}\n // The label shrinks (and truncates) when the row has content after it.\n className={cn(\n treeItemClassNames.label,\n 'truncate',\n (iconAfterNode || hasAside || hasActions) && 'min-w-0',\n )}\n >\n <TreeCheckForcedContext.Provider value={false}>\n <TreeLabelContext.Provider value>\n <TreeItemContext.Provider value={itemContext}>\n {labelContent}\n </TreeItemContext.Provider>\n </TreeLabelContext.Provider>\n </TreeCheckForcedContext.Provider>\n </span>\n {iconAfterNode}\n {(hasAside || hasActions) && (\n <span\n data-tree-end=\"\"\n className={cn(\n 'group/end ms-auto inline-grid shrink-0 items-center gap-1',\n hasAside && hasActions && END_CELL_SHARED,\n )}\n >\n {hasAside && (\n <span\n id={asideId}\n data-tree-aside=\"\"\n className={cn(\n treeItemClassNames.aside,\n 'inline-flex items-center text-caption-1 text-muted-foreground',\n hasActions && ASIDE_OFF_WITH_ACTIONS,\n )}\n >\n {materialiseSlotContent(aside)}\n </span>\n )}\n {hasActions && (\n <TreeItemActions\n labelledBy={nameId}\n tabStop={\n ctx.navigationMode === 'tree' && ctx.focusedItem === value\n ? 'last-focused'\n : 'none'\n }\n navigationMode={ctx.navigationMode}\n onReturn={() => ctx.focusValue(value)}\n >\n {materialiseSlotContent(actions)}\n </TreeItemActions>\n )}\n </span>\n )}\n </div>\n {isGroupMounted && (\n <TreeParentContext.Provider value={value}>\n <TreeCheckForcedContext.Provider value={groupListed}>\n <TreeLabelContext.Provider value={false}>\n <div\n ref={collapseRef}\n {...collapsePresenceProps}\n className={cn(treeItemClassNames.collapse, collapseClassName)}\n >\n <div ref={groupRef} role=\"group\" className={cn(treeItemClassNames.group, 'ps-4')}>\n {nestedItems}\n </div>\n </div>\n </TreeLabelContext.Provider>\n </TreeCheckForcedContext.Provider>\n </TreeParentContext.Provider>\n )}\n </div>\n );\n};\nTreeItem.displayName = 'TreeItem';\n"],"mappings":"+3BAwCA,IAAM2D,EAA2B,CAAC,EAE5BC,EACJ,uhBAOF,SAASC,GAAmB,EAAqB,CAC/CtB,EAAA,SACE,kBAAkBuB,IAClB,wCAAwCA,EAAM,uHAEhD,CACF,CAEA,IAAMC,EACJ,+HAGIC,GACJ,0IAGIC,GACJ,+JAIF,SAASC,GACP,EACY,CAEZ,OADKC,EACE,MAAM,KAAKA,EAAU,GAAUC,EAAM,OAAO,CAAC,CACjD,OAAQ,GAAuCA,IAAU,IAAI,CAAC,CAC9D,MAAM,EAAG,IACJ,CAACC,EAAE,SAAW,CAACC,EAAE,SAAWD,EAAE,UAAYC,EAAE,QAAgB,EACzDD,EAAE,QAAQ,wBAAwBC,EAAE,OAAO,EAAI,KAAK,4BACvD,GACA,CACL,CAAC,CACD,IAAK,GAAUF,EAAM,IAAI,EATP,CAAC,CAUxB,CAMA,IAAMG,GAAqB,oBAGrBC,EAAuB,uEAUvBC,GACJ,iGAGIC,GACJ,yIASIC,GACJ,6KAGIC,GACJ,sSAGIC,GAAkB,qEASxB,SAASC,GAAiB,EAA4B,CACpD,IAAMC,EAAUC,EAAK,cAA2B,8CAA8C,EAC9F,GAAI,CAACD,EAAS,MAAO,GACrB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uB,SAAxB,CAAiC,MAAO0N,GACtC,UAAA,EAAA3K,EAAA,IAAA,CAAC3C,EAAAA,iBAAiB,SAAlB,CAA2B,MAAO,GAChC,UAAA,EAAA2C,EAAA,IAAA,CAAC,MAAD,CACE,IAAKkJ,GACL,GAAIC,GACJ,UAAWjM,EAAAA,GAAGQ,EAAAA,mBAAmB,SAAU0L,EAAiB,EAE5D,UAAA,EAAApJ,EAAA,IAAA,CAAC,MAAD,CAAK,IAAKgJ,GAAU,KAAK,QAAQ,UAAW9L,EAAAA,GAAGQ,EAAAA,mBAAmB,MAAO,MAAM,EAC5E,SAAAqK,CACE,CAAA,CACF,CAAA,CACoB,CAAA,CACI,CAAA,CACP,CAAA,CAE3B,GAET,EACA,EAAS,YAAc"}
|
|
1
|
+
{"version":3,"file":"Tree.core.cjs","names":["isHiddenInput","isHiddenByCss","React","useControllable","useEventCallback","toggleCheck","isDev","useRovingTabIndex","useMergedRefs","TreeContext","TreeParentContext","TreeCheckForcedContext","cn","treeClassNames","composeEventHandlers","TreeLabelContext","isOwnEvent","isEditableTarget","getArrowIntent","getDirection","treeItemClassNames","useTreeContext","useId","isElementOfType","slotRendersContent","renderSlot","useCollapsePresence","ChevronRightIcon","collectItems","computeCheckStates","forcedColors","SubtractIcon","CheckIcon","joinIds","TreeItemContext","materialiseSlotContent","require_runtime","require_cn","require_children","require_dev","require_slot","require_composeEventHandlers","require_classNames","require_useEventCallback","require_useControllable","require_useId","require_direction","require_focus","require_useRovingTabIndex","require_useMergedRefs","require_aria","require_styles","require_icons","require_events","require_useCollapsePresence","require_Tree_context","require_treeCascade","require_Tree_selection","react","react_jsx_runtime","EMPTY","ITEM_IN_LABEL_MESSAGE","warnDuplicateValue","value","SELECTED_WITH_MULTIPLE_MESSAGE","CHECKED_WITHOUT_MULTIPLE_MESSAGE","SINGLE_WITHOUT_SELECTED_MESSAGE","forestInTreeOrder","entries","entry","a","b","TREE_ITEM_SELECTOR","ACTION_ITEM_SELECTOR","ACTIONS_ON_ITEM_FOCUS","ASIDE_OFF_ON_ITEM_FOCUS","ACTIONS_VISIBILITY","ASIDE_OFF_WITH_ACTIONS","END_CELL_SHARED","focusFirstAction","toolbar","item","cssHidden","el","concealed","marker","TreeRoot","rest","initialExpanded","defaultExpandedItems","expandedList","setExpandedList","expandedItems","onExpandedItemsChange","next","expanded","toggle","prev","v","expand","added","values","activate","onItemSelect","initialChecked","defaultCheckedItems","pendingDetails","checkedList","setCheckedList","checkedItems","onCheckedItemsChange","checked","topLevel","registerTopLevel","toggleChecked","forest","previous","effectiveSelected","selectionMode","selected","hasCheckedProps","focusedItem","setFocusedItem","valueCounts","registerValue","counts","count","remaining","context","current","getTabIndex","focusValue","navigationMode","motion","mergedRef","ref","containerProps","handleKeyDown","event","syncTypeaheadText","handleKeyDownCapture","handleBlur","className","onKeyDown","onKeyDownCapture","onFocus","onBlur","tree","label","treeitem","personaName","text","isOwnKeyEvent","target","isOwnClick","TreeItemActions","treegrid","rovingRef","rovingKeyDown","rovingFocus","popupFocus","setPopupFocus","frame","handleToolbarFocus","handleToolbarBlur","popup","labelledBy","isPrev","onReturn","TreeItem","props","typeaheadText","ctx","parent","insideLabel","isExpanded","labelId","asideId","ancestorListed","itemRef","layoutIds","setLayoutIds","registerLayout","ids","itemContext","nameId","nestedItems","labelContent","firstChildValue","children","child","keyed","key","iconNode","icon","iconAfterNode","iconAfter","hasAside","aside","hasActions","actions","hasChildren","leaf","groupRef","isGroupMounted","collapseRef","collapsePresenceProps","collapseClassName","chevron","expandIcon","multiple","ownNode","checkState","selectionEntry","isTopLevel","isSelected","isCurrent","handleClick","onClick","siblings","intent","focusedAction","inOwnActions","handleFocus","handleActionsBlur","action","active","checkbox","radio","indicator","groupListed"],"sources":["../../../src/components/layout/Tree.core.tsx"],"sourcesContent":["import * as React from 'react';\nimport { joinIds } from '../../lib/aria';\nimport { flattenChildren, isElementOfType } from '../../lib/children';\nimport { treeClassNames, treeItemClassNames } from '../../lib/classNames';\nimport { cn } from '../../lib/cn';\nimport { composeEventHandlers } from '../../lib/composeEventHandlers';\nimport { isDev, warnOnce } from '../../lib/dev';\nimport { getArrowIntent, getDirection } from '../../lib/direction';\nimport { isEditableTarget, isOwnEvent } from '../../lib/events';\nimport { isHiddenInput } from '../../lib/focus';\nimport { CheckIcon, ChevronRightIcon, SubtractIcon } from '../../lib/icons';\nimport type { MotionSlot, SelectionMode } from '../../lib/types';\nimport { materialiseSlotContent, renderSlot, slotRendersContent, type Slot } from '../../lib/slot';\nimport { forcedColors } from '../../lib/styles';\nimport { useCollapsePresence } from '../../hooks/useCollapsePresence';\nimport { useControllable } from '../../hooks/useControllable';\nimport { useEventCallback } from '../../hooks/useEventCallback';\nimport { useId } from '../../hooks/useId';\nimport { useMergedRefs } from '../../hooks/useMergedRefs';\nimport { isHiddenByCss, useRovingTabIndex } from '../../hooks/useRovingTabIndex';\nimport {\n TreeCheckForcedContext,\n TreeContext,\n TreeItemContext,\n TreeLabelContext,\n TreeParentContext,\n useTreeContext,\n type PersonaLayoutIds,\n type TreeContextValue,\n type TreeItemContextValue,\n type TreeSelectionEntry,\n} from './Tree.context';\nimport {\n collectItems,\n computeCheckStates,\n toggleCheck,\n type CheckState,\n type TreeNode,\n} from './Tree.selection';\n\nconst EMPTY: readonly string[] = [];\n\nconst ITEM_IN_LABEL_MESSAGE =\n 'Tree.Item was rendered inside the label of another Tree.Item, so it is not part of that ' +\n \"item's child group: the parent cannot expand, its name includes the nested text, and a \" +\n 'treeitem sits inside a label (axe aria-required-parent). A Tree.Item finds its nested items ' +\n 'among its own children (written directly, in Fragments, or returned by a render function such ' +\n 'as `children.map(renderNode)`), but not inside a component that renders Tree.Item itself. ' +\n 'Build a data-driven tree with a render function instead of a recursive component.';\n\nfunction warnDuplicateValue(value: string): void {\n warnOnce(\n `Tree:duplicate:${value}`,\n `Tree: several items share the value \"${value}\". Item values must be unique within a Tree; ` +\n 'items with the same value share their expanded, selected and focus state.',\n );\n}\n\nconst SELECTED_WITH_MULTIPLE_MESSAGE =\n 'Tree: `selected` has no effect with selectionMode=\"multiple\"; use `checkedItems`, and ' +\n '`current` for the item the user is on.';\n\nconst CHECKED_WITHOUT_MULTIPLE_MESSAGE =\n 'Tree: `checkedItems` and `defaultCheckedItems` need selectionMode=\"multiple\"; without it the ' +\n 'tree draws no checkboxes and ignores them.';\n\nconst SINGLE_WITHOUT_SELECTED_MESSAGE =\n 'Tree: selectionMode=\"single\" draws a radio on every item for `selected`; pass `selected` ' +\n '(null while nothing is selected) and update it from `onItemSelect`.';\n\n/** The registered top-level subtrees in document order, which is the tree order of their items. */\nfunction forestInTreeOrder(\n entries: ReadonlySet<React.RefObject<TreeSelectionEntry | null>> | null,\n): TreeNode[] {\n if (!entries) return [];\n return Array.from(entries, (entry) => entry.current)\n .filter((entry): entry is TreeSelectionEntry => entry !== null)\n .sort((a, b) => {\n if (!a.element || !b.element || a.element === b.element) return 0;\n return a.element.compareDocumentPosition(b.element) & Node.DOCUMENT_POSITION_FOLLOWING\n ? -1\n : 1;\n })\n .map((entry) => entry.node);\n}\n\n/**\n * The tree's own items for the tab stop and the arrow keys: the treeitems. A row's actions are a\n * roving container of their own, which the default selector would count as one more item.\n */\nconst TREE_ITEM_SELECTOR = '[role=\"treeitem\"]';\n\n/** Every focusable control a row's actions can hold (Toolbar's rule). */\nconst ACTION_ITEM_SELECTOR = 'button, [href], input, select, textarea, [role=\"button\"], [tabindex]';\n\n/**\n * Shows a row's actions while focus is on its item (also after a click) or inside the item's own\n * row, never in its child group (a grandchild of the item: the group sits in its collapse\n * element), so Tab and the treegrid arrows reach them. The item's `:focus-within`, not its\n * `:focus`: while focus moves from the item into an action, Chromium has already ended the item's\n * `:focus` (but keeps `:focus-within` on it, the common ancestor) when it checks that the action\n * can take focus, and a hidden action refuses it.\n */\nconst ACTIONS_ON_ITEM_FOCUS =\n '[&:focus-within:not(:has(>*>[role=group]_:focus))>[data-tree-row]_[data-tree-actions]]:visible';\n\n/** Makes the aside invisible while its actions show for focus, where they take its place. */\nconst ASIDE_OFF_ON_ITEM_FOCUS =\n '[@media(hover:hover)]:not-forced-colors:[&:focus-within:not(:has(>*>[role=group]_:focus))>[data-tree-row]_[data-tree-aside]]:invisible';\n\n/**\n * The actions stay invisible until the row is hovered or the item or an action has focus, and\n * always show in forced colors and without hover (touch). An invisible action takes no focus.\n * They also show while a surface opened from an action is open (its trigger is expanded) and\n * while focus is in such a surface (`data-focus-in-popup`), so the surface's focus return, which\n * runs after its trigger already reports it closed, reaches the action.\n */\nconst ACTIONS_VISIBILITY =\n 'invisible group-hover/row:visible focus-within:visible forced-colors:visible [@media(hover:none)]:visible has-[[aria-expanded=true]]:visible data-[focus-in-popup]:visible';\n\n/** The aside gives way to the actions where the two share one place. */\nconst ASIDE_OFF_WITH_ACTIONS =\n 'not-forced-colors:group-hover/row:invisible [@media(hover:hover)]:not-forced-colors:group-focus-within/end:invisible [@media(hover:hover)]:not-forced-colors:group-has-[[aria-expanded=true]]/end:invisible [@media(hover:hover)]:not-forced-colors:group-has-[[data-focus-in-popup]]/end:invisible';\n\n/** Aside and actions share one cell, and sit side by side where the actions always show. */\nconst END_CELL_SHARED = '[&>*]:[grid-area:1/1] forced-colors:flex [@media(hover:none)]:flex';\n\n/**\n * Focuses the first action of an item's own row that takes focus, trying them in order and\n * skipping what the roving hook skips: natively disabled, marked `data-roving-disabled`,\n * `aria-disabled` unless focusable-disabled, hidden form inputs, anything inside a `hidden` or\n * `inert` element of the toolbar, and what CSS hides (the hook's own `isHiddenByCss`). `false` when\n * focus did not move into the row's actions.\n */\nfunction focusFirstAction(item: HTMLElement): boolean {\n const toolbar = item.querySelector<HTMLElement>(':scope > [data-tree-row] [data-tree-actions]');\n if (!toolbar) return false;\n const cssHidden = new Map<Element, boolean>();\n for (const el of Array.from(toolbar.querySelectorAll<HTMLElement>(ACTION_ITEM_SELECTOR))) {\n if (isHiddenInput(el) || el.matches(':disabled')) continue;\n const concealed = el.closest('[hidden], [inert]');\n if (concealed && toolbar.contains(concealed)) continue;\n const marker = el.getAttribute('data-roving-disabled');\n if (marker !== null && marker !== 'false') continue;\n if (\n el.getAttribute('aria-disabled') === 'true' &&\n !el.hasAttribute('data-disabled-focusable')\n ) {\n continue;\n }\n if (isHiddenByCss(el, toolbar, cssHidden)) continue;\n el.focus();\n if (el.ownerDocument.activeElement === el) return true;\n }\n return false;\n}\n\n/* ------------------------------------------------------------------ */\n/* Tree */\n/* ------------------------------------------------------------------ */\n\n/** The second argument of `onCheckedItemsChange`. */\nexport interface TreeCheckedItemsChangeDetails {\n /** The item that was toggled. */\n value: string;\n /** Its new state (a toggle never leaves it mixed). */\n checked: boolean;\n /** The DOM event of the toggle: a keyboard event for Space, a mouse event for a click. */\n event: Event;\n}\n\n/** Properties for the Tree component. */\nexport interface TreeProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Controlled list of expanded item values. */\n expandedItems?: readonly string[];\n /**\n * Item values that are expanded initially (uncontrolled).\n * @default []\n */\n defaultExpandedItems?: readonly string[];\n /** Called with the new list of expanded item values when an item expands or collapses. */\n onExpandedItemsChange?: (expandedItems: string[]) => void;\n /**\n * Called with an item's value every time it is activated (a click on its row, Enter, or Space\n * unless the tree has checkboxes), also when the same item is activated again.\n */\n onItemSelect?: (value: string) => void;\n /**\n * Value of the selected item. When set (also to `null`), every item carries `aria-selected`, and\n * the selected item is where keyboard focus enters the tree. It has no effect with\n * `selectionMode=\"multiple\"` (a development warning): items carry `aria-checked` instead. With\n * `selectionMode=\"single\"` every item carries `aria-selected` even while it is not set (a\n * development warning: the radios need it).\n */\n selected?: string | null;\n /** Value of the current item (for example the open page): it gets `aria-current=\"true\"`. */\n current?: string | null;\n /**\n * How items are selected. `'none'`: activation only (0.7; `selected` highlights one item).\n * `'single'`: a radio indicator on every item for `selected`/`onItemSelect`. `'multiple'`: a\n * checkbox on every item, bound to `checkedItems`; checking an item checks its descendants, and a\n * parent shows checked, mixed or unchecked from them. Fluent's `'multiselect'` is `'multiple'`.\n * @default 'none'\n */\n selectionMode?: 'none' | SelectionMode;\n /** Controlled checked items (`selectionMode=\"multiple\"`); see the cascade rule in the component docs. */\n checkedItems?: readonly string[];\n /**\n * Initially checked items (uncontrolled).\n * @default []\n */\n defaultCheckedItems?: readonly string[];\n /**\n * Called with every checked item (in tree order) when a check changes (Fluent's `onCheckedChange`).\n * WaveUI always passes `details`; it is typed optional until 1.0.\n */\n onCheckedItemsChange?: (checkedItems: string[], details?: TreeCheckedItemsChangeDetails) => void;\n /**\n * `'tree'`: Tab from a focused item enters its actions. `'treegrid'`: the \"next\" arrow\n * (ArrowRight, ArrowLeft in RTL) moves into an item's actions and \"previous\" returns; on an\n * expanded parent \"next\" no longer moves to the first child (ArrowDown does). The roles stay\n * `tree` and `treeitem` (Fluent's `navigationMode`).\n * @default 'tree'\n */\n navigationMode?: 'tree' | 'treegrid';\n /**\n * Replaces the collapse of every child group in the tree (Fluent's `Tree collapseMotion`), on\n * the element around each `role=\"group\"` element: by default the space a group takes opens\n * from nothing and closes back to it, with a fade, over the normal duration (200 ms) with the\n * max easy-ease curve, both ways. `null` turns it off (a group appears and disappears at once);\n * a class string or `{ className }` replaces it, written as `MotionSlot` describes. A\n * `WaveProvider` with `motion=\"none\"` turns the default off, and a value here still applies\n * under it. The expand chevron's turn is not part of it, and a nested `Tree` takes its own.\n * @default the collapse described above\n */\n motion?: MotionSlot | null;\n /** Ref to the `role=\"tree\"` element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\nexport const TreeRoot = ({\n expandedItems,\n defaultExpandedItems,\n onExpandedItemsChange,\n onItemSelect,\n selected,\n current,\n selectionMode = 'none',\n navigationMode = 'tree',\n checkedItems,\n defaultCheckedItems,\n onCheckedItemsChange,\n motion,\n className,\n children,\n onKeyDown,\n onKeyDownCapture,\n onFocus,\n onBlur,\n ref,\n ...rest\n}: TreeProps) => {\n const [initialExpanded] = React.useState<readonly string[]>(() => defaultExpandedItems ?? EMPTY);\n const [expandedList, setExpandedList] = useControllable<readonly string[]>(\n expandedItems,\n initialExpanded,\n (next) => onExpandedItemsChange?.([...next]),\n );\n const expanded = React.useMemo(() => new Set(expandedList), [expandedList]);\n\n const toggle = React.useCallback(\n (value: string) => {\n setExpandedList((prev) =>\n prev.includes(value) ? prev.filter((v) => v !== value) : [...prev, value],\n );\n },\n [setExpandedList],\n );\n\n const expand = React.useCallback(\n (values: readonly string[]) => {\n setExpandedList((prev) => {\n const added = values.filter((v) => !prev.includes(v));\n return added.length > 0 ? [...prev, ...added] : prev;\n });\n },\n [setExpandedList],\n );\n\n const activate = useEventCallback((value: string) => {\n onItemSelect?.(value);\n });\n\n // Checked items (`selectionMode=\"multiple\"`). useControllable passes the value only, so a toggle\n // hands `details` to the change callback through a ref it writes and clears in the same event.\n const [initialChecked] = React.useState<readonly string[]>(() => defaultCheckedItems ?? EMPTY);\n const pendingDetails = React.useRef<TreeCheckedItemsChangeDetails | undefined>(undefined);\n const [checkedList, setCheckedList] = useControllable<readonly string[]>(\n checkedItems,\n initialChecked,\n (next) => onCheckedItemsChange?.([...next], pendingDetails.current),\n );\n const checked = React.useMemo(() => new Set(checkedList), [checkedList]);\n\n // The top-level items' subtrees (each item scans its own children), read when a check toggles:\n // they give the emitted list its tree order.\n const topLevel = React.useRef<Set<React.RefObject<TreeSelectionEntry | null>> | null>(null);\n const registerTopLevel = React.useCallback(\n (entry: React.RefObject<TreeSelectionEntry | null>) => {\n topLevel.current ??= new Set();\n const entries = topLevel.current;\n entries.add(entry);\n return () => {\n entries.delete(entry);\n };\n },\n [],\n );\n const toggleChecked = useEventCallback((value: string, event: Event) => {\n const forest = forestInTreeOrder(topLevel.current);\n setCheckedList((previous) => {\n const next = toggleCheck(forest, previous, value);\n pendingDetails.current = { value, checked: next.includes(value), event };\n return next;\n });\n pendingDetails.current = undefined;\n });\n\n // An item carries aria-checked or aria-selected, never both (APG); in single mode every item\n // carries aria-selected from the first render, so the radios and the state agree.\n const effectiveSelected =\n selectionMode === 'multiple'\n ? undefined\n : selectionMode === 'single'\n ? (selected ?? null)\n : selected;\n\n React.useEffect(() => {\n if (selectionMode === 'multiple' && selected !== undefined) {\n warnOnce('Tree:selected-with-multiple', SELECTED_WITH_MULTIPLE_MESSAGE);\n }\n }, [selectionMode, selected]);\n React.useEffect(() => {\n if (selectionMode === 'single' && selected === undefined) {\n warnOnce('Tree:single-without-selected', SINGLE_WITHOUT_SELECTED_MESSAGE);\n }\n }, [selectionMode, selected]);\n const hasCheckedProps = checkedItems !== undefined || defaultCheckedItems !== undefined;\n React.useEffect(() => {\n if (selectionMode !== 'multiple' && hasCheckedProps) {\n warnOnce('Tree:checked-without-multiple', CHECKED_WITHOUT_MULTIPLE_MESSAGE);\n }\n }, [selectionMode, hasCheckedProps]);\n\n // The item that has focus while focus is inside the tree: it holds the tab stop, so Shift+Tab\n // leaves the tree. Cleared when focus leaves; the next entry goes to `selected`, else the first.\n const [focusedItem, setFocusedItem] = React.useState<string | null>(null);\n\n // How many mounted items carry each value (written from the items' effects only).\n const valueCounts = React.useRef<Map<string, number> | null>(null);\n const registerValue = React.useCallback((value: string) => {\n if (!isDev) return () => {};\n valueCounts.current ??= new Map();\n const counts = valueCounts.current;\n const count = (counts.get(value) ?? 0) + 1;\n counts.set(value, count);\n if (count > 1) warnDuplicateValue(value);\n return () => {\n const remaining = (counts.get(value) ?? 1) - 1;\n if (remaining > 0) counts.set(value, remaining);\n else counts.delete(value);\n };\n }, []);\n\n const { containerProps, getTabIndex, focusValue } = useRovingTabIndex({\n activeValue: focusedItem ?? effectiveSelected ?? null,\n itemSelector: TREE_ITEM_SELECTOR,\n orientation: 'vertical',\n loop: false,\n typeahead: true,\n });\n\n const context = React.useMemo<TreeContextValue>(\n () => ({\n expanded,\n toggle,\n expand,\n activate,\n selected: effectiveSelected,\n current,\n getTabIndex,\n focusValue,\n onItemFocus: setFocusedItem,\n focusedItem,\n navigationMode,\n registerValue,\n selectionMode,\n checked,\n toggleChecked,\n registerTopLevel,\n motion,\n }),\n [\n expanded,\n toggle,\n expand,\n activate,\n effectiveSelected,\n current,\n getTabIndex,\n focusValue,\n focusedItem,\n navigationMode,\n registerValue,\n selectionMode,\n checked,\n toggleChecked,\n registerTopLevel,\n motion,\n ],\n );\n\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, containerProps.ref);\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n // Typeahead reads `data-roving-text` at key time: fill it from each item's label first.\n if (event.key.length === 1) syncTypeaheadText(event.currentTarget);\n containerProps.onKeyDown(event);\n };\n\n // A Space that continues a search is typeahead too, taken before the item would activate on it.\n const handleKeyDownCapture = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === ' ') syncTypeaheadText(event.currentTarget);\n containerProps.onKeyDownCapture(event);\n };\n\n const handleBlur = (event: React.FocusEvent<HTMLDivElement>) => {\n const next = event.relatedTarget as Node | null;\n if (!next || !event.currentTarget.contains(next)) setFocusedItem(null);\n };\n\n return (\n <TreeContext.Provider value={context}>\n <TreeParentContext.Provider value={null}>\n <TreeCheckForcedContext.Provider value={false}>\n <div\n role=\"tree\"\n data-selection-mode={selectionMode}\n aria-multiselectable={selectionMode === 'multiple' ? true : undefined}\n className={cn(treeClassNames.root, 'text-body-1', className)}\n {...rest}\n data-roving-container=\"\"\n onKeyDown={composeEventHandlers(onKeyDown, handleKeyDown)}\n onKeyDownCapture={composeEventHandlers(onKeyDownCapture, handleKeyDownCapture)}\n onFocus={composeEventHandlers(onFocus, containerProps.onFocus, {\n checkDefaultPrevented: false,\n })}\n onBlur={composeEventHandlers(onBlur, handleBlur, { checkDefaultPrevented: false })}\n ref={mergedRef}\n >\n {/* A Tree has its own items, also when it renders inside a label (a portaled popup). */}\n <TreeLabelContext.Provider value={false}>{children}</TreeLabelContext.Provider>\n </div>\n </TreeCheckForcedContext.Provider>\n </TreeParentContext.Provider>\n </TreeContext.Provider>\n );\n};\nTreeRoot.displayName = 'Tree';\n\n/* ------------------------------------------------------------------ */\n/* Tree.Item */\n/* ------------------------------------------------------------------ */\n\n/** Properties for the TreeItem sub-component. */\nexport interface TreeItemProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Unique value identifying this tree item. */\n value: string;\n /**\n * Icon displayed before the label. Rendered in a `<span>` hidden from assistive technology\n * (`aria-hidden`); pass a slot object (`{ className, children, … }`) to customise it. A falsy\n * icon (`''`, `0`) or a list of nothing renders no span.\n */\n icon?: Slot<'span'>;\n /** Icon after the label (decorative, `aria-hidden`; a falsy value renders nothing, as `icon`). */\n iconAfter?: Slot<'span'>;\n /**\n * Replaces the expand chevron (decorative). `null`/`undefined` keep the chevron; `false`, or\n * anything that renders nothing, hides it (`aria-expanded` still reports the state). Not rotated.\n */\n expandIcon?: Slot<'span'>;\n /**\n * Non-interactive content at the end of the row, such as a count or a badge. It describes the item\n * (`aria-describedby`); it hides while the actions show on hover or focus.\n */\n aside?: React.ReactNode;\n /**\n * Buttons at the end of the row (a toolbar named by the item's label). Shown while the row is\n * hovered or the item or its actions have focus, and always in forced colors and without hover\n * (touch). Tab reaches them from the focused item (`navigationMode=\"tree\"`), or the arrow keys do\n * (`\"treegrid\"`). Keys and clicks on them never activate or check the item.\n *\n * They also stay shown while a Menu, Popover or Dialog rendered inside them holds focus or its\n * trigger among them is expanded, so its focus return reaches the action. A dialog your app\n * renders elsewhere and opens from an action through state (a \"Delete…\" menu item that opens a\n * confirm Dialog) closes after the actions have hidden again (on devices with hover, outside\n * forced colors): a hidden action cannot take focus, so focus returns to the nearest element\n * that can, normally the item. Render such a Dialog inside `actions` (its `Dialog.Trigger`\n * there, or the controlled Dialog next to the Menu that opens it) to return focus to the action;\n * `finalFocusRef` cannot name it, since it is still hidden when the dialog closes.\n */\n actions?: React.ReactNode;\n /**\n * Renders the item as a leaf even when it has nested `Tree.Item`s: they are not rendered, and\n * the item has no `aria-expanded` and does not expand. An item is expandable only while it has\n * nested items, so `leaf={false}` does not make an item without them expandable. To load the\n * children on first expansion, give the item a placeholder child (a \"Loading…\" `Tree.Item`)\n * until they arrive.\n * @default false\n */\n leaf?: boolean;\n /** Ref to the `role=\"treeitem\"` element. */\n ref?: React.Ref<HTMLDivElement>;\n}\n\n/**\n * Sets the typeahead text (`data-roving-text`, read by the roving hook) of every rendered\n * treeitem to the text of its label (a persona layout's name when the label holds one), so neither\n * the icon nor the nested items take part. A consumer `data-roving-text` on a Tree.Item is kept on\n * its label and wins.\n */\nfunction syncTypeaheadText(tree: HTMLElement): void {\n tree.querySelectorAll<HTMLElement>('[role=\"treeitem\"]').forEach((treeitem) => {\n const label = treeitem.querySelector<HTMLElement>(\n ':scope > [data-tree-row] > [data-tree-label]',\n );\n if (!label) return;\n // A persona layout's name is the item's name, so it is its typeahead text too (not the media,\n // such as an avatar's initials, or the description).\n const personaName = label.querySelector<HTMLElement>('[data-tree-persona-name]');\n const text =\n label.getAttribute('data-roving-text') ?? personaName?.textContent ?? label.textContent ?? '';\n if (treeitem.getAttribute('data-roving-text') !== text) {\n treeitem.setAttribute('data-roving-text', text);\n }\n });\n}\n\n/**\n * Whether a keyboard event belongs to this treeitem: its target (the focused element) is this\n * treeitem or inside its row, not a nested item and not the row's actions (their keys are theirs).\n */\nfunction isOwnKeyEvent(event: React.KeyboardEvent<HTMLElement>): boolean {\n const target = event.target as Element | null;\n if (target?.closest?.('[data-tree-actions]')) return false;\n return target?.closest?.('[role=\"treeitem\"]') === event.currentTarget;\n}\n\n/**\n * Whether a click landed on this treeitem's own row (or on the treeitem element itself). Clicks\n * in its child group, including the indentation gutter beside the nested rows, clicks on nested\n * items, on its checkbox and on its actions are not its own.\n *\n * While the child group exits, its collapse element is `inert`, which hit-tests like an element\n * the pointer passes through: a pointer click in the group's box lands on the treeitem element\n * itself, and is not its own either (it would expand the item again and activate it). A click\n * without a pointer (`detail` 0: Enter on a focused item, a screen reader's click) still is.\n */\nfunction isOwnClick(event: React.MouseEvent<HTMLElement>): boolean {\n const target = event.target as Element | null;\n if (target === event.currentTarget) {\n return event.detail === 0 || !event.currentTarget.querySelector(':scope > [inert]');\n }\n if (target?.closest?.('[data-tree-checkbox], [data-tree-actions]')) return false;\n return target?.closest?.('[data-tree-row]')?.parentElement === event.currentTarget;\n}\n\ninterface TreeItemActionsProps {\n /** Id of the element that names the item. */\n labelledBy: string;\n /**\n * `'last-focused'` while the actions hold a Tab stop (their item has focus, tree mode), else\n * `'none'`.\n */\n tabStop: 'last-focused' | 'none';\n /** `'treegrid'`: the arrows do not wrap, and \"previous\" on the first action returns to the item. */\n navigationMode: 'tree' | 'treegrid';\n /** Moves focus back to the item. */\n onReturn: () => void;\n children: React.ReactNode;\n}\n\n/**\n * A row's actions: the consumer's controls rove with the arrow keys and hold at most one Tab\n * stop. A key pressed on an action is the action's: ArrowDown and ArrowUp on an action that opens\n * a popup (`aria-haspopup`) never move focus to another item. In treegrid navigation, \"previous\"\n * on the first action returns to the item.\n */\nconst TreeItemActions = ({\n labelledBy,\n tabStop,\n navigationMode,\n onReturn,\n children,\n}: TreeItemActionsProps) => {\n const treegrid = navigationMode === 'treegrid';\n const {\n containerProps: { ref: rovingRef },\n handleKeyDown: rovingKeyDown,\n handleFocus: rovingFocus,\n } = useRovingTabIndex({\n itemSelector: ACTION_ITEM_SELECTOR,\n manageTabIndex: true,\n orientation: 'horizontal',\n loop: !treegrid,\n tabStop,\n });\n\n // Focus in a surface opened from an action (a Menu, Popover or Dialog rendered in a portal, whose\n // focus events reach the toolbar through the React tree): `'inside'`. Once focus leaves such a\n // surface for anywhere but the toolbar, `'leaving'` until the next frame, because the surface's\n // focus return comes later in that close (its layout phase, or a microtask).\n const [popupFocus, setPopupFocus] = React.useState<'inside' | 'leaving' | null>(null);\n React.useEffect(() => {\n if (popupFocus !== 'leaving') return;\n const frame = requestAnimationFrame(() => setPopupFocus(null));\n return () => cancelAnimationFrame(frame);\n }, [popupFocus]);\n\n const handleToolbarFocus = (event: React.FocusEvent<HTMLSpanElement>) => {\n rovingFocus(event);\n setPopupFocus(event.currentTarget.contains(event.target) ? null : 'inside');\n };\n\n const handleToolbarBlur = (event: React.FocusEvent<HTMLSpanElement>) => {\n // An action's own blur: its focus-within reveal decides.\n if (event.currentTarget.contains(event.target)) return;\n const next = event.relatedTarget;\n // Back to an action: its focus clears the hold.\n if (next instanceof Node && event.currentTarget.contains(next)) return;\n setPopupFocus('leaving');\n };\n\n /** Whether the key is treegrid's \"previous\" for an action (the roving order settles it). */\n const handleKeyDown = (event: React.KeyboardEvent<HTMLSpanElement>): boolean => {\n // A key from a popup an action opened reaches here through the React tree: not ours.\n if (event.defaultPrevented || !isOwnEvent(event)) return false;\n const target = event.target as HTMLElement;\n const popup = target.getAttribute('aria-haspopup');\n if (\n (event.key === 'ArrowDown' || event.key === 'ArrowUp') &&\n popup !== null &&\n popup !== 'false'\n ) {\n event.preventDefault();\n return false;\n }\n if (!treegrid || event.altKey || event.ctrlKey || event.metaKey || isEditableTarget(target)) {\n return false;\n }\n const intent = getArrowIntent(event.key, {\n orientation: 'horizontal',\n dir: getDirection(event.currentTarget),\n });\n return intent === 'prev';\n };\n\n const handleToolbarKeyDown = (event: React.KeyboardEvent<HTMLSpanElement>) => {\n const isPrev = handleKeyDown(event);\n if (event.defaultPrevented) return;\n rovingKeyDown(event);\n // \"Previous\" that the roving order did not take (the first action it reaches) returns.\n if (isPrev && event.target === document.activeElement) {\n event.preventDefault();\n onReturn();\n }\n };\n\n return (\n <span\n role=\"toolbar\"\n aria-labelledby={labelledBy}\n aria-orientation=\"horizontal\"\n data-tree-actions=\"\"\n data-roving-container=\"\"\n ref={rovingRef}\n data-focus-in-popup={popupFocus === null ? undefined : ''}\n onKeyDown={handleToolbarKeyDown}\n onFocus={handleToolbarFocus}\n onBlur={handleToolbarBlur}\n className={cn(\n treeItemClassNames.actions,\n 'inline-flex items-center gap-1',\n ACTIONS_VISIBILITY,\n )}\n >\n {children}\n </span>\n );\n};\nTreeItemActions.displayName = 'TreeItemActions';\n\n/**\n * One node of a Tree. Text and other content are the label; nested `Tree.Item` children form its\n * child group, which is shown while the item is expanded.\n *\n * The child group renders as the only child of a collapse element (its stable class\n * `wave-tree-item__collapse`), which opens and closes the group's space (the Tree's `motion`) and\n * has no box of its own while the item is expanded, so the group lays out in the item as before.\n * An item expanded by default appears without motion. After a collapse the group stays in the\n * document until the collapse ends, `inert` (its items leave the arrow keys and typeahead at once)\n * while the item already reports itself collapsed; expanding the item again during the collapse\n * keeps the same group. Focus inside the group when the item collapses moves to the item. A\n * pointer click that falls through the exiting group onto the item (an `inert` element lets the\n * pointer through) is not the item's: it neither expands nor activates it.\n *\n * Nested items must be `Tree.Item` elements among the item's own children: written directly, in\n * Fragments, or returned by a render function (`{node.children.map(renderNode)}`). A component\n * that renders `Tree.Item` itself (a recursive `<NodeView node={child} />`) is not recognised:\n * its output becomes part of the label, so the parent cannot expand (a development warning names\n * this). Render data-driven trees with a render function instead. The checks of a\n * `selectionMode=\"multiple\"` tree cascade by the same rule, so an item that such a component\n * renders is not checked with its parent.\n *\n * `ref` and every other prop land on the `role=\"treeitem\"` element, which contains the label row\n * and the child group (in its collapse element). Its `onClick` receives only clicks on its own\n * row (not on its child group or nested items) and its `onKeyDown` only keys pressed while focus\n * is on it or in its row; both run before the built-in behaviour (call `event.preventDefault()`\n * to skip it). In a checkbox tree, a click on the item's checkbox toggles its check and is not\n * passed to `onClick`, and neither is a click on its actions; `onKeyDown` receives no keys pressed\n * in the actions. Its other event handlers (`onFocus`, `onDoubleClick`, `onContextMenu` and the\n * rest) are not filtered: as DOM events bubble, they also receive events from its child group and\n * nested items (compare `event.target` with `event.currentTarget` to tell them apart).\n *\n * `actions` render in a toolbar at the end of the row, named by the item; keys and clicks on them\n * belong to them and never activate or check the item. `aside` sits before them and describes the\n * item.\n *\n * The item is named by its label (`aria-labelledby`), not by its icon or nested items; an\n * `aria-label` or `aria-labelledby` prop replaces that name. Typeahead matches the label text too\n * (a `data-roving-text` prop replaces it).\n */\nexport const TreeItem = ({\n value,\n icon,\n iconAfter,\n expandIcon,\n aside,\n actions,\n leaf = false,\n className,\n children,\n onClick,\n onKeyDown,\n onFocus,\n onBlur,\n ref,\n ...props\n}: TreeItemProps) => {\n const { 'data-roving-text': typeaheadText, ...rest } = props as typeof props & {\n 'data-roving-text'?: string;\n };\n const ctx = useTreeContext('Tree.Item');\n const parent = React.useContext(TreeParentContext);\n const insideLabel = React.useContext(TreeLabelContext);\n const isExpanded = ctx.expanded.has(value);\n const labelId = useId('tree-item-label');\n const asideId = useId('tree-item-aside');\n const ancestorListed = React.useContext(TreeCheckForcedContext);\n const itemRef = React.useRef<HTMLDivElement>(null);\n const mergedRef = useMergedRefs<HTMLDivElement>(ref, itemRef);\n // A Tree.ItemPersonaLayout in the label registers its name and description: the item is named\n // by the name only and described by the description.\n const [layoutIds, setLayoutIds] = React.useState<PersonaLayoutIds | null>(null);\n const registerLayout = React.useCallback((ids: PersonaLayoutIds) => {\n setLayoutIds(ids);\n return () => setLayoutIds((current) => (current === ids ? null : current));\n }, []);\n const itemContext = React.useMemo<TreeItemContextValue>(\n () => ({ registerLayout }),\n [registerLayout],\n );\n const nameId = layoutIds?.nameId ?? labelId;\n\n const { registerValue, registerTopLevel } = ctx;\n React.useEffect(() => registerValue(value), [registerValue, value]);\n React.useEffect(() => {\n if (insideLabel) warnOnce('Tree.Item:inside-label', ITEM_IN_LABEL_MESSAGE);\n }, [insideLabel]);\n\n // Nested Tree.Items (and, as in 0.4, nested Trees) form the child group; the rest is the label.\n // Parts are identified through their element type, so parts written in a Server Component\n // (lazy references) count too.\n const nestedItems: React.ReactNode[] = [];\n const labelContent: React.ReactNode[] = [];\n let firstChildValue: string | undefined;\n flattenChildren(children).forEach(({ key, node: child }) => {\n const keyed = <React.Fragment key={key}>{child}</React.Fragment>;\n if (isElementOfType<TreeItemProps>(child, TreeItem)) {\n firstChildValue ??= child.props.value;\n nestedItems.push(keyed);\n } else if (isElementOfType(child, TreeRoot)) {\n nestedItems.push(keyed);\n } else {\n labelContent.push(keyed);\n }\n });\n\n // A falsy icon (`icon={name && <Icon />}` with `name` '' or a count of 0) is no icon, as in 0.4\n // and as in Avatar, and so is a collection whose items render nothing: no empty span adds a gap\n // to the row. The check does not consume a generator: renderSlot still renders its items.\n const iconNode =\n icon && slotRendersContent(icon)\n ? renderSlot(icon, 'span', cn(treeItemClassNames.icon, 'inline-flex shrink-0'), {\n 'aria-hidden': true,\n })\n : null;\n const iconAfterNode =\n iconAfter && slotRendersContent(iconAfter)\n ? renderSlot(iconAfter, 'span', cn(treeItemClassNames.iconAfter, 'inline-flex shrink-0'), {\n 'aria-hidden': true,\n })\n : null;\n // No empty aside and no empty toolbar (`actions={cond && <Button />}` with `cond` false).\n const hasAside = slotRendersContent(aside);\n const hasActions = slotRendersContent(actions);\n const hasChildren = nestedItems.length > 0 && !leaf;\n\n // The child group renders in a collapse element (the presence element) while the item is\n // expanded and, after a collapse, until that element's motion ends; focus inside the group when\n // the item collapses moves to this item, which the roving hook then treats as the focused item.\n const groupRef = React.useRef<HTMLDivElement | null>(null);\n const {\n isMounted: isGroupMounted,\n wrapperRef: collapseRef,\n presenceProps: collapsePresenceProps,\n className: collapseClassName,\n } = useCollapsePresence(hasChildren && isExpanded, {\n motion: ctx.motion,\n partRef: groupRef,\n getTrigger: () => itemRef.current,\n });\n\n // The optional-indicator slot rule (C-SLOTS): `null`/`undefined` keep the chevron, `false` or\n // content that renders nothing hides it (the spacer keeps the column), and a custom glyph is\n // rendered as given, not rotated.\n let chevron: React.ReactNode = <span className=\"w-3 shrink-0\" aria-hidden=\"true\" />;\n if (hasChildren && (expandIcon === undefined || expandIcon === null)) {\n chevron = (\n <ChevronRightIcon\n className={cn(\n treeItemClassNames.expandIcon,\n 'shrink-0 transition-transform motion-reduce:transition-none',\n isExpanded ? 'rotate-90' : 'wave-rtl:-scale-x-100',\n )}\n />\n );\n } else if (hasChildren && slotRendersContent(expandIcon)) {\n chevron = renderSlot(\n expandIcon,\n 'span',\n cn(treeItemClassNames.expandIcon, 'inline-flex shrink-0'),\n { 'aria-hidden': true },\n );\n }\n\n // Checkbox tree: the item computes its state from its own subtree (the child-group rule) and\n // the checked list, so every state renders on the server and needs no other item. A top-level\n // item also hands its subtree to the root, which orders a toggle's list by it.\n const multiple = ctx.selectionMode === 'multiple';\n const ownNode = React.useMemo<TreeNode | null>(\n () =>\n multiple\n ? {\n value,\n children: leaf ? [] : collectItems(children, { item: TreeItem, tree: TreeRoot }),\n }\n : null,\n [multiple, value, leaf, children],\n );\n const checkState: CheckState | undefined = ownNode\n ? computeCheckStates([ownNode], ctx.checked, ancestorListed).get(value)\n : undefined;\n const selectionEntry = React.useRef<TreeSelectionEntry | null>(null);\n React.useLayoutEffect(() => {\n selectionEntry.current = ownNode ? { node: ownNode, element: itemRef.current } : null;\n });\n const isTopLevel = parent === null && !insideLabel;\n React.useLayoutEffect(\n () => (multiple && isTopLevel ? registerTopLevel(selectionEntry) : undefined),\n [multiple, isTopLevel, registerTopLevel],\n );\n const isSelected = ctx.selected !== undefined ? ctx.selected === value : undefined;\n const isCurrent = ctx.current !== undefined && ctx.current !== null && ctx.current === value;\n\n const activate = () => {\n if (hasChildren) ctx.toggle(value);\n ctx.activate(value);\n };\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n if (!isOwnClick(event)) return;\n onClick?.(event);\n if (!event.defaultPrevented) activate();\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (!isOwnKeyEvent(event)) return;\n onKeyDown?.(event);\n if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey) return;\n\n switch (event.key) {\n case 'Enter':\n event.preventDefault();\n activate();\n return;\n case ' ':\n event.preventDefault();\n // A checkbox tree toggles the focused item's check (APG); the other modes activate.\n if (checkState !== undefined) ctx.toggleChecked(value, event.nativeEvent);\n else activate();\n return;\n case '*': {\n event.preventDefault();\n const siblings = event.currentTarget.parentElement?.querySelectorAll<HTMLElement>(\n ':scope > [role=\"treeitem\"][aria-expanded=\"false\"][data-roving-value]',\n );\n ctx.expand(\n Array.from(siblings ?? [], (el) => el.getAttribute('data-roving-value') ?? '').filter(\n Boolean,\n ),\n );\n return;\n }\n default:\n }\n\n const intent = getArrowIntent(event.key, {\n orientation: 'horizontal',\n dir: getDirection(event.currentTarget),\n });\n if (intent === 'next') {\n event.preventDefault();\n if (hasChildren && !isExpanded) {\n ctx.toggle(value);\n return;\n }\n // Treegrid navigation moves into the row's actions, also from an open parent (Down reaches\n // its first child), where APG's tree moves to the first child.\n if (ctx.navigationMode === 'treegrid' && focusFirstAction(event.currentTarget)) return;\n if (hasChildren && firstChildValue !== undefined) ctx.focusValue(firstChildValue);\n } else if (intent === 'prev') {\n event.preventDefault();\n if (hasChildren && isExpanded) ctx.toggle(value);\n else if (parent !== null) ctx.focusValue(parent);\n }\n };\n\n // Focus in the actions: tracked from the events, because a removed element fires no reliable\n // blur. A blur that leaves for another element, or from an element still in the document, ends it.\n const focusedAction = React.useRef<Element | null>(null);\n const inOwnActions = (event: React.FocusEvent<HTMLElement>) =>\n (event.target as Element).closest('[data-tree-actions]')?.closest('[role=\"treeitem\"]') ===\n event.currentTarget;\n // Focus on the item, or on one of its own actions (a click), makes it the active item.\n const handleFocus = (event: React.FocusEvent<HTMLDivElement>) => {\n if (event.target === event.currentTarget || inOwnActions(event)) ctx.onItemFocus(value);\n if (inOwnActions(event)) focusedAction.current = event.target as Element;\n };\n\n const handleActionsBlur = (event: React.FocusEvent<HTMLDivElement>) => {\n if (inOwnActions(event) && (event.relatedTarget !== null || event.target.isConnected)) {\n focusedAction.current = null;\n }\n };\n // An action that had focus is gone (no longer in the document) and focus fell to the page: it\n // goes to the item instead. Focus anywhere else ends the record at the next render.\n React.useLayoutEffect(() => {\n const action = focusedAction.current;\n if (!action) return;\n const item = itemRef.current;\n const active = item?.ownerDocument.activeElement;\n if (active && active !== item.ownerDocument.body) {\n focusedAction.current = null;\n } else if (item && !action.isConnected) {\n focusedAction.current = null;\n item.focus({ preventScroll: true });\n }\n });\n\n // The checkbox never takes focus (APG: focus stays on tree items): a press on it focuses its\n // item instead, and its click toggles the check without activating the item.\n const keepFocusOnItem = (event: React.MouseEvent<HTMLSpanElement>) => {\n event.preventDefault();\n itemRef.current?.focus({ preventScroll: true });\n };\n const handleCheckboxClick = (event: React.MouseEvent<HTMLSpanElement>) => {\n ctx.toggleChecked(value, event.nativeEvent);\n };\n\n const checkbox =\n checkState === undefined ? null : (\n <span\n role=\"checkbox\"\n aria-checked={checkState === 'mixed' ? 'mixed' : checkState === 'checked'}\n aria-labelledby={nameId}\n tabIndex={-1}\n data-tree-checkbox=\"\"\n onMouseDown={keepFocusOnItem}\n onClick={handleCheckboxClick}\n className={cn(\n treeItemClassNames.indicator,\n // Checkbox's box: 16px inside a 24px target (the pseudo-element), WCAG 2.5.8.\n 'relative inline-flex size-4 shrink-0 items-center justify-center rounded-xs border transition-colors motion-reduce:transition-none',\n 'before:absolute before:-inset-1',\n checkState === 'unchecked'\n ? cn('border-stroke-accessible bg-transparent', forcedColors.control)\n : 'border-primary bg-primary text-primary-foreground forced-colors:border-[Highlight] forced-colors:bg-[Highlight]',\n )}\n >\n {checkState === 'mixed' ? (\n <SubtractIcon size={12} className={forcedColors.selectedLeaf} />\n ) : checkState === 'checked' ? (\n <CheckIcon size={12} className={forcedColors.selectedLeaf} />\n ) : null}\n </span>\n );\n\n // Single mode: a decorative radio (the treeitem's aria-selected carries the state). A click on\n // it is a click on the row, so it activates the item.\n const radio =\n ctx.selectionMode === 'single' ? (\n <span\n aria-hidden=\"true\"\n className={cn(\n treeItemClassNames.indicator,\n 'inline-flex size-4 shrink-0 items-center justify-center rounded-full border transition-colors motion-reduce:transition-none',\n isSelected\n ? 'border-2 border-primary forced-colors:border-[Highlight]'\n : cn('border-stroke-accessible', forcedColors.control),\n )}\n >\n {isSelected && (\n <span className={cn('block size-2 rounded-full bg-primary', forcedColors.selectedLeaf)} />\n )}\n </span>\n ) : null;\n // A tree item shows its checkbox in multiple mode, its radio in single mode, and nothing else.\n const indicator = checkbox ?? radio;\n\n // Items in this item's group are checked when the list checks this item or an ancestor.\n const groupListed = ancestorListed || (multiple && ctx.checked.has(value));\n\n return (\n <div\n role=\"treeitem\"\n aria-selected={isSelected}\n aria-current={isCurrent ? true : undefined}\n data-checked={checkState === 'checked' ? '' : undefined}\n data-mixed={checkState === 'mixed' ? '' : undefined}\n className={cn(\n treeItemClassNames.root,\n // The focus ring is drawn on the row: an outline on the treeitem would surround its\n // whole subtree.\n 'block outline-none',\n '[&:focus-visible>[data-tree-row]]:outline-2 [&:focus-visible>[data-tree-row]]:-outline-offset-2 [&:focus-visible>[data-tree-row]]:outline-ring',\n hasActions && ACTIONS_ON_ITEM_FOCUS,\n hasActions && hasAside && ASIDE_OFF_ON_ITEM_FOCUS,\n className,\n )}\n {...rest}\n // Named by its label only: the treeitem also contains its icon and its child group. A\n // consumer aria-labelledby or aria-label replaces it.\n aria-labelledby={\n rest['aria-labelledby'] ?? (rest['aria-label'] === undefined ? nameId : undefined)\n }\n // The aside describes the item, after a consumer description.\n aria-describedby={joinIds(\n rest['aria-describedby'],\n hasAside ? asideId : undefined,\n layoutIds?.descriptionId,\n )}\n aria-expanded={hasChildren ? isExpanded : undefined}\n // From the checked list, after the rest props, so a consumer cannot contradict it.\n aria-checked={\n checkState === undefined\n ? undefined\n : checkState === 'mixed'\n ? 'mixed'\n : checkState === 'checked'\n }\n tabIndex={ctx.getTabIndex(value)}\n data-roving-value={value}\n data-selected={isSelected ? '' : undefined}\n data-current={isCurrent ? '' : undefined}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n onFocus={(event) =>\n composeEventHandlers(onFocus, handleFocus, { checkDefaultPrevented: false })(event)\n }\n onBlur={(event) =>\n composeEventHandlers(onBlur, handleActionsBlur, { checkDefaultPrevented: false })(event)\n }\n ref={mergedRef}\n >\n <div\n data-tree-row=\"\"\n className={cn(\n treeItemClassNames.row,\n 'flex cursor-pointer items-center gap-1.5 rounded px-2 py-1 hover:bg-subtle-hover',\n hasActions && 'group/row',\n isSelected && cn('bg-subtle-selected font-semibold', forcedColors.selectedContainer),\n )}\n >\n {chevron}\n {indicator}\n {iconNode}\n <span\n id={labelId}\n data-tree-label=\"\"\n data-roving-text={typeaheadText}\n // The label shrinks (and truncates) when the row has content after it.\n className={cn(\n treeItemClassNames.label,\n 'truncate',\n (iconAfterNode || hasAside || hasActions) && 'min-w-0',\n )}\n >\n <TreeCheckForcedContext.Provider value={false}>\n <TreeLabelContext.Provider value>\n <TreeItemContext.Provider value={itemContext}>\n {labelContent}\n </TreeItemContext.Provider>\n </TreeLabelContext.Provider>\n </TreeCheckForcedContext.Provider>\n </span>\n {iconAfterNode}\n {(hasAside || hasActions) && (\n <span\n data-tree-end=\"\"\n className={cn(\n 'group/end ms-auto inline-grid shrink-0 items-center gap-1',\n hasAside && hasActions && END_CELL_SHARED,\n )}\n >\n {hasAside && (\n <span\n id={asideId}\n data-tree-aside=\"\"\n className={cn(\n treeItemClassNames.aside,\n 'inline-flex items-center text-caption-1 text-muted-foreground',\n hasActions && ASIDE_OFF_WITH_ACTIONS,\n )}\n >\n {materialiseSlotContent(aside)}\n </span>\n )}\n {hasActions && (\n <TreeItemActions\n labelledBy={nameId}\n tabStop={\n ctx.navigationMode === 'tree' && ctx.focusedItem === value\n ? 'last-focused'\n : 'none'\n }\n navigationMode={ctx.navigationMode}\n onReturn={() => ctx.focusValue(value)}\n >\n {materialiseSlotContent(actions)}\n </TreeItemActions>\n )}\n </span>\n )}\n </div>\n {isGroupMounted && (\n <TreeParentContext.Provider value={value}>\n <TreeCheckForcedContext.Provider value={groupListed}>\n <TreeLabelContext.Provider value={false}>\n <div\n ref={collapseRef}\n {...collapsePresenceProps}\n className={cn(treeItemClassNames.collapse, collapseClassName)}\n >\n <div ref={groupRef} role=\"group\" className={cn(treeItemClassNames.group, 'ps-4')}>\n {nestedItems}\n </div>\n </div>\n </TreeLabelContext.Provider>\n </TreeCheckForcedContext.Provider>\n </TreeParentContext.Provider>\n )}\n </div>\n );\n};\nTreeItem.displayName = 'TreeItem';\n"],"mappings":"u6BAwCA,IAAM4D,EAA2B,CAAC,EA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