@neo4j-ndl/react 4.21.2 → 4.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/dropzone/stories/dropzone-full.story.js +5 -5
- package/lib/cjs/dropzone/stories/dropzone-full.story.js.map +1 -1
- package/lib/cjs/helpers/index.js +1 -0
- package/lib/cjs/helpers/index.js.map +1 -1
- package/lib/cjs/helpers/platform.js +59 -0
- package/lib/cjs/helpers/platform.js.map +1 -0
- package/lib/cjs/kbd/kbd-utils.js +6 -22
- package/lib/cjs/kbd/kbd-utils.js.map +1 -1
- package/lib/cjs/next/tree-view/TreeView.js +384 -66
- package/lib/cjs/next/tree-view/TreeView.js.map +1 -1
- package/lib/cjs/next/tree-view/selection.js +181 -0
- package/lib/cjs/next/tree-view/selection.js.map +1 -0
- package/lib/cjs/next/tree-view/stories/index.js +13 -1
- package/lib/cjs/next/tree-view/stories/index.js.map +1 -1
- package/lib/cjs/next/tree-view/stories/tree-view-large.story.js +57 -0
- package/lib/cjs/next/tree-view/stories/tree-view-large.story.js.map +1 -0
- package/lib/cjs/next/tree-view/stories/tree-view-lazy.story.js +1 -0
- package/lib/cjs/next/tree-view/stories/tree-view-lazy.story.js.map +1 -1
- package/lib/cjs/next/tree-view/stories/tree-view-multi.story.js +16 -40
- package/lib/cjs/next/tree-view/stories/tree-view-multi.story.js.map +1 -1
- package/lib/cjs/next/tree-view/stories/tree-view-multiple-replace.story.js +38 -0
- package/lib/cjs/next/tree-view/stories/tree-view-multiple-replace.story.js.map +1 -0
- package/lib/cjs/next/tree-view/stories/tree-view-non-selectable-folders.story.js +7 -4
- package/lib/cjs/next/tree-view/stories/tree-view-non-selectable-folders.story.js.map +1 -1
- package/lib/cjs/next/tree-view/stories/tree-view-root-selection.story.js +125 -0
- package/lib/cjs/next/tree-view/stories/tree-view-root-selection.story.js.map +1 -0
- package/lib/cjs/toast/ToastControlled.js +1 -1
- package/lib/cjs/toast/ToastControlled.js.map +1 -1
- package/lib/esm/dropzone/stories/dropzone-full.story.js +5 -5
- package/lib/esm/dropzone/stories/dropzone-full.story.js.map +1 -1
- package/lib/esm/helpers/index.js +1 -0
- package/lib/esm/helpers/index.js.map +1 -1
- package/lib/esm/helpers/platform.js +55 -0
- package/lib/esm/helpers/platform.js.map +1 -0
- package/lib/esm/kbd/kbd-utils.js +2 -18
- package/lib/esm/kbd/kbd-utils.js.map +1 -1
- package/lib/esm/next/tree-view/TreeView.js +385 -67
- package/lib/esm/next/tree-view/TreeView.js.map +1 -1
- package/lib/esm/next/tree-view/selection.js +175 -0
- package/lib/esm/next/tree-view/selection.js.map +1 -0
- package/lib/esm/next/tree-view/stories/index.js +9 -0
- package/lib/esm/next/tree-view/stories/index.js.map +1 -1
- package/lib/esm/next/tree-view/stories/tree-view-large.story.js +55 -0
- package/lib/esm/next/tree-view/stories/tree-view-large.story.js.map +1 -0
- package/lib/esm/next/tree-view/stories/tree-view-lazy.story.js +1 -0
- package/lib/esm/next/tree-view/stories/tree-view-lazy.story.js.map +1 -1
- package/lib/esm/next/tree-view/stories/tree-view-multi.story.js +16 -40
- package/lib/esm/next/tree-view/stories/tree-view-multi.story.js.map +1 -1
- package/lib/esm/next/tree-view/stories/tree-view-multiple-replace.story.js +36 -0
- package/lib/esm/next/tree-view/stories/tree-view-multiple-replace.story.js.map +1 -0
- package/lib/esm/next/tree-view/stories/tree-view-non-selectable-folders.story.js +7 -4
- package/lib/esm/next/tree-view/stories/tree-view-non-selectable-folders.story.js.map +1 -1
- package/lib/esm/next/tree-view/stories/tree-view-root-selection.story.js +123 -0
- package/lib/esm/next/tree-view/stories/tree-view-root-selection.story.js.map +1 -0
- package/lib/esm/toast/ToastControlled.js +1 -1
- package/lib/esm/toast/ToastControlled.js.map +1 -1
- package/lib/types/helpers/index.d.ts +1 -0
- package/lib/types/helpers/index.d.ts.map +1 -1
- package/lib/types/helpers/platform.d.ts +29 -0
- package/lib/types/helpers/platform.d.ts.map +1 -0
- package/lib/types/kbd/kbd-utils.d.ts +2 -5
- package/lib/types/kbd/kbd-utils.d.ts.map +1 -1
- package/lib/types/next/tree-view/TreeView.d.ts +29 -5
- package/lib/types/next/tree-view/TreeView.d.ts.map +1 -1
- package/lib/types/next/tree-view/selection.d.ts +78 -0
- package/lib/types/next/tree-view/selection.d.ts.map +1 -0
- package/lib/types/next/tree-view/stories/index.d.ts +6 -0
- package/lib/types/next/tree-view/stories/index.d.ts.map +1 -1
- package/lib/types/next/tree-view/stories/tree-view-large.story.d.ts +24 -0
- package/lib/types/next/tree-view/stories/tree-view-large.story.d.ts.map +1 -0
- package/lib/types/next/tree-view/stories/tree-view-lazy.story.d.ts.map +1 -1
- package/lib/types/next/tree-view/stories/tree-view-multi.story.d.ts +10 -0
- package/lib/types/next/tree-view/stories/tree-view-multi.story.d.ts.map +1 -1
- package/lib/types/next/tree-view/stories/tree-view-multiple-replace.story.d.ts +29 -0
- package/lib/types/next/tree-view/stories/tree-view-multiple-replace.story.d.ts.map +1 -0
- package/lib/types/next/tree-view/stories/tree-view-non-selectable-folders.story.d.ts +5 -0
- package/lib/types/next/tree-view/stories/tree-view-non-selectable-folders.story.d.ts.map +1 -1
- package/lib/types/next/tree-view/stories/tree-view-root-selection.story.d.ts +24 -0
- package/lib/types/next/tree-view/stories/tree-view-root-selection.story.d.ts.map +1 -0
- package/package.json +2 -2
- package/skills/ndl-react/SKILL.md +1 -1
- package/skills/ndl-react/components/next/tree-view.md +358 -104
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeView.js","sourceRoot":"","sources":["../../../../src/next/tree-view/TreeView.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,8CAAkD;AAClD,4DAAoC;AACpC,iCAUe;AAGf,uFAAiF;AACjF,6CAA0C;AAC1C,+DAA0D;AAC1D,6DAAyD;AACzD,qGAAkG;AAClG,iHAA8G;AAC9G,qCAAkC;AAClC,6CAA0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,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAChD,uBAAC,mBAAQ,IAAa,MAAM,EAAC,MAAM,EAAC,KAAK,EAAC,MAAM,IAAjC,KAAK,CAA+B,CACpD,CAAC,IACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;AACpD,4BAAQ","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 useId,\n useRef,\n useState,\n} from 'react';\n\nimport { type CommonProps, type TooltipObjectProps } from '../../_common/types';\nimport { useSemicontrolledState } from '../../_common/use-semi-controlled-state';\nimport { Checkbox } from '../../checkbox';\nimport { CleanIconButton } from '../../clean-icon-button';\nimport { ConditionalWrap } from '../../conditional-wrap';\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';\n\ntype SelectionMode = 'single' | 'multiple';\n\ntype TreeViewContextValue = {\n focusedId: string | null;\n level: number;\n selectionMode: SelectionMode;\n setFocusedId: (id: string | null) => void;\n};\n\nconst noop = () => undefined;\n\nconst TREE_EVENTS = {\n action: 'treeitem-action',\n collapse: 'treeitem-collapse',\n expand: 'treeitem-expand',\n select: 'treeitem-select',\n} as const;\n\nconst TreeViewContext = createContext<TreeViewContextValue>({\n focusedId: null,\n level: 1,\n selectionMode: 'single',\n setFocusedId: noop,\n});\n\nfunction getVisibleTreeItems(root: HTMLElement): HTMLElement[] {\n return Array.from(\n root.querySelectorAll<HTMLElement>(\n '[role=\"treeitem\"]:not([role=\"group\"][hidden] [role=\"treeitem\"])',\n ),\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 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 /** Selection mode for the tree. Defaults to \"single\". */\n selectionMode?: SelectionMode;\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 selectionMode = 'single',\n ariaLabel,\n ariaLabelledby,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', RootProps>) => {\n const treeRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs([treeRef, ref]);\n const [focusedId, setFocusedId] = useState<string | null>(null);\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((el) => el.id === focusedId);\n let isHandled = true;\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 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 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 current.dispatchEvent(new CustomEvent(TREE_EVENTS.select));\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 [focusedId],\n );\n\n const handleFocus = useCallback(\n (event: React.FocusEvent<HTMLDivElement>) => {\n const root = treeRef.current;\n if (!root) {\n return;\n }\n\n if (event.target === root) {\n const items = getVisibleTreeItems(root);\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 [focusedId],\n );\n\n const classes = classNames(className, 'ndl-tree-view-new');\n\n return (\n <TreeViewContext.Provider\n value={{ focusedId, level: 1, selectionMode, setFocusedId }}\n >\n <div\n ref={mergedRef}\n role=\"tree\"\n aria-multiselectable={selectionMode === 'multiple' || undefined}\n tabIndex={0}\n className={classes}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\n aria-label={ariaLabel ?? undefined}\n aria-labelledby={ariaLabelledby}\n style={style}\n {...htmlAttributes}\n {...restProps}\n >\n {annotateTreeItems(children)}\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 // TODO v5: fix boolean naming convention\n // eslint-disable-next-line @typescript-eslint/naming-convention\n defaultExpanded?: 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 /** 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 is selected */\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. */\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 (`defaultExpanded`)\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 defaultExpanded = false,\n hasChildren: hasChildrenProp,\n isDisabled,\n isExpanded: isExpandedProp,\n isIndeterminate,\n isLoading,\n isSelected,\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 = `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 { focusedId, level, selectionMode, setFocusedId } =\n useContext(TreeViewContext);\n\n const isControlledExpansion = isExpandedProp !== undefined;\n const [isExpanded, setIsExpanded] = useSemicontrolledState({\n isControlled: isControlledExpansion,\n onChange: onExpandedChange,\n state: isExpandedProp ?? defaultExpanded,\n });\n\n const hasChildren = hasChildrenProp ?? Children.count(children) > 0;\n const isSelectable = onSelectedChange !== undefined;\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 const handleSelect = useCallback(() => {\n if (isDisabled) {\n return;\n }\n onSelectedChange?.(!isSelected);\n }, [isDisabled, isSelected, onSelectedChange]);\n\n const handleClick = useCallback(() => {\n if (isDisabled) {\n return;\n }\n setFocusedId(itemId);\n if (isSelectable) {\n handleSelect();\n } else {\n toggleExpanded();\n }\n }, [\n isDisabled,\n setFocusedId,\n itemId,\n isSelectable,\n handleSelect,\n toggleExpanded,\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.select) {\n event.stopPropagation();\n if (isSelectable) {\n handleSelect();\n } else {\n toggleExpanded();\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 [\n actionMenuItems,\n hasChildren,\n isExpanded,\n isDisabled,\n isSelectable,\n setIsExpanded,\n handleSelect,\n toggleExpanded,\n ],\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.select, 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.select, handleCustomEvents);\n node.addEventListener(TREE_EVENTS.action, handleCustomEvents);\n }\n },\n [handleCustomEvents],\n );\n\n const mergedRef = useMergeRefs([callbackRef, ref]);\n\n const isFocused = focusedId === itemId;\n\n const selectionAriaProps = (() => {\n if (!isSelectable) {\n return {};\n }\n if (isMultiple) {\n return {\n 'aria-checked': isIndeterminate\n ? ('mixed' as const)\n : (isSelected ?? false),\n };\n }\n return { 'aria-selected': isSelected ?? false };\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 id={itemId}\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, {\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();\n }}\n {...htmlAttributes}\n {...restProps}\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\n value={{ focusedId, level: level + 1, selectionMode, setFocusedId }}\n >\n <div\n role=\"group\"\n id={groupId}\n hidden={!isExpanded}\n style={{ '--tree-level': level - 1 } as React.CSSProperties}\n >\n {annotateTreeItems(children)}\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={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\nconst TreeView = Object.assign(Root, { Item, SkeletonItem });\nexport { TreeView };\n"]}
|
|
1
|
+
{"version":3,"file":"TreeView.js","sourceRoot":"","sources":["../../../../src/next/tree-view/TreeView.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,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c,EACd,GAAG,OAEmC,EADnC,SAAS,cANQ,uDAOrB,CADa;IAEZ,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,kBAAU,EAAC,eAAe,CAAC,CAAC;IAC9C,OAAO,CACL,8CACE,GAAG,EAAE,GAAG,iBACI,MAAM,EAClB,SAAS,EAAE,IAAA,oBAAU,EAAC,4BAA4B,EAAE,SAAS,CAAC,EAC9D,KAAK,EAAE,gBAAE,cAAc,EAAE,KAAK,GAAG,CAAC,IAAK,KAAK,CAAyB,IACjE,cAAc,EACd,SAAS,cAEZ,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAChD,uBAAC,mBAAQ,IAAa,MAAM,EAAC,MAAM,EAAC,KAAK,EAAC,MAAM,IAAjC,KAAK,CAA+B,CACpD,CAAC,IACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC;AACpD,4BAAQ","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 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 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 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={0}\n className={classes}\n onKeyDown={handleKeyDown}\n onFocus={handleFocus}\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 // TODO v5: fix boolean naming convention\n // eslint-disable-next-line @typescript-eslint/naming-convention\n defaultExpanded?: 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 (`defaultExpanded`)\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 defaultExpanded = 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 ?? defaultExpanded,\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"]}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) "Neo4j"
|
|
5
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
6
|
+
*
|
|
7
|
+
* This file is part of Neo4j.
|
|
8
|
+
*
|
|
9
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
10
|
+
* it under the terms of the GNU General Public License as published by
|
|
11
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
12
|
+
* (at your option) any later version.
|
|
13
|
+
*
|
|
14
|
+
* This program is distributed in the hope that it will be useful,
|
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
+
* GNU General Public License for more details.
|
|
18
|
+
*
|
|
19
|
+
* You should have received a copy of the GNU General Public License
|
|
20
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
21
|
+
*/
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.computeNextSelection = computeNextSelection;
|
|
24
|
+
exports.computeSelectionEdges = computeSelectionEdges;
|
|
25
|
+
exports.countChangedIds = countChangedIds;
|
|
26
|
+
exports.formatSelectionAnnouncement = formatSelectionAnnouncement;
|
|
27
|
+
/**
|
|
28
|
+
* Ids that are selected but cannot be acted on, because they are disabled or
|
|
29
|
+
* not selectable. A replacing selection leaves them exactly as they are rather
|
|
30
|
+
* than clearing them behind the user's back.
|
|
31
|
+
*/
|
|
32
|
+
function getLockedIds(selectedIds, selectableIds) {
|
|
33
|
+
return [...selectedIds].filter((id) => !selectableIds.has(id));
|
|
34
|
+
}
|
|
35
|
+
function getRangeIds(visibleIds, fromId, toId, selectableIds) {
|
|
36
|
+
const fromIndex = visibleIds.indexOf(fromId);
|
|
37
|
+
const toIndex = visibleIds.indexOf(toId);
|
|
38
|
+
const [start, end] = fromIndex <= toIndex ? [fromIndex, toIndex] : [toIndex, fromIndex];
|
|
39
|
+
return visibleIds.slice(start, end + 1).filter((id) => selectableIds.has(id));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The anchor may have been scrolled out of reach by a collapse. Walking up to
|
|
43
|
+
* its nearest visible ancestor keeps a range measurable from roughly where the
|
|
44
|
+
* user put it, instead of silently collapsing the range to a single item.
|
|
45
|
+
*/
|
|
46
|
+
function resolveVisibleAnchorId(anchor, visibleIds, parentIdById) {
|
|
47
|
+
if (anchor === null) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const visible = new Set(visibleIds);
|
|
51
|
+
let candidate = anchor.id;
|
|
52
|
+
while (candidate !== undefined) {
|
|
53
|
+
if (visible.has(candidate)) {
|
|
54
|
+
return candidate;
|
|
55
|
+
}
|
|
56
|
+
candidate = parentIdById.get(candidate);
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
function toggleId(selectedIds, targetId) {
|
|
61
|
+
const next = new Set(selectedIds);
|
|
62
|
+
if (next.has(targetId)) {
|
|
63
|
+
next.delete(targetId);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
next.add(targetId);
|
|
67
|
+
}
|
|
68
|
+
return next;
|
|
69
|
+
}
|
|
70
|
+
function anchorAt(id, selectedIds) {
|
|
71
|
+
return {
|
|
72
|
+
baseSelectedIds: new Set(selectedIds),
|
|
73
|
+
id,
|
|
74
|
+
isSelected: selectedIds.has(id),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Resolves a selection gesture into the complete next selection. Pure: the
|
|
79
|
+
* caller supplies the current state and applies the result.
|
|
80
|
+
*/
|
|
81
|
+
function computeNextSelection({ anchor, intent, parentIdById, selectableIds, selectedIds, selectionMode, targetId, visibleIds, }) {
|
|
82
|
+
var _a;
|
|
83
|
+
if (!selectableIds.has(targetId) || !visibleIds.includes(targetId)) {
|
|
84
|
+
return { anchor, selectedIds: new Set(selectedIds) };
|
|
85
|
+
}
|
|
86
|
+
if (selectionMode === 'single') {
|
|
87
|
+
const next = new Set([targetId]);
|
|
88
|
+
return { anchor: anchorAt(targetId, next), selectedIds: next };
|
|
89
|
+
}
|
|
90
|
+
const anchorId = intent.isRange
|
|
91
|
+
? resolveVisibleAnchorId(anchor, visibleIds, parentIdById)
|
|
92
|
+
: null;
|
|
93
|
+
if (selectionMode === 'multiple') {
|
|
94
|
+
if (!intent.isRange || anchorId === null) {
|
|
95
|
+
const next = toggleId(selectedIds, targetId);
|
|
96
|
+
return { anchor: anchorAt(targetId, next), selectedIds: next };
|
|
97
|
+
}
|
|
98
|
+
// A range repeats whatever the anchor row was last put into. An anchor
|
|
99
|
+
// resolved from a collapsed group may not be selectable at all, in which
|
|
100
|
+
// case there is no prior action to repeat and selecting is the useful default.
|
|
101
|
+
const isPaintingSelected = selectableIds.has(anchorId)
|
|
102
|
+
? ((_a = anchor === null || anchor === void 0 ? void 0 : anchor.isSelected) !== null && _a !== void 0 ? _a : true)
|
|
103
|
+
: true;
|
|
104
|
+
const next = new Set(selectedIds);
|
|
105
|
+
getRangeIds(visibleIds, anchorId, targetId, selectableIds).forEach((id) => {
|
|
106
|
+
if (isPaintingSelected) {
|
|
107
|
+
next.add(id);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
next.delete(id);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
return { anchor, selectedIds: next };
|
|
114
|
+
}
|
|
115
|
+
const lockedIds = getLockedIds(selectedIds, selectableIds);
|
|
116
|
+
if (intent.isRange) {
|
|
117
|
+
const rangeIds = getRangeIds(visibleIds, anchorId !== null && anchorId !== void 0 ? anchorId : targetId, targetId, selectableIds);
|
|
118
|
+
const baseIds = anchor === null
|
|
119
|
+
? []
|
|
120
|
+
: [...anchor.baseSelectedIds].filter((id) => selectableIds.has(id) && visibleIds.includes(id));
|
|
121
|
+
const next = new Set([...lockedIds, ...baseIds, ...rangeIds]);
|
|
122
|
+
return {
|
|
123
|
+
anchor: anchorId === null ? anchorAt(targetId, next) : anchor,
|
|
124
|
+
selectedIds: next,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
if (intent.isToggle) {
|
|
128
|
+
const next = toggleId(selectedIds, targetId);
|
|
129
|
+
return { anchor: anchorAt(targetId, next), selectedIds: next };
|
|
130
|
+
}
|
|
131
|
+
const next = new Set([...lockedIds, targetId]);
|
|
132
|
+
return { anchor: anchorAt(targetId, next), selectedIds: next };
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Marks each selected item's position within its run of adjacent selected
|
|
136
|
+
* items, so a run can be styled as one block.
|
|
137
|
+
*/
|
|
138
|
+
function computeSelectionEdges(visibleIds, selectedIds) {
|
|
139
|
+
const edges = new Map();
|
|
140
|
+
visibleIds.forEach((id, index) => {
|
|
141
|
+
if (!selectedIds.has(id)) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const hasPreviousSelected = index > 0 && selectedIds.has(visibleIds[index - 1]);
|
|
145
|
+
const hasNextSelected = index < visibleIds.length - 1 && selectedIds.has(visibleIds[index + 1]);
|
|
146
|
+
if (hasPreviousSelected && hasNextSelected) {
|
|
147
|
+
edges.set(id, 'middle');
|
|
148
|
+
}
|
|
149
|
+
else if (hasNextSelected) {
|
|
150
|
+
edges.set(id, 'top');
|
|
151
|
+
}
|
|
152
|
+
else if (hasPreviousSelected) {
|
|
153
|
+
edges.set(id, 'bottom');
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
return edges;
|
|
157
|
+
}
|
|
158
|
+
function countChangedIds(previous, next) {
|
|
159
|
+
let changed = 0;
|
|
160
|
+
previous.forEach((id) => {
|
|
161
|
+
if (!next.has(id)) {
|
|
162
|
+
changed++;
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
next.forEach((id) => {
|
|
166
|
+
if (!previous.has(id)) {
|
|
167
|
+
changed++;
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
return changed;
|
|
171
|
+
}
|
|
172
|
+
function formatSelectionAnnouncement(selectedCount) {
|
|
173
|
+
if (selectedCount === 0) {
|
|
174
|
+
return 'No items selected';
|
|
175
|
+
}
|
|
176
|
+
if (selectedCount === 1) {
|
|
177
|
+
return '1 item selected';
|
|
178
|
+
}
|
|
179
|
+
return `${selectedCount} items selected`;
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=selection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.js","sourceRoot":"","sources":["../../../../src/next/tree-view/selection.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AAiIH,oDA0EC;AAMD,sDAsBC;AAED,0CAgBC;AAED,kEAQC;AA/MD;;;;GAIG;AACH,SAAS,YAAY,CACnB,WAAgC,EAChC,aAAkC;IAElC,OAAO,CAAC,GAAG,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,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,CAAC;IACD,OAAO,GAAG,aAAa,iBAAiB,CAAC;AAC3C,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport type SelectionMode = 'single' | 'multiple' | 'multiple-replace';\n\nexport type SelectionEdge = 'top' | 'middle' | 'bottom';\n\n/** Modifier keys resolved from a pointer or keyboard event. */\nexport type SelectionIntent = {\n /** Shift: extend from the anchor to the target. */\n isRange: boolean;\n /**\n * Cmd on Apple platforms, Ctrl elsewhere. Ignored in `multiple`, where an\n * unmodified click already toggles.\n */\n isToggle: boolean;\n};\n\n/**\n * Where a range is measured from.\n *\n * `baseSelectedIds` is the selection as it stood immediately after the anchor\n * was placed. A `multiple-replace` range unions its visible members with the\n * range so it can be grown and shrunk without losing earlier picks.\n * `isSelected` is the state the anchor row was placed into, which a `multiple`\n * range paints across its members.\n */\nexport type SelectionAnchor = {\n baseSelectedIds: ReadonlySet<string>;\n id: string;\n isSelected: boolean;\n} | null;\n\ntype ComputeNextSelectionInput = {\n anchor: SelectionAnchor;\n intent: SelectionIntent;\n /** Ids of every selectable, non-disabled item, visible or not. */\n selectableIds: ReadonlySet<string>;\n /** Currently selected ids, including items inside collapsed groups. */\n selectedIds: ReadonlySet<string>;\n selectionMode: SelectionMode;\n targetId: string;\n /** Ids of the items the user can currently see, in visual order. */\n visibleIds: readonly string[];\n /** Maps an item id to the id of the item that owns its group. */\n parentIdById: ReadonlyMap<string, string>;\n};\n\ntype ComputeNextSelectionResult = {\n anchor: SelectionAnchor;\n selectedIds: Set<string>;\n};\n\n/**\n * Ids that are selected but cannot be acted on, because they are disabled or\n * not selectable. A replacing selection leaves them exactly as they are rather\n * than clearing them behind the user's back.\n */\nfunction getLockedIds(\n selectedIds: ReadonlySet<string>,\n selectableIds: ReadonlySet<string>,\n): string[] {\n return [...selectedIds].filter((id) => !selectableIds.has(id));\n}\n\nfunction getRangeIds(\n visibleIds: readonly string[],\n fromId: string,\n toId: string,\n selectableIds: ReadonlySet<string>,\n): string[] {\n const fromIndex = visibleIds.indexOf(fromId);\n const toIndex = visibleIds.indexOf(toId);\n const [start, end] =\n fromIndex <= toIndex ? [fromIndex, toIndex] : [toIndex, fromIndex];\n return visibleIds.slice(start, end + 1).filter((id) => selectableIds.has(id));\n}\n\n/**\n * The anchor may have been scrolled out of reach by a collapse. Walking up to\n * its nearest visible ancestor keeps a range measurable from roughly where the\n * user put it, instead of silently collapsing the range to a single item.\n */\nfunction resolveVisibleAnchorId(\n anchor: SelectionAnchor,\n visibleIds: readonly string[],\n parentIdById: ReadonlyMap<string, string>,\n): string | null {\n if (anchor === null) {\n return null;\n }\n const visible = new Set(visibleIds);\n let candidate: string | undefined = anchor.id;\n while (candidate !== undefined) {\n if (visible.has(candidate)) {\n return candidate;\n }\n candidate = parentIdById.get(candidate);\n }\n return null;\n}\n\nfunction toggleId(\n selectedIds: ReadonlySet<string>,\n targetId: string,\n): Set<string> {\n const next = new Set(selectedIds);\n if (next.has(targetId)) {\n next.delete(targetId);\n } else {\n next.add(targetId);\n }\n return next;\n}\n\nfunction anchorAt(\n id: string,\n selectedIds: ReadonlySet<string>,\n): SelectionAnchor {\n return {\n baseSelectedIds: new Set(selectedIds),\n id,\n isSelected: selectedIds.has(id),\n };\n}\n\n/**\n * Resolves a selection gesture into the complete next selection. Pure: the\n * caller supplies the current state and applies the result.\n */\nexport function computeNextSelection({\n anchor,\n intent,\n parentIdById,\n selectableIds,\n selectedIds,\n selectionMode,\n targetId,\n visibleIds,\n}: ComputeNextSelectionInput): ComputeNextSelectionResult {\n if (!selectableIds.has(targetId) || !visibleIds.includes(targetId)) {\n return { anchor, selectedIds: new Set(selectedIds) };\n }\n\n if (selectionMode === 'single') {\n const next = new Set([targetId]);\n return { anchor: anchorAt(targetId, next), selectedIds: next };\n }\n\n const anchorId = intent.isRange\n ? resolveVisibleAnchorId(anchor, visibleIds, parentIdById)\n : null;\n\n if (selectionMode === 'multiple') {\n if (!intent.isRange || anchorId === null) {\n const next = toggleId(selectedIds, targetId);\n return { anchor: anchorAt(targetId, next), selectedIds: next };\n }\n // A range repeats whatever the anchor row was last put into. An anchor\n // resolved from a collapsed group may not be selectable at all, in which\n // case there is no prior action to repeat and selecting is the useful default.\n const isPaintingSelected = selectableIds.has(anchorId)\n ? (anchor?.isSelected ?? true)\n : true;\n const next = new Set(selectedIds);\n getRangeIds(visibleIds, anchorId, targetId, selectableIds).forEach((id) => {\n if (isPaintingSelected) {\n next.add(id);\n } else {\n next.delete(id);\n }\n });\n return { anchor, selectedIds: next };\n }\n\n const lockedIds = getLockedIds(selectedIds, selectableIds);\n\n if (intent.isRange) {\n const rangeIds = getRangeIds(\n visibleIds,\n anchorId ?? targetId,\n targetId,\n selectableIds,\n );\n const baseIds =\n anchor === null\n ? []\n : [...anchor.baseSelectedIds].filter(\n (id) => selectableIds.has(id) && visibleIds.includes(id),\n );\n const next = new Set([...lockedIds, ...baseIds, ...rangeIds]);\n return {\n anchor: anchorId === null ? anchorAt(targetId, next) : anchor,\n selectedIds: next,\n };\n }\n\n if (intent.isToggle) {\n const next = toggleId(selectedIds, targetId);\n return { anchor: anchorAt(targetId, next), selectedIds: next };\n }\n\n const next = new Set([...lockedIds, targetId]);\n return { anchor: anchorAt(targetId, next), selectedIds: next };\n}\n\n/**\n * Marks each selected item's position within its run of adjacent selected\n * items, so a run can be styled as one block.\n */\nexport function computeSelectionEdges(\n visibleIds: readonly string[],\n selectedIds: ReadonlySet<string>,\n): Map<string, SelectionEdge> {\n const edges = new Map<string, SelectionEdge>();\n visibleIds.forEach((id, index) => {\n if (!selectedIds.has(id)) {\n return;\n }\n const hasPreviousSelected =\n index > 0 && selectedIds.has(visibleIds[index - 1]);\n const hasNextSelected =\n index < visibleIds.length - 1 && selectedIds.has(visibleIds[index + 1]);\n if (hasPreviousSelected && hasNextSelected) {\n edges.set(id, 'middle');\n } else if (hasNextSelected) {\n edges.set(id, 'top');\n } else if (hasPreviousSelected) {\n edges.set(id, 'bottom');\n }\n });\n return edges;\n}\n\nexport function countChangedIds(\n previous: ReadonlySet<string>,\n next: ReadonlySet<string>,\n): number {\n let changed = 0;\n previous.forEach((id) => {\n if (!next.has(id)) {\n changed++;\n }\n });\n next.forEach((id) => {\n if (!previous.has(id)) {\n changed++;\n }\n });\n return changed;\n}\n\nexport function formatSelectionAnnouncement(selectedCount: number): string {\n if (selectedCount === 0) {\n return 'No items selected';\n }\n if (selectedCount === 1) {\n return '1 item selected';\n }\n return `${selectedCount} items selected`;\n}\n"]}
|
|
@@ -23,13 +23,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.TreeViewUncontrolledExpansionSrc = exports.TreeViewTooltipSrc = exports.TreeViewTrailingContentSrc = exports.TreeViewSingleSelectSrc = exports.TreeViewNonSelectableFoldersSrc = exports.TreeViewMultiSelectSrc = exports.TreeViewLazyLoadingSrc = exports.TreeViewActionsSrc = exports.TreeViewWithTooltip = exports.TreeViewWithTrailingContent = exports.TreeViewUncontrolledExpansion = exports.TreeViewWithActions = exports.TreeViewSingleSelect = exports.TreeViewNonSelectableFolders = exports.TreeViewMultiSelect = exports.TreeViewLazyLoading = void 0;
|
|
26
|
+
exports.TreeViewUncontrolledExpansionSrc = exports.TreeViewTooltipSrc = exports.TreeViewTrailingContentSrc = exports.TreeViewSingleSelectSrc = exports.TreeViewRootSelectionSrc = exports.TreeViewNonSelectableFoldersSrc = exports.TreeViewMultipleReplaceSrc = exports.TreeViewMultiSelectSrc = exports.TreeViewLazyLoadingSrc = exports.TreeViewLargeSrc = exports.TreeViewActionsSrc = exports.TreeViewWithTooltip = exports.TreeViewWithTrailingContent = exports.TreeViewUncontrolledExpansion = exports.TreeViewWithActions = exports.TreeViewSingleSelect = exports.TreeViewRootSelection = exports.TreeViewNonSelectableFolders = exports.TreeViewMultipleReplace = exports.TreeViewMultiSelect = exports.TreeViewLazyLoading = exports.TreeViewLarge = void 0;
|
|
27
|
+
var tree_view_large_story_1 = require("./tree-view-large.story");
|
|
28
|
+
Object.defineProperty(exports, "TreeViewLarge", { enumerable: true, get: function () { return __importDefault(tree_view_large_story_1).default; } });
|
|
27
29
|
var tree_view_lazy_story_1 = require("./tree-view-lazy.story");
|
|
28
30
|
Object.defineProperty(exports, "TreeViewLazyLoading", { enumerable: true, get: function () { return __importDefault(tree_view_lazy_story_1).default; } });
|
|
29
31
|
var tree_view_multi_story_1 = require("./tree-view-multi.story");
|
|
30
32
|
Object.defineProperty(exports, "TreeViewMultiSelect", { enumerable: true, get: function () { return __importDefault(tree_view_multi_story_1).default; } });
|
|
33
|
+
var tree_view_multiple_replace_story_1 = require("./tree-view-multiple-replace.story");
|
|
34
|
+
Object.defineProperty(exports, "TreeViewMultipleReplace", { enumerable: true, get: function () { return __importDefault(tree_view_multiple_replace_story_1).default; } });
|
|
31
35
|
var tree_view_non_selectable_folders_story_1 = require("./tree-view-non-selectable-folders.story");
|
|
32
36
|
Object.defineProperty(exports, "TreeViewNonSelectableFolders", { enumerable: true, get: function () { return __importDefault(tree_view_non_selectable_folders_story_1).default; } });
|
|
37
|
+
var tree_view_root_selection_story_1 = require("./tree-view-root-selection.story");
|
|
38
|
+
Object.defineProperty(exports, "TreeViewRootSelection", { enumerable: true, get: function () { return __importDefault(tree_view_root_selection_story_1).default; } });
|
|
33
39
|
var tree_view_single_story_1 = require("./tree-view-single.story");
|
|
34
40
|
Object.defineProperty(exports, "TreeViewSingleSelect", { enumerable: true, get: function () { return __importDefault(tree_view_single_story_1).default; } });
|
|
35
41
|
var tree_view_actions_story_1 = require("./tree-view-actions.story");
|
|
@@ -42,17 +48,23 @@ var tree_view_tooltip_story_1 = require("./tree-view-tooltip.story");
|
|
|
42
48
|
Object.defineProperty(exports, "TreeViewWithTooltip", { enumerable: true, get: function () { return __importDefault(tree_view_tooltip_story_1).default; } });
|
|
43
49
|
const export_stories_utils_1 = require("../../../_common/export-stories-utils");
|
|
44
50
|
const tree_view_actions_story_raw_1 = __importDefault(require("./tree-view-actions.story?raw"));
|
|
51
|
+
const tree_view_large_story_raw_1 = __importDefault(require("./tree-view-large.story?raw"));
|
|
45
52
|
const tree_view_lazy_story_raw_1 = __importDefault(require("./tree-view-lazy.story?raw"));
|
|
46
53
|
const tree_view_multi_story_raw_1 = __importDefault(require("./tree-view-multi.story?raw"));
|
|
54
|
+
const tree_view_multiple_replace_story_raw_1 = __importDefault(require("./tree-view-multiple-replace.story?raw"));
|
|
47
55
|
const tree_view_non_selectable_folders_story_raw_1 = __importDefault(require("./tree-view-non-selectable-folders.story?raw"));
|
|
56
|
+
const tree_view_root_selection_story_raw_1 = __importDefault(require("./tree-view-root-selection.story?raw"));
|
|
48
57
|
const tree_view_single_story_raw_1 = __importDefault(require("./tree-view-single.story?raw"));
|
|
49
58
|
const tree_view_tooltip_story_raw_1 = __importDefault(require("./tree-view-tooltip.story?raw"));
|
|
50
59
|
const tree_view_trailing_story_raw_1 = __importDefault(require("./tree-view-trailing.story?raw"));
|
|
51
60
|
const tree_view_uncontrolled_story_raw_1 = __importDefault(require("./tree-view-uncontrolled.story?raw"));
|
|
52
61
|
exports.TreeViewActionsSrc = (0, export_stories_utils_1.removeLicenseHeader)(tree_view_actions_story_raw_1.default);
|
|
62
|
+
exports.TreeViewLargeSrc = (0, export_stories_utils_1.removeLicenseHeader)(tree_view_large_story_raw_1.default);
|
|
53
63
|
exports.TreeViewLazyLoadingSrc = (0, export_stories_utils_1.removeLicenseHeader)(tree_view_lazy_story_raw_1.default);
|
|
54
64
|
exports.TreeViewMultiSelectSrc = (0, export_stories_utils_1.removeLicenseHeader)(tree_view_multi_story_raw_1.default);
|
|
65
|
+
exports.TreeViewMultipleReplaceSrc = (0, export_stories_utils_1.removeLicenseHeader)(tree_view_multiple_replace_story_raw_1.default);
|
|
55
66
|
exports.TreeViewNonSelectableFoldersSrc = (0, export_stories_utils_1.removeLicenseHeader)(tree_view_non_selectable_folders_story_raw_1.default);
|
|
67
|
+
exports.TreeViewRootSelectionSrc = (0, export_stories_utils_1.removeLicenseHeader)(tree_view_root_selection_story_raw_1.default);
|
|
56
68
|
exports.TreeViewSingleSelectSrc = (0, export_stories_utils_1.removeLicenseHeader)(tree_view_single_story_raw_1.default);
|
|
57
69
|
exports.TreeViewTrailingContentSrc = (0, export_stories_utils_1.removeLicenseHeader)(tree_view_trailing_story_raw_1.default);
|
|
58
70
|
exports.TreeViewTooltipSrc = (0, export_stories_utils_1.removeLicenseHeader)(tree_view_tooltip_story_raw_1.default);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;AAEH,+DAAwE;AAA/D,4IAAA,OAAO,OAAuB;AACvC,iEAAyE;AAAhE,6IAAA,OAAO,OAAuB;AACvC,mGAAmG;AAA1F,uKAAA,OAAO,OAAgC;AAChD,mEAA2E;AAAlE,+IAAA,OAAO,OAAwB;AACxC,qEAA2E;AAAlE,+IAAA,OAAO,OAAuB;AACvC,+EAA0F;AAAjF,8JAAA,OAAO,OAAiC;AACjD,uEAAoF;AAA3E,wJAAA,OAAO,OAA+B;AAC/C,qEAA2E;AAAlE,+IAAA,OAAO,OAAuB;AAEvC,gFAA4E;AAC5E,gGAAkE;AAClE,0FAAmE;AACnE,4FAAoE;AACpE,8HAA8F;AAC9F,8FAAsE;AACtE,gGAAkE;AAClE,kGAA2E;AAC3E,0GAAqF;AAExE,QAAA,kBAAkB,GAAG,IAAA,0CAAmB,EAAC,qCAAqB,CAAC,CAAC;AAChE,QAAA,sBAAsB,GAAG,IAAA,0CAAmB,EACvD,kCAAyB,CAC1B,CAAC;AACW,QAAA,sBAAsB,GAAG,IAAA,0CAAmB,EACvD,mCAAyB,CAC1B,CAAC;AACW,QAAA,+BAA+B,GAAG,IAAA,0CAAmB,EAChE,oDAAkC,CACnC,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,0CAAmB,EACxD,oCAA0B,CAC3B,CAAC;AACW,QAAA,0BAA0B,GAAG,IAAA,0CAAmB,EAC3D,sCAA6B,CAC9B,CAAC;AACW,QAAA,kBAAkB,GAAG,IAAA,0CAAmB,EAAC,qCAAqB,CAAC,CAAC;AAChE,QAAA,gCAAgC,GAAG,IAAA,0CAAmB,EACjE,0CAAmC,CACpC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { default as TreeViewLazyLoading } from './tree-view-lazy.story';\nexport { default as TreeViewMultiSelect } from './tree-view-multi.story';\nexport { default as TreeViewNonSelectableFolders } from './tree-view-non-selectable-folders.story';\nexport { default as TreeViewSingleSelect } from './tree-view-single.story';\nexport { default as TreeViewWithActions } from './tree-view-actions.story';\nexport { default as TreeViewUncontrolledExpansion } from './tree-view-uncontrolled.story';\nexport { default as TreeViewWithTrailingContent } from './tree-view-trailing.story';\nexport { default as TreeViewWithTooltip } from './tree-view-tooltip.story';\n\nimport { removeLicenseHeader } from '../../../_common/export-stories-utils';\nimport TreeViewActionsSrcRaw from './tree-view-actions.story?raw';\nimport TreeViewLazyLoadingSrcRaw from './tree-view-lazy.story?raw';\nimport TreeViewMultiSelectSrcRaw from './tree-view-multi.story?raw';\nimport TreeViewNonSelectableFoldersSrcRaw from './tree-view-non-selectable-folders.story?raw';\nimport TreeViewSingleSelectSrcRaw from './tree-view-single.story?raw';\nimport TreeViewTooltipSrcRaw from './tree-view-tooltip.story?raw';\nimport TreeViewTrailingContentSrcRaw from './tree-view-trailing.story?raw';\nimport TreeViewUncontrolledExpansionSrcRaw from './tree-view-uncontrolled.story?raw';\n\nexport const TreeViewActionsSrc = removeLicenseHeader(TreeViewActionsSrcRaw);\nexport const TreeViewLazyLoadingSrc = removeLicenseHeader(\n TreeViewLazyLoadingSrcRaw,\n);\nexport const TreeViewMultiSelectSrc = removeLicenseHeader(\n TreeViewMultiSelectSrcRaw,\n);\nexport const TreeViewNonSelectableFoldersSrc = removeLicenseHeader(\n TreeViewNonSelectableFoldersSrcRaw,\n);\nexport const TreeViewSingleSelectSrc = removeLicenseHeader(\n TreeViewSingleSelectSrcRaw,\n);\nexport const TreeViewTrailingContentSrc = removeLicenseHeader(\n TreeViewTrailingContentSrcRaw,\n);\nexport const TreeViewTooltipSrc = removeLicenseHeader(TreeViewTooltipSrcRaw);\nexport const TreeViewUncontrolledExpansionSrc = removeLicenseHeader(\n TreeViewUncontrolledExpansionSrcRaw,\n);\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;AAEH,iEAAmE;AAA1D,uIAAA,OAAO,OAAiB;AACjC,+DAAwE;AAA/D,4IAAA,OAAO,OAAuB;AACvC,i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AChE,QAAA,gCAAgC,GAAG,IAAA,0CAAmB,EACjE,0CAAmC,CACpC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { default as TreeViewLarge } from './tree-view-large.story';\nexport { default as TreeViewLazyLoading } from './tree-view-lazy.story';\nexport { default as TreeViewMultiSelect } from './tree-view-multi.story';\nexport { default as TreeViewMultipleReplace } from './tree-view-multiple-replace.story';\nexport { default as TreeViewNonSelectableFolders } from './tree-view-non-selectable-folders.story';\nexport { default as TreeViewRootSelection } from './tree-view-root-selection.story';\nexport { default as TreeViewSingleSelect } from './tree-view-single.story';\nexport { default as TreeViewWithActions } from './tree-view-actions.story';\nexport { default as TreeViewUncontrolledExpansion } from './tree-view-uncontrolled.story';\nexport { default as TreeViewWithTrailingContent } from './tree-view-trailing.story';\nexport { default as TreeViewWithTooltip } from './tree-view-tooltip.story';\n\nimport { removeLicenseHeader } from '../../../_common/export-stories-utils';\nimport TreeViewActionsSrcRaw from './tree-view-actions.story?raw';\nimport TreeViewLargeSrcRaw from './tree-view-large.story?raw';\nimport TreeViewLazyLoadingSrcRaw from './tree-view-lazy.story?raw';\nimport TreeViewMultiSelectSrcRaw from './tree-view-multi.story?raw';\nimport TreeViewMultipleReplaceSrcRaw from './tree-view-multiple-replace.story?raw';\nimport TreeViewNonSelectableFoldersSrcRaw from './tree-view-non-selectable-folders.story?raw';\nimport TreeViewRootSelectionSrcRaw from './tree-view-root-selection.story?raw';\nimport TreeViewSingleSelectSrcRaw from './tree-view-single.story?raw';\nimport TreeViewTooltipSrcRaw from './tree-view-tooltip.story?raw';\nimport TreeViewTrailingContentSrcRaw from './tree-view-trailing.story?raw';\nimport TreeViewUncontrolledExpansionSrcRaw from './tree-view-uncontrolled.story?raw';\n\nexport const TreeViewActionsSrc = removeLicenseHeader(TreeViewActionsSrcRaw);\nexport const TreeViewLargeSrc = removeLicenseHeader(TreeViewLargeSrcRaw);\nexport const TreeViewLazyLoadingSrc = removeLicenseHeader(\n TreeViewLazyLoadingSrcRaw,\n);\nexport const TreeViewMultiSelectSrc = removeLicenseHeader(\n TreeViewMultiSelectSrcRaw,\n);\nexport const TreeViewMultipleReplaceSrc = removeLicenseHeader(\n TreeViewMultipleReplaceSrcRaw,\n);\nexport const TreeViewNonSelectableFoldersSrc = removeLicenseHeader(\n TreeViewNonSelectableFoldersSrcRaw,\n);\nexport const TreeViewRootSelectionSrc = removeLicenseHeader(\n TreeViewRootSelectionSrcRaw,\n);\nexport const TreeViewSingleSelectSrc = removeLicenseHeader(\n TreeViewSingleSelectSrcRaw,\n);\nexport const TreeViewTrailingContentSrc = removeLicenseHeader(\n TreeViewTrailingContentSrcRaw,\n);\nexport const TreeViewTooltipSrc = removeLicenseHeader(TreeViewTooltipSrcRaw);\nexport const TreeViewUncontrolledExpansionSrc = removeLicenseHeader(\n TreeViewUncontrolledExpansionSrcRaw,\n);\n"]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) "Neo4j"
|
|
7
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
8
|
+
*
|
|
9
|
+
* This file is part of Neo4j.
|
|
10
|
+
*
|
|
11
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
12
|
+
* it under the terms of the GNU General Public License as published by
|
|
13
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
14
|
+
* (at your option) any later version.
|
|
15
|
+
*
|
|
16
|
+
* This program is distributed in the hope that it will be useful,
|
|
17
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19
|
+
* GNU General Public License for more details.
|
|
20
|
+
*
|
|
21
|
+
* You should have received a copy of the GNU General Public License
|
|
22
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
|
+
*/
|
|
24
|
+
require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
|
|
25
|
+
const icons_1 = require("@neo4j-ndl/react/icons");
|
|
26
|
+
const next_1 = require("@neo4j-ndl/react/next");
|
|
27
|
+
const react_1 = require("react");
|
|
28
|
+
const TOP_FOLDER_COUNT = 7;
|
|
29
|
+
const SUBFOLDER_COUNT = 9;
|
|
30
|
+
const FILE_COUNT = 10;
|
|
31
|
+
/**
|
|
32
|
+
* 7 top folders + 63 subfolders + 630 files = 700 items, all expanded so every
|
|
33
|
+
* row is mounted and visible. Exercises the worst-case performance paths:
|
|
34
|
+
* arrow-key navigation, Shift ranges, and the multiple-replace edge styling.
|
|
35
|
+
*/
|
|
36
|
+
const files = Array.from({ length: TOP_FOLDER_COUNT }, (_unused, folderIndex) => ({
|
|
37
|
+
children: Array.from({ length: SUBFOLDER_COUNT }, (_unused, subIndex) => ({
|
|
38
|
+
children: Array.from({ length: FILE_COUNT }, (_unused, fileIndex) => ({
|
|
39
|
+
id: `file-${folderIndex}-${subIndex}-${fileIndex}`,
|
|
40
|
+
title: `file-${folderIndex}-${subIndex}-${fileIndex}.txt`,
|
|
41
|
+
})),
|
|
42
|
+
id: `subfolder-${folderIndex}-${subIndex}`,
|
|
43
|
+
title: `Subfolder ${folderIndex}.${subIndex}`,
|
|
44
|
+
})),
|
|
45
|
+
id: `folder-${folderIndex}`,
|
|
46
|
+
title: `Folder ${folderIndex}`,
|
|
47
|
+
}));
|
|
48
|
+
const Component = () => {
|
|
49
|
+
const [selectedIds, setSelectedIds] = (0, react_1.useState)([]);
|
|
50
|
+
const renderNode = (node) => {
|
|
51
|
+
var _a;
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { id: node.id, title: node.title, defaultExpanded: true, leadingVisual: node.children === undefined ? ((0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {})) : ((0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {})), children: (_a = node.children) === null || _a === void 0 ? void 0 : _a.map(renderNode) }, node.id));
|
|
53
|
+
};
|
|
54
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("p", { style: { marginBottom: '8px' }, children: ["700 items, ", selectedIds.length, " selected"] }), (0, jsx_runtime_1.jsx)(next_1.TreeView, { ariaLabel: "Large file explorer", selectionMode: "multiple-replace", selectedIds: selectedIds, onSelectedIdsChange: setSelectedIds, children: files.map(renderNode) })] }));
|
|
55
|
+
};
|
|
56
|
+
exports.default = Component;
|
|
57
|
+
//# sourceMappingURL=tree-view-large.story.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree-view-large.story.js","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/tree-view-large.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,kDAA8E;AAC9E,gDAAiD;AACjD,iCAAiC;AAQjC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB;;;;GAIG;AACH,MAAM,KAAK,GAAe,KAAK,CAAC,IAAI,CAClC,EAAE,MAAM,EAAE,gBAAgB,EAAE,EAC5B,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,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,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,4BACnB,WAAW,CAAC,MAAM,iBAC5B,EACJ,uBAAC,eAAQ,IACP,SAAS,EAAC,qBAAqB,EAC/B,aAAa,EAAC,kBAAkB,EAChC,WAAW,EAAE,WAAW,EACxB,mBAAmB,EAAE,cAAc,YAElC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,GACb,IACV,CACJ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","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 '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { DocumentIconOutline, FolderIconSolid } from '@neo4j-ndl/react/icons';\nimport { TreeView } from '@neo4j-ndl/react/next';\nimport { useState } from 'react';\n\ntype FileNode = {\n children?: FileNode[];\n id: string;\n title: string;\n};\n\nconst TOP_FOLDER_COUNT = 7;\nconst SUBFOLDER_COUNT = 9;\nconst FILE_COUNT = 10;\n\n/**\n * 7 top folders + 63 subfolders + 630 files = 700 items, all expanded so every\n * row is mounted and visible. Exercises the worst-case performance paths:\n * arrow-key navigation, Shift ranges, and the multiple-replace edge styling.\n */\nconst files: FileNode[] = Array.from(\n { length: TOP_FOLDER_COUNT },\n (_unused, folderIndex) => ({\n children: Array.from({ length: SUBFOLDER_COUNT }, (_unused, subIndex) => ({\n children: Array.from({ length: FILE_COUNT }, (_unused, fileIndex) => ({\n id: `file-${folderIndex}-${subIndex}-${fileIndex}`,\n title: `file-${folderIndex}-${subIndex}-${fileIndex}.txt`,\n })),\n id: `subfolder-${folderIndex}-${subIndex}`,\n title: `Subfolder ${folderIndex}.${subIndex}`,\n })),\n id: `folder-${folderIndex}`,\n title: `Folder ${folderIndex}`,\n }),\n);\n\nconst Component = () => {\n const [selectedIds, setSelectedIds] = useState<string[]>([]);\n\n const renderNode = (node: FileNode) => (\n <TreeView.Item\n key={node.id}\n id={node.id}\n title={node.title}\n defaultExpanded\n leadingVisual={\n node.children === undefined ? (\n <DocumentIconOutline />\n ) : (\n <FolderIconSolid />\n )\n }\n >\n {node.children?.map(renderNode)}\n </TreeView.Item>\n );\n\n return (\n <>\n <p style={{ marginBottom: '8px' }}>\n 700 items, {selectedIds.length} selected\n </p>\n <TreeView\n ariaLabel=\"Large file explorer\"\n selectionMode=\"multiple-replace\"\n selectedIds={selectedIds}\n onSelectedIdsChange={setSelectedIds}\n >\n {files.map(renderNode)}\n </TreeView>\n </>\n );\n};\n\nexport default Component;\n"]}
|