@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":"tree-view-utils.js","sourceRoot":"","sources":["../../../src/tree-view/tree-view-utils.ts"],"names":[],"mappings":";;;AAuEA,4CAcC;AAOD,8BAqCC;AAqCD,sCAiDC;AAlMD,gDAA8C;AAU9C;;;;;;;GAOG;AACI,MAAM,WAAW,GAAG,CACzB,IAAmB,EACnB,KAAK,GAAG,CAAC,EACT,WAAoC,IAAI,EAChB,EAAE;IAC1B,MAAM,SAAS,GAA2B,EAAE,CAAC;IAE7C,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;;QACpB,SAAS,CAAC,IAAI,iCACT,IAAI,KACP,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ;YAClB,uCAAuC;YACvC,iBAAiB,EAAE,MAAA,IAAI,CAAC,iBAAiB,mCAAI,KAAK,IAClD,CAAC;QAEH,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACzB,IAAA,mBAAW,EAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CACjE,SAAS,CA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,EAAE,CAAC;YAC/B,OAAO,YAAY,CAAC,EAAE,CAAC;QACzB,CAAC;QAED,MAAM,SAAS,GAAG,MAAA,QAAQ;aACvB,KAAK,CAAC,CAAC,EAAE,aAAa,CAAC;aACvB,OAAO,EAAE;aACT,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,0CAAE,QAAQ,CAAC;QAElD,OAAO,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,IAAI,CAAC;IAC3B,CAAC;AACH,CAAC;AACD;;;;GAIG;AAEI,MAAM,iBAAiB,GAAG,CAAC,SAKjC,EAAE,EAAE;IACH,OAAO,UAAU,SAAS,CAAC,MAAM,YAAY,SAAS,CAAC,MAAM,iBAAiB,SAAS,CAAC,CAAC,OAAO,SAAS,CAAC,CAAC,QAAQ,CAAC;AACtH,CAAC,CAAC;AAPW,QAAA,iBAAiB,qBAO5B","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 UniqueIdentifier } from '@dnd-kit/core';\nimport { arrayMove } from '@dnd-kit/sortable';\nimport { type RefObject } from 'react';\n\nimport { type FlattenedTreeItem, type TreeItem } from './tree-view-types';\n\nexport type SensorContext<T> = RefObject<{\n items: FlattenedTreeItem<T>[];\n offset: number;\n}>;\n\n/**\n * Takes a tree and flattens it into a list of item\n * where each item has a depth and a parentId.\n * @param tree the tree to flatten\n * @param depth the depth of the root of the tree (default 0)\n * @param parentId the id of the parent of the root of the tree (default null)\n * @returns a list of items with depth and parentId\n */\nexport const flattenTree = <T>(\n tree: TreeItem<T>[],\n depth = 0,\n parentId: UniqueIdentifier | null = null,\n): FlattenedTreeItem<T>[] => {\n const flattened: FlattenedTreeItem<T>[] = [];\n\n tree.forEach((item) => {\n flattened.push({\n ...item,\n depth: depth,\n parentId: parentId,\n // Default values can go here for items\n isSkeletonLoading: item.isSkeletonLoading ?? false,\n });\n\n if (item.canHaveSubItems) {\n flattenTree(item.subItems, depth + 1, item.id).forEach((subItem) =>\n flattened.push({ ...subItem }),\n );\n }\n });\n\n return flattened;\n};\n\n/**\n * Removes the children of the items with the given ids\n * @param items the flattened tree items to remove the children from\n * @param ids the ids of the items to remove the children from\n * @returns a new list of items with the children of the items with the given ids removed\n */\nexport function removeChildrenOf<T>(\n items: FlattenedTreeItem<T>[],\n ids: UniqueIdentifier[],\n) {\n const excludeParentIds = [...ids];\n return items.filter((item) => {\n if (item.parentId !== null && excludeParentIds.includes(item.parentId)) {\n if (item.canHaveSubItems && item.subItems.length > 0) {\n excludeParentIds.push(item.id);\n }\n return false;\n }\n return true;\n });\n}\n\n/**\n * Builds a tree from a list of flattened tree items\n * @param items the flattened tree items\n * @returns the items as a tree data structure\n */\nexport function buildTree<T>(items: FlattenedTreeItem<T>[]): TreeItem<T>[] {\n const tree: TreeItem<T>[] = [];\n\n // Map array to object\n const itemMap: { [id: string]: TreeItem<T> } = items.reduce(\n (newItemMap, item) => {\n const { id } = item;\n // Add sub items array if it's allowed to have sub items.\n const newItem = {\n // Keep all item properties\n ...item,\n ...(item.canHaveSubItems && {\n subItems: [],\n }),\n };\n return {\n ...newItemMap,\n [id]: newItem,\n };\n },\n {},\n );\n\n // Build the tree structure by assigning children to their parent items\n items.forEach((item) => {\n const { id, parentId } = item;\n if (parentId !== null) {\n const parentItem = itemMap[parentId];\n if (parentItem && parentItem.canHaveSubItems) {\n parentItem.subItems.push(itemMap[id]);\n }\n } else {\n tree.push(itemMap[id]);\n }\n });\n\n return tree;\n}\n\nfunction getDragDepth(offset: number, indentationWidth: number) {\n return Math.round(offset / indentationWidth);\n}\n\nfunction getMaxDepth<T>({\n previousItem,\n}: {\n previousItem: FlattenedTreeItem<T>;\n}) {\n if (previousItem && previousItem.canHaveSubItems === true) {\n return previousItem.depth + 1;\n }\n\n return previousItem?.depth ?? 0;\n}\n\nfunction getMinDepth<T>({ nextItem }: { nextItem: FlattenedTreeItem<T> }) {\n if (nextItem) {\n return nextItem.depth;\n }\n\n return 0;\n}\n\n/**\n * Calculates the new depth, max depth, min depth and parent id of the item being dragged\n * Used to project the position of the dragged item. For example, to convert the item being dragged into a placeholder.\n * such as the line that appears when dragging an item in a tree view.\n * @param items the flattened tree items\n * @param activeId the id of the item being dragged\n * @param overId the id of the item that the dragged item is being dragged over\n * @param dragOffset the offset of the drag in pixels\n * @param indentationWidth the width of the indentation in pixels\n * @returns the depth, max depth, min depth and parent id of the item being dragged\n */\nexport function getProjection<T>(\n items: FlattenedTreeItem<T>[],\n activeId: UniqueIdentifier,\n overId: UniqueIdentifier,\n dragOffset: number,\n indentationWidth: number,\n) {\n const overItemIndex = items.findIndex(({ id }) => id === overId);\n const activeItemIndex = items.findIndex(({ id }) => id === activeId);\n const activeItem = items[activeItemIndex];\n const newItems = arrayMove(items, activeItemIndex, overItemIndex);\n const previousItem = newItems[overItemIndex - 1];\n const nextItem = newItems[overItemIndex + 1];\n const dragDepth = getDragDepth(dragOffset, indentationWidth);\n const projectedDepth = activeItem.depth + dragDepth;\n const maxDepth = getMaxDepth({\n previousItem,\n });\n const minDepth = getMinDepth({ nextItem });\n let depth = projectedDepth;\n\n if (projectedDepth >= maxDepth) {\n depth = maxDepth;\n } else if (projectedDepth < minDepth) {\n depth = minDepth;\n }\n\n return { depth, maxDepth, minDepth, parentId: getParentId() };\n\n function getParentId() {\n if (depth === 0 || !previousItem) {\n return null;\n }\n\n if (depth === previousItem.depth) {\n return previousItem.parentId;\n }\n\n if (depth > previousItem.depth) {\n return previousItem.id;\n }\n\n const newParent = newItems\n .slice(0, overItemIndex)\n .reverse()\n .find((item) => item.depth === depth)?.parentId;\n\n return newParent ?? null;\n }\n}\n/**\n *\n * @param transform a transform object\n * @returns a css transform string\n */\n\nexport const transformToString = (transform: {\n scaleX: number;\n scaleY: number;\n x: number;\n y: number;\n}) => {\n return `scaleX(${transform.scaleX}) scaleY(${transform.scaleY}) translate3d(${transform.x}px, ${transform.y}px, 0)`;\n};\n"]}
1
+ {"version":3,"file":"tree-view-utils.js","sourceRoot":"","sources":["../../../src/tree-view/tree-view-utils.ts"],"names":[],"mappings":";;;AAuEA,4CAcC;AAOD,8BAqCC;AAqCD,sCAiDC;AAlMD,gDAA8C;AAU9C;;;;;;;GAOG;AACI,MAAM,WAAW,GAAG,CACzB,IAAmB,EACnB,KAAK,GAAG,CAAC,EACT,WAAoC,IAAI,EAChB,EAAE;IAC1B,MAAM,SAAS,GAA2B,EAAE,CAAC;IAE7C,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;;QACpB,SAAS,CAAC,IAAI,iCACT,IAAI,KACP,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ;YAClB,uCAAuC;YACvC,iBAAiB,EAAE,MAAA,IAAI,CAAC,iBAAiB,mCAAI,KAAK,IAClD,CAAC;QAEH,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YACzB,IAAA,mBAAW,EAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CACjE,SAAS,CAAC,IAAI,mBAAM,OAAO,EAAG,CAC/B,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAxBW,QAAA,WAAW,eAwBtB;AAEF;;;;;GAKG;AACH,SAAgB,gBAAgB,CAC9B,KAA6B,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,CAAC,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,0CAAE,QAAQ,CAAC;QAElD,OAAO,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,IAAI,CAAC;IAC3B,CAAC;AACH,CAAC;AACD;;;;GAIG;AAEI,MAAM,iBAAiB,GAAG,CAAC,SASjC,EAAE,EAAE;IACH,OAAO,UAAU,SAAS,CAAC,MAAM,YAAY,SAAS,CAAC,MAAM,iBAAiB,SAAS,CAAC,CAAC,OAAO,SAAS,CAAC,CAAC,QAAQ,CAAC;AACtH,CAAC,CAAC;AAXW,QAAA,iBAAiB,qBAW5B","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 UniqueIdentifier } from '@dnd-kit/core';\nimport { arrayMove } from '@dnd-kit/sortable';\nimport { type RefObject } from 'react';\n\nimport { type FlattenedTreeItem, type TreeItem } from './tree-view-types';\n\nexport type SensorContext<T> = RefObject<{\n items: FlattenedTreeItem<T>[];\n offset: number;\n}>;\n\n/**\n * Takes a tree and flattens it into a list of item\n * where each item has a depth and a parentId.\n * @param tree - The tree to flatten\n * @param depth - The depth of the root of the tree (default 0)\n * @param parentId - The id of the parent of the root of the tree (default null)\n * @returns a list of items with depth and parentId\n */\nexport const flattenTree = <T>(\n tree: TreeItem<T>[],\n depth = 0,\n parentId: UniqueIdentifier | null = null,\n): FlattenedTreeItem<T>[] => {\n const flattened: FlattenedTreeItem<T>[] = [];\n\n tree.forEach((item) => {\n flattened.push({\n ...item,\n depth: depth,\n parentId: parentId,\n // Default values can go here for items\n isSkeletonLoading: item.isSkeletonLoading ?? false,\n });\n\n if (item.canHaveSubItems) {\n flattenTree(item.subItems, depth + 1, item.id).forEach((subItem) =>\n flattened.push({ ...subItem }),\n );\n }\n });\n\n return flattened;\n};\n\n/**\n * Removes the children of the items with the given ids\n * @param items - The flattened tree items to remove the children from\n * @param ids - The ids of the items to remove the children from\n * @returns a new list of items with the children of the items with the given ids removed\n */\nexport function removeChildrenOf<T>(\n items: FlattenedTreeItem<T>[],\n ids: UniqueIdentifier[],\n) {\n const excludeParentIds = [...ids];\n return items.filter((item) => {\n if (item.parentId !== null && excludeParentIds.includes(item.parentId)) {\n if (item.canHaveSubItems && item.subItems.length > 0) {\n excludeParentIds.push(item.id);\n }\n return false;\n }\n return true;\n });\n}\n\n/**\n * Builds a tree from a list of flattened tree items\n * @param items - The flattened tree items\n * @returns the items as a tree data structure\n */\nexport function buildTree<T>(items: FlattenedTreeItem<T>[]): TreeItem<T>[] {\n const tree: TreeItem<T>[] = [];\n\n // Map array to object\n const itemMap: { [id: string]: TreeItem<T> } = items.reduce(\n (newItemMap, item) => {\n const { id } = item;\n // Add sub items array if it's allowed to have sub items.\n const newItem = {\n // Keep all item properties\n ...item,\n ...(item.canHaveSubItems && {\n subItems: [],\n }),\n };\n return {\n ...newItemMap,\n [id]: newItem,\n };\n },\n {},\n );\n\n // Build the tree structure by assigning children to their parent items\n items.forEach((item) => {\n const { id, parentId } = item;\n if (parentId !== null) {\n const parentItem = itemMap[parentId];\n if (parentItem && parentItem.canHaveSubItems) {\n parentItem.subItems.push(itemMap[id]);\n }\n } else {\n tree.push(itemMap[id]);\n }\n });\n\n return tree;\n}\n\nfunction getDragDepth(offset: number, indentationWidth: number) {\n return Math.round(offset / indentationWidth);\n}\n\nfunction getMaxDepth<T>({\n previousItem,\n}: {\n previousItem: FlattenedTreeItem<T>;\n}) {\n if (previousItem && previousItem.canHaveSubItems === true) {\n return previousItem.depth + 1;\n }\n\n return previousItem?.depth ?? 0;\n}\n\nfunction getMinDepth<T>({ nextItem }: { nextItem: FlattenedTreeItem<T> }) {\n if (nextItem) {\n return nextItem.depth;\n }\n\n return 0;\n}\n\n/**\n * Calculates the new depth, max depth, min depth and parent id of the item being dragged\n * Used to project the position of the dragged item. For example, to convert the item being dragged into a placeholder.\n * such as the line that appears when dragging an item in a tree view.\n * @param items - The flattened tree items\n * @param activeId - The id of the item being dragged\n * @param overId - The id of the item that the dragged item is being dragged over\n * @param dragOffset - The offset of the drag in pixels\n * @param indentationWidth - The width of the indentation in pixels\n * @returns the depth, max depth, min depth and parent id of the item being dragged\n */\nexport function getProjection<T>(\n items: FlattenedTreeItem<T>[],\n activeId: UniqueIdentifier,\n overId: UniqueIdentifier,\n dragOffset: number,\n indentationWidth: number,\n) {\n const overItemIndex = items.findIndex(({ id }) => id === overId);\n const activeItemIndex = items.findIndex(({ id }) => id === activeId);\n const activeItem = items[activeItemIndex];\n const newItems = arrayMove(items, activeItemIndex, overItemIndex);\n const previousItem = newItems[overItemIndex - 1];\n const nextItem = newItems[overItemIndex + 1];\n const dragDepth = getDragDepth(dragOffset, indentationWidth);\n const projectedDepth = activeItem.depth + dragDepth;\n const maxDepth = getMaxDepth({\n previousItem,\n });\n const minDepth = getMinDepth({ nextItem });\n let depth = projectedDepth;\n\n if (projectedDepth >= maxDepth) {\n depth = maxDepth;\n } else if (projectedDepth < minDepth) {\n depth = minDepth;\n }\n\n return { depth, maxDepth, minDepth, parentId: getParentId() };\n\n function getParentId() {\n if (depth === 0 || !previousItem) {\n return null;\n }\n\n if (depth === previousItem.depth) {\n return previousItem.parentId;\n }\n\n if (depth > previousItem.depth) {\n return previousItem.id;\n }\n\n const newParent = newItems\n .slice(0, overItemIndex)\n .reverse()\n .find((item) => item.depth === depth)?.parentId;\n\n return newParent ?? null;\n }\n}\n/**\n *\n * @param transform - A transform object\n * @returns a css transform string\n */\n\nexport const transformToString = (transform: {\n scaleX: number;\n scaleY: number;\n // TODO v5: fix id-length\n // oxlint-disable-next-line id-length\n x: number;\n // TODO v5: fix id-length\n // oxlint-disable-next-line id-length\n y: number;\n}) => {\n return `scaleX(${transform.scaleX}) scaleY(${transform.scaleY}) translate3d(${transform.x}px, ${transform.y}px, 0)`;\n};\n"]}
@@ -20,7 +20,7 @@
20
20
  */
21
21
  /**
22
22
  * Removes license header comments from source code
23
- * @param source Raw source code string
23
+ * @param source - Raw source code string
24
24
  * @returns Source code with license header removed
25
25
  */
26
26
  export const removeLicenseHeader = (source) => {
@@ -1 +1 @@
1
- {"version":3,"file":"export-stories-utils.js","sourceRoot":"","sources":["../../../src/_common/export-stories-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAc,EAAU,EAAE;IAC5D,OAAO,MAAM,CAAC,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC;AACpD,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 * Removes license header comments from source code\n * @param source Raw source code string\n * @returns Source code with license header removed\n */\nexport const removeLicenseHeader = (source: string): string => {\n return source.replace(/^\\/\\*[\\s\\S]*?\\*\\/\\s*/, '');\n};\n"]}
1
+ {"version":3,"file":"export-stories-utils.js","sourceRoot":"","sources":["../../../src/_common/export-stories-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAc,EAAU,EAAE;IAC5D,OAAO,MAAM,CAAC,OAAO,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC;AACpD,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 * Removes license header comments from source code\n * @param source - Raw source code string\n * @returns Source code with license header removed\n */\nexport const removeLicenseHeader = (source: string): string => {\n return source.replace(/^\\/\\*[\\s\\S]*?\\*\\/\\s*/, '');\n};\n"]}
@@ -115,7 +115,7 @@ export function findUntil(direction, el, matchSelector) {
115
115
  }
116
116
  /**
117
117
  * Find all html elements that are focusable given a parent element
118
- * @param parentElement the parent element
118
+ * @param parentElement - The parent element
119
119
  * @returns an array of HTML elements
120
120
  */
121
121
  export const findFocusableChildren = (parentElement) => {
@@ -130,7 +130,7 @@ export const findFocusableChildren = (parentElement) => {
130
130
  };
131
131
  /**
132
132
  * Using the element that currently has focus, finds the previous sibling of the currently focused element that is focusable
133
- * @param parentRef the parent element
133
+ * @param parentRef - The parent element
134
134
  * @returns the previous focusable element
135
135
  */
136
136
  export const findFocusableSibling = (parentRef, direction) => {
@@ -154,7 +154,7 @@ export const findFocusableSibling = (parentRef, direction) => {
154
154
  /**
155
155
  * Convert hex color to rgb format
156
156
  *
157
- * @param hex color in hex code format
157
+ * @param hex - Color in hex code format
158
158
  * @returns color in rgb format rgb(_, _, _)
159
159
  */
160
160
  export const convertHexToRGB = (hex) => {
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/_common/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAGL,WAAW,EACX,SAAS,EACT,MAAM,GACP,MAAM,OAAO,CAAC;AAIf,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,EAAE,CAC9C,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;AAEtC,qCAAqC;AACrC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE,CAC5C,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAEpC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAAE,EAAE,CACtD,OAAO,CAAC,IAAI,CAAC,iBAAiB,OAAO,EAAE,CAAC,CAAC;AAE3C,MAAM,gBAAgB,GAAG,CAAC,GAAa,EAAU,EAAE;IACjD,iFAAiF;IACjF,MAAM,aAAa,GAAG,GAAG,CAAC,eAAe,CAAC,WAAW,CAAC;IACtD,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,GAAG,aAAa,CAAC,CAAC;IAClE,iFAAiF;IACjF,OAAO,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,MAAM,eAAe,GAAG,CAAC,OAAgB,EAAU,EAAE,CACnD,QAAQ,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;A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AS;CACrB,CAAC;AAEX,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,OAA4B,EAC5B,QAAsC,EACtC,EAAE;IACF,OAAO,OAAO;QACZ,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,IAAI,eAAe,CAAC,QAAQ,CAAC,CAAC;QACpD,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,YAAY,EAAE,SAAS;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,OAA2B,EAC3B,QAAqC,EACrC,EAAE;IACF,OAAO,OAAO;QACZ,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,IAAI,cAAc,CAAC,QAAQ,CAAC,CAAC;QAC1D,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAiB,EAA4B,EAAE;IAC5E,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAChE,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,8BAA8B,SAAS,EAAE,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChE,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 */\nimport { tokens } from '@neo4j-ndl/base';\nimport {\n type MouseEvent,\n type TouchEvent,\n useCallback,\n useEffect,\n useRef,\n} from 'react';\n\nimport type { Radius, Spacing } from './types';\n\nexport const removeNewlines = (input: string) =>\n input.replace(/(\\r\\n|\\n|\\r)/gm, '');\n\n/** Remove extra spaces from sting */\nexport const removeSpaces = (input: string) =>\n input.replace(/\\s+/g, ' ').trim();\n\nexport const needleWarningMessage = (message: string) =>\n console.warn(`[🪡 Needle]: ${message}`);\n\nconst getScrollbarSize = (doc: Document): number => {\n // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes\n const documentWidth = doc.documentElement.clientWidth;\n const scrollBarSize = Math.abs(window.innerWidth - documentWidth);\n // Firefox with 110% and 120% zoom level return 1px even if there is no scrollbar\n return scrollBarSize > 1 ? scrollBarSize : 0;\n};\n\nconst getPaddingRight = (element: Element): number =>\n parseInt(window.getComputedStyle(element).paddingRight, 10) || 0;\n\n/**\n * Toggles scroll on the provided document.\n * Useful for disabling scroll when a popup is open (ie ContextMenu/Modal)\n */\nexport const useDocumentScrollToggle = () => {\n const bodyPadding = useRef<number>(0);\n\n return useCallback((disable: boolean, doc: Document = document) => {\n if (disable) {\n const existingPaddingRight = getPaddingRight(doc.body);\n bodyPadding.current = existingPaddingRight;\n const newPaddingRight = existingPaddingRight + getScrollbarSize(doc);\n doc.body.style.overflow = 'hidden';\n doc.body.style.paddingRight = `${newPaddingRight}px`;\n } else {\n doc.body.style.overflow = '';\n doc.body.style.paddingRight = `${bodyPadding.current}px`;\n }\n }, []);\n};\n\n/**\n * Detect if there is a click event outside\n * of the provided element\n * Source:\n * https://hashnode.com/post/useonclickoutside-custom-hook-to-detect-the-mouse-click-on-outside-typescript-ckrejmy3h0k5r91s18iu42t28\n */\nexport const useOnClickOutside = <T extends HTMLElement = HTMLElement>(\n ref: React.RefObject<T>,\n handler: (event: MouseEvent | TouchEvent) => void,\n) => {\n useEffect(() => {\n const listener = (event: MouseEvent | TouchEvent) => {\n const el = ref?.current;\n if (!el || el.contains((event?.target as Node) || null)) {\n return;\n }\n\n handler(event); // Call the handler only if the click is outside of the element passed.\n };\n\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n document.addEventListener('mousedown', listener as any);\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n document.addEventListener('touchstart', listener as any);\n\n return () => {\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n document.removeEventListener('mousedown', listener as any);\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n document.removeEventListener('touchstart', listener as any);\n };\n }, [ref, handler]); // Reload only if ref or handler changes\n};\n\n/**\n * X - char long pseudo-random string\n */\nexport const randomId = (length: number) =>\n Math.random()\n .toString(36)\n .slice(2, length + 2);\n\n// Utility / Type-Guard if the object is a ref\nexport function isRefObject<T>(\n obj: React.RefObject<T> | T,\n): obj is React.RefObject<T> {\n return obj && typeof obj === 'object' && 'current' in obj;\n}\n\n/**\n * Equivalent to prevUntil/nextUntil in jQuery\n * https://api.jquery.com/prevUntil/\n * https://api.jquery.com/nextUntil/\n *\n * Additional functionality is added to circle back\n * to the beginning of a list of siblings if it reaches the end\n * or vice versa.\n */\nexport function findUntil(\n direction: 'next' | 'prev',\n el: Element | ChildNode,\n matchSelector: string,\n): Element | null {\n const element: ChildNode = el;\n\n if (!element.parentElement) {\n return null;\n }\n\n const allSiblings = [...element.parentElement.children].filter((sibling) =>\n sibling.matches(matchSelector),\n );\n\n const index = allSiblings.findIndex((sibling) =>\n sibling.isEqualNode(element),\n );\n\n if (index === -1) {\n return null;\n }\n\n const newIndex =\n direction === 'next'\n ? (index + 1) % allSiblings.length\n : (index - 1 + allSiblings.length) % allSiblings.length;\n\n return allSiblings[newIndex];\n}\n\n/**\n * Find all html elements that are focusable given a parent element\n * @param parentElement the parent element\n * @returns an array of HTML elements\n */\nexport const findFocusableChildren = (parentElement: HTMLElement) => {\n const focusableElements =\n 'a:not([disabled]), button:not([disabled]), input[type=text]:not([disabled]), input[type=checkbox]:not([disabled]), [tabindex]:not([disabled]):not([tabindex=\"-1\"])';\n\n const focusable = Array.from(\n parentElement.querySelectorAll(focusableElements),\n ).filter((element) => {\n if (element instanceof HTMLElement) {\n return true;\n }\n\n return false;\n });\n return focusable;\n};\n\n/**\n * Using the element that currently has focus, finds the previous sibling of the currently focused element that is focusable\n * @param parentRef the parent element\n * @returns the previous focusable element\n */\nexport const findFocusableSibling = (\n parentRef: React.RefObject<HTMLElement | null>,\n direction: 'prev' | 'next',\n): HTMLElement | undefined => {\n const { current } = parentRef;\n const { activeElement } = document;\n\n if (current === null || activeElement === null) {\n return undefined;\n }\n\n const focusable = findFocusableChildren(current);\n const index = focusable.indexOf(activeElement);\n if (index > -1) {\n const siblingElement = focusable[index + (direction === 'next' ? 1 : -1)];\n if (\n siblingElement === undefined ||\n !(siblingElement instanceof HTMLElement)\n ) {\n return undefined;\n }\n return siblingElement;\n }\n return undefined;\n};\n\n/**\n * Convert hex color to rgb format\n *\n * @param hex color in hex code format\n * @returns color in rgb format rgb(_, _, _)\n */\nexport const convertHexToRGB = (hex: string) => {\n hex = hex.replace(/^#/, '');\n\n const red = parseInt(hex.substring(0, 2), 16);\n const green = parseInt(hex.substring(2, 4), 16);\n const blue = parseInt(hex.substring(4, 6), 16);\n\n return `rgb(${red}, ${green}, ${blue})`;\n};\n\nexport const SpacingDefaults = {\n gap: '4',\n padding: '4',\n paddingBlockEnd: undefined,\n paddingBlockStart: undefined,\n paddingInline: undefined,\n paddingInlineEnd: undefined,\n paddingInlineStart: undefined,\n} as const;\n\nexport const getSpacing = (\n spacing: Spacing | undefined,\n property: keyof typeof SpacingDefaults,\n) => {\n return spacing\n ? tokens.space[spacing || SpacingDefaults[property]]\n : undefined;\n};\n\nexport const RadiusDefaults = {\n borderRadius: undefined,\n};\n\nexport const getRadius = (\n spacing: Radius | undefined,\n property: keyof typeof RadiusDefaults,\n) => {\n return spacing\n ? tokens.borderRadius[spacing || RadiusDefaults[property]]\n : undefined;\n};\n\nexport const parseRgbString = (rgbString: string): [number, number, number] => {\n const match = rgbString.match(/rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)/);\n if (!match) {\n throw new Error(`Unable to parse RGB color: ${rgbString}`);\n }\n return [Number(match[1]), Number(match[2]), Number(match[3])];\n};\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/_common/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAGL,WAAW,EACX,SAAS,EACT,MAAM,GACP,MAAM,OAAO,CAAC;AAIf,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,EAAE,CAC9C,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;AAEtC,qCAAqC;AACrC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,EAAE,CAC5C,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAEpC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OAAe,EAAE,EAAE,CACtD,OAAO,CAAC,IAAI,CAAC,iBAAiB,OAAO,EAAE,CAAC,CAAC;AAE3C,MAAM,gBAAgB,GAAG,CAAC,GAAa,EAAU,EAAE;IACjD,iFAAiF;IACjF,MAAM,aAAa,GAAG,GAAG,CAAC,eAAe,CAAC,WAAW,CAAC;IACtD,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,GAAG,aAAa,CAAC,CAAC;IAClE,iFAAiF;IACjF,OAAO,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC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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 { tokens } from '@neo4j-ndl/base';\nimport {\n type MouseEvent,\n type TouchEvent,\n useCallback,\n useEffect,\n useRef,\n} from 'react';\n\nimport type { Radius, Spacing } from './types';\n\nexport const removeNewlines = (input: string) =>\n input.replace(/(\\r\\n|\\n|\\r)/gm, '');\n\n/** Remove extra spaces from sting */\nexport const removeSpaces = (input: string) =>\n input.replace(/\\s+/g, ' ').trim();\n\nexport const needleWarningMessage = (message: string) =>\n console.warn(`[🪡 Needle]: ${message}`);\n\nconst getScrollbarSize = (doc: Document): number => {\n // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes\n const documentWidth = doc.documentElement.clientWidth;\n const scrollBarSize = Math.abs(window.innerWidth - documentWidth);\n // Firefox with 110% and 120% zoom level return 1px even if there is no scrollbar\n return scrollBarSize > 1 ? scrollBarSize : 0;\n};\n\nconst getPaddingRight = (element: Element): number =>\n parseInt(window.getComputedStyle(element).paddingRight, 10) || 0;\n\n/**\n * Toggles scroll on the provided document.\n * Useful for disabling scroll when a popup is open (ie ContextMenu/Modal)\n */\nexport const useDocumentScrollToggle = () => {\n const bodyPadding = useRef<number>(0);\n\n return useCallback((disable: boolean, doc: Document = document) => {\n if (disable) {\n const existingPaddingRight = getPaddingRight(doc.body);\n bodyPadding.current = existingPaddingRight;\n const newPaddingRight = existingPaddingRight + getScrollbarSize(doc);\n doc.body.style.overflow = 'hidden';\n doc.body.style.paddingRight = `${newPaddingRight}px`;\n } else {\n doc.body.style.overflow = '';\n doc.body.style.paddingRight = `${bodyPadding.current}px`;\n }\n }, []);\n};\n\n/**\n * Detect if there is a click event outside\n * of the provided element\n * Source:\n * https://hashnode.com/post/useonclickoutside-custom-hook-to-detect-the-mouse-click-on-outside-typescript-ckrejmy3h0k5r91s18iu42t28\n */\nexport const useOnClickOutside = <T extends HTMLElement = HTMLElement>(\n ref: React.RefObject<T>,\n handler: (event: MouseEvent | TouchEvent) => void,\n) => {\n useEffect(() => {\n const listener = (event: MouseEvent | TouchEvent) => {\n const el = ref?.current;\n if (!el || el.contains((event?.target as Node) || null)) {\n return;\n }\n\n handler(event); // Call the handler only if the click is outside of the element passed.\n };\n\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n document.addEventListener('mousedown', listener as any);\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n document.addEventListener('touchstart', listener as any);\n\n return () => {\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n document.removeEventListener('mousedown', listener as any);\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n document.removeEventListener('touchstart', listener as any);\n };\n }, [ref, handler]); // Reload only if ref or handler changes\n};\n\n/**\n * X - char long pseudo-random string\n */\nexport const randomId = (length: number) =>\n Math.random()\n .toString(36)\n .slice(2, length + 2);\n\n// Utility / Type-Guard if the object is a ref\nexport function isRefObject<T>(\n obj: React.RefObject<T> | T,\n): obj is React.RefObject<T> {\n return obj && typeof obj === 'object' && 'current' in obj;\n}\n\n/**\n * Equivalent to prevUntil/nextUntil in jQuery\n * https://api.jquery.com/prevUntil/\n * https://api.jquery.com/nextUntil/\n *\n * Additional functionality is added to circle back\n * to the beginning of a list of siblings if it reaches the end\n * or vice versa.\n */\nexport function findUntil(\n direction: 'next' | 'prev',\n el: Element | ChildNode,\n matchSelector: string,\n): Element | null {\n const element: ChildNode = el;\n\n if (!element.parentElement) {\n return null;\n }\n\n const allSiblings = [...element.parentElement.children].filter((sibling) =>\n sibling.matches(matchSelector),\n );\n\n const index = allSiblings.findIndex((sibling) =>\n sibling.isEqualNode(element),\n );\n\n if (index === -1) {\n return null;\n }\n\n const newIndex =\n direction === 'next'\n ? (index + 1) % allSiblings.length\n : (index - 1 + allSiblings.length) % allSiblings.length;\n\n return allSiblings[newIndex];\n}\n\n/**\n * Find all html elements that are focusable given a parent element\n * @param parentElement - The parent element\n * @returns an array of HTML elements\n */\nexport const findFocusableChildren = (parentElement: HTMLElement) => {\n const focusableElements =\n 'a:not([disabled]), button:not([disabled]), input[type=text]:not([disabled]), input[type=checkbox]:not([disabled]), [tabindex]:not([disabled]):not([tabindex=\"-1\"])';\n\n const focusable = Array.from(\n parentElement.querySelectorAll(focusableElements),\n ).filter((element) => {\n if (element instanceof HTMLElement) {\n return true;\n }\n\n return false;\n });\n return focusable;\n};\n\n/**\n * Using the element that currently has focus, finds the previous sibling of the currently focused element that is focusable\n * @param parentRef - The parent element\n * @returns the previous focusable element\n */\nexport const findFocusableSibling = (\n parentRef: React.RefObject<HTMLElement | null>,\n direction: 'prev' | 'next',\n): HTMLElement | undefined => {\n const { current } = parentRef;\n const { activeElement } = document;\n\n if (current === null || activeElement === null) {\n return undefined;\n }\n\n const focusable = findFocusableChildren(current);\n const index = focusable.indexOf(activeElement);\n if (index > -1) {\n const siblingElement = focusable[index + (direction === 'next' ? 1 : -1)];\n if (\n siblingElement === undefined ||\n !(siblingElement instanceof HTMLElement)\n ) {\n return undefined;\n }\n return siblingElement;\n }\n return undefined;\n};\n\n/**\n * Convert hex color to rgb format\n *\n * @param hex - Color in hex code format\n * @returns color in rgb format rgb(_, _, _)\n */\nexport const convertHexToRGB = (hex: string) => {\n hex = hex.replace(/^#/, '');\n\n const red = parseInt(hex.substring(0, 2), 16);\n const green = parseInt(hex.substring(2, 4), 16);\n const blue = parseInt(hex.substring(4, 6), 16);\n\n return `rgb(${red}, ${green}, ${blue})`;\n};\n\nexport const SpacingDefaults = {\n gap: '4',\n padding: '4',\n paddingBlockEnd: undefined,\n paddingBlockStart: undefined,\n paddingInline: undefined,\n paddingInlineEnd: undefined,\n paddingInlineStart: undefined,\n} as const;\n\nexport const getSpacing = (\n spacing: Spacing | undefined,\n property: keyof typeof SpacingDefaults,\n) => {\n return spacing\n ? tokens.space[spacing || SpacingDefaults[property]]\n : undefined;\n};\n\nexport const RadiusDefaults = {\n borderRadius: undefined,\n};\n\nexport const getRadius = (\n spacing: Radius | undefined,\n property: keyof typeof RadiusDefaults,\n) => {\n return spacing\n ? tokens.borderRadius[spacing || RadiusDefaults[property]]\n : undefined;\n};\n\nexport const parseRgbString = (rgbString: string): [number, number, number] => {\n const match = rgbString.match(/rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)/);\n if (!match) {\n throw new Error(`Unable to parse RGB color: ${rgbString}`);\n }\n return [Number(match[1]), Number(match[2]), Number(match[3])];\n};\n"]}
@@ -38,8 +38,11 @@ export function getWeight(startValue, endValue, value) {
38
38
  */
39
39
  export function lerpColor(startColor, endColor, weight) {
40
40
  return {
41
+ // oxlint-disable-next-line id-length
41
42
  b: Math.round(startColor.b * (1 - weight) + endColor.b * weight),
43
+ // oxlint-disable-next-line id-length
42
44
  g: Math.round(startColor.g * (1 - weight) + endColor.g * weight),
45
+ // oxlint-disable-next-line id-length
43
46
  r: Math.round(startColor.r * (1 - weight) + endColor.r * weight),
44
47
  };
45
48
  }
@@ -1 +1 @@
1
- {"version":3,"file":"color-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/color-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAyBH;;;;GAIG;AACH,MAAM,UAAU,SAAS,CACvB,UAAkB,EAClB,QAAgB,EAChB,KAAa;IAEb,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,GAAG,UAAU,CAAC,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CACvB,UAAoB,EACpB,QAAkB,EAClB,MAAc;IAEd,OAAO;QACL,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC;QAChE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC;QAChE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC;KACjE,CAAC;AACJ,CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport type { RgbColor } from '@uiw/react-color';\n\n/**\n * Computes a linear interpolation weight in [0, 1] for `value` between\n * `startValue` and `endValue`. Values outside the range produce weights\n * outside [0, 1] — callers are responsible for clamping if needed.\n */\nexport function getWeight(\n startValue: number,\n endValue: number,\n value: number,\n): number {\n return (value - startValue) / (endValue - startValue);\n}\n\n/**\n * Linearly interpolates between two RGB colors by `weight` (0 = start, 1 = end).\n * Each channel is rounded to the nearest integer.\n */\nexport function lerpColor(\n startColor: RgbColor,\n endColor: RgbColor,\n weight: number,\n): RgbColor {\n return {\n b: Math.round(startColor.b * (1 - weight) + endColor.b * weight),\n g: Math.round(startColor.g * (1 - weight) + endColor.g * weight),\n r: Math.round(startColor.r * (1 - weight) + endColor.r * weight),\n };\n}\n"]}
1
+ {"version":3,"file":"color-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/color-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAyBH;;;;GAIG;AACH,MAAM,UAAU,SAAS,CACvB,UAAkB,EAClB,QAAgB,EAChB,KAAa;IAEb,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,GAAG,UAAU,CAAC,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CACvB,UAAoB,EACpB,QAAkB,EAClB,MAAc;IAEd,OAAO;QACL,qCAAqC;QACrC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC;QAChE,qCAAqC;QACrC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC;QAChE,qCAAqC;QACrC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC;KACjE,CAAC;AACJ,CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport type { RgbColor } from '@uiw/react-color';\n\n/**\n * Computes a linear interpolation weight in [0, 1] for `value` between\n * `startValue` and `endValue`. Values outside the range produce weights\n * outside [0, 1] — callers are responsible for clamping if needed.\n */\nexport function getWeight(\n startValue: number,\n endValue: number,\n value: number,\n): number {\n return (value - startValue) / (endValue - startValue);\n}\n\n/**\n * Linearly interpolates between two RGB colors by `weight` (0 = start, 1 = end).\n * Each channel is rounded to the nearest integer.\n */\nexport function lerpColor(\n startColor: RgbColor,\n endColor: RgbColor,\n weight: number,\n): RgbColor {\n return {\n // oxlint-disable-next-line id-length\n b: Math.round(startColor.b * (1 - weight) + endColor.b * weight),\n // oxlint-disable-next-line id-length\n g: Math.round(startColor.g * (1 - weight) + endColor.g * weight),\n // oxlint-disable-next-line id-length\n r: Math.round(startColor.r * (1 - weight) + endColor.r * weight),\n };\n}\n"]}
@@ -53,21 +53,21 @@ function parseOffsetMs(offsetStr) {
53
53
  *
54
54
  * Values wrap around midnight: `"00:00:00+01:00"` → 82,800,000 (23:00 UTC).
55
55
  */
56
- export function parseTimeString(s) {
56
+ export function parseTimeString(input) {
57
57
  // Reject datetime strings and anything with an IANA timezone bracket.
58
58
  // Temporal.PlainTime.from silently extracts the time portion from strings
59
59
  // containing a 'T' separator. IANA brackets are meaningless for time-only
60
60
  // values (there is no date to anchor DST to), so they are also rejected.
61
- if (s.includes('T') || s.includes('[')) {
61
+ if (input.includes('T') || input.includes('[')) {
62
62
  return null;
63
63
  }
64
64
  // Offset time: detect "+HH:MM" or "-HH:MM" suffix first. Temporal.PlainTime.from
65
65
  // silently strips offsets and returns the clock-face time, so we must handle
66
66
  // offset strings explicitly before falling through to the plain parse.
67
- const offsetMatch = s.match(/([+-]\d{2}:\d{2})(\[.*\])?$/);
67
+ const offsetMatch = input.match(/([+-]\d{2}:\d{2})(\[.*\])?$/);
68
68
  if (offsetMatch) {
69
69
  const offsetStr = offsetMatch[1];
70
- const timeStr = s.slice(0, s.indexOf(offsetStr));
70
+ const timeStr = input.slice(0, input.indexOf(offsetStr));
71
71
  const offsetMs = parseOffsetMs(offsetStr);
72
72
  if (offsetMs !== null) {
73
73
  try {
@@ -84,7 +84,7 @@ export function parseTimeString(s) {
84
84
  // UTC time with Z suffix (e.g. "14:30:00Z") — strip Z and treat as local (UTC) time.
85
85
  // Only apply when there is no 'T' in the string; a datetime string like
86
86
  // "2024-06-15T14:30:00Z" must not be accepted here.
87
- const normalized = s.endsWith('Z') && !s.includes('T') ? s.slice(0, -1) : s;
87
+ const normalized = input.endsWith('Z') && !input.includes('T') ? input.slice(0, -1) : input;
88
88
  // Local time (no offset) — treated as UTC
89
89
  try {
90
90
  return plainTimeToMs(Temporal.PlainTime.from(normalized));
@@ -112,17 +112,17 @@ export function parseTimeString(s) {
112
112
  * parsed as UTC wall-clock time. (Neo4j `LocalDateTime` values should instead be
113
113
  * parsed with {@link parseLocalDateString}, in the browser's local timezone.)
114
114
  */
115
- export function parseDateString(s) {
115
+ export function parseDateString(input) {
116
116
  // RFC 9557 / ZonedDateTime with IANA bracket notation
117
117
  try {
118
- return Temporal.ZonedDateTime.from(s).epochMilliseconds;
118
+ return Temporal.ZonedDateTime.from(input).epochMilliseconds;
119
119
  }
120
120
  catch (_a) {
121
121
  /* empty */
122
122
  }
123
123
  // UTC or fixed-offset datetime (no IANA name)
124
124
  try {
125
- return Temporal.Instant.from(s).epochMilliseconds;
125
+ return Temporal.Instant.from(input).epochMilliseconds;
126
126
  }
127
127
  catch (_b) {
128
128
  /* empty */
@@ -131,7 +131,7 @@ export function parseDateString(s) {
131
131
  // Also covers date-only strings like "2024-01-01" (PlainDateTime.from parses
132
132
  // them as midnight), so a separate PlainDate path is not needed.
133
133
  try {
134
- return Temporal.PlainDateTime.from(s).toZonedDateTime('UTC')
134
+ return Temporal.PlainDateTime.from(input).toZonedDateTime('UTC')
135
135
  .epochMilliseconds;
136
136
  }
137
137
  catch (_c) {
@@ -158,7 +158,7 @@ export function parseDateString(s) {
158
158
  * The optional `timeZone` parameter overrides the browser's local timezone,
159
159
  * which is useful for deterministic testing.
160
160
  */
161
- export function parseLocalDateString(s, timeZone) {
161
+ export function parseLocalDateString(input, timeZone) {
162
162
  // Reject strings that carry explicit timezone information. This mirrors the
163
163
  // cascade in parseDateString but uses successful parsing as a rejection
164
164
  // signal rather than an acceptance signal:
@@ -171,14 +171,14 @@ export function parseLocalDateString(s, timeZone) {
171
171
  // instead of throwing, so these two pre-checks are necessary to enforce
172
172
  // the plain-only constraint.
173
173
  try {
174
- Temporal.ZonedDateTime.from(s);
174
+ Temporal.ZonedDateTime.from(input);
175
175
  return null;
176
176
  }
177
177
  catch (_a) {
178
178
  /* not a zoned datetime — continue */
179
179
  }
180
180
  try {
181
- Temporal.Instant.from(s);
181
+ Temporal.Instant.from(input);
182
182
  return null;
183
183
  }
184
184
  catch (_b) {
@@ -186,7 +186,8 @@ export function parseLocalDateString(s, timeZone) {
186
186
  }
187
187
  const tz = timeZone !== null && timeZone !== void 0 ? timeZone : Temporal.Now.timeZoneId();
188
188
  try {
189
- return Temporal.PlainDateTime.from(s).toZonedDateTime(tz).epochMilliseconds;
189
+ return Temporal.PlainDateTime.from(input).toZonedDateTime(tz)
190
+ .epochMilliseconds;
190
191
  }
191
192
  catch (_c) {
192
193
  /* empty */
@@ -1 +1 @@
1
- {"version":3,"file":"date-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/date-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,UAAU,GAA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CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { Temporal } from 'temporal-polyfill';\n\nconst MS_PER_DAY = 86_400_000;\n\nfunction plainTimeToMs(pt: Temporal.PlainTime): number {\n return (\n pt.hour * 3_600_000 +\n pt.minute * 60_000 +\n pt.second * 1_000 +\n pt.millisecond\n );\n}\n\nfunction parseOffsetMs(offsetStr: string): number | null {\n const match = offsetStr.match(/^([+-])(\\d{2}):(\\d{2})$/);\n if (!match) {\n return null;\n }\n const sign = match[1] === '+' ? 1 : -1;\n return (\n sign *\n (parseInt(match[2], 10) * 3_600_000 + parseInt(match[3], 10) * 60_000)\n );\n}\n\n/**\n * Parses an ISO 8601 time string to UTC milliseconds since midnight\n * (0–86,399,999). Returns `null` if the string cannot be parsed.\n *\n * Three formats are accepted:\n * 1. Local time (no offset): `\"14:30:00\"`, `\"14:30:00.500\"` — treated as UTC\n * 2. UTC time with Z suffix: `\"14:30:00Z\"` — treated identically to the local form\n * 3. Offset time: `\"14:30:00+02:00\"` — the offset is applied so the result\n * is the equivalent UTC time of day. `\"12:00:00+01:00\"` resolves to\n * 39,600,000 (11:00 UTC), which is less than `\"12:00:00+00:00\"` (43,200,000).\n *\n * Values wrap around midnight: `\"00:00:00+01:00\"` → 82,800,000 (23:00 UTC).\n */\nexport function parseTimeString(s: string): number | null {\n // Reject datetime strings and anything with an IANA timezone bracket.\n // Temporal.PlainTime.from silently extracts the time portion from strings\n // containing a 'T' separator. IANA brackets are meaningless for time-only\n // values (there is no date to anchor DST to), so they are also rejected.\n if (s.includes('T') || s.includes('[')) {\n return null;\n }\n // Offset time: detect \"+HH:MM\" or \"-HH:MM\" suffix first. Temporal.PlainTime.from\n // silently strips offsets and returns the clock-face time, so we must handle\n // offset strings explicitly before falling through to the plain parse.\n const offsetMatch = s.match(/([+-]\\d{2}:\\d{2})(\\[.*\\])?$/);\n if (offsetMatch) {\n const offsetStr = offsetMatch[1];\n const timeStr = s.slice(0, s.indexOf(offsetStr));\n const offsetMs = parseOffsetMs(offsetStr);\n if (offsetMs !== null) {\n try {\n const localMs = plainTimeToMs(Temporal.PlainTime.from(timeStr));\n // Subtract the UTC offset to normalise to UTC time-of-day; wrap around midnight\n return (((localMs - offsetMs) % MS_PER_DAY) + MS_PER_DAY) % MS_PER_DAY;\n } catch {\n /* empty */\n }\n }\n return null;\n }\n\n // UTC time with Z suffix (e.g. \"14:30:00Z\") — strip Z and treat as local (UTC) time.\n // Only apply when there is no 'T' in the string; a datetime string like\n // \"2024-06-15T14:30:00Z\" must not be accepted here.\n const normalized = s.endsWith('Z') && !s.includes('T') ? s.slice(0, -1) : s;\n\n // Local time (no offset) — treated as UTC\n try {\n return plainTimeToMs(Temporal.PlainTime.from(normalized));\n } catch {\n /* empty */\n }\n\n return null;\n}\n\n/**\n * Parses an ISO 8601 or RFC 9557 date/datetime string to a Unix millisecond\n * timestamp. Returns `null` if the string cannot be parsed.\n *\n * Three formats are tried in order:\n * 1. RFC 9557 ZonedDateTime with IANA bracket notation\n * e.g. `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset inferred from the\n * named timezone, including DST) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"`\n * (offset explicit; bracket must agree with the IANA zone)\n * 2. UTC or fixed-offset Instant\n * e.g. `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * 3. Plain date or datetime (no offset, `Z`, or IANA bracket), interpreted as UTC\n * e.g. `\"2024-01-01\"`, `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n *\n * Strings with a time component that lack `Z`, an offset, or an IANA bracket are\n * parsed as UTC wall-clock time. (Neo4j `LocalDateTime` values should instead be\n * parsed with {@link parseLocalDateString}, in the browser's local timezone.)\n */\nexport function parseDateString(s: string): number | null {\n // RFC 9557 / ZonedDateTime with IANA bracket notation\n try {\n return Temporal.ZonedDateTime.from(s).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n // UTC or fixed-offset datetime (no IANA name)\n try {\n return Temporal.Instant.from(s).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n // Plain datetime — interpret as UTC.\n // Also covers date-only strings like \"2024-01-01\" (PlainDateTime.from parses\n // them as midnight), so a separate PlainDate path is not needed.\n try {\n return Temporal.PlainDateTime.from(s).toZonedDateTime('UTC')\n .epochMilliseconds;\n } catch {\n /* empty */\n }\n\n return null;\n}\n\n/**\n * Parses a plain (unzoned) ISO 8601 date or datetime string to a Unix\n * millisecond timestamp, interpreting the wall-clock time in the given\n * `timeZone` (defaults to the browser's local timezone via\n * `Temporal.Now.timeZoneId()`). Returns `null` if the string cannot be\n * parsed or contains any timezone qualifier.\n *\n * Only plain date/datetime strings are accepted — strings with `Z`, a\n * fixed UTC offset (`+02:00`), or an IANA bracket (`[Europe/Stockholm]`)\n * are **rejected** and return `null`. This mirrors the semantics of\n * Neo4j `LocalDateTime`, which has no associated timezone.\n *\n * Accepted formats:\n * - Plain datetime: `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as local midnight): `\"2024-01-01\"`\n *\n * The optional `timeZone` parameter overrides the browser's local timezone,\n * which is useful for deterministic testing.\n */\nexport function parseLocalDateString(\n s: string,\n timeZone?: string,\n): number | null {\n // Reject strings that carry explicit timezone information. This mirrors the\n // cascade in parseDateString but uses successful parsing as a rejection\n // signal rather than an acceptance signal:\n //\n // - ZonedDateTime.from succeeds → string has an IANA bracket → reject\n // - Instant.from succeeds → string has Z or a fixed offset → reject\n // - PlainDateTime.from succeeds → truly plain string → accept\n //\n // The polyfill's PlainDateTime.from() silently strips offsets/brackets\n // instead of throwing, so these two pre-checks are necessary to enforce\n // the plain-only constraint.\n try {\n Temporal.ZonedDateTime.from(s);\n return null;\n } catch {\n /* not a zoned datetime — continue */\n }\n\n try {\n Temporal.Instant.from(s);\n return null;\n } catch {\n /* not a UTC/offset instant — continue */\n }\n\n const tz = timeZone ?? Temporal.Now.timeZoneId();\n try {\n return Temporal.PlainDateTime.from(s).toZonedDateTime(tz).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n return null;\n}\n"]}
1
+ {"version":3,"file":"date-utils.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/date-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,UAAU,GAAG,QAAU,CAAC;AAE9B,SAAS,aAAa,CAAC,EAAsB;IAC3C,OAAO,CACL,EAAE,CAAC,IAAI,GAAG,OAAS;QACnB,EAAE,CAAC,MAAM,GAAG,KAAM;QAClB,EAAE,CAAC,MAAM,GAAG,IAAK;QACjB,EAAE,CAAC,WAAW,CACf,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,SAAiB;IACtC,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACzD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC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E;IACF,uEAAuE;IACvE,2EAA2E;IAC3E,+DAA+D;IAC/D,EAAE;IACF,uEAAuE;IACvE,wEAAwE;IACxE,6BAA6B;IAC7B,IAAI,CAAC;QACH,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,WAAM,CAAC;QACP,qCAAqC;IACvC,CAAC;IAED,IAAI,CAAC;QACH,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,WAAM,CAAC;QACP,yCAAyC;IAC3C,CAAC;IAED,MAAM,EAAE,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,QAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC;IACjD,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,eAAe,CAAC,EAAE,CAAC;aAC1D,iBAAiB,CAAC;IACvB,CAAC;IAAC,WAAM,CAAC;QACP,WAAW;IACb,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { Temporal } from 'temporal-polyfill';\n\nconst MS_PER_DAY = 86_400_000;\n\nfunction plainTimeToMs(pt: Temporal.PlainTime): number {\n return (\n pt.hour * 3_600_000 +\n pt.minute * 60_000 +\n pt.second * 1_000 +\n pt.millisecond\n );\n}\n\nfunction parseOffsetMs(offsetStr: string): number | null {\n const match = offsetStr.match(/^([+-])(\\d{2}):(\\d{2})$/);\n if (!match) {\n return null;\n }\n const sign = match[1] === '+' ? 1 : -1;\n return (\n sign *\n (parseInt(match[2], 10) * 3_600_000 + parseInt(match[3], 10) * 60_000)\n );\n}\n\n/**\n * Parses an ISO 8601 time string to UTC milliseconds since midnight\n * (0–86,399,999). Returns `null` if the string cannot be parsed.\n *\n * Three formats are accepted:\n * 1. Local time (no offset): `\"14:30:00\"`, `\"14:30:00.500\"` — treated as UTC\n * 2. UTC time with Z suffix: `\"14:30:00Z\"` — treated identically to the local form\n * 3. Offset time: `\"14:30:00+02:00\"` — the offset is applied so the result\n * is the equivalent UTC time of day. `\"12:00:00+01:00\"` resolves to\n * 39,600,000 (11:00 UTC), which is less than `\"12:00:00+00:00\"` (43,200,000).\n *\n * Values wrap around midnight: `\"00:00:00+01:00\"` → 82,800,000 (23:00 UTC).\n */\nexport function parseTimeString(input: string): number | null {\n // Reject datetime strings and anything with an IANA timezone bracket.\n // Temporal.PlainTime.from silently extracts the time portion from strings\n // containing a 'T' separator. IANA brackets are meaningless for time-only\n // values (there is no date to anchor DST to), so they are also rejected.\n if (input.includes('T') || input.includes('[')) {\n return null;\n }\n // Offset time: detect \"+HH:MM\" or \"-HH:MM\" suffix first. Temporal.PlainTime.from\n // silently strips offsets and returns the clock-face time, so we must handle\n // offset strings explicitly before falling through to the plain parse.\n const offsetMatch = input.match(/([+-]\\d{2}:\\d{2})(\\[.*\\])?$/);\n if (offsetMatch) {\n const offsetStr = offsetMatch[1];\n const timeStr = input.slice(0, input.indexOf(offsetStr));\n const offsetMs = parseOffsetMs(offsetStr);\n if (offsetMs !== null) {\n try {\n const localMs = plainTimeToMs(Temporal.PlainTime.from(timeStr));\n // Subtract the UTC offset to normalise to UTC time-of-day; wrap around midnight\n return (((localMs - offsetMs) % MS_PER_DAY) + MS_PER_DAY) % MS_PER_DAY;\n } catch {\n /* empty */\n }\n }\n return null;\n }\n\n // UTC time with Z suffix (e.g. \"14:30:00Z\") — strip Z and treat as local (UTC) time.\n // Only apply when there is no 'T' in the string; a datetime string like\n // \"2024-06-15T14:30:00Z\" must not be accepted here.\n const normalized =\n input.endsWith('Z') && !input.includes('T') ? input.slice(0, -1) : input;\n\n // Local time (no offset) — treated as UTC\n try {\n return plainTimeToMs(Temporal.PlainTime.from(normalized));\n } catch {\n /* empty */\n }\n\n return null;\n}\n\n/**\n * Parses an ISO 8601 or RFC 9557 date/datetime string to a Unix millisecond\n * timestamp. Returns `null` if the string cannot be parsed.\n *\n * Three formats are tried in order:\n * 1. RFC 9557 ZonedDateTime with IANA bracket notation\n * e.g. `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset inferred from the\n * named timezone, including DST) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"`\n * (offset explicit; bracket must agree with the IANA zone)\n * 2. UTC or fixed-offset Instant\n * e.g. `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * 3. Plain date or datetime (no offset, `Z`, or IANA bracket), interpreted as UTC\n * e.g. `\"2024-01-01\"`, `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n *\n * Strings with a time component that lack `Z`, an offset, or an IANA bracket are\n * parsed as UTC wall-clock time. (Neo4j `LocalDateTime` values should instead be\n * parsed with {@link parseLocalDateString}, in the browser's local timezone.)\n */\nexport function parseDateString(input: string): number | null {\n // RFC 9557 / ZonedDateTime with IANA bracket notation\n try {\n return Temporal.ZonedDateTime.from(input).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n // UTC or fixed-offset datetime (no IANA name)\n try {\n return Temporal.Instant.from(input).epochMilliseconds;\n } catch {\n /* empty */\n }\n\n // Plain datetime — interpret as UTC.\n // Also covers date-only strings like \"2024-01-01\" (PlainDateTime.from parses\n // them as midnight), so a separate PlainDate path is not needed.\n try {\n return Temporal.PlainDateTime.from(input).toZonedDateTime('UTC')\n .epochMilliseconds;\n } catch {\n /* empty */\n }\n\n return null;\n}\n\n/**\n * Parses a plain (unzoned) ISO 8601 date or datetime string to a Unix\n * millisecond timestamp, interpreting the wall-clock time in the given\n * `timeZone` (defaults to the browser's local timezone via\n * `Temporal.Now.timeZoneId()`). Returns `null` if the string cannot be\n * parsed or contains any timezone qualifier.\n *\n * Only plain date/datetime strings are accepted — strings with `Z`, a\n * fixed UTC offset (`+02:00`), or an IANA bracket (`[Europe/Stockholm]`)\n * are **rejected** and return `null`. This mirrors the semantics of\n * Neo4j `LocalDateTime`, which has no associated timezone.\n *\n * Accepted formats:\n * - Plain datetime: `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as local midnight): `\"2024-01-01\"`\n *\n * The optional `timeZone` parameter overrides the browser's local timezone,\n * which is useful for deterministic testing.\n */\nexport function parseLocalDateString(\n input: string,\n timeZone?: string,\n): number | null {\n // Reject strings that carry explicit timezone information. This mirrors the\n // cascade in parseDateString but uses successful parsing as a rejection\n // signal rather than an acceptance signal:\n //\n // - ZonedDateTime.from succeeds → string has an IANA bracket → reject\n // - Instant.from succeeds → string has Z or a fixed offset → reject\n // - PlainDateTime.from succeeds → truly plain string → accept\n //\n // The polyfill's PlainDateTime.from() silently strips offsets/brackets\n // instead of throwing, so these two pre-checks are necessary to enforce\n // the plain-only constraint.\n try {\n Temporal.ZonedDateTime.from(input);\n return null;\n } catch {\n /* not a zoned datetime — continue */\n }\n\n try {\n Temporal.Instant.from(input);\n return null;\n } catch {\n /* not a UTC/offset instant — continue */\n }\n\n const tz = timeZone ?? Temporal.Now.timeZoneId();\n try {\n return Temporal.PlainDateTime.from(input).toZonedDateTime(tz)\n .epochMilliseconds;\n } catch {\n /* empty */\n }\n\n return null;\n}\n"]}
@@ -51,7 +51,7 @@ export const NumericLiteralSchema = z.union([
51
51
  * - Date-only (treated as UTC midnight): `"2024-01-01"`
52
52
  */
53
53
  export const DatetimeLiteralSchema = z.object({
54
- datetime: z.string().refine((s) => parseDateString(s) !== null, {
54
+ datetime: z.string().refine((input) => parseDateString(input) !== null, {
55
55
  message: 'datetime must be a valid ISO 8601 / RFC 9557 date or datetime string',
56
56
  }),
57
57
  });
@@ -69,7 +69,9 @@ export const DatetimeLiteralSchema = z.object({
69
69
  * timezone-aware instants. This matches the semantics of Neo4j `LocalDateTime`.
70
70
  */
71
71
  export const LocalDatetimeLiteralSchema = z.object({
72
- localdatetime: z.string().refine((s) => parseLocalDateString(s) !== null, {
72
+ localdatetime: z
73
+ .string()
74
+ .refine((input) => parseLocalDateString(input) !== null, {
73
75
  message: 'localdatetime must be a valid ISO 8601 plain date or datetime string (no Z, offset, or timezone)',
74
76
  }),
75
77
  });
@@ -87,7 +89,7 @@ export const LocalDatetimeLiteralSchema = z.object({
87
89
  * Full datetime strings (containing `T`) are rejected.
88
90
  */
89
91
  export const TimeLiteralSchema = z.object({
90
- time: z.string().refine((s) => parseTimeString(s) !== null, {
92
+ time: z.string().refine((input) => parseTimeString(input) !== null, {
91
93
  message: 'time must be a valid ISO 8601 time string (e.g. "14:30:00" or "14:30:00+02:00")',
92
94
  }),
93
95
  });
@@ -1 +1 @@
1
- {"version":3,"file":"literal-schemas.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/literal-schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,eAAe,GAChB,MAAM,cAAc,CAAC;AAEtB;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,MAAM,EAAE,C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K;QACZ,OAAQ,KAAiC,CAAC,GAAG,CAAC,KAAK,QAAQ,CAC5D,CAAC;AACJ,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,qBAAqB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AAClD,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,sBAAsB,CACpC,KAAc;IAEd,OAAO,qBAAqB,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;AACvD,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC;IACxC,oBAAoB;IACpB,qBAAqB;IACrB,0BAA0B;IAC1B,iBAAiB;CAClB,CAAC,CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { z } from 'zod';\n\nimport {\n parseDateString,\n parseLocalDateString,\n parseTimeString,\n} from './date-utils';\n\n/**\n * A JSON-safe bigint literal. Native bigint values cannot be serialized as\n * JSON, so persisted style rules can use a signed decimal string instead.\n */\nexport const BigintLiteralSchema = z.object({\n bigint: z.string().regex(/^[+-]?\\d+$/, {\n message: 'bigint must be a signed decimal integer string',\n }),\n});\nexport type BigintLiteral = z.infer<typeof BigintLiteralSchema>;\n\n/** A numeric style-rule literal, including native and JSON-safe bigints. */\nexport const NumericLiteralSchema = z.union([\n z.number(),\n z.bigint(),\n BigintLiteralSchema,\n]);\nexport type NumericLiteral = z.infer<typeof NumericLiteralSchema>;\n\n/**\n * An ISO 8601 or RFC 9557 datetime literal that resolves to a Unix millisecond\n * timestamp at evaluation time. Supported formats:\n * - RFC 9557 with IANA timezone: `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset\n * inferred from the named zone, DST-aware) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"`\n * (offset explicit)\n * - UTC or offset datetime: `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * - Plain datetime (treated as UTC): `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as UTC midnight): `\"2024-01-01\"`\n */\nexport const DatetimeLiteralSchema = z.object({\n datetime: z.string().refine((s) => parseDateString(s) !== null, {\n message:\n 'datetime must be a valid ISO 8601 / RFC 9557 date or datetime string',\n }),\n});\nexport type DatetimeLiteral = z.infer<typeof DatetimeLiteralSchema>;\n\n/**\n * A plain (unzoned) ISO 8601 date or datetime literal that resolves to a Unix\n * millisecond timestamp at evaluation time, interpreting the wall-clock time\n * in the browser's local timezone.\n *\n * Only plain date/datetime strings without timezone qualifiers are accepted:\n * - Plain datetime: `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as local midnight): `\"2024-01-01\"`\n *\n * Strings with `Z`, a UTC offset (`+02:00`), or an IANA bracket\n * (`[Europe/Stockholm]`) are **rejected** — use `{ datetime }` for\n * timezone-aware instants. This matches the semantics of Neo4j `LocalDateTime`.\n */\nexport const LocalDatetimeLiteralSchema = z.object({\n localdatetime: z.string().refine((s) => parseLocalDateString(s) !== null, {\n message:\n 'localdatetime must be a valid ISO 8601 plain date or datetime string (no Z, offset, or timezone)',\n }),\n});\nexport type LocalDatetimeLiteral = z.infer<typeof LocalDatetimeLiteralSchema>;\n\n/**\n * An ISO 8601 time literal that resolves to milliseconds since UTC midnight\n * at evaluation time. Supported formats:\n * - Local time (treated as UTC): `\"14:30:00\"`, `\"14:30:00.500\"`\n * - UTC time: `\"14:30:00Z\"` — identical to local form\n * - Offset time (UTC-normalised): `\"14:30:00+02:00\"` → 45,000,000 ms (12:30 UTC)\n *\n * IANA timezone brackets (e.g. `[Europe/Stockholm]`) are **not** accepted — a\n * time-of-day value has no calendar date so DST cannot be resolved. Use\n * `{ datetime }` literals for timezone-aware instants.\n *\n * Full datetime strings (containing `T`) are rejected.\n */\nexport const TimeLiteralSchema = z.object({\n time: z.string().refine((s) => parseTimeString(s) !== null, {\n message:\n 'time must be a valid ISO 8601 time string (e.g. \"14:30:00\" or \"14:30:00+02:00\")',\n }),\n});\nexport type TimeLiteral = z.infer<typeof TimeLiteralSchema>;\n\nfunction isObjectWithStringKey<K extends string>(\n value: unknown,\n key: K,\n): value is Record<K, string> {\n return (\n typeof value === 'object' &&\n value !== null &&\n key in value &&\n typeof (value as Record<string, unknown>)[key] === 'string'\n );\n}\n\n/** Returns whether a value is a `{ datetime: string }` wrapper. Does not validate the string. */\nexport function isDatetimeLiteral(value: unknown): value is DatetimeLiteral {\n return isObjectWithStringKey(value, 'datetime');\n}\n\n/** Returns whether a value is a `{ localdatetime: string }` wrapper. Does not validate the string. */\nexport function isLocalDatetimeLiteral(\n value: unknown,\n): value is LocalDatetimeLiteral {\n return isObjectWithStringKey(value, 'localdatetime');\n}\n\n/** Returns whether a value is a `{ time: string }` wrapper. Does not validate the string. */\nexport function isTimeLiteral(value: unknown): value is TimeLiteral {\n return isObjectWithStringKey(value, 'time');\n}\n\n/**\n * A continuous, orderable literal that can be used as a range boundary.\n * Temporal literals resolve to numbers before range interpolation.\n */\nexport const RangeLiteralSchema = z.union([\n NumericLiteralSchema,\n DatetimeLiteralSchema,\n LocalDatetimeLiteralSchema,\n TimeLiteralSchema,\n]);\nexport type RangeLiteral = z.infer<typeof RangeLiteralSchema>;\n"]}
1
+ {"version":3,"file":"literal-schemas.js","sourceRoot":"","sources":["../../../../src/_generated/style-rules/literal-schemas.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,eAAe,GAChB,MAAM,cAAc,CAAC;AAEtB;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,YAAY,EAAE;QACrC,OAAO,EAAE,gDAAgD;KAC1D,CAAC;CACH,CAAC,CAAC;AAGH,4EAA4E;AAC5E,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC;IAC1C,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,MAAM,EAAE;IACV,mBAAmB;CACpB,CAAC,CAAC;AAGH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE;QACtE,OAAO,EACL,sEAAsE;KACzE,CAAC;CACH,CAAC,CAAC;AAGH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,aAAa,EAAE,CAAC;SACb,MAAM,EAAE;SACR,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE;QACvD,OAAO,EACL,kGAAkG;KACrG,CAAC;CACL,CAAC,CAAC;AAGH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE;QAClE,OAAO,EACL,iFAAiF;KACpF,CAAC;CACH,CAAC,CAAC;AAGH,SAAS,qBAAqB,CAC5B,KAAc,EACd,GAAM;IAEN,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,GAAG,IAAI,KAAK;QACZ,OAAQ,KAAiC,CAAC,GAAG,CAAC,KAAK,QAAQ,CAC5D,CAAC;AACJ,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,qBAAqB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AAClD,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,sBAAsB,CACpC,KAAc;IAEd,OAAO,qBAAqB,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;AACvD,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC;IACxC,oBAAoB;IACpB,qBAAqB;IACrB,0BAA0B;IAC1B,iBAAiB;CAClB,CAAC,CAAC","sourcesContent":["/*\n * AUTO-GENERATED FILE — DO NOT EDIT.\n * Source of truth: packages/style-rules/src/\n * Regenerate with `pnpm generate:shared` (runs automatically at build/dev/install).\n */\n\n/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { z } from 'zod';\n\nimport {\n parseDateString,\n parseLocalDateString,\n parseTimeString,\n} from './date-utils';\n\n/**\n * A JSON-safe bigint literal. Native bigint values cannot be serialized as\n * JSON, so persisted style rules can use a signed decimal string instead.\n */\nexport const BigintLiteralSchema = z.object({\n bigint: z.string().regex(/^[+-]?\\d+$/, {\n message: 'bigint must be a signed decimal integer string',\n }),\n});\nexport type BigintLiteral = z.infer<typeof BigintLiteralSchema>;\n\n/** A numeric style-rule literal, including native and JSON-safe bigints. */\nexport const NumericLiteralSchema = z.union([\n z.number(),\n z.bigint(),\n BigintLiteralSchema,\n]);\nexport type NumericLiteral = z.infer<typeof NumericLiteralSchema>;\n\n/**\n * An ISO 8601 or RFC 9557 datetime literal that resolves to a Unix millisecond\n * timestamp at evaluation time. Supported formats:\n * - RFC 9557 with IANA timezone: `\"2024-06-15T14:00:00[Europe/Stockholm]\"` (offset\n * inferred from the named zone, DST-aware) or `\"2024-06-15T14:00:00+02:00[Europe/Stockholm]\"`\n * (offset explicit)\n * - UTC or offset datetime: `\"2024-01-01T00:00:00Z\"`, `\"2024-01-01T00:00:00+02:00\"`\n * - Plain datetime (treated as UTC): `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as UTC midnight): `\"2024-01-01\"`\n */\nexport const DatetimeLiteralSchema = z.object({\n datetime: z.string().refine((input) => parseDateString(input) !== null, {\n message:\n 'datetime must be a valid ISO 8601 / RFC 9557 date or datetime string',\n }),\n});\nexport type DatetimeLiteral = z.infer<typeof DatetimeLiteralSchema>;\n\n/**\n * A plain (unzoned) ISO 8601 date or datetime literal that resolves to a Unix\n * millisecond timestamp at evaluation time, interpreting the wall-clock time\n * in the browser's local timezone.\n *\n * Only plain date/datetime strings without timezone qualifiers are accepted:\n * - Plain datetime: `\"2024-01-01T14:30:00\"`, `\"2024-01-01T14:30:00.500\"`\n * - Date-only (treated as local midnight): `\"2024-01-01\"`\n *\n * Strings with `Z`, a UTC offset (`+02:00`), or an IANA bracket\n * (`[Europe/Stockholm]`) are **rejected** — use `{ datetime }` for\n * timezone-aware instants. This matches the semantics of Neo4j `LocalDateTime`.\n */\nexport const LocalDatetimeLiteralSchema = z.object({\n localdatetime: z\n .string()\n .refine((input) => parseLocalDateString(input) !== null, {\n message:\n 'localdatetime must be a valid ISO 8601 plain date or datetime string (no Z, offset, or timezone)',\n }),\n});\nexport type LocalDatetimeLiteral = z.infer<typeof LocalDatetimeLiteralSchema>;\n\n/**\n * An ISO 8601 time literal that resolves to milliseconds since UTC midnight\n * at evaluation time. Supported formats:\n * - Local time (treated as UTC): `\"14:30:00\"`, `\"14:30:00.500\"`\n * - UTC time: `\"14:30:00Z\"` — identical to local form\n * - Offset time (UTC-normalised): `\"14:30:00+02:00\"` → 45,000,000 ms (12:30 UTC)\n *\n * IANA timezone brackets (e.g. `[Europe/Stockholm]`) are **not** accepted — a\n * time-of-day value has no calendar date so DST cannot be resolved. Use\n * `{ datetime }` literals for timezone-aware instants.\n *\n * Full datetime strings (containing `T`) are rejected.\n */\nexport const TimeLiteralSchema = z.object({\n time: z.string().refine((input) => parseTimeString(input) !== null, {\n message:\n 'time must be a valid ISO 8601 time string (e.g. \"14:30:00\" or \"14:30:00+02:00\")',\n }),\n});\nexport type TimeLiteral = z.infer<typeof TimeLiteralSchema>;\n\nfunction isObjectWithStringKey<K extends string>(\n value: unknown,\n key: K,\n): value is Record<K, string> {\n return (\n typeof value === 'object' &&\n value !== null &&\n key in value &&\n typeof (value as Record<string, unknown>)[key] === 'string'\n );\n}\n\n/** Returns whether a value is a `{ datetime: string }` wrapper. Does not validate the string. */\nexport function isDatetimeLiteral(value: unknown): value is DatetimeLiteral {\n return isObjectWithStringKey(value, 'datetime');\n}\n\n/** Returns whether a value is a `{ localdatetime: string }` wrapper. Does not validate the string. */\nexport function isLocalDatetimeLiteral(\n value: unknown,\n): value is LocalDatetimeLiteral {\n return isObjectWithStringKey(value, 'localdatetime');\n}\n\n/** Returns whether a value is a `{ time: string }` wrapper. Does not validate the string. */\nexport function isTimeLiteral(value: unknown): value is TimeLiteral {\n return isObjectWithStringKey(value, 'time');\n}\n\n/**\n * A continuous, orderable literal that can be used as a range boundary.\n * Temporal literals resolve to numbers before range interpolation.\n */\nexport const RangeLiteralSchema = z.union([\n NumericLiteralSchema,\n DatetimeLiteralSchema,\n LocalDatetimeLiteralSchema,\n TimeLiteralSchema,\n]);\nexport type RangeLiteral = z.infer<typeof RangeLiteralSchema>;\n"]}
@@ -41,7 +41,7 @@ import ndlCodeLight from '../../code-block/themes/ndl-code-light';
41
41
  * The component is used to display code that is generated by an LLM.
42
42
  *
43
43
  * @alpha - Changes to this component may be breaking.
44
- * @deprecated - Use <Preview /> with <Preview.Code /> instead.
44
+ * @deprecated - Use `<Preview />` with `<Preview.Code />` instead.
45
45
  */
46
46
  export const CodePreview = (_a) => {
47
47
  var { code, language, label, isLoading = false, headerActions, theme, ref, style, className, htmlAttributes } = _a, restProps = __rest(_a, ["code", "language", "label", "isLoading", "headerActions", "theme", "ref", "style", "className", "htmlAttributes"]);
@@ -1 +1 @@
1
- {"version":3,"file":"CodePreview.js","sourceRoot":"","sources":["../../../../src/ai/code-preview/CodePreview.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,eAAe,EAEf,cAAc,EACd,WAAW,EACX,UAAU,EACV,cAAc,GACf,MAAM,k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AAC,OAAO,GACZ,EACD,aAAa,IACV,CACP,IACG,EAEL,CAAC,SAAS,IAAI,CACb,cAAK,SAAS,EAAC,6BAA6B,YAC1C,cAAK,SAAS,EAAC,4BAA4B,YACzC,KAAC,iBAAiB,IAChB,QAAQ,EAAE,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,MAAM,EAClC,KAAK,kCACA,QAAQ,EAAE,KACb,yBAAyB,EAAE;gCACzB,MAAM,EAAE,CAAC;gCACT,KAAK,EAAE,yCAAyC;gCAChD,UAAU,EAAE,GAAG;gCACf,SAAS,EAAE,MAAM;gCACjB,OAAO,EAAE,iBAAiB;gCAC1B,KAAK,EAAE,aAAa;6BACrB;wBAEH,2FAA2F;wBAC3F,kFAAkF;wBAClF,gBAAgB;wBAChB,YAAY,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE,EAChD,eAAe,EAAE,KAAK,YAErB,IAAI,GACa,GAChB,GACF,CACP,KACG,CACP,CAAC;AACJ,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 */\nimport {\n ClipboardButton,\n type CodeBlock,\n LoadingSpinner,\n StatusLabel,\n Typography,\n useNeedleTheme,\n} from '@neo4j-ndl/react';\nimport classNames from 'classnames';\nimport { useEffect, useState } from 'react';\nimport { PrismLight as SyntaxHighlighter } from 'react-syntax-highlighter';\n\nimport { type CommonProps } from '../../_common/types';\nimport {\n type LanguageProp,\n Languages,\n loadLanguage,\n} from '../../code-block/code-languages';\nimport ndlCodeDark from '../../code-block/themes/ndl-code-dark';\nimport ndlCodeLight from '../../code-block/themes/ndl-code-light';\n\ntype CodePreviewProps = {\n /** The code content to display */\n code: string;\n /** The language of the code (e.g., 'cypher', 'python', 'javascript') */\n language: React.ComponentProps<typeof CodeBlock>['language'];\n /** The current state of the code block */\n label?: 'read' | 'write';\n /** Whether the code block is loading */\n isLoading?: boolean;\n /** The actions to display in the header. Should be small CleanIconButton components. */\n headerActions?: React.ReactNode;\n /** The theme of the code block */\n theme?: 'ndl-code-dark' | 'ndl-code-light';\n};\n\n/**\n * The component is used to display code that is generated by an LLM.\n *\n * @alpha - Changes to this component may be breaking.\n * @deprecated - Use <Preview /> with <Preview.Code /> instead.\n */\nexport const CodePreview = ({\n code,\n language,\n label,\n isLoading = false,\n headerActions,\n theme,\n ref,\n style,\n className,\n htmlAttributes,\n ...restProps\n}: CommonProps<'div', CodePreviewProps>) => {\n const [loadedLanguage, setLoadedLanguage] = useState<\n CodePreviewProps['language'] | null\n >(null);\n const { theme: ndlTheme } = useNeedleTheme();\n\n useEffect(() => {\n if (!language || !(Languages as readonly string[]).includes(language)) {\n setLoadedLanguage('text');\n return;\n }\n\n loadLanguage(language as LanguageProp)\n .then((module) => {\n SyntaxHighlighter.registerLanguage(language, module.default);\n setLoadedLanguage(language);\n })\n .catch((err) => console.error(err));\n }, [language]);\n\n const getTheme = () => {\n switch (theme) {\n case 'ndl-code-dark':\n return ndlCodeDark;\n case 'ndl-code-light':\n return ndlCodeLight;\n default:\n return ndlTheme === 'light' ? ndlCodeLight : ndlCodeDark;\n }\n };\n\n return (\n <div\n ref={ref}\n style={style}\n className={classNames('ndl-ai-code-preview', className)}\n {...restProps}\n {...htmlAttributes}\n >\n {/* Header */}\n <div className=\"ndl-ai-code-preview-header\">\n <div className=\"ndl-ai-code-preview-title\">\n {isLoading ? (\n <>\n <LoadingSpinner size=\"medium\" />\n <Typography variant=\"code\">\n WRITING {language.toUpperCase()}\n </Typography>\n </>\n ) : (\n <>\n <Typography variant=\"code\">\n {language.toUpperCase()}{' '}\n {language.toLowerCase() === 'cypher' ? 'QUERY' : ''}\n </Typography>\n {label && (\n <StatusLabel\n variant={label === 'write' ? 'warning' : 'info'}\n size=\"small\"\n fill=\"semi-filled\"\n >\n {label}\n </StatusLabel>\n )}\n </>\n )}\n </div>\n\n {!isLoading && (\n <div className=\"ndl-ai-code-preview-actions\">\n <ClipboardButton\n textToCopy={code}\n type=\"clean-icon-button\"\n size=\"small\"\n />\n {headerActions}\n </div>\n )}\n </div>\n\n {!isLoading && (\n <div className=\"ndl-ai-code-preview-content\">\n <div className=\"ndl-code-content-container\">\n <SyntaxHighlighter\n language={loadedLanguage ?? 'text'}\n style={{\n ...getTheme(),\n 'pre[class*=\"language-\"]': {\n border: 0,\n color: 'var(--theme-color-neutral-text-default)',\n lineHeight: '1',\n overflowX: 'auto',\n padding: 'var(--space-12)',\n width: 'fit-content',\n },\n }}\n // Turn on 'shouldShowLineNumbers' & 'wrapLongLines' at the same time, the display is wrong\n // https://github.com/react-syntax-highlighter/react-syntax-highlighter/issues/402\n // wrapLongLines\n codeTagProps={{ className: 'n-ai-code-preview' }}\n showLineNumbers={false}\n >\n {code}\n </SyntaxHighlighter>\n </div>\n </div>\n )}\n </div>\n );\n};\n"]}
1
+ {"version":3,"file":"CodePreview.js","sourceRoot":"","sources":["../../../../src/ai/code-preview/CodePreview.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EACL,eAAe,EAEf,cAAc,EACd,WAAW,EACX,UAAU,EACV,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG3E,OAAO,EAEL,SAA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GAAI,MAAM,EAClC,KAAK,kCACA,QAAQ,EAAE,KACb,yBAAyB,EAAE;gCACzB,MAAM,EAAE,CAAC;gCACT,KAAK,EAAE,yCAAyC;gCAChD,UAAU,EAAE,GAAG;gCACf,SAAS,EAAE,MAAM;gCACjB,OAAO,EAAE,iBAAiB;gCAC1B,KAAK,EAAE,aAAa;6BACrB;wBAEH,2FAA2F;wBAC3F,kFAAkF;wBAClF,gBAAgB;wBAChB,YAAY,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE,EAChD,eAAe,EAAE,KAAK,YAErB,IAAI,GACa,GAChB,GACF,CACP,KACG,CACP,CAAC;AACJ,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 */\nimport {\n ClipboardButton,\n type CodeBlock,\n LoadingSpinner,\n StatusLabel,\n Typography,\n useNeedleTheme,\n} from '@neo4j-ndl/react';\nimport classNames from 'classnames';\nimport { useEffect, useState } from 'react';\nimport { PrismLight as SyntaxHighlighter } from 'react-syntax-highlighter';\n\nimport { type CommonProps } from '../../_common/types';\nimport {\n type LanguageProp,\n Languages,\n loadLanguage,\n} from '../../code-block/code-languages';\nimport ndlCodeDark from '../../code-block/themes/ndl-code-dark';\nimport ndlCodeLight from '../../code-block/themes/ndl-code-light';\n\ntype CodePreviewProps = {\n /** The code content to display */\n code: string;\n /** The language of the code (e.g., 'cypher', 'python', 'javascript') */\n language: React.ComponentProps<typeof CodeBlock>['language'];\n /** The current state of the code block */\n label?: 'read' | 'write';\n /** Whether the code block is loading */\n isLoading?: boolean;\n /** The actions to display in the header. Should be small CleanIconButton components. */\n headerActions?: React.ReactNode;\n /** The theme of the code block */\n theme?: 'ndl-code-dark' | 'ndl-code-light';\n};\n\n/**\n * The component is used to display code that is generated by an LLM.\n *\n * @alpha - Changes to this component may be breaking.\n * @deprecated - Use `<Preview />` with `<Preview.Code />` instead.\n */\nexport const CodePreview = ({\n code,\n language,\n label,\n isLoading = false,\n headerActions,\n theme,\n ref,\n style,\n className,\n htmlAttributes,\n ...restProps\n}: CommonProps<'div', CodePreviewProps>) => {\n const [loadedLanguage, setLoadedLanguage] = useState<\n CodePreviewProps['language'] | null\n >(null);\n const { theme: ndlTheme } = useNeedleTheme();\n\n useEffect(() => {\n if (!language || !(Languages as readonly string[]).includes(language)) {\n setLoadedLanguage('text');\n return;\n }\n\n loadLanguage(language as LanguageProp)\n .then((module) => {\n SyntaxHighlighter.registerLanguage(language, module.default);\n setLoadedLanguage(language);\n })\n .catch((err) => console.error(err));\n }, [language]);\n\n const getTheme = () => {\n switch (theme) {\n case 'ndl-code-dark':\n return ndlCodeDark;\n case 'ndl-code-light':\n return ndlCodeLight;\n default:\n return ndlTheme === 'light' ? ndlCodeLight : ndlCodeDark;\n }\n };\n\n return (\n <div\n ref={ref}\n style={style}\n className={classNames('ndl-ai-code-preview', className)}\n {...restProps}\n {...htmlAttributes}\n >\n {/* Header */}\n <div className=\"ndl-ai-code-preview-header\">\n <div className=\"ndl-ai-code-preview-title\">\n {isLoading ? (\n <>\n <LoadingSpinner size=\"medium\" />\n <Typography variant=\"code\">\n WRITING {language.toUpperCase()}\n </Typography>\n </>\n ) : (\n <>\n <Typography variant=\"code\">\n {language.toUpperCase()}{' '}\n {language.toLowerCase() === 'cypher' ? 'QUERY' : ''}\n </Typography>\n {label && (\n <StatusLabel\n variant={label === 'write' ? 'warning' : 'info'}\n size=\"small\"\n fill=\"semi-filled\"\n >\n {label}\n </StatusLabel>\n )}\n </>\n )}\n </div>\n\n {!isLoading && (\n <div className=\"ndl-ai-code-preview-actions\">\n <ClipboardButton\n textToCopy={code}\n type=\"clean-icon-button\"\n size=\"small\"\n />\n {headerActions}\n </div>\n )}\n </div>\n\n {!isLoading && (\n <div className=\"ndl-ai-code-preview-content\">\n <div className=\"ndl-code-content-container\">\n <SyntaxHighlighter\n language={loadedLanguage ?? 'text'}\n style={{\n ...getTheme(),\n 'pre[class*=\"language-\"]': {\n border: 0,\n color: 'var(--theme-color-neutral-text-default)',\n lineHeight: '1',\n overflowX: 'auto',\n padding: 'var(--space-12)',\n width: 'fit-content',\n },\n }}\n // Turn on 'shouldShowLineNumbers' & 'wrapLongLines' at the same time, the display is wrong\n // https://github.com/react-syntax-highlighter/react-syntax-highlighter/issues/402\n // wrapLongLines\n codeTagProps={{ className: 'n-ai-code-preview' }}\n showLineNumbers={false}\n >\n {code}\n </SyntaxHighlighter>\n </div>\n </div>\n )}\n </div>\n );\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"FileTag.js","sourceRoot":"","sources":["../../../../src/ai/file-tag/FileTag.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAiBpF;;;;;GAKG;AACH,MAAM,OAAO,GAAG,CAAC,EAY8B,EAAE,EAAE;QAZlC,EACf,OAAO,EACP,WAAW,GAAG,KAAK,EACnB,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,KAAK,EACL,cAAc,EACd,GAAG,EACH,SAAS,GAAG,KAAK,OAE4B,EAD1C,SAAS,cAXG,sHAYhB,CADa;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gCACtC,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC;gCACtC,YAAY,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC;gCAC3C,YAAY,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC;6BAC7C,EACD,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,wBAAwB,YAElC,KAAC,gBAAgB,KAAG,GACJ,CACnB,KACS,GACI,EAClB,KAAC,OAAO,CAAC,OAAO,cACb,cAAc,CAAC,CAAC,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,GACzB,IACV,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,EAAE,OAAO,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 */\n\nimport { CleanIconButton, LoadingSpinner, Tooltip } from '@neo4j-ndl/react';\nimport classNames from 'classnames';\nimport { useState } from 'react';\n\nimport { type CommonProps } from '../../_common/types';\nimport { XMarkIconOutline } from '../../icons/generated/heroIcons/XMarkIconOutline';\n\ntype FileTagProps = {\n /** The icon that represents the file type */\n icon: React.ReactNode;\n /** The name of the file */\n fileName: string;\n /** The type of the file, e.g. 'pdf', 'docx', 'txt', etc. */\n fileType: string;\n /** Callback function triggered either when the file tag is clicked, or when the remove button is clicked (if isRemovable is true) */\n onClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Whether the file tag is removable */\n isRemovable?: boolean;\n /** Whether the file tag is loading */\n isLoading?: boolean;\n};\n\n/**\n * The component is used to display a file in a chat, or in a prompt.\n * It can be removable and it can be loading.\n *\n * @alpha - Changes to this component may be breaking.\n */\nconst FileTag = ({\n onClick,\n isRemovable = false,\n fileName,\n fileType,\n icon,\n className,\n style,\n htmlAttributes,\n ref,\n isLoading = false,\n ...restProps\n}: CommonProps<React.ElementType, FileTagProps>) => {\n const Component = isRemovable !== true ? 'button' : 'div';\n const classes = classNames('ndl-ai-file-tag', className);\n\n const file = `${fileName}.${fileType}`;\n const [isRemoveActive, setIsRemoveActive] = useState(false);\n\n return (\n <Tooltip\n type=\"simple\"\n placement=\"bottom\"\n hoverDelay={{ close: 0, open: 500 }}\n >\n <Tooltip.Trigger hasButtonWrapper>\n <Component\n ref={ref}\n className={classes}\n style={style}\n {...(isRemovable ? {} : { onClick })}\n // what is read by screen readers here?\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-ai-file-tag-leading\">\n {isLoading ? <LoadingSpinner size=\"medium\" /> : icon}\n </div>\n <div className=\"ndl-ai-file-tag-content\">\n <span className=\"ndl-ai-file-tag-content-title\">{fileName}</span>\n <span className=\"ndl-ai-file-tag-content-type\">\n {fileType?.toUpperCase()}\n </span>\n </div>\n {isRemovable && (\n <CleanIconButton\n onClick={onClick}\n description={null}\n htmlAttributes={{\n 'aria-label': `Remove ${file}`,\n onBlur: () => setIsRemoveActive(false),\n onFocus: () => setIsRemoveActive(true),\n onMouseEnter: () => setIsRemoveActive(true),\n onMouseLeave: () => setIsRemoveActive(false),\n }}\n size=\"small\"\n className=\"ndl-ai-file-tag-remove\"\n >\n <XMarkIconOutline />\n </CleanIconButton>\n )}\n </Component>\n </Tooltip.Trigger>\n <Tooltip.Content>\n {isRemoveActive ? `Remove ${file}` : file}\n </Tooltip.Content>\n </Tooltip>\n );\n};\n\nexport { FileTag };\n"]}
1
+ {"version":3,"file":"FileTag.js","sourceRoot":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AAO,EAAE,CAAC,EAEhC,SAAS,EACT,cAAc,eAElB,cAAK,SAAS,EAAC,yBAAyB,YACrC,SAAS,CAAC,CAAC,CAAC,KAAC,cAAc,IAAC,IAAI,EAAC,QAAQ,GAAG,CAAC,CAAC,CAAC,IAAI,GAChD,EACN,eAAK,SAAS,EAAC,yBAAyB,aACtC,eAAM,SAAS,EAAC,+BAA+B,YAAE,QAAQ,GAAQ,EACjE,eAAM,SAAS,EAAC,8BAA8B,YAC3C,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,WAAW,EAAE,GACnB,IACH,EACL,WAAW,IAAI,CACd,KAAC,eAAe,IACd,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,IAAI,EACjB,cAAc,EAAE;gCACd,YAAY,EAAE,UAAU,IAAI,EAAE;gCAC9B,MAAM,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC;gCACtC,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC;gCACtC,YAAY,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC;gCAC3C,YAAY,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC;6BAC7C,EACD,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,wBAAwB,YAElC,KAAC,gBAAgB,KAAG,GACJ,CACnB,KACS,GACI,EAClB,KAAC,OAAO,CAAC,OAAO,cACb,cAAc,CAAC,CAAC,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,GACzB,IACV,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,EAAE,OAAO,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 */\n\nimport { CleanIconButton, LoadingSpinner, Tooltip } from '@neo4j-ndl/react';\nimport classNames from 'classnames';\nimport { useState } from 'react';\n\nimport { type CommonProps } from '../../_common/types';\nimport { XMarkIconOutline } from '../../icons/generated/heroIcons/XMarkIconOutline';\n\ntype FileTagProps = {\n /** The icon that represents the file type */\n icon: React.ReactNode;\n /** The name of the file */\n fileName: string;\n /** The type of the file, e.g. 'pdf', 'docx', 'txt', etc. */\n fileType: string;\n /** Callback function triggered either when the file tag is clicked, or when the remove button is clicked (if isRemovable is true) */\n onClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Whether the file tag is removable */\n isRemovable?: boolean;\n /** Whether the file tag is loading */\n isLoading?: boolean;\n};\n\n/**\n * The component is used to display a file in a chat, or in a prompt.\n * It can be removable and it can be loading.\n *\n * @alpha - Changes to this component may be breaking.\n */\nconst FileTag = ({\n onClick,\n isRemovable = false,\n fileName,\n fileType,\n icon,\n className,\n style,\n htmlAttributes,\n ref,\n isLoading = false,\n ...restProps\n}: CommonProps<React.ElementType, FileTagProps>) => {\n const Component = isRemovable !== true ? 'button' : 'div';\n const classes = classNames('ndl-ai-file-tag', className);\n\n const file = `${fileName}.${fileType}`;\n const [isRemoveActive, setIsRemoveActive] = useState(false);\n\n return (\n <Tooltip\n type=\"simple\"\n placement=\"bottom\"\n hoverDelay={{ close: 0, open: 500 }}\n >\n <Tooltip.Trigger hasButtonWrapper>\n <Component\n ref={ref}\n className={classes}\n style={style}\n {...(isRemovable ? {} : { onClick })}\n // what is read by screen readers here?\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-ai-file-tag-leading\">\n {isLoading ? <LoadingSpinner size=\"medium\" /> : icon}\n </div>\n <div className=\"ndl-ai-file-tag-content\">\n <span className=\"ndl-ai-file-tag-content-title\">{fileName}</span>\n <span className=\"ndl-ai-file-tag-content-type\">\n {fileType?.toUpperCase()}\n </span>\n </div>\n {isRemovable && (\n <CleanIconButton\n onClick={onClick}\n description={null}\n htmlAttributes={{\n 'aria-label': `Remove ${file}`,\n onBlur: () => setIsRemoveActive(false),\n onFocus: () => setIsRemoveActive(true),\n onMouseEnter: () => setIsRemoveActive(true),\n onMouseLeave: () => setIsRemoveActive(false),\n }}\n size=\"small\"\n className=\"ndl-ai-file-tag-remove\"\n >\n <XMarkIconOutline />\n </CleanIconButton>\n )}\n </Component>\n </Tooltip.Trigger>\n <Tooltip.Content>\n {isRemoveActive ? `Remove ${file}` : file}\n </Tooltip.Content>\n </Tooltip>\n );\n};\n\nexport { FileTag };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ImageTag.js","sourceRoot":"","sources":["../../../../src/ai/image-tag/ImageTag.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAmBpF;;;;;GAKG;AACH,MAAM,QAAQ,GAAG,CAAC,EAa8B,EAAE,EAAE;QAblC,EAChB,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,GAAG,EACH,OAAO,EACP,WAAW,GAAG,KAAK,EACnB,SAAS,GAAG,KAAK,EACjB,GAAG,EACH,SAAS,EACT,KAAK,EACL,cAAc,OAEgC,EAD3C,SAAS,cAZI,4HAajB,CADa;IAEZ,MAAM,SAAS,GAAG,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CA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,EACA,SAAS,IAAI,CACZ,cAAK,SAAS,EAAC,kCAAkC,YAC/C,KAAC,cAAc,IAAC,IAAI,EAAC,QAAQ,GAAG,GAC5B,CACP,KACS,GACI,EAClB,KAAC,OAAO,CAAC,OAAO,cACb,cAAc,CAAC,CAAC,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,GAC3B,IACV,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,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 */\n\nimport { CleanIconButton, LoadingSpinner, Tooltip } from '@neo4j-ndl/react';\nimport classNames from 'classnames';\nimport { useState } from 'react';\n\nimport { type CommonProps } from '../../_common/types';\nimport { XMarkIconOutline } from '../../icons/generated/heroIcons/XMarkIconOutline';\n\ntype ImageTagProps = {\n /** The source of the image */\n src: string;\n /** The alt text of the image */\n alt: string;\n /** The name of the image */\n fileName: string;\n /** The type of the image, e.g. 'jpg', 'png', 'gif', etc. */\n fileType: string;\n /** Callback function triggered either when the image tag is clicked, or when the remove button is clicked (if isRemovable is true) */\n onClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Whether the image tag is removable */\n isRemovable?: boolean;\n /** Whether the image tag is loading */\n isLoading?: boolean;\n};\n\n/**\n * The component is used to display an image in a chat, or in a prompt.\n * It can be removable and it can be loading.\n *\n * @alpha - Changes to this component may be breaking.\n */\nconst ImageTag = ({\n src,\n fileName,\n fileType,\n alt,\n onClick,\n isRemovable = false,\n isLoading = false,\n ref,\n className,\n style,\n htmlAttributes,\n ...restProps\n}: CommonProps<React.ElementType, ImageTagProps>) => {\n const Component = isRemovable !== true ? 'button' : 'div';\n const classes = classNames('ndl-ai-image-tag', className);\n\n const image = `${fileName}.${fileType}`;\n const [isRemoveActive, setIsRemoveActive] = useState(false);\n\n return (\n <Tooltip\n type=\"simple\"\n placement=\"bottom\"\n hoverDelay={{ close: 0, open: 500 }}\n >\n <Tooltip.Trigger hasButtonWrapper>\n <Component\n ref={ref}\n className={classes}\n style={style}\n {...(isRemovable ? {} : { onClick })}\n // what is read by screen readers here?\n {...restProps}\n {...htmlAttributes}\n >\n <img src={src} alt={alt} />\n {isRemovable && (\n <>\n <div className=\"ndl-ai-image-tag-remove-wrapper\" />\n <CleanIconButton\n onClick={onClick}\n description={null}\n htmlAttributes={{\n 'aria-label': `Remove ${image}`,\n onBlur: () => setIsRemoveActive(false),\n onFocus: () => setIsRemoveActive(true),\n onMouseEnter: () => setIsRemoveActive(true),\n onMouseLeave: () => setIsRemoveActive(false),\n }}\n size=\"small\"\n className=\"ndl-ai-image-tag-remove\"\n >\n <XMarkIconOutline />\n </CleanIconButton>\n </>\n )}\n {isLoading && (\n <div className=\"ndl-ai-image-tag-loading-overlay\">\n <LoadingSpinner size=\"medium\" />\n </div>\n )}\n </Component>\n </Tooltip.Trigger>\n <Tooltip.Content>\n {isRemoveActive ? `Remove ${image}` : image}\n </Tooltip.Content>\n </Tooltip>\n );\n};\n\nexport { ImageTag };\n"]}
1
+ {"version":3,"file":"ImageTag.js","sourceRoot":"","sources":["../../../../src/ai/image-tag/ImageTag.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,UAAU,MAAM,YAAY,CAAC;A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AAO,EAChB,WAAW,EAAE,IAAI,EACjB,cAAc,EAAE;wCACd,YAAY,EAAE,UAAU,KAAK,EAAE;wCAC/B,MAAM,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC;wCACtC,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC;wCACtC,YAAY,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC;wCAC3C,YAAY,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC;qCAC7C,EACD,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,yBAAyB,YAEnC,KAAC,gBAAgB,KAAG,GACJ,IACjB,CACJ,EACA,SAAS,IAAI,CACZ,cAAK,SAAS,EAAC,kCAAkC,YAC/C,KAAC,cAAc,IAAC,IAAI,EAAC,QAAQ,GAAG,GAC5B,CACP,KACS,GACI,EAClB,KAAC,OAAO,CAAC,OAAO,cACb,cAAc,CAAC,CAAC,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,GAC3B,IACV,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,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 */\n\nimport { CleanIconButton, LoadingSpinner, Tooltip } from '@neo4j-ndl/react';\nimport classNames from 'classnames';\nimport { useState } from 'react';\n\nimport { type CommonProps } from '../../_common/types';\nimport { XMarkIconOutline } from '../../icons/generated/heroIcons/XMarkIconOutline';\n\ntype ImageTagProps = {\n /** The source of the image */\n src: string;\n /** The alt text of the image */\n alt: string;\n /** The name of the image */\n fileName: string;\n /** The type of the image, e.g. 'jpg', 'png', 'gif', etc. */\n fileType: string;\n /** Callback function triggered either when the image tag is clicked, or when the remove button is clicked (if isRemovable is true) */\n onClick?: (event: React.MouseEvent<HTMLElement, MouseEvent>) => void;\n /** Whether the image tag is removable */\n isRemovable?: boolean;\n /** Whether the image tag is loading */\n isLoading?: boolean;\n};\n\n/**\n * The component is used to display an image in a chat, or in a prompt.\n * It can be removable and it can be loading.\n *\n * @alpha - Changes to this component may be breaking.\n */\nconst ImageTag = ({\n src,\n fileName,\n fileType,\n alt,\n onClick,\n isRemovable = false,\n isLoading = false,\n ref,\n className,\n style,\n htmlAttributes,\n ...restProps\n}: CommonProps<React.ElementType, ImageTagProps>) => {\n const Component = isRemovable !== true ? 'button' : 'div';\n const classes = classNames('ndl-ai-image-tag', className);\n\n const image = `${fileName}.${fileType}`;\n const [isRemoveActive, setIsRemoveActive] = useState(false);\n\n return (\n <Tooltip\n type=\"simple\"\n placement=\"bottom\"\n hoverDelay={{ close: 0, open: 500 }}\n >\n <Tooltip.Trigger hasButtonWrapper>\n <Component\n ref={ref}\n className={classes}\n style={style}\n {...(isRemovable ? {} : { onClick })}\n // what is read by screen readers here?\n {...restProps}\n {...htmlAttributes}\n >\n <img src={src} alt={alt} />\n {isRemovable && (\n <>\n <div className=\"ndl-ai-image-tag-remove-wrapper\" />\n <CleanIconButton\n onClick={onClick}\n description={null}\n htmlAttributes={{\n 'aria-label': `Remove ${image}`,\n onBlur: () => setIsRemoveActive(false),\n onFocus: () => setIsRemoveActive(true),\n onMouseEnter: () => setIsRemoveActive(true),\n onMouseLeave: () => setIsRemoveActive(false),\n }}\n size=\"small\"\n className=\"ndl-ai-image-tag-remove\"\n >\n <XMarkIconOutline />\n </CleanIconButton>\n </>\n )}\n {isLoading && (\n <div className=\"ndl-ai-image-tag-loading-overlay\">\n <LoadingSpinner size=\"medium\" />\n </div>\n )}\n </Component>\n </Tooltip.Trigger>\n <Tooltip.Content>\n {isRemoveActive ? `Remove ${image}` : image}\n </Tooltip.Content>\n </Tooltip>\n );\n};\n\nexport { ImageTag };\n"]}