@neo4j-ndl/react 5.6.4 → 5.7.1

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.
@@ -34,6 +34,7 @@ const require_icons_generated_heroIcons_BarsArrowUpIconOutline = require("./gene
34
34
  const require_icons_generated_heroIcons_ChevronDownIconSolid = require("./generated/heroIcons/ChevronDownIconSolid.js");
35
35
  const require_icons_generated_heroIcons_ChevronLeftIconOutline = require("./generated/heroIcons/ChevronLeftIconOutline.js");
36
36
  const require_icons_generated_heroIcons_EllipsisHorizontalIconOutline = require("./generated/heroIcons/EllipsisHorizontalIconOutline.js");
37
+ const require_icons_generated_custom_MagnifyingGlassOutline = require("./generated/custom/MagnifyingGlassOutline.js");
37
38
  const require_icons_generated_custom_AcademicCapOutline = require("./generated/custom/AcademicCapOutline.js");
38
39
  const require_icons_generated_custom_AdjustmentsHorizontalOutline = require("./generated/custom/AdjustmentsHorizontalOutline.js");
39
40
  const require_icons_generated_custom_AdjustmentsVerticalOutline = require("./generated/custom/AdjustmentsVerticalOutline.js");
@@ -408,7 +409,6 @@ const require_icons_generated_custom_LockOpenOutline = require("./generated/cust
408
409
  const require_icons_generated_custom_LogOutOutline = require("./generated/custom/LogOutOutline.js");
409
410
  const require_icons_generated_custom_MagnifyingGlassCircleOutline = require("./generated/custom/MagnifyingGlassCircleOutline.js");
410
411
  const require_icons_generated_custom_MagnifyingGlassMinusOutline = require("./generated/custom/MagnifyingGlassMinusOutline.js");
411
- const require_icons_generated_custom_MagnifyingGlassOutline = require("./generated/custom/MagnifyingGlassOutline.js");
412
412
  const require_icons_generated_custom_MagnifyingGlassPlusOutline = require("./generated/custom/MagnifyingGlassPlusOutline.js");
413
413
  const require_icons_generated_custom_MagnifyingGlassResetOutline = require("./generated/custom/MagnifyingGlassResetOutline.js");
414
414
  const require_icons_generated_custom_MagnifyingGlassReset = require("./generated/custom/MagnifyingGlassReset.js");
package/lib/cjs/index.js CHANGED
@@ -25,6 +25,7 @@ const require_popover_Popover = require("./popover/Popover.js");
25
25
  const require_progress_bar_ProgressBar = require("./progress-bar/ProgressBar.js");
26
26
  const require_dropzone_Dropzone = require("./dropzone/Dropzone.js");
27
27
  const require_text_input_TextInput = require("./text-input/TextInput.js");
28
+ const require_search_field_SearchField = require("./search-field/SearchField.js");
28
29
  const require_text_area_TextArea = require("./text-area/TextArea.js");
29
30
  const require_text_link_TextLink = require("./text-link/TextLink.js");
30
31
  const require_select_Select = require("./select/Select.js");
@@ -37,19 +38,19 @@ const require_side_navigation_SideNavigation = require("./side-navigation/SideNa
37
38
  const require_typography_Typography = require("./typography/Typography.js");
38
39
  const require_drawer_Drawer = require("./drawer/Drawer.js");
39
40
  const require_breadcrumbs_Breadcrumbs = require("./breadcrumbs/Breadcrumbs.js");
40
- const require_hooks_index = require("./hooks/index.js");
41
41
  const require_data_grid_data_grid_context = require("./data-grid/data-grid-context.js");
42
42
  const require_data_grid_helpers_index = require("./data-grid/helpers/index.js");
43
43
  const require_hooks_use_debounce_callback_index = require("./hooks/use-debounce-callback/index.js");
44
+ const require_hooks_index = require("./hooks/index.js");
44
45
  const require_box_Box = require("./box/Box.js");
45
46
  const require_flex_Flex = require("./flex/Flex.js");
46
- const require_avatar_Avatar = require("./avatar/Avatar.js");
47
47
  const require_data_grid_style_rules_evaluate = require("./data-grid/style-rules/evaluate.js");
48
48
  const require_data_grid_style_rules_hooks = require("./data-grid/style-rules/hooks.js");
49
49
  const require_data_grid_data_grid_nav_data_grid_nav = require("./data-grid/data-grid-nav/data-grid-nav.js");
50
50
  const require_data_grid_data_grid_nav_index = require("./data-grid/data-grid-nav/index.js");
51
51
  const require_data_grid_DataGrid = require("./data-grid/DataGrid.js");
52
52
  const require_data_grid_style_rules_guard = require("./data-grid/style-rules/guard.js");
53
+ const require_avatar_Avatar = require("./avatar/Avatar.js");
53
54
  const require_logo_Logo = require("./logo/Logo.js");
54
55
  const require_clipboard_button_ClipboardButton = require("./clipboard-button/ClipboardButton.js");
55
56
  const require_slider_Slider = require("./slider/Slider.js");
@@ -152,6 +153,7 @@ exports.ProgressBar = require_progress_bar_ProgressBar.ProgressBar;
152
153
  exports.Radio = require_radio_Radio.Radio;
153
154
  exports.RadioGroup = require_radio_group_RadioGroup.RadioGroup;
154
155
  exports.ReadOnlyTag = require_read_only_tag_ReadOnlyTag.ReadOnlyTag;
156
+ exports.SearchField = require_search_field_SearchField.SearchField;
155
157
  exports.SegmentedControl = require_segmented_control_SegmentedControl.SegmentedControl;
156
158
  exports.Select = require_select_Select.Select;
157
159
  exports.SelectIconButton = require_select_icon_button_SelectIconButton.SelectIconButton;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { Accordion } from './accordion';\nexport { StatusLabel } from './status-label';\nexport { Banner } from './banner';\nexport { AnnouncementBanner } from './announcement-banner';\nexport { Checkbox } from './checkbox';\nexport { CheckboxGroup } from './checkbox-group';\nexport { Fieldset } from './fieldset';\nexport { Switch } from './switch';\nexport { Radio } from './radio';\nexport { RadioGroup } from './radio-group';\nexport { Menu } from './menu';\nexport { DatePicker } from './date-picker';\nexport { Dialog } from './dialog';\nexport { LoadingSpinner } from './loading-spinner';\nexport { Tabs } from './tabs';\nexport { SegmentedControl } from './segmented-control';\nexport * from './popover';\nexport { ProgressBar } from './progress-bar';\nexport { Dropzone } from './dropzone';\nexport * from './data-grid';\nexport { TextInput } from './text-input';\nexport { TextArea } from './text-area';\nexport { TextLink } from './text-link';\nexport { Select } from './select';\nexport { Tag } from './tag';\nexport * from './theme';\nexport { Wizard } from './wizard';\nexport { GraphLabel } from './graph-label';\nexport { CodeBlock } from './code-block';\nexport { StatusIndicator } from './status-indicator';\nexport { SideNavigation } from './side-navigation';\nexport { Typography } from './typography';\nexport { Drawer } from './drawer';\nexport { Breadcrumbs } from './breadcrumbs';\nexport * from './hooks';\nexport { Box } from './box';\nexport { Flex } from './flex';\nexport { Avatar } from './avatar';\nexport { Logo } from './logo';\nexport { ClipboardButton } from './clipboard-button';\nexport { Slider } from './slider';\nexport { InlineEdit } from './inline-edit';\nexport { DropdownButton } from './dropdown-button';\nexport { Divider } from './divider';\nexport * from './tree-view';\nexport { ToasterControlled, Toaster, toast, type ToastId } from './toast';\nexport { Tooltip } from './tooltip';\nexport { Skeleton } from './skeleton';\nexport { TimePicker, NeedleTime } from './time-picker';\nexport { TimeZonePicker } from './timezone-picker';\nexport {\n Spotlight,\n SpotlightProvider,\n SpotlightTarget,\n SpotlightTour,\n useSpotlightContext,\n} from './spotlight';\nexport { LoadingBar } from './loading-bar';\nexport { IconButton } from './icon-button';\nexport { CleanIconButton } from './clean-icon-button';\nexport { IconButtonArray } from './icon-button-array';\nexport { ConditionalWrap } from './conditional-wrap';\nexport { ColorPicker } from './color-picker';\nexport { OutlinedButton } from './outlined-button';\nexport { FilledButton } from './filled-button';\nexport { TextButton } from './text-button';\nexport { Code } from './code';\nexport { Kbd } from './kbd';\nexport { SelectIconButton } from './select-icon-button';\nexport { ReadOnlyTag } from './read-only-tag';\nexport { DismissibleTag } from './dismissible-tag';\nexport { SelectableTag } from './selectable-tag';\nexport { OperationalTag } from './operational-tag';\nexport * from './combobox';\n"],"mappings":""}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { Accordion } from './accordion';\nexport { StatusLabel } from './status-label';\nexport { Banner } from './banner';\nexport { AnnouncementBanner } from './announcement-banner';\nexport { Checkbox } from './checkbox';\nexport { CheckboxGroup } from './checkbox-group';\nexport { Fieldset } from './fieldset';\nexport { Switch } from './switch';\nexport { Radio } from './radio';\nexport { RadioGroup } from './radio-group';\nexport { Menu } from './menu';\nexport { DatePicker } from './date-picker';\nexport { Dialog } from './dialog';\nexport { LoadingSpinner } from './loading-spinner';\nexport { Tabs } from './tabs';\nexport { SegmentedControl } from './segmented-control';\nexport * from './popover';\nexport { ProgressBar } from './progress-bar';\nexport { Dropzone } from './dropzone';\nexport * from './data-grid';\nexport { TextInput } from './text-input';\nexport { SearchField } from './search-field';\nexport { TextArea } from './text-area';\nexport { TextLink } from './text-link';\nexport { Select } from './select';\nexport { Tag } from './tag';\nexport * from './theme';\nexport { Wizard } from './wizard';\nexport { GraphLabel } from './graph-label';\nexport { CodeBlock } from './code-block';\nexport { StatusIndicator } from './status-indicator';\nexport { SideNavigation } from './side-navigation';\nexport { Typography } from './typography';\nexport { Drawer } from './drawer';\nexport { Breadcrumbs } from './breadcrumbs';\nexport * from './hooks';\nexport { Box } from './box';\nexport { Flex } from './flex';\nexport { Avatar } from './avatar';\nexport { Logo } from './logo';\nexport { ClipboardButton } from './clipboard-button';\nexport { Slider } from './slider';\nexport { InlineEdit } from './inline-edit';\nexport { DropdownButton } from './dropdown-button';\nexport { Divider } from './divider';\nexport * from './tree-view';\nexport { ToasterControlled, Toaster, toast, type ToastId } from './toast';\nexport { Tooltip } from './tooltip';\nexport { Skeleton } from './skeleton';\nexport { TimePicker, NeedleTime } from './time-picker';\nexport { TimeZonePicker } from './timezone-picker';\nexport {\n Spotlight,\n SpotlightProvider,\n SpotlightTarget,\n SpotlightTour,\n useSpotlightContext,\n} from './spotlight';\nexport { LoadingBar } from './loading-bar';\nexport { IconButton } from './icon-button';\nexport { CleanIconButton } from './clean-icon-button';\nexport { IconButtonArray } from './icon-button-array';\nexport { ConditionalWrap } from './conditional-wrap';\nexport { ColorPicker } from './color-picker';\nexport { OutlinedButton } from './outlined-button';\nexport { FilledButton } from './filled-button';\nexport { TextButton } from './text-button';\nexport { Code } from './code';\nexport { Kbd } from './kbd';\nexport { SelectIconButton } from './select-icon-button';\nexport { ReadOnlyTag } from './read-only-tag';\nexport { DismissibleTag } from './dismissible-tag';\nexport { SelectableTag } from './selectable-tag';\nexport { OperationalTag } from './operational-tag';\nexport * from './combobox';\n"],"mappings":""}
@@ -10,8 +10,8 @@ const require_checkbox_Checkbox = require("../../checkbox/Checkbox.js");
10
10
  const require_clean_icon_button_CleanIconButton = require("../../clean-icon-button/CleanIconButton.js");
11
11
  const require_conditional_wrap_ConditionalWrap = require("../../conditional-wrap/ConditionalWrap.js");
12
12
  const require_helpers_platform = require("../../helpers/platform.js");
13
- const require_icons_generated_heroIcons_ChevronRightIconOutline = require("../../icons/generated/heroIcons/ChevronRightIconOutline.js");
14
- const require_icons_generated_heroIcons_EllipsisHorizontalIconOutline = require("../../icons/generated/heroIcons/EllipsisHorizontalIconOutline.js");
13
+ const require_icons_generated_custom_ChevronRightOutline = require("../../icons/generated/custom/ChevronRightOutline.js");
14
+ const require_icons_generated_custom_EllipsisHorizontalOutline = require("../../icons/generated/custom/EllipsisHorizontalOutline.js");
15
15
  const require_menu_Menu = require("../../menu/Menu.js");
16
16
  const require_skeleton_Skeleton = require("../../skeleton/Skeleton.js");
17
17
  const require_tooltip_Tooltip = require("../../tooltip/Tooltip.js");
@@ -709,7 +709,7 @@ const Item = (_ref4) => {
709
709
  className: "ndl-tree-view-new-chevron",
710
710
  "aria-disabled": isDisabled,
711
711
  onClick: handleChevronClick,
712
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_generated_heroIcons_ChevronRightIconOutline.ChevronRightIconOutline, { className: (0, classnames.default)("ndl-tree-view-new-chevron-icon", { "ndl-tree-view-new-chevron-icon--open": isExpanded }) })
712
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_generated_custom_ChevronRightOutline.default, { className: (0, classnames.default)("ndl-tree-view-new-chevron-icon", { "ndl-tree-view-new-chevron-icon--open": isExpanded }) })
713
713
  }),
714
714
  leadingVisual && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
715
715
  className: "ndl-tree-view-new-item-content-leading-visual",
@@ -758,7 +758,7 @@ const Item = (_ref4) => {
758
758
  },
759
759
  tabIndex: -1
760
760
  },
761
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_generated_heroIcons_EllipsisHorizontalIconOutline.EllipsisHorizontalIconOutline, {})
761
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_generated_custom_EllipsisHorizontalOutline.default, {})
762
762
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_menu_Menu.Menu, require_objectSpread2.default(require_objectSpread2.default({
763
763
  isOpen: isMenuOpen,
764
764
  anchorRef: actionButtonRef,
@@ -815,7 +815,7 @@ const SkeletonItem = (_ref6) => {
815
815
  className: (0, classnames.default)("ndl-tree-view-new-skeleton", className),
816
816
  style: require_objectSpread2.default({ "--tree-level": level - 1 }, style)
817
817
  }, htmlAttributes), restProps), {}, { children: Array.from({ length: rows }, (_unused, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_skeleton_Skeleton.Skeleton, {
818
- height: "18px",
818
+ height: "24px",
819
819
  width: "100%"
820
820
  }, index)) }));
821
821
  };
@@ -1 +1 @@
1
- {"version":3,"file":"TreeView.js","names":["createContext","isApplePlatform","Children","isValidElement","cloneElement","useRef","useMergeRefs","useState","useCallback","useSemicontrolledState","computeSelectionEdges","computeNextSelection","countChangedIds","formatSelectionAnnouncement","classNames","useMemo","useId","useContext","useSyncExternalStore","ChevronRightIconOutline","Checkbox","CleanIconButton","EllipsisHorizontalIconOutline","Menu","ConditionalWrap","Tooltip","Skeleton"],"sources":["../../../../src/next/tree-view/TreeView.tsx"],"sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { useMergeRefs } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport {\n Children,\n cloneElement,\n createContext,\n isValidElement,\n useCallback,\n useContext,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n} from 'react';\n\nimport { type CommonProps, type TooltipObjectProps } from '../../_common/types';\nimport { useSemicontrolledState } from '../../_common/use-semi-controlled-state';\nimport { needleWarningMessage } from '../../_common/utils';\nimport { Checkbox } from '../../checkbox';\nimport { CleanIconButton } from '../../clean-icon-button';\nimport { ConditionalWrap } from '../../conditional-wrap';\nimport { isApplePlatform } from '../../helpers/platform';\nimport { ChevronRightIconOutline } from '../../icons/generated/heroIcons/ChevronRightIconOutline';\nimport { EllipsisHorizontalIconOutline } from '../../icons/generated/heroIcons/EllipsisHorizontalIconOutline';\nimport { Menu } from '../../menu';\nimport { Skeleton } from '../../skeleton';\nimport { Tooltip } from '../../tooltip';\nimport {\n computeNextSelection,\n computeSelectionEdges,\n countChangedIds,\n formatSelectionAnnouncement,\n type SelectionAnchor,\n type SelectionEdge,\n type SelectionIntent,\n type SelectionMode,\n} from './selection';\n\ntype ItemEntry = {\n isDisabled: boolean;\n isSelectable: boolean;\n isSelected: boolean;\n onSelectedChange?: (isSelected: boolean) => void;\n parentId: string | null;\n toggleExpanded: () => void;\n};\n\ntype TreeViewContextValue = {\n isRootManaged: boolean;\n level: number;\n onSelectionIntent: (itemId: string, intent: SelectionIntent) => void;\n parentId: string | null;\n registerItem: (itemId: string, entry: ItemEntry | null) => void;\n selectionMode: SelectionMode;\n setFocusedId: (id: string | null) => void;\n store: TreeViewStore;\n};\n\nconst noop = () => undefined;\n\nconst EMPTY_EDGES: ReadonlyMap<string, SelectionEdge> = new Map();\nconst EMPTY_IDS: ReadonlySet<string> = new Set();\nconst EMPTY_ID_LIST: string[] = [];\n\ntype TreeViewStoreState = {\n edgeById: ReadonlyMap<string, SelectionEdge>;\n focusedId: string | null;\n /** Mirror of the selected ids; only meaningful when the root manages selection. */\n selectedIds: ReadonlySet<string>;\n};\n\ntype TreeViewStore = {\n getState: () => TreeViewStoreState;\n setState: (partial: Partial<TreeViewStoreState>) => void;\n subscribe: (listener: () => void) => () => void;\n};\n\n/**\n * Volatile per-interaction state (focus, root-managed selection, edge\n * styling) lives in this store instead of React context, so each item can\n * subscribe to its own primitive slice via `useSyncExternalStore` and an\n * interaction only re-renders the rows whose slice actually changed.\n */\nfunction createTreeViewStore(\n initialState?: Partial<TreeViewStoreState>,\n): TreeViewStore {\n let state: TreeViewStoreState = {\n edgeById: EMPTY_EDGES,\n focusedId: null,\n selectedIds: EMPTY_IDS,\n ...initialState,\n };\n const listeners = new Set<() => void>();\n return {\n getState: () => state,\n setState: (partial) => {\n state = { ...state, ...partial };\n listeners.forEach((listener) => listener());\n },\n subscribe: (listener) => {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n };\n}\n\nconst TREE_EVENTS = {\n action: 'treeitem-action',\n collapse: 'treeitem-collapse',\n expand: 'treeitem-expand',\n} as const;\n\nconst TreeViewContext = createContext<TreeViewContextValue>({\n isRootManaged: false,\n level: 1,\n onSelectionIntent: noop,\n parentId: null,\n registerItem: noop,\n selectionMode: 'single',\n setFocusedId: noop,\n store: createTreeViewStore(),\n});\n\n/**\n * On Apple platforms Ctrl+click is the context menu gesture, so only Cmd may\n * stand for an additive selection there.\n */\nfunction getSelectionIntent(\n event: React.KeyboardEvent | React.MouseEvent,\n): SelectionIntent {\n return {\n isRange: event.shiftKey,\n isToggle: isApplePlatform() ? event.metaKey : event.ctrlKey,\n };\n}\n\nfunction getVisibleTreeItems(root: HTMLElement): HTMLElement[] {\n return Array.from(\n root.querySelectorAll<HTMLElement>('[role=\"treeitem\"]'),\n ).filter((el) => {\n let parent = el.parentElement;\n while (parent && parent !== root) {\n if (parent.getAttribute('role') === 'group' && parent.hidden) {\n return false;\n }\n parent = parent.parentElement;\n }\n return true;\n });\n}\n\nfunction getVisibleItemIds(root: HTMLElement): string[] {\n return getVisibleTreeItems(root).map((el) => el.id);\n}\n\nfunction areIdSetsEqual(\n first: ReadonlySet<string>,\n second: ReadonlySet<string>,\n): boolean {\n if (first.size !== second.size) {\n return false;\n }\n for (const id of first) {\n if (!second.has(id)) {\n return false;\n }\n }\n return true;\n}\n\nfunction areEdgeMapsEqual(\n first: ReadonlyMap<string, SelectionEdge>,\n second: ReadonlyMap<string, SelectionEdge>,\n): boolean {\n if (first.size !== second.size) {\n return false;\n }\n for (const [id, edge] of first) {\n if (second.get(id) !== edge) {\n return false;\n }\n }\n return true;\n}\n\nfunction annotateTreeItems(children: React.ReactNode): React.ReactNode {\n const items = Children.toArray(children);\n const treeItemCount = items.filter(\n (child): child is React.ReactElement =>\n isValidElement(child) && child.type === Item,\n ).length;\n\n let posInSet = 0;\n return Children.map(children, (child) => {\n if (isValidElement(child) && child.type === Item) {\n posInSet++;\n return cloneElement(\n child as React.ReactElement<React.HTMLAttributes<HTMLElement>>,\n {\n 'aria-posinset': posInSet,\n 'aria-setsize': treeItemCount,\n },\n );\n }\n return child;\n });\n}\n\ntype RootProps = {\n /** The aria-label for the tree. Required for accessibility, unless using ariaLabelledby. Pass null to omit. */\n ariaLabel: string | null;\n /** The aria-labelledby for the tree. Pass a string of space-separated IDs of elements that label the tree. */\n ariaLabelledby?: string;\n /** The children of the tree. Should be TreeView.Item components or TreeView.SkeletonItem components only. */\n children?: React.ReactNode;\n /** Initially selected item ids for an uncontrolled root-managed selection. */\n defaultSelectedIds?: string[];\n /** Selected item ids. Makes the tree manage selection itself, instead of each item managing its own. */\n selectedIds?: string[];\n /** Selection mode for the tree. Defaults to \"single\". */\n selectionMode?: SelectionMode;\n /** Callback called with the complete next selection whenever the tree manages selection. Fires once per interaction. */\n onSelectedIdsChange?: (selectedIds: string[]) => void;\n};\n\n/**\n * Root container for a tree view. Renders a `role=\"tree\"` element with full\n * keyboard navigation (arrow keys, Home/End, Enter/Space) following the\n * WAI-ARIA TreeView pattern.\n *\n * Direct children should be `TreeView.Item` or `TreeView.SkeletonItem`.\n *\n * @example\n * ```tsx\n * <TreeView ariaLabel=\"Files\">\n * <TreeView.Item title=\"README.md\" onSelectedChange={setSelected} isSelected={selected} />\n * </TreeView>\n * ```\n *\n * @alpha - this component is still in development and may change in the future. It might not have feature parity with the old tree view yet.\n */\nconst Root = ({\n children,\n defaultSelectedIds,\n selectedIds: selectedIdsProp,\n selectionMode = 'single',\n ariaLabel,\n ariaLabelledby,\n className,\n style,\n htmlAttributes,\n onSelectedIdsChange,\n ref,\n ...restProps\n}: CommonProps<'div', RootProps>) => {\n const treeRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs([treeRef, ref]);\n const [announcement, setAnnouncement] = useState('');\n // While focus is inside the tree the root drops out of the tab order so\n // that Shift+Tab moves focus out of the tree instead of landing on the\n // root, which would delegate focus straight back to the item (a trap).\n const [isFocusWithin, setIsFocusWithin] = useState(false);\n const anchorRef = useRef<SelectionAnchor>(null);\n const entriesRef = useRef(new Map<string, ItemEntry>());\n\n const isRootManaged =\n selectedIdsProp !== undefined || defaultSelectedIds !== undefined;\n\n const storeRef = useRef<TreeViewStore>(null);\n if (storeRef.current === null) {\n storeRef.current = createTreeViewStore({\n selectedIds: new Set(\n selectedIdsProp ?? defaultSelectedIds ?? EMPTY_ID_LIST,\n ),\n });\n }\n const store = storeRef.current;\n\n const setFocusedId = useCallback(\n (id: string | null) => {\n if (store.getState().focusedId !== id) {\n store.setState({ focusedId: id });\n }\n },\n [store],\n );\n\n const [selectedIdList, setSelectedIdList] = useSemicontrolledState<string[]>({\n isControlled: selectedIdsProp !== undefined,\n onChange: onSelectedIdsChange,\n state: selectedIdsProp ?? defaultSelectedIds ?? EMPTY_ID_LIST,\n });\n\n // useSemicontrolledState recreates its setter whenever the value changes;\n // reading it through a ref keeps onSelectionIntent (and with it the\n // memoized context value) stable across selection changes.\n const setSelectedIdListRef = useRef(setSelectedIdList);\n useLayoutEffect(() => {\n setSelectedIdListRef.current = setSelectedIdList;\n });\n\n const readSelectedIds = useCallback((): Set<string> => {\n if (isRootManaged) {\n return new Set(store.getState().selectedIds);\n }\n const selected = new Set<string>();\n entriesRef.current.forEach((entry, itemId) => {\n if (entry.isSelected) {\n selected.add(itemId);\n }\n });\n return selected;\n }, [isRootManaged, store]);\n\n const readItemMaps = useCallback(() => {\n const parentIdById = new Map<string, string>();\n const selectableIds = new Set<string>();\n entriesRef.current.forEach((entry, itemId) => {\n if (entry.parentId !== null) {\n parentIdById.set(itemId, entry.parentId);\n }\n if (entry.isSelectable && !entry.isDisabled) {\n selectableIds.add(itemId);\n }\n });\n return { parentIdById, selectableIds };\n }, []);\n\n const recomputeEdges = useCallback(() => {\n const root = treeRef.current;\n const previousEdges = store.getState().edgeById;\n if (!root || selectionMode !== 'multiple-replace') {\n if (previousEdges.size > 0) {\n store.setState({ edgeById: EMPTY_EDGES });\n }\n return;\n }\n const selectedIds = readSelectedIds();\n if (selectedIds.size === 0 && previousEdges.size === 0) {\n return;\n }\n const nextEdges = computeSelectionEdges(\n getVisibleItemIds(root),\n selectedIds,\n );\n if (!areEdgeMapsEqual(previousEdges, nextEdges)) {\n store.setState({ edgeById: nextEdges });\n }\n }, [readSelectedIds, selectionMode, store]);\n\n const recomputeEdgesRef = useRef(recomputeEdges);\n useLayoutEffect(() => {\n recomputeEdgesRef.current = recomputeEdges;\n });\n\n // Debounced through a microtask so a commit that touches many items (mount,\n // expansion, range selection) triggers a single recompute, after all item\n // layout effects have registered and before the browser paints.\n const isEdgeRecomputeScheduledRef = useRef(false);\n const scheduleEdgeRecompute = useCallback(() => {\n if (isEdgeRecomputeScheduledRef.current) {\n return;\n }\n isEdgeRecomputeScheduledRef.current = true;\n queueMicrotask(() => {\n isEdgeRecomputeScheduledRef.current = false;\n recomputeEdgesRef.current();\n });\n }, []);\n\n const registerItem = useCallback(\n (itemId: string, entry: ItemEntry | null) => {\n if (entry === null) {\n entriesRef.current.delete(itemId);\n } else {\n entriesRef.current.set(itemId, entry);\n }\n // Covers item mount/unmount and expansion toggles (a collapsing parent\n // re-registers because its toggleExpanded callback is recreated).\n scheduleEdgeRecompute();\n },\n [scheduleEdgeRecompute],\n );\n\n const onSelectionIntent = useCallback(\n (itemId: string, intent: SelectionIntent) => {\n const root = treeRef.current;\n const entry = entriesRef.current.get(itemId);\n if (!root || !entry || entry.isDisabled) {\n return;\n }\n if (!entry.isSelectable) {\n entry.toggleExpanded();\n return;\n }\n\n const { parentIdById, selectableIds } = readItemMaps();\n const selectedIds = readSelectedIds();\n const result = computeNextSelection({\n anchor: anchorRef.current,\n intent,\n parentIdById,\n selectableIds,\n selectedIds,\n selectionMode,\n targetId: itemId,\n visibleIds: getVisibleItemIds(root),\n });\n anchorRef.current = result.anchor;\n\n const nextSelectedIds = result.selectedIds;\n const changedCount = countChangedIds(selectedIds, nextSelectedIds);\n\n if (isRootManaged) {\n if (changedCount > 0) {\n setSelectedIdListRef.current([...nextSelectedIds]);\n }\n } else if (selectionMode === 'single') {\n // Single mode leaves clearing the previously selected item to the\n // consumer, so only the clicked item is told about the change.\n if (!selectedIds.has(itemId)) {\n entry.onSelectedChange?.(true);\n }\n } else {\n entriesRef.current.forEach((itemEntry, id) => {\n const isSelected = nextSelectedIds.has(id);\n if (itemEntry.isSelected !== isSelected) {\n itemEntry.onSelectedChange?.(isSelected);\n }\n });\n }\n\n scheduleEdgeRecompute();\n\n if (selectionMode !== 'single') {\n setAnnouncement(\n intent.isRange\n ? formatSelectionAnnouncement(nextSelectedIds.size)\n : '',\n );\n }\n },\n [\n isRootManaged,\n readItemMaps,\n readSelectedIds,\n scheduleEdgeRecompute,\n selectionMode,\n ],\n );\n\n // Mirrors the root-managed selection into the store, so items subscribe to\n // their own slice and event handlers read it without a state dependency.\n useLayoutEffect(() => {\n const next = isRootManaged ? new Set(selectedIdList) : EMPTY_IDS;\n if (areIdSetsEqual(store.getState().selectedIds, next)) {\n return;\n }\n store.setState({ selectedIds: next });\n scheduleEdgeRecompute();\n }, [isRootManaged, scheduleEdgeRecompute, selectedIdList, store]);\n\n // Computes edges on mount and whenever the edge inputs change identity\n // (selection mode, root-managed flag). Interaction-driven recomputes go\n // through scheduleEdgeRecompute instead.\n useLayoutEffect(() => {\n recomputeEdges();\n }, [recomputeEdges]);\n\n const handleKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n const root = treeRef.current;\n if (!root) {\n return;\n }\n\n const items = getVisibleTreeItems(root);\n if (items.length === 0) {\n return;\n }\n\n const currentIndex = items.findIndex(\n (el) => el.id === store.getState().focusedId,\n );\n let isHandled = true;\n\n const extendRangeTo = (item: HTMLElement) => {\n if (selectionMode === 'single' || currentIndex < 0) {\n return;\n }\n const entry = entriesRef.current.get(item.id);\n if (!entry?.isSelectable || entry.isDisabled) {\n return;\n }\n if (anchorRef.current === null) {\n // A keyboard range has no preceding click to repeat, so it grows the\n // selection outwards from wherever focus already is.\n anchorRef.current = {\n baseSelectedIds: readSelectedIds(),\n id: items[currentIndex].id,\n isSelected: true,\n };\n }\n onSelectionIntent(item.id, { isRange: true, isToggle: false });\n };\n\n switch (event.key) {\n case 'ArrowDown': {\n const nextIndex =\n currentIndex < items.length - 1 ? currentIndex + 1 : currentIndex;\n const nextItem = items[nextIndex];\n if (nextItem) {\n if (event.shiftKey) {\n extendRangeTo(nextItem);\n }\n setFocusedId(nextItem.id);\n nextItem.focus();\n }\n break;\n }\n case 'ArrowUp': {\n const prevIndex = currentIndex > 0 ? currentIndex - 1 : 0;\n const prevItem = items[prevIndex];\n if (prevItem) {\n if (event.shiftKey) {\n extendRangeTo(prevItem);\n }\n setFocusedId(prevItem.id);\n prevItem.focus();\n }\n break;\n }\n case 'ArrowRight': {\n const current = currentIndex >= 0 ? items[currentIndex] : null;\n if (!current) {\n break;\n }\n const isExpanded = current.getAttribute('aria-expanded');\n if (isExpanded === 'false') {\n current.dispatchEvent(new CustomEvent(TREE_EVENTS.expand));\n } else if (isExpanded === 'true') {\n const nextIndex = currentIndex + 1;\n if (nextIndex < items.length) {\n const nextItem = items[nextIndex];\n setFocusedId(nextItem.id);\n nextItem.focus();\n }\n }\n break;\n }\n case 'ArrowLeft': {\n const current = currentIndex >= 0 ? items[currentIndex] : null;\n if (!current) {\n break;\n }\n const isExpanded = current.getAttribute('aria-expanded');\n if (isExpanded === 'true') {\n current.dispatchEvent(new CustomEvent(TREE_EVENTS.collapse));\n } else {\n const parentGroup = current.closest('[role=\"group\"]');\n if (parentGroup?.id) {\n const parentItem = root.querySelector<HTMLElement>(\n `[aria-owns=\"${parentGroup.id}\"]`,\n );\n if (parentItem) {\n setFocusedId(parentItem.id);\n parentItem.focus();\n }\n }\n }\n break;\n }\n case 'Home': {\n const first = items[0];\n if (first) {\n setFocusedId(first.id);\n first.focus();\n }\n break;\n }\n case 'End': {\n const last = items[items.length - 1];\n if (last) {\n setFocusedId(last.id);\n last.focus();\n }\n break;\n }\n case 'Enter':\n case ' ': {\n const current = currentIndex >= 0 ? items[currentIndex] : null;\n if (current) {\n onSelectionIntent(current.id, getSelectionIntent(event));\n }\n break;\n }\n case 'F10': {\n if (event.shiftKey) {\n const current = currentIndex >= 0 ? items[currentIndex] : null;\n if (current) {\n current.dispatchEvent(new CustomEvent(TREE_EVENTS.action));\n }\n } else {\n isHandled = false;\n }\n break;\n }\n default:\n isHandled = false;\n }\n\n if (isHandled) {\n event.preventDefault();\n event.stopPropagation();\n }\n },\n [onSelectionIntent, readSelectedIds, selectionMode, setFocusedId, store],\n );\n\n const handleFocus = useCallback(\n (event: React.FocusEvent<HTMLDivElement>) => {\n const root = treeRef.current;\n if (!root) {\n return;\n }\n\n setIsFocusWithin(true);\n\n if (event.target === root) {\n const items = getVisibleTreeItems(root);\n const { focusedId } = store.getState();\n const alreadyFocused = focusedId\n ? items.find((el) => el.id === focusedId)\n : null;\n const target = alreadyFocused ?? items[0];\n if (target) {\n setFocusedId(target.id);\n target.focus();\n }\n }\n },\n [setFocusedId, store],\n );\n\n const handleBlur = useCallback((event: React.FocusEvent<HTMLDivElement>) => {\n const root = treeRef.current;\n if (!root) {\n return;\n }\n if (\n !(event.relatedTarget instanceof Node) ||\n !root.contains(event.relatedTarget)\n ) {\n setIsFocusWithin(false);\n }\n }, []);\n\n const classes = classNames(className, 'ndl-tree-view-new', {\n 'ndl-tree-view-new--checkbox': selectionMode === 'multiple',\n });\n\n // Cached on children identity so Root-internal state commits (announcement,\n // uncontrolled selection) reuse the same annotated elements and React bails\n // out of the whole item subtree instead of re-rendering every row.\n const annotatedChildren = useMemo(\n () => annotateTreeItems(children),\n [children],\n );\n\n // Everything in here is stable or primitive, so items only re-render via\n // context when the tree's configuration changes, not per interaction.\n const contextValue = useMemo(\n () => ({\n isRootManaged,\n level: 1,\n onSelectionIntent,\n parentId: null,\n registerItem,\n selectionMode,\n setFocusedId,\n store,\n }),\n [\n isRootManaged,\n onSelectionIntent,\n registerItem,\n selectionMode,\n setFocusedId,\n store,\n ],\n );\n\n return (\n <TreeViewContext.Provider value={contextValue}>\n <div\n ref={mergedRef}\n role=\"tree\"\n aria-multiselectable={\n selectionMode === 'multiple' || selectionMode === 'multiple-replace'\n ? true\n : undefined\n }\n tabIndex={isFocusWithin ? -1 : 0}\n className={classes}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n onBlur={handleBlur}\n aria-label={ariaLabel ?? undefined}\n aria-labelledby={ariaLabelledby}\n style={style}\n {...htmlAttributes}\n {...restProps}\n >\n {annotatedChildren}\n </div>\n <div\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className=\"ndl-tree-view-new-live-region\"\n >\n {announcement}\n </div>\n </TreeViewContext.Provider>\n );\n};\n\ntype ItemProps = {\n /** Nested TreeView.Item or TreeView.SkeletonItem elements rendered as sub-items in a collapsible group. */\n children?: React.ReactNode;\n /** The label content displayed in the item row. */\n title?: React.ReactNode;\n /** Default expansion for uncontrolled items */\n isDefaultExpanded?: boolean;\n /** Whether the item has children. Decides if the item should render a chevron for expansion. Needed for lazy loading. */\n hasChildren?: boolean;\n /** Identifies the item. Required when the tree manages selection via `selectedIds`. */\n id?: string;\n /** Whether the item is disabled */\n isDisabled?: boolean;\n /** Whether the item is expanded. Makes the item controlled. */\n isExpanded?: boolean;\n /** Whether the item is in an indeterminate state. Only meaningful in multi-select mode for parent nodes. */\n isIndeterminate?: boolean;\n /** Whether the item is loading. Applies aria-busy=\"true\" to the item. */\n isLoading?: boolean;\n /** Whether the item can be selected. Defaults to true when the tree manages selection, and otherwise to whether `onSelectedChange` is set. */\n isSelectable?: boolean;\n /** Whether the item is selected. Ignored when the tree manages selection via `selectedIds`. */\n isSelected?: boolean;\n /** Leading visual for the item. */\n leadingVisual?: React.ReactNode;\n /** Trailing content for the item. Shown after the children but before the action menu. */\n trailingContent?: React.ReactNode;\n /** ReactNode containing Menu.Item elements to render in an action menu. When provided, an action button is rendered. */\n actionMenuItems?: React.ReactNode;\n /** Props forwarded to the Menu sub-components (anchorRef, onClose). */\n actionMenuProps?: React.ComponentProps<typeof Menu>;\n /** Content rendered inside the tooltip. When provided, the item is wrapped in a Tooltip. */\n tooltipContent?: React.ReactNode;\n /** Props forwarded to the Tooltip sub-components (root, trigger, content). */\n tooltipProps?: TooltipObjectProps;\n /** Callback called when the item is expanded/collapsed. */\n onExpandedChange?: (isExpanded: boolean) => void;\n /** Callback called when the item is selected/deselected. Receives the new selected state. Ignored when the tree manages selection via `selectedIds`. */\n onSelectedChange?: (isSelected: boolean) => void;\n};\n\n/**\n * A single item within a `TreeView`. Renders a `role=\"treeitem\"` element that\n * supports selection, expansion, leading/trailing visuals, and an action menu.\n *\n * The `title` prop provides the item's label content. Nesting `TreeView.Item`\n * elements as `children` creates a hierarchical tree structure.\n *\n * Supports both controlled (`isExpanded`) and uncontrolled (`isDefaultExpanded`)\n * expansion, as well as lazy loading via `hasChildren` + `isLoading`.\n *\n * @example\n * ```tsx\n * <TreeView.Item\n * title=\"src\"\n * leadingVisual={<FolderIcon />}\n * isSelected={selected}\n * onSelectedChange={setSelected}\n * >\n * <TreeView.Item title=\"index.ts\" />\n * </TreeView.Item>\n * ```\n */\nconst Item = ({\n actionMenuItems,\n children,\n isDefaultExpanded = false,\n hasChildren: hasChildrenProp,\n id: idProp,\n isDisabled,\n isExpanded: isExpandedProp,\n isIndeterminate,\n isLoading,\n isSelectable: isSelectableProp,\n isSelected: isSelectedProp,\n leadingVisual,\n title,\n tooltipContent,\n tooltipProps,\n trailingContent,\n onExpandedChange,\n onSelectedChange,\n actionMenuProps,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', ItemProps>) => {\n const generatedId = useId();\n const itemId = idProp ?? htmlAttributes?.id ?? `ndl-treeitem-${generatedId}`;\n const titleId = `ndl-treeitem-title-${generatedId}`;\n const groupId = `ndl-treegroup-${generatedId}`;\n const itemRef = useRef<HTMLDivElement>(null);\n const actionButtonRef = useRef<HTMLButtonElement>(null);\n const didOpenViaKeyboard = useRef(false);\n const [isMenuOpen, setIsMenuOpen] = useState(false);\n const treeViewContext = useContext(TreeViewContext);\n const {\n isRootManaged,\n level,\n onSelectionIntent,\n parentId,\n registerItem,\n selectionMode,\n setFocusedId,\n store,\n } = treeViewContext;\n\n // Primitive slices of the store, so Object.is bails out of re-renders for\n // rows whose focus/selection/edge state did not change.\n const isFocused = useSyncExternalStore(\n store.subscribe,\n () => store.getState().focusedId === itemId,\n () => store.getState().focusedId === itemId,\n );\n const isRootSelected = useSyncExternalStore(\n store.subscribe,\n () => store.getState().selectedIds.has(itemId),\n () => store.getState().selectedIds.has(itemId),\n );\n const edge = useSyncExternalStore(\n store.subscribe,\n () => store.getState().edgeById.get(itemId),\n () => store.getState().edgeById.get(itemId),\n );\n\n const isControlledExpansion = isExpandedProp !== undefined;\n const [isExpanded, setIsExpanded] = useSemicontrolledState({\n isControlled: isControlledExpansion,\n onChange: onExpandedChange,\n state: isExpandedProp ?? isDefaultExpanded,\n });\n\n const hasChildren = hasChildrenProp ?? Children.count(children) > 0;\n const isSelectable = isRootManaged\n ? (isSelectableProp ?? true)\n : (isSelectableProp ?? onSelectedChange !== undefined);\n const isSelected = isRootManaged ? isRootSelected : (isSelectedProp ?? false);\n const isMultiple = selectionMode === 'multiple';\n\n const toggleExpanded = useCallback(() => {\n if (isDisabled) {\n return;\n }\n if (hasChildren) {\n setIsExpanded(!isExpanded);\n }\n }, [isDisabled, hasChildren, setIsExpanded, isExpanded]);\n\n useLayoutEffect(() => {\n registerItem(itemId, {\n isDisabled: isDisabled ?? false,\n isSelectable,\n isSelected,\n onSelectedChange,\n parentId,\n toggleExpanded,\n });\n }, [\n isDisabled,\n isSelectable,\n isSelected,\n itemId,\n onSelectedChange,\n parentId,\n registerItem,\n toggleExpanded,\n ]);\n\n useLayoutEffect(() => {\n return () => registerItem(itemId, null);\n }, [itemId, registerItem]);\n\n useEffect(() => {\n if (!isRootManaged) {\n return;\n }\n if (idProp === undefined) {\n needleWarningMessage(\n 'TreeView.Item needs an `id` when the tree manages selection with `selectedIds`.',\n );\n }\n if (isSelectedProp !== undefined || onSelectedChange !== undefined) {\n needleWarningMessage(\n 'TreeView.Item `isSelected` and `onSelectedChange` are ignored when the tree manages selection with `selectedIds`.',\n );\n }\n }, [idProp, isRootManaged, isSelectedProp, onSelectedChange]);\n\n const handleClick = useCallback(\n (event: React.MouseEvent) => {\n if (isDisabled) {\n return;\n }\n setFocusedId(itemId);\n onSelectionIntent(itemId, getSelectionIntent(event));\n },\n [isDisabled, setFocusedId, itemId, onSelectionIntent],\n );\n\n const handleChevronClick = useCallback(\n (event: React.MouseEvent) => {\n event.stopPropagation();\n if (isDisabled) {\n return;\n }\n setFocusedId(itemId);\n toggleExpanded();\n },\n [isDisabled, setFocusedId, itemId, toggleExpanded],\n );\n\n const handleMenuClose = useCallback(() => {\n setIsMenuOpen(false);\n if (didOpenViaKeyboard.current) {\n itemRef.current?.focus();\n didOpenViaKeyboard.current = false;\n }\n }, []);\n\n const handleCustomEvents = useCallback(\n (event: Event) => {\n if (event.type === TREE_EVENTS.expand) {\n event.stopPropagation();\n if (hasChildren && !isExpanded && !isDisabled) {\n setIsExpanded(true);\n }\n } else if (event.type === TREE_EVENTS.collapse) {\n event.stopPropagation();\n if (hasChildren && isExpanded && !isDisabled) {\n setIsExpanded(false);\n }\n } else if (event.type === TREE_EVENTS.action) {\n event.stopPropagation();\n if (actionMenuItems && !isDisabled) {\n didOpenViaKeyboard.current = true;\n setIsMenuOpen(true);\n }\n }\n },\n [actionMenuItems, hasChildren, isExpanded, isDisabled, setIsExpanded],\n );\n\n const callbackRef = useCallback(\n (node: HTMLDivElement | null) => {\n const prev = itemRef.current;\n if (prev) {\n prev.removeEventListener(TREE_EVENTS.expand, handleCustomEvents);\n prev.removeEventListener(TREE_EVENTS.collapse, handleCustomEvents);\n prev.removeEventListener(TREE_EVENTS.action, handleCustomEvents);\n }\n (itemRef as React.MutableRefObject<HTMLDivElement | null>).current = node;\n if (node) {\n node.addEventListener(TREE_EVENTS.expand, handleCustomEvents);\n node.addEventListener(TREE_EVENTS.collapse, handleCustomEvents);\n node.addEventListener(TREE_EVENTS.action, handleCustomEvents);\n }\n },\n [handleCustomEvents],\n );\n\n const mergedRef = useMergeRefs([callbackRef, ref]);\n\n const selectionAriaProps = (() => {\n if (!isSelectable) {\n return {};\n }\n if (isMultiple) {\n return {\n 'aria-checked': isIndeterminate ? ('mixed' as const) : isSelected,\n };\n }\n return { 'aria-selected': isSelected };\n })();\n\n const edgeClass =\n edge === undefined ? undefined : `ndl-tree-view-new-item--selected-${edge}`;\n\n const childContextValue = useMemo(\n () => ({\n ...treeViewContext,\n level: treeViewContext.level + 1,\n parentId: itemId,\n }),\n [itemId, treeViewContext],\n );\n\n // Same caching as in Root: keeps child element identity stable across\n // renders of this item (selection, focus, expansion) so unchanged\n // descendants bail out of re-rendering.\n const annotatedChildren = useMemo(\n () => annotateTreeItems(children),\n [children],\n );\n\n const itemElement = (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events -- keyboard handled on tree root; aria-selected/aria-checked applied via spread\n <div\n ref={mergedRef}\n // eslint-disable-next-line jsx-a11y/role-has-required-aria-props -- aria-selected/aria-checked applied conditionally via spread\n role=\"treeitem\"\n {...selectionAriaProps}\n aria-expanded={hasChildren ? isExpanded : undefined}\n aria-owns={hasChildren ? groupId : undefined}\n aria-disabled={isDisabled || undefined}\n aria-busy={isLoading || undefined}\n aria-keyshortcuts={actionMenuItems ? 'Shift+F10' : undefined}\n aria-labelledby={titleId}\n aria-level={level}\n tabIndex={isFocused ? 0 : -1}\n className={classNames('ndl-tree-view-new-item', className, edgeClass, {\n 'ndl-tree-view-new-item--disabled': isDisabled,\n 'ndl-tree-view-new-item--parent': hasChildren,\n 'ndl-tree-view-new-item--selected': isSelected && isSelectable,\n })}\n style={{ '--tree-level': level - 1, ...style } as React.CSSProperties}\n onClick={(event) => {\n event.stopPropagation();\n handleClick(event);\n }}\n {...htmlAttributes}\n {...restProps}\n id={itemId}\n >\n <div\n className={classNames('ndl-tree-view-new-item-content', {\n 'ndl-tree-view-new-item-content--parent': hasChildren,\n })}\n >\n {hasChildren && (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions -- keyboard handled on tree root\n <span\n className=\"ndl-tree-view-new-chevron\"\n aria-disabled={isDisabled}\n onClick={handleChevronClick}\n >\n <ChevronRightIconOutline\n className={classNames('ndl-tree-view-new-chevron-icon', {\n 'ndl-tree-view-new-chevron-icon--open': isExpanded,\n })}\n />\n </span>\n )}\n {leadingVisual && (\n <div className=\"ndl-tree-view-new-item-content-leading-visual\">\n {leadingVisual}\n </div>\n )}\n {isMultiple && isSelectable && (\n <div className=\"ndl-tree-view-new-checkbox\" inert>\n <Checkbox\n style={{ borderWidth: '1.5px' }}\n ariaLabel=\"Select\"\n isChecked={isSelected}\n isIndeterminate={isIndeterminate}\n isDisabled={isDisabled}\n onChange={noop}\n />\n </div>\n )}\n <div id={titleId} className=\"ndl-tree-view-new-item-content-title\">\n {title}\n </div>\n {trailingContent && (\n <div className=\"ndl-tree-view-new-item-content-trailing-content\">\n {trailingContent}\n </div>\n )}\n {actionMenuItems && (\n <div\n className={classNames('ndl-tree-view-new-action', {\n 'ndl-tree-view-new-action--visible': isMenuOpen,\n })}\n >\n <CleanIconButton\n ref={actionButtonRef}\n size=\"small\"\n description={null}\n isDisabled={isDisabled}\n style={{ height: '24px', width: '24px' }}\n htmlAttributes={{\n 'aria-expanded': isMenuOpen || undefined,\n 'aria-haspopup': 'menu',\n 'aria-label': 'Actions',\n onClick: (event: React.MouseEvent) => {\n event.stopPropagation();\n didOpenViaKeyboard.current = false;\n setIsMenuOpen((prev) => !prev);\n },\n tabIndex: -1,\n }}\n >\n <EllipsisHorizontalIconOutline />\n </CleanIconButton>\n <Menu\n isOpen={isMenuOpen}\n anchorRef={actionButtonRef}\n onClose={handleMenuClose}\n {...actionMenuProps}\n >\n {actionMenuItems}\n </Menu>\n </div>\n )}\n </div>\n </div>\n );\n\n return (\n <>\n <ConditionalWrap\n shouldWrap={tooltipContent !== undefined && tooltipContent !== null}\n wrap={(children) => (\n <Tooltip\n type=\"simple\"\n hoverDelay={{ close: 0, open: 500 }}\n isDisabled={isMenuOpen}\n followCursor=\"initial\"\n {...tooltipProps?.root}\n >\n <Tooltip.Trigger hasButtonWrapper {...tooltipProps?.trigger}>\n {children}\n </Tooltip.Trigger>\n <Tooltip.Content {...tooltipProps?.content}>\n {tooltipContent}\n </Tooltip.Content>\n </Tooltip>\n )}\n >\n {itemElement}\n </ConditionalWrap>\n {hasChildren && (\n <TreeViewContext.Provider value={childContextValue}>\n <div\n role=\"group\"\n id={groupId}\n hidden={!isExpanded}\n style={{ '--tree-level': level - 1 } as React.CSSProperties}\n >\n {annotatedChildren}\n </div>\n </TreeViewContext.Provider>\n )}\n </>\n );\n};\n\ntype SkeletonItemProps = {\n /** The number of rows to render. */\n rows?: number;\n};\n\n/**\n * A skeleton placeholder for tree items that are being loaded. Renders one or\n * more `Skeleton` rows at the current nesting depth. The element is\n * `aria-hidden` since it is purely a visual indicator and not interactive.\n *\n * Typically used inside a `TreeView.Item` that has `isLoading` set, to give\n * the user a visual hint that child items are being fetched.\n *\n * @example\n * ```tsx\n * <TreeView.Item title=\"Lazy folder\" hasChildren isLoading isExpanded>\n * {isLoading && <TreeView.SkeletonItem rows={3} />}\n * </TreeView.Item>\n * ```\n */\nconst SkeletonItem = ({\n rows = 1,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', SkeletonItemProps>) => {\n const { level } = useContext(TreeViewContext);\n return (\n <div\n ref={ref}\n aria-hidden=\"true\"\n className={classNames('ndl-tree-view-new-skeleton', className)}\n style={{ '--tree-level': level - 1, ...style } as React.CSSProperties}\n {...htmlAttributes}\n {...restProps}\n >\n {Array.from({ length: rows }, (_unused, index) => (\n <Skeleton key={index} height=\"18px\" width=\"100%\" />\n ))}\n </div>\n );\n};\n\n/**\n * @remarks\n * Selection can be managed per item, with `isSelected` and `onSelectedChange`\n * on each `TreeView.Item`, or by the tree itself, by passing `selectedIds` (or\n * `defaultSelectedIds`) together with `onSelectedIdsChange`. When the tree\n * manages selection, every item needs an `id`, and each item's own\n * `isSelected` and `onSelectedChange` are ignored.\n *\n * The available selection modes are:\n *\n * - `single` — one item at a time. An unmodified click selects the clicked item and never clears it.\n * - `multiple` — multi-select with checkboxes. An unmodified click toggles an item, and `Shift` repeats that across a range without clearing anything outside it.\n * - `multiple-replace` — multi-select without checkboxes. An unmodified click selects only that item, `Cmd`/`Ctrl` toggles it and moves the anchor, and `Shift` extends from that anchor while retaining its selection snapshot. `Shift` + arrow extends the range.\n */\nconst TreeView = Object.assign(Root, { Item, SkeletonItem });\nexport { TreeView };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4QE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;CA2hBA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;CA+XA;CACA;CACA;CACA;CACA;;AAxnCF,MAAM,aAAa,KAAA;AAEnB,MAAM,8BAAkD,IAAI,IAAI;AAChE,MAAM,4BAAiC,IAAI,IAAI;AAC/C,MAAM,gBAA0B,CAAC;;;;;;;AAqBjC,SAAS,oBACP,cACe;CACf,IAAI,QAAA,sBAAA,QAAA;EACF,UAAU;EACV,WAAW;EACX,aAAa;CACV,GAAA,YACL;CACA,MAAM,4BAAY,IAAI,IAAgB;CACtC,OAAO;EACL,gBAAgB;EAChB,WAAW,YAAY;GACrB,QAAA,sBAAA,QAAA,sBAAA,QAAA,CAAA,GAAa,KAAA,GAAU,OAAQ;GAC/B,UAAU,SAAS,aAAa,SAAS,CAAC;EAC5C;EACA,YAAY,aAAa;GACvB,UAAU,IAAI,QAAQ;GACtB,aAAa;IACX,UAAU,OAAO,QAAQ;GAC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AAWH,WAAAA,QAAAA,CAAW,8BAA8B,SAAS;EAC7D,OAAA,sBAAA,QAAA,EAAS,gBAAgB,QAAQ,EAAA,GAAM,KAAM;CACzC,GAAA,cAAA,GACA,SAAA,GAAA,CAAA,GAAA,EAAA,UAEH,MAAM,KAAK,EAAE,QAAQ,KAAK,IAAI,SAAS,UACtC,iBAAA,GAAA,kBAAA,IAAA,CAACY,0BAAAA,UAAD;EAAsB,QAAO;EAAO,OAAM;CAAQ,GAAnC,KAAmC,CACnD,EAAA,CACE,CAAA;AAET;;;;;;;;;;;;;;;AAgBA,MAAM,WAAW,OAAO,OAAO,MAAM;CAAE;CAAM;AAAa,CAAC"}
1
+ {"version":3,"file":"TreeView.js","names":["createContext","isApplePlatform","Children","isValidElement","cloneElement","useRef","useMergeRefs","useState","useCallback","useSemicontrolledState","computeSelectionEdges","computeNextSelection","countChangedIds","formatSelectionAnnouncement","classNames","useMemo","useId","useContext","useSyncExternalStore","ChevronRightOutlineIcon","Checkbox","CleanIconButton","EllipsisHorizontalOutlineIcon","Menu","ConditionalWrap","Tooltip","Skeleton"],"sources":["../../../../src/next/tree-view/TreeView.tsx"],"sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { useMergeRefs } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport {\n Children,\n cloneElement,\n createContext,\n isValidElement,\n useCallback,\n useContext,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n useSyncExternalStore,\n} from 'react';\n\nimport { type CommonProps, type TooltipObjectProps } from '../../_common/types';\nimport { useSemicontrolledState } from '../../_common/use-semi-controlled-state';\nimport { needleWarningMessage } from '../../_common/utils';\nimport { Checkbox } from '../../checkbox';\nimport { CleanIconButton } from '../../clean-icon-button';\nimport { ConditionalWrap } from '../../conditional-wrap';\nimport { isApplePlatform } from '../../helpers/platform';\nimport ChevronRightOutlineIcon from '../../icons/generated/custom/ChevronRightOutline';\nimport EllipsisHorizontalOutlineIcon from '../../icons/generated/custom/EllipsisHorizontalOutline';\nimport { Menu } from '../../menu';\nimport { Skeleton } from '../../skeleton';\nimport { Tooltip } from '../../tooltip';\nimport {\n computeNextSelection,\n computeSelectionEdges,\n countChangedIds,\n formatSelectionAnnouncement,\n type SelectionAnchor,\n type SelectionEdge,\n type SelectionIntent,\n type SelectionMode,\n} from './selection';\n\ntype ItemEntry = {\n isDisabled: boolean;\n isSelectable: boolean;\n isSelected: boolean;\n onSelectedChange?: (isSelected: boolean) => void;\n parentId: string | null;\n toggleExpanded: () => void;\n};\n\ntype TreeViewContextValue = {\n isRootManaged: boolean;\n level: number;\n onSelectionIntent: (itemId: string, intent: SelectionIntent) => void;\n parentId: string | null;\n registerItem: (itemId: string, entry: ItemEntry | null) => void;\n selectionMode: SelectionMode;\n setFocusedId: (id: string | null) => void;\n store: TreeViewStore;\n};\n\nconst noop = () => undefined;\n\nconst EMPTY_EDGES: ReadonlyMap<string, SelectionEdge> = new Map();\nconst EMPTY_IDS: ReadonlySet<string> = new Set();\nconst EMPTY_ID_LIST: string[] = [];\n\ntype TreeViewStoreState = {\n edgeById: ReadonlyMap<string, SelectionEdge>;\n focusedId: string | null;\n /** Mirror of the selected ids; only meaningful when the root manages selection. */\n selectedIds: ReadonlySet<string>;\n};\n\ntype TreeViewStore = {\n getState: () => TreeViewStoreState;\n setState: (partial: Partial<TreeViewStoreState>) => void;\n subscribe: (listener: () => void) => () => void;\n};\n\n/**\n * Volatile per-interaction state (focus, root-managed selection, edge\n * styling) lives in this store instead of React context, so each item can\n * subscribe to its own primitive slice via `useSyncExternalStore` and an\n * interaction only re-renders the rows whose slice actually changed.\n */\nfunction createTreeViewStore(\n initialState?: Partial<TreeViewStoreState>,\n): TreeViewStore {\n let state: TreeViewStoreState = {\n edgeById: EMPTY_EDGES,\n focusedId: null,\n selectedIds: EMPTY_IDS,\n ...initialState,\n };\n const listeners = new Set<() => void>();\n return {\n getState: () => state,\n setState: (partial) => {\n state = { ...state, ...partial };\n listeners.forEach((listener) => listener());\n },\n subscribe: (listener) => {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n };\n}\n\nconst TREE_EVENTS = {\n action: 'treeitem-action',\n collapse: 'treeitem-collapse',\n expand: 'treeitem-expand',\n} as const;\n\nconst TreeViewContext = createContext<TreeViewContextValue>({\n isRootManaged: false,\n level: 1,\n onSelectionIntent: noop,\n parentId: null,\n registerItem: noop,\n selectionMode: 'single',\n setFocusedId: noop,\n store: createTreeViewStore(),\n});\n\n/**\n * On Apple platforms Ctrl+click is the context menu gesture, so only Cmd may\n * stand for an additive selection there.\n */\nfunction getSelectionIntent(\n event: React.KeyboardEvent | React.MouseEvent,\n): SelectionIntent {\n return {\n isRange: event.shiftKey,\n isToggle: isApplePlatform() ? event.metaKey : event.ctrlKey,\n };\n}\n\nfunction getVisibleTreeItems(root: HTMLElement): HTMLElement[] {\n return Array.from(\n root.querySelectorAll<HTMLElement>('[role=\"treeitem\"]'),\n ).filter((el) => {\n let parent = el.parentElement;\n while (parent && parent !== root) {\n if (parent.getAttribute('role') === 'group' && parent.hidden) {\n return false;\n }\n parent = parent.parentElement;\n }\n return true;\n });\n}\n\nfunction getVisibleItemIds(root: HTMLElement): string[] {\n return getVisibleTreeItems(root).map((el) => el.id);\n}\n\nfunction areIdSetsEqual(\n first: ReadonlySet<string>,\n second: ReadonlySet<string>,\n): boolean {\n if (first.size !== second.size) {\n return false;\n }\n for (const id of first) {\n if (!second.has(id)) {\n return false;\n }\n }\n return true;\n}\n\nfunction areEdgeMapsEqual(\n first: ReadonlyMap<string, SelectionEdge>,\n second: ReadonlyMap<string, SelectionEdge>,\n): boolean {\n if (first.size !== second.size) {\n return false;\n }\n for (const [id, edge] of first) {\n if (second.get(id) !== edge) {\n return false;\n }\n }\n return true;\n}\n\nfunction annotateTreeItems(children: React.ReactNode): React.ReactNode {\n const items = Children.toArray(children);\n const treeItemCount = items.filter(\n (child): child is React.ReactElement =>\n isValidElement(child) && child.type === Item,\n ).length;\n\n let posInSet = 0;\n return Children.map(children, (child) => {\n if (isValidElement(child) && child.type === Item) {\n posInSet++;\n return cloneElement(\n child as React.ReactElement<React.HTMLAttributes<HTMLElement>>,\n {\n 'aria-posinset': posInSet,\n 'aria-setsize': treeItemCount,\n },\n );\n }\n return child;\n });\n}\n\ntype RootProps = {\n /** The aria-label for the tree. Required for accessibility, unless using ariaLabelledby. Pass null to omit. */\n ariaLabel: string | null;\n /** The aria-labelledby for the tree. Pass a string of space-separated IDs of elements that label the tree. */\n ariaLabelledby?: string;\n /** The children of the tree. Should be TreeView.Item components or TreeView.SkeletonItem components only. */\n children?: React.ReactNode;\n /** Initially selected item ids for an uncontrolled root-managed selection. */\n defaultSelectedIds?: string[];\n /** Selected item ids. Makes the tree manage selection itself, instead of each item managing its own. */\n selectedIds?: string[];\n /** Selection mode for the tree. Defaults to \"single\". */\n selectionMode?: SelectionMode;\n /** Callback called with the complete next selection whenever the tree manages selection. Fires once per interaction. */\n onSelectedIdsChange?: (selectedIds: string[]) => void;\n};\n\n/**\n * Root container for a tree view. Renders a `role=\"tree\"` element with full\n * keyboard navigation (arrow keys, Home/End, Enter/Space) following the\n * WAI-ARIA TreeView pattern.\n *\n * Direct children should be `TreeView.Item` or `TreeView.SkeletonItem`.\n *\n * @example\n * ```tsx\n * <TreeView ariaLabel=\"Files\">\n * <TreeView.Item title=\"README.md\" onSelectedChange={setSelected} isSelected={selected} />\n * </TreeView>\n * ```\n *\n * @alpha - this component is still in development and may change in the future. It might not have feature parity with the old tree view yet.\n */\nconst Root = ({\n children,\n defaultSelectedIds,\n selectedIds: selectedIdsProp,\n selectionMode = 'single',\n ariaLabel,\n ariaLabelledby,\n className,\n style,\n htmlAttributes,\n onSelectedIdsChange,\n ref,\n ...restProps\n}: CommonProps<'div', RootProps>) => {\n const treeRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs([treeRef, ref]);\n const [announcement, setAnnouncement] = useState('');\n // While focus is inside the tree the root drops out of the tab order so\n // that Shift+Tab moves focus out of the tree instead of landing on the\n // root, which would delegate focus straight back to the item (a trap).\n const [isFocusWithin, setIsFocusWithin] = useState(false);\n const anchorRef = useRef<SelectionAnchor>(null);\n const entriesRef = useRef(new Map<string, ItemEntry>());\n\n const isRootManaged =\n selectedIdsProp !== undefined || defaultSelectedIds !== undefined;\n\n const storeRef = useRef<TreeViewStore>(null);\n if (storeRef.current === null) {\n storeRef.current = createTreeViewStore({\n selectedIds: new Set(\n selectedIdsProp ?? defaultSelectedIds ?? EMPTY_ID_LIST,\n ),\n });\n }\n const store = storeRef.current;\n\n const setFocusedId = useCallback(\n (id: string | null) => {\n if (store.getState().focusedId !== id) {\n store.setState({ focusedId: id });\n }\n },\n [store],\n );\n\n const [selectedIdList, setSelectedIdList] = useSemicontrolledState<string[]>({\n isControlled: selectedIdsProp !== undefined,\n onChange: onSelectedIdsChange,\n state: selectedIdsProp ?? defaultSelectedIds ?? EMPTY_ID_LIST,\n });\n\n // useSemicontrolledState recreates its setter whenever the value changes;\n // reading it through a ref keeps onSelectionIntent (and with it the\n // memoized context value) stable across selection changes.\n const setSelectedIdListRef = useRef(setSelectedIdList);\n useLayoutEffect(() => {\n setSelectedIdListRef.current = setSelectedIdList;\n });\n\n const readSelectedIds = useCallback((): Set<string> => {\n if (isRootManaged) {\n return new Set(store.getState().selectedIds);\n }\n const selected = new Set<string>();\n entriesRef.current.forEach((entry, itemId) => {\n if (entry.isSelected) {\n selected.add(itemId);\n }\n });\n return selected;\n }, [isRootManaged, store]);\n\n const readItemMaps = useCallback(() => {\n const parentIdById = new Map<string, string>();\n const selectableIds = new Set<string>();\n entriesRef.current.forEach((entry, itemId) => {\n if (entry.parentId !== null) {\n parentIdById.set(itemId, entry.parentId);\n }\n if (entry.isSelectable && !entry.isDisabled) {\n selectableIds.add(itemId);\n }\n });\n return { parentIdById, selectableIds };\n }, []);\n\n const recomputeEdges = useCallback(() => {\n const root = treeRef.current;\n const previousEdges = store.getState().edgeById;\n if (!root || selectionMode !== 'multiple-replace') {\n if (previousEdges.size > 0) {\n store.setState({ edgeById: EMPTY_EDGES });\n }\n return;\n }\n const selectedIds = readSelectedIds();\n if (selectedIds.size === 0 && previousEdges.size === 0) {\n return;\n }\n const nextEdges = computeSelectionEdges(\n getVisibleItemIds(root),\n selectedIds,\n );\n if (!areEdgeMapsEqual(previousEdges, nextEdges)) {\n store.setState({ edgeById: nextEdges });\n }\n }, [readSelectedIds, selectionMode, store]);\n\n const recomputeEdgesRef = useRef(recomputeEdges);\n useLayoutEffect(() => {\n recomputeEdgesRef.current = recomputeEdges;\n });\n\n // Debounced through a microtask so a commit that touches many items (mount,\n // expansion, range selection) triggers a single recompute, after all item\n // layout effects have registered and before the browser paints.\n const isEdgeRecomputeScheduledRef = useRef(false);\n const scheduleEdgeRecompute = useCallback(() => {\n if (isEdgeRecomputeScheduledRef.current) {\n return;\n }\n isEdgeRecomputeScheduledRef.current = true;\n queueMicrotask(() => {\n isEdgeRecomputeScheduledRef.current = false;\n recomputeEdgesRef.current();\n });\n }, []);\n\n const registerItem = useCallback(\n (itemId: string, entry: ItemEntry | null) => {\n if (entry === null) {\n entriesRef.current.delete(itemId);\n } else {\n entriesRef.current.set(itemId, entry);\n }\n // Covers item mount/unmount and expansion toggles (a collapsing parent\n // re-registers because its toggleExpanded callback is recreated).\n scheduleEdgeRecompute();\n },\n [scheduleEdgeRecompute],\n );\n\n const onSelectionIntent = useCallback(\n (itemId: string, intent: SelectionIntent) => {\n const root = treeRef.current;\n const entry = entriesRef.current.get(itemId);\n if (!root || !entry || entry.isDisabled) {\n return;\n }\n if (!entry.isSelectable) {\n entry.toggleExpanded();\n return;\n }\n\n const { parentIdById, selectableIds } = readItemMaps();\n const selectedIds = readSelectedIds();\n const result = computeNextSelection({\n anchor: anchorRef.current,\n intent,\n parentIdById,\n selectableIds,\n selectedIds,\n selectionMode,\n targetId: itemId,\n visibleIds: getVisibleItemIds(root),\n });\n anchorRef.current = result.anchor;\n\n const nextSelectedIds = result.selectedIds;\n const changedCount = countChangedIds(selectedIds, nextSelectedIds);\n\n if (isRootManaged) {\n if (changedCount > 0) {\n setSelectedIdListRef.current([...nextSelectedIds]);\n }\n } else if (selectionMode === 'single') {\n // Single mode leaves clearing the previously selected item to the\n // consumer, so only the clicked item is told about the change.\n if (!selectedIds.has(itemId)) {\n entry.onSelectedChange?.(true);\n }\n } else {\n entriesRef.current.forEach((itemEntry, id) => {\n const isSelected = nextSelectedIds.has(id);\n if (itemEntry.isSelected !== isSelected) {\n itemEntry.onSelectedChange?.(isSelected);\n }\n });\n }\n\n scheduleEdgeRecompute();\n\n if (selectionMode !== 'single') {\n setAnnouncement(\n intent.isRange\n ? formatSelectionAnnouncement(nextSelectedIds.size)\n : '',\n );\n }\n },\n [\n isRootManaged,\n readItemMaps,\n readSelectedIds,\n scheduleEdgeRecompute,\n selectionMode,\n ],\n );\n\n // Mirrors the root-managed selection into the store, so items subscribe to\n // their own slice and event handlers read it without a state dependency.\n useLayoutEffect(() => {\n const next = isRootManaged ? new Set(selectedIdList) : EMPTY_IDS;\n if (areIdSetsEqual(store.getState().selectedIds, next)) {\n return;\n }\n store.setState({ selectedIds: next });\n scheduleEdgeRecompute();\n }, [isRootManaged, scheduleEdgeRecompute, selectedIdList, store]);\n\n // Computes edges on mount and whenever the edge inputs change identity\n // (selection mode, root-managed flag). Interaction-driven recomputes go\n // through scheduleEdgeRecompute instead.\n useLayoutEffect(() => {\n recomputeEdges();\n }, [recomputeEdges]);\n\n const handleKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n const root = treeRef.current;\n if (!root) {\n return;\n }\n\n const items = getVisibleTreeItems(root);\n if (items.length === 0) {\n return;\n }\n\n const currentIndex = items.findIndex(\n (el) => el.id === store.getState().focusedId,\n );\n let isHandled = true;\n\n const extendRangeTo = (item: HTMLElement) => {\n if (selectionMode === 'single' || currentIndex < 0) {\n return;\n }\n const entry = entriesRef.current.get(item.id);\n if (!entry?.isSelectable || entry.isDisabled) {\n return;\n }\n if (anchorRef.current === null) {\n // A keyboard range has no preceding click to repeat, so it grows the\n // selection outwards from wherever focus already is.\n anchorRef.current = {\n baseSelectedIds: readSelectedIds(),\n id: items[currentIndex].id,\n isSelected: true,\n };\n }\n onSelectionIntent(item.id, { isRange: true, isToggle: false });\n };\n\n switch (event.key) {\n case 'ArrowDown': {\n const nextIndex =\n currentIndex < items.length - 1 ? currentIndex + 1 : currentIndex;\n const nextItem = items[nextIndex];\n if (nextItem) {\n if (event.shiftKey) {\n extendRangeTo(nextItem);\n }\n setFocusedId(nextItem.id);\n nextItem.focus();\n }\n break;\n }\n case 'ArrowUp': {\n const prevIndex = currentIndex > 0 ? currentIndex - 1 : 0;\n const prevItem = items[prevIndex];\n if (prevItem) {\n if (event.shiftKey) {\n extendRangeTo(prevItem);\n }\n setFocusedId(prevItem.id);\n prevItem.focus();\n }\n break;\n }\n case 'ArrowRight': {\n const current = currentIndex >= 0 ? items[currentIndex] : null;\n if (!current) {\n break;\n }\n const isExpanded = current.getAttribute('aria-expanded');\n if (isExpanded === 'false') {\n current.dispatchEvent(new CustomEvent(TREE_EVENTS.expand));\n } else if (isExpanded === 'true') {\n const nextIndex = currentIndex + 1;\n if (nextIndex < items.length) {\n const nextItem = items[nextIndex];\n setFocusedId(nextItem.id);\n nextItem.focus();\n }\n }\n break;\n }\n case 'ArrowLeft': {\n const current = currentIndex >= 0 ? items[currentIndex] : null;\n if (!current) {\n break;\n }\n const isExpanded = current.getAttribute('aria-expanded');\n if (isExpanded === 'true') {\n current.dispatchEvent(new CustomEvent(TREE_EVENTS.collapse));\n } else {\n const parentGroup = current.closest('[role=\"group\"]');\n if (parentGroup?.id) {\n const parentItem = root.querySelector<HTMLElement>(\n `[aria-owns=\"${parentGroup.id}\"]`,\n );\n if (parentItem) {\n setFocusedId(parentItem.id);\n parentItem.focus();\n }\n }\n }\n break;\n }\n case 'Home': {\n const first = items[0];\n if (first) {\n setFocusedId(first.id);\n first.focus();\n }\n break;\n }\n case 'End': {\n const last = items[items.length - 1];\n if (last) {\n setFocusedId(last.id);\n last.focus();\n }\n break;\n }\n case 'Enter':\n case ' ': {\n const current = currentIndex >= 0 ? items[currentIndex] : null;\n if (current) {\n onSelectionIntent(current.id, getSelectionIntent(event));\n }\n break;\n }\n case 'F10': {\n if (event.shiftKey) {\n const current = currentIndex >= 0 ? items[currentIndex] : null;\n if (current) {\n current.dispatchEvent(new CustomEvent(TREE_EVENTS.action));\n }\n } else {\n isHandled = false;\n }\n break;\n }\n default:\n isHandled = false;\n }\n\n if (isHandled) {\n event.preventDefault();\n event.stopPropagation();\n }\n },\n [onSelectionIntent, readSelectedIds, selectionMode, setFocusedId, store],\n );\n\n const handleFocus = useCallback(\n (event: React.FocusEvent<HTMLDivElement>) => {\n const root = treeRef.current;\n if (!root) {\n return;\n }\n\n setIsFocusWithin(true);\n\n if (event.target === root) {\n const items = getVisibleTreeItems(root);\n const { focusedId } = store.getState();\n const alreadyFocused = focusedId\n ? items.find((el) => el.id === focusedId)\n : null;\n const target = alreadyFocused ?? items[0];\n if (target) {\n setFocusedId(target.id);\n target.focus();\n }\n }\n },\n [setFocusedId, store],\n );\n\n const handleBlur = useCallback((event: React.FocusEvent<HTMLDivElement>) => {\n const root = treeRef.current;\n if (!root) {\n return;\n }\n if (\n !(event.relatedTarget instanceof Node) ||\n !root.contains(event.relatedTarget)\n ) {\n setIsFocusWithin(false);\n }\n }, []);\n\n const classes = classNames(className, 'ndl-tree-view-new', {\n 'ndl-tree-view-new--checkbox': selectionMode === 'multiple',\n });\n\n // Cached on children identity so Root-internal state commits (announcement,\n // uncontrolled selection) reuse the same annotated elements and React bails\n // out of the whole item subtree instead of re-rendering every row.\n const annotatedChildren = useMemo(\n () => annotateTreeItems(children),\n [children],\n );\n\n // Everything in here is stable or primitive, so items only re-render via\n // context when the tree's configuration changes, not per interaction.\n const contextValue = useMemo(\n () => ({\n isRootManaged,\n level: 1,\n onSelectionIntent,\n parentId: null,\n registerItem,\n selectionMode,\n setFocusedId,\n store,\n }),\n [\n isRootManaged,\n onSelectionIntent,\n registerItem,\n selectionMode,\n setFocusedId,\n store,\n ],\n );\n\n return (\n <TreeViewContext.Provider value={contextValue}>\n <div\n ref={mergedRef}\n role=\"tree\"\n aria-multiselectable={\n selectionMode === 'multiple' || selectionMode === 'multiple-replace'\n ? true\n : undefined\n }\n tabIndex={isFocusWithin ? -1 : 0}\n className={classes}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n onBlur={handleBlur}\n aria-label={ariaLabel ?? undefined}\n aria-labelledby={ariaLabelledby}\n style={style}\n {...htmlAttributes}\n {...restProps}\n >\n {annotatedChildren}\n </div>\n <div\n role=\"status\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n className=\"ndl-tree-view-new-live-region\"\n >\n {announcement}\n </div>\n </TreeViewContext.Provider>\n );\n};\n\ntype ItemProps = {\n /** Nested TreeView.Item or TreeView.SkeletonItem elements rendered as sub-items in a collapsible group. */\n children?: React.ReactNode;\n /** The label content displayed in the item row. */\n title?: React.ReactNode;\n /** Default expansion for uncontrolled items */\n isDefaultExpanded?: boolean;\n /** Whether the item has children. Decides if the item should render a chevron for expansion. Needed for lazy loading. */\n hasChildren?: boolean;\n /** Identifies the item. Required when the tree manages selection via `selectedIds`. */\n id?: string;\n /** Whether the item is disabled */\n isDisabled?: boolean;\n /** Whether the item is expanded. Makes the item controlled. */\n isExpanded?: boolean;\n /** Whether the item is in an indeterminate state. Only meaningful in multi-select mode for parent nodes. */\n isIndeterminate?: boolean;\n /** Whether the item is loading. Applies aria-busy=\"true\" to the item. */\n isLoading?: boolean;\n /** Whether the item can be selected. Defaults to true when the tree manages selection, and otherwise to whether `onSelectedChange` is set. */\n isSelectable?: boolean;\n /** Whether the item is selected. Ignored when the tree manages selection via `selectedIds`. */\n isSelected?: boolean;\n /** Leading visual for the item. */\n leadingVisual?: React.ReactNode;\n /** Trailing content for the item. Shown after the children but before the action menu. */\n trailingContent?: React.ReactNode;\n /** ReactNode containing Menu.Item elements to render in an action menu. When provided, an action button is rendered. */\n actionMenuItems?: React.ReactNode;\n /** Props forwarded to the Menu sub-components (anchorRef, onClose). */\n actionMenuProps?: React.ComponentProps<typeof Menu>;\n /** Content rendered inside the tooltip. When provided, the item is wrapped in a Tooltip. */\n tooltipContent?: React.ReactNode;\n /** Props forwarded to the Tooltip sub-components (root, trigger, content). */\n tooltipProps?: TooltipObjectProps;\n /** Callback called when the item is expanded/collapsed. */\n onExpandedChange?: (isExpanded: boolean) => void;\n /** Callback called when the item is selected/deselected. Receives the new selected state. Ignored when the tree manages selection via `selectedIds`. */\n onSelectedChange?: (isSelected: boolean) => void;\n};\n\n/**\n * A single item within a `TreeView`. Renders a `role=\"treeitem\"` element that\n * supports selection, expansion, leading/trailing visuals, and an action menu.\n *\n * The `title` prop provides the item's label content. Nesting `TreeView.Item`\n * elements as `children` creates a hierarchical tree structure.\n *\n * Supports both controlled (`isExpanded`) and uncontrolled (`isDefaultExpanded`)\n * expansion, as well as lazy loading via `hasChildren` + `isLoading`.\n *\n * @example\n * ```tsx\n * <TreeView.Item\n * title=\"src\"\n * leadingVisual={<FolderIcon />}\n * isSelected={selected}\n * onSelectedChange={setSelected}\n * >\n * <TreeView.Item title=\"index.ts\" />\n * </TreeView.Item>\n * ```\n */\nconst Item = ({\n actionMenuItems,\n children,\n isDefaultExpanded = false,\n hasChildren: hasChildrenProp,\n id: idProp,\n isDisabled,\n isExpanded: isExpandedProp,\n isIndeterminate,\n isLoading,\n isSelectable: isSelectableProp,\n isSelected: isSelectedProp,\n leadingVisual,\n title,\n tooltipContent,\n tooltipProps,\n trailingContent,\n onExpandedChange,\n onSelectedChange,\n actionMenuProps,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', ItemProps>) => {\n const generatedId = useId();\n const itemId = idProp ?? htmlAttributes?.id ?? `ndl-treeitem-${generatedId}`;\n const titleId = `ndl-treeitem-title-${generatedId}`;\n const groupId = `ndl-treegroup-${generatedId}`;\n const itemRef = useRef<HTMLDivElement>(null);\n const actionButtonRef = useRef<HTMLButtonElement>(null);\n const didOpenViaKeyboard = useRef(false);\n const [isMenuOpen, setIsMenuOpen] = useState(false);\n const treeViewContext = useContext(TreeViewContext);\n const {\n isRootManaged,\n level,\n onSelectionIntent,\n parentId,\n registerItem,\n selectionMode,\n setFocusedId,\n store,\n } = treeViewContext;\n\n // Primitive slices of the store, so Object.is bails out of re-renders for\n // rows whose focus/selection/edge state did not change.\n const isFocused = useSyncExternalStore(\n store.subscribe,\n () => store.getState().focusedId === itemId,\n () => store.getState().focusedId === itemId,\n );\n const isRootSelected = useSyncExternalStore(\n store.subscribe,\n () => store.getState().selectedIds.has(itemId),\n () => store.getState().selectedIds.has(itemId),\n );\n const edge = useSyncExternalStore(\n store.subscribe,\n () => store.getState().edgeById.get(itemId),\n () => store.getState().edgeById.get(itemId),\n );\n\n const isControlledExpansion = isExpandedProp !== undefined;\n const [isExpanded, setIsExpanded] = useSemicontrolledState({\n isControlled: isControlledExpansion,\n onChange: onExpandedChange,\n state: isExpandedProp ?? isDefaultExpanded,\n });\n\n const hasChildren = hasChildrenProp ?? Children.count(children) > 0;\n const isSelectable = isRootManaged\n ? (isSelectableProp ?? true)\n : (isSelectableProp ?? onSelectedChange !== undefined);\n const isSelected = isRootManaged ? isRootSelected : (isSelectedProp ?? false);\n const isMultiple = selectionMode === 'multiple';\n\n const toggleExpanded = useCallback(() => {\n if (isDisabled) {\n return;\n }\n if (hasChildren) {\n setIsExpanded(!isExpanded);\n }\n }, [isDisabled, hasChildren, setIsExpanded, isExpanded]);\n\n useLayoutEffect(() => {\n registerItem(itemId, {\n isDisabled: isDisabled ?? false,\n isSelectable,\n isSelected,\n onSelectedChange,\n parentId,\n toggleExpanded,\n });\n }, [\n isDisabled,\n isSelectable,\n isSelected,\n itemId,\n onSelectedChange,\n parentId,\n registerItem,\n toggleExpanded,\n ]);\n\n useLayoutEffect(() => {\n return () => registerItem(itemId, null);\n }, [itemId, registerItem]);\n\n useEffect(() => {\n if (!isRootManaged) {\n return;\n }\n if (idProp === undefined) {\n needleWarningMessage(\n 'TreeView.Item needs an `id` when the tree manages selection with `selectedIds`.',\n );\n }\n if (isSelectedProp !== undefined || onSelectedChange !== undefined) {\n needleWarningMessage(\n 'TreeView.Item `isSelected` and `onSelectedChange` are ignored when the tree manages selection with `selectedIds`.',\n );\n }\n }, [idProp, isRootManaged, isSelectedProp, onSelectedChange]);\n\n const handleClick = useCallback(\n (event: React.MouseEvent) => {\n if (isDisabled) {\n return;\n }\n setFocusedId(itemId);\n onSelectionIntent(itemId, getSelectionIntent(event));\n },\n [isDisabled, setFocusedId, itemId, onSelectionIntent],\n );\n\n const handleChevronClick = useCallback(\n (event: React.MouseEvent) => {\n event.stopPropagation();\n if (isDisabled) {\n return;\n }\n setFocusedId(itemId);\n toggleExpanded();\n },\n [isDisabled, setFocusedId, itemId, toggleExpanded],\n );\n\n const handleMenuClose = useCallback(() => {\n setIsMenuOpen(false);\n if (didOpenViaKeyboard.current) {\n itemRef.current?.focus();\n didOpenViaKeyboard.current = false;\n }\n }, []);\n\n const handleCustomEvents = useCallback(\n (event: Event) => {\n if (event.type === TREE_EVENTS.expand) {\n event.stopPropagation();\n if (hasChildren && !isExpanded && !isDisabled) {\n setIsExpanded(true);\n }\n } else if (event.type === TREE_EVENTS.collapse) {\n event.stopPropagation();\n if (hasChildren && isExpanded && !isDisabled) {\n setIsExpanded(false);\n }\n } else if (event.type === TREE_EVENTS.action) {\n event.stopPropagation();\n if (actionMenuItems && !isDisabled) {\n didOpenViaKeyboard.current = true;\n setIsMenuOpen(true);\n }\n }\n },\n [actionMenuItems, hasChildren, isExpanded, isDisabled, setIsExpanded],\n );\n\n const callbackRef = useCallback(\n (node: HTMLDivElement | null) => {\n const prev = itemRef.current;\n if (prev) {\n prev.removeEventListener(TREE_EVENTS.expand, handleCustomEvents);\n prev.removeEventListener(TREE_EVENTS.collapse, handleCustomEvents);\n prev.removeEventListener(TREE_EVENTS.action, handleCustomEvents);\n }\n (itemRef as React.MutableRefObject<HTMLDivElement | null>).current = node;\n if (node) {\n node.addEventListener(TREE_EVENTS.expand, handleCustomEvents);\n node.addEventListener(TREE_EVENTS.collapse, handleCustomEvents);\n node.addEventListener(TREE_EVENTS.action, handleCustomEvents);\n }\n },\n [handleCustomEvents],\n );\n\n const mergedRef = useMergeRefs([callbackRef, ref]);\n\n const selectionAriaProps = (() => {\n if (!isSelectable) {\n return {};\n }\n if (isMultiple) {\n return {\n 'aria-checked': isIndeterminate ? ('mixed' as const) : isSelected,\n };\n }\n return { 'aria-selected': isSelected };\n })();\n\n const edgeClass =\n edge === undefined ? undefined : `ndl-tree-view-new-item--selected-${edge}`;\n\n const childContextValue = useMemo(\n () => ({\n ...treeViewContext,\n level: treeViewContext.level + 1,\n parentId: itemId,\n }),\n [itemId, treeViewContext],\n );\n\n // Same caching as in Root: keeps child element identity stable across\n // renders of this item (selection, focus, expansion) so unchanged\n // descendants bail out of re-rendering.\n const annotatedChildren = useMemo(\n () => annotateTreeItems(children),\n [children],\n );\n\n const itemElement = (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events -- keyboard handled on tree root; aria-selected/aria-checked applied via spread\n <div\n ref={mergedRef}\n // eslint-disable-next-line jsx-a11y/role-has-required-aria-props -- aria-selected/aria-checked applied conditionally via spread\n role=\"treeitem\"\n {...selectionAriaProps}\n aria-expanded={hasChildren ? isExpanded : undefined}\n aria-owns={hasChildren ? groupId : undefined}\n aria-disabled={isDisabled || undefined}\n aria-busy={isLoading || undefined}\n aria-keyshortcuts={actionMenuItems ? 'Shift+F10' : undefined}\n aria-labelledby={titleId}\n aria-level={level}\n tabIndex={isFocused ? 0 : -1}\n className={classNames('ndl-tree-view-new-item', className, edgeClass, {\n 'ndl-tree-view-new-item--disabled': isDisabled,\n 'ndl-tree-view-new-item--parent': hasChildren,\n 'ndl-tree-view-new-item--selected': isSelected && isSelectable,\n })}\n style={{ '--tree-level': level - 1, ...style } as React.CSSProperties}\n onClick={(event) => {\n event.stopPropagation();\n handleClick(event);\n }}\n {...htmlAttributes}\n {...restProps}\n id={itemId}\n >\n <div\n className={classNames('ndl-tree-view-new-item-content', {\n 'ndl-tree-view-new-item-content--parent': hasChildren,\n })}\n >\n {hasChildren && (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions -- keyboard handled on tree root\n <span\n className=\"ndl-tree-view-new-chevron\"\n aria-disabled={isDisabled}\n onClick={handleChevronClick}\n >\n <ChevronRightOutlineIcon\n className={classNames('ndl-tree-view-new-chevron-icon', {\n 'ndl-tree-view-new-chevron-icon--open': isExpanded,\n })}\n />\n </span>\n )}\n {leadingVisual && (\n <div className=\"ndl-tree-view-new-item-content-leading-visual\">\n {leadingVisual}\n </div>\n )}\n {isMultiple && isSelectable && (\n <div className=\"ndl-tree-view-new-checkbox\" inert>\n <Checkbox\n style={{ borderWidth: '1.5px' }}\n ariaLabel=\"Select\"\n isChecked={isSelected}\n isIndeterminate={isIndeterminate}\n isDisabled={isDisabled}\n onChange={noop}\n />\n </div>\n )}\n <div id={titleId} className=\"ndl-tree-view-new-item-content-title\">\n {title}\n </div>\n {trailingContent && (\n <div className=\"ndl-tree-view-new-item-content-trailing-content\">\n {trailingContent}\n </div>\n )}\n {actionMenuItems && (\n <div\n className={classNames('ndl-tree-view-new-action', {\n 'ndl-tree-view-new-action--visible': isMenuOpen,\n })}\n >\n <CleanIconButton\n ref={actionButtonRef}\n size=\"small\"\n description={null}\n isDisabled={isDisabled}\n style={{ height: '24px', width: '24px' }}\n htmlAttributes={{\n 'aria-expanded': isMenuOpen || undefined,\n 'aria-haspopup': 'menu',\n 'aria-label': 'Actions',\n onClick: (event: React.MouseEvent) => {\n event.stopPropagation();\n didOpenViaKeyboard.current = false;\n setIsMenuOpen((prev) => !prev);\n },\n tabIndex: -1,\n }}\n >\n <EllipsisHorizontalOutlineIcon />\n </CleanIconButton>\n <Menu\n isOpen={isMenuOpen}\n anchorRef={actionButtonRef}\n onClose={handleMenuClose}\n {...actionMenuProps}\n >\n {actionMenuItems}\n </Menu>\n </div>\n )}\n </div>\n </div>\n );\n\n return (\n <>\n <ConditionalWrap\n shouldWrap={tooltipContent !== undefined && tooltipContent !== null}\n wrap={(children) => (\n <Tooltip\n type=\"simple\"\n hoverDelay={{ close: 0, open: 500 }}\n isDisabled={isMenuOpen}\n followCursor=\"initial\"\n {...tooltipProps?.root}\n >\n <Tooltip.Trigger hasButtonWrapper {...tooltipProps?.trigger}>\n {children}\n </Tooltip.Trigger>\n <Tooltip.Content {...tooltipProps?.content}>\n {tooltipContent}\n </Tooltip.Content>\n </Tooltip>\n )}\n >\n {itemElement}\n </ConditionalWrap>\n {hasChildren && (\n <TreeViewContext.Provider value={childContextValue}>\n <div\n role=\"group\"\n id={groupId}\n hidden={!isExpanded}\n style={{ '--tree-level': level - 1 } as React.CSSProperties}\n >\n {annotatedChildren}\n </div>\n </TreeViewContext.Provider>\n )}\n </>\n );\n};\n\ntype SkeletonItemProps = {\n /** The number of rows to render. */\n rows?: number;\n};\n\n/**\n * A skeleton placeholder for tree items that are being loaded. Renders one or\n * more `Skeleton` rows at the current nesting depth. The element is\n * `aria-hidden` since it is purely a visual indicator and not interactive.\n *\n * Typically used inside a `TreeView.Item` that has `isLoading` set, to give\n * the user a visual hint that child items are being fetched.\n *\n * @example\n * ```tsx\n * <TreeView.Item title=\"Lazy folder\" hasChildren isLoading isExpanded>\n * {isLoading && <TreeView.SkeletonItem rows={3} />}\n * </TreeView.Item>\n * ```\n */\nconst SkeletonItem = ({\n rows = 1,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', SkeletonItemProps>) => {\n const { level } = useContext(TreeViewContext);\n return (\n <div\n ref={ref}\n aria-hidden=\"true\"\n className={classNames('ndl-tree-view-new-skeleton', className)}\n style={{ '--tree-level': level - 1, ...style } as React.CSSProperties}\n {...htmlAttributes}\n {...restProps}\n >\n {Array.from({ length: rows }, (_unused, index) => (\n <Skeleton key={index} height=\"24px\" width=\"100%\" />\n ))}\n </div>\n );\n};\n\n/**\n * @remarks\n * Selection can be managed per item, with `isSelected` and `onSelectedChange`\n * on each `TreeView.Item`, or by the tree itself, by passing `selectedIds` (or\n * `defaultSelectedIds`) together with `onSelectedIdsChange`. When the tree\n * manages selection, every item needs an `id`, and each item's own\n * `isSelected` and `onSelectedChange` are ignored.\n *\n * The available selection modes are:\n *\n * - `single` — one item at a time. An unmodified click selects the clicked item and never clears it.\n * - `multiple` — multi-select with checkboxes. An unmodified click toggles an item, and `Shift` repeats that across a range without clearing anything outside it.\n * - `multiple-replace` — multi-select without checkboxes. An unmodified click selects only that item, `Cmd`/`Ctrl` toggles it and moves the anchor, and `Shift` extends from that anchor while retaining its selection snapshot. `Shift` + arrow extends the range.\n */\nconst TreeView = Object.assign(Root, { Item, SkeletonItem });\nexport { TreeView };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4QE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;CA2hBA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;CA+XA;CACA;CACA;CACA;CACA;;AAxnCF,MAAM,aAAa,KAAA;AAEnB,MAAM,8BAAkD,IAAI,IAAI;AAChE,MAAM,4BAAiC,IAAI,IAAI;AA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AAO,EAAE,gBAAgB,QAAQ,EAAE;GAElC,UAAA;EACE,CAAA;CACmB,CAAA,CAE5B,EAAA,CAAA;AAEN;;;;;;;;;;;;;;;;AAsBA,MAAM,gBAAgB,UAOuB;CAPvB,IAAA,EACpB,OAAO,GACP,WACA,OACA,gBACA,QAAA,OACG,YAAA,gCAAA,QAAA,OAAA,UAAA;CAEH,MAAM,EAAE,WAAA,GAAUR,MAAAA,WAAAA,CAAW,eAAe;CAC5C,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAA,sBAAA,QAAA,sBAAA,QAAA,sBAAA,QAAA;EACM;EACL,eAAY;EACZ,YAAA,GAAWH,WAAAA,QAAAA,CAAW,8BAA8B,SAAS;EAC7D,OAAA,sBAAA,QAAA,EAAS,gBAAgB,QAAQ,EAAA,GAAM,KAAM;CACzC,GAAA,cAAA,GACA,SAAA,GAAA,CAAA,GAAA,EAAA,UAEH,MAAM,KAAK,EAAE,QAAQ,KAAK,IAAI,SAAS,UACtC,iBAAA,GAAA,kBAAA,IAAA,CAACY,0BAAAA,UAAD;EAAsB,QAAO;EAAO,OAAM;CAAQ,GAAnC,KAAmC,CACnD,EAAA,CACE,CAAA;AAET;;;;;;;;;;;;;;;AAgBA,MAAM,WAAW,OAAO,OAAO,MAAM;CAAE;CAAM;AAAa,CAAC"}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ const require_hooks_use_debounce_callback_index = require("../hooks/use-debounce-callback/index.js");
7
+ const require_icons_generated_custom_MagnifyingGlassOutline = require("../icons/generated/custom/MagnifyingGlassOutline.js");
8
+ const require_text_input_TextInput = require("../text-input/TextInput.js");
9
+ const require_objectWithoutProperties = require("../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutProperties.js");
10
+ const require_objectSpread2 = require("../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectSpread2.js");
11
+ let react = require("react");
12
+ let react_jsx_runtime = require("react/jsx-runtime");
13
+ // src/search-field/SearchField.tsx
14
+ /*!
15
+ *
16
+ * Copyright (c) "Neo4j"
17
+ * Neo4j Sweden AB [http://neo4j.com]
18
+ *
19
+ * This file is part of Neo4j.
20
+ *
21
+ * Neo4j is free software: you can redistribute it and/or modify
22
+ * it under the terms of the GNU General Public License as published by
23
+ * the Free Software Foundation, either version 3 of the License, or
24
+ * (at your option) any later version.
25
+ *
26
+ * This program is distributed in the hope that it will be useful,
27
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
28
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29
+ * GNU General Public License for more details.
30
+ *
31
+ * You should have received a copy of the GNU General Public License
32
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
33
+ */
34
+ const _excluded = [
35
+ "debounceDelay",
36
+ "htmlAttributes",
37
+ "label",
38
+ "onChange",
39
+ "onSearch"
40
+ ];
41
+ /**
42
+ * A text input for entering search queries.
43
+ *
44
+ * @remarks
45
+ * SearchField renders a fixed search icon and uses the native `search` input
46
+ * type. `onChange` is called immediately, while `onSearch` is debounced until
47
+ * typing pauses. Pressing Enter or clearing the field calls `onSearch`
48
+ * immediately.
49
+ */
50
+ const SearchField = (_ref) => {
51
+ let { debounceDelay = 500, htmlAttributes, label, onChange, onSearch } = _ref, textInputProps = require_objectWithoutProperties.default(_ref, _excluded);
52
+ const debouncedSearch = require_hooks_use_debounce_callback_index.useDebounceCallback((query) => {
53
+ onSearch === null || onSearch === void 0 || onSearch(query);
54
+ }, debounceDelay);
55
+ const handleChange = (0, react.useCallback)((event) => {
56
+ onChange === null || onChange === void 0 || onChange(event);
57
+ const query = event.target.value;
58
+ if (query === "") {
59
+ debouncedSearch.cancel();
60
+ onSearch === null || onSearch === void 0 || onSearch("");
61
+ return;
62
+ }
63
+ debouncedSearch(query);
64
+ }, [
65
+ debouncedSearch,
66
+ onChange,
67
+ onSearch
68
+ ]);
69
+ const handleKeyDown = (0, react.useCallback)((event) => {
70
+ var _htmlAttributes$onKey;
71
+ htmlAttributes === null || htmlAttributes === void 0 || (_htmlAttributes$onKey = htmlAttributes.onKeyDown) === null || _htmlAttributes$onKey === void 0 || _htmlAttributes$onKey.call(htmlAttributes, event);
72
+ if (event.key === "Enter" && !event.defaultPrevented && !event.nativeEvent.isComposing) {
73
+ if (debouncedSearch.isPending()) debouncedSearch.flush();
74
+ else onSearch === null || onSearch === void 0 || onSearch(event.currentTarget.value);
75
+ }
76
+ }, [
77
+ debouncedSearch,
78
+ htmlAttributes,
79
+ onSearch
80
+ ]);
81
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_text_input_TextInput.TextInput, require_objectSpread2.default(require_objectSpread2.default({}, textInputProps), {}, {
82
+ htmlAttributes: require_objectSpread2.default(require_objectSpread2.default({}, htmlAttributes), {}, {
83
+ "aria-label": label,
84
+ onKeyDown: handleKeyDown,
85
+ type: "search"
86
+ }),
87
+ isClearable: true,
88
+ leadingElement: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_generated_custom_MagnifyingGlassOutline.default, {}),
89
+ onChange: handleChange
90
+ }));
91
+ };
92
+ exports.SearchField = SearchField;
93
+
94
+ //# sourceMappingURL=SearchField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SearchField.js","names":["useDebounceCallback","useCallback","TextInput","MagnifyingGlassOutlineIcon"],"sources":["../../../src/search-field/SearchField.tsx"],"sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { type ChangeEvent, type ComponentProps, useCallback } from 'react';\n\nimport { useDebounceCallback } from '../hooks/use-debounce-callback';\nimport MagnifyingGlassOutlineIcon from '../icons/generated/custom/MagnifyingGlassOutline';\nimport { TextInput } from '../text-input';\n\ntype SearchFieldTextInputProps = Pick<\n ComponentProps<typeof TextInput>,\n | 'className'\n | 'errorText'\n | 'helpText'\n | 'htmlAttributes'\n | 'isDisabled'\n | 'isFluid'\n | 'isLoading'\n | 'isReadOnly'\n | 'isSkeletonLoading'\n | 'onChange'\n | 'placeholder'\n | 'ref'\n | 'size'\n | 'skeletonProps'\n | 'style'\n | 'value'\n>;\n\nexport type SearchFieldProps = SearchFieldTextInputProps & {\n /**\n * Accessible name for the search field. The label is announced by assistive\n * technologies but is not rendered visually.\n */\n label: string;\n\n /**\n * Called with the search query after typing pauses for `debounceDelay`, and\n * immediately when the user presses Enter or clears the field.\n */\n onSearch?: (query: string) => void;\n\n /**\n * Delay in milliseconds before calling `onSearch` after the query changes.\n * @default 500\n */\n debounceDelay?: number;\n};\n\n/**\n * A text input for entering search queries.\n *\n * @remarks\n * SearchField renders a fixed search icon and uses the native `search` input\n * type. `onChange` is called immediately, while `onSearch` is debounced until\n * typing pauses. Pressing Enter or clearing the field calls `onSearch`\n * immediately.\n */\nexport const SearchField = ({\n debounceDelay = 500,\n htmlAttributes,\n label,\n onChange,\n onSearch,\n ...textInputProps\n}: SearchFieldProps) => {\n const debouncedSearch = useDebounceCallback((query: string) => {\n onSearch?.(query);\n }, debounceDelay);\n\n const handleChange = useCallback(\n (event: ChangeEvent<HTMLInputElement>) => {\n onChange?.(event);\n\n const query = event.target.value;\n if (query === '') {\n debouncedSearch.cancel();\n onSearch?.('');\n return;\n }\n\n debouncedSearch(query);\n },\n [debouncedSearch, onChange, onSearch],\n );\n\n const handleKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n htmlAttributes?.onKeyDown?.(event);\n\n if (\n event.key === 'Enter' &&\n !event.defaultPrevented &&\n !event.nativeEvent.isComposing\n ) {\n if (debouncedSearch.isPending()) {\n debouncedSearch.flush();\n } else {\n onSearch?.(event.currentTarget.value);\n }\n }\n },\n [debouncedSearch, htmlAttributes, onSearch],\n );\n\n return (\n <TextInput\n {...textInputProps}\n htmlAttributes={{\n ...htmlAttributes,\n 'aria-label': label,\n onKeyDown: handleKeyDown,\n type: 'search',\n }}\n isClearable\n leadingElement={<MagnifyingGlassOutlineIcon />}\n onChange={handleChange}\n />\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6EE;CACA;CACA;CACA;CACA;;;;;;;;;;;AALF,MAAa,eAAe,SAOJ;CAPI,IAAA,EAC1B,gBAAgB,KAChB,gBACA,OACA,UACA,aAAA,MACG,iBAAA,gCAAA,QAAA,MAAA,SAAA;CAEH,MAAM,kBAAkBA,0CAAAA,qBAAqB,UAAkB;EAC7D,aAAA,QAAA,aAAA,KAAA,KAAA,SAAW,KAAK;CAClB,GAAG,aAAa;CAEhB,MAAM,gBAAA,GAAeC,MAAAA,YAAAA,EAClB,UAAyC;EACxC,aAAA,QAAA,aAAA,KAAA,KAAA,SAAW,KAAK;EAEhB,MAAM,QAAQ,MAAM,OAAO;EAC3B,IAAI,UAAU,IAAI;GAChB,gBAAgB,OAAO;GACvB,aAAA,QAAA,aAAA,KAAA,KAAA,SAAW,EAAE;GACb;EACF;EAEA,gBAAgB,KAAK;CACvB,GACA;EAAC;EAAiB;EAAU;CAAQ,CACtC;CAEA,MAAM,iBAAA,GAAgBA,MAAAA,YAAAA,EACnB,UAAiD;;EAChD,mBAAA,QAAA,mBAAA,KAAA,MAAA,wBAAA,eAAgB,eAAA,QAAA,0BAAA,KAAA,KAAA,sBAAA,KAAA,gBAAY,KAAK;EAEjC,IACE,MAAM,QAAQ,WACd,CAAC,MAAM,oBACP,CAAC,MAAM,YAAY,aACnB;GACA,IAAI,gBAAgB,UAAU,GAC5B,gBAAgB,MAAM;QAEtB,aAAA,QAAA,aAAA,KAAA,KAAA,SAAW,MAAM,cAAc,KAAK;EAExC;CACF,GACA;EAAC;EAAiB;EAAgB;CAAQ,CAC5C;CAEA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,6BAAAA,WAAAA,sBAAAA,QAAAA,sBAAAA,QAAAA,CAAAA,GACK,cAAA,GAAA,CAAA,GAAA;EACJ,gBAAA,sBAAA,QAAA,sBAAA,QAAA,CAAA,GACK,cAAA,GAAA,CAAA,GAAA;GACH,cAAc;GACd,WAAW;GACX,MAAM;EACR,CAAA;EACA,aAAA;EACA,gBAAgB,iBAAA,GAAA,kBAAA,IAAA,CAACC,sDAAAA,SAAD,CAA6B,CAAA;EAC7C,UAAU;CACX,CAAA,CAAA;AAEL"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, {
3
+ __esModule: { value: true },
4
+ [Symbol.toStringTag]: { value: "Module" }
5
+ });
6
+ const require_search_field_SearchField = require("./SearchField.js");
7
+ // src/search-field/index.ts
8
+ /*!
9
+ *
10
+ * Copyright (c) "Neo4j"
11
+ * Neo4j Sweden AB [http://neo4j.com]
12
+ *
13
+ * This file is part of Neo4j.
14
+ *
15
+ * Neo4j is free software: you can redistribute it and/or modify
16
+ * it under the terms of the GNU General Public License as published by
17
+ * the Free Software Foundation, either version 3 of the License, or
18
+ * (at your option) any later version.
19
+ *
20
+ * This program is distributed in the hope that it will be useful,
21
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ * GNU General Public License for more details.
24
+ *
25
+ * You should have received a copy of the GNU General Public License
26
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
27
+ */
28
+ exports.SearchField = require_search_field_SearchField.SearchField;
29
+
30
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/search-field/index.ts"],"sourcesContent":["/*!\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport * from './SearchField';\n"],"mappings":""}
@@ -82,7 +82,7 @@ const TextInput = (_ref) => {
82
82
  state: value !== null && value !== void 0 ? value : ""
83
83
  });
84
84
  const hintId = (0, react.useId)();
85
- const canClear = isClearable && isDisabled !== true;
85
+ const canClear = isClearable && isDisabled !== true && isReadOnly !== true;
86
86
  const shouldRenderHint = canClear || isLoading;
87
87
  const { field, controlProps } = require__common_form_control_use_form_field.useFormField({
88
88
  errorText,