@neo4j-ndl/react 4.20.0 → 4.21.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 (439) hide show
  1. package/lib/cjs/_common/export-stories-utils.js +1 -1
  2. package/lib/cjs/_common/export-stories-utils.js.map +1 -1
  3. package/lib/cjs/_common/utils.js +3 -3
  4. package/lib/cjs/_common/utils.js.map +1 -1
  5. package/lib/cjs/_generated/style-rules/color-utils.js +3 -0
  6. package/lib/cjs/_generated/style-rules/color-utils.js.map +1 -1
  7. package/lib/cjs/_generated/style-rules/date-utils.js +14 -13
  8. package/lib/cjs/_generated/style-rules/date-utils.js.map +1 -1
  9. package/lib/cjs/_generated/style-rules/literal-schemas.js +5 -3
  10. package/lib/cjs/_generated/style-rules/literal-schemas.js.map +1 -1
  11. package/lib/cjs/ai/code-preview/CodePreview.js +1 -1
  12. package/lib/cjs/ai/code-preview/CodePreview.js.map +1 -1
  13. package/lib/cjs/ai/file-tag/FileTag.js.map +1 -1
  14. package/lib/cjs/ai/image-tag/ImageTag.js.map +1 -1
  15. package/lib/cjs/ai/prompt/Prompt.js +10 -10
  16. package/lib/cjs/ai/prompt/Prompt.js.map +1 -1
  17. package/lib/cjs/ai/prompt/stories/prompt-advanced.story.js +1 -1
  18. package/lib/cjs/ai/prompt/stories/prompt-advanced.story.js.map +1 -1
  19. package/lib/cjs/ai/prompt/stories/prompt-context.story.js +1 -1
  20. package/lib/cjs/ai/prompt/stories/prompt-context.story.js.map +1 -1
  21. package/lib/cjs/ai/prompt/stories/prompt-default.story.js +1 -1
  22. package/lib/cjs/ai/prompt/stories/prompt-default.story.js.map +1 -1
  23. package/lib/cjs/ai/prompt/stories/prompt-header.story.js +1 -1
  24. package/lib/cjs/ai/prompt/stories/prompt-header.story.js.map +1 -1
  25. package/lib/cjs/ai/response/Response.js +4 -4
  26. package/lib/cjs/ai/response/Response.js.map +1 -1
  27. package/lib/cjs/ai/response/stories/response-full-example.story.js +1 -1
  28. package/lib/cjs/ai/response/stories/response-full-example.story.js.map +1 -1
  29. package/lib/cjs/ai/suggestion/Suggestion.js.map +1 -1
  30. package/lib/cjs/ai/thinking/thinking-duration-formatter.js +5 -5
  31. package/lib/cjs/ai/thinking/thinking-duration-formatter.js.map +1 -1
  32. package/lib/cjs/banner/Banner.js +2 -2
  33. package/lib/cjs/banner/Banner.js.map +1 -1
  34. package/lib/cjs/button/ButtonBase.js +4 -4
  35. package/lib/cjs/button/ButtonBase.js.map +1 -1
  36. package/lib/cjs/code/Code.js +3 -3
  37. package/lib/cjs/code/Code.js.map +1 -1
  38. package/lib/cjs/code-block/CodeBlock.js +2 -2
  39. package/lib/cjs/code-block/CodeBlock.js.map +1 -1
  40. package/lib/cjs/color-picker/ColorPicker.js +22 -22
  41. package/lib/cjs/color-picker/ColorPicker.js.map +1 -1
  42. package/lib/cjs/color-picker/stories/color-picker-custom-swatches.story.js +20 -20
  43. package/lib/cjs/color-picker/stories/color-picker-custom-swatches.story.js.map +1 -1
  44. package/lib/cjs/color-picker/stories/color-picker-default.story.js +4 -4
  45. package/lib/cjs/color-picker/stories/color-picker-default.story.js.map +1 -1
  46. package/lib/cjs/color-picker/stories/color-picker-dialog.story.js +4 -4
  47. package/lib/cjs/color-picker/stories/color-picker-dialog.story.js.map +1 -1
  48. package/lib/cjs/color-picker/stories/color-picker-without-eyedropper.story.js +4 -4
  49. package/lib/cjs/color-picker/stories/color-picker-without-eyedropper.story.js.map +1 -1
  50. package/lib/cjs/combobox/stories/combobox-large-data-set.story.js +1 -1
  51. package/lib/cjs/combobox/stories/combobox-large-data-set.story.js.map +1 -1
  52. package/lib/cjs/data-grid/Components.js +20 -20
  53. package/lib/cjs/data-grid/Components.js.map +1 -1
  54. package/lib/cjs/data-grid/DataGrid.js +3 -3
  55. package/lib/cjs/data-grid/DataGrid.js.map +1 -1
  56. package/lib/cjs/data-grid/data-grid-nav/data-grid-nav.js +55 -54
  57. package/lib/cjs/data-grid/data-grid-nav/data-grid-nav.js.map +1 -1
  58. package/lib/cjs/data-grid/data-grid-nav/helpers.js +1 -1
  59. package/lib/cjs/data-grid/data-grid-nav/helpers.js.map +1 -1
  60. package/lib/cjs/data-grid/data-grid-nav/index.js +2 -2
  61. package/lib/cjs/data-grid/data-grid-nav/index.js.map +1 -1
  62. package/lib/cjs/data-grid/helpers/index.js +42 -40
  63. package/lib/cjs/data-grid/helpers/index.js.map +1 -1
  64. package/lib/cjs/data-grid/stories/datagrid-in-dialog.story.js +10 -7
  65. package/lib/cjs/data-grid/stories/datagrid-in-dialog.story.js.map +1 -1
  66. package/lib/cjs/data-grid/stories/datagrid-keyboard-navigation.story.js +10 -7
  67. package/lib/cjs/data-grid/stories/datagrid-keyboard-navigation.story.js.map +1 -1
  68. package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +5 -5
  69. package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -1
  70. package/lib/cjs/data-grid/stories/datagrid-search-and-filters.stories.js +1 -1
  71. package/lib/cjs/data-grid/stories/datagrid-search-and-filters.stories.js.map +1 -1
  72. package/lib/cjs/data-grid/stories/datagrid-virtualization.story.js +5 -5
  73. package/lib/cjs/data-grid/stories/datagrid-virtualization.story.js.map +1 -1
  74. package/lib/cjs/data-grid/style-rules/evaluate.js +23 -23
  75. package/lib/cjs/data-grid/style-rules/evaluate.js.map +1 -1
  76. package/lib/cjs/data-grid/style-rules/types.js +1 -1
  77. package/lib/cjs/data-grid/style-rules/types.js.map +1 -1
  78. package/lib/cjs/dialog/Dialog.js +5 -5
  79. package/lib/cjs/dialog/Dialog.js.map +1 -1
  80. package/lib/cjs/dialog/dialog-types.js.map +1 -1
  81. package/lib/cjs/drawer/Drawer.js +5 -5
  82. package/lib/cjs/drawer/Drawer.js.map +1 -1
  83. package/lib/cjs/dropdown-button/DropdownButton.js +4 -4
  84. package/lib/cjs/dropdown-button/DropdownButton.js.map +1 -1
  85. package/lib/cjs/dropzone/stories/dropzone-full.story.js +1 -1
  86. package/lib/cjs/dropzone/stories/dropzone-full.story.js.map +1 -1
  87. package/lib/cjs/flex/stories/flex-default.story.js +1 -1
  88. package/lib/cjs/flex/stories/flex-default.story.js.map +1 -1
  89. package/lib/cjs/hooks/index.js +3 -3
  90. package/lib/cjs/hooks/index.js.map +1 -1
  91. package/lib/cjs/icon-button-base/IconButtonBase.js +4 -4
  92. package/lib/cjs/icon-button-base/IconButtonBase.js.map +1 -1
  93. package/lib/cjs/icons/generated/custom/ScatterPlot.js +30 -0
  94. package/lib/cjs/icons/generated/custom/ScatterPlot.js.map +1 -0
  95. package/lib/cjs/icons/generated/custom/index.js +4 -2
  96. package/lib/cjs/icons/generated/custom/index.js.map +1 -1
  97. package/lib/cjs/inline-edit/InlineEdit.js +8 -8
  98. package/lib/cjs/inline-edit/InlineEdit.js.map +1 -1
  99. package/lib/cjs/kbd/kbd-utils.js +2 -2
  100. package/lib/cjs/kbd/kbd-utils.js.map +1 -1
  101. package/lib/cjs/modal/Modal.js +6 -6
  102. package/lib/cjs/modal/Modal.js.map +1 -1
  103. package/lib/cjs/next/tree-view/TreeView.js +23 -23
  104. package/lib/cjs/next/tree-view/TreeView.js.map +1 -1
  105. package/lib/cjs/next/tree-view/stories/tree-view-lazy.story.js +1 -1
  106. package/lib/cjs/next/tree-view/stories/tree-view-lazy.story.js.map +1 -1
  107. package/lib/cjs/next/tree-view/stories/tree-view-multi.story.js +6 -6
  108. package/lib/cjs/next/tree-view/stories/tree-view-multi.story.js.map +1 -1
  109. package/lib/cjs/popover/Popover.js.map +1 -1
  110. package/lib/cjs/popover/stories/popover-custom-offset.story.js +3 -3
  111. package/lib/cjs/popover/stories/popover-custom-offset.story.js.map +1 -1
  112. package/lib/cjs/popover/use-popover.js +2 -0
  113. package/lib/cjs/popover/use-popover.js.map +1 -1
  114. package/lib/cjs/segmented-control/SegmentedControl.js.map +1 -1
  115. package/lib/cjs/select/Overrides.js +30 -30
  116. package/lib/cjs/select/Overrides.js.map +1 -1
  117. package/lib/cjs/select-icon-button/SelectIconButton.js +4 -4
  118. package/lib/cjs/select-icon-button/SelectIconButton.js.map +1 -1
  119. package/lib/cjs/selectable-tag/stories/selectable-tag-sizes.story.js +1 -1
  120. package/lib/cjs/selectable-tag/stories/selectable-tag-sizes.story.js.map +1 -1
  121. package/lib/cjs/side-navigation/SideNavigation.js +9 -9
  122. package/lib/cjs/side-navigation/SideNavigation.js.map +1 -1
  123. package/lib/cjs/slider/Slider.js +1 -1
  124. package/lib/cjs/slider/Slider.js.map +1 -1
  125. package/lib/cjs/slider/stories/slider-single-controlled.story.js +2 -2
  126. package/lib/cjs/slider/stories/slider-single-controlled.story.js.map +1 -1
  127. package/lib/cjs/spotlight/Spotlight.js +6 -6
  128. package/lib/cjs/spotlight/Spotlight.js.map +1 -1
  129. package/lib/cjs/spotlight/SpotlightProvider.js +6 -6
  130. package/lib/cjs/spotlight/SpotlightProvider.js.map +1 -1
  131. package/lib/cjs/spotlight/SpotlightTarget.js +18 -16
  132. package/lib/cjs/spotlight/SpotlightTarget.js.map +1 -1
  133. package/lib/cjs/status-indicator/StatusIndicator.js +4 -2
  134. package/lib/cjs/status-indicator/StatusIndicator.js.map +1 -1
  135. package/lib/cjs/tabs/Tabs.js +3 -3
  136. package/lib/cjs/tabs/Tabs.js.map +1 -1
  137. package/lib/cjs/tabs/use-tabs-scroll-overflow.js +2 -2
  138. package/lib/cjs/tabs/use-tabs-scroll-overflow.js.map +1 -1
  139. package/lib/cjs/text-input/stories/text-input-full.story.js +1 -1
  140. package/lib/cjs/text-input/stories/text-input-full.story.js.map +1 -1
  141. package/lib/cjs/text-input/stories/text-input-with-icons.story.js +1 -1
  142. package/lib/cjs/text-input/stories/text-input-with-icons.story.js.map +1 -1
  143. package/lib/cjs/theme/agnostic.js +4 -4
  144. package/lib/cjs/theme/agnostic.js.map +1 -1
  145. package/lib/cjs/time-picker/TimePicker.js +24 -24
  146. package/lib/cjs/time-picker/TimePicker.js.map +1 -1
  147. package/lib/cjs/time-picker/generate-time-options.js +3 -3
  148. package/lib/cjs/time-picker/generate-time-options.js.map +1 -1
  149. package/lib/cjs/timezone-picker/TimeZonePicker.js +44 -44
  150. package/lib/cjs/timezone-picker/TimeZonePicker.js.map +1 -1
  151. package/lib/cjs/timezone-picker/generate-timezone-options.js +5 -5
  152. package/lib/cjs/timezone-picker/generate-timezone-options.js.map +1 -1
  153. package/lib/cjs/toast/ToastControlled.js +1 -1
  154. package/lib/cjs/toast/ToastControlled.js.map +1 -1
  155. package/lib/cjs/tooltip/use-tooltip.js +8 -1
  156. package/lib/cjs/tooltip/use-tooltip.js.map +1 -1
  157. package/lib/cjs/tree-view/TreeItemWrapper.js +8 -8
  158. package/lib/cjs/tree-view/TreeItemWrapper.js.map +1 -1
  159. package/lib/cjs/tree-view/TreeView.js +6 -2
  160. package/lib/cjs/tree-view/TreeView.js.map +1 -1
  161. package/lib/cjs/tree-view/TreeViewTextItem.js +17 -17
  162. package/lib/cjs/tree-view/TreeViewTextItem.js.map +1 -1
  163. package/lib/cjs/tree-view/tree-view-keyboard-coordinates.js +2 -0
  164. package/lib/cjs/tree-view/tree-view-keyboard-coordinates.js.map +1 -1
  165. package/lib/cjs/tree-view/tree-view-utils.js +12 -12
  166. package/lib/cjs/tree-view/tree-view-utils.js.map +1 -1
  167. package/lib/esm/_common/export-stories-utils.js +1 -1
  168. package/lib/esm/_common/export-stories-utils.js.map +1 -1
  169. package/lib/esm/_common/utils.js +3 -3
  170. package/lib/esm/_common/utils.js.map +1 -1
  171. package/lib/esm/_generated/style-rules/color-utils.js +3 -0
  172. package/lib/esm/_generated/style-rules/color-utils.js.map +1 -1
  173. package/lib/esm/_generated/style-rules/date-utils.js +14 -13
  174. package/lib/esm/_generated/style-rules/date-utils.js.map +1 -1
  175. package/lib/esm/_generated/style-rules/literal-schemas.js +5 -3
  176. package/lib/esm/_generated/style-rules/literal-schemas.js.map +1 -1
  177. package/lib/esm/ai/code-preview/CodePreview.js +1 -1
  178. package/lib/esm/ai/code-preview/CodePreview.js.map +1 -1
  179. package/lib/esm/ai/file-tag/FileTag.js.map +1 -1
  180. package/lib/esm/ai/image-tag/ImageTag.js.map +1 -1
  181. package/lib/esm/ai/prompt/Prompt.js +10 -10
  182. package/lib/esm/ai/prompt/Prompt.js.map +1 -1
  183. package/lib/esm/ai/prompt/stories/prompt-advanced.story.js +1 -1
  184. package/lib/esm/ai/prompt/stories/prompt-advanced.story.js.map +1 -1
  185. package/lib/esm/ai/prompt/stories/prompt-context.story.js +1 -1
  186. package/lib/esm/ai/prompt/stories/prompt-context.story.js.map +1 -1
  187. package/lib/esm/ai/prompt/stories/prompt-default.story.js +1 -1
  188. package/lib/esm/ai/prompt/stories/prompt-default.story.js.map +1 -1
  189. package/lib/esm/ai/prompt/stories/prompt-header.story.js +1 -1
  190. package/lib/esm/ai/prompt/stories/prompt-header.story.js.map +1 -1
  191. package/lib/esm/ai/response/Response.js +4 -4
  192. package/lib/esm/ai/response/Response.js.map +1 -1
  193. package/lib/esm/ai/response/stories/response-full-example.story.js +1 -1
  194. package/lib/esm/ai/response/stories/response-full-example.story.js.map +1 -1
  195. package/lib/esm/ai/suggestion/Suggestion.js.map +1 -1
  196. package/lib/esm/ai/thinking/thinking-duration-formatter.js +5 -5
  197. package/lib/esm/ai/thinking/thinking-duration-formatter.js.map +1 -1
  198. package/lib/esm/banner/Banner.js +2 -2
  199. package/lib/esm/banner/Banner.js.map +1 -1
  200. package/lib/esm/button/ButtonBase.js +4 -4
  201. package/lib/esm/button/ButtonBase.js.map +1 -1
  202. package/lib/esm/code/Code.js +3 -3
  203. package/lib/esm/code/Code.js.map +1 -1
  204. package/lib/esm/code-block/CodeBlock.js +2 -2
  205. package/lib/esm/code-block/CodeBlock.js.map +1 -1
  206. package/lib/esm/color-picker/ColorPicker.js +22 -22
  207. package/lib/esm/color-picker/ColorPicker.js.map +1 -1
  208. package/lib/esm/color-picker/stories/color-picker-custom-swatches.story.js +20 -20
  209. package/lib/esm/color-picker/stories/color-picker-custom-swatches.story.js.map +1 -1
  210. package/lib/esm/color-picker/stories/color-picker-default.story.js +4 -4
  211. package/lib/esm/color-picker/stories/color-picker-default.story.js.map +1 -1
  212. package/lib/esm/color-picker/stories/color-picker-dialog.story.js +4 -4
  213. package/lib/esm/color-picker/stories/color-picker-dialog.story.js.map +1 -1
  214. package/lib/esm/color-picker/stories/color-picker-without-eyedropper.story.js +4 -4
  215. package/lib/esm/color-picker/stories/color-picker-without-eyedropper.story.js.map +1 -1
  216. package/lib/esm/combobox/stories/combobox-large-data-set.story.js +1 -1
  217. package/lib/esm/combobox/stories/combobox-large-data-set.story.js.map +1 -1
  218. package/lib/esm/data-grid/Components.js +20 -20
  219. package/lib/esm/data-grid/Components.js.map +1 -1
  220. package/lib/esm/data-grid/DataGrid.js +3 -3
  221. package/lib/esm/data-grid/DataGrid.js.map +1 -1
  222. package/lib/esm/data-grid/data-grid-nav/data-grid-nav.js +55 -54
  223. package/lib/esm/data-grid/data-grid-nav/data-grid-nav.js.map +1 -1
  224. package/lib/esm/data-grid/data-grid-nav/helpers.js +1 -1
  225. package/lib/esm/data-grid/data-grid-nav/helpers.js.map +1 -1
  226. package/lib/esm/data-grid/data-grid-nav/index.js +2 -2
  227. package/lib/esm/data-grid/data-grid-nav/index.js.map +1 -1
  228. package/lib/esm/data-grid/helpers/index.js +42 -40
  229. package/lib/esm/data-grid/helpers/index.js.map +1 -1
  230. package/lib/esm/data-grid/stories/datagrid-in-dialog.story.js +10 -7
  231. package/lib/esm/data-grid/stories/datagrid-in-dialog.story.js.map +1 -1
  232. package/lib/esm/data-grid/stories/datagrid-keyboard-navigation.story.js +10 -7
  233. package/lib/esm/data-grid/stories/datagrid-keyboard-navigation.story.js.map +1 -1
  234. package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +5 -5
  235. package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -1
  236. package/lib/esm/data-grid/stories/datagrid-search-and-filters.stories.js +1 -1
  237. package/lib/esm/data-grid/stories/datagrid-search-and-filters.stories.js.map +1 -1
  238. package/lib/esm/data-grid/stories/datagrid-virtualization.story.js +5 -5
  239. package/lib/esm/data-grid/stories/datagrid-virtualization.story.js.map +1 -1
  240. package/lib/esm/data-grid/style-rules/evaluate.js +23 -23
  241. package/lib/esm/data-grid/style-rules/evaluate.js.map +1 -1
  242. package/lib/esm/data-grid/style-rules/types.js +1 -1
  243. package/lib/esm/data-grid/style-rules/types.js.map +1 -1
  244. package/lib/esm/dialog/Dialog.js +5 -5
  245. package/lib/esm/dialog/Dialog.js.map +1 -1
  246. package/lib/esm/dialog/dialog-types.js.map +1 -1
  247. package/lib/esm/drawer/Drawer.js +5 -5
  248. package/lib/esm/drawer/Drawer.js.map +1 -1
  249. package/lib/esm/dropdown-button/DropdownButton.js +4 -4
  250. package/lib/esm/dropdown-button/DropdownButton.js.map +1 -1
  251. package/lib/esm/dropzone/stories/dropzone-full.story.js +1 -1
  252. package/lib/esm/dropzone/stories/dropzone-full.story.js.map +1 -1
  253. package/lib/esm/flex/stories/flex-default.story.js +1 -1
  254. package/lib/esm/flex/stories/flex-default.story.js.map +1 -1
  255. package/lib/esm/hooks/index.js +3 -3
  256. package/lib/esm/hooks/index.js.map +1 -1
  257. package/lib/esm/icon-button-base/IconButtonBase.js +4 -4
  258. package/lib/esm/icon-button-base/IconButtonBase.js.map +1 -1
  259. package/lib/esm/icons/generated/custom/ScatterPlot.js +28 -0
  260. package/lib/esm/icons/generated/custom/ScatterPlot.js.map +1 -0
  261. package/lib/esm/icons/generated/custom/index.js +1 -0
  262. package/lib/esm/icons/generated/custom/index.js.map +1 -1
  263. package/lib/esm/inline-edit/InlineEdit.js +8 -8
  264. package/lib/esm/inline-edit/InlineEdit.js.map +1 -1
  265. package/lib/esm/kbd/kbd-utils.js +2 -2
  266. package/lib/esm/kbd/kbd-utils.js.map +1 -1
  267. package/lib/esm/modal/Modal.js +6 -6
  268. package/lib/esm/modal/Modal.js.map +1 -1
  269. package/lib/esm/next/tree-view/TreeView.js +23 -23
  270. package/lib/esm/next/tree-view/TreeView.js.map +1 -1
  271. package/lib/esm/next/tree-view/stories/tree-view-lazy.story.js +1 -1
  272. package/lib/esm/next/tree-view/stories/tree-view-lazy.story.js.map +1 -1
  273. package/lib/esm/next/tree-view/stories/tree-view-multi.story.js +6 -6
  274. package/lib/esm/next/tree-view/stories/tree-view-multi.story.js.map +1 -1
  275. package/lib/esm/popover/Popover.js.map +1 -1
  276. package/lib/esm/popover/stories/popover-custom-offset.story.js +3 -3
  277. package/lib/esm/popover/stories/popover-custom-offset.story.js.map +1 -1
  278. package/lib/esm/popover/use-popover.js +2 -0
  279. package/lib/esm/popover/use-popover.js.map +1 -1
  280. package/lib/esm/segmented-control/SegmentedControl.js.map +1 -1
  281. package/lib/esm/select/Overrides.js +30 -30
  282. package/lib/esm/select/Overrides.js.map +1 -1
  283. package/lib/esm/select-icon-button/SelectIconButton.js +4 -4
  284. package/lib/esm/select-icon-button/SelectIconButton.js.map +1 -1
  285. package/lib/esm/selectable-tag/stories/selectable-tag-sizes.story.js +1 -1
  286. package/lib/esm/selectable-tag/stories/selectable-tag-sizes.story.js.map +1 -1
  287. package/lib/esm/side-navigation/SideNavigation.js +9 -9
  288. package/lib/esm/side-navigation/SideNavigation.js.map +1 -1
  289. package/lib/esm/slider/Slider.js +1 -1
  290. package/lib/esm/slider/Slider.js.map +1 -1
  291. package/lib/esm/slider/stories/slider-single-controlled.story.js +2 -2
  292. package/lib/esm/slider/stories/slider-single-controlled.story.js.map +1 -1
  293. package/lib/esm/spotlight/Spotlight.js +6 -6
  294. package/lib/esm/spotlight/Spotlight.js.map +1 -1
  295. package/lib/esm/spotlight/SpotlightProvider.js +6 -6
  296. package/lib/esm/spotlight/SpotlightProvider.js.map +1 -1
  297. package/lib/esm/spotlight/SpotlightTarget.js +18 -16
  298. package/lib/esm/spotlight/SpotlightTarget.js.map +1 -1
  299. package/lib/esm/status-indicator/StatusIndicator.js +4 -2
  300. package/lib/esm/status-indicator/StatusIndicator.js.map +1 -1
  301. package/lib/esm/tabs/Tabs.js +3 -3
  302. package/lib/esm/tabs/Tabs.js.map +1 -1
  303. package/lib/esm/tabs/use-tabs-scroll-overflow.js +2 -2
  304. package/lib/esm/tabs/use-tabs-scroll-overflow.js.map +1 -1
  305. package/lib/esm/text-input/stories/text-input-full.story.js +1 -1
  306. package/lib/esm/text-input/stories/text-input-full.story.js.map +1 -1
  307. package/lib/esm/text-input/stories/text-input-with-icons.story.js +1 -1
  308. package/lib/esm/text-input/stories/text-input-with-icons.story.js.map +1 -1
  309. package/lib/esm/theme/agnostic.js +3 -3
  310. package/lib/esm/theme/agnostic.js.map +1 -1
  311. package/lib/esm/time-picker/TimePicker.js +24 -24
  312. package/lib/esm/time-picker/TimePicker.js.map +1 -1
  313. package/lib/esm/time-picker/generate-time-options.js +3 -3
  314. package/lib/esm/time-picker/generate-time-options.js.map +1 -1
  315. package/lib/esm/timezone-picker/TimeZonePicker.js +44 -44
  316. package/lib/esm/timezone-picker/TimeZonePicker.js.map +1 -1
  317. package/lib/esm/timezone-picker/generate-timezone-options.js +5 -5
  318. package/lib/esm/timezone-picker/generate-timezone-options.js.map +1 -1
  319. package/lib/esm/toast/ToastControlled.js +1 -1
  320. package/lib/esm/toast/ToastControlled.js.map +1 -1
  321. package/lib/esm/tooltip/use-tooltip.js +8 -1
  322. package/lib/esm/tooltip/use-tooltip.js.map +1 -1
  323. package/lib/esm/tree-view/TreeItemWrapper.js +8 -8
  324. package/lib/esm/tree-view/TreeItemWrapper.js.map +1 -1
  325. package/lib/esm/tree-view/TreeView.js +6 -2
  326. package/lib/esm/tree-view/TreeView.js.map +1 -1
  327. package/lib/esm/tree-view/TreeViewTextItem.js +17 -17
  328. package/lib/esm/tree-view/TreeViewTextItem.js.map +1 -1
  329. package/lib/esm/tree-view/tree-view-keyboard-coordinates.js +2 -0
  330. package/lib/esm/tree-view/tree-view-keyboard-coordinates.js.map +1 -1
  331. package/lib/esm/tree-view/tree-view-utils.js +12 -12
  332. package/lib/esm/tree-view/tree-view-utils.js.map +1 -1
  333. package/lib/types/_common/export-stories-utils.d.ts +1 -1
  334. package/lib/types/_common/utils.d.ts +3 -3
  335. package/lib/types/_generated/style-rules/color-utils.d.ts.map +1 -1
  336. package/lib/types/_generated/style-rules/date-utils.d.ts +3 -3
  337. package/lib/types/_generated/style-rules/date-utils.d.ts.map +1 -1
  338. package/lib/types/_generated/style-rules/literal-schemas.d.ts.map +1 -1
  339. package/lib/types/ai/code-preview/CodePreview.d.ts +1 -1
  340. package/lib/types/ai/file-tag/FileTag.d.ts +1 -1
  341. package/lib/types/ai/file-tag/FileTag.d.ts.map +1 -1
  342. package/lib/types/ai/image-tag/ImageTag.d.ts +1 -1
  343. package/lib/types/ai/image-tag/ImageTag.d.ts.map +1 -1
  344. package/lib/types/ai/prompt/Prompt.d.ts +3 -3
  345. package/lib/types/ai/prompt/Prompt.d.ts.map +1 -1
  346. package/lib/types/ai/suggestion/Suggestion.d.ts +1 -1
  347. package/lib/types/ai/suggestion/Suggestion.d.ts.map +1 -1
  348. package/lib/types/ai/thinking/thinking-duration-formatter.d.ts +5 -5
  349. package/lib/types/banner/Banner.d.ts +1 -1
  350. package/lib/types/banner/Banner.d.ts.map +1 -1
  351. package/lib/types/button/ButtonBase.d.ts +2 -2
  352. package/lib/types/button/ButtonBase.d.ts.map +1 -1
  353. package/lib/types/code/Code.d.ts +1 -1
  354. package/lib/types/code/Code.d.ts.map +1 -1
  355. package/lib/types/data-grid/Components.d.ts +2 -2
  356. package/lib/types/data-grid/Components.d.ts.map +1 -1
  357. package/lib/types/data-grid/DataGrid.d.ts +2 -2
  358. package/lib/types/data-grid/data-grid-nav/data-grid-nav.d.ts +4 -4
  359. package/lib/types/data-grid/data-grid-nav/data-grid-nav.d.ts.map +1 -1
  360. package/lib/types/data-grid/data-grid-nav/helpers.d.ts +1 -1
  361. package/lib/types/data-grid/data-grid-nav/index.d.ts +1 -1
  362. package/lib/types/data-grid/data-grid-nav/index.d.ts.map +1 -1
  363. package/lib/types/data-grid/helpers/index.d.ts +5 -5
  364. package/lib/types/data-grid/helpers/index.d.ts.map +1 -1
  365. package/lib/types/data-grid/stories/datagrid-in-dialog.story.d.ts.map +1 -1
  366. package/lib/types/data-grid/stories/datagrid-keyboard-navigation.story.d.ts.map +1 -1
  367. package/lib/types/data-grid/stories/datagrid-pinned-columns.stories.d.ts +2 -2
  368. package/lib/types/data-grid/stories/datagrid-search-and-filters.stories.d.ts +2 -2
  369. package/lib/types/data-grid/stories/datagrid-virtualization.story.d.ts.map +1 -1
  370. package/lib/types/data-grid/style-rules/evaluate.d.ts +1 -1
  371. package/lib/types/dialog/Dialog.d.ts.map +1 -1
  372. package/lib/types/dialog/dialog-types.d.ts +1 -1
  373. package/lib/types/dialog/dialog-types.d.ts.map +1 -1
  374. package/lib/types/drawer/Drawer.d.ts +1 -1
  375. package/lib/types/drawer/Drawer.d.ts.map +1 -1
  376. package/lib/types/dropdown-button/DropdownButton.d.ts +1 -1
  377. package/lib/types/dropdown-button/DropdownButton.d.ts.map +1 -1
  378. package/lib/types/hooks/index.d.ts +3 -3
  379. package/lib/types/icon-button-base/IconButtonBase.d.ts +1 -1
  380. package/lib/types/icon-button-base/IconButtonBase.d.ts.map +1 -1
  381. package/lib/types/icons/generated/custom/ScatterPlot.d.ts +29 -0
  382. package/lib/types/icons/generated/custom/ScatterPlot.d.ts.map +1 -0
  383. package/lib/types/icons/generated/custom/index.d.ts +1 -0
  384. package/lib/types/icons/generated/custom/index.d.ts.map +1 -1
  385. package/lib/types/modal/Modal.d.ts +1 -1
  386. package/lib/types/modal/Modal.d.ts.map +1 -1
  387. package/lib/types/popover/Popover.d.ts.map +1 -1
  388. package/lib/types/popover/use-popover.d.ts.map +1 -1
  389. package/lib/types/segmented-control/SegmentedControl.d.ts +1 -1
  390. package/lib/types/segmented-control/SegmentedControl.d.ts.map +1 -1
  391. package/lib/types/select/Overrides.d.ts.map +1 -1
  392. package/lib/types/select-icon-button/SelectIconButton.d.ts +1 -1
  393. package/lib/types/select-icon-button/SelectIconButton.d.ts.map +1 -1
  394. package/lib/types/selectable-tag/stories/selectable-tag-sizes.story.d.ts.map +1 -1
  395. package/lib/types/spotlight/SpotlightProvider.d.ts.map +1 -1
  396. package/lib/types/spotlight/SpotlightTarget.d.ts +4 -3
  397. package/lib/types/spotlight/SpotlightTarget.d.ts.map +1 -1
  398. package/lib/types/status-indicator/StatusIndicator.d.ts.map +1 -1
  399. package/lib/types/tabs/Tabs.d.ts +1 -1
  400. package/lib/types/tabs/Tabs.d.ts.map +1 -1
  401. package/lib/types/theme/agnostic.d.ts +2 -2
  402. package/lib/types/theme/agnostic.d.ts.map +1 -1
  403. package/lib/types/tooltip/use-tooltip.d.ts.map +1 -1
  404. package/lib/types/tree-view/TreeView.d.ts.map +1 -1
  405. package/lib/types/tree-view/TreeViewTextItem.d.ts.map +1 -1
  406. package/lib/types/tree-view/tree-view-keyboard-coordinates.d.ts.map +1 -1
  407. package/lib/types/tree-view/tree-view-utils.d.ts +12 -12
  408. package/lib/types/tree-view/tree-view-utils.d.ts.map +1 -1
  409. package/package.json +5 -3
  410. package/skills/ndl-react/SKILL.md +54 -3
  411. package/skills/ndl-react/components/ai/file-tag.md +1 -1
  412. package/skills/ndl-react/components/ai/image-tag.md +1 -1
  413. package/skills/ndl-react/components/ai/prompt.md +10 -10
  414. package/skills/ndl-react/components/ai/response.md +1 -1
  415. package/skills/ndl-react/components/ai/suggestion.md +1 -1
  416. package/skills/ndl-react/components/banner.md +1 -1
  417. package/skills/ndl-react/components/clean-icon-button.md +1 -1
  418. package/skills/ndl-react/components/code.md +1 -1
  419. package/skills/ndl-react/components/combobox.md +1 -1
  420. package/skills/ndl-react/components/data-grid.md +35 -28
  421. package/skills/ndl-react/components/dialog.md +1 -1
  422. package/skills/ndl-react/components/drawer.md +1 -1
  423. package/skills/ndl-react/components/dropdown-button.md +1 -1
  424. package/skills/ndl-react/components/dropzone.md +1 -1
  425. package/skills/ndl-react/components/filled-button.md +2 -2
  426. package/skills/ndl-react/components/flex.md +2 -2
  427. package/skills/ndl-react/components/icon-button.md +1 -1
  428. package/skills/ndl-react/components/modal.md +1 -1
  429. package/skills/ndl-react/components/next/tree-view.md +8 -8
  430. package/skills/ndl-react/components/outlined-button.md +2 -2
  431. package/skills/ndl-react/components/popover.md +3 -3
  432. package/skills/ndl-react/components/segmented-control.md +1 -1
  433. package/skills/ndl-react/components/select-icon-button.md +1 -1
  434. package/skills/ndl-react/components/selectable-tag.md +10 -4
  435. package/skills/ndl-react/components/slider.md +2 -2
  436. package/skills/ndl-react/components/tabs.md +1 -1
  437. package/skills/ndl-react/components/text-button.md +2 -2
  438. package/skills/ndl-react/components/text-input.md +2 -2
  439. package/skills/ndl-react/references/styling.md +290 -0
@@ -1 +1 @@
1
- {"version":3,"file":"DataGrid.js","sourceRoot":"","sources":["../../../src/data-grid/DataGrid.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAwBA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EACL,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,cAAc,EACd,YAAY,EACZ,MAAM,EACN,UAAU,EACV,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,+BAA+B,EAC/B,UAAU,EACV,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,WAAW,EACX,WAAW,EACX,UAAU,EACV,YAAY,GACb,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,eAAe,GAEhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,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AAI,EAAE,mBAAmB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,eACjC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EACvC,GAAG,EAAE,QAAQ,aAGZ,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,KAAI,KAAC,UAAU,CAAC,MAAM,KAAG,EAC3C,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,KAAI,KAAC,UAAU,CAAC,IAAI,KAAG,IACpC,GACc,EAErB,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,KAAI,KAAC,UAAU,CAAC,UAAU,KAAG,KAChD,GACmB,CAC5B,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG;IACzB,YAAY;IACZ,UAAU;IACV,IAAI;IACJ,QAAQ;IACR,OAAO;IACP,cAAc;IACd,YAAY;IACZ,MAAM;IACN,UAAU;IACV,WAAW;IACX,cAAc;IACd,kBAAkB;IAClB,UAAU;IACV,UAAU;IACV,iBAAiB;IACjB,+BAA+B;IAC/B,UAAU;IACV,qBAAqB;IACrB,uBAAuB;IACvB,wBAAwB;IACxB,WAAW;IACX,WAAW;IACX,UAAU;IACV,YAAY;CACb,CAAC;AAEF,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,CAAC;AAEtE,OAAO,EAAE,QAAQ,EAAE,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 */\nimport {\n type RowData,\n type Table as DataGridType,\n} from '@tanstack/react-table';\nimport classNames from 'classnames';\nimport {\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { type CommonProps, type HtmlAttributes } from '../_common/types';\nimport { useResizeObserver } from '../hooks';\nimport { type Skeleton } from '../skeleton';\nimport {\n ActionButton,\n ActionCell,\n Body,\n BodyCell,\n BodyRow,\n ColumnControls,\n DropDownCell,\n Header,\n HeaderCell,\n HeaderTitle,\n InlineEditCell,\n LoadingPlaceholder,\n Navigation,\n NoDataIcon,\n NoDataPlaceholder,\n NoDataPlaceholderContentWrapper,\n Pagination,\n PaginationArrowButton,\n PaginationNumericButton,\n PaginationNumericButtons,\n ResizingBar,\n RowsPerPage,\n Scrollable,\n TableResults,\n} from './Components';\nimport {\n type DataGridComponentsInterface,\n DataGridContext,\n type DataGridContextType,\n} from './data-grid-context';\nimport { useTableNav } from './data-grid-nav';\nimport { updateColumnWidths } from './helpers';\nimport {\n type DataGridStyleRule,\n type DataGridStyleRuleValueConverters,\n} from './style-rules/types';\n\nenum BorderStyleEnum {\n AllSides = 'all-sides',\n Horizontal = 'horizontal',\n Vertical = 'vertical',\n None = 'none',\n}\n\nexport type BorderStyle = `${BorderStyleEnum}`;\n\nenum HeaderStyleEnum {\n Filled = 'filled',\n Clean = 'clean',\n}\n\nexport type HeaderStyle = `${HeaderStyleEnum}`;\n\nexport type DataGridProps<T extends RowData> = {\n styling?: Partial<{\n /** Alternate the background color of rows */\n hasZebraStriping: boolean;\n /** Type of border that will be used */\n borderStyle: BorderStyle;\n /** If header should have styles or not (Aura example) */\n headerStyle: HeaderStyle;\n /** If background hover effects should be enabled on rows and header cells */\n hasHoverEffects: boolean;\n /** If table should have less padding */\n isCompact: boolean;\n }>;\n /** Resizing the width of columns */\n isResizable?: boolean;\n /** Enables table's loading state */\n isLoading?: boolean;\n /**\n * Enables keyboard navigation.\n * To control keyboard navigation programmatically\n * for edge cases, pass a `ref` to `tableNavRef`\n */\n isKeyboardNavigable?: boolean;\n /**\n * Enables automatic resizing of columns.\n * If `isResizable` is `true`, the columns will only be automatically resized on initial render of the table.\n * If `isResizable` is `false`, the columns will be resized automatically to always fit the table width (assuming that column maxWidths allow for it).\n * Note: Action columns are a fixed size of 40px, and Pinned columns are not resized automatically.\n * @defaultValue true\n */\n isAutoResizingColumns?: boolean;\n /**\n * Reference to the tableNav instance\n * for programmatic control\n */\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n tableNavRef?: React.RefObject<any>;\n /** Table instance created from `useTable`*/\n tableInstance: DataGridType<T>;\n /** Table sub-component overrides */\n components?: DataGridComponentsInterface<T>;\n /** @deprecated Use htmlAttributes, className and style on the root element instead */\n rootProps?: HtmlAttributes<'div'>;\n isSkeletonLoading?: boolean;\n skeletonProps?: React.ComponentProps<typeof Skeleton>;\n /** The target element for portaled elements to be rendered in, e.g. the modal root if the data grid is inside a modal.\n * This is used in for example the DropdownCell, RowsPerPage, and ColumnControls.\n */\n portalTarget?: HTMLElement | null;\n /** Rule-based conditional styling for cells and rows. */\n styleRules?: DataGridStyleRule[];\n /** Per-column converters that teach the style-rule engine how to interpret complex cell values. */\n styleRuleValueConverters?: DataGridStyleRuleValueConverters;\n ref?: React.Ref<HTMLDivElement>;\n};\n\nconst DEFAULT_STYLING: Required<DataGridProps<unknown>['styling']> = {\n borderStyle: BorderStyleEnum.Horizontal,\n hasHoverEffects: true,\n hasZebraStriping: false,\n headerStyle: HeaderStyleEnum.Filled,\n isCompact: false,\n};\n\nconst DataGridComponent = function DataGrid<T extends RowData = unknown>({\n isResizable = true,\n isLoading = false,\n isKeyboardNavigable = true,\n isAutoResizingColumns = true,\n tableInstance,\n components,\n rootProps,\n styling = {},\n tableNavRef,\n isSkeletonLoading = false,\n skeletonProps,\n ref,\n portalTarget = document.body,\n styleRules,\n styleRuleValueConverters,\n htmlAttributes,\n className,\n style,\n ...restProps\n}: CommonProps<'div', DataGridProps<T>>) {\n const { className: rootClassName = '', style: rootStyle = {} } =\n rootProps || {};\n\n const [isScrollable, setIsScrollable] = useState(false);\n const [isMediumNavigation, setIsMediumNavigation] = useState(false);\n const [isSmallNavigation, setIsSmallNavigation] = useState(false);\n const tableRef = useRef<HTMLDivElement>(null);\n const scrollableContainerRef = useRef<HTMLDivElement>(null);\n\n tableInstance.setOptions((prevOptions) => {\n return {\n ...prevOptions,\n enableSorting: isSkeletonLoading ? false : prevOptions.enableSorting,\n };\n });\n\n // Triggers when the whole container is resized\n useResizeObserver({\n onResize: (entry) => {\n if (entry.width === undefined) {\n return;\n }\n isAutoResizingColumns &&\n !isResizable &&\n updateColumnWidths(tableInstance, entry.width); // don't resize columns when the table is resizable due to problems with the resize handler.\n setIsScrollable(tableInstance.getTotalSize() > entry.width);\n setIsMediumNavigation(entry.width <= 680);\n setIsSmallNavigation(entry.width <= 480);\n },\n ref: scrollableContainerRef as React.RefObject<HTMLElement>,\n });\n\n // Triggers when the individual columns are resized\n useResizeObserver({\n onResize: () => {\n if (scrollableContainerRef.current === null) {\n return;\n }\n setIsScrollable(\n tableInstance.getTotalSize() >\n scrollableContainerRef.current.clientWidth,\n );\n },\n ref: tableRef as React.RefObject<HTMLElement>,\n });\n\n const Styling = useMemo(\n () => ({\n ...DEFAULT_STYLING,\n ...styling,\n }),\n [styling],\n );\n\n const Components = useMemo(\n () =>\n ({\n ...DataGridComponents,\n ...components,\n }) as DataGridContextType<T>['components'],\n [components],\n );\n const ScrollableContainer = Components?.Scrollable\n ? Components.Scrollable\n : Scrollable;\n\n const { listeners, tableNav } = useTableNav({\n isDebug: false,\n });\n\n /** Surface the tableNav instance for programmatic control if needed */\n useImperativeHandle(tableNavRef, () => tableNav, [tableNav]);\n\n useEffect(() => {\n if (isAutoResizingColumns && isResizable) {\n updateColumnWidths(\n tableInstance,\n scrollableContainerRef.current?.clientWidth\n ? scrollableContainerRef.current.clientWidth - 1 // -1 to avoid horizontal scrollbar\n : 0,\n );\n }\n }, [isAutoResizingColumns, tableInstance, isResizable]);\n\n return (\n <DataGridContext.Provider\n value={\n {\n components: Components,\n dataGridNav: tableNav,\n hasResizeColumns: isAutoResizingColumns,\n isKeyboardNavigationEnabled: isKeyboardNavigable,\n isLoading: isLoading,\n isMediumNavigation,\n isResizable: isResizable,\n isSkeletonLoading,\n isSmallNavigation,\n portalTarget: portalTarget,\n skeletonProps,\n styleRuleValueConverters,\n styleRules,\n tableProps: tableInstance,\n } as DataGridContextType<T>\n }\n >\n <div\n // Root props needs to be first in order to override className\n {...rootProps}\n className={classNames('ndl-data-grid-root', rootClassName, className, {\n 'ndl-data-grid-border-horizontal':\n Styling.borderStyle === BorderStyleEnum.Horizontal ||\n Styling.borderStyle === BorderStyleEnum.AllSides,\n 'ndl-data-grid-border-vertical':\n Styling.borderStyle === BorderStyleEnum.Vertical ||\n Styling.borderStyle === BorderStyleEnum.AllSides,\n 'ndl-data-grid-compact': Styling.isCompact,\n 'ndl-data-grid-focusable-cells': isKeyboardNavigable,\n 'ndl-data-grid-header-filled':\n Styling.headerStyle === HeaderStyleEnum.Filled,\n 'ndl-data-grid-hover-effects': Styling.hasHoverEffects,\n 'ndl-data-grid-resizable': isResizable,\n 'ndl-data-grid-zebra-striping': Styling.hasZebraStriping,\n })}\n ref={ref}\n style={{ ...rootStyle, ...style }}\n {...restProps}\n {...htmlAttributes}\n {...(isKeyboardNavigable ? listeners : {})}\n >\n {/* Make DataGrid horizontally scrollable and avoid horizontal scrollbar have an extra vertical scrollbar (esp. Safari) */}\n {/* This behavior can be overridden by consumers through replacing the scrolling container */}\n <ScrollableContainer\n ref={scrollableContainerRef}\n htmlAttributes={{\n onKeyDown: (e) => {\n if (isScrollable && !isKeyboardNavigable) {\n if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {\n e.stopPropagation();\n }\n }\n },\n // Ensure that the user can focus and scroll inside the table with arrow keys even if there is no interactive element inside\n tabIndex: isScrollable && !isKeyboardNavigable ? 0 : undefined,\n }}\n >\n {/* Table content Area */}\n <div\n className=\"ndl-div-table\"\n role={isKeyboardNavigable ? 'grid' : 'table'}\n aria-busy={isLoading ? 'true' : 'false'}\n ref={tableRef}\n >\n {/* DataGrid Header Area */}\n {Components?.Header && <Components.Header />}\n {Components?.Body && <Components.Body />}\n </div>\n </ScrollableContainer>\n {/* Bottom Navigation Area */}\n {Components?.Navigation && <Components.Navigation />}\n </div>\n </DataGridContext.Provider>\n );\n};\n\nconst DataGridComponents = {\n ActionButton,\n ActionCell,\n Body,\n BodyCell,\n BodyRow,\n ColumnControls,\n DropDownCell,\n Header,\n HeaderCell,\n HeaderTitle,\n InlineEditCell,\n LoadingPlaceholder,\n Navigation,\n NoDataIcon,\n NoDataPlaceholder,\n NoDataPlaceholderContentWrapper,\n Pagination,\n PaginationArrowButton,\n PaginationNumericButton,\n PaginationNumericButtons,\n ResizingBar,\n RowsPerPage,\n Scrollable,\n TableResults,\n};\n\nconst DataGrid = Object.assign(DataGridComponent, DataGridComponents);\n\nexport { DataGrid };\n"]}
1
+ {"version":3,"file":"DataGrid.js","sourceRoot":"","sources":["../../../src/data-grid/DataGrid.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAwBA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,OAAO,EACP,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE7C,OAAO,EACL,YAAY,EACZ,UAAU,EACV,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,cAAc,EACd,YAAY,EACZ,MAAM,EACN,UAAU,EACV,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,+BAA+B,EAC/B,UAAU,EACV,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,WAAW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AC;4BACH,CAAC;wBACH,CAAC;wBACD,4HAA4H;wBAC5H,QAAQ,EAAE,YAAY,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;qBAC/D,YAGD,eACE,SAAS,EAAC,eAAe,EACzB,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,eACjC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EACvC,GAAG,EAAE,QAAQ,aAGZ,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,KAAI,KAAC,UAAU,CAAC,MAAM,KAAG,EAC3C,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,IAAI,KAAI,KAAC,UAAU,CAAC,IAAI,KAAG,IACpC,GACc,EAErB,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,KAAI,KAAC,UAAU,CAAC,UAAU,KAAG,KAChD,GACmB,CAC5B,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG;IACzB,YAAY;IACZ,UAAU;IACV,IAAI;IACJ,QAAQ;IACR,OAAO;IACP,cAAc;IACd,YAAY;IACZ,MAAM;IACN,UAAU;IACV,WAAW;IACX,cAAc;IACd,kBAAkB;IAClB,UAAU;IACV,UAAU;IACV,iBAAiB;IACjB,+BAA+B;IAC/B,UAAU;IACV,qBAAqB;IACrB,uBAAuB;IACvB,wBAAwB;IACxB,WAAW;IACX,WAAW;IACX,UAAU;IACV,YAAY;CACb,CAAC;AAEF,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,CAAC;AAEtE,OAAO,EAAE,QAAQ,EAAE,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 */\nimport {\n type RowData,\n type Table as DataGridType,\n} from '@tanstack/react-table';\nimport classNames from 'classnames';\nimport {\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\n\nimport { type CommonProps, type HtmlAttributes } from '../_common/types';\nimport { useResizeObserver } from '../hooks';\nimport { type Skeleton } from '../skeleton';\nimport {\n ActionButton,\n ActionCell,\n Body,\n BodyCell,\n BodyRow,\n ColumnControls,\n DropDownCell,\n Header,\n HeaderCell,\n HeaderTitle,\n InlineEditCell,\n LoadingPlaceholder,\n Navigation,\n NoDataIcon,\n NoDataPlaceholder,\n NoDataPlaceholderContentWrapper,\n Pagination,\n PaginationArrowButton,\n PaginationNumericButton,\n PaginationNumericButtons,\n ResizingBar,\n RowsPerPage,\n Scrollable,\n TableResults,\n} from './Components';\nimport {\n type DataGridComponentsInterface,\n DataGridContext,\n type DataGridContextType,\n} from './data-grid-context';\nimport { useTableNav } from './data-grid-nav';\nimport { updateColumnWidths } from './helpers';\nimport {\n type DataGridStyleRule,\n type DataGridStyleRuleValueConverters,\n} from './style-rules/types';\n\nenum BorderStyleEnum {\n AllSides = 'all-sides',\n Horizontal = 'horizontal',\n Vertical = 'vertical',\n None = 'none',\n}\n\nexport type BorderStyle = `${BorderStyleEnum}`;\n\nenum HeaderStyleEnum {\n Filled = 'filled',\n Clean = 'clean',\n}\n\nexport type HeaderStyle = `${HeaderStyleEnum}`;\n\nexport type DataGridProps<T extends RowData> = {\n styling?: Partial<{\n /** Alternate the background color of rows */\n hasZebraStriping: boolean;\n /** Type of border that will be used */\n borderStyle: BorderStyle;\n /** If header should have styles or not (Aura example) */\n headerStyle: HeaderStyle;\n /** If background hover effects should be enabled on rows and header cells */\n hasHoverEffects: boolean;\n /** If table should have less padding */\n isCompact: boolean;\n }>;\n /** Resizing the width of columns */\n isResizable?: boolean;\n /** Enables table's loading state */\n isLoading?: boolean;\n /**\n * Enables keyboard navigation.\n * To control keyboard navigation programmatically\n * for edge cases, pass a `ref` to `tableNavRef`\n */\n isKeyboardNavigable?: boolean;\n /**\n * Enables automatic resizing of columns.\n * If `isResizable` is `true`, the columns will only be automatically resized on initial render of the table.\n * If `isResizable` is `false`, the columns will be resized automatically to always fit the table width (assuming that column maxWidths allow for it).\n * Note: Action columns are a fixed size of 40px, and Pinned columns are not resized automatically.\n * @defaultValue true\n */\n isAutoResizingColumns?: boolean;\n /**\n * Reference to the tableNav instance\n * for programmatic control\n */\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n tableNavRef?: React.RefObject<any>;\n /** Table instance created from `useTable`*/\n tableInstance: DataGridType<T>;\n /** Table sub-component overrides */\n components?: DataGridComponentsInterface<T>;\n /** @deprecated Use htmlAttributes, className and style on the root element instead */\n rootProps?: HtmlAttributes<'div'>;\n isSkeletonLoading?: boolean;\n skeletonProps?: React.ComponentProps<typeof Skeleton>;\n /** The target element for portaled elements to be rendered in, e.g. the modal root if the data grid is inside a modal.\n * This is used in for example the DropdownCell, RowsPerPage, and ColumnControls.\n */\n portalTarget?: HTMLElement | null;\n /** Rule-based conditional styling for cells and rows. */\n styleRules?: DataGridStyleRule[];\n /** Per-column converters that teach the style-rule engine how to interpret complex cell values. */\n styleRuleValueConverters?: DataGridStyleRuleValueConverters;\n ref?: React.Ref<HTMLDivElement>;\n};\n\nconst DEFAULT_STYLING: Required<DataGridProps<unknown>['styling']> = {\n borderStyle: BorderStyleEnum.Horizontal,\n hasHoverEffects: true,\n hasZebraStriping: false,\n headerStyle: HeaderStyleEnum.Filled,\n isCompact: false,\n};\n\nconst DataGridComponent = function DataGrid<T extends RowData = unknown>({\n isResizable = true,\n isLoading = false,\n isKeyboardNavigable = true,\n isAutoResizingColumns = true,\n tableInstance,\n components,\n rootProps,\n styling = {},\n tableNavRef,\n isSkeletonLoading = false,\n skeletonProps,\n ref,\n portalTarget = document.body,\n styleRules,\n styleRuleValueConverters,\n htmlAttributes,\n className,\n style,\n ...restProps\n}: CommonProps<'div', DataGridProps<T>>) {\n const { className: rootClassName = '', style: rootStyle = {} } =\n rootProps || {};\n\n const [isScrollable, setIsScrollable] = useState(false);\n const [isMediumNavigation, setIsMediumNavigation] = useState(false);\n const [isSmallNavigation, setIsSmallNavigation] = useState(false);\n const tableRef = useRef<HTMLDivElement>(null);\n const scrollableContainerRef = useRef<HTMLDivElement>(null);\n\n tableInstance.setOptions((prevOptions) => {\n return {\n ...prevOptions,\n enableSorting: isSkeletonLoading ? false : prevOptions.enableSorting,\n };\n });\n\n // Triggers when the whole container is resized\n useResizeObserver({\n onResize: (entry) => {\n if (entry.width === undefined) {\n return;\n }\n isAutoResizingColumns &&\n !isResizable &&\n updateColumnWidths(tableInstance, entry.width); // don't resize columns when the table is resizable due to problems with the resize handler.\n setIsScrollable(tableInstance.getTotalSize() > entry.width);\n setIsMediumNavigation(entry.width <= 680);\n setIsSmallNavigation(entry.width <= 480);\n },\n ref: scrollableContainerRef as React.RefObject<HTMLElement>,\n });\n\n // Triggers when the individual columns are resized\n useResizeObserver({\n onResize: () => {\n if (scrollableContainerRef.current === null) {\n return;\n }\n setIsScrollable(\n tableInstance.getTotalSize() >\n scrollableContainerRef.current.clientWidth,\n );\n },\n ref: tableRef as React.RefObject<HTMLElement>,\n });\n\n const Styling = useMemo(\n () => ({\n ...DEFAULT_STYLING,\n ...styling,\n }),\n [styling],\n );\n\n const Components = useMemo(\n () =>\n ({\n ...DataGridComponents,\n ...components,\n }) as DataGridContextType<T>['components'],\n [components],\n );\n const ScrollableContainer = Components?.Scrollable\n ? Components.Scrollable\n : Scrollable;\n\n const { listeners, tableNav } = useTableNav({\n isDebug: false,\n });\n\n /** Surface the tableNav instance for programmatic control if needed */\n useImperativeHandle(tableNavRef, () => tableNav, [tableNav]);\n\n useEffect(() => {\n if (isAutoResizingColumns && isResizable) {\n updateColumnWidths(\n tableInstance,\n scrollableContainerRef.current?.clientWidth\n ? scrollableContainerRef.current.clientWidth - 1 // -1 to avoid horizontal scrollbar\n : 0,\n );\n }\n }, [isAutoResizingColumns, tableInstance, isResizable]);\n\n return (\n <DataGridContext.Provider\n value={\n {\n components: Components,\n dataGridNav: tableNav,\n hasResizeColumns: isAutoResizingColumns,\n isKeyboardNavigationEnabled: isKeyboardNavigable,\n isLoading: isLoading,\n isMediumNavigation,\n isResizable: isResizable,\n isSkeletonLoading,\n isSmallNavigation,\n portalTarget: portalTarget,\n skeletonProps,\n styleRuleValueConverters,\n styleRules,\n tableProps: tableInstance,\n } as DataGridContextType<T>\n }\n >\n <div\n // Root props needs to be first in order to override className\n {...rootProps}\n className={classNames('ndl-data-grid-root', rootClassName, className, {\n 'ndl-data-grid-border-horizontal':\n Styling.borderStyle === BorderStyleEnum.Horizontal ||\n Styling.borderStyle === BorderStyleEnum.AllSides,\n 'ndl-data-grid-border-vertical':\n Styling.borderStyle === BorderStyleEnum.Vertical ||\n Styling.borderStyle === BorderStyleEnum.AllSides,\n 'ndl-data-grid-compact': Styling.isCompact,\n 'ndl-data-grid-focusable-cells': isKeyboardNavigable,\n 'ndl-data-grid-header-filled':\n Styling.headerStyle === HeaderStyleEnum.Filled,\n 'ndl-data-grid-hover-effects': Styling.hasHoverEffects,\n 'ndl-data-grid-resizable': isResizable,\n 'ndl-data-grid-zebra-striping': Styling.hasZebraStriping,\n })}\n ref={ref}\n style={{ ...rootStyle, ...style }}\n {...restProps}\n {...htmlAttributes}\n {...(isKeyboardNavigable ? listeners : {})}\n >\n {/* Make DataGrid horizontally scrollable and avoid horizontal scrollbar have an extra vertical scrollbar (esp. Safari) */}\n {/* This behavior can be overridden by consumers through replacing the scrolling container */}\n <ScrollableContainer\n ref={scrollableContainerRef}\n htmlAttributes={{\n onKeyDown: (event) => {\n if (isScrollable && !isKeyboardNavigable) {\n if (event.key === 'ArrowRight' || event.key === 'ArrowLeft') {\n event.stopPropagation();\n }\n }\n },\n // Ensure that the user can focus and scroll inside the table with arrow keys even if there is no interactive element inside\n tabIndex: isScrollable && !isKeyboardNavigable ? 0 : undefined,\n }}\n >\n {/* Table content Area */}\n <div\n className=\"ndl-div-table\"\n role={isKeyboardNavigable ? 'grid' : 'table'}\n aria-busy={isLoading ? 'true' : 'false'}\n ref={tableRef}\n >\n {/* DataGrid Header Area */}\n {Components?.Header && <Components.Header />}\n {Components?.Body && <Components.Body />}\n </div>\n </ScrollableContainer>\n {/* Bottom Navigation Area */}\n {Components?.Navigation && <Components.Navigation />}\n </div>\n </DataGridContext.Provider>\n );\n};\n\nconst DataGridComponents = {\n ActionButton,\n ActionCell,\n Body,\n BodyCell,\n BodyRow,\n ColumnControls,\n DropDownCell,\n Header,\n HeaderCell,\n HeaderTitle,\n InlineEditCell,\n LoadingPlaceholder,\n Navigation,\n NoDataIcon,\n NoDataPlaceholder,\n NoDataPlaceholderContentWrapper,\n Pagination,\n PaginationArrowButton,\n PaginationNumericButton,\n PaginationNumericButtons,\n ResizingBar,\n RowsPerPage,\n Scrollable,\n TableResults,\n};\n\nconst DataGrid = Object.assign(DataGridComponent, DataGridComponents);\n\nexport { DataGrid };\n"]}
@@ -67,9 +67,9 @@ export class DataGridNav {
67
67
  this.keys = [];
68
68
  }
69
69
  /** Used as a keyboard listener for key down */
70
- tableKeyDown(e) {
70
+ tableKeyDown(event) {
71
71
  var _a;
72
- this.debugLog('tableKeyDown', `Key pressed: ${e.key}`);
72
+ this.debugLog('tableKeyDown', `Key pressed: ${event.key}`);
73
73
  if (this.disabled) {
74
74
  this.debugLog('tableKeyDown', 'interaction is disabled');
75
75
  return;
@@ -84,69 +84,70 @@ export class DataGridNav {
84
84
  * Cannot work with preventDefault as it will
85
85
  * first capture the event from an input in cell for example
86
86
  */
87
- if (Keys.ArrowDown === e.key ||
88
- Keys.ArrowUp === e.key ||
89
- Keys.ArrowLeft === e.key ||
90
- Keys.ArrowRight === e.key) {
91
- e.preventDefault();
87
+ if (Keys.ArrowDown === event.key ||
88
+ Keys.ArrowUp === event.key ||
89
+ Keys.ArrowLeft === event.key ||
90
+ Keys.ArrowRight === event.key) {
91
+ event.preventDefault();
92
92
  }
93
93
  /**
94
94
  * Add key to the stack if it's
95
95
  * not the same with the last (long press)
96
96
  */
97
- if (this.keys.length === 0 || this.keys[this.keys.length - 1] !== e.key) {
98
- this.keys.push(e.key);
97
+ if (this.keys.length === 0 ||
98
+ this.keys[this.keys.length - 1] !== event.key) {
99
+ this.keys.push(event.key);
99
100
  }
100
101
  /**
101
102
  * Need to check if we are inside a grid cell
102
103
  * or not to enable/disable Grid Navigation
103
104
  */
104
- if (!(e.target instanceof Element)) {
105
+ if (!(event.target instanceof Element)) {
105
106
  return;
106
107
  }
107
- const cell = (_a = e.target.parentElement) === null || _a === void 0 ? void 0 : _a.closest(`${this.selectors.Cell},${this.selectors.Row}`);
108
+ const cell = (_a = event.target.parentElement) === null || _a === void 0 ? void 0 : _a.closest(`${this.selectors.Cell},${this.selectors.Row}`);
108
109
  if (!cell) {
109
110
  this.debugLog('tableKeyDown', 'cell not found');
110
111
  return;
111
112
  }
112
113
  if (cell.matches(this.selectors.Cell)) {
113
114
  this.debugLog('tableKeyDown', 'event captured in cell');
114
- this.cellNavigation(e);
115
+ this.cellNavigation(event);
115
116
  }
116
117
  else {
117
118
  this.debugLog('tableKeyDown', 'event captured in grid');
118
- this.gridNavigation(e);
119
+ this.gridNavigation(event);
119
120
  }
120
121
  }
121
122
  /**
122
123
  * Handles the navigation inside a cell
123
124
  */
124
- cellNavigation(e) {
125
- if (!(e.target instanceof Element)) {
125
+ cellNavigation(event) {
126
+ if (!(event.target instanceof Element)) {
126
127
  return;
127
128
  }
128
- const cell = e.target.closest(this.selectors.Cell);
129
+ const cell = event.target.closest(this.selectors.Cell);
129
130
  if (!cell) {
130
131
  this.debugLog('cellNavigation', 'cell not found');
131
132
  return;
132
133
  }
133
134
  if (this.getValidFocusableChild(cell)) {
134
135
  this.debugLog('cellNavigation', 'valid focusable child found');
135
- this.gridNavigation(e);
136
+ this.gridNavigation(event);
136
137
  return;
137
138
  }
138
139
  const focusableWidgets = cell
139
140
  ? [...cell.querySelectorAll(this.selectors.Focusable)]
140
141
  : [];
141
- const widgetIdx = focusableWidgets.findIndex((el) => el === e.target);
142
+ const widgetIdx = focusableWidgets.findIndex((el) => el === event.target);
142
143
  /**
143
144
  * Keys: Escape
144
145
  * Restore grid navigation
145
146
  */
146
- if (e.key === Keys.Escape && this.isFocusable(cell)) {
147
+ if (event.key === Keys.Escape && this.isFocusable(cell)) {
147
148
  cell.focus();
148
- e.preventDefault();
149
- e.stopPropagation();
149
+ event.preventDefault();
150
+ event.stopPropagation();
150
151
  return;
151
152
  }
152
153
  /**
@@ -156,7 +157,7 @@ export class DataGridNav {
156
157
  * Arrow Down disabled:
157
158
  * https://github.com/w3c/aria-practices/issues/2739#issuecomment-1613538972
158
159
  */
159
- if (e.key === Keys.ArrowRight || e.key === Keys.ArrowDown) {
160
+ if (event.key === Keys.ArrowRight || event.key === Keys.ArrowDown) {
160
161
  const nextFocusable = widgetIdx === focusableWidgets.length - 1 ? 0 : widgetIdx + 1;
161
162
  const widgetToFocus = focusableWidgets[nextFocusable];
162
163
  if (this.isFocusable(widgetToFocus)) {
@@ -171,7 +172,7 @@ export class DataGridNav {
171
172
  * Arrow Up disabled:
172
173
  * https://github.com/w3c/aria-practices/issues/2739#issuecomment-1613538972
173
174
  */
174
- if (e.key === Keys.ArrowLeft || e.key === Keys.ArrowUp) {
175
+ if (event.key === Keys.ArrowLeft || event.key === Keys.ArrowUp) {
175
176
  const previousFocusable = widgetIdx === 0 ? focusableWidgets.length - 1 : widgetIdx - 1;
176
177
  const widgetToFocus = focusableWidgets[previousFocusable];
177
178
  if (this.isFocusable(widgetToFocus)) {
@@ -182,7 +183,7 @@ export class DataGridNav {
182
183
  }
183
184
  /**
184
185
  * Get the valid focusable child of a cell
185
- * @return {FocusableElement | null} - The valid focusable child, or null if there are none or multiple focusable children
186
+ * @returns `FocusableElement` | `null` - The valid focusable child, or null if there are none or multiple focusable children
186
187
  */
187
188
  getValidFocusableChild(el) {
188
189
  const focusableChildren = [
@@ -199,9 +200,9 @@ export class DataGridNav {
199
200
  * Handles the navigation outside a cell
200
201
  * on the grid level
201
202
  */
202
- gridNavigation(e) {
203
+ gridNavigation(event) {
203
204
  var _a;
204
- if (!(e.target instanceof Element)) {
205
+ if (!(event.target instanceof Element)) {
205
206
  return;
206
207
  }
207
208
  if (this.keys.length === 1) {
@@ -210,24 +211,24 @@ export class DataGridNav {
210
211
  * Should move focus inside the cell to the first focusable element:
211
212
  * https://www.w3.org/WAI/ARIA/apg/patterns/grid/#gridNav_inside
212
213
  */
213
- if (e.key === Keys.Enter) {
214
- const cell = e.target.querySelector(this.selectors.Focusable);
214
+ if (event.key === Keys.Enter) {
215
+ const cell = event.target.querySelector(this.selectors.Focusable);
215
216
  if (cell && this.isFocusable(cell)) {
216
217
  // Enter can trigger child elements:
217
218
  // Source: https://www.reddit.com/r/learnjavascript/comments/14kpj24/wrong_keydown_listener_is_called_with_focus/
218
- // If the e.preventDefault causes issues, we can offset the execution with setTimeout
219
+ // If the event.preventDefault causes issues, we can offset the execution with setTimeout
219
220
  cell.focus();
220
- e.preventDefault();
221
+ event.preventDefault();
221
222
  }
222
223
  }
223
224
  /**
224
225
  * Keys: ArrowLeft, ArrowRight
225
226
  * Should move focus to the next/previous cell
226
227
  */
227
- if (e.key === Keys.ArrowLeft || e.key === Keys.ArrowRight) {
228
- const direction = e.key === Keys.ArrowLeft ? 'prev' : 'next';
228
+ if (event.key === Keys.ArrowLeft || event.key === Keys.ArrowRight) {
229
+ const direction = event.key === Keys.ArrowLeft ? 'prev' : 'next';
229
230
  // Get the closest cell we are currently in
230
- const cell = e.target.closest(this.selectors.Cell);
231
+ const cell = event.target.closest(this.selectors.Cell);
231
232
  if (cell && cell instanceof Element) {
232
233
  const closeFocusable = this.findUntil(direction, cell, this.selectors.Cell);
233
234
  if (closeFocusable) {
@@ -245,8 +246,8 @@ export class DataGridNav {
245
246
  * Keys: Up,Down
246
247
  * Should move focus to the same column of the next/previous row
247
248
  */
248
- if (e.key === Keys.ArrowDown || e.key === Keys.ArrowUp) {
249
- this.verticalCellNavigation(e);
249
+ if (event.key === Keys.ArrowDown || event.key === Keys.ArrowUp) {
250
+ this.verticalCellNavigation(event);
250
251
  return;
251
252
  }
252
253
  /**
@@ -254,18 +255,18 @@ export class DataGridNav {
254
255
  * Should move focus to the first/last row
255
256
  * or a predefined number of rows if user provides a value
256
257
  */
257
- if (e.key === Keys.PageUp || e.key === Keys.PageDown) {
258
- this.pageCellNavigation(e);
258
+ if (event.key === Keys.PageUp || event.key === Keys.PageDown) {
259
+ this.pageCellNavigation(event);
259
260
  return;
260
261
  }
261
262
  /**
262
263
  * Keys: Home, End
263
264
  * Should move focus to the first/last cell of the current row
264
265
  */
265
- if (e.key === Keys.Home || e.key === Keys.End) {
266
- const row = e.target.closest(this.selectors.Row);
266
+ if (event.key === Keys.Home || event.key === Keys.End) {
267
+ const row = event.target.closest(this.selectors.Row);
267
268
  const rowChildren = [...((row === null || row === void 0 ? void 0 : row.children) || [])];
268
- if (e.key === 'End') {
269
+ if (event.key === 'End') {
269
270
  rowChildren.reverse();
270
271
  }
271
272
  this.focusOnFirstCell(rowChildren);
@@ -279,7 +280,7 @@ export class DataGridNav {
279
280
  const [firstKey, secondKey] = this.keys;
280
281
  if (firstKey === 'Control' &&
281
282
  (secondKey === Keys.Home || secondKey === Keys.End)) {
282
- const row = e.target.closest(this.selectors.Row);
283
+ const row = event.target.closest(this.selectors.Row);
283
284
  const siblings = (_a = row.parentElement) === null || _a === void 0 ? void 0 : _a.children;
284
285
  if (!siblings) {
285
286
  this.debugLog('cellNavigation', 'siblings not found');
@@ -294,20 +295,20 @@ export class DataGridNav {
294
295
  }
295
296
  }
296
297
  }
297
- pageCellNavigation(e) {
298
+ pageCellNavigation(event) {
298
299
  var _a;
299
- if (!(e.target instanceof Element)) {
300
+ if (!(event.target instanceof Element)) {
300
301
  return;
301
302
  }
302
- const row = e.target.closest(this.selectors.Row);
303
- const cell = e.target.closest(this.selectors.Cell);
303
+ const row = event.target.closest(this.selectors.Row);
304
+ const cell = event.target.closest(this.selectors.Cell);
304
305
  if (row && cell) {
305
306
  const position = this.getColumnIndex(cell);
306
307
  if (position === undefined) {
307
308
  this.debugLog('cellNavigation', 'position not found');
308
309
  return;
309
310
  }
310
- const direction = e.key === Keys.PageUp ? 'prev' : 'next';
311
+ const direction = event.key === Keys.PageUp ? 'prev' : 'next';
311
312
  const siblings = (_a = row.parentElement) === null || _a === void 0 ? void 0 : _a.children;
312
313
  if (!siblings) {
313
314
  this.debugLog('cellNavigation', 'siblings not found');
@@ -322,7 +323,7 @@ export class DataGridNav {
322
323
  return;
323
324
  }
324
325
  let lastVisitedSibling = sibling;
325
- for (let i = 0; i < this.pageUpDown - 1 && sibling; i++) {
326
+ for (let index = 0; index < this.pageUpDown - 1 && sibling; index++) {
326
327
  sibling = sibling[methodClbk];
327
328
  if (sibling) {
328
329
  lastVisitedSibling = sibling;
@@ -349,13 +350,13 @@ export class DataGridNav {
349
350
  }
350
351
  }
351
352
  }
352
- verticalCellNavigation(e) {
353
+ verticalCellNavigation(event) {
353
354
  var _a, _b, _c, _d, _e;
354
- if (!(e.target instanceof Element)) {
355
+ if (!(event.target instanceof Element)) {
355
356
  return;
356
357
  }
357
- const row = e.target.closest(this.selectors.Row);
358
- const cell = e.target.closest(this.selectors.Cell);
358
+ const row = event.target.closest(this.selectors.Row);
359
+ const cell = event.target.closest(this.selectors.Cell);
359
360
  if (row && cell) {
360
361
  const cellPosition = this.getColumnIndex(cell);
361
362
  const rowPosition = this.getRowIndex(row);
@@ -365,7 +366,7 @@ export class DataGridNav {
365
366
  this.debugLog('verticalCellNavigation', 'row or cell position not found');
366
367
  return;
367
368
  }
368
- const direction = e.key === Keys.ArrowUp ? 'prev' : 'next';
369
+ const direction = event.key === Keys.ArrowUp ? 'prev' : 'next';
369
370
  /** Find previous rowgroup and focus on the proper cell */
370
371
  if (rowPosition === 0 && direction === 'prev') {
371
372
  const currentRowGroup = (_a = row.parentElement) === null || _a === void 0 ? void 0 : _a.closest(this.selectors.RowGroup);
@@ -442,8 +443,8 @@ export class DataGridNav {
442
443
  * reversed order
443
444
  */
444
445
  focusOnFirstCell(el) {
445
- for (let i = 0; i < el.length; i++) {
446
- const child = el[i];
446
+ for (let index = 0; index < el.length; index++) {
447
+ const child = el[index];
447
448
  if (this.isFocusable(child)) {
448
449
  child.focus();
449
450
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"data-grid-nav.js","sourceRoot":"","sources":["../../../../src/data-grid/data-grid-nav/data-grid-nav.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAexC,MAAM,OAAO,WAAW;IAStB,YAAY,SAAiB,EAAE;QANvB,SAAI,GAAa,EAAE,CAAC;QAepB,aAAQ,GAAG,CAAC,YAAoB,EAAE,OAAe,EAAE,EAAE;YAC3D,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,IAAI,YAAY,MAAM,OAAO,EAAE,CAAC,CAAC;YAChD,CAAC;QACH,CAAC,CAAC;QAZA,MAAM,EAAE,SAAS,GAAG,EAAE,EAAE,UAAU,EAAE,OAAO,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC;QAC/D,IAAI,CAAC,SAAS,mCAAQ,SAAS,GAAK,SAAS,CAAE,CAAC;QAChD,IAAI,CAAC,UAAU,G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,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;OAGG;IACK,SAAS,CACf,SAA0B,EAC1B,EAAuB,EACvB,aAAqB,EACrB,YAAqB;QAErB,IAAI,OAAO,GAAc,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,iBAAiB,CAAC;QAExE,OAAO,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACvB,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;YAChC,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,OAAO,IAAI,CAAC;YACd,CAAC;YACD,IACE,YAAY;gBACZ,OAAO,YAAY,OAAO;gBAC1B,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAC7B,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;YAED,IAAI,OAAO,YAAY,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;gBACjE,OAAO,OAA2B,CAAC;YACrC,CAAC;YAED,OAAO,GAAG,OAAO,CAAC;QACpB,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","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 */\nimport { isValidInteractiveElement } from './helpers';\nimport { Keys } from './keys';\nimport { Selectors } from './selectors';\n\ntype FocusableElement = HTMLElement | SVGElement;\n\nexport type Config =\n | {\n /** Enable debug logs */\n isDebug?: boolean;\n /** CSS Selectors being used to find Rows, Row Groups, Cells and Focusable elements */\n selectors?: Partial<typeof Selectors>;\n /** How many rows to move when pressing page up/down - Default goes to first/last row */\n pageUpDown?: number;\n }\n | undefined;\n\nexport class DataGridNav {\n private selectors: Record<keyof typeof Selectors, string>;\n readonly pageUpDown: number | undefined;\n private keys: string[] = [];\n private disabled: boolean;\n readonly debug: boolean;\n\n constructor();\n constructor(config: Config);\n constructor(config: Config = {}) {\n const { selectors = {}, pageUpDown, isDebug = false } = config;\n this.selectors = { ...Selectors, ...selectors };\n this.pageUpDown = pageUpDown;\n this.keys = [];\n this.debug = isDebug;\n this.disabled = false;\n }\n\n private debugLog = (functionName: string, message: string) => {\n if (this.debug) {\n console.info(`[${functionName}]: ${message}`);\n }\n };\n\n /**\n * Disables the keyboard listener in cases\n * that elements inside the grid need to use\n * arrows keys etc., like select dropdowns\n */\n public disable() {\n this.disabled = true;\n }\n\n /**\n * Enables the keyboard listeners\n */\n public enable() {\n this.disabled = false;\n }\n\n private isFocusable(el: Element): el is FocusableElement {\n return el instanceof HTMLElement || el instanceof SVGElement;\n }\n\n public focusParentCell(el: Element) {\n const cell = el.closest(this.selectors.Cell);\n if (cell && this.isFocusable(cell)) {\n cell.focus();\n }\n }\n\n /** Used as a keyboard listener for key up */\n public tableKeyUp() {\n // TODO: have a cleanup as user can press key\n // and then move to another tab, and get back to the same tab\n // so this will not be empty (the bug exists with .pop)\n this.keys = [];\n }\n\n /** Used as a keyboard listener for key down */\n public tableKeyDown(e: KeyboardEvent) {\n this.debugLog('tableKeyDown', `Key pressed: ${e.key}`);\n if (this.disabled) {\n this.debugLog('tableKeyDown', 'interaction is disabled');\n return;\n }\n /**\n * Avoid page scrolling etc.\n * Enable default behavior for:\n * Tab, Shift + Tab\n * TODO: Actually it will be better to just prevent\n * in ArrowKeys and PageKeys maybe?\n * Or should the consumer stop propagation?!\n * Cannot work with preventDefault as it will\n * first capture the event from an input in cell for example\n */\n if (\n Keys.ArrowDown === e.key ||\n Keys.ArrowUp === e.key ||\n Keys.ArrowLeft === e.key ||\n Keys.ArrowRight === e.key\n ) {\n e.preventDefault();\n }\n\n /**\n * Add key to the stack if it's\n * not the same with the last (long press)\n */\n if (this.keys.length === 0 || this.keys[this.keys.length - 1] !== e.key) {\n this.keys.push(e.key);\n }\n\n /**\n * Need to check if we are inside a grid cell\n * or not to enable/disable Grid Navigation\n */\n if (!(e.target instanceof Element)) {\n return;\n }\n const cell = e.target.parentElement?.closest(\n `${this.selectors.Cell},${this.selectors.Row}`,\n );\n\n if (!cell) {\n this.debugLog('tableKeyDown', 'cell not found');\n return;\n }\n\n if (cell.matches(this.selectors.Cell)) {\n this.debugLog('tableKeyDown', 'event captured in cell');\n this.cellNavigation(e);\n } else {\n this.debugLog('tableKeyDown', 'event captured in grid');\n this.gridNavigation(e);\n }\n }\n\n /**\n * Handles the navigation inside a cell\n */\n public cellNavigation(e: KeyboardEvent) {\n if (!(e.target instanceof Element)) {\n return;\n }\n\n const cell = e.target.closest(this.selectors.Cell);\n\n if (!cell) {\n this.debugLog('cellNavigation', 'cell not found');\n return;\n }\n\n if (this.getValidFocusableChild(cell)) {\n this.debugLog('cellNavigation', 'valid focusable child found');\n this.gridNavigation(e);\n return;\n }\n\n const focusableWidgets = cell\n ? [...cell.querySelectorAll(this.selectors.Focusable)]\n : [];\n const widgetIdx = focusableWidgets.findIndex((el) => el === e.target);\n\n /**\n * Keys: Escape\n * Restore grid navigation\n */\n if (e.key === Keys.Escape && this.isFocusable(cell)) {\n cell.focus();\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n\n /**\n * Keys: ArrowRight, ArrowDown\n * Move to the next focusable cell, or the first one\n *\n * Arrow Down disabled:\n * https://github.com/w3c/aria-practices/issues/2739#issuecomment-1613538972\n */\n if (e.key === Keys.ArrowRight || e.key === Keys.ArrowDown) {\n const nextFocusable =\n widgetIdx === focusableWidgets.length - 1 ? 0 : widgetIdx + 1;\n const widgetToFocus = focusableWidgets[nextFocusable];\n if (this.isFocusable(widgetToFocus)) {\n widgetToFocus.focus();\n }\n return;\n }\n\n /**\n * Keys: ArrowLeft, ArrowUp\n * Move to the previous focusable cell, or the last one\n *\n * Arrow Up disabled:\n * https://github.com/w3c/aria-practices/issues/2739#issuecomment-1613538972\n */\n if (e.key === Keys.ArrowLeft || e.key === Keys.ArrowUp) {\n const previousFocusable =\n widgetIdx === 0 ? focusableWidgets.length - 1 : widgetIdx - 1;\n const widgetToFocus = focusableWidgets[previousFocusable];\n if (this.isFocusable(widgetToFocus)) {\n widgetToFocus.focus();\n }\n return;\n }\n }\n\n /**\n * Get the valid focusable child of a cell\n * @return {FocusableElement | null} - The valid focusable child, or null if there are none or multiple focusable children\n */\n private getValidFocusableChild(el: Element): FocusableElement | null {\n const focusableChildren = [\n ...el.querySelectorAll(this.selectors.Focusable),\n ];\n if (\n focusableChildren.length === 1 &&\n isValidInteractiveElement(focusableChildren[0]) &&\n this.isFocusable(focusableChildren[0])\n ) {\n return focusableChildren[0];\n }\n return null;\n }\n\n /**\n * Handles the navigation outside a cell\n * on the grid level\n */\n public gridNavigation(e: KeyboardEvent) {\n if (!(e.target instanceof Element)) {\n return;\n }\n\n if (this.keys.length === 1) {\n /**\n * Keys: Enter\n * Should move focus inside the cell to the first focusable element:\n * https://www.w3.org/WAI/ARIA/apg/patterns/grid/#gridNav_inside\n */\n if (e.key === Keys.Enter) {\n const cell = e.target.querySelector(this.selectors.Focusable);\n if (cell && this.isFocusable(cell)) {\n // Enter can trigger child elements:\n // Source: https://www.reddit.com/r/learnjavascript/comments/14kpj24/wrong_keydown_listener_is_called_with_focus/\n // If the e.preventDefault causes issues, we can offset the execution with setTimeout\n cell.focus();\n e.preventDefault();\n }\n }\n\n /**\n * Keys: ArrowLeft, ArrowRight\n * Should move focus to the next/previous cell\n */\n if (e.key === Keys.ArrowLeft || e.key === Keys.ArrowRight) {\n const direction = e.key === Keys.ArrowLeft ? 'prev' : 'next';\n // Get the closest cell we are currently in\n const cell = e.target.closest(this.selectors.Cell);\n\n if (cell && cell instanceof Element) {\n const closeFocusable = this.findUntil(\n direction,\n cell,\n this.selectors.Cell,\n );\n if (closeFocusable) {\n const focusableChild = this.getValidFocusableChild(closeFocusable);\n\n const toFocus = focusableChild ?? closeFocusable;\n toFocus.focus();\n toFocus.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n });\n }\n }\n }\n\n /**\n * Keys: Up,Down\n * Should move focus to the same column of the next/previous row\n */\n if (e.key === Keys.ArrowDown || e.key === Keys.ArrowUp) {\n this.verticalCellNavigation(e);\n return;\n }\n\n /**\n * Keys: PageUp, PageDown\n * Should move focus to the first/last row\n * or a predefined number of rows if user provides a value\n */\n if (e.key === Keys.PageUp || e.key === Keys.PageDown) {\n this.pageCellNavigation(e);\n return;\n }\n\n /**\n * Keys: Home, End\n * Should move focus to the first/last cell of the current row\n */\n if (e.key === Keys.Home || e.key === Keys.End) {\n const row = e.target.closest(this.selectors.Row) as Element;\n const rowChildren = [...(row?.children || [])];\n if (e.key === 'End') {\n rowChildren.reverse();\n }\n this.focusOnFirstCell(rowChildren);\n }\n } else {\n /**\n * Keys: Control + Home, Control + End\n * Should move focus to the first/last cell of the first/last row\n */\n const [firstKey, secondKey] = this.keys;\n if (\n firstKey === 'Control' &&\n (secondKey === Keys.Home || secondKey === Keys.End)\n ) {\n const row = e.target.closest(this.selectors.Row) as Element;\n const siblings = row.parentElement?.children;\n\n if (!siblings) {\n this.debugLog('cellNavigation', 'siblings not found');\n return;\n }\n\n const rowToFocus =\n secondKey === Keys.Home ? siblings[0] : siblings[siblings.length - 1];\n const rowChildren = [...(rowToFocus?.children || [])];\n if (secondKey === Keys.End) {\n rowChildren.reverse();\n }\n this.focusOnFirstCell(rowChildren);\n }\n }\n }\n\n private pageCellNavigation(e: KeyboardEvent) {\n if (!(e.target instanceof Element)) {\n return;\n }\n const row = e.target.closest(this.selectors.Row) as Element;\n const cell = e.target.closest(this.selectors.Cell) as Element;\n\n if (row && cell) {\n const position = this.getColumnIndex(cell);\n\n if (position === undefined) {\n this.debugLog('cellNavigation', 'position not found');\n return;\n }\n\n const direction = e.key === Keys.PageUp ? 'prev' : 'next';\n const siblings = row.parentElement?.children;\n\n if (!siblings) {\n this.debugLog('cellNavigation', 'siblings not found');\n return;\n }\n\n // If pageUpDown is defined, we should move that number of rows, or to the closest possible\n let destinationRow: Element | ChildNode;\n if (this.pageUpDown) {\n const methodClbk =\n direction === 'prev' ? 'previousSibling' : 'nextSibling';\n let sibling = row[methodClbk];\n if (sibling === null) {\n return;\n }\n\n let lastVisitedSibling = sibling;\n\n for (let i = 0; i < this.pageUpDown - 1 && sibling; i++) {\n sibling = sibling[methodClbk];\n if (sibling) {\n lastVisitedSibling = sibling;\n }\n }\n destinationRow = sibling ? sibling : lastVisitedSibling;\n } else {\n destinationRow =\n direction === 'prev' ? siblings[0] : siblings[siblings.length - 1];\n }\n if (!destinationRow || !(destinationRow instanceof Element)) {\n return;\n }\n\n const child = destinationRow.children[position];\n if (child && this.isFocusable(child)) {\n const focusableGrandChild = this.getValidFocusableChild(child);\n if (focusableGrandChild) {\n focusableGrandChild.focus();\n } else {\n child.focus();\n }\n }\n }\n }\n\n private verticalCellNavigation(e: KeyboardEvent) {\n if (!(e.target instanceof Element)) {\n return;\n }\n const row = e.target.closest(this.selectors.Row) as Element;\n const cell = e.target.closest(this.selectors.Cell) as Element;\n\n if (row && cell) {\n const cellPosition = this.getColumnIndex(cell);\n const rowPosition = this.getRowIndex(row);\n this.debugLog('gridNavigation', `Initial row position: ${rowPosition}`);\n this.debugLog('gridNavigation', `Initial cell position: ${cellPosition}`);\n if (cellPosition === undefined || rowPosition === undefined) {\n this.debugLog(\n 'verticalCellNavigation',\n 'row or cell position not found',\n );\n return;\n }\n\n const direction = e.key === Keys.ArrowUp ? 'prev' : 'next';\n\n /** Find previous rowgroup and focus on the proper cell */\n if (rowPosition === 0 && direction === 'prev') {\n const currentRowGroup = row.parentElement?.closest(\n this.selectors.RowGroup,\n );\n const siblingRowGroups = [\n ...(currentRowGroup?.parentElement?.children || []),\n ];\n const currentRowGroupIdx = siblingRowGroups.findIndex(\n (el) => el === currentRowGroup,\n );\n if (currentRowGroupIdx !== 0) {\n const previousRowGroup = siblingRowGroups[currentRowGroupIdx - 1];\n const rows = [\n ...previousRowGroup.querySelectorAll(this.selectors.Row),\n ];\n const child = rows[rows.length - 1].children[cellPosition];\n if (child && this.isFocusable(child)) {\n const focusableGrandChild = this.getValidFocusableChild(child);\n if (focusableGrandChild) {\n focusableGrandChild.focus();\n } else {\n child.focus();\n }\n }\n return;\n }\n }\n\n const siblingRows = [\n ...(row.parentElement?.querySelectorAll(this.selectors.Row) || []),\n ];\n /** Find next rowgroup and focus on the proper cell */\n if (rowPosition === siblingRows.length - 1 && direction === 'next') {\n const currentRowGroup = row.parentElement?.closest(\n this.selectors.RowGroup,\n );\n const siblingRowGroups = [\n ...(currentRowGroup?.parentElement?.children || []),\n ];\n const currentRowGroupIdx = siblingRowGroups.findIndex(\n (el) => el === currentRowGroup,\n );\n if (currentRowGroupIdx !== siblingRowGroups.length - 1) {\n const nextRowGroup = siblingRowGroups[currentRowGroupIdx + 1];\n const rows = [...nextRowGroup.querySelectorAll(this.selectors.Row)];\n const child = rows[0].children[cellPosition];\n if (child && this.isFocusable(child)) {\n const focusableGrandChild = this.getValidFocusableChild(child);\n if (focusableGrandChild) {\n focusableGrandChild.focus();\n } else {\n child.focus();\n }\n }\n return;\n }\n return;\n }\n\n /** Navigation in the same rowgroup */\n const destinationRow = this.findUntil(direction, row, this.selectors.Row);\n if (!destinationRow) {\n return;\n }\n\n const child = destinationRow.children[cellPosition];\n if (child && this.isFocusable(child)) {\n const focusableGrandChild = this.getValidFocusableChild(child);\n if (focusableGrandChild) {\n focusableGrandChild.focus();\n } else {\n child.focus();\n }\n }\n }\n }\n\n /**\n * Sending a row `Element` and then the first cell will be focused.\n *\n * If you want to focus the last cell then the row children can be passed in\n * reversed order\n */\n private focusOnFirstCell(el: Element[]) {\n for (let i = 0; i < el.length; i++) {\n const child = el[i];\n if (this.isFocusable(child)) {\n child.focus();\n return;\n }\n }\n }\n\n /**\n * Get the column index of a `cell` based on the first `row` parent.\n * `cellIndex` could be used, but it's not supported in HTML tables.\n */\n private getColumnIndex(cell: Element) {\n let position = 0;\n const siblings = cell?.parentNode?.children;\n if (!siblings) {\n return undefined;\n }\n\n while (cell !== siblings[position] && siblings[position] !== undefined) {\n position++;\n }\n\n // Cell position find was not possible, maybe should log here\n if (siblings[position] === undefined) {\n this.debugLog('getColumnIndex', 'position finding was not successful');\n return undefined;\n }\n return position;\n }\n\n /**\n * Get the row index of a `row` based\n * on its sibling rows\n */\n private getRowIndex(row: Element) {\n let position = 0;\n const siblings = row?.parentNode?.children;\n if (!siblings) {\n return undefined;\n }\n\n while (row !== siblings[position] && siblings[position] !== undefined) {\n position++;\n }\n\n // Cell position find was not possible\n if (siblings[position] === undefined) {\n this.debugLog('getRowIndex', 'position finding was not successful');\n return undefined;\n }\n return position;\n }\n\n /**\n * Equivalent to prevUntil/nextUntil in jQuery\n * https://api.jquery.com/prevUntil/\n */\n private findUntil(\n direction: 'next' | 'prev',\n el: Element | ChildNode,\n matchSelector: string,\n exitSelector?: string,\n ): FocusableElement | null {\n let element: ChildNode = el;\n const method = direction === 'next' ? 'nextSibling' : 'previousSibling';\n\n while (element[method]) {\n const sibling = element[method];\n if (!sibling) {\n return null;\n }\n if (\n exitSelector &&\n sibling instanceof Element &&\n sibling.matches(exitSelector)\n ) {\n return null;\n }\n\n if (sibling instanceof Element && sibling.matches(matchSelector)) {\n return sibling as FocusableElement;\n }\n\n element = sibling;\n }\n\n return null;\n }\n}\n"]}
1
+ {"version":3,"file":"data-grid-nav.js","sourceRoot":"","sources":["../../../../src/data-grid/data-grid-nav/data-grid-nav.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,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;YACrC,CAAC;YAED,OAAO,GAAG,OAAO,CAAC;QACpB,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","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 */\nimport { isValidInteractiveElement } from './helpers';\nimport { Keys } from './keys';\nimport { Selectors } from './selectors';\n\ntype FocusableElement = HTMLElement | SVGElement;\n\nexport type Config =\n | {\n /** Enable debug logs */\n isDebug?: boolean;\n /** CSS Selectors being used to find Rows, Row Groups, Cells and Focusable elements */\n selectors?: Partial<typeof Selectors>;\n /** How many rows to move when pressing page up/down - Default goes to first/last row */\n pageUpDown?: number;\n }\n | undefined;\n\nexport class DataGridNav {\n private selectors: Record<keyof typeof Selectors, string>;\n readonly pageUpDown: number | undefined;\n private keys: string[] = [];\n private disabled: boolean;\n readonly debug: boolean;\n\n constructor();\n constructor(config: Config);\n constructor(config: Config = {}) {\n const { selectors = {}, pageUpDown, isDebug = false } = config;\n this.selectors = { ...Selectors, ...selectors };\n this.pageUpDown = pageUpDown;\n this.keys = [];\n this.debug = isDebug;\n this.disabled = false;\n }\n\n private debugLog = (functionName: string, message: string) => {\n if (this.debug) {\n console.info(`[${functionName}]: ${message}`);\n }\n };\n\n /**\n * Disables the keyboard listener in cases\n * that elements inside the grid need to use\n * arrows keys etc., like select dropdowns\n */\n public disable() {\n this.disabled = true;\n }\n\n /**\n * Enables the keyboard listeners\n */\n public enable() {\n this.disabled = false;\n }\n\n private isFocusable(el: Element): el is FocusableElement {\n return el instanceof HTMLElement || el instanceof SVGElement;\n }\n\n public focusParentCell(el: Element) {\n const cell = el.closest(this.selectors.Cell);\n if (cell && this.isFocusable(cell)) {\n cell.focus();\n }\n }\n\n /** Used as a keyboard listener for key up */\n public tableKeyUp() {\n // TODO: have a cleanup as user can press key\n // and then move to another tab, and get back to the same tab\n // so this will not be empty (the bug exists with .pop)\n this.keys = [];\n }\n\n /** Used as a keyboard listener for key down */\n public tableKeyDown(event: KeyboardEvent) {\n this.debugLog('tableKeyDown', `Key pressed: ${event.key}`);\n if (this.disabled) {\n this.debugLog('tableKeyDown', 'interaction is disabled');\n return;\n }\n /**\n * Avoid page scrolling etc.\n * Enable default behavior for:\n * Tab, Shift + Tab\n * TODO: Actually it will be better to just prevent\n * in ArrowKeys and PageKeys maybe?\n * Or should the consumer stop propagation?!\n * Cannot work with preventDefault as it will\n * first capture the event from an input in cell for example\n */\n if (\n Keys.ArrowDown === event.key ||\n Keys.ArrowUp === event.key ||\n Keys.ArrowLeft === event.key ||\n Keys.ArrowRight === event.key\n ) {\n event.preventDefault();\n }\n\n /**\n * Add key to the stack if it's\n * not the same with the last (long press)\n */\n if (\n this.keys.length === 0 ||\n this.keys[this.keys.length - 1] !== event.key\n ) {\n this.keys.push(event.key);\n }\n\n /**\n * Need to check if we are inside a grid cell\n * or not to enable/disable Grid Navigation\n */\n if (!(event.target instanceof Element)) {\n return;\n }\n const cell = event.target.parentElement?.closest(\n `${this.selectors.Cell},${this.selectors.Row}`,\n );\n\n if (!cell) {\n this.debugLog('tableKeyDown', 'cell not found');\n return;\n }\n\n if (cell.matches(this.selectors.Cell)) {\n this.debugLog('tableKeyDown', 'event captured in cell');\n this.cellNavigation(event);\n } else {\n this.debugLog('tableKeyDown', 'event captured in grid');\n this.gridNavigation(event);\n }\n }\n\n /**\n * Handles the navigation inside a cell\n */\n public cellNavigation(event: KeyboardEvent) {\n if (!(event.target instanceof Element)) {\n return;\n }\n\n const cell = event.target.closest(this.selectors.Cell);\n\n if (!cell) {\n this.debugLog('cellNavigation', 'cell not found');\n return;\n }\n\n if (this.getValidFocusableChild(cell)) {\n this.debugLog('cellNavigation', 'valid focusable child found');\n this.gridNavigation(event);\n return;\n }\n\n const focusableWidgets = cell\n ? [...cell.querySelectorAll(this.selectors.Focusable)]\n : [];\n const widgetIdx = focusableWidgets.findIndex((el) => el === event.target);\n\n /**\n * Keys: Escape\n * Restore grid navigation\n */\n if (event.key === Keys.Escape && this.isFocusable(cell)) {\n cell.focus();\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n /**\n * Keys: ArrowRight, ArrowDown\n * Move to the next focusable cell, or the first one\n *\n * Arrow Down disabled:\n * https://github.com/w3c/aria-practices/issues/2739#issuecomment-1613538972\n */\n if (event.key === Keys.ArrowRight || event.key === Keys.ArrowDown) {\n const nextFocusable =\n widgetIdx === focusableWidgets.length - 1 ? 0 : widgetIdx + 1;\n const widgetToFocus = focusableWidgets[nextFocusable];\n if (this.isFocusable(widgetToFocus)) {\n widgetToFocus.focus();\n }\n return;\n }\n\n /**\n * Keys: ArrowLeft, ArrowUp\n * Move to the previous focusable cell, or the last one\n *\n * Arrow Up disabled:\n * https://github.com/w3c/aria-practices/issues/2739#issuecomment-1613538972\n */\n if (event.key === Keys.ArrowLeft || event.key === Keys.ArrowUp) {\n const previousFocusable =\n widgetIdx === 0 ? focusableWidgets.length - 1 : widgetIdx - 1;\n const widgetToFocus = focusableWidgets[previousFocusable];\n if (this.isFocusable(widgetToFocus)) {\n widgetToFocus.focus();\n }\n return;\n }\n }\n\n /**\n * Get the valid focusable child of a cell\n * @returns `FocusableElement` | `null` - The valid focusable child, or null if there are none or multiple focusable children\n */\n private getValidFocusableChild(el: Element): FocusableElement | null {\n const focusableChildren = [\n ...el.querySelectorAll(this.selectors.Focusable),\n ];\n if (\n focusableChildren.length === 1 &&\n isValidInteractiveElement(focusableChildren[0]) &&\n this.isFocusable(focusableChildren[0])\n ) {\n return focusableChildren[0];\n }\n return null;\n }\n\n /**\n * Handles the navigation outside a cell\n * on the grid level\n */\n public gridNavigation(event: KeyboardEvent) {\n if (!(event.target instanceof Element)) {\n return;\n }\n\n if (this.keys.length === 1) {\n /**\n * Keys: Enter\n * Should move focus inside the cell to the first focusable element:\n * https://www.w3.org/WAI/ARIA/apg/patterns/grid/#gridNav_inside\n */\n if (event.key === Keys.Enter) {\n const cell = event.target.querySelector(this.selectors.Focusable);\n if (cell && this.isFocusable(cell)) {\n // Enter can trigger child elements:\n // Source: https://www.reddit.com/r/learnjavascript/comments/14kpj24/wrong_keydown_listener_is_called_with_focus/\n // If the event.preventDefault causes issues, we can offset the execution with setTimeout\n cell.focus();\n event.preventDefault();\n }\n }\n\n /**\n * Keys: ArrowLeft, ArrowRight\n * Should move focus to the next/previous cell\n */\n if (event.key === Keys.ArrowLeft || event.key === Keys.ArrowRight) {\n const direction = event.key === Keys.ArrowLeft ? 'prev' : 'next';\n // Get the closest cell we are currently in\n const cell = event.target.closest(this.selectors.Cell);\n\n if (cell && cell instanceof Element) {\n const closeFocusable = this.findUntil(\n direction,\n cell,\n this.selectors.Cell,\n );\n if (closeFocusable) {\n const focusableChild = this.getValidFocusableChild(closeFocusable);\n\n const toFocus = focusableChild ?? closeFocusable;\n toFocus.focus();\n toFocus.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n });\n }\n }\n }\n\n /**\n * Keys: Up,Down\n * Should move focus to the same column of the next/previous row\n */\n if (event.key === Keys.ArrowDown || event.key === Keys.ArrowUp) {\n this.verticalCellNavigation(event);\n return;\n }\n\n /**\n * Keys: PageUp, PageDown\n * Should move focus to the first/last row\n * or a predefined number of rows if user provides a value\n */\n if (event.key === Keys.PageUp || event.key === Keys.PageDown) {\n this.pageCellNavigation(event);\n return;\n }\n\n /**\n * Keys: Home, End\n * Should move focus to the first/last cell of the current row\n */\n if (event.key === Keys.Home || event.key === Keys.End) {\n const row = event.target.closest(this.selectors.Row) as Element;\n const rowChildren = [...(row?.children || [])];\n if (event.key === 'End') {\n rowChildren.reverse();\n }\n this.focusOnFirstCell(rowChildren);\n }\n } else {\n /**\n * Keys: Control + Home, Control + End\n * Should move focus to the first/last cell of the first/last row\n */\n const [firstKey, secondKey] = this.keys;\n if (\n firstKey === 'Control' &&\n (secondKey === Keys.Home || secondKey === Keys.End)\n ) {\n const row = event.target.closest(this.selectors.Row) as Element;\n const siblings = row.parentElement?.children;\n\n if (!siblings) {\n this.debugLog('cellNavigation', 'siblings not found');\n return;\n }\n\n const rowToFocus =\n secondKey === Keys.Home ? siblings[0] : siblings[siblings.length - 1];\n const rowChildren = [...(rowToFocus?.children || [])];\n if (secondKey === Keys.End) {\n rowChildren.reverse();\n }\n this.focusOnFirstCell(rowChildren);\n }\n }\n }\n\n private pageCellNavigation(event: KeyboardEvent) {\n if (!(event.target instanceof Element)) {\n return;\n }\n const row = event.target.closest(this.selectors.Row) as Element;\n const cell = event.target.closest(this.selectors.Cell) as Element;\n\n if (row && cell) {\n const position = this.getColumnIndex(cell);\n\n if (position === undefined) {\n this.debugLog('cellNavigation', 'position not found');\n return;\n }\n\n const direction = event.key === Keys.PageUp ? 'prev' : 'next';\n const siblings = row.parentElement?.children;\n\n if (!siblings) {\n this.debugLog('cellNavigation', 'siblings not found');\n return;\n }\n\n // If pageUpDown is defined, we should move that number of rows, or to the closest possible\n let destinationRow: Element | ChildNode;\n if (this.pageUpDown) {\n const methodClbk =\n direction === 'prev' ? 'previousSibling' : 'nextSibling';\n let sibling = row[methodClbk];\n if (sibling === null) {\n return;\n }\n\n let lastVisitedSibling = sibling;\n\n for (let index = 0; index < this.pageUpDown - 1 && sibling; index++) {\n sibling = sibling[methodClbk];\n if (sibling) {\n lastVisitedSibling = sibling;\n }\n }\n destinationRow = sibling ? sibling : lastVisitedSibling;\n } else {\n destinationRow =\n direction === 'prev' ? siblings[0] : siblings[siblings.length - 1];\n }\n if (!destinationRow || !(destinationRow instanceof Element)) {\n return;\n }\n\n const child = destinationRow.children[position];\n if (child && this.isFocusable(child)) {\n const focusableGrandChild = this.getValidFocusableChild(child);\n if (focusableGrandChild) {\n focusableGrandChild.focus();\n } else {\n child.focus();\n }\n }\n }\n }\n\n private verticalCellNavigation(event: KeyboardEvent) {\n if (!(event.target instanceof Element)) {\n return;\n }\n const row = event.target.closest(this.selectors.Row) as Element;\n const cell = event.target.closest(this.selectors.Cell) as Element;\n\n if (row && cell) {\n const cellPosition = this.getColumnIndex(cell);\n const rowPosition = this.getRowIndex(row);\n this.debugLog('gridNavigation', `Initial row position: ${rowPosition}`);\n this.debugLog('gridNavigation', `Initial cell position: ${cellPosition}`);\n if (cellPosition === undefined || rowPosition === undefined) {\n this.debugLog(\n 'verticalCellNavigation',\n 'row or cell position not found',\n );\n return;\n }\n\n const direction = event.key === Keys.ArrowUp ? 'prev' : 'next';\n\n /** Find previous rowgroup and focus on the proper cell */\n if (rowPosition === 0 && direction === 'prev') {\n const currentRowGroup = row.parentElement?.closest(\n this.selectors.RowGroup,\n );\n const siblingRowGroups = [\n ...(currentRowGroup?.parentElement?.children || []),\n ];\n const currentRowGroupIdx = siblingRowGroups.findIndex(\n (el) => el === currentRowGroup,\n );\n if (currentRowGroupIdx !== 0) {\n const previousRowGroup = siblingRowGroups[currentRowGroupIdx - 1];\n const rows = [\n ...previousRowGroup.querySelectorAll(this.selectors.Row),\n ];\n const child = rows[rows.length - 1].children[cellPosition];\n if (child && this.isFocusable(child)) {\n const focusableGrandChild = this.getValidFocusableChild(child);\n if (focusableGrandChild) {\n focusableGrandChild.focus();\n } else {\n child.focus();\n }\n }\n return;\n }\n }\n\n const siblingRows = [\n ...(row.parentElement?.querySelectorAll(this.selectors.Row) || []),\n ];\n /** Find next rowgroup and focus on the proper cell */\n if (rowPosition === siblingRows.length - 1 && direction === 'next') {\n const currentRowGroup = row.parentElement?.closest(\n this.selectors.RowGroup,\n );\n const siblingRowGroups = [\n ...(currentRowGroup?.parentElement?.children || []),\n ];\n const currentRowGroupIdx = siblingRowGroups.findIndex(\n (el) => el === currentRowGroup,\n );\n if (currentRowGroupIdx !== siblingRowGroups.length - 1) {\n const nextRowGroup = siblingRowGroups[currentRowGroupIdx + 1];\n const rows = [...nextRowGroup.querySelectorAll(this.selectors.Row)];\n const child = rows[0].children[cellPosition];\n if (child && this.isFocusable(child)) {\n const focusableGrandChild = this.getValidFocusableChild(child);\n if (focusableGrandChild) {\n focusableGrandChild.focus();\n } else {\n child.focus();\n }\n }\n return;\n }\n return;\n }\n\n /** Navigation in the same rowgroup */\n const destinationRow = this.findUntil(direction, row, this.selectors.Row);\n if (!destinationRow) {\n return;\n }\n\n const child = destinationRow.children[cellPosition];\n if (child && this.isFocusable(child)) {\n const focusableGrandChild = this.getValidFocusableChild(child);\n if (focusableGrandChild) {\n focusableGrandChild.focus();\n } else {\n child.focus();\n }\n }\n }\n }\n\n /**\n * Sending a row `Element` and then the first cell will be focused.\n *\n * If you want to focus the last cell then the row children can be passed in\n * reversed order\n */\n private focusOnFirstCell(el: Element[]) {\n for (let index = 0; index < el.length; index++) {\n const child = el[index];\n if (this.isFocusable(child)) {\n child.focus();\n return;\n }\n }\n }\n\n /**\n * Get the column index of a `cell` based on the first `row` parent.\n * `cellIndex` could be used, but it's not supported in HTML tables.\n */\n private getColumnIndex(cell: Element) {\n let position = 0;\n const siblings = cell?.parentNode?.children;\n if (!siblings) {\n return undefined;\n }\n\n while (cell !== siblings[position] && siblings[position] !== undefined) {\n position++;\n }\n\n // Cell position find was not possible, maybe should log here\n if (siblings[position] === undefined) {\n this.debugLog('getColumnIndex', 'position finding was not successful');\n return undefined;\n }\n return position;\n }\n\n /**\n * Get the row index of a `row` based\n * on its sibling rows\n */\n private getRowIndex(row: Element) {\n let position = 0;\n const siblings = row?.parentNode?.children;\n if (!siblings) {\n return undefined;\n }\n\n while (row !== siblings[position] && siblings[position] !== undefined) {\n position++;\n }\n\n // Cell position find was not possible\n if (siblings[position] === undefined) {\n this.debugLog('getRowIndex', 'position finding was not successful');\n return undefined;\n }\n return position;\n }\n\n /**\n * Equivalent to prevUntil/nextUntil in jQuery\n * https://api.jquery.com/prevUntil/\n */\n private findUntil(\n direction: 'next' | 'prev',\n el: Element | ChildNode,\n matchSelector: string,\n exitSelector?: string,\n ): FocusableElement | null {\n let element: ChildNode = el;\n const method = direction === 'next' ? 'nextSibling' : 'previousSibling';\n\n while (element[method]) {\n const sibling = element[method];\n if (!sibling) {\n return null;\n }\n if (\n exitSelector &&\n sibling instanceof Element &&\n sibling.matches(exitSelector)\n ) {\n return null;\n }\n\n if (sibling instanceof Element && sibling.matches(matchSelector)) {\n return sibling as FocusableElement;\n }\n\n element = sibling;\n }\n\n return null;\n }\n}\n"]}
@@ -20,7 +20,7 @@
20
20
  */
21
21
  /**
22
22
  * This function checks that an element is interactive and of a type that doesn't disrupt grid navigation.
23
- * @param element the element to check
23
+ * @param element - The element to check
24
24
  * @returns true if the element is an interactive element that doesn't disrupt grid navigation
25
25
  */
26
26
  export const isValidInteractiveElement = (element) => {
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../src/data-grid/data-grid-nav/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,OAAgB,EAAW,EAAE;IACrE,IAAI,CAAC,CAAC,OAAO,YAAY,WAAW,CAAC,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;IAC5D,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC;QACpC,UAAU;QACV,OAAO;QACP,QAAQ;QACR,OAAO;KACR,CAAC,CAAC;IAEH,IAAI,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,OAAO,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QAChC,MAAM,SAAS,GAAI,OAA4B,CAAC,IAAI,CAAC;QACrD,OAAO,qBAAqB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,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\n/**\n * This function checks that an element is interactive and of a type that doesn't disrupt grid navigation.\n * @param element the element to check\n * @returns true if the element is an interactive element that doesn't disrupt grid navigation\n */\nexport const isValidInteractiveElement = (element: Element): boolean => {\n if (!(element instanceof HTMLElement)) {\n return false;\n }\n\n const interactiveTags = new Set(['A', 'BUTTON', 'DETAILS']);\n const interactiveInputTypes = new Set([\n 'checkbox',\n 'radio',\n 'submit',\n 'reset',\n ]);\n\n if (interactiveTags.has(element.tagName)) {\n return true;\n }\n\n if (element.tagName === 'INPUT') {\n const inputType = (element as HTMLInputElement).type;\n return interactiveInputTypes.has(inputType);\n }\n\n return false;\n};\n"]}
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../src/data-grid/data-grid-nav/helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,OAAgB,EAAW,EAAE;IACrE,IAAI,CAAC,CAAC,OAAO,YAAY,WAAW,CAAC,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;IAC5D,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC;QACpC,UAAU;QACV,OAAO;QACP,QAAQ;QACR,OAAO;KACR,CAAC,CAAC;IAEH,IAAI,eAAe,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,OAAO,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;QAChC,MAAM,SAAS,GAAI,OAA4B,CAAC,IAAI,CAAC;QACrD,OAAO,qBAAqB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,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\n/**\n * This function checks that an element is interactive and of a type that doesn't disrupt grid navigation.\n * @param element - The element to check\n * @returns true if the element is an interactive element that doesn't disrupt grid navigation\n */\nexport const isValidInteractiveElement = (element: Element): boolean => {\n if (!(element instanceof HTMLElement)) {\n return false;\n }\n\n const interactiveTags = new Set(['A', 'BUTTON', 'DETAILS']);\n const interactiveInputTypes = new Set([\n 'checkbox',\n 'radio',\n 'submit',\n 'reset',\n ]);\n\n if (interactiveTags.has(element.tagName)) {\n return true;\n }\n\n if (element.tagName === 'INPUT') {\n const inputType = (element as HTMLInputElement).type;\n return interactiveInputTypes.has(inputType);\n }\n\n return false;\n};\n"]}
@@ -29,7 +29,7 @@ export function useTableNav(options) {
29
29
  }
30
30
  // A piece of state to force a re-render when you want to react to instance changes
31
31
  const [, setVersion] = useState(0);
32
- const forceUpdate = useCallback(() => setVersion((v) => v + 1), []);
32
+ const forceUpdate = useCallback(() => setVersion((version) => version + 1), []);
33
33
  // Wrap the instance in a proxy that intercepts reads/writes
34
34
  const proxiedInstance = useMemo(() => {
35
35
  const handler = {
@@ -66,7 +66,7 @@ export function useTableNav(options) {
66
66
  }, [forceUpdate]);
67
67
  return {
68
68
  listeners: {
69
- onKeyDown: (e) => proxiedInstance.tableKeyDown(e.nativeEvent),
69
+ onKeyDown: (event) => proxiedInstance.tableKeyDown(event.nativeEvent),
70
70
  onKeyUp: () => proxiedInstance.tableKeyUp(),
71
71
  },
72
72
  tableNav: proxiedInstance,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data-grid/data-grid-nav/index.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE/D,OAAO,EAAe,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE3D,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,qEAAqE;IACrE,MAAM,WAAW,GAAG,MAAM,CAAqB,IAAI,CAAC,CAAC;IACrD,IAAI,WAAW,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QACjC,WAAW,CAAC,OAAO,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;IAED,mFAAmF;IACnF,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,EAAE,CA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AC,WAAW,CAAC,CAAC,CAAC;IAElB,OAAO;QACL,SAAS,EAAE;YACT,SAAS,EAAE,CAAC,CAAsB,EAAE,EAAE,CACpC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC;YAC7C,OAAO,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,UAAU,EAAE;SAC5C;QACD,QAAQ,EAAE,eAAe;KAC1B,CAAC;AACJ,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 */\nimport type React from 'react';\nimport { useCallback, useMemo, useRef, useState } from 'react';\n\nimport { type Config, DataGridNav } from './data-grid-nav';\n\nexport function useTableNav(options?: Config) {\n // Store the actual class instance in a ref so we only create it once\n const instanceRef = useRef<DataGridNav | null>(null);\n if (instanceRef.current === null) {\n instanceRef.current = new DataGridNav(options);\n }\n\n // A piece of state to force a re-render when you want to react to instance changes\n const [, setVersion] = useState(0);\n const forceUpdate = useCallback(() => setVersion((v) => v + 1), []);\n\n // Wrap the instance in a proxy that intercepts reads/writes\n const proxiedInstance = useMemo(() => {\n const handler: ProxyHandler<DataGridNav> = {\n get(target, prop, receiver) {\n const value = Reflect.get(target, prop, receiver);\n\n // If it's a function (a class method), we can intercept calls:\n if (typeof value === 'function') {\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n return (...args: any[]) => {\n // Call the original method\n const result = value.apply(target, args);\n\n // Example: force re-render if the method is known to change internal state\n // or if you want to force re-render after *every* method call, remove the condition\n if (['enable', 'disable'].includes(String(prop))) {\n forceUpdate();\n }\n return result;\n };\n }\n\n // Otherwise, it's a property. Just return it.\n return value;\n },\n\n // Trap for property assignments, so React can re-render on changes\n set(target, prop, newValue, receiver) {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const result = Reflect.set(target, prop, newValue, receiver);\n // Force re-render after setting *any* property\n forceUpdate();\n return result;\n },\n };\n\n return new Proxy(instanceRef.current as DataGridNav, handler);\n // We only want to create a new Proxy if the instanceRef or forceUpdate changes\n }, [forceUpdate]);\n\n return {\n listeners: {\n onKeyDown: (e: React.KeyboardEvent) =>\n proxiedInstance.tableKeyDown(e.nativeEvent),\n onKeyUp: () => proxiedInstance.tableKeyUp(),\n },\n tableNav: proxiedInstance,\n };\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/data-grid/data-grid-nav/index.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE/D,OAAO,EAAe,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE3D,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,qEAAqE;IACrE,MAAM,WAAW,GAAG,MAAM,CAAqB,IAAI,CAAC,CAAC;IACrD,IAAI,WAAW,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QACjC,WAAW,CAAC,OAAO,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;IAED,mFAAmF;IACnF,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,WAAW,GAAG,WAAW,CAC7B,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,GAAG,CAAC,CAAC,EAC1C,EAAE,CACH,CAAC;IAEF,4DAA4D;IAC5D,MAAM,eAAe,GAAG,OAAO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,WAAW,CAAC;YACjD,OAAO,EAAE,GAAG,EAAE,CAAC,eAAe,CAAC,UAAU,EAAE;SAC5C;QACD,QAAQ,EAAE,eAAe;KAC1B,CAAC;AACJ,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 */\nimport type React from 'react';\nimport { useCallback, useMemo, useRef, useState } from 'react';\n\nimport { type Config, DataGridNav } from './data-grid-nav';\n\nexport function useTableNav(options?: Config) {\n // Store the actual class instance in a ref so we only create it once\n const instanceRef = useRef<DataGridNav | null>(null);\n if (instanceRef.current === null) {\n instanceRef.current = new DataGridNav(options);\n }\n\n // A piece of state to force a re-render when you want to react to instance changes\n const [, setVersion] = useState(0);\n const forceUpdate = useCallback(\n () => setVersion((version) => version + 1),\n [],\n );\n\n // Wrap the instance in a proxy that intercepts reads/writes\n const proxiedInstance = useMemo(() => {\n const handler: ProxyHandler<DataGridNav> = {\n get(target, prop, receiver) {\n const value = Reflect.get(target, prop, receiver);\n\n // If it's a function (a class method), we can intercept calls:\n if (typeof value === 'function') {\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n return (...args: any[]) => {\n // Call the original method\n const result = value.apply(target, args);\n\n // Example: force re-render if the method is known to change internal state\n // or if you want to force re-render after *every* method call, remove the condition\n if (['enable', 'disable'].includes(String(prop))) {\n forceUpdate();\n }\n return result;\n };\n }\n\n // Otherwise, it's a property. Just return it.\n return value;\n },\n\n // Trap for property assignments, so React can re-render on changes\n set(target, prop, newValue, receiver) {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const result = Reflect.set(target, prop, newValue, receiver);\n // Force re-render after setting *any* property\n forceUpdate();\n return result;\n },\n };\n\n return new Proxy(instanceRef.current as DataGridNav, handler);\n // We only want to create a new Proxy if the instanceRef or forceUpdate changes\n }, [forceUpdate]);\n\n return {\n listeners: {\n onKeyDown: (event: React.KeyboardEvent) =>\n proxiedInstance.tableKeyDown(event.nativeEvent),\n onKeyUp: () => proxiedInstance.tableKeyUp(),\n },\n tableNav: proxiedInstance,\n };\n}\n"]}