@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.
Files changed (82) hide show
  1. package/lib/cjs/dropzone/stories/dropzone-full.story.js +5 -5
  2. package/lib/cjs/dropzone/stories/dropzone-full.story.js.map +1 -1
  3. package/lib/cjs/helpers/index.js +1 -0
  4. package/lib/cjs/helpers/index.js.map +1 -1
  5. package/lib/cjs/helpers/platform.js +59 -0
  6. package/lib/cjs/helpers/platform.js.map +1 -0
  7. package/lib/cjs/kbd/kbd-utils.js +6 -22
  8. package/lib/cjs/kbd/kbd-utils.js.map +1 -1
  9. package/lib/cjs/next/tree-view/TreeView.js +384 -66
  10. package/lib/cjs/next/tree-view/TreeView.js.map +1 -1
  11. package/lib/cjs/next/tree-view/selection.js +181 -0
  12. package/lib/cjs/next/tree-view/selection.js.map +1 -0
  13. package/lib/cjs/next/tree-view/stories/index.js +13 -1
  14. package/lib/cjs/next/tree-view/stories/index.js.map +1 -1
  15. package/lib/cjs/next/tree-view/stories/tree-view-large.story.js +57 -0
  16. package/lib/cjs/next/tree-view/stories/tree-view-large.story.js.map +1 -0
  17. package/lib/cjs/next/tree-view/stories/tree-view-lazy.story.js +1 -0
  18. package/lib/cjs/next/tree-view/stories/tree-view-lazy.story.js.map +1 -1
  19. package/lib/cjs/next/tree-view/stories/tree-view-multi.story.js +16 -40
  20. package/lib/cjs/next/tree-view/stories/tree-view-multi.story.js.map +1 -1
  21. package/lib/cjs/next/tree-view/stories/tree-view-multiple-replace.story.js +38 -0
  22. package/lib/cjs/next/tree-view/stories/tree-view-multiple-replace.story.js.map +1 -0
  23. package/lib/cjs/next/tree-view/stories/tree-view-non-selectable-folders.story.js +7 -4
  24. package/lib/cjs/next/tree-view/stories/tree-view-non-selectable-folders.story.js.map +1 -1
  25. package/lib/cjs/next/tree-view/stories/tree-view-root-selection.story.js +125 -0
  26. package/lib/cjs/next/tree-view/stories/tree-view-root-selection.story.js.map +1 -0
  27. package/lib/cjs/toast/ToastControlled.js +1 -1
  28. package/lib/cjs/toast/ToastControlled.js.map +1 -1
  29. package/lib/esm/dropzone/stories/dropzone-full.story.js +5 -5
  30. package/lib/esm/dropzone/stories/dropzone-full.story.js.map +1 -1
  31. package/lib/esm/helpers/index.js +1 -0
  32. package/lib/esm/helpers/index.js.map +1 -1
  33. package/lib/esm/helpers/platform.js +55 -0
  34. package/lib/esm/helpers/platform.js.map +1 -0
  35. package/lib/esm/kbd/kbd-utils.js +2 -18
  36. package/lib/esm/kbd/kbd-utils.js.map +1 -1
  37. package/lib/esm/next/tree-view/TreeView.js +385 -67
  38. package/lib/esm/next/tree-view/TreeView.js.map +1 -1
  39. package/lib/esm/next/tree-view/selection.js +175 -0
  40. package/lib/esm/next/tree-view/selection.js.map +1 -0
  41. package/lib/esm/next/tree-view/stories/index.js +9 -0
  42. package/lib/esm/next/tree-view/stories/index.js.map +1 -1
  43. package/lib/esm/next/tree-view/stories/tree-view-large.story.js +55 -0
  44. package/lib/esm/next/tree-view/stories/tree-view-large.story.js.map +1 -0
  45. package/lib/esm/next/tree-view/stories/tree-view-lazy.story.js +1 -0
  46. package/lib/esm/next/tree-view/stories/tree-view-lazy.story.js.map +1 -1
  47. package/lib/esm/next/tree-view/stories/tree-view-multi.story.js +16 -40
  48. package/lib/esm/next/tree-view/stories/tree-view-multi.story.js.map +1 -1
  49. package/lib/esm/next/tree-view/stories/tree-view-multiple-replace.story.js +36 -0
  50. package/lib/esm/next/tree-view/stories/tree-view-multiple-replace.story.js.map +1 -0
  51. package/lib/esm/next/tree-view/stories/tree-view-non-selectable-folders.story.js +7 -4
  52. package/lib/esm/next/tree-view/stories/tree-view-non-selectable-folders.story.js.map +1 -1
  53. package/lib/esm/next/tree-view/stories/tree-view-root-selection.story.js +123 -0
  54. package/lib/esm/next/tree-view/stories/tree-view-root-selection.story.js.map +1 -0
  55. package/lib/esm/toast/ToastControlled.js +1 -1
  56. package/lib/esm/toast/ToastControlled.js.map +1 -1
  57. package/lib/types/helpers/index.d.ts +1 -0
  58. package/lib/types/helpers/index.d.ts.map +1 -1
  59. package/lib/types/helpers/platform.d.ts +29 -0
  60. package/lib/types/helpers/platform.d.ts.map +1 -0
  61. package/lib/types/kbd/kbd-utils.d.ts +2 -5
  62. package/lib/types/kbd/kbd-utils.d.ts.map +1 -1
  63. package/lib/types/next/tree-view/TreeView.d.ts +29 -5
  64. package/lib/types/next/tree-view/TreeView.d.ts.map +1 -1
  65. package/lib/types/next/tree-view/selection.d.ts +78 -0
  66. package/lib/types/next/tree-view/selection.d.ts.map +1 -0
  67. package/lib/types/next/tree-view/stories/index.d.ts +6 -0
  68. package/lib/types/next/tree-view/stories/index.d.ts.map +1 -1
  69. package/lib/types/next/tree-view/stories/tree-view-large.story.d.ts +24 -0
  70. package/lib/types/next/tree-view/stories/tree-view-large.story.d.ts.map +1 -0
  71. package/lib/types/next/tree-view/stories/tree-view-lazy.story.d.ts.map +1 -1
  72. package/lib/types/next/tree-view/stories/tree-view-multi.story.d.ts +10 -0
  73. package/lib/types/next/tree-view/stories/tree-view-multi.story.d.ts.map +1 -1
  74. package/lib/types/next/tree-view/stories/tree-view-multiple-replace.story.d.ts +29 -0
  75. package/lib/types/next/tree-view/stories/tree-view-multiple-replace.story.d.ts.map +1 -0
  76. package/lib/types/next/tree-view/stories/tree-view-non-selectable-folders.story.d.ts +5 -0
  77. package/lib/types/next/tree-view/stories/tree-view-non-selectable-folders.story.d.ts.map +1 -1
  78. package/lib/types/next/tree-view/stories/tree-view-root-selection.story.d.ts +24 -0
  79. package/lib/types/next/tree-view/stories/tree-view-root-selection.story.d.ts.map +1 -0
  80. package/package.json +2 -2
  81. package/skills/ndl-react/SKILL.md +1 -1
  82. package/skills/ndl-react/components/next/tree-view.md +358 -104
@@ -20,7 +20,7 @@
20
20
  */
21
21
  import { type CommonProps, type TooltipObjectProps } from '../../_common/types';
22
22
  import { Menu } from '../../menu';
23
- type SelectionMode = 'single' | 'multiple';
23
+ import { type SelectionMode } from './selection';
24
24
  type RootProps = {
25
25
  /** The aria-label for the tree. Required for accessibility, unless using ariaLabelledby. Pass null to omit. */
26
26
  ariaLabel: string | null;
@@ -28,8 +28,14 @@ type RootProps = {
28
28
  ariaLabelledby?: string;
29
29
  /** The children of the tree. Should be TreeView.Item components or TreeView.SkeletonItem components only. */
30
30
  children?: React.ReactNode;
31
+ /** Initially selected item ids for an uncontrolled root-managed selection. */
32
+ defaultSelectedIds?: string[];
33
+ /** Selected item ids. Makes the tree manage selection itself, instead of each item managing its own. */
34
+ selectedIds?: string[];
31
35
  /** Selection mode for the tree. Defaults to "single". */
32
36
  selectionMode?: SelectionMode;
37
+ /** Callback called with the complete next selection whenever the tree manages selection. Fires once per interaction. */
38
+ onSelectedIdsChange?: (selectedIds: string[]) => void;
33
39
  };
34
40
  type ItemProps = {
35
41
  /** Nested TreeView.Item or TreeView.SkeletonItem elements rendered as sub-items in a collapsible group. */
@@ -40,6 +46,8 @@ type ItemProps = {
40
46
  defaultExpanded?: boolean;
41
47
  /** Whether the item has children. Decides if the item should render a chevron for expansion. Needed for lazy loading. */
42
48
  hasChildren?: boolean;
49
+ /** Identifies the item. Required when the tree manages selection via `selectedIds`. */
50
+ id?: string;
43
51
  /** Whether the item is disabled */
44
52
  isDisabled?: boolean;
45
53
  /** Whether the item is expanded. Makes the item controlled. */
@@ -48,7 +56,9 @@ type ItemProps = {
48
56
  isIndeterminate?: boolean;
49
57
  /** Whether the item is loading. Applies aria-busy="true" to the item. */
50
58
  isLoading?: boolean;
51
- /** Whether the item is selected */
59
+ /** Whether the item can be selected. Defaults to true when the tree manages selection, and otherwise to whether `onSelectedChange` is set. */
60
+ isSelectable?: boolean;
61
+ /** Whether the item is selected. Ignored when the tree manages selection via `selectedIds`. */
52
62
  isSelected?: boolean;
53
63
  /** Leading visual for the item. */
54
64
  leadingVisual?: React.ReactNode;
@@ -64,15 +74,29 @@ type ItemProps = {
64
74
  tooltipProps?: TooltipObjectProps;
65
75
  /** Callback called when the item is expanded/collapsed. */
66
76
  onExpandedChange?: (isExpanded: boolean) => void;
67
- /** Callback called when the item is selected/deselected. */
77
+ /** Callback called when the item is selected/deselected. Receives the new selected state. Ignored when the tree manages selection via `selectedIds`. */
68
78
  onSelectedChange?: (isSelected: boolean) => void;
69
79
  };
70
80
  type SkeletonItemProps = {
71
81
  /** The number of rows to render. */
72
82
  rows?: number;
73
83
  };
74
- declare const TreeView: (({ children, selectionMode, ariaLabel, ariaLabelledby, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", RootProps>) => import("react/jsx-runtime").JSX.Element) & {
75
- Item: ({ actionMenuItems, children, defaultExpanded, hasChildren: hasChildrenProp, isDisabled, isExpanded: isExpandedProp, isIndeterminate, isLoading, isSelected, leadingVisual, title, tooltipContent, tooltipProps, trailingContent, onExpandedChange, onSelectedChange, actionMenuProps, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", ItemProps>) => import("react/jsx-runtime").JSX.Element;
84
+ /**
85
+ * @remarks
86
+ * Selection can be managed per item, with `isSelected` and `onSelectedChange`
87
+ * on each `TreeView.Item`, or by the tree itself, by passing `selectedIds` (or
88
+ * `defaultSelectedIds`) together with `onSelectedIdsChange`. When the tree
89
+ * manages selection, every item needs an `id`, and each item's own
90
+ * `isSelected` and `onSelectedChange` are ignored.
91
+ *
92
+ * The available selection modes are:
93
+ *
94
+ * - `single` — one item at a time. An unmodified click selects the clicked item and never clears it.
95
+ * - `multiple` — multi-select with checkboxes. An unmodified click toggles an item, and `Shift` repeats that across a range without clearing anything outside it.
96
+ * - `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.
97
+ */
98
+ declare const TreeView: (({ children, defaultSelectedIds, selectedIds: selectedIdsProp, selectionMode, ariaLabel, ariaLabelledby, className, style, htmlAttributes, onSelectedIdsChange, ref, ...restProps }: CommonProps<"div", RootProps>) => import("react/jsx-runtime").JSX.Element) & {
99
+ Item: ({ actionMenuItems, children, defaultExpanded, hasChildren: hasChildrenProp, id: idProp, isDisabled, isExpanded: isExpandedProp, isIndeterminate, isLoading, isSelectable: isSelectableProp, isSelected: isSelectedProp, leadingVisual, title, tooltipContent, tooltipProps, trailingContent, onExpandedChange, onSelectedChange, actionMenuProps, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", ItemProps>) => import("react/jsx-runtime").JSX.Element;
76
100
  SkeletonItem: ({ rows, className, style, htmlAttributes, ref, ...restProps }: CommonProps<"div", SkeletonItemProps>) => import("react/jsx-runtime").JSX.Element;
77
101
  };
78
102
  export { TreeView };
@@ -1 +1 @@
1
- {"version":3,"file":"TreeView.d.ts","sourceRoot":"","sources":["../../../../src/next/tree-view/TreeView.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAgBH,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAOhF,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIlC,KAAK,aAAa,GAAG,QAAQ,GAAG,UAAU,CAAC;AAiE3C,KAAK,SAAS,GAAG;IACf,+GAA+G;IAC/G,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,8GAA8G;IAC9G,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6GAA6G;IAC7G,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,yDAAyD;IACzD,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B,CAAC;AA2MF,KAAK,SAAS,GAAG;IACf,2GAA2G;IAC3G,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,mDAAmD;IACnD,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,+CAA+C;IAG/C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,yHAAyH;IACzH,W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AA8I;IAC9I,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,+FAA+F;IAC/F,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,mCAAmC;IACnC,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,0FAA0F;IAC1F,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC,wHAAwH;IACxH,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAClC,uEAAuE;IACvE,eAAe,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,CAAC;IACpD,4FAA4F;IAC5F,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACjC,8EAA8E;IAC9E,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,2DAA2D;IAC3D,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,wJAAwJ;IACxJ,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;CAClD,CAAC;AAyZF,KAAK,iBAAiB,GAAG;IACvB,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AA0CF;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,QAAQ,wLAl8BX,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC;oZA+hB7B,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC;kFAmY7B,WAAW,CAAC,KAAK,EAAE,iBAAiB,CAAC;CAgCoB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ export type SelectionMode = 'single' | 'multiple' | 'multiple-replace';
22
+ export type SelectionEdge = 'top' | 'middle' | 'bottom';
23
+ /** Modifier keys resolved from a pointer or keyboard event. */
24
+ export type SelectionIntent = {
25
+ /** Shift: extend from the anchor to the target. */
26
+ isRange: boolean;
27
+ /**
28
+ * Cmd on Apple platforms, Ctrl elsewhere. Ignored in `multiple`, where an
29
+ * unmodified click already toggles.
30
+ */
31
+ isToggle: boolean;
32
+ };
33
+ /**
34
+ * Where a range is measured from.
35
+ *
36
+ * `baseSelectedIds` is the selection as it stood immediately after the anchor
37
+ * was placed. A `multiple-replace` range unions its visible members with the
38
+ * range so it can be grown and shrunk without losing earlier picks.
39
+ * `isSelected` is the state the anchor row was placed into, which a `multiple`
40
+ * range paints across its members.
41
+ */
42
+ export type SelectionAnchor = {
43
+ baseSelectedIds: ReadonlySet<string>;
44
+ id: string;
45
+ isSelected: boolean;
46
+ } | null;
47
+ type ComputeNextSelectionInput = {
48
+ anchor: SelectionAnchor;
49
+ intent: SelectionIntent;
50
+ /** Ids of every selectable, non-disabled item, visible or not. */
51
+ selectableIds: ReadonlySet<string>;
52
+ /** Currently selected ids, including items inside collapsed groups. */
53
+ selectedIds: ReadonlySet<string>;
54
+ selectionMode: SelectionMode;
55
+ targetId: string;
56
+ /** Ids of the items the user can currently see, in visual order. */
57
+ visibleIds: readonly string[];
58
+ /** Maps an item id to the id of the item that owns its group. */
59
+ parentIdById: ReadonlyMap<string, string>;
60
+ };
61
+ type ComputeNextSelectionResult = {
62
+ anchor: SelectionAnchor;
63
+ selectedIds: Set<string>;
64
+ };
65
+ /**
66
+ * Resolves a selection gesture into the complete next selection. Pure: the
67
+ * caller supplies the current state and applies the result.
68
+ */
69
+ export declare function computeNextSelection({ anchor, intent, parentIdById, selectableIds, selectedIds, selectionMode, targetId, visibleIds, }: ComputeNextSelectionInput): ComputeNextSelectionResult;
70
+ /**
71
+ * Marks each selected item's position within its run of adjacent selected
72
+ * items, so a run can be styled as one block.
73
+ */
74
+ export declare function computeSelectionEdges(visibleIds: readonly string[], selectedIds: ReadonlySet<string>): Map<string, SelectionEdge>;
75
+ export declare function countChangedIds(previous: ReadonlySet<string>, next: ReadonlySet<string>): number;
76
+ export declare function formatSelectionAnnouncement(selectedCount: number): string;
77
+ export {};
78
+ //# sourceMappingURL=selection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../../../../src/next/tree-view/selection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,UAAU,GAAG,kBAAkB,CAAC;AAEvE,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAExD,+DAA+D;AAC/D,MAAM,MAAM,eAAe,GAAG;IAC5B,mDAAmD;IACnD,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,OAAO,CAAC;CACrB,GAAG,IAAI,CAAC;AAET,KAAK,yBAAyB,GAAG;IAC/B,MAAM,EAAE,eAAe,CAAC;IACxB,MAAM,EAAE,eAAe,CAAC;IACxB,kEAAkE;IAClE,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,uEAAuE;IACvE,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,iEAAiE;IACjE,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,MAAM,EAAE,eAAe,CAAC;IACxB,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC1B,CAAC;AA2EF;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,MAAM,EACN,MAAM,EACN,YAAY,EACZ,aAAa,EACb,WAAW,EACX,aAAa,EACb,QAAQ,EACR,UAAU,GACX,EAAE,yBAAyB,GAAG,0BAA0B,CAiExD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,GAC/B,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAmB5B;AAED,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,EAC7B,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,GACxB,MAAM,CAaR;AAED,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAQzE"}
@@ -18,18 +18,24 @@
18
18
  * You should have received a copy of the GNU General Public License
19
19
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
20
  */
21
+ export { default as TreeViewLarge } from './tree-view-large.story';
21
22
  export { default as TreeViewLazyLoading } from './tree-view-lazy.story';
22
23
  export { default as TreeViewMultiSelect } from './tree-view-multi.story';
24
+ export { default as TreeViewMultipleReplace } from './tree-view-multiple-replace.story';
23
25
  export { default as TreeViewNonSelectableFolders } from './tree-view-non-selectable-folders.story';
26
+ export { default as TreeViewRootSelection } from './tree-view-root-selection.story';
24
27
  export { default as TreeViewSingleSelect } from './tree-view-single.story';
25
28
  export { default as TreeViewWithActions } from './tree-view-actions.story';
26
29
  export { default as TreeViewUncontrolledExpansion } from './tree-view-uncontrolled.story';
27
30
  export { default as TreeViewWithTrailingContent } from './tree-view-trailing.story';
28
31
  export { default as TreeViewWithTooltip } from './tree-view-tooltip.story';
29
32
  export declare const TreeViewActionsSrc: string;
33
+ export declare const TreeViewLargeSrc: string;
30
34
  export declare const TreeViewLazyLoadingSrc: string;
31
35
  export declare const TreeViewMultiSelectSrc: string;
36
+ export declare const TreeViewMultipleReplaceSrc: string;
32
37
  export declare const TreeViewNonSelectableFoldersSrc: string;
38
+ export declare const TreeViewRootSelectionSrc: string;
33
39
  export declare const TreeViewSingleSelectSrc: string;
34
40
  export declare const TreeViewTrailingContentSrc: string;
35
41
  export declare const TreeViewTooltipSrc: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,0CAA0C,CAAC;AACnG,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAC1F,OAAO,EAAE,OAAO,IAAI,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAY3E,eAAO,MAAM,kBAAkB,QAA6C,C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AACF,eAAO,MAAM,sBAAsB,QAElC,CAAC;AACF,eAAO,MAAM,0BAA0B,QAEtC,CAAC;AACF,eAAO,MAAM,+BAA+B,QAE3C,CAAC;AACF,eAAO,MAAM,wBAAwB,QAEpC,CAAC;AACF,eAAO,MAAM,uBAAuB,QAEnC,CAAC;AACF,eAAO,MAAM,0BAA0B,QAEtC,CAAC;AACF,eAAO,MAAM,kBAAkB,QAA6C,CAAC;AAC7E,eAAO,MAAM,gCAAgC,QAE5C,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
22
+ declare const Component: () => import("react/jsx-runtime").JSX.Element;
23
+ export default Component;
24
+ //# sourceMappingURL=tree-view-large.story.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-view-large.story.d.ts","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/tree-view-large.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAqCjD,QAAA,MAAM,SAAS,+CAoCd,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"tree-view-lazy.story.d.ts","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/tree-view-lazy.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AA0LjD,QAAA,MAAM,SAAS,+CAcd,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"tree-view-lazy.story.d.ts","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/tree-view-lazy.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AA+LjD,QAAA,MAAM,SAAS,+CAcd,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -19,6 +19,16 @@
19
19
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
20
  */
21
21
  import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
22
+ /**
23
+ * Every row owns its own checkbox: `onSelectedChange` reports the state the row
24
+ * should end up in, and the story stores exactly that. Folders are ordinary
25
+ * selectable rows here, unrelated to what sits inside them.
26
+ *
27
+ * Deriving a folder's state from its children instead needs the tree to own the
28
+ * selection, since a Shift range moves several rows at once and a cascade has
29
+ * to be applied to the whole set in one pass. See the root-managed selection
30
+ * story for that.
31
+ */
22
32
  declare const Component: () => import("react/jsx-runtime").JSX.Element;
23
33
  export default Component;
24
34
  //# sourceMappingURL=tree-view-multi.story.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tree-view-multi.story.d.ts","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/tree-view-multi.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAmCjD,QAAA,MAAM,SAAS,+CAsGd,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"tree-view-multi.story.d.ts","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/tree-view-multi.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAUjD;;;;;;;;;GASG;AACH,QAAA,MAAM,SAAS,+CAsFd,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
22
+ /**
23
+ * Letting the tree own the selection keeps the items declarative: they carry an
24
+ * `id` and nothing else, and a Shift range that moves several rows at once
25
+ * arrives as a single `onSelectedIdsChange`.
26
+ */
27
+ declare const Component: () => import("react/jsx-runtime").JSX.Element;
28
+ export default Component;
29
+ //# sourceMappingURL=tree-view-multiple-replace.story.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-view-multiple-replace.story.d.ts","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/tree-view-multiple-replace.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAUjD;;;;GAIG;AACH,QAAA,MAAM,SAAS,+CA6Dd,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -19,6 +19,11 @@
19
19
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
20
  */
21
21
  import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
22
+ /**
23
+ * Folders here are pure containers: `isSelectable={false}` makes them expand on
24
+ * click without ever becoming part of the selection, and screen readers
25
+ * announce them as non-selectable rather than as unselected rows.
26
+ */
22
27
  declare const Component: () => import("react/jsx-runtime").JSX.Element;
23
28
  export default Component;
24
29
  //# sourceMappingURL=tree-view-non-selectable-folders.story.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tree-view-non-selectable-folders.story.d.ts","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/tree-view-non-selectable-folders.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAMjD,QAAA,MAAM,SAAS,+CAiEd,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"tree-view-non-selectable-folders.story.d.ts","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/tree-view-non-selectable-folders.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAMjD;;;;GAIG;AACH,QAAA,MAAM,SAAS,+CA4Dd,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ *
3
+ * Copyright (c) "Neo4j"
4
+ * Neo4j Sweden AB [http://neo4j.com]
5
+ *
6
+ * This file is part of Neo4j.
7
+ *
8
+ * Neo4j is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
+ */
21
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
22
+ declare const Component: () => import("react/jsx-runtime").JSX.Element;
23
+ export default Component;
24
+ //# sourceMappingURL=tree-view-root-selection.story.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-view-root-selection.story.d.ts","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/tree-view-root-selection.story.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAqEjD,QAAA,MAAM,SAAS,+CAuEd,CAAC;AAEF,eAAe,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-ndl/react",
3
- "version": "4.21.2",
3
+ "version": "4.22.0",
4
4
  "sideEffects": false,
5
5
  "description": "React implementation of Neo4j Design System",
6
6
  "keywords": [
@@ -404,7 +404,7 @@
404
404
  "@tanstack/react-table": "8.21.3",
405
405
  "react": ">=19.0.0",
406
406
  "react-dom": ">=19.0.0",
407
- "@neo4j-ndl/base": "^4.20.2"
407
+ "@neo4j-ndl/base": "^4.21.0"
408
408
  },
409
409
  "dependencies": {
410
410
  "@dnd-kit/core": "6.3.1",
@@ -198,7 +198,7 @@ Next-generation components, imported from the `@neo4j-ndl/react/next` subpath. A
198
198
 
199
199
  | Component | Docs | Accessibility | Examples |
200
200
  |-----------|------|---------------|----------|
201
- | `TreeView` | [components/next/tree-view.md](components/next/tree-view.md) | ✅ | 8 |
201
+ | `TreeView` | [components/next/tree-view.md](components/next/tree-view.md) | ✅ | 10 |
202
202
 
203
203
  ## AI components
204
204