@neo4j-ndl/react 4.12.4 → 4.13.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 (90) hide show
  1. package/lib/cjs/data-grid/DataGrid.js +1 -0
  2. package/lib/cjs/data-grid/DataGrid.js.map +1 -1
  3. package/lib/cjs/icons/generated/custom/Appearance.js +30 -0
  4. package/lib/cjs/icons/generated/custom/Appearance.js.map +1 -0
  5. package/lib/cjs/icons/generated/custom/index.js +5 -3
  6. package/lib/cjs/icons/generated/custom/index.js.map +1 -1
  7. package/lib/cjs/next/index.js +16 -0
  8. package/lib/cjs/next/index.js.map +1 -1
  9. package/lib/cjs/next/tree-view/TreeView.js +460 -0
  10. package/lib/cjs/next/tree-view/TreeView.js.map +1 -0
  11. package/lib/cjs/next/tree-view/index.js +26 -0
  12. package/lib/cjs/next/tree-view/index.js.map +1 -0
  13. package/lib/cjs/next/tree-view/stories/index.js +60 -0
  14. package/lib/cjs/next/tree-view/stories/index.js.map +1 -0
  15. package/lib/cjs/next/tree-view/stories/tree-view-actions.story.js +36 -0
  16. package/lib/cjs/next/tree-view/stories/tree-view-actions.story.js.map +1 -0
  17. package/lib/cjs/next/tree-view/stories/tree-view-lazy.story.js +149 -0
  18. package/lib/cjs/next/tree-view/stories/tree-view-lazy.story.js.map +1 -0
  19. package/lib/cjs/next/tree-view/stories/tree-view-multi.story.js +73 -0
  20. package/lib/cjs/next/tree-view/stories/tree-view-multi.story.js.map +1 -0
  21. package/lib/cjs/next/tree-view/stories/tree-view-non-selectable-folders.story.js +35 -0
  22. package/lib/cjs/next/tree-view/stories/tree-view-non-selectable-folders.story.js.map +1 -0
  23. package/lib/cjs/next/tree-view/stories/tree-view-single.story.js +35 -0
  24. package/lib/cjs/next/tree-view/stories/tree-view-single.story.js.map +1 -0
  25. package/lib/cjs/next/tree-view/stories/tree-view-tooltip.story.js +34 -0
  26. package/lib/cjs/next/tree-view/stories/tree-view-tooltip.story.js.map +1 -0
  27. package/lib/cjs/next/tree-view/stories/tree-view-trailing.story.js +34 -0
  28. package/lib/cjs/next/tree-view/stories/tree-view-trailing.story.js.map +1 -0
  29. package/lib/cjs/next/tree-view/stories/tree-view-uncontrolled.story.js +33 -0
  30. package/lib/cjs/next/tree-view/stories/tree-view-uncontrolled.story.js.map +1 -0
  31. package/lib/esm/data-grid/DataGrid.js +1 -0
  32. package/lib/esm/data-grid/DataGrid.js.map +1 -1
  33. package/lib/esm/icons/generated/custom/Appearance.js +28 -0
  34. package/lib/esm/icons/generated/custom/Appearance.js.map +1 -0
  35. package/lib/esm/icons/generated/custom/index.js +1 -0
  36. package/lib/esm/icons/generated/custom/index.js.map +1 -1
  37. package/lib/esm/next/index.js +1 -1
  38. package/lib/esm/next/index.js.map +1 -1
  39. package/lib/esm/next/tree-view/TreeView.js +454 -0
  40. package/lib/esm/next/tree-view/TreeView.js.map +1 -0
  41. package/lib/esm/next/tree-view/index.js +22 -0
  42. package/lib/esm/next/tree-view/index.js.map +1 -0
  43. package/lib/esm/next/tree-view/stories/index.js +46 -0
  44. package/lib/esm/next/tree-view/stories/index.js.map +1 -0
  45. package/lib/esm/next/tree-view/stories/tree-view-actions.story.js +34 -0
  46. package/lib/esm/next/tree-view/stories/tree-view-actions.story.js.map +1 -0
  47. package/lib/esm/next/tree-view/stories/tree-view-lazy.story.js +147 -0
  48. package/lib/esm/next/tree-view/stories/tree-view-lazy.story.js.map +1 -0
  49. package/lib/esm/next/tree-view/stories/tree-view-multi.story.js +71 -0
  50. package/lib/esm/next/tree-view/stories/tree-view-multi.story.js.map +1 -0
  51. package/lib/esm/next/tree-view/stories/tree-view-non-selectable-folders.story.js +33 -0
  52. package/lib/esm/next/tree-view/stories/tree-view-non-selectable-folders.story.js.map +1 -0
  53. package/lib/esm/next/tree-view/stories/tree-view-single.story.js +33 -0
  54. package/lib/esm/next/tree-view/stories/tree-view-single.story.js.map +1 -0
  55. package/lib/esm/next/tree-view/stories/tree-view-tooltip.story.js +32 -0
  56. package/lib/esm/next/tree-view/stories/tree-view-tooltip.story.js.map +1 -0
  57. package/lib/esm/next/tree-view/stories/tree-view-trailing.story.js +32 -0
  58. package/lib/esm/next/tree-view/stories/tree-view-trailing.story.js.map +1 -0
  59. package/lib/esm/next/tree-view/stories/tree-view-uncontrolled.story.js +31 -0
  60. package/lib/esm/next/tree-view/stories/tree-view-uncontrolled.story.js.map +1 -0
  61. package/lib/types/data-grid/DataGrid.d.ts.map +1 -1
  62. package/lib/types/icons/generated/custom/Appearance.d.ts +29 -0
  63. package/lib/types/icons/generated/custom/Appearance.d.ts.map +1 -0
  64. package/lib/types/icons/generated/custom/index.d.ts +1 -0
  65. package/lib/types/icons/generated/custom/index.d.ts.map +1 -1
  66. package/lib/types/next/index.d.ts +1 -0
  67. package/lib/types/next/index.d.ts.map +1 -1
  68. package/lib/types/next/tree-view/TreeView.d.ts +79 -0
  69. package/lib/types/next/tree-view/TreeView.d.ts.map +1 -0
  70. package/lib/types/next/tree-view/index.d.ts +22 -0
  71. package/lib/types/next/tree-view/index.d.ts.map +1 -0
  72. package/lib/types/next/tree-view/stories/index.d.ts +37 -0
  73. package/lib/types/next/tree-view/stories/index.d.ts.map +1 -0
  74. package/lib/types/next/tree-view/stories/tree-view-actions.story.d.ts +24 -0
  75. package/lib/types/next/tree-view/stories/tree-view-actions.story.d.ts.map +1 -0
  76. package/lib/types/next/tree-view/stories/tree-view-lazy.story.d.ts +24 -0
  77. package/lib/types/next/tree-view/stories/tree-view-lazy.story.d.ts.map +1 -0
  78. package/lib/types/next/tree-view/stories/tree-view-multi.story.d.ts +24 -0
  79. package/lib/types/next/tree-view/stories/tree-view-multi.story.d.ts.map +1 -0
  80. package/lib/types/next/tree-view/stories/tree-view-non-selectable-folders.story.d.ts +24 -0
  81. package/lib/types/next/tree-view/stories/tree-view-non-selectable-folders.story.d.ts.map +1 -0
  82. package/lib/types/next/tree-view/stories/tree-view-single.story.d.ts +24 -0
  83. package/lib/types/next/tree-view/stories/tree-view-single.story.d.ts.map +1 -0
  84. package/lib/types/next/tree-view/stories/tree-view-tooltip.story.d.ts +24 -0
  85. package/lib/types/next/tree-view/stories/tree-view-tooltip.story.d.ts.map +1 -0
  86. package/lib/types/next/tree-view/stories/tree-view-trailing.story.d.ts +24 -0
  87. package/lib/types/next/tree-view/stories/tree-view-trailing.story.d.ts.map +1 -0
  88. package/lib/types/next/tree-view/stories/tree-view-uncontrolled.story.d.ts +24 -0
  89. package/lib/types/next/tree-view/stories/tree-view-uncontrolled.story.d.ts.map +1 -0
  90. package/package.json +2 -2
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
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
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
+ import { Menu } from '@neo4j-ndl/react';
24
+ import { DocumentIconOutline, FolderIconSolid } from '@neo4j-ndl/react/icons';
25
+ import { TreeView } from '@neo4j-ndl/react/next';
26
+ import { useState } from 'react';
27
+ const Component = () => {
28
+ const [expanded, setExpanded] = useState({});
29
+ const [selected, setSelected] = useState(null);
30
+ const toggle = (key) => setExpanded((prev) => (Object.assign(Object.assign({}, prev), { [key]: !prev[key] })));
31
+ return (_jsxs(TreeView, { ariaLabel: "Project files", children: [_jsxs(TreeView.Item, { title: "src", hasChildren: true, isExpanded: expanded['src'], onExpandedChange: () => toggle('src'), isSelected: selected === 'src', onSelectedChange: () => setSelected('src'), leadingVisual: _jsx(FolderIconSolid, {}), actionMenuItems: _jsxs(_Fragment, { children: [_jsx(Menu.Item, { title: "New File", onClick: () => alert('New file in src') }), _jsx(Menu.Item, { title: "Rename", onClick: () => alert('Rename src') }), _jsx(Menu.Item, { title: "Delete", onClick: () => alert('Delete src') })] }), children: [_jsx(TreeView.Item, { title: "index.ts", isSelected: selected === 'index', onSelectedChange: () => setSelected('index'), leadingVisual: _jsx(DocumentIconOutline, {}), actionMenuItems: _jsxs(_Fragment, { children: [_jsx(Menu.Item, { title: "Open", onClick: () => alert('Open index.ts') }), _jsx(Menu.Item, { title: "Rename", onClick: () => alert('Rename index.ts') }), _jsx(Menu.Item, { title: "Delete", onClick: () => alert('Delete index.ts') })] }) }), _jsx(TreeView.Item, { title: "utils.ts", isSelected: selected === 'utils', onSelectedChange: () => setSelected('utils'), leadingVisual: _jsx(DocumentIconOutline, {}), actionMenuItems: _jsxs(_Fragment, { children: [_jsx(Menu.Item, { title: "Open", onClick: () => alert('Open utils.ts') }), _jsx(Menu.Item, { title: "Rename", onClick: () => alert('Rename utils.ts') }), _jsx(Menu.Item, { title: "Delete", onClick: () => alert('Delete utils.ts') })] }) })] }), _jsxs(TreeView.Item, { title: "tests", hasChildren: true, isExpanded: expanded['tests'], onExpandedChange: () => toggle('tests'), isSelected: selected === 'tests', onSelectedChange: () => setSelected('tests'), leadingVisual: _jsx(FolderIconSolid, {}), actionMenuItems: _jsxs(_Fragment, { children: [_jsx(Menu.Item, { title: "Run Tests", onClick: () => alert('Run all tests') }), _jsx(Menu.Item, { title: "New Test", onClick: () => alert('New test in tests') }), _jsx(Menu.Item, { title: "Delete", onClick: () => alert('Delete tests') })] }), children: [_jsx(TreeView.Item, { title: "index.test.ts", isSelected: selected === 'index-test', onSelectedChange: () => setSelected('index-test'), leadingVisual: _jsx(DocumentIconOutline, {}), actionMenuItems: _jsxs(_Fragment, { children: [_jsx(Menu.Item, { title: "Run", onClick: () => alert('Run index.test.ts') }), _jsx(Menu.Item, { title: "Rename", onClick: () => alert('Rename index.test.ts') }), _jsx(Menu.Item, { title: "Delete", onClick: () => alert('Delete index.test.ts') })] }) }), _jsx(TreeView.Item, { title: "utils.test.ts", isSelected: selected === 'utils-test', onSelectedChange: () => setSelected('utils-test'), leadingVisual: _jsx(DocumentIconOutline, {}), actionMenuItems: _jsxs(_Fragment, { children: [_jsx(Menu.Item, { title: "Run", onClick: () => alert('Run utils.test.ts') }), _jsx(Menu.Item, { title: "Rename", onClick: () => alert('Rename utils.test.ts') }), _jsx(Menu.Item, { title: "Delete", onClick: () => alert('Delete utils.test.ts') })] }) })] }), _jsx(TreeView.Item, { title: "README.md", isSelected: selected === 'readme', onSelectedChange: () => setSelected('readme'), leadingVisual: _jsx(DocumentIconOutline, {}), actionMenuItems: _jsxs(_Fragment, { children: [_jsx(Menu.Item, { title: "Open", onClick: () => alert('Open README.md') }), _jsx(Menu.Item, { title: "Rename", onClick: () => alert('Rename README.md') }), _jsx(Menu.Item, { title: "Delete", onClick: () => alert('Delete README.md') })] }) })] }));
32
+ };
33
+ export default Component;
34
+ //# sourceMappingURL=tree-view-actions.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-view-actions.story.js","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/tree-view-actions.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,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Y,CAAC,EACjD,aAAa,EAAE,KAAC,mBAAmB,KAAG,EACtC,eAAe,EACb,8BACE,KAAC,IAAI,CAAC,IAAI,IACR,KAAK,EAAC,KAAK,EACX,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,GACzC,EACF,KAAC,IAAI,CAAC,IAAI,IACR,KAAK,EAAC,QAAQ,EACd,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,sBAAsB,CAAC,GAC5C,EACF,KAAC,IAAI,CAAC,IAAI,IACR,KAAK,EAAC,QAAQ,EACd,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,sBAAsB,CAAC,GAC5C,IACD,GAEL,IACY,EAChB,KAAC,QAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,WAAW,EACjB,UAAU,EAAE,QAAQ,KAAK,QAAQ,EACjC,gBAAgB,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,EAC7C,aAAa,EAAE,KAAC,mBAAmB,KAAG,EACtC,eAAe,EACb,8BACE,KAAC,IAAI,CAAC,IAAI,IAAC,KAAK,EAAC,MAAM,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAAI,EAClE,KAAC,IAAI,CAAC,IAAI,IACR,KAAK,EAAC,QAAQ,EACd,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,kBAAkB,CAAC,GACxC,EACF,KAAC,IAAI,CAAC,IAAI,IACR,KAAK,EAAC,QAAQ,EACd,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,kBAAkB,CAAC,GACxC,IACD,GAEL,IACO,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,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 { Menu } from '@neo4j-ndl/react';\nimport { DocumentIconOutline, FolderIconSolid } from '@neo4j-ndl/react/icons';\nimport { TreeView } from '@neo4j-ndl/react/next';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [expanded, setExpanded] = useState<Record<string, boolean>>({});\n const [selected, setSelected] = useState<string | null>(null);\n\n const toggle = (key: string) =>\n setExpanded((prev) => ({ ...prev, [key]: !prev[key] }));\n\n return (\n <TreeView ariaLabel=\"Project files\">\n <TreeView.Item\n title=\"src\"\n hasChildren\n isExpanded={expanded['src']}\n onExpandedChange={() => toggle('src')}\n isSelected={selected === 'src'}\n onSelectedChange={() => setSelected('src')}\n leadingVisual={<FolderIconSolid />}\n actionMenuItems={\n <>\n <Menu.Item\n title=\"New File\"\n onClick={() => alert('New file in src')}\n />\n <Menu.Item title=\"Rename\" onClick={() => alert('Rename src')} />\n <Menu.Item title=\"Delete\" onClick={() => alert('Delete src')} />\n </>\n }\n >\n <TreeView.Item\n title=\"index.ts\"\n isSelected={selected === 'index'}\n onSelectedChange={() => setSelected('index')}\n leadingVisual={<DocumentIconOutline />}\n actionMenuItems={\n <>\n <Menu.Item title=\"Open\" onClick={() => alert('Open index.ts')} />\n <Menu.Item\n title=\"Rename\"\n onClick={() => alert('Rename index.ts')}\n />\n <Menu.Item\n title=\"Delete\"\n onClick={() => alert('Delete index.ts')}\n />\n </>\n }\n />\n <TreeView.Item\n title=\"utils.ts\"\n isSelected={selected === 'utils'}\n onSelectedChange={() => setSelected('utils')}\n leadingVisual={<DocumentIconOutline />}\n actionMenuItems={\n <>\n <Menu.Item title=\"Open\" onClick={() => alert('Open utils.ts')} />\n <Menu.Item\n title=\"Rename\"\n onClick={() => alert('Rename utils.ts')}\n />\n <Menu.Item\n title=\"Delete\"\n onClick={() => alert('Delete utils.ts')}\n />\n </>\n }\n />\n </TreeView.Item>\n <TreeView.Item\n title=\"tests\"\n hasChildren\n isExpanded={expanded['tests']}\n onExpandedChange={() => toggle('tests')}\n isSelected={selected === 'tests'}\n onSelectedChange={() => setSelected('tests')}\n leadingVisual={<FolderIconSolid />}\n actionMenuItems={\n <>\n <Menu.Item\n title=\"Run Tests\"\n onClick={() => alert('Run all tests')}\n />\n <Menu.Item\n title=\"New Test\"\n onClick={() => alert('New test in tests')}\n />\n <Menu.Item title=\"Delete\" onClick={() => alert('Delete tests')} />\n </>\n }\n >\n <TreeView.Item\n title=\"index.test.ts\"\n isSelected={selected === 'index-test'}\n onSelectedChange={() => setSelected('index-test')}\n leadingVisual={<DocumentIconOutline />}\n actionMenuItems={\n <>\n <Menu.Item\n title=\"Run\"\n onClick={() => alert('Run index.test.ts')}\n />\n <Menu.Item\n title=\"Rename\"\n onClick={() => alert('Rename index.test.ts')}\n />\n <Menu.Item\n title=\"Delete\"\n onClick={() => alert('Delete index.test.ts')}\n />\n </>\n }\n />\n <TreeView.Item\n title=\"utils.test.ts\"\n isSelected={selected === 'utils-test'}\n onSelectedChange={() => setSelected('utils-test')}\n leadingVisual={<DocumentIconOutline />}\n actionMenuItems={\n <>\n <Menu.Item\n title=\"Run\"\n onClick={() => alert('Run utils.test.ts')}\n />\n <Menu.Item\n title=\"Rename\"\n onClick={() => alert('Rename utils.test.ts')}\n />\n <Menu.Item\n title=\"Delete\"\n onClick={() => alert('Delete utils.test.ts')}\n />\n </>\n }\n />\n </TreeView.Item>\n <TreeView.Item\n title=\"README.md\"\n isSelected={selected === 'readme'}\n onSelectedChange={() => setSelected('readme')}\n leadingVisual={<DocumentIconOutline />}\n actionMenuItems={\n <>\n <Menu.Item title=\"Open\" onClick={() => alert('Open README.md')} />\n <Menu.Item\n title=\"Rename\"\n onClick={() => alert('Rename README.md')}\n />\n <Menu.Item\n title=\"Delete\"\n onClick={() => alert('Delete README.md')}\n />\n </>\n }\n />\n </TreeView>\n );\n};\n\nexport default Component;\n"]}
@@ -0,0 +1,147 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
+ import { DocumentIconOutline, FolderIconSolid, PhotoIconOutline, } from '@neo4j-ndl/react/icons';
24
+ import { TreeView } from '@neo4j-ndl/react/next';
25
+ import { useCallback, useMemo, useRef, useState } from 'react';
26
+ const TREE_DATA = [
27
+ {
28
+ children: [
29
+ {
30
+ children: [
31
+ { id: 'app-tsx', label: 'App.tsx' },
32
+ { id: 'index-tsx', label: 'index.tsx' },
33
+ { id: 'styles-css', label: 'styles.css' },
34
+ ],
35
+ id: 'frontend',
36
+ label: 'Frontend',
37
+ },
38
+ {
39
+ children: [
40
+ { id: 'server-ts', label: 'server.ts' },
41
+ { id: 'routes-ts', label: 'routes.ts' },
42
+ ],
43
+ id: 'backend',
44
+ label: 'Backend',
45
+ },
46
+ { id: 'readme-md', label: 'README.md' },
47
+ ],
48
+ id: 'projects',
49
+ label: 'Projects',
50
+ },
51
+ {
52
+ children: [
53
+ {
54
+ children: [
55
+ { id: 'beach-jpg', label: 'beach.jpg' },
56
+ { id: 'sunset-jpg', label: 'sunset.jpg' },
57
+ ],
58
+ id: 'vacation',
59
+ label: 'Vacation',
60
+ },
61
+ { id: 'profile-png', label: 'profile.png' },
62
+ ],
63
+ id: 'photos',
64
+ label: 'Photos',
65
+ },
66
+ {
67
+ children: [
68
+ { id: 'resume-pdf', label: 'resume.pdf' },
69
+ { id: 'cover-letter-pdf', label: 'cover-letter.pdf' },
70
+ { id: 'notes-txt', label: 'notes.txt' },
71
+ ],
72
+ id: 'documents',
73
+ label: 'Documents',
74
+ },
75
+ {
76
+ children: [
77
+ {
78
+ children: [
79
+ { id: 'chill-m3u', label: 'chill.m3u' },
80
+ { id: 'workout-m3u', label: 'workout.m3u' },
81
+ ],
82
+ id: 'playlists',
83
+ label: 'Playlists',
84
+ },
85
+ { id: 'favorites-m3u', label: 'favorites.m3u' },
86
+ ],
87
+ id: 'music',
88
+ label: 'Music',
89
+ },
90
+ { id: 'todo-txt', label: 'TODO.txt' },
91
+ ];
92
+ const LOAD_DELAY_MS = 600;
93
+ function iconForNode(node) {
94
+ if (node.children) {
95
+ return _jsx(FolderIconSolid, {});
96
+ }
97
+ if (/\.(jpg|jpeg|png|gif|svg)$/i.test(node.label)) {
98
+ return _jsx(PhotoIconOutline, {});
99
+ }
100
+ return _jsx(DocumentIconOutline, {});
101
+ }
102
+ const INITIAL_NODE_STATE = {
103
+ hasLoaded: false,
104
+ isExpanded: false,
105
+ isLoading: false,
106
+ };
107
+ function useTreeState() {
108
+ const [nodeStates, setNodeStates] = useState({});
109
+ const [selectedId, setSelectedId] = useState(null);
110
+ const timers = useRef({});
111
+ const getNodeState = useCallback((id) => { var _a; return (_a = nodeStates[id]) !== null && _a !== void 0 ? _a : INITIAL_NODE_STATE; }, [nodeStates]);
112
+ const handleExpand = useCallback((id, expanded) => {
113
+ setNodeStates((prev) => {
114
+ var _a;
115
+ const current = (_a = prev[id]) !== null && _a !== void 0 ? _a : INITIAL_NODE_STATE;
116
+ if (expanded && !current.hasLoaded) {
117
+ if (timers.current[id]) {
118
+ clearTimeout(timers.current[id]);
119
+ }
120
+ timers.current[id] = setTimeout(() => {
121
+ setNodeStates((p) => (Object.assign(Object.assign({}, p), { [id]: { hasLoaded: true, isExpanded: true, isLoading: false } })));
122
+ delete timers.current[id];
123
+ }, LOAD_DELAY_MS);
124
+ return Object.assign(Object.assign({}, prev), { [id]: { hasLoaded: false, isExpanded: true, isLoading: true } });
125
+ }
126
+ return Object.assign(Object.assign({}, prev), { [id]: Object.assign(Object.assign({}, current), { isExpanded: expanded }) });
127
+ });
128
+ }, []);
129
+ const handleSelect = useCallback((id) => setSelectedId((prev) => (prev === id ? null : id)), []);
130
+ return { getNodeState, handleExpand, handleSelect, selectedId };
131
+ }
132
+ function renderNode(node, ctx) {
133
+ const hasChildren = node.children !== undefined &&
134
+ node.children !== null &&
135
+ node.children.length > 0;
136
+ const state = ctx.getNodeState(node.id);
137
+ return (_jsxs(TreeView.Item, { title: node.label, hasChildren: hasChildren, isExpanded: state.isExpanded, isLoading: state.isLoading, isSelected: ctx.selectedId === node.id, leadingVisual: iconForNode(node), onExpandedChange: (expanded) => ctx.handleExpand(node.id, expanded), onSelectedChange: () => ctx.handleSelect(node.id), children: [hasChildren && state.isLoading && !state.hasLoaded && (_jsx(TreeView.SkeletonItem, { rows: 2 })), hasChildren &&
138
+ state.hasLoaded &&
139
+ node.children.map((child) => renderNode(child, ctx))] }, node.id));
140
+ }
141
+ const Component = () => {
142
+ const { getNodeState, selectedId, handleExpand, handleSelect } = useTreeState();
143
+ const ctx = useMemo(() => ({ getNodeState, handleExpand, handleSelect, selectedId }), [getNodeState, selectedId, handleExpand, handleSelect]);
144
+ return (_jsx(TreeView, { ariaLabel: "Lazy-loaded file explorer", children: TREE_DATA.map((node) => renderNode(node, ctx)) }));
145
+ };
146
+ export default Component;
147
+ //# sourceMappingURL=tree-view-lazy.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-view-lazy.story.js","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/tree-view-lazy.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAQ/D,MAAM,SAAS,GAAe;IAC5B;QACE,QAAQ,EAAE;YACR;gBACE,QAAQ,EAAE;oBACR,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;oBACnC,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;oBACvC,EAAE,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;iBAC1C;gBACD,EAAE,EAAE,UAAU;gBACd,KAAK,EAAE,UAAU;aAClB;YACD;gBACE,QAAQ,EAAE;oBACR,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;oBACvC,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;iBACxC;gBACD,EAAE,EAAE,SAAS;gBACb,KAAK,EAAE,SAAS;aACjB;YACD,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;SACxC;QACD,EAAE,EAAE,UAAU;QACd,KAAK,EAAE,UAAU;KAClB;IACD;QACE,QAAQ,EAAE;YACR;gBACE,QAAQ,EAAE;oBACR,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;oBACvC,EAAE,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE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AC,EAAE,EAAE,QAAQ,CAAC,EAErC,gBAAgB,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,aAEhD,WAAW,IAAI,KAAK,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,SAAS,IAAI,CACrD,KAAC,QAAQ,CAAC,YAAY,IAAC,IAAI,EAAE,CAAC,GAAI,CACnC,EACA,WAAW;gBACV,KAAK,CAAC,SAAS;gBACf,IAAI,CAAC,QAAS,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,KAjBlD,IAAI,CAAC,EAAE,CAkBE,CACjB,CAAC;AACJ,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,GAC5D,YAAY,EAAE,CAAC;IAEjB,MAAM,GAAG,GAAG,OAAO,CACjB,GAAG,EAAE,CAAC,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC,EAChE,CAAC,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,CAAC,CACvD,CAAC;IAEF,OAAO,CACL,KAAC,QAAQ,IAAC,SAAS,EAAC,2BAA2B,YAC5C,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,GACtC,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,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 {\n DocumentIconOutline,\n FolderIconSolid,\n PhotoIconOutline,\n} from '@neo4j-ndl/react/icons';\nimport { TreeView } from '@neo4j-ndl/react/next';\nimport { useCallback, useMemo, useRef, useState } from 'react';\n\ntype TreeNode = {\n id: string;\n label: string;\n children?: TreeNode[];\n};\n\nconst TREE_DATA: TreeNode[] = [\n {\n children: [\n {\n children: [\n { id: 'app-tsx', label: 'App.tsx' },\n { id: 'index-tsx', label: 'index.tsx' },\n { id: 'styles-css', label: 'styles.css' },\n ],\n id: 'frontend',\n label: 'Frontend',\n },\n {\n children: [\n { id: 'server-ts', label: 'server.ts' },\n { id: 'routes-ts', label: 'routes.ts' },\n ],\n id: 'backend',\n label: 'Backend',\n },\n { id: 'readme-md', label: 'README.md' },\n ],\n id: 'projects',\n label: 'Projects',\n },\n {\n children: [\n {\n children: [\n { id: 'beach-jpg', label: 'beach.jpg' },\n { id: 'sunset-jpg', label: 'sunset.jpg' },\n ],\n id: 'vacation',\n label: 'Vacation',\n },\n { id: 'profile-png', label: 'profile.png' },\n ],\n id: 'photos',\n label: 'Photos',\n },\n {\n children: [\n { id: 'resume-pdf', label: 'resume.pdf' },\n { id: 'cover-letter-pdf', label: 'cover-letter.pdf' },\n { id: 'notes-txt', label: 'notes.txt' },\n ],\n id: 'documents',\n label: 'Documents',\n },\n {\n children: [\n {\n children: [\n { id: 'chill-m3u', label: 'chill.m3u' },\n { id: 'workout-m3u', label: 'workout.m3u' },\n ],\n id: 'playlists',\n label: 'Playlists',\n },\n { id: 'favorites-m3u', label: 'favorites.m3u' },\n ],\n id: 'music',\n label: 'Music',\n },\n { id: 'todo-txt', label: 'TODO.txt' },\n];\n\nconst LOAD_DELAY_MS = 600;\n\nfunction iconForNode(node: TreeNode) {\n if (node.children) {\n return <FolderIconSolid />;\n }\n if (/\\.(jpg|jpeg|png|gif|svg)$/i.test(node.label)) {\n return <PhotoIconOutline />;\n }\n return <DocumentIconOutline />;\n}\n\ntype NodeState = {\n isExpanded: boolean;\n isLoading: boolean;\n hasLoaded: boolean;\n};\n\nconst INITIAL_NODE_STATE: NodeState = {\n hasLoaded: false,\n isExpanded: false,\n isLoading: false,\n};\n\nfunction useTreeState() {\n const [nodeStates, setNodeStates] = useState<Record<string, NodeState>>({});\n const [selectedId, setSelectedId] = useState<string | null>(null);\n const timers = useRef<Record<string, ReturnType<typeof setTimeout>>>({});\n\n const getNodeState = useCallback(\n (id: string): NodeState => nodeStates[id] ?? INITIAL_NODE_STATE,\n [nodeStates],\n );\n\n const handleExpand = useCallback((id: string, expanded: boolean) => {\n setNodeStates((prev) => {\n const current = prev[id] ?? INITIAL_NODE_STATE;\n if (expanded && !current.hasLoaded) {\n if (timers.current[id]) {\n clearTimeout(timers.current[id]);\n }\n timers.current[id] = setTimeout(() => {\n setNodeStates((p) => ({\n ...p,\n [id]: { hasLoaded: true, isExpanded: true, isLoading: false },\n }));\n delete timers.current[id];\n }, LOAD_DELAY_MS);\n return {\n ...prev,\n [id]: { hasLoaded: false, isExpanded: true, isLoading: true },\n };\n }\n return { ...prev, [id]: { ...current, isExpanded: expanded } };\n });\n }, []);\n\n const handleSelect = useCallback(\n (id: string) => setSelectedId((prev) => (prev === id ? null : id)),\n [],\n );\n\n return { getNodeState, handleExpand, handleSelect, selectedId };\n}\n\ntype RenderContext = {\n getNodeState: (id: string) => NodeState;\n selectedId: string | null;\n handleExpand: (id: string, expanded: boolean) => void;\n handleSelect: (id: string) => void;\n};\n\nfunction renderNode(node: TreeNode, ctx: RenderContext) {\n const hasChildren =\n node.children !== undefined &&\n node.children !== null &&\n node.children.length > 0;\n const state = ctx.getNodeState(node.id);\n\n return (\n <TreeView.Item\n key={node.id}\n title={node.label}\n hasChildren={hasChildren}\n isExpanded={state.isExpanded}\n isLoading={state.isLoading}\n isSelected={ctx.selectedId === node.id}\n leadingVisual={iconForNode(node)}\n onExpandedChange={(expanded: boolean) =>\n ctx.handleExpand(node.id, expanded)\n }\n onSelectedChange={() => ctx.handleSelect(node.id)}\n >\n {hasChildren && state.isLoading && !state.hasLoaded && (\n <TreeView.SkeletonItem rows={2} />\n )}\n {hasChildren &&\n state.hasLoaded &&\n node.children!.map((child) => renderNode(child, ctx))}\n </TreeView.Item>\n );\n}\n\nconst Component = () => {\n const { getNodeState, selectedId, handleExpand, handleSelect } =\n useTreeState();\n\n const ctx = useMemo<RenderContext>(\n () => ({ getNodeState, handleExpand, handleSelect, selectedId }),\n [getNodeState, selectedId, handleExpand, handleSelect],\n );\n\n return (\n <TreeView ariaLabel=\"Lazy-loaded file explorer\">\n {TREE_DATA.map((node) => renderNode(node, ctx))}\n </TreeView>\n );\n};\n\nexport default Component;\n"]}
@@ -0,0 +1,71 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
+ import { DocumentIconOutline, FolderIconSolid, PhotoIconOutline, } from '@neo4j-ndl/react/icons';
24
+ import { TreeView } from '@neo4j-ndl/react/next';
25
+ import { useCallback, useState } from 'react';
26
+ const WORK_CHILDREN = ['report', 'presentation'];
27
+ const DOC_CHILDREN = ['work', 'resume'];
28
+ const IMAGE_CHILDREN = ['photo', 'screenshot'];
29
+ const DISABLED_KEYS = new Set(['presentation']);
30
+ function getParentChecked(checked, childKeys) {
31
+ const enabledKeys = childKeys.filter((k) => !DISABLED_KEYS.has(k));
32
+ if (enabledKeys.length === 0) {
33
+ return { isChecked: false, isIndeterminate: false };
34
+ }
35
+ const checkedCount = enabledKeys.filter((k) => checked[k]).length;
36
+ if (checkedCount === 0) {
37
+ return { isChecked: false, isIndeterminate: false };
38
+ }
39
+ if (checkedCount === enabledKeys.length) {
40
+ return { isChecked: true, isIndeterminate: false };
41
+ }
42
+ return { isChecked: false, isIndeterminate: true };
43
+ }
44
+ const Component = () => {
45
+ const [expanded, setExpanded] = useState({});
46
+ const [checked, setChecked] = useState({});
47
+ const toggle = (key) => setExpanded((prev) => (Object.assign(Object.assign({}, prev), { [key]: !prev[key] })));
48
+ const toggleCheck = useCallback((key) => {
49
+ setChecked((prev) => (Object.assign(Object.assign({}, prev), { [key]: !prev[key] })));
50
+ }, []);
51
+ const toggleParent = useCallback((childKeys) => {
52
+ const enabledKeys = childKeys.filter((k) => !DISABLED_KEYS.has(k));
53
+ const isAllChecked = enabledKeys.every((k) => checked[k]);
54
+ setChecked((prev) => {
55
+ const next = Object.assign({}, prev);
56
+ for (const k of enabledKeys) {
57
+ next[k] = !isAllChecked;
58
+ }
59
+ return next;
60
+ });
61
+ }, [checked]);
62
+ const docState = getParentChecked(checked, [
63
+ ...DOC_CHILDREN,
64
+ ...WORK_CHILDREN,
65
+ ]);
66
+ const workState = getParentChecked(checked, WORK_CHILDREN);
67
+ const imageState = getParentChecked(checked, IMAGE_CHILDREN);
68
+ return (_jsxs(TreeView, { ariaLabel: "File explorer", selectionMode: "multiple", children: [_jsxs(TreeView.Item, { title: "Documents", hasChildren: true, isExpanded: expanded['documents'], onExpandedChange: () => toggle('documents'), isSelected: docState.isChecked, isIndeterminate: docState.isIndeterminate, onSelectedChange: () => toggleParent([...DOC_CHILDREN, ...WORK_CHILDREN]), leadingVisual: _jsx(FolderIconSolid, {}), children: [_jsxs(TreeView.Item, { title: "Work", hasChildren: true, isExpanded: expanded['work'], onExpandedChange: () => toggle('work'), isSelected: workState.isChecked, isIndeterminate: workState.isIndeterminate, onSelectedChange: () => toggleParent(WORK_CHILDREN), leadingVisual: _jsx(FolderIconSolid, {}), children: [_jsx(TreeView.Item, { title: "Report.pdf", isSelected: !!checked['report'], onSelectedChange: () => toggleCheck('report'), leadingVisual: _jsx(DocumentIconOutline, {}) }), _jsx(TreeView.Item, { title: "Presentation.pptx", isDisabled: true, onSelectedChange: () => null, leadingVisual: _jsx(DocumentIconOutline, {}) })] }), _jsx(TreeView.Item, { title: "Resume.pdf", isSelected: !!checked['resume'], onSelectedChange: () => toggleCheck('resume'), leadingVisual: _jsx(DocumentIconOutline, {}) })] }), _jsxs(TreeView.Item, { title: "Images", hasChildren: true, isExpanded: expanded['images'], onExpandedChange: () => toggle('images'), isSelected: imageState.isChecked, isIndeterminate: imageState.isIndeterminate, onSelectedChange: () => toggleParent(IMAGE_CHILDREN), leadingVisual: _jsx(FolderIconSolid, {}), children: [_jsx(TreeView.Item, { title: "Photo.jpg", isSelected: !!checked['photo'], onSelectedChange: () => toggleCheck('photo'), leadingVisual: _jsx(PhotoIconOutline, {}) }), _jsx(TreeView.Item, { title: "Screenshot.png", isSelected: !!checked['screenshot'], onSelectedChange: () => toggleCheck('screenshot'), leadingVisual: _jsx(PhotoIconOutline, {}) })] })] }));
69
+ };
70
+ export default Component;
71
+ //# sourceMappingURL=tree-view-multi.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-view-multi.story.js","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/tree-view-multi.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC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IACY,IACP,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,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 {\n DocumentIconOutline,\n FolderIconSolid,\n PhotoIconOutline,\n} from '@neo4j-ndl/react/icons';\nimport { TreeView } from '@neo4j-ndl/react/next';\nimport { useCallback, useState } from 'react';\n\ntype CheckedState = Record<string, boolean>;\n\nconst WORK_CHILDREN = ['report', 'presentation'] as const;\nconst DOC_CHILDREN = ['work', 'resume'] as const;\nconst IMAGE_CHILDREN = ['photo', 'screenshot'] as const;\nconst DISABLED_KEYS = new Set(['presentation']);\n\nfunction getParentChecked(\n checked: CheckedState,\n childKeys: readonly string[],\n): { isChecked: boolean; isIndeterminate: boolean } {\n const enabledKeys = childKeys.filter((k) => !DISABLED_KEYS.has(k));\n if (enabledKeys.length === 0) {\n return { isChecked: false, isIndeterminate: false };\n }\n const checkedCount = enabledKeys.filter((k) => checked[k]).length;\n if (checkedCount === 0) {\n return { isChecked: false, isIndeterminate: false };\n }\n if (checkedCount === enabledKeys.length) {\n return { isChecked: true, isIndeterminate: false };\n }\n return { isChecked: false, isIndeterminate: true };\n}\n\nconst Component = () => {\n const [expanded, setExpanded] = useState<Record<string, boolean>>({});\n const [checked, setChecked] = useState<CheckedState>({});\n\n const toggle = (key: string) =>\n setExpanded((prev) => ({ ...prev, [key]: !prev[key] }));\n\n const toggleCheck = useCallback((key: string) => {\n setChecked((prev) => ({ ...prev, [key]: !prev[key] }));\n }, []);\n\n const toggleParent = useCallback(\n (childKeys: readonly string[]) => {\n const enabledKeys = childKeys.filter((k) => !DISABLED_KEYS.has(k));\n const isAllChecked = enabledKeys.every((k) => checked[k]);\n setChecked((prev) => {\n const next = { ...prev };\n for (const k of enabledKeys) {\n next[k] = !isAllChecked;\n }\n return next;\n });\n },\n [checked],\n );\n\n const docState = getParentChecked(checked, [\n ...DOC_CHILDREN,\n ...WORK_CHILDREN,\n ]);\n const workState = getParentChecked(checked, WORK_CHILDREN);\n const imageState = getParentChecked(checked, IMAGE_CHILDREN);\n\n return (\n <TreeView ariaLabel=\"File explorer\" selectionMode=\"multiple\">\n <TreeView.Item\n title=\"Documents\"\n hasChildren\n isExpanded={expanded['documents']}\n onExpandedChange={() => toggle('documents')}\n isSelected={docState.isChecked}\n isIndeterminate={docState.isIndeterminate}\n onSelectedChange={() =>\n toggleParent([...DOC_CHILDREN, ...WORK_CHILDREN])\n }\n leadingVisual={<FolderIconSolid />}\n >\n <TreeView.Item\n title=\"Work\"\n hasChildren\n isExpanded={expanded['work']}\n onExpandedChange={() => toggle('work')}\n isSelected={workState.isChecked}\n isIndeterminate={workState.isIndeterminate}\n onSelectedChange={() => toggleParent(WORK_CHILDREN)}\n leadingVisual={<FolderIconSolid />}\n >\n <TreeView.Item\n title=\"Report.pdf\"\n isSelected={!!checked['report']}\n onSelectedChange={() => toggleCheck('report')}\n leadingVisual={<DocumentIconOutline />}\n />\n <TreeView.Item\n title=\"Presentation.pptx\"\n isDisabled\n onSelectedChange={() => null}\n leadingVisual={<DocumentIconOutline />}\n />\n </TreeView.Item>\n <TreeView.Item\n title=\"Resume.pdf\"\n isSelected={!!checked['resume']}\n onSelectedChange={() => toggleCheck('resume')}\n leadingVisual={<DocumentIconOutline />}\n />\n </TreeView.Item>\n <TreeView.Item\n title=\"Images\"\n hasChildren\n isExpanded={expanded['images']}\n onExpandedChange={() => toggle('images')}\n isSelected={imageState.isChecked}\n isIndeterminate={imageState.isIndeterminate}\n onSelectedChange={() => toggleParent(IMAGE_CHILDREN)}\n leadingVisual={<FolderIconSolid />}\n >\n <TreeView.Item\n title=\"Photo.jpg\"\n isSelected={!!checked['photo']}\n onSelectedChange={() => toggleCheck('photo')}\n leadingVisual={<PhotoIconOutline />}\n />\n <TreeView.Item\n title=\"Screenshot.png\"\n isSelected={!!checked['screenshot']}\n onSelectedChange={() => toggleCheck('screenshot')}\n leadingVisual={<PhotoIconOutline />}\n />\n </TreeView.Item>\n </TreeView>\n );\n};\n\nexport default Component;\n"]}
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
+ import { DocumentIconOutline, FolderIconSolid } from '@neo4j-ndl/react/icons';
24
+ import { TreeView } from '@neo4j-ndl/react/next';
25
+ import { useState } from 'react';
26
+ const Component = () => {
27
+ const [expanded, setExpanded] = useState({});
28
+ const [selected, setSelected] = useState(null);
29
+ const toggle = (key) => setExpanded((prev) => (Object.assign(Object.assign({}, prev), { [key]: !prev[key] })));
30
+ return (_jsxs(TreeView, { ariaLabel: "File explorer", children: [_jsxs(TreeView.Item, { title: "Documents", hasChildren: true, isExpanded: expanded['documents'], onExpandedChange: () => toggle('documents'), leadingVisual: _jsx(FolderIconSolid, {}), children: [_jsxs(TreeView.Item, { title: "Work", hasChildren: true, isExpanded: expanded['work'], onExpandedChange: () => toggle('work'), leadingVisual: _jsx(FolderIconSolid, {}), children: [_jsx(TreeView.Item, { title: "Report.pdf", isSelected: selected === 'report', onSelectedChange: () => setSelected('report'), leadingVisual: _jsx(DocumentIconOutline, {}) }), _jsx(TreeView.Item, { title: "Presentation.pptx", isSelected: selected === 'presentation', onSelectedChange: () => setSelected('presentation'), leadingVisual: _jsx(DocumentIconOutline, {}) })] }), _jsx(TreeView.Item, { title: "Resume.pdf", isSelected: selected === 'resume', onSelectedChange: () => setSelected('resume'), leadingVisual: _jsx(DocumentIconOutline, {}) })] }), _jsxs(TreeView.Item, { title: "Images", hasChildren: true, isExpanded: expanded['images'], onExpandedChange: () => toggle('images'), leadingVisual: _jsx(FolderIconSolid, {}), children: [_jsx(TreeView.Item, { title: "Photo.jpg", isSelected: selected === 'photo', onSelectedChange: () => setSelected('photo'), leadingVisual: _jsx(DocumentIconOutline, {}) }), _jsx(TreeView.Item, { title: "Screenshot.png", isSelected: selected === 'screenshot', onSelectedChange: () => setSelected('screenshot'), leadingVisual: _jsx(DocumentIconOutline, {}) })] })] }));
31
+ };
32
+ export default Component;
33
+ //# sourceMappingURL=tree-view-non-selectable-folders.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-view-non-selectable-folders.story.js","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/tree-view-non-selectable-folders.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,QAAQ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,CAAC,cAAc,CAAC,EACnD,aAAa,EAAE,KAAC,mBAAmB,KAAG,GACtC,IACY,EAChB,KAAC,QAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,YAAY,EAClB,UAAU,EAAE,QAAQ,KAAK,QAAQ,EACjC,gBAAgB,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,EAC7C,aAAa,EAAE,KAAC,mBAAmB,KAAG,GACtC,IACY,EAChB,MAAC,QAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,QAAQ,EACd,WAAW,QACX,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,EAC9B,gBAAgB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EACxC,aAAa,EAAE,KAAC,eAAe,KAAG,aAElC,KAAC,QAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,WAAW,EACjB,UAAU,EAAE,QAAQ,KAAK,OAAO,EAChC,gBAAgB,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,EAC5C,aAAa,EAAE,KAAC,mBAAmB,KAAG,GACtC,EACF,KAAC,QAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,gBAAgB,EACtB,UAAU,EAAE,QAAQ,KAAK,YAAY,EACrC,gBAAgB,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,YAAY,CAAC,EACjD,aAAa,EAAE,KAAC,mBAAmB,KAAG,GACtC,IACY,IACP,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,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\nconst Component = () => {\n const [expanded, setExpanded] = useState<Record<string, boolean>>({});\n const [selected, setSelected] = useState<string | null>(null);\n\n const toggle = (key: string) =>\n setExpanded((prev) => ({ ...prev, [key]: !prev[key] }));\n\n return (\n <TreeView ariaLabel=\"File explorer\">\n <TreeView.Item\n title=\"Documents\"\n hasChildren\n isExpanded={expanded['documents']}\n onExpandedChange={() => toggle('documents')}\n leadingVisual={<FolderIconSolid />}\n >\n <TreeView.Item\n title=\"Work\"\n hasChildren\n isExpanded={expanded['work']}\n onExpandedChange={() => toggle('work')}\n leadingVisual={<FolderIconSolid />}\n >\n <TreeView.Item\n title=\"Report.pdf\"\n isSelected={selected === 'report'}\n onSelectedChange={() => setSelected('report')}\n leadingVisual={<DocumentIconOutline />}\n />\n <TreeView.Item\n title=\"Presentation.pptx\"\n isSelected={selected === 'presentation'}\n onSelectedChange={() => setSelected('presentation')}\n leadingVisual={<DocumentIconOutline />}\n />\n </TreeView.Item>\n <TreeView.Item\n title=\"Resume.pdf\"\n isSelected={selected === 'resume'}\n onSelectedChange={() => setSelected('resume')}\n leadingVisual={<DocumentIconOutline />}\n />\n </TreeView.Item>\n <TreeView.Item\n title=\"Images\"\n hasChildren\n isExpanded={expanded['images']}\n onExpandedChange={() => toggle('images')}\n leadingVisual={<FolderIconSolid />}\n >\n <TreeView.Item\n title=\"Photo.jpg\"\n isSelected={selected === 'photo'}\n onSelectedChange={() => setSelected('photo')}\n leadingVisual={<DocumentIconOutline />}\n />\n <TreeView.Item\n title=\"Screenshot.png\"\n isSelected={selected === 'screenshot'}\n onSelectedChange={() => setSelected('screenshot')}\n leadingVisual={<DocumentIconOutline />}\n />\n </TreeView.Item>\n </TreeView>\n );\n};\n\nexport default Component;\n"]}
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
+ import { DocumentIconOutline, FolderIconSolid } from '@neo4j-ndl/react/icons';
24
+ import { TreeView } from '@neo4j-ndl/react/next';
25
+ import { useState } from 'react';
26
+ const Component = () => {
27
+ const [expanded, setExpanded] = useState({});
28
+ const [selected, setSelected] = useState(null);
29
+ const toggle = (key) => setExpanded((prev) => (Object.assign(Object.assign({}, prev), { [key]: !prev[key] })));
30
+ return (_jsxs(TreeView, { ariaLabel: "File explorer", children: [_jsxs(TreeView.Item, { title: "Documents", hasChildren: true, isExpanded: expanded['documents'], onExpandedChange: () => toggle('documents'), isSelected: selected === 'documents', onSelectedChange: () => setSelected('documents'), leadingVisual: _jsx(FolderIconSolid, {}), children: [_jsxs(TreeView.Item, { title: "Work", hasChildren: true, isExpanded: expanded['work'], onExpandedChange: () => toggle('work'), isSelected: selected === 'work', onSelectedChange: () => setSelected('work'), leadingVisual: _jsx(FolderIconSolid, {}), children: [_jsx(TreeView.Item, { title: "Report.pdf", isSelected: selected === 'report', onSelectedChange: () => setSelected('report'), leadingVisual: _jsx(DocumentIconOutline, {}) }), _jsx(TreeView.Item, { title: "Presentation.pptx", isDisabled: true, isSelected: selected === 'presentation', onSelectedChange: () => setSelected('presentation'), leadingVisual: _jsx(DocumentIconOutline, {}) })] }), _jsx(TreeView.Item, { title: "Resume.pdf", isSelected: selected === 'resume', onSelectedChange: () => setSelected('resume'), leadingVisual: _jsx(DocumentIconOutline, {}) })] }), _jsx(TreeView.Item, { title: "Images (disabled)", hasChildren: true, isExpanded: expanded['images'], onExpandedChange: () => toggle('images'), isSelected: selected === 'images', onSelectedChange: () => setSelected('images'), leadingVisual: _jsx(FolderIconSolid, {}), isDisabled: true }), _jsx(TreeView.Item, { title: "README.md", isSelected: selected === 'readme', onSelectedChange: () => setSelected('readme'), leadingVisual: _jsx(DocumentIconOutline, {}) })] }));
31
+ };
32
+ export default Component;
33
+ //# sourceMappingURL=tree-view-single.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-view-single.story.js","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/tree-view-single.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAA0B,EAAE,CAAC,CAAC;IACtE,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAE9D,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,EAAE,CAC7B,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,iCAAM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AAY,EAClB,UAAU,EAAE,QAAQ,KAAK,QAAQ,EACjC,gBAAgB,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,EAC7C,aAAa,EAAE,KAAC,mBAAmB,KAAG,GACtC,IACY,EAChB,KAAC,QAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,mBAAmB,EACzB,WAAW,QACX,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,EAC9B,gBAAgB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EACxC,UAAU,EAAE,QAAQ,KAAK,QAAQ,EACjC,gBAAgB,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,EAC7C,aAAa,EAAE,KAAC,eAAe,KAAG,EAClC,UAAU,SACV,EACF,KAAC,QAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,WAAW,EACjB,UAAU,EAAE,QAAQ,KAAK,QAAQ,EACjC,gBAAgB,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,EAC7C,aAAa,EAAE,KAAC,mBAAmB,KAAG,GACtC,IACO,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,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\nconst Component = () => {\n const [expanded, setExpanded] = useState<Record<string, boolean>>({});\n const [selected, setSelected] = useState<string | null>(null);\n\n const toggle = (key: string) =>\n setExpanded((prev) => ({ ...prev, [key]: !prev[key] }));\n\n return (\n <TreeView ariaLabel=\"File explorer\">\n <TreeView.Item\n title=\"Documents\"\n hasChildren\n isExpanded={expanded['documents']}\n onExpandedChange={() => toggle('documents')}\n isSelected={selected === 'documents'}\n onSelectedChange={() => setSelected('documents')}\n leadingVisual={<FolderIconSolid />}\n >\n <TreeView.Item\n title=\"Work\"\n hasChildren\n isExpanded={expanded['work']}\n onExpandedChange={() => toggle('work')}\n isSelected={selected === 'work'}\n onSelectedChange={() => setSelected('work')}\n leadingVisual={<FolderIconSolid />}\n >\n <TreeView.Item\n title=\"Report.pdf\"\n isSelected={selected === 'report'}\n onSelectedChange={() => setSelected('report')}\n leadingVisual={<DocumentIconOutline />}\n />\n <TreeView.Item\n title=\"Presentation.pptx\"\n isDisabled\n isSelected={selected === 'presentation'}\n onSelectedChange={() => setSelected('presentation')}\n leadingVisual={<DocumentIconOutline />}\n />\n </TreeView.Item>\n <TreeView.Item\n title=\"Resume.pdf\"\n isSelected={selected === 'resume'}\n onSelectedChange={() => setSelected('resume')}\n leadingVisual={<DocumentIconOutline />}\n />\n </TreeView.Item>\n <TreeView.Item\n title=\"Images (disabled)\"\n hasChildren\n isExpanded={expanded['images']}\n onExpandedChange={() => toggle('images')}\n isSelected={selected === 'images'}\n onSelectedChange={() => setSelected('images')}\n leadingVisual={<FolderIconSolid />}\n isDisabled\n />\n <TreeView.Item\n title=\"README.md\"\n isSelected={selected === 'readme'}\n onSelectedChange={() => setSelected('readme')}\n leadingVisual={<DocumentIconOutline />}\n />\n </TreeView>\n );\n};\n\nexport default Component;\n"]}
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
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
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
+ import { Menu } from '@neo4j-ndl/react';
24
+ import { AppearanceIcon, CheckCircleIconSolid, DatabaseSignalIcon, } from '@neo4j-ndl/react/icons';
25
+ import { TreeView } from '@neo4j-ndl/react/next';
26
+ import { useState } from 'react';
27
+ const Component = () => {
28
+ const [selected, setSelected] = useState(null);
29
+ return (_jsxs(TreeView, { ariaLabel: "Databases", style: { marginTop: '100px' }, children: [_jsx(TreeView.Item, { title: "Production", isSelected: selected === 'production', onSelectedChange: () => setSelected('production'), leadingVisual: _jsx(DatabaseSignalIcon, {}), trailingContent: _jsx(CheckCircleIconSolid, { className: "n-size-5 n-text-success-bg-status" }), actionMenuItems: _jsxs(_Fragment, { children: [_jsx(Menu.Item, { title: "Edit" }), _jsx(Menu.Item, { title: "Delete" }), _jsx(Menu.Item, { title: "Rename" })] }), tooltipContent: _jsxs(_Fragment, { children: [_jsx("span", { className: "n-font-semibold", children: "Production" }), _jsxs("span", { className: "n-flex n-items-center n-gap-token-4 n-mt-token-8", children: [_jsx(CheckCircleIconSolid, { className: "n-size-5 n-text-success-bg-status" }), ": Endorsed"] })] }) }), _jsx(TreeView.Item, { title: "Development", isSelected: selected === 'development', onSelectedChange: () => setSelected('development'), leadingVisual: _jsx(DatabaseSignalIcon, {}), trailingContent: _jsx(AppearanceIcon, { className: "n-size-5 n-text-warning-bg-status" }), tooltipContent: _jsxs(_Fragment, { children: [_jsx("span", { className: "n-font-semibold", children: "Development" }), _jsxs("span", { className: "n-flex n-items-center n-gap-token-4 n-mt-token-8", children: [_jsx(AppearanceIcon, { className: "n-size-5 n-text-warning-bg-status" }), ": In development"] })] }) })] }));
30
+ };
31
+ export default Component;
32
+ //# sourceMappingURL=tree-view-tooltip.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-view-tooltip.story.js","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/tree-view-tooltip.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAE9D,OAAO,CACL,MAAC,QAAQ,IAAC,SAAS,EAAC,WAAW,EAAC,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,aAC3D,KAAC,QAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,YAAY,EAClB,UAAU,EAAE,QAAQ,KAAK,YAAY,EACrC,gBAAgB,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,YAAY,CAAC,EACjD,aAAa,EAAE,KAAC,kBAAkB,KAAG,EACrC,eAAe,EACb,KAAC,oBAAoB,IAAC,SAAS,EAAC,mCAAmC,GAAG,EAExE,eAAe,EACb,8BACE,KAAC,IAAI,CAAC,IAAI,IAAC,KAAK,EAAC,MAAM,GAAG,EAC1B,KAAC,IAAI,CAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,GAAG,EAC5B,KAAC,IAAI,CAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,GAAG,IAC3B,EAEL,cAAc,EACZ,8BACE,eAAM,SAAS,EAAC,iBAAiB,2BAAkB,EACnD,gBAAM,SAAS,EAAC,kDAAkD,aAChE,KAAC,oBAAoB,IAAC,SAAS,EAAC,mCAAmC,GAAG,kBAEjE,IACN,GAEL,EACF,KAAC,QAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,aAAa,EACnB,UAAU,EAAE,QAAQ,KAAK,aAAa,EACtC,gBAAgB,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,aAAa,CAAC,EAClD,aAAa,EAAE,KAAC,kBAAkB,KAAG,EACrC,eAAe,EACb,KAAC,cAAc,IAAC,SAAS,EAAC,mCAAmC,GAAG,EAElE,cAAc,EACZ,8BACE,eAAM,SAAS,EAAC,iBAAiB,4BAAmB,EACpD,gBAAM,SAAS,EAAC,kDAAkD,aAChE,KAAC,cAAc,IAAC,SAAS,EAAC,mCAAmC,GAAG,wBAE3D,IACN,GAEL,IACO,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,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 { Menu } from '@neo4j-ndl/react';\nimport {\n AppearanceIcon,\n CheckCircleIconSolid,\n DatabaseSignalIcon,\n} from '@neo4j-ndl/react/icons';\nimport { TreeView } from '@neo4j-ndl/react/next';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [selected, setSelected] = useState<string | null>(null);\n\n return (\n <TreeView ariaLabel=\"Databases\" style={{ marginTop: '100px' }}>\n <TreeView.Item\n title=\"Production\"\n isSelected={selected === 'production'}\n onSelectedChange={() => setSelected('production')}\n leadingVisual={<DatabaseSignalIcon />}\n trailingContent={\n <CheckCircleIconSolid className=\"n-size-5 n-text-success-bg-status\" />\n }\n actionMenuItems={\n <>\n <Menu.Item title=\"Edit\" />\n <Menu.Item title=\"Delete\" />\n <Menu.Item title=\"Rename\" />\n </>\n }\n tooltipContent={\n <>\n <span className=\"n-font-semibold\">Production</span>\n <span className=\"n-flex n-items-center n-gap-token-4 n-mt-token-8\">\n <CheckCircleIconSolid className=\"n-size-5 n-text-success-bg-status\" />\n : Endorsed\n </span>\n </>\n }\n />\n <TreeView.Item\n title=\"Development\"\n isSelected={selected === 'development'}\n onSelectedChange={() => setSelected('development')}\n leadingVisual={<DatabaseSignalIcon />}\n trailingContent={\n <AppearanceIcon className=\"n-size-5 n-text-warning-bg-status\" />\n }\n tooltipContent={\n <>\n <span className=\"n-font-semibold\">Development</span>\n <span className=\"n-flex n-items-center n-gap-token-4 n-mt-token-8\">\n <AppearanceIcon className=\"n-size-5 n-text-warning-bg-status\" />:\n In development\n </span>\n </>\n }\n />\n </TreeView>\n );\n};\n\nexport default Component;\n"]}
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
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
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
+ import { Menu } from '@neo4j-ndl/react';
24
+ import { AppearanceIcon, CheckCircleIconSolid, DatabaseSignalIcon, } from '@neo4j-ndl/react/icons';
25
+ import { TreeView } from '@neo4j-ndl/react/next';
26
+ import { useState } from 'react';
27
+ const Component = () => {
28
+ const [selected, setSelected] = useState(null);
29
+ return (_jsxs(TreeView, { ariaLabel: "Databases", children: [_jsx(TreeView.Item, { title: "Production", isSelected: selected === 'production', onSelectedChange: () => setSelected('production'), leadingVisual: _jsx(DatabaseSignalIcon, {}), trailingContent: _jsx(CheckCircleIconSolid, { className: "n-size-5 n-text-success-bg-status" }), actionMenuItems: _jsxs(_Fragment, { children: [_jsx(Menu.Item, { title: "Edit" }), _jsx(Menu.Item, { title: "Delete" }), _jsx(Menu.Item, { title: "Rename" })] }) }), _jsx(TreeView.Item, { title: "Development", isSelected: selected === 'development', onSelectedChange: () => setSelected('development'), leadingVisual: _jsx(DatabaseSignalIcon, {}), trailingContent: _jsx(AppearanceIcon, { className: "n-size-5 n-text-warning-bg-status" }) })] }));
30
+ };
31
+ export default Component;
32
+ //# sourceMappingURL=tree-view-trailing.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-view-trailing.story.js","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/tree-view-trailing.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,IAAI,EAAE,MAAM,kBA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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 { Menu } from '@neo4j-ndl/react';\nimport {\n AppearanceIcon,\n CheckCircleIconSolid,\n DatabaseSignalIcon,\n} from '@neo4j-ndl/react/icons';\nimport { TreeView } from '@neo4j-ndl/react/next';\nimport { useState } from 'react';\n\nconst Component = () => {\n const [selected, setSelected] = useState<string | null>(null);\n\n return (\n <TreeView ariaLabel=\"Databases\">\n <TreeView.Item\n title=\"Production\"\n isSelected={selected === 'production'}\n onSelectedChange={() => setSelected('production')}\n leadingVisual={<DatabaseSignalIcon />}\n trailingContent={\n <CheckCircleIconSolid className=\"n-size-5 n-text-success-bg-status\" />\n }\n actionMenuItems={\n <>\n <Menu.Item title=\"Edit\" />\n <Menu.Item title=\"Delete\" />\n <Menu.Item title=\"Rename\" />\n </>\n }\n />\n <TreeView.Item\n title=\"Development\"\n isSelected={selected === 'development'}\n onSelectedChange={() => setSelected('development')}\n leadingVisual={<DatabaseSignalIcon />}\n trailingContent={\n <AppearanceIcon className=\"n-size-5 n-text-warning-bg-status\" />\n }\n />\n </TreeView>\n );\n};\n\nexport default Component;\n"]}
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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
+ import '@neo4j-ndl/base/lib/neo4j-ds-styles.css';
23
+ import { DocumentIconOutline, FolderIconSolid } from '@neo4j-ndl/react/icons';
24
+ import { TreeView } from '@neo4j-ndl/react/next';
25
+ import { useState } from 'react';
26
+ const Component = () => {
27
+ const [selected, setSelected] = useState(null);
28
+ return (_jsxs(TreeView, { ariaLabel: "File explorer", children: [_jsxs(TreeView.Item, { title: "Documents (expanded by default)", defaultExpanded: true, leadingVisual: _jsx(FolderIconSolid, {}), children: [_jsxs(TreeView.Item, { title: "Work", leadingVisual: _jsx(FolderIconSolid, {}), children: [_jsx(TreeView.Item, { title: "Report.pdf", isSelected: selected === 'report', onSelectedChange: () => setSelected('report'), leadingVisual: _jsx(DocumentIconOutline, {}) }), _jsx(TreeView.Item, { title: "Presentation.pptx", isSelected: selected === 'presentation', onSelectedChange: () => setSelected('presentation'), leadingVisual: _jsx(DocumentIconOutline, {}) })] }), _jsx(TreeView.Item, { title: "Resume.pdf", isSelected: selected === 'resume', onSelectedChange: () => setSelected('resume'), leadingVisual: _jsx(DocumentIconOutline, {}) })] }), _jsxs(TreeView.Item, { title: "Images (collapsed by default)", leadingVisual: _jsx(FolderIconSolid, {}), defaultExpanded: false, children: [_jsx(TreeView.Item, { title: "Photo.jpg", isSelected: selected === 'photo', onSelectedChange: () => setSelected('photo'), leadingVisual: _jsx(DocumentIconOutline, {}) }), _jsx(TreeView.Item, { title: "Screenshot.png", isSelected: selected === 'screenshot', onSelectedChange: () => setSelected('screenshot'), leadingVisual: _jsx(DocumentIconOutline, {}) })] })] }));
29
+ };
30
+ export default Component;
31
+ //# sourceMappingURL=tree-view-uncontrolled.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-view-uncontrolled.story.js","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/tree-view-uncontrolled.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,yCAAyC,CAAC;AAEjD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IAE9D,OAAO,CACL,MAAC,QAAQ,IAAC,SAAS,EAAC,eAAe,aACjC,MAAC,QAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,iCAAiC,EACvC,eAAe,EAAE,IAAI,EACrB,aAAa,EAAE,KAAC,eAAe,KAAG,aAElC,MAAC,QAAQ,CAAC,IAAI,IAAC,KAAK,EAAC,MAAM,EAAC,aAAa,EAAE,KAAC,eAAe,KAAG,aAC5D,KAAC,QAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,YAAY,EAClB,UAAU,EAAE,QAAQ,KAAK,QAAQ,EACjC,gBAAgB,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,EAC7C,aAAa,EAAE,KAAC,mBAAmB,KAAG,GACtC,EACF,KAAC,QAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,mBAAmB,EACzB,UAAU,EAAE,QAAQ,KAAK,cAAc,EACvC,gBAAgB,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,cAAc,CAAC,EACnD,aAAa,EAAE,KAAC,mBAAmB,KAAG,GACtC,IACY,EAChB,KAAC,QAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,YAAY,EAClB,UAAU,EAAE,QAAQ,KAAK,QAAQ,EACjC,gBAAgB,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,EAC7C,aAAa,EAAE,KAAC,mBAAmB,KAAG,GACtC,IACY,EAChB,MAAC,QAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,+BAA+B,EACrC,aAAa,EAAE,KAAC,eAAe,KAAG,EAClC,eAAe,EAAE,KAAK,aAEtB,KAAC,QAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,WAAW,EACjB,UAAU,EAAE,QAAQ,KAAK,OAAO,EAChC,gBAAgB,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,EAC5C,aAAa,EAAE,KAAC,mBAAmB,KAAG,GACtC,EACF,KAAC,QAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,gBAAgB,EACtB,UAAU,EAAE,QAAQ,KAAK,YAAY,EACrC,gBAAgB,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,YAAY,CAAC,EACjD,aAAa,EAAE,KAAC,mBAAmB,KAAG,GACtC,IACY,IACP,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,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\nconst Component = () => {\n const [selected, setSelected] = useState<string | null>(null);\n\n return (\n <TreeView ariaLabel=\"File explorer\">\n <TreeView.Item\n title=\"Documents (expanded by default)\"\n defaultExpanded={true}\n leadingVisual={<FolderIconSolid />}\n >\n <TreeView.Item title=\"Work\" leadingVisual={<FolderIconSolid />}>\n <TreeView.Item\n title=\"Report.pdf\"\n isSelected={selected === 'report'}\n onSelectedChange={() => setSelected('report')}\n leadingVisual={<DocumentIconOutline />}\n />\n <TreeView.Item\n title=\"Presentation.pptx\"\n isSelected={selected === 'presentation'}\n onSelectedChange={() => setSelected('presentation')}\n leadingVisual={<DocumentIconOutline />}\n />\n </TreeView.Item>\n <TreeView.Item\n title=\"Resume.pdf\"\n isSelected={selected === 'resume'}\n onSelectedChange={() => setSelected('resume')}\n leadingVisual={<DocumentIconOutline />}\n />\n </TreeView.Item>\n <TreeView.Item\n title=\"Images (collapsed by default)\"\n leadingVisual={<FolderIconSolid />}\n defaultExpanded={false}\n >\n <TreeView.Item\n title=\"Photo.jpg\"\n isSelected={selected === 'photo'}\n onSelectedChange={() => setSelected('photo')}\n leadingVisual={<DocumentIconOutline />}\n />\n <TreeView.Item\n title=\"Screenshot.png\"\n isSelected={selected === 'screenshot'}\n onSelectedChange={() => setSelected('screenshot')}\n leadingVisual={<DocumentIconOutline />}\n />\n </TreeView.Item>\n </TreeView>\n );\n};\n\nexport default Component;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DataGrid.d.ts","sourceRoot":"","sources":["../../../src/data-grid/DataGrid.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,KAAK,IAAI,YAAY,EAC3B,MAAM,uBAAuB,CAAC;AAU/B,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CA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