@neo4j-ndl/react 4.21.2-alpha.c774957.15.1 → 4.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/lib/cjs/ai/reasoning/Reasoning.js +1 -1
  2. package/lib/cjs/ai/reasoning/Reasoning.js.map +1 -1
  3. package/lib/cjs/clean-icon-button/stories/clean-icon-button-sizes.story.js +1 -1
  4. package/lib/cjs/clean-icon-button/stories/clean-icon-button-sizes.story.js.map +1 -1
  5. package/lib/cjs/clean-icon-button/stories/clean-icon-button-tone.story.js +1 -1
  6. package/lib/cjs/clean-icon-button/stories/clean-icon-button-tone.story.js.map +1 -1
  7. package/lib/cjs/date-picker/stories/date-picker-with-timezone-both-mode.story.js +1 -1
  8. package/lib/cjs/date-picker/stories/date-picker-with-timezone-both-mode.story.js.map +1 -1
  9. package/lib/cjs/dropzone/stories/dropzone-full.story.js +1 -1
  10. package/lib/cjs/dropzone/stories/dropzone-full.story.js.map +1 -1
  11. package/lib/cjs/helpers/index.js +1 -0
  12. package/lib/cjs/helpers/index.js.map +1 -1
  13. package/lib/cjs/helpers/platform.js +59 -0
  14. package/lib/cjs/helpers/platform.js.map +1 -0
  15. package/lib/cjs/icon-button/stories/icon-button-sizes.story.js +1 -1
  16. package/lib/cjs/icon-button/stories/icon-button-sizes.story.js.map +1 -1
  17. package/lib/cjs/icon-button/stories/icon-button-tone.story.js +1 -1
  18. package/lib/cjs/icon-button/stories/icon-button-tone.story.js.map +1 -1
  19. package/lib/cjs/kbd/kbd-utils.js +6 -22
  20. package/lib/cjs/kbd/kbd-utils.js.map +1 -1
  21. package/lib/cjs/next/tree-view/TreeView.js +384 -66
  22. package/lib/cjs/next/tree-view/TreeView.js.map +1 -1
  23. package/lib/cjs/next/tree-view/selection.js +181 -0
  24. package/lib/cjs/next/tree-view/selection.js.map +1 -0
  25. package/lib/cjs/next/tree-view/stories/index.js +13 -1
  26. package/lib/cjs/next/tree-view/stories/index.js.map +1 -1
  27. package/lib/cjs/next/tree-view/stories/tree-view-large.story.js +57 -0
  28. package/lib/cjs/next/tree-view/stories/tree-view-large.story.js.map +1 -0
  29. package/lib/cjs/next/tree-view/stories/tree-view-lazy.story.js +1 -0
  30. package/lib/cjs/next/tree-view/stories/tree-view-lazy.story.js.map +1 -1
  31. package/lib/cjs/next/tree-view/stories/tree-view-multi.story.js +16 -40
  32. package/lib/cjs/next/tree-view/stories/tree-view-multi.story.js.map +1 -1
  33. package/lib/cjs/next/tree-view/stories/tree-view-multiple-replace.story.js +38 -0
  34. package/lib/cjs/next/tree-view/stories/tree-view-multiple-replace.story.js.map +1 -0
  35. package/lib/cjs/next/tree-view/stories/tree-view-non-selectable-folders.story.js +7 -4
  36. package/lib/cjs/next/tree-view/stories/tree-view-non-selectable-folders.story.js.map +1 -1
  37. package/lib/cjs/next/tree-view/stories/tree-view-root-selection.story.js +125 -0
  38. package/lib/cjs/next/tree-view/stories/tree-view-root-selection.story.js.map +1 -0
  39. package/lib/cjs/radio/stories/radio-custom-label.story.js +1 -1
  40. package/lib/cjs/radio/stories/radio-custom-label.story.js.map +1 -1
  41. package/lib/cjs/select-icon-button/stories/select-icon-button-sizes.story.js +1 -1
  42. package/lib/cjs/select-icon-button/stories/select-icon-button-sizes.story.js.map +1 -1
  43. package/lib/cjs/select-icon-button/stories/select-icon-button-states.story.js +1 -1
  44. package/lib/cjs/select-icon-button/stories/select-icon-button-states.story.js.map +1 -1
  45. package/lib/cjs/side-navigation/SideNavigation.js +1 -1
  46. package/lib/cjs/side-navigation/SideNavigation.js.map +1 -1
  47. package/lib/cjs/status-indicator/stories/status-indicator-variants.story.js +1 -1
  48. package/lib/cjs/status-indicator/stories/status-indicator-variants.story.js.map +1 -1
  49. package/lib/cjs/tabs/stories/tabs-fill-variants.story.js +1 -1
  50. package/lib/cjs/tabs/stories/tabs-fill-variants.story.js.map +1 -1
  51. package/lib/cjs/tabs/stories/tabs-sizes.story.js +1 -1
  52. package/lib/cjs/tabs/stories/tabs-sizes.story.js.map +1 -1
  53. package/lib/cjs/toast/ToastControlled.js +1 -1
  54. package/lib/cjs/toast/ToastControlled.js.map +1 -1
  55. package/lib/cjs/typography/Typography.js.map +1 -1
  56. package/lib/esm/ai/reasoning/Reasoning.js +1 -1
  57. package/lib/esm/ai/reasoning/Reasoning.js.map +1 -1
  58. package/lib/esm/clean-icon-button/stories/clean-icon-button-sizes.story.js +1 -1
  59. package/lib/esm/clean-icon-button/stories/clean-icon-button-sizes.story.js.map +1 -1
  60. package/lib/esm/clean-icon-button/stories/clean-icon-button-tone.story.js +1 -1
  61. package/lib/esm/clean-icon-button/stories/clean-icon-button-tone.story.js.map +1 -1
  62. package/lib/esm/date-picker/stories/date-picker-with-timezone-both-mode.story.js +1 -1
  63. package/lib/esm/date-picker/stories/date-picker-with-timezone-both-mode.story.js.map +1 -1
  64. package/lib/esm/dropzone/stories/dropzone-full.story.js +1 -1
  65. package/lib/esm/dropzone/stories/dropzone-full.story.js.map +1 -1
  66. package/lib/esm/helpers/index.js +1 -0
  67. package/lib/esm/helpers/index.js.map +1 -1
  68. package/lib/esm/helpers/platform.js +55 -0
  69. package/lib/esm/helpers/platform.js.map +1 -0
  70. package/lib/esm/icon-button/stories/icon-button-sizes.story.js +1 -1
  71. package/lib/esm/icon-button/stories/icon-button-sizes.story.js.map +1 -1
  72. package/lib/esm/icon-button/stories/icon-button-tone.story.js +1 -1
  73. package/lib/esm/icon-button/stories/icon-button-tone.story.js.map +1 -1
  74. package/lib/esm/kbd/kbd-utils.js +2 -18
  75. package/lib/esm/kbd/kbd-utils.js.map +1 -1
  76. package/lib/esm/next/tree-view/TreeView.js +385 -67
  77. package/lib/esm/next/tree-view/TreeView.js.map +1 -1
  78. package/lib/esm/next/tree-view/selection.js +175 -0
  79. package/lib/esm/next/tree-view/selection.js.map +1 -0
  80. package/lib/esm/next/tree-view/stories/index.js +9 -0
  81. package/lib/esm/next/tree-view/stories/index.js.map +1 -1
  82. package/lib/esm/next/tree-view/stories/tree-view-large.story.js +55 -0
  83. package/lib/esm/next/tree-view/stories/tree-view-large.story.js.map +1 -0
  84. package/lib/esm/next/tree-view/stories/tree-view-lazy.story.js +1 -0
  85. package/lib/esm/next/tree-view/stories/tree-view-lazy.story.js.map +1 -1
  86. package/lib/esm/next/tree-view/stories/tree-view-multi.story.js +16 -40
  87. package/lib/esm/next/tree-view/stories/tree-view-multi.story.js.map +1 -1
  88. package/lib/esm/next/tree-view/stories/tree-view-multiple-replace.story.js +36 -0
  89. package/lib/esm/next/tree-view/stories/tree-view-multiple-replace.story.js.map +1 -0
  90. package/lib/esm/next/tree-view/stories/tree-view-non-selectable-folders.story.js +7 -4
  91. package/lib/esm/next/tree-view/stories/tree-view-non-selectable-folders.story.js.map +1 -1
  92. package/lib/esm/next/tree-view/stories/tree-view-root-selection.story.js +123 -0
  93. package/lib/esm/next/tree-view/stories/tree-view-root-selection.story.js.map +1 -0
  94. package/lib/esm/radio/stories/radio-custom-label.story.js +1 -1
  95. package/lib/esm/radio/stories/radio-custom-label.story.js.map +1 -1
  96. package/lib/esm/select-icon-button/stories/select-icon-button-sizes.story.js +1 -1
  97. package/lib/esm/select-icon-button/stories/select-icon-button-sizes.story.js.map +1 -1
  98. package/lib/esm/select-icon-button/stories/select-icon-button-states.story.js +1 -1
  99. package/lib/esm/select-icon-button/stories/select-icon-button-states.story.js.map +1 -1
  100. package/lib/esm/side-navigation/SideNavigation.js +1 -1
  101. package/lib/esm/side-navigation/SideNavigation.js.map +1 -1
  102. package/lib/esm/status-indicator/stories/status-indicator-variants.story.js +1 -1
  103. package/lib/esm/status-indicator/stories/status-indicator-variants.story.js.map +1 -1
  104. package/lib/esm/tabs/stories/tabs-fill-variants.story.js +1 -1
  105. package/lib/esm/tabs/stories/tabs-fill-variants.story.js.map +1 -1
  106. package/lib/esm/tabs/stories/tabs-sizes.story.js +1 -1
  107. package/lib/esm/tabs/stories/tabs-sizes.story.js.map +1 -1
  108. package/lib/esm/toast/ToastControlled.js +1 -1
  109. package/lib/esm/toast/ToastControlled.js.map +1 -1
  110. package/lib/esm/typography/Typography.js.map +1 -1
  111. package/lib/types/helpers/index.d.ts +1 -0
  112. package/lib/types/helpers/index.d.ts.map +1 -1
  113. package/lib/types/helpers/platform.d.ts +29 -0
  114. package/lib/types/helpers/platform.d.ts.map +1 -0
  115. package/lib/types/kbd/kbd-utils.d.ts +2 -5
  116. package/lib/types/kbd/kbd-utils.d.ts.map +1 -1
  117. package/lib/types/next/tree-view/TreeView.d.ts +29 -5
  118. package/lib/types/next/tree-view/TreeView.d.ts.map +1 -1
  119. package/lib/types/next/tree-view/selection.d.ts +78 -0
  120. package/lib/types/next/tree-view/selection.d.ts.map +1 -0
  121. package/lib/types/next/tree-view/stories/index.d.ts +6 -0
  122. package/lib/types/next/tree-view/stories/index.d.ts.map +1 -1
  123. package/lib/types/next/tree-view/stories/tree-view-large.story.d.ts +24 -0
  124. package/lib/types/next/tree-view/stories/tree-view-large.story.d.ts.map +1 -0
  125. package/lib/types/next/tree-view/stories/tree-view-lazy.story.d.ts.map +1 -1
  126. package/lib/types/next/tree-view/stories/tree-view-multi.story.d.ts +10 -0
  127. package/lib/types/next/tree-view/stories/tree-view-multi.story.d.ts.map +1 -1
  128. package/lib/types/next/tree-view/stories/tree-view-multiple-replace.story.d.ts +29 -0
  129. package/lib/types/next/tree-view/stories/tree-view-multiple-replace.story.d.ts.map +1 -0
  130. package/lib/types/next/tree-view/stories/tree-view-non-selectable-folders.story.d.ts +5 -0
  131. package/lib/types/next/tree-view/stories/tree-view-non-selectable-folders.story.d.ts.map +1 -1
  132. package/lib/types/next/tree-view/stories/tree-view-root-selection.story.d.ts +24 -0
  133. package/lib/types/next/tree-view/stories/tree-view-root-selection.story.d.ts.map +1 -0
  134. package/lib/types/typography/Typography.d.ts +1 -6
  135. package/lib/types/typography/Typography.d.ts.map +1 -1
  136. package/package.json +3 -4
  137. package/skills/ndl-react/SKILL.md +1 -1
  138. package/skills/ndl-react/components/clean-icon-button.md +5 -5
  139. package/skills/ndl-react/components/color-picker.md +32 -32
  140. package/skills/ndl-react/components/date-picker.md +1 -1
  141. package/skills/ndl-react/components/dropzone.md +6 -6
  142. package/skills/ndl-react/components/icon-button.md +5 -5
  143. package/skills/ndl-react/components/next/tree-view.md +358 -104
  144. package/skills/ndl-react/components/radio.md +1 -1
  145. package/skills/ndl-react/components/select-icon-button.md +6 -6
  146. package/skills/ndl-react/components/status-indicator.md +5 -5
  147. package/skills/ndl-react/components/tabs.md +4 -4
  148. package/skills/ndl-react/components/typography.md +1 -1
@@ -137,6 +137,7 @@ function renderNode(node, ctx) {
137
137
  node.children.length > 0;
138
138
  const state = ctx.getNodeState(node.id);
139
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.isExpanded &&
140
141
  state.hasLoaded &&
141
142
  node.children.map((child) => renderNode(child, ctx))] }, node.id));
142
143
  }
@@ -1 +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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5D,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((prev) => ({\n ...prev,\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"]}
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;gBACD,EAAE,EAAE,UAAU;gBACd,KAAK,EAAE,UAAU;aAClB;YACD,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE;SAC5C;QACD,EAAE,EAAE,QAAQ;QACZ,KAAK,EAAE,QAAQ;KA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KAAK,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,SAAS,IAAI,CACrD,uBAAC,eAAQ,CAAC,YAAY,IAAC,IAAI,EAAE,CAAC,GAAI,CACnC,EAKA,WAAW;gBACV,KAAK,CAAC,UAAU;gBAChB,KAAK,CAAC,SAAS;gBACf,IAAI,CAAC,QAAS,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,KAtBlD,IAAI,CAAC,EAAE,CAuBE,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((prev) => ({\n ...prev,\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 {/* Rendering children only while expanded keeps collapsed subtrees out\n of the DOM, so large trees only pay for the rows the user can see.\n All item state lives outside the tree (keyed by node id), so nothing\n is lost when a subtree unmounts on collapse. */}\n {hasChildren &&\n state.isExpanded &&\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"]}
@@ -25,49 +25,25 @@ require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
25
25
  const icons_1 = require("@neo4j-ndl/react/icons");
26
26
  const next_1 = require("@neo4j-ndl/react/next");
27
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((key) => !DISABLED_KEYS.has(key));
34
- if (enabledKeys.length === 0) {
35
- return { isChecked: false, isIndeterminate: false };
36
- }
37
- const checkedCount = enabledKeys.filter((key) => checked[key]).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
- }
28
+ /**
29
+ * Every row owns its own checkbox: `onSelectedChange` reports the state the row
30
+ * should end up in, and the story stores exactly that. Folders are ordinary
31
+ * selectable rows here, unrelated to what sits inside them.
32
+ *
33
+ * Deriving a folder's state from its children instead needs the tree to own the
34
+ * selection, since a Shift range moves several rows at once and a cascade has
35
+ * to be applied to the whole set in one pass. See the root-managed selection
36
+ * story for that.
37
+ */
46
38
  const Component = () => {
39
+ var _a, _b, _c, _d, _e, _f, _g, _h;
47
40
  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] })));
41
+ const [selected, setSelected] = (0, react_1.useState)({});
42
+ const toggleExpanded = (key) => setExpanded((prev) => (Object.assign(Object.assign({}, prev), { [key]: !prev[key] })));
43
+ const setRowSelected = (0, react_1.useCallback)((key, isSelected) => {
44
+ setSelected((prev) => (Object.assign(Object.assign({}, prev), { [key]: isSelected })));
52
45
  }, []);
53
- const toggleParent = (0, react_1.useCallback)((childKeys) => {
54
- const enabledKeys = childKeys.filter((key) => !DISABLED_KEYS.has(key));
55
- const isAllChecked = enabledKeys.every((key) => checked[key]);
56
- setChecked((prev) => {
57
- const next = Object.assign({}, prev);
58
- for (const key of enabledKeys) {
59
- next[key] = !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, {}) })] })] }));
46
+ 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: () => toggleExpanded('documents'), isSelected: (_a = selected['documents']) !== null && _a !== void 0 ? _a : false, onSelectedChange: (isSelected) => setRowSelected('documents', isSelected), 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: () => toggleExpanded('work'), isSelected: (_b = selected['work']) !== null && _b !== void 0 ? _b : false, onSelectedChange: (isSelected) => setRowSelected('work', isSelected), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), children: [(0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Report.pdf", isSelected: (_c = selected['report']) !== null && _c !== void 0 ? _c : false, onSelectedChange: (isSelected) => setRowSelected('report', isSelected), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Presentation.pptx", isDisabled: true, isSelected: (_d = selected['presentation']) !== null && _d !== void 0 ? _d : false, onSelectedChange: (isSelected) => setRowSelected('presentation', isSelected), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) })] }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Resume.pdf", isSelected: (_e = selected['resume']) !== null && _e !== void 0 ? _e : false, onSelectedChange: (isSelected) => setRowSelected('resume', isSelected), 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: () => toggleExpanded('images'), isSelected: (_f = selected['images']) !== null && _f !== void 0 ? _f : false, onSelectedChange: (isSelected) => setRowSelected('images', isSelected), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), children: [(0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Photo.jpg", isSelected: (_g = selected['photo']) !== null && _g !== void 0 ? _g : false, onSelectedChange: (isSelected) => setRowSelected('photo', isSelected), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.PhotoIconOutline, {}) }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { title: "Screenshot.png", isSelected: (_h = selected['screenshot']) !== null && _h !== void 0 ? _h : false, onSelectedChange: (isSelected) => setRowSelected('screenshot', isSelected), leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.PhotoIconOutline, {}) })] })] }));
71
47
  };
72
48
  exports.default = Component;
73
49
  //# sourceMappingURL=tree-view-multi.story.js.map
@@ -1 +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,GAAG,EAAE,EAAE,CAAC,C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CAAC,QAAQ,CAAC,EAC9B,gBAAgB,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EACxC,UAAU,EAAE,UAAU,CAAC,SAAS,EAChC,eAAe,EAAE,UAAU,CAAC,eAAe,EAC3C,gBAAgB,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,cAAc,CAAC,EACpD,aAAa,EAAE,uBAAC,uBAAe,KAAG,aAElC,uBAAC,eAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,WAAW,EACjB,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,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((key) => !DISABLED_KEYS.has(key));\n if (enabledKeys.length === 0) {\n return { isChecked: false, isIndeterminate: false };\n }\n const checkedCount = enabledKeys.filter((key) => checked[key]).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((key) => !DISABLED_KEYS.has(key));\n const isAllChecked = enabledKeys.every((key) => checked[key]);\n setChecked((prev) => {\n const next = { ...prev };\n for (const key of enabledKeys) {\n next[key] = !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"]}
1
+ {"version":3,"file":"tree-view-multi.story.js","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/tree-view-multi.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;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GAAG,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,EAChD,UAAU,EAAE,MAAA,QAAQ,CAAC,QAAQ,CAAC,mCAAI,KAAK,EACvC,gBAAgB,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,UAAU,CAAC,EACtE,aAAa,EAAE,uBAAC,uBAAe,KAAG,aAElC,uBAAC,eAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,WAAW,EACjB,UAAU,EAAE,MAAA,QAAQ,CAAC,OAAO,CAAC,mCAAI,KAAK,EACtC,gBAAgB,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,EACrE,aAAa,EAAE,uBAAC,wBAAgB,KAAG,GACnC,EACF,uBAAC,eAAQ,CAAC,IAAI,IACZ,KAAK,EAAC,gBAAgB,EACtB,UAAU,EAAE,MAAA,QAAQ,CAAC,YAAY,CAAC,mCAAI,KAAK,EAC3C,gBAAgB,EAAE,CAAC,UAAU,EAAE,EAAE,CAC/B,cAAc,CAAC,YAAY,EAAE,UAAU,CAAC,EAE1C,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\n/**\n * Every row owns its own checkbox: `onSelectedChange` reports the state the row\n * should end up in, and the story stores exactly that. Folders are ordinary\n * selectable rows here, unrelated to what sits inside them.\n *\n * Deriving a folder's state from its children instead needs the tree to own the\n * selection, since a Shift range moves several rows at once and a cascade has\n * to be applied to the whole set in one pass. See the root-managed selection\n * story for that.\n */\nconst Component = () => {\n const [expanded, setExpanded] = useState<Record<string, boolean>>({});\n const [selected, setSelected] = useState<Record<string, boolean>>({});\n\n const toggleExpanded = (key: string) =>\n setExpanded((prev) => ({ ...prev, [key]: !prev[key] }));\n\n const setRowSelected = useCallback((key: string, isSelected: boolean) => {\n setSelected((prev) => ({ ...prev, [key]: isSelected }));\n }, []);\n\n return (\n <TreeView ariaLabel=\"File explorer\" selectionMode=\"multiple\">\n <TreeView.Item\n title=\"Documents\"\n hasChildren\n isExpanded={expanded['documents']}\n onExpandedChange={() => toggleExpanded('documents')}\n isSelected={selected['documents'] ?? false}\n onSelectedChange={(isSelected) =>\n setRowSelected('documents', isSelected)\n }\n leadingVisual={<FolderIconSolid />}\n >\n <TreeView.Item\n title=\"Work\"\n hasChildren\n isExpanded={expanded['work']}\n onExpandedChange={() => toggleExpanded('work')}\n isSelected={selected['work'] ?? false}\n onSelectedChange={(isSelected) => setRowSelected('work', isSelected)}\n leadingVisual={<FolderIconSolid />}\n >\n <TreeView.Item\n title=\"Report.pdf\"\n isSelected={selected['report'] ?? false}\n onSelectedChange={(isSelected) =>\n setRowSelected('report', isSelected)\n }\n leadingVisual={<DocumentIconOutline />}\n />\n <TreeView.Item\n title=\"Presentation.pptx\"\n isDisabled\n isSelected={selected['presentation'] ?? false}\n onSelectedChange={(isSelected) =>\n setRowSelected('presentation', isSelected)\n }\n leadingVisual={<DocumentIconOutline />}\n />\n </TreeView.Item>\n <TreeView.Item\n title=\"Resume.pdf\"\n isSelected={selected['resume'] ?? false}\n onSelectedChange={(isSelected) =>\n setRowSelected('resume', isSelected)\n }\n leadingVisual={<DocumentIconOutline />}\n />\n </TreeView.Item>\n <TreeView.Item\n title=\"Images\"\n hasChildren\n isExpanded={expanded['images']}\n onExpandedChange={() => toggleExpanded('images')}\n isSelected={selected['images'] ?? false}\n onSelectedChange={(isSelected) => setRowSelected('images', isSelected)}\n leadingVisual={<FolderIconSolid />}\n >\n <TreeView.Item\n title=\"Photo.jpg\"\n isSelected={selected['photo'] ?? false}\n onSelectedChange={(isSelected) => setRowSelected('photo', isSelected)}\n leadingVisual={<PhotoIconOutline />}\n />\n <TreeView.Item\n title=\"Screenshot.png\"\n isSelected={selected['screenshot'] ?? false}\n onSelectedChange={(isSelected) =>\n setRowSelected('screenshot', isSelected)\n }\n leadingVisual={<PhotoIconOutline />}\n />\n </TreeView.Item>\n </TreeView>\n );\n};\n\nexport default Component;\n"]}
@@ -0,0 +1,38 @@
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
+ /**
29
+ * Letting the tree own the selection keeps the items declarative: they carry an
30
+ * `id` and nothing else, and a Shift range that moves several rows at once
31
+ * arrives as a single `onSelectedIdsChange`.
32
+ */
33
+ const Component = () => {
34
+ const [selectedIds, setSelectedIds] = (0, react_1.useState)([]);
35
+ return ((0, jsx_runtime_1.jsxs)(next_1.TreeView, { ariaLabel: "File explorer", selectionMode: "multiple-replace", selectedIds: selectedIds, onSelectedIdsChange: setSelectedIds, children: [(0, jsx_runtime_1.jsxs)(next_1.TreeView.Item, { id: "documents", title: "Documents", hasChildren: true, defaultExpanded: true, leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), children: [(0, jsx_runtime_1.jsxs)(next_1.TreeView.Item, { id: "work", title: "Work", hasChildren: true, defaultExpanded: true, leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), children: [(0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { id: "report", title: "Report.pdf", isDisabled: true, leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { id: "presentation", title: "Presentation.pptx", leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) })] }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { id: "resume", title: "Resume.pdf", leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) })] }), (0, jsx_runtime_1.jsxs)(next_1.TreeView.Item, { id: "images", title: "Images", hasChildren: true, leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), children: [(0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { id: "photo", title: "Photo.jpg", leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.PhotoIconOutline, {}) }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { id: "screenshot", title: "Screenshot.png", leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.PhotoIconOutline, {}) })] })] }));
36
+ };
37
+ exports.default = Component;
38
+ //# sourceMappingURL=tree-view-multiple-replace.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-view-multiple-replace.story.js","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/tree-view-multiple-replace.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,kDAIgC;AAChC,gDAAiD;AACjD,iCAAiC;AAEjC;;;;GAIG;AACH,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAW,EAAE,CAAC,CAAC;IAE7D,OAAO,CACL,wBAAC,eAAQ,IACP,SAAS,EAAC,eAAe,EACzB,aAAa,EAAC,kBAAkB,EAChC,WAAW,EAAE,WAAW,EACxB,mBAAmB,EAAE,cAAc,aAEnC,wBAAC,eAAQ,CAAC,IAAI,IACZ,EAAE,EAAC,WAAW,EACd,KAAK,EAAC,WAAW,EACjB,WAAW,QACX,eAAe,QACf,aAAa,EAAE,uBAAC,uBAAe,KAAG,aAElC,wBAAC,eAAQ,CAAC,IAAI,IACZ,EAAE,EAAC,MAAM,EACT,KAAK,EAAC,MAAM,EACZ,WAAW,QACX,eAAe,QACf,aAAa,EAAE,uBAAC,uBAAe,KAAG,aAElC,uBAAC,eAAQ,CAAC,IAAI,IACZ,EAAE,EAAC,QAAQ,EACX,KAAK,EAAC,YAAY,EAClB,UAAU,QACV,aAAa,EAAE,uBAAC,2BAAmB,KAAG,GACtC,EACF,uBAAC,eAAQ,CAAC,IAAI,IACZ,EAAE,EAAC,cAAc,EACjB,KAAK,EAAC,mBAAmB,EACzB,aAAa,EAAE,uBAAC,2BAAmB,KAAG,GACtC,IACY,EAChB,uBAAC,eAAQ,CAAC,IAAI,IACZ,EAAE,EAAC,QAAQ,EACX,KAAK,EAAC,YAAY,EAClB,aAAa,EAAE,uBAAC,2BAAmB,KAAG,GACtC,IACY,EAChB,wBAAC,eAAQ,CAAC,IAAI,IACZ,EAAE,EAAC,QAAQ,EACX,KAAK,EAAC,QAAQ,EACd,WAAW,QACX,aAAa,EAAE,uBAAC,uBAAe,KAAG,aAElC,uBAAC,eAAQ,CAAC,IAAI,IACZ,EAAE,EAAC,OAAO,EACV,KAAK,EAAC,WAAW,EACjB,aAAa,EAAE,uBAAC,wBAAgB,KAAG,GACnC,EACF,uBAAC,eAAQ,CAAC,IAAI,IACZ,EAAE,EAAC,YAAY,EACf,KAAK,EAAC,gBAAgB,EACtB,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 { useState } from 'react';\n\n/**\n * Letting the tree own the selection keeps the items declarative: they carry an\n * `id` and nothing else, and a Shift range that moves several rows at once\n * arrives as a single `onSelectedIdsChange`.\n */\nconst Component = () => {\n const [selectedIds, setSelectedIds] = useState<string[]>([]);\n\n return (\n <TreeView\n ariaLabel=\"File explorer\"\n selectionMode=\"multiple-replace\"\n selectedIds={selectedIds}\n onSelectedIdsChange={setSelectedIds}\n >\n <TreeView.Item\n id=\"documents\"\n title=\"Documents\"\n hasChildren\n defaultExpanded\n leadingVisual={<FolderIconSolid />}\n >\n <TreeView.Item\n id=\"work\"\n title=\"Work\"\n hasChildren\n defaultExpanded\n leadingVisual={<FolderIconSolid />}\n >\n <TreeView.Item\n id=\"report\"\n title=\"Report.pdf\"\n isDisabled\n leadingVisual={<DocumentIconOutline />}\n />\n <TreeView.Item\n id=\"presentation\"\n title=\"Presentation.pptx\"\n leadingVisual={<DocumentIconOutline />}\n />\n </TreeView.Item>\n <TreeView.Item\n id=\"resume\"\n title=\"Resume.pdf\"\n leadingVisual={<DocumentIconOutline />}\n />\n </TreeView.Item>\n <TreeView.Item\n id=\"images\"\n title=\"Images\"\n hasChildren\n leadingVisual={<FolderIconSolid />}\n >\n <TreeView.Item\n id=\"photo\"\n title=\"Photo.jpg\"\n leadingVisual={<PhotoIconOutline />}\n />\n <TreeView.Item\n id=\"screenshot\"\n title=\"Screenshot.png\"\n leadingVisual={<PhotoIconOutline />}\n />\n </TreeView.Item>\n </TreeView>\n );\n};\n\nexport default Component;\n"]}
@@ -25,11 +25,14 @@ require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
25
25
  const icons_1 = require("@neo4j-ndl/react/icons");
26
26
  const next_1 = require("@neo4j-ndl/react/next");
27
27
  const react_1 = require("react");
28
+ /**
29
+ * Folders here are pure containers: `isSelectable={false}` makes them expand on
30
+ * click without ever becoming part of the selection, and screen readers
31
+ * announce them as non-selectable rather than as unselected rows.
32
+ */
28
33
  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, {}) })] })] }));
34
+ const [selectedIds, setSelectedIds] = (0, react_1.useState)([]);
35
+ return ((0, jsx_runtime_1.jsxs)(next_1.TreeView, { ariaLabel: "File explorer", selectedIds: selectedIds, onSelectedIdsChange: setSelectedIds, children: [(0, jsx_runtime_1.jsxs)(next_1.TreeView.Item, { id: "documents", title: "Documents", hasChildren: true, isSelectable: false, leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), children: [(0, jsx_runtime_1.jsxs)(next_1.TreeView.Item, { id: "work", title: "Work", hasChildren: true, isSelectable: false, leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), children: [(0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { id: "report", title: "Report.pdf", leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { id: "presentation", title: "Presentation.pptx", leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) })] }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { id: "resume", title: "Resume.pdf", leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) })] }), (0, jsx_runtime_1.jsxs)(next_1.TreeView.Item, { id: "images", title: "Images", hasChildren: true, isSelectable: false, leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {}), children: [(0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { id: "photo", title: "Photo.jpg", leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) }), (0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { id: "screenshot", title: "Screenshot.png", leadingVisual: (0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {}) })] })] }));
33
36
  };
34
37
  exports.default = Component;
35
38
  //# sourceMappingURL=tree-view-non-selectable-folders.story.js.map
@@ -1 +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;;;;;;;;;;;;;;;;;;;GAm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,QAAQ,KAAK,cAAc,EACvC,gBAAgB,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,cAAc,CAAC,EACnD,aAAa,EAAE,uBAAC,2BAAmB,KAAG,GACtC,IACY,EAChB,uBAAC,eAAQ,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,uBAAC,2BAAmB,KAAG,GACtC,IACY,EAChB,wBAAC,eAAQ,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,uBAAC,uBAAe,KAAG,aAElC,uBAAC,eAAQ,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,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"]}
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;;;;GAIG;AACH,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAW,EAAE,CAAC,CAAC;IAE7D,OAAO,CACL,wBAAC,eAAQ,IACP,SAAS,EAAC,eAAe,EACzB,WAAW,EAAE,WAAW,EACxB,mBAAmB,EAAE,cAAc,aAEnC,wBAAC,eAAQ,CAAC,IAAI,IACZ,EAAE,EAAC,WAAW,EACd,KAAK,EAAC,WAAW,EACjB,WAAW,QACX,YAAY,EAAE,KAAK,EACnB,aAAa,EAAE,uBAAC,uBAAe,KAAG,aAElC,wBAAC,eAAQ,CAAC,IAAI,IACZ,EAAE,EAAC,MAAM,EACT,KAAK,EAAC,MAAM,EACZ,WAAW,QACX,YAAY,EAAE,KAAK,EACnB,aAAa,EAAE,uBAAC,uBAAe,KAAG,aAElC,uBAAC,eAAQ,CAAC,IAAI,IACZ,EAAE,EAAC,QAAQ,EACX,KAAK,EAAC,YAAY,EAClB,aAAa,EAAE,uBAAC,2BAAmB,KAAG,GACtC,EACF,uBAAC,eAAQ,CAAC,IAAI,IACZ,EAAE,EAAC,cAAc,EACjB,KAAK,EAAC,mBAAmB,EACzB,aAAa,EAAE,uBAAC,2BAAmB,KAAG,GACtC,IACY,EAChB,uBAAC,eAAQ,CAAC,IAAI,IACZ,EAAE,EAAC,QAAQ,EACX,KAAK,EAAC,YAAY,EAClB,aAAa,EAAE,uBAAC,2BAAmB,KAAG,GACtC,IACY,EAChB,wBAAC,eAAQ,CAAC,IAAI,IACZ,EAAE,EAAC,QAAQ,EACX,KAAK,EAAC,QAAQ,EACd,WAAW,QACX,YAAY,EAAE,KAAK,EACnB,aAAa,EAAE,uBAAC,uBAAe,KAAG,aAElC,uBAAC,eAAQ,CAAC,IAAI,IACZ,EAAE,EAAC,OAAO,EACV,KAAK,EAAC,WAAW,EACjB,aAAa,EAAE,uBAAC,2BAAmB,KAAG,GACtC,EACF,uBAAC,eAAQ,CAAC,IAAI,IACZ,EAAE,EAAC,YAAY,EACf,KAAK,EAAC,gBAAgB,EACtB,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\n/**\n * Folders here are pure containers: `isSelectable={false}` makes them expand on\n * click without ever becoming part of the selection, and screen readers\n * announce them as non-selectable rather than as unselected rows.\n */\nconst Component = () => {\n const [selectedIds, setSelectedIds] = useState<string[]>([]);\n\n return (\n <TreeView\n ariaLabel=\"File explorer\"\n selectedIds={selectedIds}\n onSelectedIdsChange={setSelectedIds}\n >\n <TreeView.Item\n id=\"documents\"\n title=\"Documents\"\n hasChildren\n isSelectable={false}\n leadingVisual={<FolderIconSolid />}\n >\n <TreeView.Item\n id=\"work\"\n title=\"Work\"\n hasChildren\n isSelectable={false}\n leadingVisual={<FolderIconSolid />}\n >\n <TreeView.Item\n id=\"report\"\n title=\"Report.pdf\"\n leadingVisual={<DocumentIconOutline />}\n />\n <TreeView.Item\n id=\"presentation\"\n title=\"Presentation.pptx\"\n leadingVisual={<DocumentIconOutline />}\n />\n </TreeView.Item>\n <TreeView.Item\n id=\"resume\"\n title=\"Resume.pdf\"\n leadingVisual={<DocumentIconOutline />}\n />\n </TreeView.Item>\n <TreeView.Item\n id=\"images\"\n title=\"Images\"\n hasChildren\n isSelectable={false}\n leadingVisual={<FolderIconSolid />}\n >\n <TreeView.Item\n id=\"photo\"\n title=\"Photo.jpg\"\n leadingVisual={<DocumentIconOutline />}\n />\n <TreeView.Item\n id=\"screenshot\"\n title=\"Screenshot.png\"\n leadingVisual={<DocumentIconOutline />}\n />\n </TreeView.Item>\n </TreeView>\n );\n};\n\nexport default Component;\n"]}
@@ -0,0 +1,125 @@
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 files = [
29
+ {
30
+ children: [
31
+ {
32
+ children: [
33
+ { id: 'report', title: 'Report.pdf' },
34
+ { id: 'presentation', title: 'Presentation.pptx' },
35
+ ],
36
+ id: 'work',
37
+ title: 'Work',
38
+ },
39
+ { id: 'resume', title: 'Resume.pdf' },
40
+ ],
41
+ id: 'documents',
42
+ title: 'Documents',
43
+ },
44
+ {
45
+ children: [
46
+ { id: 'photo', title: 'Photo.jpg' },
47
+ { id: 'screenshot', title: 'Screenshot.png' },
48
+ ],
49
+ id: 'images',
50
+ title: 'Images',
51
+ },
52
+ ];
53
+ const walk = (nodes, visit) => {
54
+ nodes.forEach((node) => {
55
+ var _a;
56
+ visit(node);
57
+ walk((_a = node.children) !== null && _a !== void 0 ? _a : [], visit);
58
+ });
59
+ };
60
+ const getDescendantIds = (node) => {
61
+ var _a;
62
+ return ((_a = node.children) !== null && _a !== void 0 ? _a : []).flatMap((child) => [
63
+ child.id,
64
+ ...getDescendantIds(child),
65
+ ]);
66
+ };
67
+ const getLeafIds = (node) => node.children === undefined ? [node.id] : node.children.flatMap(getLeafIds);
68
+ /** Folders follow their contents: selected only when every leaf below them is. */
69
+ const syncFolders = (nodes, selected) => {
70
+ nodes.forEach((node) => {
71
+ if (node.children === undefined) {
72
+ return;
73
+ }
74
+ syncFolders(node.children, selected);
75
+ if (getLeafIds(node).every((id) => selected.has(id))) {
76
+ selected.add(node.id);
77
+ }
78
+ else {
79
+ selected.delete(node.id);
80
+ }
81
+ });
82
+ };
83
+ const Component = () => {
84
+ const [selectedIds, setSelectedIds] = (0, react_1.useState)(['resume']);
85
+ const selected = new Set(selectedIds);
86
+ /**
87
+ * The tree reports the whole selection at once, so cascading folders onto
88
+ * their contents takes a single pass even when a Shift range flipped many
89
+ * rows.
90
+ */
91
+ const handleSelectedIdsChange = (0, react_1.useCallback)((nextIds) => {
92
+ setSelectedIds((previousIds) => {
93
+ const next = new Set(nextIds);
94
+ const previous = new Set(previousIds);
95
+ walk(files, (node) => {
96
+ const isSelected = next.has(node.id);
97
+ if (node.children === undefined ||
98
+ isSelected === previous.has(node.id)) {
99
+ return;
100
+ }
101
+ getDescendantIds(node).forEach((id) => {
102
+ if (isSelected) {
103
+ next.add(id);
104
+ }
105
+ else {
106
+ next.delete(id);
107
+ }
108
+ });
109
+ });
110
+ syncFolders(files, next);
111
+ return [...next];
112
+ });
113
+ }, []);
114
+ const renderNode = (node) => {
115
+ var _a;
116
+ const leafIds = getLeafIds(node);
117
+ const selectedLeafCount = leafIds.filter((id) => selected.has(id)).length;
118
+ return ((0, jsx_runtime_1.jsx)(next_1.TreeView.Item, { id: node.id, title: node.title, defaultExpanded: true, isIndeterminate: node.children !== undefined &&
119
+ selectedLeafCount > 0 &&
120
+ selectedLeafCount < leafIds.length, leadingVisual: node.children === undefined ? ((0, jsx_runtime_1.jsx)(icons_1.DocumentIconOutline, {})) : ((0, jsx_runtime_1.jsx)(icons_1.FolderIconSolid, {})), children: (_a = node.children) === null || _a === void 0 ? void 0 : _a.map(renderNode) }, node.id));
121
+ };
122
+ return ((0, jsx_runtime_1.jsx)(next_1.TreeView, { ariaLabel: "File explorer", selectionMode: "multiple", selectedIds: selectedIds, onSelectedIdsChange: handleSelectedIdsChange, children: files.map(renderNode) }));
123
+ };
124
+ exports.default = Component;
125
+ //# sourceMappingURL=tree-view-root-selection.story.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-view-root-selection.story.js","sourceRoot":"","sources":["../../../../../src/next/tree-view/stories/tree-view-root-selection.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,kDAA8E;AAC9E,gDAAiD;AACjD,iCAA8C;A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G,CACxB,CAAC,CAAC,CAAC,CACF,uBAAC,uBAAe,KAAG,CACpB,YAGF,MAAA,IAAI,CAAC,QAAQ,0CAAE,GAAG,CAAC,UAAU,CAAC,IAjB1B,IAAI,CAAC,EAAE,CAkBE,CACjB,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,uBAAC,eAAQ,IACP,SAAS,EAAC,eAAe,EACzB,aAAa,EAAC,UAAU,EACxB,WAAW,EAAE,WAAW,EACxB,mBAAmB,EAAE,uBAAuB,YAE3C,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,GACb,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 { useCallback, useState } from 'react';\n\ntype FileNode = {\n children?: FileNode[];\n id: string;\n title: string;\n};\n\nconst files: FileNode[] = [\n {\n children: [\n {\n children: [\n { id: 'report', title: 'Report.pdf' },\n { id: 'presentation', title: 'Presentation.pptx' },\n ],\n id: 'work',\n title: 'Work',\n },\n { id: 'resume', title: 'Resume.pdf' },\n ],\n id: 'documents',\n title: 'Documents',\n },\n {\n children: [\n { id: 'photo', title: 'Photo.jpg' },\n { id: 'screenshot', title: 'Screenshot.png' },\n ],\n id: 'images',\n title: 'Images',\n },\n];\n\nconst walk = (nodes: FileNode[], visit: (node: FileNode) => void) => {\n nodes.forEach((node) => {\n visit(node);\n walk(node.children ?? [], visit);\n });\n};\n\nconst getDescendantIds = (node: FileNode): string[] =>\n (node.children ?? []).flatMap((child) => [\n child.id,\n ...getDescendantIds(child),\n ]);\n\nconst getLeafIds = (node: FileNode): string[] =>\n node.children === undefined ? [node.id] : node.children.flatMap(getLeafIds);\n\n/** Folders follow their contents: selected only when every leaf below them is. */\nconst syncFolders = (nodes: FileNode[], selected: Set<string>) => {\n nodes.forEach((node) => {\n if (node.children === undefined) {\n return;\n }\n syncFolders(node.children, selected);\n if (getLeafIds(node).every((id) => selected.has(id))) {\n selected.add(node.id);\n } else {\n selected.delete(node.id);\n }\n });\n};\n\nconst Component = () => {\n const [selectedIds, setSelectedIds] = useState<string[]>(['resume']);\n const selected = new Set(selectedIds);\n\n /**\n * The tree reports the whole selection at once, so cascading folders onto\n * their contents takes a single pass even when a Shift range flipped many\n * rows.\n */\n const handleSelectedIdsChange = useCallback((nextIds: string[]) => {\n setSelectedIds((previousIds) => {\n const next = new Set(nextIds);\n const previous = new Set(previousIds);\n walk(files, (node) => {\n const isSelected = next.has(node.id);\n if (\n node.children === undefined ||\n isSelected === previous.has(node.id)\n ) {\n return;\n }\n getDescendantIds(node).forEach((id) => {\n if (isSelected) {\n next.add(id);\n } else {\n next.delete(id);\n }\n });\n });\n syncFolders(files, next);\n return [...next];\n });\n }, []);\n\n const renderNode = (node: FileNode) => {\n const leafIds = getLeafIds(node);\n const selectedLeafCount = leafIds.filter((id) => selected.has(id)).length;\n return (\n <TreeView.Item\n key={node.id}\n id={node.id}\n title={node.title}\n defaultExpanded\n isIndeterminate={\n node.children !== undefined &&\n selectedLeafCount > 0 &&\n selectedLeafCount < leafIds.length\n }\n leadingVisual={\n node.children === undefined ? (\n <DocumentIconOutline />\n ) : (\n <FolderIconSolid />\n )\n }\n >\n {node.children?.map(renderNode)}\n </TreeView.Item>\n );\n };\n\n return (\n <TreeView\n ariaLabel=\"File explorer\"\n selectionMode=\"multiple\"\n selectedIds={selectedIds}\n onSelectedIdsChange={handleSelectedIdsChange}\n >\n {files.map(renderNode)}\n </TreeView>\n );\n};\n\nexport default Component;\n"]}
@@ -24,7 +24,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
24
24
  require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
25
25
  const react_1 = require("@neo4j-ndl/react");
26
26
  const Component = () => {
27
- return ((0, jsx_runtime_1.jsx)(react_1.Radio, { label: (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "title-4", children: "Custom label" }), ariaLabel: "example aria label" }));
27
+ return ((0, jsx_runtime_1.jsx)(react_1.Radio, { label: (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "label", children: "Custom label" }), ariaLabel: "example aria label" }));
28
28
  };
29
29
  exports.default = Component;
30
30
  //# sourceMappingURL=radio-custom-label.story.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio-custom-label.story.js","sourceRoot":"","sources":["../../../../src/radio/stories/radio-custom-label.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAAqD;AAErD,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,uBAAC,aAAK,IACJ,KAAK,EAAE,uBAAC,kBAAU,IAAC,OAAO,EAAC,SAAS,6BAA0B,EAC9D,SAAS,EAAC,oBAAoB,GAC9B,CACH,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 { Radio, Typography } from '@neo4j-ndl/react';\n\nconst Component = () => {\n return (\n <Radio\n label={<Typography variant=\"title-4\">Custom label</Typography>}\n ariaLabel=\"example aria label\"\n />\n );\n};\n\nexport default Component;\n"]}
1
+ {"version":3,"file":"radio-custom-label.story.js","sourceRoot":"","sources":["../../../../src/radio/stories/radio-custom-label.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAAqD;AAErD,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,uBAAC,aAAK,IACJ,KAAK,EAAE,uBAAC,kBAAU,IAAC,OAAO,EAAC,OAAO,6BAA0B,EAC5D,SAAS,EAAC,oBAAoB,GAC9B,CACH,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 { Radio, Typography } from '@neo4j-ndl/react';\n\nconst Component = () => {\n return (\n <Radio\n label={<Typography variant=\"label\">Custom label</Typography>}\n ariaLabel=\"example aria label\"\n />\n );\n};\n\nexport default Component;\n"]}
@@ -25,7 +25,7 @@ require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
25
25
  const react_1 = require("@neo4j-ndl/react");
26
26
  const icons_1 = require("@neo4j-ndl/react/icons");
27
27
  const Component = () => {
28
- return ((0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-col n-gap-token-16", children: [(0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-row n-gap-token-16 n-items-center", children: [(0, jsx_runtime_1.jsx)(react_1.SelectIconButton, { description: "Select", size: "small", isOpen: false, children: (0, jsx_runtime_1.jsx)(icons_1.SelectIcon, {}) }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "title-4", children: " Small" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-row n-gap-token-16 n-items-center", children: [(0, jsx_runtime_1.jsx)(react_1.SelectIconButton, { description: "Select", size: "medium", isOpen: false, children: (0, jsx_runtime_1.jsx)(icons_1.SelectIcon, {}) }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "title-4", children: " Medium" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-row n-gap-token-16 n-items-center", children: [(0, jsx_runtime_1.jsx)(react_1.SelectIconButton, { description: "Select", size: "large", isOpen: false, children: (0, jsx_runtime_1.jsx)(icons_1.SelectIcon, {}) }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "title-4", children: " Large" })] })] }));
28
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-col n-gap-token-16", children: [(0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-row n-gap-token-16 n-items-center", children: [(0, jsx_runtime_1.jsx)(react_1.SelectIconButton, { description: "Select", size: "small", isOpen: false, children: (0, jsx_runtime_1.jsx)(icons_1.SelectIcon, {}) }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "label", children: " Small" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-row n-gap-token-16 n-items-center", children: [(0, jsx_runtime_1.jsx)(react_1.SelectIconButton, { description: "Select", size: "medium", isOpen: false, children: (0, jsx_runtime_1.jsx)(icons_1.SelectIcon, {}) }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "label", children: " Medium" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-row n-gap-token-16 n-items-center", children: [(0, jsx_runtime_1.jsx)(react_1.SelectIconButton, { description: "Select", size: "large", isOpen: false, children: (0, jsx_runtime_1.jsx)(icons_1.SelectIcon, {}) }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "label", children: " Large" })] })] }));
29
29
  };
30
30
  exports.default = Component;
31
31
  //# sourceMappingURL=select-icon-button-sizes.story.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select-icon-button-sizes.story.js","sourceRoot":"","sources":["../../../../src/select-icon-button/stories/select-icon-button-sizes.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAAgE;AAChE,kDAAoD;AAEpD,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,iCAAK,SAAS,EAAC,kCAAkC,aAC/C,iCAAK,SAAS,EAAC,iDAAiD,aAC9D,uBAAC,wBAAgB,IAAC,WAAW,EAAC,QAAQ,EAAC,IAAI,EAAC,OAAO,EAAC,MAAM,EAAE,KAAK,YAC/D,uBAAC,kBAAU,KAAG,GACG,EACnB,uBAAC,kBAAU,IAAC,OAAO,EAAC,SAAS,uBAAoB,IAC7C,EACN,iCAAK,SAAS,EAAC,iDAAiD,aAC9D,uBAAC,wBAAgB,IAAC,WAAW,EAAC,QAAQ,EAAC,IAAI,EAAC,QAAQ,EAAC,MAAM,EAAE,KAAK,YAChE,uBAAC,kBAAU,KAAG,GACG,EACnB,uBAAC,kBAAU,IAAC,OAAO,EAAC,SAAS,wBAAqB,IAC9C,EACN,iCAAK,SAAS,EAAC,iDAAiD,aAC9D,uBAAC,wBAAgB,IAAC,WAAW,EAAC,QAAQ,EAAC,IAAI,EAAC,OAAO,EAAC,MAAM,EAAE,KAAK,YAC/D,uBAAC,kBAAU,KAAG,GACG,EACnB,uBAAC,kBAAU,IAAC,OAAO,EAAC,SAAS,uBAAoB,IAC7C,IACF,CACP,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 { SelectIconButton, Typography } from '@neo4j-ndl/react';\nimport { SelectIcon } from '@neo4j-ndl/react/icons';\n\nconst Component = () => {\n return (\n <div className=\"n-flex n-flex-col n-gap-token-16\">\n <div className=\"n-flex n-flex-row n-gap-token-16 n-items-center\">\n <SelectIconButton description=\"Select\" size=\"small\" isOpen={false}>\n <SelectIcon />\n </SelectIconButton>\n <Typography variant=\"title-4\"> Small</Typography>\n </div>\n <div className=\"n-flex n-flex-row n-gap-token-16 n-items-center\">\n <SelectIconButton description=\"Select\" size=\"medium\" isOpen={false}>\n <SelectIcon />\n </SelectIconButton>\n <Typography variant=\"title-4\"> Medium</Typography>\n </div>\n <div className=\"n-flex n-flex-row n-gap-token-16 n-items-center\">\n <SelectIconButton description=\"Select\" size=\"large\" isOpen={false}>\n <SelectIcon />\n </SelectIconButton>\n <Typography variant=\"title-4\"> Large</Typography>\n </div>\n </div>\n );\n};\n\nexport default Component;\n"]}
1
+ {"version":3,"file":"select-icon-button-sizes.story.js","sourceRoot":"","sources":["../../../../src/select-icon-button/stories/select-icon-button-sizes.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAAgE;AAChE,kDAAoD;AAEpD,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,iCAAK,SAAS,EAAC,kCAAkC,aAC/C,iCAAK,SAAS,EAAC,iDAAiD,aAC9D,uBAAC,wBAAgB,IAAC,WAAW,EAAC,QAAQ,EAAC,IAAI,EAAC,OAAO,EAAC,MAAM,EAAE,KAAK,YAC/D,uBAAC,kBAAU,KAAG,GACG,EACnB,uBAAC,kBAAU,IAAC,OAAO,EAAC,OAAO,uBAAoB,IAC3C,EACN,iCAAK,SAAS,EAAC,iDAAiD,aAC9D,uBAAC,wBAAgB,IAAC,WAAW,EAAC,QAAQ,EAAC,IAAI,EAAC,QAAQ,EAAC,MAAM,EAAE,KAAK,YAChE,uBAAC,kBAAU,KAAG,GACG,EACnB,uBAAC,kBAAU,IAAC,OAAO,EAAC,OAAO,wBAAqB,IAC5C,EACN,iCAAK,SAAS,EAAC,iDAAiD,aAC9D,uBAAC,wBAAgB,IAAC,WAAW,EAAC,QAAQ,EAAC,IAAI,EAAC,OAAO,EAAC,MAAM,EAAE,KAAK,YAC/D,uBAAC,kBAAU,KAAG,GACG,EACnB,uBAAC,kBAAU,IAAC,OAAO,EAAC,OAAO,uBAAoB,IAC3C,IACF,CACP,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 { SelectIconButton, Typography } from '@neo4j-ndl/react';\nimport { SelectIcon } from '@neo4j-ndl/react/icons';\n\nconst Component = () => {\n return (\n <div className=\"n-flex n-flex-col n-gap-token-16\">\n <div className=\"n-flex n-flex-row n-gap-token-16 n-items-center\">\n <SelectIconButton description=\"Select\" size=\"small\" isOpen={false}>\n <SelectIcon />\n </SelectIconButton>\n <Typography variant=\"label\"> Small</Typography>\n </div>\n <div className=\"n-flex n-flex-row n-gap-token-16 n-items-center\">\n <SelectIconButton description=\"Select\" size=\"medium\" isOpen={false}>\n <SelectIcon />\n </SelectIconButton>\n <Typography variant=\"label\"> Medium</Typography>\n </div>\n <div className=\"n-flex n-flex-row n-gap-token-16 n-items-center\">\n <SelectIconButton description=\"Select\" size=\"large\" isOpen={false}>\n <SelectIcon />\n </SelectIconButton>\n <Typography variant=\"label\"> Large</Typography>\n </div>\n </div>\n );\n};\n\nexport default Component;\n"]}
@@ -25,7 +25,7 @@ require("@neo4j-ndl/base/lib/neo4j-ds-styles.css");
25
25
  const react_1 = require("@neo4j-ndl/react");
26
26
  const icons_1 = require("@neo4j-ndl/react/icons");
27
27
  const Component = () => {
28
- return ((0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-col n-gap-token-16", children: [(0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-row n-gap-token-16 n-items-center", children: [(0, jsx_runtime_1.jsx)(react_1.SelectIconButton, { description: "Select", size: "small", isDisabled: true, isOpen: false, children: (0, jsx_runtime_1.jsx)(icons_1.SelectIcon, {}) }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "title-4", children: " Disabled" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-row n-gap-token-16 n-items-center", children: [(0, jsx_runtime_1.jsx)(react_1.SelectIconButton, { description: "Select", size: "small", isOpen: true, children: (0, jsx_runtime_1.jsx)(icons_1.SelectIcon, {}) }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "title-4", children: " Active" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-row n-gap-token-16 n-items-center", children: [(0, jsx_runtime_1.jsx)(react_1.SelectIconButton, { description: "Select", size: "small", isLoading: true, loadingMessage: "Loading", isOpen: false, children: (0, jsx_runtime_1.jsx)(icons_1.SelectIcon, {}) }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "title-4", children: " Loading" })] })] }));
28
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-col n-gap-token-16", children: [(0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-row n-gap-token-16 n-items-center", children: [(0, jsx_runtime_1.jsx)(react_1.SelectIconButton, { description: "Select", size: "small", isDisabled: true, isOpen: false, children: (0, jsx_runtime_1.jsx)(icons_1.SelectIcon, {}) }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "label", children: " Disabled" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-row n-gap-token-16 n-items-center", children: [(0, jsx_runtime_1.jsx)(react_1.SelectIconButton, { description: "Select", size: "small", isOpen: true, children: (0, jsx_runtime_1.jsx)(icons_1.SelectIcon, {}) }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "label", children: " Active" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-flex-row n-gap-token-16 n-items-center", children: [(0, jsx_runtime_1.jsx)(react_1.SelectIconButton, { description: "Select", size: "small", isLoading: true, loadingMessage: "Loading", isOpen: false, children: (0, jsx_runtime_1.jsx)(icons_1.SelectIcon, {}) }), (0, jsx_runtime_1.jsx)(react_1.Typography, { variant: "label", children: " Loading" })] })] }));
29
29
  };
30
30
  exports.default = Component;
31
31
  //# sourceMappingURL=select-icon-button-states.story.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select-icon-button-states.story.js","sourceRoot":"","sources":["../../../../src/select-icon-button/stories/select-icon-button-states.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAAgE;AAChE,kDAAoD;AAEpD,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,iCAAK,SAAS,EAAC,kCAAkC,aAC/C,iCAAK,SAAS,EAAC,iDAAiD,aAC9D,uBAAC,wBAAgB,IACf,WAAW,EAAC,QAAQ,EACpB,IAAI,EAAC,OAAO,EACZ,UAAU,QACV,MAAM,EAAE,KAAK,YAEb,uBAAC,kBAAU,KAAG,GACG,EACnB,uBAAC,kBAAU,IAAC,OAAO,EAAC,SAAS,0BAAuB,IAChD,EACN,iCAAK,SAAS,EAAC,iDAAiD,aAC9D,uBAAC,wBAAgB,IAAC,WAAW,EAAC,QAAQ,EAAC,IAAI,EAAC,OAAO,EAAC,MAAM,EAAE,IAAI,YAC9D,uBAAC,kBAAU,KAAG,GACG,EACnB,uBAAC,kBAAU,IAAC,OAAO,EAAC,SAAS,wBAAqB,IAC9C,EACN,iCAAK,SAAS,EAAC,iDAAiD,aAC9D,uBAAC,wBAAgB,IACf,WAAW,EAAC,QAAQ,EACpB,IAAI,EAAC,OAAO,EACZ,SAAS,QACT,cAAc,EAAC,SAAS,EACxB,MAAM,EAAE,KAAK,YAEb,uBAAC,kBAAU,KAAG,GACG,EACnB,uBAAC,kBAAU,IAAC,OAAO,EAAC,SAAS,yBAAsB,IAC/C,IACF,CACP,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 { SelectIconButton, Typography } from '@neo4j-ndl/react';\nimport { SelectIcon } from '@neo4j-ndl/react/icons';\n\nconst Component = () => {\n return (\n <div className=\"n-flex n-flex-col n-gap-token-16\">\n <div className=\"n-flex n-flex-row n-gap-token-16 n-items-center\">\n <SelectIconButton\n description=\"Select\"\n size=\"small\"\n isDisabled\n isOpen={false}\n >\n <SelectIcon />\n </SelectIconButton>\n <Typography variant=\"title-4\"> Disabled</Typography>\n </div>\n <div className=\"n-flex n-flex-row n-gap-token-16 n-items-center\">\n <SelectIconButton description=\"Select\" size=\"small\" isOpen={true}>\n <SelectIcon />\n </SelectIconButton>\n <Typography variant=\"title-4\"> Active</Typography>\n </div>\n <div className=\"n-flex n-flex-row n-gap-token-16 n-items-center\">\n <SelectIconButton\n description=\"Select\"\n size=\"small\"\n isLoading\n loadingMessage=\"Loading\"\n isOpen={false}\n >\n <SelectIcon />\n </SelectIconButton>\n <Typography variant=\"title-4\"> Loading</Typography>\n </div>\n </div>\n );\n};\n\nexport default Component;\n"]}
1
+ {"version":3,"file":"select-icon-button-states.story.js","sourceRoot":"","sources":["../../../../src/select-icon-button/stories/select-icon-button-states.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,mDAAiD;AAEjD,4CAAgE;AAChE,kDAAoD;AAEpD,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,OAAO,CACL,iCAAK,SAAS,EAAC,kCAAkC,aAC/C,iCAAK,SAAS,EAAC,iDAAiD,aAC9D,uBAAC,wBAAgB,IACf,WAAW,EAAC,QAAQ,EACpB,IAAI,EAAC,OAAO,EACZ,UAAU,QACV,MAAM,EAAE,KAAK,YAEb,uBAAC,kBAAU,KAAG,GACG,EACnB,uBAAC,kBAAU,IAAC,OAAO,EAAC,OAAO,0BAAuB,IAC9C,EACN,iCAAK,SAAS,EAAC,iDAAiD,aAC9D,uBAAC,wBAAgB,IAAC,WAAW,EAAC,QAAQ,EAAC,IAAI,EAAC,OAAO,EAAC,MAAM,EAAE,IAAI,YAC9D,uBAAC,kBAAU,KAAG,GACG,EACnB,uBAAC,kBAAU,IAAC,OAAO,EAAC,OAAO,wBAAqB,IAC5C,EACN,iCAAK,SAAS,EAAC,iDAAiD,aAC9D,uBAAC,wBAAgB,IACf,WAAW,EAAC,QAAQ,EACpB,IAAI,EAAC,OAAO,EACZ,SAAS,QACT,cAAc,EAAC,SAAS,EACxB,MAAM,EAAE,KAAK,YAEb,uBAAC,kBAAU,KAAG,GACG,EACnB,uBAAC,kBAAU,IAAC,OAAO,EAAC,OAAO,yBAAsB,IAC7C,IACF,CACP,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 { SelectIconButton, Typography } from '@neo4j-ndl/react';\nimport { SelectIcon } from '@neo4j-ndl/react/icons';\n\nconst Component = () => {\n return (\n <div className=\"n-flex n-flex-col n-gap-token-16\">\n <div className=\"n-flex n-flex-row n-gap-token-16 n-items-center\">\n <SelectIconButton\n description=\"Select\"\n size=\"small\"\n isDisabled\n isOpen={false}\n >\n <SelectIcon />\n </SelectIconButton>\n <Typography variant=\"label\"> Disabled</Typography>\n </div>\n <div className=\"n-flex n-flex-row n-gap-token-16 n-items-center\">\n <SelectIconButton description=\"Select\" size=\"small\" isOpen={true}>\n <SelectIcon />\n </SelectIconButton>\n <Typography variant=\"label\"> Active</Typography>\n </div>\n <div className=\"n-flex n-flex-row n-gap-token-16 n-items-center\">\n <SelectIconButton\n description=\"Select\"\n size=\"small\"\n isLoading\n loadingMessage=\"Loading\"\n isOpen={false}\n >\n <SelectIcon />\n </SelectIconButton>\n <Typography variant=\"label\"> Loading</Typography>\n </div>\n </div>\n );\n};\n\nexport default Component;\n"]}
@@ -305,7 +305,7 @@ const CategoryHeader = (_a) => {
305
305
  const classes = (0, classnames_1.default)('ndl-side-nav-category-header', className, {
306
306
  'ndl-side-nav-category-header-expanded': isExpanded || isHovered,
307
307
  });
308
- return ((0, jsx_runtime_1.jsx)(typography_1.Typography, Object.assign({ ref: ref, variant: "title-4", as: "li", className: classes, htmlAttributes: Object.assign(Object.assign({}, htmlAttributes), { role: 'separator' }), style: style }, restProps, { children: isExpanded || isHovered ? children : (0, jsx_runtime_1.jsx)(divider_1.Divider, {}) })));
308
+ return ((0, jsx_runtime_1.jsx)(typography_1.Typography, Object.assign({ ref: ref, variant: "label", as: "li", className: classes, htmlAttributes: Object.assign(Object.assign({}, htmlAttributes), { role: 'separator' }), style: style }, restProps, { children: isExpanded || isHovered ? children : (0, jsx_runtime_1.jsx)(divider_1.Divider, {}) })));
309
309
  };
310
310
  /**
311
311
  * SelectedIndicator