@neo4j-ndl/react 2.9.4 → 2.10.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 (66) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/lib/LICENSES.txt +26 -0
  3. package/lib/NOTICE.txt +6 -0
  4. package/lib/cjs/_common/utils.js +41 -1
  5. package/lib/cjs/_common/utils.js.map +1 -1
  6. package/lib/cjs/index.js +1 -0
  7. package/lib/cjs/index.js.map +1 -1
  8. package/lib/cjs/tree-view/TreeItemWrapper.js +201 -0
  9. package/lib/cjs/tree-view/TreeItemWrapper.js.map +1 -0
  10. package/lib/cjs/tree-view/TreeView.js +314 -0
  11. package/lib/cjs/tree-view/TreeView.js.map +1 -0
  12. package/lib/cjs/tree-view/TreeViewItem.js +89 -0
  13. package/lib/cjs/tree-view/TreeViewItem.js.map +1 -0
  14. package/lib/cjs/tree-view/TreeViewTextItem.js +153 -0
  15. package/lib/cjs/tree-view/TreeViewTextItem.js.map +1 -0
  16. package/lib/cjs/tree-view/TreeViewTrail.js +30 -0
  17. package/lib/cjs/tree-view/TreeViewTrail.js.map +1 -0
  18. package/lib/cjs/tree-view/index.js +26 -0
  19. package/lib/cjs/tree-view/index.js.map +1 -0
  20. package/lib/cjs/tree-view/tree-view-keyboard-coordinates.js +119 -0
  21. package/lib/cjs/tree-view/tree-view-keyboard-coordinates.js.map +1 -0
  22. package/lib/cjs/tree-view/tree-view-keyboard-helpers.js +75 -0
  23. package/lib/cjs/tree-view/tree-view-keyboard-helpers.js.map +1 -0
  24. package/lib/cjs/tree-view/tree-view-types.js +24 -0
  25. package/lib/cjs/tree-view/tree-view-types.js.map +1 -0
  26. package/lib/cjs/tree-view/tree-view-utils.js +187 -0
  27. package/lib/cjs/tree-view/tree-view-utils.js.map +1 -0
  28. package/lib/esm/_common/utils.js +38 -0
  29. package/lib/esm/_common/utils.js.map +1 -1
  30. package/lib/esm/index.js +1 -0
  31. package/lib/esm/index.js.map +1 -1
  32. package/lib/esm/tree-view/TreeItemWrapper.js +172 -0
  33. package/lib/esm/tree-view/TreeItemWrapper.js.map +1 -0
  34. package/lib/esm/tree-view/TreeView.js +310 -0
  35. package/lib/esm/tree-view/TreeView.js.map +1 -0
  36. package/lib/esm/tree-view/TreeViewItem.js +63 -0
  37. package/lib/esm/tree-view/TreeViewItem.js.map +1 -0
  38. package/lib/esm/tree-view/TreeViewTextItem.js +147 -0
  39. package/lib/esm/tree-view/TreeViewTextItem.js.map +1 -0
  40. package/lib/esm/tree-view/TreeViewTrail.js +26 -0
  41. package/lib/esm/tree-view/TreeViewTrail.js.map +1 -0
  42. package/lib/esm/tree-view/index.js +22 -0
  43. package/lib/esm/tree-view/index.js.map +1 -0
  44. package/lib/esm/tree-view/tree-view-keyboard-coordinates.js +115 -0
  45. package/lib/esm/tree-view/tree-view-keyboard-coordinates.js.map +1 -0
  46. package/lib/esm/tree-view/tree-view-keyboard-helpers.js +68 -0
  47. package/lib/esm/tree-view/tree-view-keyboard-helpers.js.map +1 -0
  48. package/lib/esm/tree-view/tree-view-types.js +23 -0
  49. package/lib/esm/tree-view/tree-view-types.js.map +1 -0
  50. package/lib/esm/tree-view/tree-view-utils.js +179 -0
  51. package/lib/esm/tree-view/tree-view-utils.js.map +1 -0
  52. package/lib/types/_common/utils.d.ts +12 -0
  53. package/lib/types/index.d.ts +1 -0
  54. package/lib/types/table/Table.d.ts +1 -1
  55. package/lib/types/tree-view/TreeItemWrapper.d.ts +32 -0
  56. package/lib/types/tree-view/TreeView.d.ts +34 -0
  57. package/lib/types/tree-view/TreeViewItem.d.ts +52 -0
  58. package/lib/types/tree-view/TreeViewTextItem.d.ts +23 -0
  59. package/lib/types/tree-view/TreeViewTrail.d.ts +24 -0
  60. package/lib/types/tree-view/index.d.ts +23 -0
  61. package/lib/types/tree-view/tree-view-keyboard-coordinates.d.ts +23 -0
  62. package/lib/types/tree-view/tree-view-keyboard-helpers.d.ts +25 -0
  63. package/lib/types/tree-view/tree-view-types.d.ts +80 -0
  64. package/lib/types/tree-view/tree-view-utils.d.ts +77 -0
  65. package/lib/types/typography/Typography.d.ts +1 -1
  66. package/package.json +3 -1
@@ -61,3 +61,4 @@ export * from './logo';
61
61
  export * from './clipboard-copier';
62
62
  export * from './slider';
63
63
  export * from './inline-edit';
64
+ export * from './tree-view';
@@ -57,7 +57,7 @@ declare const TableNameSpace: (<T extends unknown>(props: {
57
57
  focusableCells?: boolean | undefined;
58
58
  tableProps: TableType<T>;
59
59
  components?: TableComponentsInterface<T> | undefined;
60
- } & Omit<ElementBase<HTMLDivElement>, "as" | "controls" | "data" | "headers" | "rows"> & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null) & {
60
+ } & Omit<ElementBase<HTMLDivElement>, "data" | "as" | "controls" | "headers" | "rows"> & import("react").RefAttributes<HTMLDivElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null) & {
61
61
  RowActions: ({ className, ...restProps }: ElementBase<HTMLDivElement>) => import("react/jsx-runtime").JSX.Element;
62
62
  };
63
63
  export default TableNameSpace;
@@ -0,0 +1,32 @@
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
+
22
+ import React from 'react';
23
+ import type { TreeItemComponentProps } from './tree-view-types';
24
+ /**
25
+ * Used as a helper function to wrap the TreeItem component
26
+ * This adds the drag handle and trail to the start of a tree item.
27
+ * Useful if you want to add additional functionality to the tree item but still keep the drag handle and trail
28
+ * Is also used internally to create the TreeViewTextItem component
29
+ */
30
+ export declare const TreeItemWrapper: React.ForwardRefExoticComponent<TreeItemComponentProps<Record<string, unknown>> & {
31
+ children?: React.ReactNode;
32
+ } & React.RefAttributes<HTMLElement>>;
@@ -0,0 +1,34 @@
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
+
22
+ /// <reference types="react" />
23
+ import { type ItemChangedReason, type TreeItem, type TreeItemComponent } from './tree-view-types';
24
+ export interface TreeViewProps<T extends Record<string, unknown>, E extends HTMLElement> extends React.HTMLAttributes<HTMLOListElement> {
25
+ items: TreeItem<T>[];
26
+ onItemsChanged: (newItems: TreeItem<T>[], itemChangedReason: ItemChangedReason<T>) => void;
27
+ TreeItemComponent?: TreeItemComponent<T, E>;
28
+ }
29
+ export declare const TreeView: {
30
+ <T extends Record<string, unknown>, E extends HTMLElement>({ items, TreeItemComponent, onItemsChanged, ...rest }: TreeViewProps<T, E>): import("react/jsx-runtime").JSX.Element;
31
+ TreeItemWrapper: import("react").ForwardRefExoticComponent<import("./tree-view-types").TreeItemComponentProps<Record<string, unknown>> & {
32
+ children?: import("react").ReactNode;
33
+ } & import("react").RefAttributes<HTMLElement>>;
34
+ };
@@ -0,0 +1,52 @@
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 { type UniqueIdentifier } from '@dnd-kit/core';
22
+ import { type UseSortableArguments } from '@dnd-kit/sortable';
23
+ import { type FlattenedTreeItem, type ItemChangedReason, type TreeItemComponent } from './tree-view-types';
24
+ export interface TreeItemProps<T> {
25
+ childCount?: number;
26
+ clone?: boolean;
27
+ collapsed?: boolean;
28
+ depth: number;
29
+ shouldDisableInteraction?: boolean;
30
+ indicator?: boolean;
31
+ indentationWidth: number;
32
+ item: FlattenedTreeItem<T>;
33
+ isLast: boolean;
34
+ parent: FlattenedTreeItem<T> | null;
35
+ onCollapse?(id: UniqueIdentifier): void;
36
+ onRemove?(id: UniqueIdentifier): void;
37
+ wrapperRef?(node: HTMLLIElement): void;
38
+ }
39
+ type SortableTreeItemProps<T extends Record<string, unknown>, E extends HTMLElement> = TreeItemProps<T> & {
40
+ id: UniqueIdentifier;
41
+ TreeItemComponent: TreeItemComponent<T, E>;
42
+ shouldDisableSorting?: boolean;
43
+ sortableProps?: Omit<UseSortableArguments, 'id'>;
44
+ keepGhostInPlace?: boolean;
45
+ trails: ('none' | 'straight' | 'straight-curved' | 'curved')[];
46
+ onItemsChanged: (newItems: FlattenedTreeItem<T>[], itemChangedReason: ItemChangedReason<T>) => void;
47
+ items: FlattenedTreeItem<T>[];
48
+ tabIndex?: number;
49
+ onFocus?: () => void;
50
+ };
51
+ export declare const SortableTreeViewItem: <T extends Record<string, unknown>, E extends HTMLElement>({ id, depth, isLast, TreeItemComponent, parent, shouldDisableSorting, sortableProps, keepGhostInPlace, item, onCollapse, trails, onItemsChanged, items, tabIndex, onFocus, ...restProps }: SortableTreeItemProps<T, E>) => import("react/jsx-runtime").JSX.Element;
52
+ export {};
@@ -0,0 +1,23 @@
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 React from 'react';
22
+ import type { TreeItemComponentProps } from './tree-view-types';
23
+ export declare const TreeViewTextItem: <T>(p: React.PropsWithChildren<TreeItemComponentProps<T extends Record<string, unknown> ? T : never> & React.RefAttributes<HTMLDivElement>>) => React.ReactElement;
@@ -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
+ export type TrailProps = {
22
+ variant: 'straight' | 'curved' | 'straight-curved' | 'none';
23
+ };
24
+ export declare const Trail: ({ variant }: TrailProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,23 @@
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 { TreeView } from './TreeView';
22
+ export type { TreeViewProps } from './TreeView';
23
+ export type * from './tree-view-types';
@@ -0,0 +1,23 @@
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 { type KeyboardCoordinateGetter } from '@dnd-kit/core';
22
+ import { type SensorContext } from './tree-view-utils';
23
+ export declare const sortableTreeKeyboardCoordinates: <T>(context: SensorContext<T>, indicator: boolean, indentationWidth: number) => KeyboardCoordinateGetter;
@@ -0,0 +1,25 @@
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
+
22
+ export declare const focusNextRow: (parentElement: HTMLElement) => void;
23
+ export declare const focusPreviousRow: (parentElement: HTMLElement) => void;
24
+ export declare const focusCellInNextRow: (parentElement: HTMLElement) => void;
25
+ export declare const focusCellInPreviousRow: (parentElement: HTMLElement) => void;
@@ -0,0 +1,80 @@
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 { type UniqueIdentifier } from '@dnd-kit/core';
22
+ import { type RefAttributes } from 'react';
23
+ import { type IconButtonProps } from '../button';
24
+ export type TreeItem<T> = {
25
+ id: UniqueIdentifier;
26
+ canHaveSubItems: false;
27
+ isSortable?: boolean;
28
+ data: T;
29
+ isSelected?: boolean;
30
+ } | {
31
+ id: UniqueIdentifier;
32
+ canHaveSubItems: true;
33
+ isCollapsed: boolean;
34
+ subItems: TreeItem<T>[];
35
+ isSortable?: boolean;
36
+ data: T;
37
+ isSelected?: boolean;
38
+ };
39
+ export type TextItemData = {
40
+ text: string;
41
+ onTextClick?: () => void;
42
+ actions: {
43
+ icon: React.ReactNode;
44
+ buttonProps: Omit<IconButtonProps, 'children'>;
45
+ }[];
46
+ };
47
+ export type DefaultTreeItem = TreeItem<TextItemData>;
48
+ export type FlattenedTreeItem<T> = TreeItem<T> & {
49
+ depth: number;
50
+ parentId: UniqueIdentifier | null;
51
+ };
52
+ export type TreeItemComponent<T extends Record<string, unknown>, TElement extends HTMLElement> = React.FC<React.PropsWithChildren<TreeItemComponentProps<T> & RefAttributes<TElement>>>;
53
+ export type TreeItemComponentProps<T extends Record<string, unknown>> = {
54
+ item: FlattenedTreeItem<T>;
55
+ parent: FlattenedTreeItem<T> | null;
56
+ isGhost?: boolean;
57
+ isCollapsed?: boolean;
58
+ depth: number;
59
+ shouldDisableInteraction?: boolean;
60
+ shouldDisableSorting?: boolean;
61
+ isOver: boolean;
62
+ isOverParent: boolean;
63
+ isLastInParent: boolean;
64
+ isIndicator?: boolean;
65
+ indentationWidth: number;
66
+ onCollapse?(): void;
67
+ setActivatorNodeRef: (node: HTMLElement | null) => void;
68
+ setNodeRef: (node: HTMLLIElement) => void;
69
+ dragHandleProps?: Record<string, unknown>;
70
+ style?: React.CSSProperties;
71
+ trails: ('none' | 'straight' | 'straight-curved' | 'curved')[];
72
+ items: FlattenedTreeItem<T>[];
73
+ onItemsChanged: (newItems: FlattenedTreeItem<T>[], reason: ItemChangedReason<T>) => void;
74
+ tabIndex?: number;
75
+ onFocus?: () => void;
76
+ };
77
+ export type ItemChangedReason<T> = {
78
+ item: TreeItem<T>;
79
+ reason: 'collapsed' | 'expanded' | 'dropped' | 'selected' | 'other';
80
+ };
@@ -0,0 +1,77 @@
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 { type UniqueIdentifier } from '@dnd-kit/core';
22
+ import { type MutableRefObject } from 'react';
23
+ import { type FlattenedTreeItem, type TreeItem } from './tree-view-types';
24
+ export type SensorContext<T> = MutableRefObject<{
25
+ items: FlattenedTreeItem<T>[];
26
+ offset: number;
27
+ }>;
28
+ /**
29
+ * Takes a tree and flattens it into a list of item
30
+ * where each item has a depth and a parentId.
31
+ * @param tree the tree to flatten
32
+ * @param depth the depth of the root of the tree (default 0)
33
+ * @param parentId the id of the parent of the root of the tree (default null)
34
+ * @returns a list of items with depth and parentId
35
+ */
36
+ export declare const flattenTree: <T>(tree: TreeItem<T>[], depth?: number, parentId?: UniqueIdentifier | null) => FlattenedTreeItem<T>[];
37
+ /**
38
+ * Removes the children of the items with the given ids
39
+ * @param items the flattened tree items to remove the children from
40
+ * @param ids the ids of the items to remove the children from
41
+ * @returns a new list of items with the children of the items with the given ids removed
42
+ */
43
+ export declare function removeChildrenOf<T>(items: FlattenedTreeItem<T>[], ids: UniqueIdentifier[]): FlattenedTreeItem<T>[];
44
+ /**
45
+ * Builds a tree from a list of flattened tree items
46
+ * @param items the flattened tree items
47
+ * @returns the items as a tree data structure
48
+ */
49
+ export declare function buildTree<T>(items: FlattenedTreeItem<T>[]): TreeItem<T>[];
50
+ /**
51
+ * Calculates the new depth, max depth, min depth and parent id of the item being dragged
52
+ * Used to project the position of the dragged item. For example, to convert the item being dragged into a placeholder.
53
+ * such as the line that appears when dragging an item in a tree view.
54
+ * @param items the flattened tree items
55
+ * @param activeId the id of the item being dragged
56
+ * @param overId the id of the item that the dragged item is being dragged over
57
+ * @param dragOffset the offset of the drag in pixels
58
+ * @param indentationWidth the width of the indentation in pixels
59
+ * @returns the depth, max depth, min depth and parent id of the item being dragged
60
+ */
61
+ export declare function getProjection<T>(items: FlattenedTreeItem<T>[], activeId: UniqueIdentifier, overId: UniqueIdentifier, dragOffset: number, indentationWidth: number): {
62
+ depth: number;
63
+ maxDepth: number;
64
+ minDepth: number;
65
+ parentId: UniqueIdentifier | null;
66
+ };
67
+ /**
68
+ *
69
+ * @param transform a transform object
70
+ * @returns a css transform string
71
+ */
72
+ export declare const transformToString: (transform: {
73
+ scaleX: number;
74
+ scaleY: number;
75
+ x: number;
76
+ y: number;
77
+ }) => string;
@@ -20,7 +20,7 @@
20
20
  */
21
21
 
22
22
  import { type AsType, type ConditionalTypography } from './types';
23
- export declare const Typography: <TVar extends "label" | "code" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "subheading-large" | "subheading-medium" | "subheading-small" | "body-large" | "body-medium" | "body-small", TAs extends AsType = undefined>(props: {
23
+ export declare const Typography: <TVar extends "code" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "label" | "subheading-large" | "subheading-medium" | "subheading-small" | "body-large" | "body-medium" | "body-small", TAs extends AsType = undefined>(props: {
24
24
  as?: TAs | undefined;
25
25
  variant: TVar;
26
26
  } & ConditionalTypography<TAs, TVar>) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neo4j-ndl/react",
3
- "version": "2.9.4",
3
+ "version": "2.10.0",
4
4
  "sideEffects": false,
5
5
  "description": "React implementation of Neo4j Design System",
6
6
  "keywords": [
@@ -85,6 +85,8 @@
85
85
  "react-dom": ">=16.8.0"
86
86
  },
87
87
  "dependencies": {
88
+ "@dnd-kit/core": "6.1.0",
89
+ "@dnd-kit/sortable": "8.0.0",
88
90
  "@floating-ui/react": "0.25.1",
89
91
  "@heroicons/react": "2.0.13",
90
92
  "@neo4j-cypher/react-codemirror": "^1.0.1",