@neo4j-ndl/react 4.12.5 → 4.13.1

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 (91) hide show
  1. package/lib/cjs/icons/generated/custom/AddNode.js +1 -0
  2. package/lib/cjs/icons/generated/custom/AddNode.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/icons/generated/custom/AddNode.js +1 -0
  32. package/lib/esm/icons/generated/custom/AddNode.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/icons/generated/custom/AddNode.d.ts +1 -0
  62. package/lib/types/icons/generated/custom/AddNode.d.ts.map +1 -1
  63. package/lib/types/icons/generated/custom/Appearance.d.ts +29 -0
  64. package/lib/types/icons/generated/custom/Appearance.d.ts.map +1 -0
  65. package/lib/types/icons/generated/custom/index.d.ts +1 -0
  66. package/lib/types/icons/generated/custom/index.d.ts.map +1 -1
  67. package/lib/types/next/index.d.ts +1 -0
  68. package/lib/types/next/index.d.ts.map +1 -1
  69. package/lib/types/next/tree-view/TreeView.d.ts +79 -0
  70. package/lib/types/next/tree-view/TreeView.d.ts.map +1 -0
  71. package/lib/types/next/tree-view/index.d.ts +22 -0
  72. package/lib/types/next/tree-view/index.d.ts.map +1 -0
  73. package/lib/types/next/tree-view/stories/index.d.ts +37 -0
  74. package/lib/types/next/tree-view/stories/index.d.ts.map +1 -0
  75. package/lib/types/next/tree-view/stories/tree-view-actions.story.d.ts +24 -0
  76. package/lib/types/next/tree-view/stories/tree-view-actions.story.d.ts.map +1 -0
  77. package/lib/types/next/tree-view/stories/tree-view-lazy.story.d.ts +24 -0
  78. package/lib/types/next/tree-view/stories/tree-view-lazy.story.d.ts.map +1 -0
  79. package/lib/types/next/tree-view/stories/tree-view-multi.story.d.ts +24 -0
  80. package/lib/types/next/tree-view/stories/tree-view-multi.story.d.ts.map +1 -0
  81. package/lib/types/next/tree-view/stories/tree-view-non-selectable-folders.story.d.ts +24 -0
  82. package/lib/types/next/tree-view/stories/tree-view-non-selectable-folders.story.d.ts.map +1 -0
  83. package/lib/types/next/tree-view/stories/tree-view-single.story.d.ts +24 -0
  84. package/lib/types/next/tree-view/stories/tree-view-single.story.d.ts.map +1 -0
  85. package/lib/types/next/tree-view/stories/tree-view-tooltip.story.d.ts +24 -0
  86. package/lib/types/next/tree-view/stories/tree-view-tooltip.story.d.ts.map +1 -0
  87. package/lib/types/next/tree-view/stories/tree-view-trailing.story.d.ts +24 -0
  88. package/lib/types/next/tree-view/stories/tree-view-trailing.story.d.ts.map +1 -0
  89. package/lib/types/next/tree-view/stories/tree-view-uncontrolled.story.d.ts +24 -0
  90. package/lib/types/next/tree-view/stories/tree-view-uncontrolled.story.d.ts.map +1 -0
  91. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;;;;AAEH,+DAAwE;AAA/D,4IAAA,OAAO,OAAuB;AACvC,iEAAyE;AAAhE,6IAAA,OAAO,OAAuB;AACvC,mGAAmG;AAA1F,uKAAA,OAAO,OAAgC;AAChD,mEAA2E;AAAlE,+IAAA,OAAO,OAAwB;AACxC,qEAA2E;AAAlE,+IAAA,OAAO,OAAuB;AACvC,+EAA0F;AAAjF,8JAAA,OAAO,OAAiC;AACjD,uEAAoF;AAA3E,wJAAA,OAAO,OAA+B;AAC/C,qEAA2E;AAAlE,+IAAA,OAAO,OAAuB;AAEvC,gFAA4E;AAC5E,gGAAkE;AAClE,0FAAmE;AACnE,4FAAoE;AACpE,8HAA8F;AAC9F,8FAAsE;AACtE,gGAAkE;AAClE,kGAA2E;AAC3E,0GAAqF;AAExE,QAAA,kBAAkB,GAAG,IAAA,0CAAmB,EAAC,qCAAqB,CAAC,CAAC;AAChE,QAAA,sBAAsB,GAAG,IAAA,0CAAmB,EACvD,kCAAyB,CAC1B,CAAC;AACW,QAAA,sBAAsB,GAAG,IAAA,0CAAmB,EACvD,mCAAyB,CAC1B,CAAC;AACW,QAAA,+BAA+B,GAAG,IAAA,0CAAmB,EAChE,oDAAkC,CACnC,CAAC;AACW,QAAA,uBAAuB,GAAG,IAAA,0CAAmB,EACxD,oCAA0B,CAC3B,CAAC;AACW,QAAA,0BAA0B,GAAG,IAAA,0CAAmB,EAC3D,sCAA6B,CAC9B,CAAC;AACW,QAAA,kBAAkB,GAAG,IAAA,0CAAmB,EAAC,qCAAqB,CAAC,CAAC;AAChE,QAAA,gCAAgC,GAAG,IAAA,0CAAmB,EACjE,0CAAmC,CACpC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nexport { default as TreeViewLazyLoading } from './tree-view-lazy.story';\nexport { default as TreeViewMultiSelect } from './tree-view-multi.story';\nexport { default as TreeViewNonSelectableFolders } from './tree-view-non-selectable-folders.story';\nexport { default as TreeViewSingleSelect } from './tree-view-single.story';\nexport { default as TreeViewWithActions } from './tree-view-actions.story';\nexport { default as TreeViewUncontrolledExpansion } from './tree-view-uncontrolled.story';\nexport { default as TreeViewWithTrailingContent } from './tree-view-trailing.story';\nexport { default as TreeViewWithTooltip } from './tree-view-tooltip.story';\n\nimport { removeLicenseHeader } from '../../../_common/export-stories-utils';\nimport TreeViewActionsSrcRaw from './tree-view-actions.story?raw';\nimport TreeViewLazyLoadingSrcRaw from './tree-view-lazy.story?raw';\nimport TreeViewMultiSelectSrcRaw from './tree-view-multi.story?raw';\nimport TreeViewNonSelectableFoldersSrcRaw from './tree-view-non-selectable-folders.story?raw';\nimport TreeViewSingleSelectSrcRaw from './tree-view-single.story?raw';\nimport TreeViewTooltipSrcRaw from './tree-view-tooltip.story?raw';\nimport TreeViewTrailingContentSrcRaw from './tree-view-trailing.story?raw';\nimport TreeViewUncontrolledExpansionSrcRaw from './tree-view-uncontrolled.story?raw';\n\nexport const TreeViewActionsSrc = removeLicenseHeader(TreeViewActionsSrcRaw);\nexport const TreeViewLazyLoadingSrc = removeLicenseHeader(\n TreeViewLazyLoadingSrcRaw,\n);\nexport const TreeViewMultiSelectSrc = removeLicenseHeader(\n TreeViewMultiSelectSrcRaw,\n);\nexport const TreeViewNonSelectableFoldersSrc = removeLicenseHeader(\n TreeViewNonSelectableFoldersSrcRaw,\n);\nexport const TreeViewSingleSelectSrc = removeLicenseHeader(\n TreeViewSingleSelectSrcRaw,\n);\nexport const TreeViewTrailingContentSrc = removeLicenseHeader(\n TreeViewTrailingContentSrcRaw,\n);\nexport const TreeViewTooltipSrc = removeLicenseHeader(TreeViewTooltipSrcRaw);\nexport const TreeViewUncontrolledExpansionSrc = removeLicenseHeader(\n TreeViewUncontrolledExpansionSrcRaw,\n);\n"]}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ /**
5
+ *
6
+ * Copyright (c) "Neo4j"
7
+ * Neo4j Sweden AB [http://neo4j.com]
8
+ *
9
+ * This file is part of Neo4j.
10
+ *
11
+ * Neo4j is free software: you can redistribute it and/or modify
12
+ * it under the terms of the GNU General Public License as published by
13
+ * the Free Software Foundation, either version 3 of the License, or
14
+ * (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ */
24
+ require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
25
+ const react_1 = require("@neo4j-ndl/react");
26
+ const icons_1 = require("@neo4j-ndl/react/icons");
27
+ const next_1 = require("@neo4j-ndl/react/next");
28
+ const react_2 = require("react");
29
+ const Component = () => {
30
+ const [expanded, setExpanded] = (0, react_2.useState)({});
31
+ const [selected, setSelected] = (0, react_2.useState)(null);
32
+ const toggle = (key) => setExpanded((prev) => (Object.assign(Object.assign({}, prev), { [key]: !prev[key] })));
33
+ return ((0, jsx_runtime_1.jsxs)(next_1.TreeView, { ariaLabel: "Project files", children: [(0, jsx_runtime_1.jsxs)(next_1.TreeView.Item, { title: "src", hasChildren: true, isExpanded: expanded['src'], onExpandedChange: () => toggle('src'), isSelected: selected === 'src', onSelectedChange: () => setSelected('src'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), actionMenuItems: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "New File", onClick: () => alert('New file in src') }), (0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Rename", onClick: () => alert('Rename src') }), (0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Delete", onClick: () => alert('Delete src') })] }), children: [(0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "index.ts", isSelected: selected === 'index', onSelectedChange: () => setSelected('index'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}), actionMenuItems: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Open", onClick: () => alert('Open index.ts') }), (0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Rename", onClick: () => alert('Rename index.ts') }), (0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Delete", onClick: () => alert('Delete index.ts') })] }) }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "utils.ts", isSelected: selected === 'utils', onSelectedChange: () => setSelected('utils'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}), actionMenuItems: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Open", onClick: () => alert('Open utils.ts') }), (0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Rename", onClick: () => alert('Rename utils.ts') }), (0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Delete", onClick: () => alert('Delete utils.ts') })] }) })] }), (0, jsx_runtime_1.jsxs)(next_1.TreeView.Item, { title: "tests", hasChildren: true, isExpanded: expanded['tests'], onExpandedChange: () => toggle('tests'), isSelected: selected === 'tests', onSelectedChange: () => setSelected('tests'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), actionMenuItems: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Run Tests", onClick: () => alert('Run all tests') }), (0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "New Test", onClick: () => alert('New test in tests') }), (0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Delete", onClick: () => alert('Delete tests') })] }), children: [(0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "index.test.ts", isSelected: selected === 'index-test', onSelectedChange: () => setSelected('index-test'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}), actionMenuItems: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Run", onClick: () => alert('Run index.test.ts') }), (0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Rename", onClick: () => alert('Rename index.test.ts') }), (0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Delete", onClick: () => alert('Delete index.test.ts') })] }) }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "utils.test.ts", isSelected: selected === 'utils-test', onSelectedChange: () => setSelected('utils-test'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}), actionMenuItems: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Run", onClick: () => alert('Run utils.test.ts') }), (0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Rename", onClick: () => alert('Rename utils.test.ts') }), (0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Delete", onClick: () => alert('Delete utils.test.ts') })] }) })] }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "README.md", isSelected: selected === 'readme', onSelectedChange: () => setSelected('readme'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}), actionMenuItems: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Open", onClick: () => alert('Open README.md') }), (0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Rename", onClick: () => alert('Rename README.md') }), (0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Delete", onClick: () => alert('Delete README.md') })] }) })] }));
34
+ };
35
+ exports.default = Component;
36
+ //# 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,mDAAiD;AAEjD,4CAAwC;AACxC,kDAA8E;AAC9E,gDAAiD;AACjD,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAA0B,EAAE,CAAC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uBAAC,2BAAmB,KAAG,EACtC,eAAe,EACb,6DACE,uBAAC,YAAI,CAAC,IAAI,IACR,KAAK,EAAC,KAAK,EACX,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,mBAAmB,CAAC,GACzC,EACF,uBAAC,YAAI,CAAC,IAAI,IACR,KAAK,EAAC,QAAQ,EACd,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,sBAAsB,CAAC,GAC5C,EACF,uBAAC,YAAI,CAAC,IAAI,IACR,KAAK,EAAC,QAAQ,EACd,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,sBAAsB,CAAC,GAC5C,IACD,GAEL,IACY,EAChB,uBAAC,eAAQ,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,uBAAC,2BAAmB,KAAG,EACtC,eAAe,EACb,6DACE,uBAAC,YAAI,CAAC,IAAI,IAAC,KAAK,EAAC,MAAM,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAAI,EAClE,uBAAC,YAAI,CAAC,IAAI,IACR,KAAK,EAAC,QAAQ,EACd,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,kBAAkB,CAAC,GACxC,EACF,uBAAC,YAAI,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,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { 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,149 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ /**
5
+ *
6
+ * Copyright (c) "Neo4j"
7
+ * Neo4j Sweden AB [http://neo4j.com]
8
+ *
9
+ * This file is part of Neo4j.
10
+ *
11
+ * Neo4j is free software: you can redistribute it and/or modify
12
+ * it under the terms of the GNU General Public License as published by
13
+ * the Free Software Foundation, either version 3 of the License, or
14
+ * (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ */
24
+ require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
25
+ const icons_1 = require("@neo4j-ndl/react/icons");
26
+ const next_1 = require("@neo4j-ndl/react/next");
27
+ const react_1 = require("react");
28
+ const TREE_DATA = [
29
+ {
30
+ children: [
31
+ {
32
+ children: [
33
+ { id: 'app-tsx', label: 'App.tsx' },
34
+ { id: 'index-tsx', label: 'index.tsx' },
35
+ { id: 'styles-css', label: 'styles.css' },
36
+ ],
37
+ id: 'frontend',
38
+ label: 'Frontend',
39
+ },
40
+ {
41
+ children: [
42
+ { id: 'server-ts', label: 'server.ts' },
43
+ { id: 'routes-ts', label: 'routes.ts' },
44
+ ],
45
+ id: 'backend',
46
+ label: 'Backend',
47
+ },
48
+ { id: 'readme-md', label: 'README.md' },
49
+ ],
50
+ id: 'projects',
51
+ label: 'Projects',
52
+ },
53
+ {
54
+ children: [
55
+ {
56
+ children: [
57
+ { id: 'beach-jpg', label: 'beach.jpg' },
58
+ { id: 'sunset-jpg', label: 'sunset.jpg' },
59
+ ],
60
+ id: 'vacation',
61
+ label: 'Vacation',
62
+ },
63
+ { id: 'profile-png', label: 'profile.png' },
64
+ ],
65
+ id: 'photos',
66
+ label: 'Photos',
67
+ },
68
+ {
69
+ children: [
70
+ { id: 'resume-pdf', label: 'resume.pdf' },
71
+ { id: 'cover-letter-pdf', label: 'cover-letter.pdf' },
72
+ { id: 'notes-txt', label: 'notes.txt' },
73
+ ],
74
+ id: 'documents',
75
+ label: 'Documents',
76
+ },
77
+ {
78
+ children: [
79
+ {
80
+ children: [
81
+ { id: 'chill-m3u', label: 'chill.m3u' },
82
+ { id: 'workout-m3u', label: 'workout.m3u' },
83
+ ],
84
+ id: 'playlists',
85
+ label: 'Playlists',
86
+ },
87
+ { id: 'favorites-m3u', label: 'favorites.m3u' },
88
+ ],
89
+ id: 'music',
90
+ label: 'Music',
91
+ },
92
+ { id: 'todo-txt', label: 'TODO.txt' },
93
+ ];
94
+ const LOAD_DELAY_MS = 600;
95
+ function iconForNode(node) {
96
+ if (node.children) {
97
+ return (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {});
98
+ }
99
+ if (/\.(jpg|jpeg|png|gif|svg)$/i.test(node.label)) {
100
+ return (0, jsx_runtime_1.jsx)(icons_1.PhotoIconOutline, {});
101
+ }
102
+ return (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {});
103
+ }
104
+ const INITIAL_NODE_STATE = {
105
+ hasLoaded: false,
106
+ isExpanded: false,
107
+ isLoading: false,
108
+ };
109
+ function useTreeState() {
110
+ const [nodeStates, setNodeStates] = (0, react_1.useState)({});
111
+ const [selectedId, setSelectedId] = (0, react_1.useState)(null);
112
+ const timers = (0, react_1.useRef)({});
113
+ const getNodeState = (0, react_1.useCallback)((id) => { var _a; return (_a = nodeStates[id]) !== null && _a !== void 0 ? _a : INITIAL_NODE_STATE; }, [nodeStates]);
114
+ const handleExpand = (0, react_1.useCallback)((id, expanded) => {
115
+ setNodeStates((prev) => {
116
+ var _a;
117
+ const current = (_a = prev[id]) !== null && _a !== void 0 ? _a : INITIAL_NODE_STATE;
118
+ if (expanded && !current.hasLoaded) {
119
+ if (timers.current[id]) {
120
+ clearTimeout(timers.current[id]);
121
+ }
122
+ timers.current[id] = setTimeout(() => {
123
+ setNodeStates((p) => (Object.assign(Object.assign({}, p), { [id]: { hasLoaded: true, isExpanded: true, isLoading: false } })));
124
+ delete timers.current[id];
125
+ }, LOAD_DELAY_MS);
126
+ return Object.assign(Object.assign({}, prev), { [id]: { hasLoaded: false, isExpanded: true, isLoading: true } });
127
+ }
128
+ return Object.assign(Object.assign({}, prev), { [id]: Object.assign(Object.assign({}, current), { isExpanded: expanded }) });
129
+ });
130
+ }, []);
131
+ const handleSelect = (0, react_1.useCallback)((id) => setSelectedId((prev) => (prev === id ? null : id)), []);
132
+ return { getNodeState, handleExpand, handleSelect, selectedId };
133
+ }
134
+ function renderNode(node, ctx) {
135
+ const hasChildren = node.children !== undefined &&
136
+ node.children !== null &&
137
+ node.children.length > 0;
138
+ const state = ctx.getNodeState(node.id);
139
+ return ((0, jsx_runtime_1.jsxs)(next_1.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 && ((0, jsx_runtime_1.jsx)(next_1.TreeView.SkeletonItem, { rows: 2 })), hasChildren &&
140
+ state.hasLoaded &&
141
+ node.children.map((child) => renderNode(child, ctx))] }, node.id));
142
+ }
143
+ const Component = () => {
144
+ const { getNodeState, selectedId, handleExpand, handleSelect } = useTreeState();
145
+ const ctx = (0, react_1.useMemo)(() => ({ getNodeState, handleExpand, handleSelect, selectedId }), [getNodeState, selectedId, handleExpand, handleSelect]);
146
+ return ((0, jsx_runtime_1.jsx)(next_1.TreeView, { ariaLabel: "Lazy-loaded file explorer", children: TREE_DATA.map((node) => renderNode(node, ctx)) }));
147
+ };
148
+ exports.default = Component;
149
+ //# 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,mDAAiD;AAEjD,kDAIgC;AAChC,gDAAiD;AACjD,iCAA+D;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;iBAC1C;gB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tC,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,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,uBAAC,eAAQ,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,IAAA,eAAO,EACjB,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,uBAAC,eAAQ,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,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport {\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,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ /**
5
+ *
6
+ * Copyright (c) "Neo4j"
7
+ * Neo4j Sweden AB [http://neo4j.com]
8
+ *
9
+ * This file is part of Neo4j.
10
+ *
11
+ * Neo4j is free software: you can redistribute it and/or modify
12
+ * it under the terms of the GNU General Public License as published by
13
+ * the Free Software Foundation, either version 3 of the License, or
14
+ * (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ */
24
+ require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
25
+ const icons_1 = require("@neo4j-ndl/react/icons");
26
+ const next_1 = require("@neo4j-ndl/react/next");
27
+ const react_1 = require("react");
28
+ const WORK_CHILDREN = ['report', 'presentation'];
29
+ const DOC_CHILDREN = ['work', 'resume'];
30
+ const IMAGE_CHILDREN = ['photo', 'screenshot'];
31
+ const DISABLED_KEYS = new Set(['presentation']);
32
+ function getParentChecked(checked, childKeys) {
33
+ const enabledKeys = childKeys.filter((k) => !DISABLED_KEYS.has(k));
34
+ if (enabledKeys.length === 0) {
35
+ return { isChecked: false, isIndeterminate: false };
36
+ }
37
+ const checkedCount = enabledKeys.filter((k) => checked[k]).length;
38
+ if (checkedCount === 0) {
39
+ return { isChecked: false, isIndeterminate: false };
40
+ }
41
+ if (checkedCount === enabledKeys.length) {
42
+ return { isChecked: true, isIndeterminate: false };
43
+ }
44
+ return { isChecked: false, isIndeterminate: true };
45
+ }
46
+ const Component = () => {
47
+ const [expanded, setExpanded] = (0, react_1.useState)({});
48
+ const [checked, setChecked] = (0, react_1.useState)({});
49
+ const toggle = (key) => setExpanded((prev) => (Object.assign(Object.assign({}, prev), { [key]: !prev[key] })));
50
+ const toggleCheck = (0, react_1.useCallback)((key) => {
51
+ setChecked((prev) => (Object.assign(Object.assign({}, prev), { [key]: !prev[key] })));
52
+ }, []);
53
+ const toggleParent = (0, react_1.useCallback)((childKeys) => {
54
+ const enabledKeys = childKeys.filter((k) => !DISABLED_KEYS.has(k));
55
+ const isAllChecked = enabledKeys.every((k) => checked[k]);
56
+ setChecked((prev) => {
57
+ const next = Object.assign({}, prev);
58
+ for (const k of enabledKeys) {
59
+ next[k] = !isAllChecked;
60
+ }
61
+ return next;
62
+ });
63
+ }, [checked]);
64
+ const docState = getParentChecked(checked, [
65
+ ...DOC_CHILDREN,
66
+ ...WORK_CHILDREN,
67
+ ]);
68
+ const workState = getParentChecked(checked, WORK_CHILDREN);
69
+ const imageState = getParentChecked(checked, IMAGE_CHILDREN);
70
+ return ((0, jsx_runtime_1.jsxs)(next_1.TreeView, { ariaLabel: "File explorer", selectionMode: "multiple", children: [(0, jsx_runtime_1.jsxs)(next_1.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: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), children: [(0, jsx_runtime_1.jsxs)(next_1.TreeView.Item, { title: "Work", hasChildren: true, isExpanded: expanded['work'], onExpandedChange: () => toggle('work'), isSelected: workState.isChecked, isIndeterminate: workState.isIndeterminate, onSelectedChange: () => toggleParent(WORK_CHILDREN), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), children: [(0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Report.pdf", isSelected: !!checked['report'], onSelectedChange: () => toggleCheck('report'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Presentation.pptx", isDisabled: true, onSelectedChange: () => null, leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) })] }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Resume.pdf", isSelected: !!checked['resume'], onSelectedChange: () => toggleCheck('resume'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) })] }), (0, jsx_runtime_1.jsxs)(next_1.TreeView.Item, { title: "Images", hasChildren: true, isExpanded: expanded['images'], onExpandedChange: () => toggle('images'), isSelected: imageState.isChecked, isIndeterminate: imageState.isIndeterminate, onSelectedChange: () => toggleParent(IMAGE_CHILDREN), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), children: [(0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Photo.jpg", isSelected: !!checked['photo'], onSelectedChange: () => toggleCheck('photo'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.PhotoIconOutline, {}) }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Screenshot.png", isSelected: !!checked['screenshot'], onSelectedChange: () => toggleCheck('screenshot'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.PhotoIconOutline, {}) })] })] }));
71
+ };
72
+ exports.default = Component;
73
+ //# 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,mDAAiD;AAEjD,kDAIgC;AAChC,gDAAiD;AACjD,iCAA8C;AAI9C,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,cAAc,CAAU,CAAC;AAC1D,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAU,CAAC;AACjD,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,YAAY,CAAU,CAAC;AACxD,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC;AAEhD,SAAS,gBAAgB,CACvB,OAAqB,EACrB,SAA4B;IAE5B,MAAM,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACnE,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC;IACtD,CAAC;IACD,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAClE,IAAI,YAAY,KAAK,CAAC,EAAE,CAAC;QAC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,CAAC,EAC9B,gBAAgB,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,EAC5C,aAAa,EAAE,uBAAC,wBAAgB,KAAG,GACnC,EACF,uBAAC,eAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,gBAAgB,EACtB,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,EACnC,gBAAgB,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,YAAY,CAAC,EACjD,aAAa,EAAE,uBAAC,wBAAgB,KAAG,GACnC,IACY,IACP,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport {\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,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ /**
5
+ *
6
+ * Copyright (c) "Neo4j"
7
+ * Neo4j Sweden AB [http://neo4j.com]
8
+ *
9
+ * This file is part of Neo4j.
10
+ *
11
+ * Neo4j is free software: you can redistribute it and/or modify
12
+ * it under the terms of the GNU General Public License as published by
13
+ * the Free Software Foundation, either version 3 of the License, or
14
+ * (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ */
24
+ require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
25
+ const icons_1 = require("@neo4j-ndl/react/icons");
26
+ const next_1 = require("@neo4j-ndl/react/next");
27
+ const react_1 = require("react");
28
+ const Component = () => {
29
+ const [expanded, setExpanded] = (0, react_1.useState)({});
30
+ const [selected, setSelected] = (0, react_1.useState)(null);
31
+ const toggle = (key) => setExpanded((prev) => (Object.assign(Object.assign({}, prev), { [key]: !prev[key] })));
32
+ return ((0, jsx_runtime_1.jsxs)(next_1.TreeView, { ariaLabel: "File explorer", children: [(0, jsx_runtime_1.jsxs)(next_1.TreeView.Item, { title: "Documents", hasChildren: true, isExpanded: expanded['documents'], onExpandedChange: () => toggle('documents'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), children: [(0, jsx_runtime_1.jsxs)(next_1.TreeView.Item, { title: "Work", hasChildren: true, isExpanded: expanded['work'], onExpandedChange: () => toggle('work'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), children: [(0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Report.pdf", isSelected: selected === 'report', onSelectedChange: () => setSelected('report'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Presentation.pptx", isSelected: selected === 'presentation', onSelectedChange: () => setSelected('presentation'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) })] }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Resume.pdf", isSelected: selected === 'resume', onSelectedChange: () => setSelected('resume'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) })] }), (0, jsx_runtime_1.jsxs)(next_1.TreeView.Item, { title: "Images", hasChildren: true, isExpanded: expanded['images'], onExpandedChange: () => toggle('images'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), children: [(0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Photo.jpg", isSelected: selected === 'photo', onSelectedChange: () => setSelected('photo'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Screenshot.png", isSelected: selected === 'screenshot', onSelectedChange: () => setSelected('screenshot'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) })] })] }));
33
+ };
34
+ exports.default = Component;
35
+ //# 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,mDAAiD;AAEjD,kDAA8E;AAC9E,gDAAiD;AACjD,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAA0B,EAAE,CAAC,CAAC;IACtE,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAgB,IAAI,CAAC,CAAC;IAE9D,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,EAAE,CAC7B,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,iCAAM,IAAI,KAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAG,CAAC,CAAC;IAE1D,OAAO,CACL,wBAAC,eAAQ,IAAC,SAAS,EAAC,eAAe,aACjC,wBAAC,eAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,WAAW,EACjB,WAAW,QACX,UAAU,EAAE,QAAQ,CAAC,WAAW,CAAC,EACjC,gBAAgB,EAAE,GAAG,EAA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,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,EAC5C,aAAa,EAAE,uBAAC,2BAAmB,KAAG,GACtC,EACF,uBAAC,eAAQ,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,uBAAC,2BAAmB,KAAG,GACtC,IACY,IACP,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { DocumentIconOutline, FolderIconSolid } from '@neo4j-ndl/react/icons';\nimport { TreeView } from '@neo4j-ndl/react/next';\nimport { useState } from 'react';\n\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,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ /**
5
+ *
6
+ * Copyright (c) "Neo4j"
7
+ * Neo4j Sweden AB [http://neo4j.com]
8
+ *
9
+ * This file is part of Neo4j.
10
+ *
11
+ * Neo4j is free software: you can redistribute it and/or modify
12
+ * it under the terms of the GNU General Public License as published by
13
+ * the Free Software Foundation, either version 3 of the License, or
14
+ * (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ */
24
+ require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
25
+ const icons_1 = require("@neo4j-ndl/react/icons");
26
+ const next_1 = require("@neo4j-ndl/react/next");
27
+ const react_1 = require("react");
28
+ const Component = () => {
29
+ const [expanded, setExpanded] = (0, react_1.useState)({});
30
+ const [selected, setSelected] = (0, react_1.useState)(null);
31
+ const toggle = (key) => setExpanded((prev) => (Object.assign(Object.assign({}, prev), { [key]: !prev[key] })));
32
+ return ((0, jsx_runtime_1.jsxs)(next_1.TreeView, { ariaLabel: "File explorer", children: [(0, jsx_runtime_1.jsxs)(next_1.TreeView.Item, { title: "Documents", hasChildren: true, isExpanded: expanded['documents'], onExpandedChange: () => toggle('documents'), isSelected: selected === 'documents', onSelectedChange: () => setSelected('documents'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), children: [(0, jsx_runtime_1.jsxs)(next_1.TreeView.Item, { title: "Work", hasChildren: true, isExpanded: expanded['work'], onExpandedChange: () => toggle('work'), isSelected: selected === 'work', onSelectedChange: () => setSelected('work'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), children: [(0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Report.pdf", isSelected: selected === 'report', onSelectedChange: () => setSelected('report'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Presentation.pptx", isDisabled: true, isSelected: selected === 'presentation', onSelectedChange: () => setSelected('presentation'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) })] }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Resume.pdf", isSelected: selected === 'resume', onSelectedChange: () => setSelected('resume'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) })] }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Images (disabled)", hasChildren: true, isExpanded: expanded['images'], onExpandedChange: () => toggle('images'), isSelected: selected === 'images', onSelectedChange: () => setSelected('images'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), isDisabled: true }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "README.md", isSelected: selected === 'readme', onSelectedChange: () => setSelected('readme'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) })] }));
33
+ };
34
+ exports.default = Component;
35
+ //# 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,mDAAiD;AAEjD,kDAA8E;AAC9E,gDAAiD;AACjD,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAA0B,EAAE,CAAC,CAAC;IACtE,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAgB,IAAI,CAAC,CAAC;IAE9D,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,EAAE,CAC7B,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,iCAAM,IAAI,KAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAG,CAAC,CAAC;IAE1D,OAAO,CACL,wBAAC,eAAQ,IAAC,SAAS,EAAC,eAAe,aACjC,wBAAC,eAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,WAAW,EACjB,WAAW,QACX,UAAU,EAAE,QAAQ,CAAC,WAAW,CAAC,EACjC,gBAAgB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,EAC3C,UAAU,EAAE,QAAQ,KAAK,WAAW,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ACxC,UAAU,EAAE,QAAQ,KAAK,QAAQ,EACjC,gBAAgB,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,EAC7C,aAAa,EAAE,uBAAC,uBAAe,KAAG,EAClC,UAAU,SACV,EACF,uBAAC,eAAQ,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,uBAAC,2BAAmB,KAAG,GACtC,IACO,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { DocumentIconOutline, FolderIconSolid } from '@neo4j-ndl/react/icons';\nimport { TreeView } from '@neo4j-ndl/react/next';\nimport { useState } from 'react';\n\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,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ /**
5
+ *
6
+ * Copyright (c) "Neo4j"
7
+ * Neo4j Sweden AB [http://neo4j.com]
8
+ *
9
+ * This file is part of Neo4j.
10
+ *
11
+ * Neo4j is free software: you can redistribute it and/or modify
12
+ * it under the terms of the GNU General Public License as published by
13
+ * the Free Software Foundation, either version 3 of the License, or
14
+ * (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ */
24
+ require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
25
+ const react_1 = require("@neo4j-ndl/react");
26
+ const icons_1 = require("@neo4j-ndl/react/icons");
27
+ const next_1 = require("@neo4j-ndl/react/next");
28
+ const react_2 = require("react");
29
+ const Component = () => {
30
+ const [selected, setSelected] = (0, react_2.useState)(null);
31
+ return ((0, jsx_runtime_1.jsxs)(next_1.TreeView, { ariaLabel: "Databases", style: { marginTop: '100px' }, children: [(0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Production", isSelected: selected === 'production', onSelectedChange: () => setSelected('production'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DatabaseSignalIcon, {}), trailingContent: (0, jsx_runtime_1.jsx)(icons_1.CheckCircleIconSolid, { className: "n-size-5 n-text-success-bg-status" }), actionMenuItems: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Edit" }), (0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Delete" }), (0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Rename" })] }), tooltipContent: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "n-font-semibold", children: "Production" }), (0, jsx_runtime_1.jsxs)("span", { className: "n-flex n-items-center n-gap-token-4 n-mt-token-8", children: [(0, jsx_runtime_1.jsx)(icons_1.CheckCircleIconSolid, { className: "n-size-5 n-text-success-bg-status" }), ": Endorsed"] })] }) }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Development", isSelected: selected === 'development', onSelectedChange: () => setSelected('development'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DatabaseSignalIcon, {}), trailingContent: (0, jsx_runtime_1.jsx)(icons_1.AppearanceIcon, { className: "n-size-5 n-text-warning-bg-status" }), tooltipContent: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "n-font-semibold", children: "Development" }), (0, jsx_runtime_1.jsxs)("span", { className: "n-flex n-items-center n-gap-token-4 n-mt-token-8", children: [(0, jsx_runtime_1.jsx)(icons_1.AppearanceIcon, { className: "n-size-5 n-text-warning-bg-status" }), ": In development"] })] }) })] }));
32
+ };
33
+ exports.default = Component;
34
+ //# 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,mDAAiD;AAEjD,4CAAwC;AACxC,kDAIgC;AAChC,gDAAiD;AACjD,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAgB,IAAI,CAAC,CAAC;IAE9D,OAAO,CACL,wBAAC,eAAQ,IAAC,SAAS,EAAC,WAAW,EAAC,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,aAC3D,uBAAC,eAAQ,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,uBAAC,0BAAkB,KAAG,EACrC,eAAe,EACb,uBAAC,4BAAoB,IAAC,SAAS,EAAC,mCAAmC,GAAG,EAExE,eAAe,EACb,6DACE,uBAAC,YAAI,CAAC,IAAI,IAAC,KAAK,EAAC,MAAM,GAAG,EAC1B,uBAAC,YAAI,CAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,GAAG,EAC5B,uBAAC,YAAI,CAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,GAAG,IAC3B,EAEL,cAAc,EACZ,6DACE,iCAAM,SAAS,EAAC,iBAAiB,2BAAkB,EACnD,kCAAM,SAAS,EAAC,kDAAkD,aAChE,uBAAC,4BAAoB,IAAC,SAAS,EAAC,mCAAmC,GAAG,kBAEjE,IACN,GAEL,EACF,uBAAC,eAAQ,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,uBAAC,0BAAkB,KAAG,EACrC,eAAe,EACb,uBAAC,sBAAc,IAAC,SAAS,EAAC,mCAAmC,GAAG,EAElE,cAAc,EACZ,6DACE,iCAAM,SAAS,EAAC,iBAAiB,4BAAmB,EACpD,kCAAM,SAAS,EAAC,kDAAkD,aAChE,uBAAC,sBAAc,IAAC,SAAS,EAAC,mCAAmC,GAAG,wBAE3D,IACN,GAEL,IACO,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { 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,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ /**
5
+ *
6
+ * Copyright (c) "Neo4j"
7
+ * Neo4j Sweden AB [http://neo4j.com]
8
+ *
9
+ * This file is part of Neo4j.
10
+ *
11
+ * Neo4j is free software: you can redistribute it and/or modify
12
+ * it under the terms of the GNU General Public License as published by
13
+ * the Free Software Foundation, either version 3 of the License, or
14
+ * (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ */
24
+ require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
25
+ const react_1 = require("@neo4j-ndl/react");
26
+ const icons_1 = require("@neo4j-ndl/react/icons");
27
+ const next_1 = require("@neo4j-ndl/react/next");
28
+ const react_2 = require("react");
29
+ const Component = () => {
30
+ const [selected, setSelected] = (0, react_2.useState)(null);
31
+ return ((0, jsx_runtime_1.jsxs)(next_1.TreeView, { ariaLabel: "Databases", children: [(0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Production", isSelected: selected === 'production', onSelectedChange: () => setSelected('production'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DatabaseSignalIcon, {}), trailingContent: (0, jsx_runtime_1.jsx)(icons_1.CheckCircleIconSolid, { className: "n-size-5 n-text-success-bg-status" }), actionMenuItems: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Edit" }), (0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Delete" }), (0, jsx_runtime_1.jsx)(react_1.Menu.Item, { title: "Rename" })] }) }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Development", isSelected: selected === 'development', onSelectedChange: () => setSelected('development'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DatabaseSignalIcon, {}), trailingContent: (0, jsx_runtime_1.jsx)(icons_1.AppearanceIcon, { className: "n-size-5 n-text-warning-bg-status" }) })] }));
32
+ };
33
+ exports.default = Component;
34
+ //# 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,mDAAiD;AAEjD,4CAAwC;AACxC,kDAIgC;AAChC,gDAAiD;AACjD,iCAAiC;AAEjC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAgB,IAAI,CAAC,CAAC;IAE9D,OAAO,CACL,wBAAC,eAAQ,IAAC,SAAS,EAAC,WAAW,aAC7B,uBAAC,eAAQ,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,uBAAC,0BAAkB,KAAG,EACrC,eAAe,EACb,uBAAC,4BAAoB,IAAC,SAAS,EAAC,mCAAmC,GAAG,EAExE,eAAe,EACb,6DACE,uBAAC,YAAI,CAAC,IAAI,IAAC,KAAK,EAAC,MAAM,GAAG,EAC1B,uBAAC,YAAI,CAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,GAAG,EAC5B,uBAAC,YAAI,CAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,GAAG,IAC3B,GAEL,EACF,uBAAC,eAAQ,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,uBAAC,0BAAkB,KAAG,EACrC,eAAe,EACb,uBAAC,sBAAc,IAAC,SAAS,EAAC,mCAAmC,GAAG,GAElE,IACO,CACZ,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport '@neo4j-ndl/base/lib/neo4j-ds-styles.css';\n\nimport { 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,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ /**
5
+ *
6
+ * Copyright (c) "Neo4j"
7
+ * Neo4j Sweden AB [http://neo4j.com]
8
+ *
9
+ * This file is part of Neo4j.
10
+ *
11
+ * Neo4j is free software: you can redistribute it and/or modify
12
+ * it under the terms of the GNU General Public License as published by
13
+ * the Free Software Foundation, either version 3 of the License, or
14
+ * (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU General Public License
22
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ */
24
+ require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
25
+ const icons_1 = require("@neo4j-ndl/react/icons");
26
+ const next_1 = require("@neo4j-ndl/react/next");
27
+ const react_1 = require("react");
28
+ const Component = () => {
29
+ const [selected, setSelected] = (0, react_1.useState)(null);
30
+ return ((0, jsx_runtime_1.jsxs)(next_1.TreeView, { ariaLabel: "File explorer", children: [(0, jsx_runtime_1.jsxs)(next_1.TreeView.Item, { title: "Documents (expanded by default)", defaultExpanded: true, leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), children: [(0, jsx_runtime_1.jsxs)(next_1.TreeView.Item, { title: "Work", leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), children: [(0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Report.pdf", isSelected: selected === 'report', onSelectedChange: () => setSelected('report'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Presentation.pptx", isSelected: selected === 'presentation', onSelectedChange: () => setSelected('presentation'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) })] }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Resume.pdf", isSelected: selected === 'resume', onSelectedChange: () => setSelected('resume'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) })] }), (0, jsx_runtime_1.jsxs)(next_1.TreeView.Item, { title: "Images (collapsed by default)", leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), defaultExpanded: false, children: [(0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Photo.jpg", isSelected: selected === 'photo', onSelectedChange: () => setSelected('photo'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Screenshot.png", isSelected: selected === 'screenshot', onSelectedChange: () => setSelected('screenshot'), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) })] })] }));
31
+ };
32
+ exports.default = Component;
33
+ //# sourceMappingURL=tree-view-uncontrolled.story.js.map