@neo4j-ndl/react 5.7.0 → 5.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/breadcrumbs/Breadcrumbs.js +2 -2
- package/lib/cjs/breadcrumbs/Breadcrumbs.js.map +1 -1
- package/lib/cjs/next/tree-view/TreeView.js +5 -5
- package/lib/cjs/next/tree-view/TreeView.js.map +1 -1
- package/lib/esm/breadcrumbs/Breadcrumbs.mjs +2 -2
- package/lib/esm/breadcrumbs/Breadcrumbs.mjs.map +1 -1
- package/lib/esm/next/tree-view/TreeView.mjs +5 -5
- package/lib/esm/next/tree-view/TreeView.mjs.map +1 -1
- package/package.json +2 -2
- package/skills/ndl-react/SKILL.md +2 -2
|
@@ -4,7 +4,7 @@ Object.defineProperties(exports, {
|
|
|
4
4
|
[Symbol.toStringTag]: { value: "Module" }
|
|
5
5
|
});
|
|
6
6
|
const require_runtime = require("../_virtual/_rolldown/runtime.js");
|
|
7
|
-
const
|
|
7
|
+
const require_icons_generated_custom_ChevronDownSmallOutline = require("../icons/generated/custom/ChevronDownSmallOutline.js");
|
|
8
8
|
const require_tooltip_Tooltip = require("../tooltip/Tooltip.js");
|
|
9
9
|
const require_objectWithoutProperties = require("../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutProperties.js");
|
|
10
10
|
const require_objectSpread2 = require("../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectSpread2.js");
|
|
@@ -166,7 +166,7 @@ const BreadcrumbsSelectButton = (_ref4) => {
|
|
|
166
166
|
onClick,
|
|
167
167
|
"aria-label": ariaLabel,
|
|
168
168
|
"aria-pressed": isActive
|
|
169
|
-
}, htmlAttributes), restProps), {}, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
169
|
+
}, htmlAttributes), restProps), {}, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_generated_custom_ChevronDownSmallOutline.default, { className: "ndl-breadcrumbs-chevron" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
170
170
|
className: "ndl-breadcrumbs-button-content",
|
|
171
171
|
children
|
|
172
172
|
})] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumbs.js","names":["classNames","createContext","useContext","useState","useRef","Tooltip","ChevronDownIconOutline"],"sources":["../../../src/breadcrumbs/Breadcrumbs.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 classNames from 'classnames';\nimport type React from 'react';\nimport { createContext, useContext, useRef, useState } from 'react';\n\nimport {\n type CommonProps,\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { ChevronDownIconOutline } from '../icons/generated/heroIcons/ChevronDownIconOutline';\nimport { Tooltip } from '../tooltip';\n\ntype BreadcrumbsProps = {\n /** Content to be rendered. Should only be `Breadcrumbs.Item`. */\n children?: React.ReactNode;\n /** Additional classnames. */\n shouldWrap?: boolean;\n};\n\nconst BreadcrumbsComponent = ({\n children,\n className,\n htmlAttributes,\n style,\n ref,\n shouldWrap = true,\n ...restProps\n}: CommonProps<'nav', BreadcrumbsProps>) => {\n const classes = classNames('ndl-breadcrumbs', className);\n const listClasses = classNames('ndl-breadcrumbs-list', {\n 'ndl-breadcrumbs-wrap': shouldWrap,\n });\n return (\n <nav\n aria-label=\"Breadcrumb\"\n ref={ref}\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <ol className={listClasses}>{children}</ol>\n </nav>\n );\n};\n\ntype BreadcrumbsItemContextType = {\n isInBreadcrumbsItem: boolean;\n};\n\nconst BreadcrumbsItemContext = createContext<BreadcrumbsItemContextType | null>(\n null,\n);\n\nexport const useBreadcrumbsItemContext = (): BreadcrumbsItemContextType => {\n const context = useContext(BreadcrumbsItemContext);\n if (!context) {\n throw new Error('This component must be used within a <Breadcrumbs.Item>');\n }\n\n return context;\n};\n\ntype BreadcrumbsItemProps = {\n /** Content to be rendered. Should be either `Breadcrumbs.Link`, `Breadcrumbs.Button` or `Breadcrumbs.SelectButton`. */\n children?: React.ReactNode;\n};\n\nconst BreadcrumbsItem = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'li', BreadcrumbsItemProps>) => {\n const classes = classNames('ndl-breadcrumbs-item', className);\n\n return (\n <BreadcrumbsItemContext.Provider value={{ isInBreadcrumbsItem: true }}>\n <li\n ref={ref}\n className={classes}\n style={style}\n {...htmlAttributes}\n {...restProps}\n >\n <div className=\"ndl-breadcrumbs-item-inner\">{children}</div>\n </li>\n </BreadcrumbsItemContext.Provider>\n );\n};\n\ntype InteractiveBreadcrumbProps = {\n /** Content to be rendered. */\n children?: React.ReactNode;\n} & (\n | {\n as: 'button';\n /**\n * Event handler for when the button is clicked. Only applicable if `as` is `'button'`.\n */\n onClick?: (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => void;\n }\n | {\n as: 'a';\n /**\n * The href of the link. Only applicable if `as` is `'a'`.\n */\n href: HtmlAttributes<'a'>['href'];\n /**\n * The target of the link. Only applicable if `as` is `'a'`.\n */\n target?: HtmlAttributes<'a'>['target'];\n }\n | {\n /**\n * What HTML element to render the root element as.\n */\n as?: React.ElementType;\n }\n);\n\ntype BreadcrumbsButtonProps = InteractiveBreadcrumbProps & {\n /** Leading element to be rendered. */\n leadingElement?: React.ReactNode;\n /** Trailing element to be rendered. */\n trailingElement?: React.ReactNode;\n};\n\nconst BreadcrumbsButton = <T extends React.ElementType = 'button'>({\n children,\n as,\n className,\n style,\n htmlAttributes,\n ref,\n leadingElement,\n trailingElement,\n ...restProps\n}: PolymorphicCommonProps<T, BreadcrumbsButtonProps>) => {\n useBreadcrumbsItemContext();\n\n const [isTooltipOpen, setIsTooltipOpen] = useState(false);\n const contentRef = useRef<HTMLDivElement>(null);\n const Component: React.ElementType = as ?? 'button';\n\n const classes = classNames(\n 'ndl-breadcrumbs-button ndl-breadcrumbs-sibling-hover',\n className,\n );\n\n return (\n <Tooltip\n type=\"simple\"\n isOpen={isTooltipOpen}\n onOpenChange={(isOpen) => {\n if (isOpen) {\n const isTruncated =\n contentRef.current?.scrollWidth &&\n contentRef.current?.clientWidth &&\n contentRef.current.scrollWidth > contentRef.current.clientWidth;\n const isVisible =\n contentRef.current?.offsetWidth &&\n contentRef.current?.offsetHeight &&\n contentRef.current.offsetWidth > 0 &&\n contentRef.current.offsetHeight > 0;\n setIsTooltipOpen(isTruncated || !isVisible);\n } else {\n setIsTooltipOpen(false);\n }\n }}\n >\n <Tooltip.Trigger hasButtonWrapper>\n <Component\n ref={ref}\n className={classes}\n style={style}\n {...htmlAttributes}\n {...restProps}\n >\n {Boolean(leadingElement) && (\n <div className=\"ndl-breadcrumbs-button-leading-element\">\n {leadingElement}\n </div>\n )}\n <div className=\"ndl-breadcrumbs-button-content\" ref={contentRef}>\n {children}\n </div>\n {Boolean(trailingElement) && (\n <div className=\"ndl-breadcrumbs-button-trailing-element\">\n {trailingElement}\n </div>\n )}\n </Component>\n </Tooltip.Trigger>\n <Tooltip.Content>{children}</Tooltip.Content>\n </Tooltip>\n );\n};\n\ntype BreadcrumbsSelectButtonProps = {\n /** Event handler for when the button is clicked. Should be used to open a `Menu`. */\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /** Aria label needed for accessibility. */\n ariaLabel: string;\n /** Content to be rendered. */\n children?: React.ReactNode;\n /** Active - used when a connected menu is open */\n isActive?: boolean;\n};\n\nconst BreadcrumbsSelectButton = ({\n onClick,\n children,\n isActive,\n className,\n style,\n htmlAttributes,\n ariaLabel,\n ref,\n ...restProps\n}: CommonProps<'button', BreadcrumbsSelectButtonProps>) => {\n useBreadcrumbsItemContext();\n\n const classes = classNames(\n 'ndl-breadcrumbs-button ndl-breadcrumbs-sibling-hover ndl-breadcrumbs-select',\n className,\n {\n 'ndl-active': Boolean(isActive),\n },\n );\n\n return (\n <button\n type=\"button\"\n ref={ref}\n className={classes}\n style={style}\n onClick={onClick}\n aria-label={ariaLabel}\n aria-pressed={isActive}\n {...htmlAttributes}\n {...restProps}\n >\n <ChevronDownIconOutline className=\"ndl-breadcrumbs-chevron\" />\n <div className=\"ndl-breadcrumbs-button-content\">{children}</div>\n </button>\n );\n};\n\ntype BreadcrumbsLinkProps = InteractiveBreadcrumbProps & {\n /**\n * Whether the link is the current item. Use `'page'` if it indicates the current page and `'step'` for steps (in a multi-step wizard for example).\n * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current\n */\n ariaCurrent?: React.AriaAttributes['aria-current'];\n};\n\nconst BreadcrumbsLink = <T extends React.ElementType = 'a'>({\n children,\n as,\n className,\n style,\n htmlAttributes,\n ariaCurrent = false,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, BreadcrumbsLinkProps>) => {\n useBreadcrumbsItemContext();\n\n const Component: React.ElementType = as ?? 'a';\n\n const classes = classNames(\n 'ndl-breadcrumbs-link',\n {\n 'ndl-breadcrumbs-link-current': Boolean(ariaCurrent),\n },\n className,\n );\n\n return (\n <Component\n ref={ref}\n className={classes}\n style={style}\n aria-current={ariaCurrent}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst Breadcrumbs = Object.assign(BreadcrumbsComponent, {\n Button: BreadcrumbsButton,\n Item: BreadcrumbsItem,\n Link: BreadcrumbsLink,\n SelectButton: BreadcrumbsSelectButton,\n});\n\nexport { Breadcrumb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,OAAD;EAAK,WAAU;EAAkC;CAAc,CAAA,CACzD,EAAA,CAAA,CAAA;AAEZ;AAUA,MAAM,mBAAsD,UASL;CATK,IAAA,EAC1D,UACA,IACA,WACA,OACA,gBACA,cAAc,OACd,QAAA,OACG,YAAA,gCAAA,QAAA,OAAA,UAAA;CAEH,0BAA0B;CAE1B,MAAM,YAA+B,OAAA,QAAA,OAAA,KAAA,IAAA,KAAM;CAE3C,MAAM,WAAA,GAAUN,WAAAA,QAAAA,CACd,wBACA,EACE,gCAAgC,QAAQ,WAAW,EACrD,GACA,SACF;CAEA,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,WAAA,sBAAA,QAAA,sBAAA,QAAA,sBAAA,QAAA;EACM;EACL,WAAW;EACJ;EACP,gBAAc;CACV,GAAA,SAAA,GACA,cAAA,GAAA,CAAA,GAAA,EAEH,SAAA,CACQ,CAAA;AAEf;AAEA,MAAM,cAAc,OAAO,OAAO,sBAAsB;CACtD,QAAQ;CACR,MAAM;CACN,MAAM;CACN,cAAc;AAChB,CAAC"}
|
|
1
|
+
{"version":3,"file":"Breadcrumbs.js","names":["classNames","createContext","useContext","useState","useRef","Tooltip","ChevronDownSmallOutlineIcon"],"sources":["../../../src/breadcrumbs/Breadcrumbs.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 classNames from 'classnames';\nimport type React from 'react';\nimport { createContext, useContext, useRef, useState } from 'react';\n\nimport {\n type CommonProps,\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { ChevronDownSmallOutlineIcon } from '../icons/generated/custom';\nimport { Tooltip } from '../tooltip';\n\ntype BreadcrumbsProps = {\n /** Content to be rendered. Should only be `Breadcrumbs.Item`. */\n children?: React.ReactNode;\n /** Additional classnames. */\n shouldWrap?: boolean;\n};\n\nconst BreadcrumbsComponent = ({\n children,\n className,\n htmlAttributes,\n style,\n ref,\n shouldWrap = true,\n ...restProps\n}: CommonProps<'nav', BreadcrumbsProps>) => {\n const classes = classNames('ndl-breadcrumbs', className);\n const listClasses = classNames('ndl-breadcrumbs-list', {\n 'ndl-breadcrumbs-wrap': shouldWrap,\n });\n return (\n <nav\n aria-label=\"Breadcrumb\"\n ref={ref}\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <ol className={listClasses}>{children}</ol>\n </nav>\n );\n};\n\ntype BreadcrumbsItemContextType = {\n isInBreadcrumbsItem: boolean;\n};\n\nconst BreadcrumbsItemContext = createContext<BreadcrumbsItemContextType | null>(\n null,\n);\n\nexport const useBreadcrumbsItemContext = (): BreadcrumbsItemContextType => {\n const context = useContext(BreadcrumbsItemContext);\n if (!context) {\n throw new Error('This component must be used within a <Breadcrumbs.Item>');\n }\n\n return context;\n};\n\ntype BreadcrumbsItemProps = {\n /** Content to be rendered. Should be either `Breadcrumbs.Link`, `Breadcrumbs.Button` or `Breadcrumbs.SelectButton`. */\n children?: React.ReactNode;\n};\n\nconst BreadcrumbsItem = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'li', BreadcrumbsItemProps>) => {\n const classes = classNames('ndl-breadcrumbs-item', className);\n\n return (\n <BreadcrumbsItemContext.Provider value={{ isInBreadcrumbsItem: true }}>\n <li\n ref={ref}\n className={classes}\n style={style}\n {...htmlAttributes}\n {...restProps}\n >\n <div className=\"ndl-breadcrumbs-item-inner\">{children}</div>\n </li>\n </BreadcrumbsItemContext.Provider>\n );\n};\n\ntype InteractiveBreadcrumbProps = {\n /** Content to be rendered. */\n children?: React.ReactNode;\n} & (\n | {\n as: 'button';\n /**\n * Event handler for when the button is clicked. Only applicable if `as` is `'button'`.\n */\n onClick?: (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => void;\n }\n | {\n as: 'a';\n /**\n * The href of the link. Only applicable if `as` is `'a'`.\n */\n href: HtmlAttributes<'a'>['href'];\n /**\n * The target of the link. Only applicable if `as` is `'a'`.\n */\n target?: HtmlAttributes<'a'>['target'];\n }\n | {\n /**\n * What HTML element to render the root element as.\n */\n as?: React.ElementType;\n }\n);\n\ntype BreadcrumbsButtonProps = InteractiveBreadcrumbProps & {\n /** Leading element to be rendered. */\n leadingElement?: React.ReactNode;\n /** Trailing element to be rendered. */\n trailingElement?: React.ReactNode;\n};\n\nconst BreadcrumbsButton = <T extends React.ElementType = 'button'>({\n children,\n as,\n className,\n style,\n htmlAttributes,\n ref,\n leadingElement,\n trailingElement,\n ...restProps\n}: PolymorphicCommonProps<T, BreadcrumbsButtonProps>) => {\n useBreadcrumbsItemContext();\n\n const [isTooltipOpen, setIsTooltipOpen] = useState(false);\n const contentRef = useRef<HTMLDivElement>(null);\n const Component: React.ElementType = as ?? 'button';\n\n const classes = classNames(\n 'ndl-breadcrumbs-button ndl-breadcrumbs-sibling-hover',\n className,\n );\n\n return (\n <Tooltip\n type=\"simple\"\n isOpen={isTooltipOpen}\n onOpenChange={(isOpen) => {\n if (isOpen) {\n const isTruncated =\n contentRef.current?.scrollWidth &&\n contentRef.current?.clientWidth &&\n contentRef.current.scrollWidth > contentRef.current.clientWidth;\n const isVisible =\n contentRef.current?.offsetWidth &&\n contentRef.current?.offsetHeight &&\n contentRef.current.offsetWidth > 0 &&\n contentRef.current.offsetHeight > 0;\n setIsTooltipOpen(isTruncated || !isVisible);\n } else {\n setIsTooltipOpen(false);\n }\n }}\n >\n <Tooltip.Trigger hasButtonWrapper>\n <Component\n ref={ref}\n className={classes}\n style={style}\n {...htmlAttributes}\n {...restProps}\n >\n {Boolean(leadingElement) && (\n <div className=\"ndl-breadcrumbs-button-leading-element\">\n {leadingElement}\n </div>\n )}\n <div className=\"ndl-breadcrumbs-button-content\" ref={contentRef}>\n {children}\n </div>\n {Boolean(trailingElement) && (\n <div className=\"ndl-breadcrumbs-button-trailing-element\">\n {trailingElement}\n </div>\n )}\n </Component>\n </Tooltip.Trigger>\n <Tooltip.Content>{children}</Tooltip.Content>\n </Tooltip>\n );\n};\n\ntype BreadcrumbsSelectButtonProps = {\n /** Event handler for when the button is clicked. Should be used to open a `Menu`. */\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /** Aria label needed for accessibility. */\n ariaLabel: string;\n /** Content to be rendered. */\n children?: React.ReactNode;\n /** Active - used when a connected menu is open */\n isActive?: boolean;\n};\n\nconst BreadcrumbsSelectButton = ({\n onClick,\n children,\n isActive,\n className,\n style,\n htmlAttributes,\n ariaLabel,\n ref,\n ...restProps\n}: CommonProps<'button', BreadcrumbsSelectButtonProps>) => {\n useBreadcrumbsItemContext();\n\n const classes = classNames(\n 'ndl-breadcrumbs-button ndl-breadcrumbs-sibling-hover ndl-breadcrumbs-select',\n className,\n {\n 'ndl-active': Boolean(isActive),\n },\n );\n\n return (\n <button\n type=\"button\"\n ref={ref}\n className={classes}\n style={style}\n onClick={onClick}\n aria-label={ariaLabel}\n aria-pressed={isActive}\n {...htmlAttributes}\n {...restProps}\n >\n <ChevronDownSmallOutlineIcon className=\"ndl-breadcrumbs-chevron\" />\n <div className=\"ndl-breadcrumbs-button-content\">{children}</div>\n </button>\n );\n};\n\ntype BreadcrumbsLinkProps = InteractiveBreadcrumbProps & {\n /**\n * Whether the link is the current item. Use `'page'` if it indicates the current page and `'step'` for steps (in a multi-step wizard for example).\n * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current\n */\n ariaCurrent?: React.AriaAttributes['aria-current'];\n};\n\nconst BreadcrumbsLink = <T extends React.ElementType = 'a'>({\n children,\n as,\n className,\n style,\n htmlAttributes,\n ariaCurrent = false,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, BreadcrumbsLinkProps>) => {\n useBreadcrumbsItemContext();\n\n const Component: React.ElementType = as ?? 'a';\n\n const classes = classNames(\n 'ndl-breadcrumbs-link',\n {\n 'ndl-breadcrumbs-link-current': Boolean(ariaCurrent),\n },\n className,\n );\n\n return (\n <Component\n ref={ref}\n className={classes}\n style={style}\n aria-current={ariaCurrent}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst Breadcrumbs = Object.assign(BreadcrumbsComponent, {\n Button: BreadcrumbsButton,\n Item: BreadcrumbsItem,\n Link: BreadcrumbsLink,\n SelectButton: BreadcrumbsSelectButton,\n});\n\nexport { Breadcrumbs };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCE;CACA;CACA;CACA;CACA;CACA;;;CA4CA;CACA;CACA;CACA;CACA;;;CA4DA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;CA2EA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;CAwCA;CACA;CACA;CACA;CACA;CACA;CACA;;AAzPF,MAAM,wBAAwB,SAQc;CARd,IAAA,EAC5B,UACA,WACA,gBACA,OACA,KACA,aAAa,SAAA,MACV,YAAA,gCAAA,QAAA,MAAA,SAAA;CAEH,MAAM,WAAA,GAAUA,WAAAA,QAAAA,CAAW,mBAAmB,SAAS;CACvD,MAAM,eAAA,GAAcA,WAAAA,QAAAA,CAAW,wBAAwB,EACrD,wBAAwB,WAC1B,CAAC;CACD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAA,sBAAA,QAAA,sBAAA,QAAA,sBAAA,QAAA;EACC,cAAW;EACN;EACL,WAAW;EACJ;CACH,GAAA,SAAA,GACA,cAAA,GAAA,CAAA,GAAA,EAAA,UAEJ,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD;E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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
|
|
14
|
-
const
|
|
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)(
|
|
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)(
|
|
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: "
|
|
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,M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AA,CAAC,OAAD;GACE,MAAK;GACL,IAAI;GACJ,QAAQ,CAAC;GACT,OAAO,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"}
|
|
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;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;GAC3B;EACF;CACF;AACF;AAEA,MAAM,cAAc;CAClB,QAAQ;CACR,UAAU;CACV,QAAQ;AACV;AAEA,MAAM,mBAAA,GAAkBA,MAAAA,cAAAA,CAAoC;CAC1D,eAAe;CACf,OAAO;CACP,mBAAmB;CACnB,UAAU;CACV,cAAc;CACd,eAAe;CACf,cAAc;CACd,OAAO,oBAAoB;AAC7B,CAAC;;;;;AAMD,SAAS,mBACP,OACiB;CACjB,OAAO;EACL,SAAS,MAAM;EACf,UAAUC,yBAAAA,gBAAgB,IAAI,MAAM,UAAU,MAAM;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AAgBA,MAAM,WAAW,OAAO,OAAO,MAAM;CAAE;CAAM;AAAa,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import SvgChevronDownSmallOutline from "../icons/generated/custom/ChevronDownSmallOutline.mjs";
|
|
2
2
|
import { Tooltip } from "../tooltip/Tooltip.mjs";
|
|
3
3
|
import _objectWithoutProperties from "../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectWithoutProperties.mjs";
|
|
4
4
|
import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/objectSpread2.mjs";
|
|
@@ -159,7 +159,7 @@ const BreadcrumbsSelectButton = (_ref4) => {
|
|
|
159
159
|
onClick,
|
|
160
160
|
"aria-label": ariaLabel,
|
|
161
161
|
"aria-pressed": isActive
|
|
162
|
-
}, htmlAttributes), restProps), {}, { children: [/* @__PURE__ */ jsx(
|
|
162
|
+
}, htmlAttributes), restProps), {}, { children: [/* @__PURE__ */ jsx(SvgChevronDownSmallOutline, { className: "ndl-breadcrumbs-chevron" }), /* @__PURE__ */ jsx("div", {
|
|
163
163
|
className: "ndl-breadcrumbs-button-content",
|
|
164
164
|
children
|
|
165
165
|
})] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumbs.mjs","names":[],"sources":["../../../src/breadcrumbs/Breadcrumbs.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 classNames from 'classnames';\nimport type React from 'react';\nimport { createContext, useContext, useRef, useState } from 'react';\n\nimport {\n type CommonProps,\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { ChevronDownIconOutline } from '../icons/generated/heroIcons/ChevronDownIconOutline';\nimport { Tooltip } from '../tooltip';\n\ntype BreadcrumbsProps = {\n /** Content to be rendered. Should only be `Breadcrumbs.Item`. */\n children?: React.ReactNode;\n /** Additional classnames. */\n shouldWrap?: boolean;\n};\n\nconst BreadcrumbsComponent = ({\n children,\n className,\n htmlAttributes,\n style,\n ref,\n shouldWrap = true,\n ...restProps\n}: CommonProps<'nav', BreadcrumbsProps>) => {\n const classes = classNames('ndl-breadcrumbs', className);\n const listClasses = classNames('ndl-breadcrumbs-list', {\n 'ndl-breadcrumbs-wrap': shouldWrap,\n });\n return (\n <nav\n aria-label=\"Breadcrumb\"\n ref={ref}\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <ol className={listClasses}>{children}</ol>\n </nav>\n );\n};\n\ntype BreadcrumbsItemContextType = {\n isInBreadcrumbsItem: boolean;\n};\n\nconst BreadcrumbsItemContext = createContext<BreadcrumbsItemContextType | null>(\n null,\n);\n\nexport const useBreadcrumbsItemContext = (): BreadcrumbsItemContextType => {\n const context = useContext(BreadcrumbsItemContext);\n if (!context) {\n throw new Error('This component must be used within a <Breadcrumbs.Item>');\n }\n\n return context;\n};\n\ntype BreadcrumbsItemProps = {\n /** Content to be rendered. Should be either `Breadcrumbs.Link`, `Breadcrumbs.Button` or `Breadcrumbs.SelectButton`. */\n children?: React.ReactNode;\n};\n\nconst BreadcrumbsItem = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'li', BreadcrumbsItemProps>) => {\n const classes = classNames('ndl-breadcrumbs-item', className);\n\n return (\n <BreadcrumbsItemContext.Provider value={{ isInBreadcrumbsItem: true }}>\n <li\n ref={ref}\n className={classes}\n style={style}\n {...htmlAttributes}\n {...restProps}\n >\n <div className=\"ndl-breadcrumbs-item-inner\">{children}</div>\n </li>\n </BreadcrumbsItemContext.Provider>\n );\n};\n\ntype InteractiveBreadcrumbProps = {\n /** Content to be rendered. */\n children?: React.ReactNode;\n} & (\n | {\n as: 'button';\n /**\n * Event handler for when the button is clicked. Only applicable if `as` is `'button'`.\n */\n onClick?: (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => void;\n }\n | {\n as: 'a';\n /**\n * The href of the link. Only applicable if `as` is `'a'`.\n */\n href: HtmlAttributes<'a'>['href'];\n /**\n * The target of the link. Only applicable if `as` is `'a'`.\n */\n target?: HtmlAttributes<'a'>['target'];\n }\n | {\n /**\n * What HTML element to render the root element as.\n */\n as?: React.ElementType;\n }\n);\n\ntype BreadcrumbsButtonProps = InteractiveBreadcrumbProps & {\n /** Leading element to be rendered. */\n leadingElement?: React.ReactNode;\n /** Trailing element to be rendered. */\n trailingElement?: React.ReactNode;\n};\n\nconst BreadcrumbsButton = <T extends React.ElementType = 'button'>({\n children,\n as,\n className,\n style,\n htmlAttributes,\n ref,\n leadingElement,\n trailingElement,\n ...restProps\n}: PolymorphicCommonProps<T, BreadcrumbsButtonProps>) => {\n useBreadcrumbsItemContext();\n\n const [isTooltipOpen, setIsTooltipOpen] = useState(false);\n const contentRef = useRef<HTMLDivElement>(null);\n const Component: React.ElementType = as ?? 'button';\n\n const classes = classNames(\n 'ndl-breadcrumbs-button ndl-breadcrumbs-sibling-hover',\n className,\n );\n\n return (\n <Tooltip\n type=\"simple\"\n isOpen={isTooltipOpen}\n onOpenChange={(isOpen) => {\n if (isOpen) {\n const isTruncated =\n contentRef.current?.scrollWidth &&\n contentRef.current?.clientWidth &&\n contentRef.current.scrollWidth > contentRef.current.clientWidth;\n const isVisible =\n contentRef.current?.offsetWidth &&\n contentRef.current?.offsetHeight &&\n contentRef.current.offsetWidth > 0 &&\n contentRef.current.offsetHeight > 0;\n setIsTooltipOpen(isTruncated || !isVisible);\n } else {\n setIsTooltipOpen(false);\n }\n }}\n >\n <Tooltip.Trigger hasButtonWrapper>\n <Component\n ref={ref}\n className={classes}\n style={style}\n {...htmlAttributes}\n {...restProps}\n >\n {Boolean(leadingElement) && (\n <div className=\"ndl-breadcrumbs-button-leading-element\">\n {leadingElement}\n </div>\n )}\n <div className=\"ndl-breadcrumbs-button-content\" ref={contentRef}>\n {children}\n </div>\n {Boolean(trailingElement) && (\n <div className=\"ndl-breadcrumbs-button-trailing-element\">\n {trailingElement}\n </div>\n )}\n </Component>\n </Tooltip.Trigger>\n <Tooltip.Content>{children}</Tooltip.Content>\n </Tooltip>\n );\n};\n\ntype BreadcrumbsSelectButtonProps = {\n /** Event handler for when the button is clicked. Should be used to open a `Menu`. */\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /** Aria label needed for accessibility. */\n ariaLabel: string;\n /** Content to be rendered. */\n children?: React.ReactNode;\n /** Active - used when a connected menu is open */\n isActive?: boolean;\n};\n\nconst BreadcrumbsSelectButton = ({\n onClick,\n children,\n isActive,\n className,\n style,\n htmlAttributes,\n ariaLabel,\n ref,\n ...restProps\n}: CommonProps<'button', BreadcrumbsSelectButtonProps>) => {\n useBreadcrumbsItemContext();\n\n const classes = classNames(\n 'ndl-breadcrumbs-button ndl-breadcrumbs-sibling-hover ndl-breadcrumbs-select',\n className,\n {\n 'ndl-active': Boolean(isActive),\n },\n );\n\n return (\n <button\n type=\"button\"\n ref={ref}\n className={classes}\n style={style}\n onClick={onClick}\n aria-label={ariaLabel}\n aria-pressed={isActive}\n {...htmlAttributes}\n {...restProps}\n >\n <ChevronDownIconOutline className=\"ndl-breadcrumbs-chevron\" />\n <div className=\"ndl-breadcrumbs-button-content\">{children}</div>\n </button>\n );\n};\n\ntype BreadcrumbsLinkProps = InteractiveBreadcrumbProps & {\n /**\n * Whether the link is the current item. Use `'page'` if it indicates the current page and `'step'` for steps (in a multi-step wizard for example).\n * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current\n */\n ariaCurrent?: React.AriaAttributes['aria-current'];\n};\n\nconst BreadcrumbsLink = <T extends React.ElementType = 'a'>({\n children,\n as,\n className,\n style,\n htmlAttributes,\n ariaCurrent = false,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, BreadcrumbsLinkProps>) => {\n useBreadcrumbsItemContext();\n\n const Component: React.ElementType = as ?? 'a';\n\n const classes = classNames(\n 'ndl-breadcrumbs-link',\n {\n 'ndl-breadcrumbs-link-current': Boolean(ariaCurrent),\n },\n className,\n );\n\n return (\n <Component\n ref={ref}\n className={classes}\n style={style}\n aria-current={ariaCurrent}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst Breadcrumbs = Object.assign(BreadcrumbsComponent, {\n Button: BreadcrumbsButton,\n Item: BreadcrumbsItem,\n Link: BreadcrumbsLink,\n SelectButton: BreadcrumbsSelectButton,\n});\n\nexport { Breadcrumbs };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCE;CACA;CACA;CACA;CACA;CACA;;;CA4CA;CACA;CACA;CACA;CACA;;;CA4DA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;CA2EA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;CAwCA;CACA;CACA;CACA;CACA;CACA;CACA;;AAzPF,MAAM,wBAAwB,SAQc;CARd,IAAA,EAC5B,UACA,WACA,gBACA,OACA,KACA,aAAa,SAAA,MACV,YAAA,yBAAA,MAAA,SAAA;CAEH,MAAM,UAAU,WAAW,mBAAmB,SAAS;CACvD,MAAM,cAAc,WAAW,wBAAwB,EACrD,wBAAwB,WAC1B,CAAC;CACD,OACE,oBAAC,OAAA,eAAA,eAAA,eAAA;EACC,cAAW;EACN;EACL,WAAW;EACJ;CACH,GAAA,SAAA,GACA,cAAA,GAAA,CAAA,GAAA,EAAA,UAEJ,oBAAC,MAAD;EAAI,WAAW;EAAc;CAAa,CAAA,EAAA,CACvC,CAAA;AAET;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Ac,OACd,QAAA,OACG,YAAA,yBAAA,OAAA,UAAA;CAEH,0BAA0B;CAE1B,MAAM,YAA+B,OAAA,QAAA,OAAA,KAAA,IAAA,KAAM;CAE3C,MAAM,UAAU,WACd,wBACA,EACE,gCAAgC,QAAQ,WAAW,EACrD,GACA,SACF;CAEA,OACE,oBAAC,WAAA,eAAA,eAAA,eAAA;EACM;EACL,WAAW;EACJ;EACP,gBAAc;CACV,GAAA,SAAA,GACA,cAAA,GAAA,CAAA,GAAA,EAEH,SAAA,CACQ,CAAA;AAEf;AAEA,MAAM,cAAc,OAAO,OAAO,sBAAsB;CACtD,QAAQ;CACR,MAAM;CACN,MAAM;CACN,cAAc;AAChB,CAAC"}
|
|
1
|
+
{"version":3,"file":"Breadcrumbs.mjs","names":["ChevronDownSmallOutlineIcon"],"sources":["../../../src/breadcrumbs/Breadcrumbs.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 classNames from 'classnames';\nimport type React from 'react';\nimport { createContext, useContext, useRef, useState } from 'react';\n\nimport {\n type CommonProps,\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { ChevronDownSmallOutlineIcon } from '../icons/generated/custom';\nimport { Tooltip } from '../tooltip';\n\ntype BreadcrumbsProps = {\n /** Content to be rendered. Should only be `Breadcrumbs.Item`. */\n children?: React.ReactNode;\n /** Additional classnames. */\n shouldWrap?: boolean;\n};\n\nconst BreadcrumbsComponent = ({\n children,\n className,\n htmlAttributes,\n style,\n ref,\n shouldWrap = true,\n ...restProps\n}: CommonProps<'nav', BreadcrumbsProps>) => {\n const classes = classNames('ndl-breadcrumbs', className);\n const listClasses = classNames('ndl-breadcrumbs-list', {\n 'ndl-breadcrumbs-wrap': shouldWrap,\n });\n return (\n <nav\n aria-label=\"Breadcrumb\"\n ref={ref}\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <ol className={listClasses}>{children}</ol>\n </nav>\n );\n};\n\ntype BreadcrumbsItemContextType = {\n isInBreadcrumbsItem: boolean;\n};\n\nconst BreadcrumbsItemContext = createContext<BreadcrumbsItemContextType | null>(\n null,\n);\n\nexport const useBreadcrumbsItemContext = (): BreadcrumbsItemContextType => {\n const context = useContext(BreadcrumbsItemContext);\n if (!context) {\n throw new Error('This component must be used within a <Breadcrumbs.Item>');\n }\n\n return context;\n};\n\ntype BreadcrumbsItemProps = {\n /** Content to be rendered. Should be either `Breadcrumbs.Link`, `Breadcrumbs.Button` or `Breadcrumbs.SelectButton`. */\n children?: React.ReactNode;\n};\n\nconst BreadcrumbsItem = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'li', BreadcrumbsItemProps>) => {\n const classes = classNames('ndl-breadcrumbs-item', className);\n\n return (\n <BreadcrumbsItemContext.Provider value={{ isInBreadcrumbsItem: true }}>\n <li\n ref={ref}\n className={classes}\n style={style}\n {...htmlAttributes}\n {...restProps}\n >\n <div className=\"ndl-breadcrumbs-item-inner\">{children}</div>\n </li>\n </BreadcrumbsItemContext.Provider>\n );\n};\n\ntype InteractiveBreadcrumbProps = {\n /** Content to be rendered. */\n children?: React.ReactNode;\n} & (\n | {\n as: 'button';\n /**\n * Event handler for when the button is clicked. Only applicable if `as` is `'button'`.\n */\n onClick?: (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => void;\n }\n | {\n as: 'a';\n /**\n * The href of the link. Only applicable if `as` is `'a'`.\n */\n href: HtmlAttributes<'a'>['href'];\n /**\n * The target of the link. Only applicable if `as` is `'a'`.\n */\n target?: HtmlAttributes<'a'>['target'];\n }\n | {\n /**\n * What HTML element to render the root element as.\n */\n as?: React.ElementType;\n }\n);\n\ntype BreadcrumbsButtonProps = InteractiveBreadcrumbProps & {\n /** Leading element to be rendered. */\n leadingElement?: React.ReactNode;\n /** Trailing element to be rendered. */\n trailingElement?: React.ReactNode;\n};\n\nconst BreadcrumbsButton = <T extends React.ElementType = 'button'>({\n children,\n as,\n className,\n style,\n htmlAttributes,\n ref,\n leadingElement,\n trailingElement,\n ...restProps\n}: PolymorphicCommonProps<T, BreadcrumbsButtonProps>) => {\n useBreadcrumbsItemContext();\n\n const [isTooltipOpen, setIsTooltipOpen] = useState(false);\n const contentRef = useRef<HTMLDivElement>(null);\n const Component: React.ElementType = as ?? 'button';\n\n const classes = classNames(\n 'ndl-breadcrumbs-button ndl-breadcrumbs-sibling-hover',\n className,\n );\n\n return (\n <Tooltip\n type=\"simple\"\n isOpen={isTooltipOpen}\n onOpenChange={(isOpen) => {\n if (isOpen) {\n const isTruncated =\n contentRef.current?.scrollWidth &&\n contentRef.current?.clientWidth &&\n contentRef.current.scrollWidth > contentRef.current.clientWidth;\n const isVisible =\n contentRef.current?.offsetWidth &&\n contentRef.current?.offsetHeight &&\n contentRef.current.offsetWidth > 0 &&\n contentRef.current.offsetHeight > 0;\n setIsTooltipOpen(isTruncated || !isVisible);\n } else {\n setIsTooltipOpen(false);\n }\n }}\n >\n <Tooltip.Trigger hasButtonWrapper>\n <Component\n ref={ref}\n className={classes}\n style={style}\n {...htmlAttributes}\n {...restProps}\n >\n {Boolean(leadingElement) && (\n <div className=\"ndl-breadcrumbs-button-leading-element\">\n {leadingElement}\n </div>\n )}\n <div className=\"ndl-breadcrumbs-button-content\" ref={contentRef}>\n {children}\n </div>\n {Boolean(trailingElement) && (\n <div className=\"ndl-breadcrumbs-button-trailing-element\">\n {trailingElement}\n </div>\n )}\n </Component>\n </Tooltip.Trigger>\n <Tooltip.Content>{children}</Tooltip.Content>\n </Tooltip>\n );\n};\n\ntype BreadcrumbsSelectButtonProps = {\n /** Event handler for when the button is clicked. Should be used to open a `Menu`. */\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /** Aria label needed for accessibility. */\n ariaLabel: string;\n /** Content to be rendered. */\n children?: React.ReactNode;\n /** Active - used when a connected menu is open */\n isActive?: boolean;\n};\n\nconst BreadcrumbsSelectButton = ({\n onClick,\n children,\n isActive,\n className,\n style,\n htmlAttributes,\n ariaLabel,\n ref,\n ...restProps\n}: CommonProps<'button', BreadcrumbsSelectButtonProps>) => {\n useBreadcrumbsItemContext();\n\n const classes = classNames(\n 'ndl-breadcrumbs-button ndl-breadcrumbs-sibling-hover ndl-breadcrumbs-select',\n className,\n {\n 'ndl-active': Boolean(isActive),\n },\n );\n\n return (\n <button\n type=\"button\"\n ref={ref}\n className={classes}\n style={style}\n onClick={onClick}\n aria-label={ariaLabel}\n aria-pressed={isActive}\n {...htmlAttributes}\n {...restProps}\n >\n <ChevronDownSmallOutlineIcon className=\"ndl-breadcrumbs-chevron\" />\n <div className=\"ndl-breadcrumbs-button-content\">{children}</div>\n </button>\n );\n};\n\ntype BreadcrumbsLinkProps = InteractiveBreadcrumbProps & {\n /**\n * Whether the link is the current item. Use `'page'` if it indicates the current page and `'step'` for steps (in a multi-step wizard for example).\n * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current\n */\n ariaCurrent?: React.AriaAttributes['aria-current'];\n};\n\nconst BreadcrumbsLink = <T extends React.ElementType = 'a'>({\n children,\n as,\n className,\n style,\n htmlAttributes,\n ariaCurrent = false,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, BreadcrumbsLinkProps>) => {\n useBreadcrumbsItemContext();\n\n const Component: React.ElementType = as ?? 'a';\n\n const classes = classNames(\n 'ndl-breadcrumbs-link',\n {\n 'ndl-breadcrumbs-link-current': Boolean(ariaCurrent),\n },\n className,\n );\n\n return (\n <Component\n ref={ref}\n className={classes}\n style={style}\n aria-current={ariaCurrent}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst Breadcrumbs = Object.assign(BreadcrumbsComponent, {\n Button: BreadcrumbsButton,\n Item: BreadcrumbsItem,\n Link: BreadcrumbsLink,\n SelectButton: BreadcrumbsSelectButton,\n});\n\nexport { Breadcrumbs };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCE;CACA;CACA;CACA;CACA;CACA;;;CA4CA;CACA;CACA;CACA;CACA;;;CA4DA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;CA2EA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;CAwCA;CACA;CACA;CACA;CACA;CACA;CACA;;AAzPF,MAAM,wBAAwB,SAQc;CARd,IAAA,EAC5B,UACA,WACA,gBACA,OACA,KACA,aAAa,SAAA,MACV,YAAA,yBAAA,MAAA,SAAA;CAEH,MAAM,UAAU,WAAW,mBAAmB,SAAS;CACvD,MAAM,cAAc,WAAW,wBAAwB,EACrD,wBAAwB,WAC1B,CAAC;CACD,OACE,oBAAC,OAAA,eAAA,eAAA,eAAA;EACC,cAAW;EACN;EACL,WAAW;EACJ;CACH,GAAA,SAAA,GACA,cAAA,GAAA,CAAA,GAAA,EAAA,UAEJ,oBAAC,MAAD;EAAI,WAAW;EAAc;CAAa,CAAA,EAAA,CACvC,CAAA;AAET;AAMA,MAAM,yBAAyB,cAC7B,IACF;AAEA,MAAa,kCAA8D;CACzE,MAAM,UAAU,WAAW,sBAAsB;CACjD,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,yDAAyD;CAG3E,OAAO;AACT;AAOA,MAAM,mBAAmB,UAOsB;CAPtB,IAAA,EACvB,UACA,WACA,OACA,gBACA,QAAA,OACG,YAAA,yBAAA,OAAA,UAAA;CAEH,MAAM,UAAU,WAAW,wBAAwB,SAAS;CAE5D,OACE,oBAAC,uBAAuB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ACQ,CAAA;AAEf;AAEA,MAAM,cAAc,OAAO,OAAO,sBAAsB;CACtD,QAAQ;CACR,MAAM;CACN,MAAM;CACN,cAAc;AAChB,CAAC"}
|
|
@@ -4,8 +4,8 @@ import { Checkbox } from "../../checkbox/Checkbox.mjs";
|
|
|
4
4
|
import { CleanIconButton } from "../../clean-icon-button/CleanIconButton.mjs";
|
|
5
5
|
import { ConditionalWrap } from "../../conditional-wrap/ConditionalWrap.mjs";
|
|
6
6
|
import { isApplePlatform } from "../../helpers/platform.mjs";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import SvgChevronRightOutline from "../../icons/generated/custom/ChevronRightOutline.mjs";
|
|
8
|
+
import SvgEllipsisHorizontalOutline from "../../icons/generated/custom/EllipsisHorizontalOutline.mjs";
|
|
9
9
|
import { Menu } from "../../menu/Menu.mjs";
|
|
10
10
|
import { Skeleton } from "../../skeleton/Skeleton.mjs";
|
|
11
11
|
import { Tooltip } from "../../tooltip/Tooltip.mjs";
|
|
@@ -702,7 +702,7 @@ const Item = (_ref4) => {
|
|
|
702
702
|
className: "ndl-tree-view-new-chevron",
|
|
703
703
|
"aria-disabled": isDisabled,
|
|
704
704
|
onClick: handleChevronClick,
|
|
705
|
-
children: /* @__PURE__ */ jsx(
|
|
705
|
+
children: /* @__PURE__ */ jsx(SvgChevronRightOutline, { className: classNames("ndl-tree-view-new-chevron-icon", { "ndl-tree-view-new-chevron-icon--open": isExpanded }) })
|
|
706
706
|
}),
|
|
707
707
|
leadingVisual && /* @__PURE__ */ jsx("div", {
|
|
708
708
|
className: "ndl-tree-view-new-item-content-leading-visual",
|
|
@@ -751,7 +751,7 @@ const Item = (_ref4) => {
|
|
|
751
751
|
},
|
|
752
752
|
tabIndex: -1
|
|
753
753
|
},
|
|
754
|
-
children: /* @__PURE__ */ jsx(
|
|
754
|
+
children: /* @__PURE__ */ jsx(SvgEllipsisHorizontalOutline, {})
|
|
755
755
|
}), /* @__PURE__ */ jsx(Menu, _objectSpread2(_objectSpread2({
|
|
756
756
|
isOpen: isMenuOpen,
|
|
757
757
|
anchorRef: actionButtonRef,
|
|
@@ -808,7 +808,7 @@ const SkeletonItem = (_ref6) => {
|
|
|
808
808
|
className: classNames("ndl-tree-view-new-skeleton", className),
|
|
809
809
|
style: _objectSpread2({ "--tree-level": level - 1 }, style)
|
|
810
810
|
}, htmlAttributes), restProps), {}, { children: Array.from({ length: rows }, (_unused, index) => /* @__PURE__ */ jsx(Skeleton, {
|
|
811
|
-
height: "
|
|
811
|
+
height: "24px",
|
|
812
812
|
width: "100%"
|
|
813
813
|
}, index)) }));
|
|
814
814
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeView.mjs","names":[],"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,eAAA;EACF,UAAU;EACV,WAAW;EACX,aAAa;CACV,GAAA,YACL;CACA,MAAM,4BAAY,IAAI,IAAgB;CACtC,OAAO;EACL,gBAAgB;EAChB,WAAW,YAAY;GACrB,QAAA,eAAA,eAAA,C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AC,OAAD;GACE,MAAK;GACL,IAAI;GACJ,QAAQ,CAAC;GACT,OAAO,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,yBAAA,OAAA,UAAA;CAEH,MAAM,EAAE,UAAU,WAAW,eAAe;CAC5C,OACE,oBAAC,OAAA,eAAA,eAAA,eAAA;EACM;EACL,eAAY;EACZ,WAAW,WAAW,8BAA8B,SAAS;EAC7D,OAAA,eAAA,EAAS,gBAAgB,QAAQ,EAAA,GAAM,KAAM;CACzC,GAAA,cAAA,GACA,SAAA,GAAA,CAAA,GAAA,EAAA,UAEH,MAAM,KAAK,EAAE,QAAQ,KAAK,IAAI,SAAS,UACtC,oBAAC,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.mjs","names":["ChevronRightOutlineIcon","EllipsisHorizontalOutlineIcon"],"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;CAC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7.2",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"description": "React implementation of Neo4j Design System",
|
|
6
6
|
"keywords": [
|
|
@@ -434,7 +434,7 @@
|
|
|
434
434
|
"@tanstack/react-table": "8.21.3",
|
|
435
435
|
"react": ">=19.0.0",
|
|
436
436
|
"react-dom": ">=19.0.0",
|
|
437
|
-
"@neo4j-ndl/base": "^5.4.
|
|
437
|
+
"@neo4j-ndl/base": "^5.4.5"
|
|
438
438
|
},
|
|
439
439
|
"dependencies": {
|
|
440
440
|
"@dnd-kit/core": "6.3.1",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: ndl-react
|
|
3
3
|
metadata:
|
|
4
4
|
package: '@neo4j-ndl/react'
|
|
5
|
-
version: '5.7.
|
|
5
|
+
version: '5.7.2'
|
|
6
6
|
description: >-
|
|
7
7
|
Build and edit UI with the Neo4j Needle React design system
|
|
8
8
|
(@neo4j-ndl/react). Use when adding, composing, or modifying Needle components
|
|
@@ -15,7 +15,7 @@ description: >-
|
|
|
15
15
|
|
|
16
16
|
# Neo4j Needle (@neo4j-ndl/react)
|
|
17
17
|
|
|
18
|
-
> 📌 Shipped with `@neo4j-ndl/react` v5.7.
|
|
18
|
+
> 📌 Shipped with `@neo4j-ndl/react` v5.7.2. Once installed into your repo (e.g. via
|
|
19
19
|
> `npx skills add`) this folder is detached from the package — the installed
|
|
20
20
|
> package (TypeScript types in `node_modules/@neo4j-ndl/react`) is the source of
|
|
21
21
|
> truth.
|