@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
@@ -27,16 +27,16 @@
27
27
  * - Values 10 or greater are rounded to whole numbers
28
28
  * - Unit names are automatically pluralized based on the value
29
29
  *
30
- * @param ms - The duration in milliseconds to format. Negative or NaN values return { unit: 'seconds', value: 0 }
30
+ * @param ms - The duration in milliseconds to format. Negative or NaN values return `{ unit: 'seconds', value: 0 }`
31
31
  * @returns An object containing:
32
32
  * - `unit`: The time unit string (e.g., 'second', 'seconds', 'minute', 'minutes')
33
33
  * - `value`: The numeric value in the selected unit
34
34
  *
35
35
  * @example
36
- * formatThinkingDuration(500) // { unit: 'milliseconds', value: 500 }
37
- * formatThinkingDuration(1500) // { unit: 'seconds', value: 1.5 }
38
- * formatThinkingDuration(65000) // { unit: 'minutes', value: 1.1 }
39
- * formatThinkingDuration(3600000) // { unit: 'hour', value: 1 }
36
+ * formatThinkingDuration(500) // `{ unit: 'milliseconds', value: 500 }`
37
+ * formatThinkingDuration(1500) // `{ unit: 'seconds', value: 1.5 }`
38
+ * formatThinkingDuration(65000) // `{ unit: 'minutes', value: 1.1 }`
39
+ * formatThinkingDuration(3600000) // `{ unit: 'hour', value: 1 }`
40
40
  */
41
41
  export const formatThinkingDuration = (ms) => {
42
42
  if (Number.isNaN(ms) || ms < 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"thinking-duration-formatter.js","sourceRoot":"","sources":["../../../../src/ai/thinking/thinking-duration-formatter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,EAAU,EACuB,EAAE;IACnC,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;QAC/B,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IACvC,CAAC;IAED,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC;QACd,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC7B,MAAM,IAAI,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc,CAAC;QAC1D,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACzB,CAAC;IAED,MAAM,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC;IAE1B,IAAI,OAAO,GAAG,EAAE,EAAE,CAAC;QACjB,MAAM,KAAK,GACT,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACrE,MAAM,IAAI,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;QAChD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACzB,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,GAAG,EAAE,CAAC;IAE7B,IAAI,OAAO,GAAG,EAAE,EAAE,CAAC;QACjB,MAAM,KAAK,GACT,OAAO,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACrE,MAAM,IAAI,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;QAChD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACzB,CAAC;IAED,MAAM,KAAK,GAAG,OAAO,GAAG,EAAE,CAAC;IAC3B,MAAM,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3E,MAAM,IAAI,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAE5C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACzB,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 * Formats a duration in milliseconds to a human-readable representation with automatic unit selection.\n *\n * The function selects the most appropriate time unit (milliseconds, seconds, minutes, or hours)\n * based on the input value and applies smart rounding:\n * - Values under 10 in a given unit are rounded to 1 decimal place\n * - Values 10 or greater are rounded to whole numbers\n * - Unit names are automatically pluralized based on the value\n *\n * @param ms - The duration in milliseconds to format. Negative or NaN values return { unit: 'seconds', value: 0 }\n * @returns An object containing:\n * - `unit`: The time unit string (e.g., 'second', 'seconds', 'minute', 'minutes')\n * - `value`: The numeric value in the selected unit\n *\n * @example\n * formatThinkingDuration(500) // { unit: 'milliseconds', value: 500 }\n * formatThinkingDuration(1500) // { unit: 'seconds', value: 1.5 }\n * formatThinkingDuration(65000) // { unit: 'minutes', value: 1.1 }\n * formatThinkingDuration(3600000) // { unit: 'hour', value: 1 }\n */\nexport const formatThinkingDuration = (\n ms: number,\n): { unit: string; value: number } => {\n if (Number.isNaN(ms) || ms < 0) {\n return { unit: 'seconds', value: 0 };\n }\n\n if (ms < 1000) {\n const value = Math.round(ms);\n const unit = value === 1 ? 'millisecond' : 'milliseconds';\n return { unit, value };\n }\n\n const seconds = ms / 1000;\n\n if (seconds < 60) {\n const value =\n seconds < 10 ? Math.round(seconds * 10) / 10 : Math.round(seconds);\n const unit = value === 1 ? 'second' : 'seconds';\n return { unit, value };\n }\n\n const minutes = seconds / 60;\n\n if (minutes < 60) {\n const value =\n minutes < 10 ? Math.round(minutes * 10) / 10 : Math.round(minutes);\n const unit = value === 1 ? 'minute' : 'minutes';\n return { unit, value };\n }\n\n const hours = minutes / 60;\n const value = hours < 10 ? Math.round(hours * 10) / 10 : Math.round(hours);\n const unit = value === 1 ? 'hour' : 'hours';\n\n return { unit, value };\n};\n"]}
1
+ {"version":3,"file":"thinking-duration-formatter.js","sourceRoot":"","sources":["../../../../src/ai/thinking/thinking-duration-formatter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,EAAU,EACuB,EAAE;IACnC,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC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K,GAAG,OAAO,GAAG,EAAE,CAAC;IAC3B,MAAM,KAAK,GAAG,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3E,MAAM,IAAI,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAE5C,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AACzB,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 * Formats a duration in milliseconds to a human-readable representation with automatic unit selection.\n *\n * The function selects the most appropriate time unit (milliseconds, seconds, minutes, or hours)\n * based on the input value and applies smart rounding:\n * - Values under 10 in a given unit are rounded to 1 decimal place\n * - Values 10 or greater are rounded to whole numbers\n * - Unit names are automatically pluralized based on the value\n *\n * @param ms - The duration in milliseconds to format. Negative or NaN values return `{ unit: 'seconds', value: 0 }`\n * @returns An object containing:\n * - `unit`: The time unit string (e.g., 'second', 'seconds', 'minute', 'minutes')\n * - `value`: The numeric value in the selected unit\n *\n * @example\n * formatThinkingDuration(500) // `{ unit: 'milliseconds', value: 500 }`\n * formatThinkingDuration(1500) // `{ unit: 'seconds', value: 1.5 }`\n * formatThinkingDuration(65000) // `{ unit: 'minutes', value: 1.1 }`\n * formatThinkingDuration(3600000) // `{ unit: 'hour', value: 1 }`\n */\nexport const formatThinkingDuration = (\n ms: number,\n): { unit: string; value: number } => {\n if (Number.isNaN(ms) || ms < 0) {\n return { unit: 'seconds', value: 0 };\n }\n\n if (ms < 1000) {\n const value = Math.round(ms);\n const unit = value === 1 ? 'millisecond' : 'milliseconds';\n return { unit, value };\n }\n\n const seconds = ms / 1000;\n\n if (seconds < 60) {\n const value =\n seconds < 10 ? Math.round(seconds * 10) / 10 : Math.round(seconds);\n const unit = value === 1 ? 'second' : 'seconds';\n return { unit, value };\n }\n\n const minutes = seconds / 60;\n\n if (minutes < 60) {\n const value =\n minutes < 10 ? Math.round(minutes * 10) / 10 : Math.round(minutes);\n const unit = value === 1 ? 'minute' : 'minutes';\n return { unit, value };\n }\n\n const hours = minutes / 60;\n const value = hours < 10 ? Math.round(hours * 10) / 10 : Math.round(hours);\n const unit = value === 1 ? 'hour' : 'hours';\n\n return { unit, value };\n};\n"]}
@@ -85,9 +85,9 @@ const BannerComponent = (_a) => {
85
85
  'ndl-success': variant === 'success',
86
86
  'ndl-warning': variant === 'warning',
87
87
  });
88
- const handleClose = (e) => {
88
+ const handleClose = (event) => {
89
89
  if (onClose && typeof onClose === 'function') {
90
- onClose(e);
90
+ onClose(event);
91
91
  }
92
92
  };
93
93
  return (_jsxs(Element, Object.assign({ className: classes, role: isAlert ? 'alert' : undefined, ref: ref }, restProps, htmlAttributes, { children: [hasIcon && _jsx(StatusIcon, { variant: variant }), _jsx("div", { className: "ndl-banner-content", children: children }), isCloseable && (_jsx(CleanIconButton, { size: "small", onClick: handleClose, description: null, htmlAttributes: { 'aria-label': 'Close' }, children: _jsx(XMarkIconOutline, {}) }))] })));
@@ -1 +1 @@
1
- {"version":3,"file":"Banner.js","sourceRoot":"","sources":["../../../src/banner/Banner.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAA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AC,MAAM,CAAC,eAAe,EAAE;IAC5C,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,iBAAiB;IAC9B,MAAM,EAAE,YAAY;CACrB,CAAC,CAAC;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport type React from 'react';\n\nimport {\n type CommonProps,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { BoltIconOutline } from '../icons/generated/heroIcons/BoltIconOutline';\nimport { CheckCircleIconSolid } from '../icons/generated/heroIcons/CheckCircleIconSolid';\nimport { ExclamationCircleIconSolid } from '../icons/generated/heroIcons/ExclamationCircleIconSolid';\nimport { ExclamationTriangleIconSolid } from '../icons/generated/heroIcons/ExclamationTriangleIconSolid';\nimport { InformationCircleIconSolid } from '../icons/generated/heroIcons/InformationCircleIconSolid';\nimport { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';\nimport { Typography } from '../typography';\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype BannerCommonProps = {\n /** Shows a status icon. The icon is based on the value of the `variant` prop */\n hasIcon?: boolean;\n\n /** Content to be shown in the banner. */\n children?: React.ReactNode;\n\n /** Sets the role to alert */\n isAlert?: boolean;\n\n /** How the banner is used. */\n usage?: 'inline' | 'global';\n\n /** The variant of the banner */\n variant?: BannerVariant;\n};\n\ntype CloseableBannerProps = {\n /** If the banner is closeable. Renders an icon button in the top right corner */\n isCloseable: true;\n\n /** Event handler for when the close icon is clicked */\n onClose: (\n e?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => void;\n};\n\ntype NonCloseableBannerProps = {\n isCloseable?: false;\n onClose?: never;\n};\n\ntype BannerCloseProps = CloseableBannerProps | NonCloseableBannerProps;\n\ntype BannerProps = BannerCommonProps & BannerCloseProps;\ntype BannerVariant = 'info' | 'success' | 'warning' | 'danger' | 'neutral';\n\nconst StatusIcon = ({ variant }: { variant: BannerVariant }) => {\n const iconComponent = (() => {\n switch (variant) {\n case 'success':\n return <CheckCircleIconSolid />;\n case 'warning':\n return <ExclamationTriangleIconSolid />;\n case 'danger':\n return <ExclamationCircleIconSolid />;\n case 'info':\n return <InformationCircleIconSolid />;\n case 'neutral':\n return <BoltIconOutline />;\n default:\n return null;\n }\n })();\n\n return <div className=\"ndl-banner-status-icon\">{iconComponent}</div>;\n};\n\nconst BannerHeader = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'span', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-banner-header', className);\n return (\n <Typography\n as=\"span\"\n variant=\"title-4\"\n className={classes}\n style={style}\n ref={ref}\n htmlAttributes={htmlAttributes}\n {...restProps}\n >\n {children}\n </Typography>\n );\n};\n\nconst BannerDescription = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-banner-description', className);\n return (\n <Typography\n as=\"div\"\n variant=\"body-medium\"\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Typography>\n );\n};\n\nconst BannerActions = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-banner-actions', className);\n return (\n <div\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </div>\n );\n};\n\nconst BannerComponent = <T extends React.ElementType = 'section'>({\n as,\n variant = 'info',\n hasIcon = false,\n onClose,\n className,\n children,\n isCloseable = false,\n usage = 'inline',\n htmlAttributes,\n isAlert = false,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, BannerProps>) => {\n const Element: React.ElementType = as ?? 'section';\n\n const classes = classNames('ndl-banner', className, {\n 'ndl-danger': variant === 'danger',\n 'ndl-global': usage === 'global',\n 'ndl-info': variant === 'info',\n 'ndl-inline': usage === 'inline',\n 'ndl-neutral': variant === 'neutral',\n 'ndl-success': variant === 'success',\n 'ndl-warning': variant === 'warning',\n });\n\n const handleClose = (\n e:\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEvent<HTMLElement>,\n ) => {\n if (onClose && typeof onClose === 'function') {\n onClose(e);\n }\n };\n\n return (\n <Element\n className={classes}\n role={isAlert ? 'alert' : undefined}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {hasIcon && <StatusIcon variant={variant} />}\n <div className=\"ndl-banner-content\">{children}</div>\n {isCloseable && (\n <CleanIconButton\n size=\"small\"\n onClick={handleClose}\n description={null}\n htmlAttributes={{ 'aria-label': 'Close' }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n )}\n </Element>\n );\n};\n\nconst Banner = Object.assign(BannerComponent, {\n Actions: BannerActions,\n Description: BannerDescription,\n Header: BannerHeader,\n});\n\nexport { Banner };\n"]}
1
+ {"version":3,"file":"Banner.js","sourceRoot":"","sources":["../../../src/banner/Banner.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AAOpC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,m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E,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 classNames from 'classnames';\nimport type React from 'react';\n\nimport {\n type CommonProps,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { BoltIconOutline } from '../icons/generated/heroIcons/BoltIconOutline';\nimport { CheckCircleIconSolid } from '../icons/generated/heroIcons/CheckCircleIconSolid';\nimport { ExclamationCircleIconSolid } from '../icons/generated/heroIcons/ExclamationCircleIconSolid';\nimport { ExclamationTriangleIconSolid } from '../icons/generated/heroIcons/ExclamationTriangleIconSolid';\nimport { InformationCircleIconSolid } from '../icons/generated/heroIcons/InformationCircleIconSolid';\nimport { XMarkIconOutline } from '../icons/generated/heroIcons/XMarkIconOutline';\nimport { Typography } from '../typography';\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype BannerCommonProps = {\n /** Shows a status icon. The icon is based on the value of the `variant` prop */\n hasIcon?: boolean;\n\n /** Content to be shown in the banner. */\n children?: React.ReactNode;\n\n /** Sets the role to alert */\n isAlert?: boolean;\n\n /** How the banner is used. */\n usage?: 'inline' | 'global';\n\n /** The variant of the banner */\n variant?: BannerVariant;\n};\n\ntype CloseableBannerProps = {\n /** If the banner is closeable. Renders an icon button in the top right corner */\n isCloseable: true;\n\n /** Event handler for when the close icon is clicked */\n onClose: (\n event?: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>,\n ) => void;\n};\n\ntype NonCloseableBannerProps = {\n isCloseable?: false;\n onClose?: never;\n};\n\ntype BannerCloseProps = CloseableBannerProps | NonCloseableBannerProps;\n\ntype BannerProps = BannerCommonProps & BannerCloseProps;\ntype BannerVariant = 'info' | 'success' | 'warning' | 'danger' | 'neutral';\n\nconst StatusIcon = ({ variant }: { variant: BannerVariant }) => {\n const iconComponent = (() => {\n switch (variant) {\n case 'success':\n return <CheckCircleIconSolid />;\n case 'warning':\n return <ExclamationTriangleIconSolid />;\n case 'danger':\n return <ExclamationCircleIconSolid />;\n case 'info':\n return <InformationCircleIconSolid />;\n case 'neutral':\n return <BoltIconOutline />;\n default:\n return null;\n }\n })();\n\n return <div className=\"ndl-banner-status-icon\">{iconComponent}</div>;\n};\n\nconst BannerHeader = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'span', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-banner-header', className);\n return (\n <Typography\n as=\"span\"\n variant=\"title-4\"\n className={classes}\n style={style}\n ref={ref}\n htmlAttributes={htmlAttributes}\n {...restProps}\n >\n {children}\n </Typography>\n );\n};\n\nconst BannerDescription = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-banner-description', className);\n return (\n <Typography\n as=\"div\"\n variant=\"body-medium\"\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Typography>\n );\n};\n\nconst BannerActions = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'div', { children: React.ReactNode }>) => {\n const classes = classNames('ndl-banner-actions', className);\n return (\n <div\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </div>\n );\n};\n\nconst BannerComponent = <T extends React.ElementType = 'section'>({\n as,\n variant = 'info',\n hasIcon = false,\n onClose,\n className,\n children,\n isCloseable = false,\n usage = 'inline',\n htmlAttributes,\n isAlert = false,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, BannerProps>) => {\n const Element: React.ElementType = as ?? 'section';\n\n const classes = classNames('ndl-banner', className, {\n 'ndl-danger': variant === 'danger',\n 'ndl-global': usage === 'global',\n 'ndl-info': variant === 'info',\n 'ndl-inline': usage === 'inline',\n 'ndl-neutral': variant === 'neutral',\n 'ndl-success': variant === 'success',\n 'ndl-warning': variant === 'warning',\n });\n\n const handleClose = (\n event:\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEvent<HTMLElement>,\n ) => {\n if (onClose && typeof onClose === 'function') {\n onClose(event);\n }\n };\n\n return (\n <Element\n className={classes}\n role={isAlert ? 'alert' : undefined}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {hasIcon && <StatusIcon variant={variant} />}\n <div className=\"ndl-banner-content\">{children}</div>\n {isCloseable && (\n <CleanIconButton\n size=\"small\"\n onClick={handleClose}\n description={null}\n htmlAttributes={{ 'aria-label': 'Close' }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n )}\n </Element>\n );\n};\n\nconst Banner = Object.assign(BannerComponent, {\n Actions: BannerActions,\n Description: BannerDescription,\n Header: BannerHeader,\n});\n\nexport { Banner };\n"]}
@@ -47,18 +47,18 @@ export const ButtonBase = (_a) => {
47
47
  [`ndl-${buttonFill}-button`]: buttonFill,
48
48
  [`ndl-${variant}`]: variant,
49
49
  });
50
- const handleClick = (e) => {
50
+ const handleClick = (event) => {
51
51
  if (!isInteractable) {
52
52
  // By default, a <button /> element with disabled set to true will not get its
53
53
  // on click handler called. To support the same behavior on <a /> tags we
54
54
  // swallow the event here when disabled, since the <a /> tag with disabled set to
55
55
  // true will have its onClick handler called
56
- e.preventDefault();
57
- e.stopPropagation();
56
+ event.preventDefault();
57
+ event.stopPropagation();
58
58
  return;
59
59
  }
60
60
  if (onClick) {
61
- onClick(e);
61
+ onClick(event);
62
62
  }
63
63
  };
64
64
  return (_jsx(Component, Object.assign({ type: type, onClick: handleClick, disabled: isDisabled, "aria-disabled": !isInteractable, className: classes, style: style, ref: ref }, restProps, htmlAttributes, { children: _jsxs("div", { className: "ndl-btn-inner", children: [Boolean(leadingVisual) && (_jsx("div", { className: "ndl-btn-leading-element", children: leadingVisual })), Boolean(children) && (_jsx("span", { className: "ndl-btn-content", children: children })), isLoading && (_jsx(ButtonSpinner, { loadingMessage: loadingMessage, size: size }))] }) })));
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonBase.js","sourceRoot":"","sources":["../../../src/button/ButtonBase.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AAGpC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAgEzD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAyC,EAoBtB,EAAE,EAAE;QApBkB,EACjE,EAAE,EACF,UAAU,GAAG,QAAQ,EACrB,QAAQ,EACR,SAAS,EACT,OAAO,GAAG,SAAS,EACnB,cAAc,EACd,UAAU,GAAG,KAAK,EAClB,UAAU,GAAG,KAAK,EAClB,OAAO,GAAG,KAAK,EACf,SAAS,GAAG,KAAK,EACjB,aAAa,EACb,OAAO,EACP,GAAG,EACH,IAAI,GAAG,QAAQ,EACf,KAAK,EACL,IAAI,GAAG,QAAQ;IACf,oIAAoI;IACpI,cAAc,GAAG,iBAAiB,OAES,EADxC,SAAS,cAnBqD,4MAoBlE,CADa;IAEZ,MAAM,SAAS,GAAsB,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,QAAQ,CAAC;IACpD,MAAM,cAAc,GAAG,CAAC,UAAU,IAAI,CAAC,SAAS,CAAC;IAEjD,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,EAAE,SAAS,EAAE;QAC/C,cAAc,EAAE,UAAU;QAC1B,cAAc,EAAE,UAAU;QAC1B,WAAW,EAAE,OAAO;QACpB,aAAa,EAAE,SAAS;QACxB,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,IAAI;QACrB,CAAC,OAAO,UAAU,SAAS,CAAC,EAAE,UAAU;QACxC,CAAC,OAAO,OAAO,EAAE,CAAC,EAAE,OAAO;KAC5B,CAAC,CAAC;IAEH,MAAM,WAAW,GAAG,CAAC,CAAkD,EAAE,EAAE;QACzE,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,8EAA8E;YAC9E,yEAAyE;YACzE,iFAAiF;YACjF,4CAA4C;YAC5C,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,OAAO;QACT,CAAC;QAED,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,CAAC,CAAC,CAAC;QACb,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,SAAS,kBACR,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,UAAU,mBACL,CAAC,cAAc,EAC9B,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,IACJ,SAAS,EACT,cAAc,cAElB,eAAK,SAAS,EAAC,eAAe,aAC3B,OAAO,CAAC,aAAa,CAAC,IAAI,CACzB,cAAK,SAAS,EAAC,yBAAyB,YAAE,aAAa,GAAO,CAC/D,EACA,OAAO,CAAC,QAAQ,CAAC,IAAI,CACpB,eAAM,SAAS,EAAC,iBAAiB,YAAE,QAAQ,GAAQ,CACpD,EACA,SAAS,IAAI,CACZ,KAAC,aAAa,IAAC,cAAc,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,GAAI,CAC9D,IACG,IACI,CACb,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 classNames from 'classnames';\nimport type React from 'react';\n\nimport { ButtonSpinner } from '../_common/ButtonSpinner';\nimport {\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\n\n/**\n *\n * Types\n *\n */\n\ntype ButtonTypes = 'submit' | 'button' | 'reset';\nexport type ButtonSizes = 'small' | 'medium' | 'large';\nexport type ButtonVariants = 'primary' | 'danger' | 'neutral';\n\nexport type CommonButtonProps = {\n children?: React.ReactNode;\n /** Icon to display before the button content */\n leadingVisual?: React.ReactNode;\n /** If the button is doing something Async, it will display a loading spinner */\n isLoading?: boolean;\n /** If the button is in disabled state */\n isDisabled?: boolean;\n /** If the button is fluid, it will take the full width of its container */\n isFluid?: boolean;\n /** Type of button */\n type?: ButtonTypes;\n /** Size of button */\n size?: ButtonSizes;\n /** onClick callback*/\n onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n /** onKeyDown callback */\n onKeyDown?: (e: React.KeyboardEvent<HTMLButtonElement>) => void;\n /** Accessible message for screen readers when the button is in a loading state */\n loadingMessage?: string;\n} /**\n * If `as=\"a\"`, `href` is required and `target` is available.\n * For all other elements, these props are not present.\n */ & (\n | {\n as: 'a';\n /** The URL to link to. Only applies when `as=\"a\"` */\n href?: HtmlAttributes<'a'>['href'];\n /**\n * The target window for the link. Only applies when `as=\"a\"`.\n * Not present or required for other element types.\n */\n target?: HtmlAttributes<'a'>['target'];\n }\n | {\n as?: React.ElementType;\n }\n);\n\ntype ButtonBaseProps = CommonButtonProps & {\n /** If the button is in floating state */\n isFloating?: boolean;\n /** variant of the button */\n variant?: ButtonVariants;\n /** fill of the button */\n buttonFill?: 'filled' | 'outlined' | 'text';\n};\n\nexport const ButtonBase = <T extends React.ElementType = 'button'>({\n as,\n buttonFill = 'filled',\n children,\n className,\n variant = 'primary',\n htmlAttributes,\n isDisabled = false,\n isFloating = false,\n isFluid = false,\n isLoading = false,\n leadingVisual,\n onClick,\n ref,\n size = 'medium',\n style,\n type = 'button',\n // TODO v5: maybe update default message to 'Loading'. This value is for backward compatibility with loading spinners old aria-label\n loadingMessage = 'Loading content',\n ...restProps\n}: PolymorphicCommonProps<T, ButtonBaseProps>) => {\n const Component: React.ElementType = as ?? 'button';\n const isInteractable = !isDisabled && !isLoading;\n\n const classes = classNames(className, 'ndl-btn', {\n 'ndl-disabled': isDisabled,\n 'ndl-floating': isFloating,\n 'ndl-fluid': isFluid,\n 'ndl-loading': isLoading,\n [`ndl-${size}`]: size,\n [`ndl-${buttonFill}-button`]: buttonFill,\n [`ndl-${variant}`]: variant,\n });\n\n const handleClick = (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n if (!isInteractable) {\n // By default, a <button /> element with disabled set to true will not get its\n // on click handler called. To support the same behavior on <a /> tags we\n // swallow the event here when disabled, since the <a /> tag with disabled set to\n // true will have its onClick handler called\n e.preventDefault();\n e.stopPropagation();\n return;\n }\n\n if (onClick) {\n onClick(e);\n }\n };\n\n return (\n <Component\n type={type}\n onClick={handleClick}\n disabled={isDisabled}\n aria-disabled={!isInteractable}\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-btn-inner\">\n {Boolean(leadingVisual) && (\n <div className=\"ndl-btn-leading-element\">{leadingVisual}</div>\n )}\n {Boolean(children) && (\n <span className=\"ndl-btn-content\">{children}</span>\n )}\n {isLoading && (\n <ButtonSpinner loadingMessage={loadingMessage} size={size} />\n )}\n </div>\n </Component>\n );\n};\n"]}
1
+ {"version":3,"file":"ButtonBase.js","sourceRoot":"","sources":["../../../src/button/ButtonBase.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;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OAAO;QACT,CAAC;QAED,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,SAAS,kBACR,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,UAAU,mBACL,CAAC,cAAc,EAC9B,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,EACZ,GAAG,EAAE,GAAG,IACJ,SAAS,EACT,cAAc,cAElB,eAAK,SAAS,EAAC,eAAe,aAC3B,OAAO,CAAC,aAAa,CAAC,IAAI,CACzB,cAAK,SAAS,EAAC,yBAAyB,YAAE,aAAa,GAAO,CAC/D,EACA,OAAO,CAAC,QAAQ,CAAC,IAAI,CACpB,eAAM,SAAS,EAAC,iBAAiB,YAAE,QAAQ,GAAQ,CACpD,EACA,SAAS,IAAI,CACZ,KAAC,aAAa,IAAC,cAAc,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,GAAI,CAC9D,IACG,IACI,CACb,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 classNames from 'classnames';\nimport type React from 'react';\n\nimport { ButtonSpinner } from '../_common/ButtonSpinner';\nimport {\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\n\n/**\n *\n * Types\n *\n */\n\ntype ButtonTypes = 'submit' | 'button' | 'reset';\nexport type ButtonSizes = 'small' | 'medium' | 'large';\nexport type ButtonVariants = 'primary' | 'danger' | 'neutral';\n\nexport type CommonButtonProps = {\n children?: React.ReactNode;\n /** Icon to display before the button content */\n leadingVisual?: React.ReactNode;\n /** If the button is doing something Async, it will display a loading spinner */\n isLoading?: boolean;\n /** If the button is in disabled state */\n isDisabled?: boolean;\n /** If the button is fluid, it will take the full width of its container */\n isFluid?: boolean;\n /** Type of button */\n type?: ButtonTypes;\n /** Size of button */\n size?: ButtonSizes;\n /** onClick callback*/\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n /** onKeyDown callback */\n onKeyDown?: (event: React.KeyboardEvent<HTMLButtonElement>) => void;\n /** Accessible message for screen readers when the button is in a loading state */\n loadingMessage?: string;\n} /**\n * If `as=\"a\"`, `href` is required and `target` is available.\n * For all other elements, these props are not present.\n */ & (\n | {\n as: 'a';\n /** The URL to link to. Only applies when `as=\"a\"` */\n href?: HtmlAttributes<'a'>['href'];\n /**\n * The target window for the link. Only applies when `as=\"a\"`.\n * Not present or required for other element types.\n */\n target?: HtmlAttributes<'a'>['target'];\n }\n | {\n as?: React.ElementType;\n }\n);\n\ntype ButtonBaseProps = CommonButtonProps & {\n /** If the button is in floating state */\n isFloating?: boolean;\n /** variant of the button */\n variant?: ButtonVariants;\n /** fill of the button */\n buttonFill?: 'filled' | 'outlined' | 'text';\n};\n\nexport const ButtonBase = <T extends React.ElementType = 'button'>({\n as,\n buttonFill = 'filled',\n children,\n className,\n variant = 'primary',\n htmlAttributes,\n isDisabled = false,\n isFloating = false,\n isFluid = false,\n isLoading = false,\n leadingVisual,\n onClick,\n ref,\n size = 'medium',\n style,\n type = 'button',\n // TODO v5: maybe update default message to 'Loading'. This value is for backward compatibility with loading spinners old aria-label\n loadingMessage = 'Loading content',\n ...restProps\n}: PolymorphicCommonProps<T, ButtonBaseProps>) => {\n const Component: React.ElementType = as ?? 'button';\n const isInteractable = !isDisabled && !isLoading;\n\n const classes = classNames(className, 'ndl-btn', {\n 'ndl-disabled': isDisabled,\n 'ndl-floating': isFloating,\n 'ndl-fluid': isFluid,\n 'ndl-loading': isLoading,\n [`ndl-${size}`]: size,\n [`ndl-${buttonFill}-button`]: buttonFill,\n [`ndl-${variant}`]: variant,\n });\n\n const handleClick = (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => {\n if (!isInteractable) {\n // By default, a <button /> element with disabled set to true will not get its\n // on click handler called. To support the same behavior on <a /> tags we\n // swallow the event here when disabled, since the <a /> tag with disabled set to\n // true will have its onClick handler called\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n if (onClick) {\n onClick(event);\n }\n };\n\n return (\n <Component\n type={type}\n onClick={handleClick}\n disabled={isDisabled}\n aria-disabled={!isInteractable}\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-btn-inner\">\n {Boolean(leadingVisual) && (\n <div className=\"ndl-btn-leading-element\">{leadingVisual}</div>\n )}\n {Boolean(children) && (\n <span className=\"ndl-btn-content\">{children}</span>\n )}\n {isLoading && (\n <ButtonSpinner loadingMessage={loadingMessage} size={size} />\n )}\n </div>\n </Component>\n );\n};\n"]}
@@ -40,12 +40,12 @@ export const Code = (_a) => {
40
40
  'ndl-disabled': isDisabled,
41
41
  'ndl-runnable': isRunnable,
42
42
  }, className);
43
- const handleClick = (e) => {
43
+ const handleClick = (event) => {
44
44
  if (isDisabled) {
45
- e.preventDefault();
45
+ event.preventDefault();
46
46
  return;
47
47
  }
48
- onClick === null || onClick === void 0 ? void 0 : onClick(e);
48
+ onClick === null || onClick === void 0 ? void 0 : onClick(event);
49
49
  };
50
50
  return (_jsx(ConditionalWrap, { shouldWrap: Boolean(description) === true, wrap: (children) => (_jsxs(Tooltip, { type: "simple", children: [_jsx(Tooltip.Trigger, { hasButtonWrapper: Component === 'button', children: children }), _jsx(Tooltip.Content, { children: description })] })), children: _jsx(Component, Object.assign({ className: classes, style: style, onClick: handleClick, disabled: isDisabled, ref: ref }, restProps, htmlAttributes, { children: _jsx("code", { children: children }) })) }));
51
51
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Code.js","sourceRoot":"","sources":["../../../src/code/Code.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,UAAU,MAAM,YAAY,CAAC;AAGpC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAmBrC,MAAM,CAAC,MAAM,IAAI,GAAG,CAAyC,EAYtB,EAAE,EAAE;QAZkB,EAC3D,QAAQ,EACR,SAAS,EACT,UAAU,GAAG,KAAK,EAClB,KAAK,EACL,UAAU,GAAG,KAAK,EAClB,WAAW,EACX,OAAO,EACP,EAAE,EACF,GAAG,EACH,cAAc,OAEuB,EADlC,SAAS,cAX+C,uHAY5D,CADa;IAEZ,MAAM,SAAS,GAAsB,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAEzE,MAAM,OAAO,GAAG,UAAU,CACxB,UAAU,EACV;QACE,cAAc,EAAE,UAAU;QAC1B,cAAc,EAAE,UAAU;KAC3B,EACD,SAAS,CACV,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,CAA4C,EAAE,EAAE;QACnE,IAAI,UAAU,EAAE,CAAC;YACf,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,OAAO;QACT,CAAC;QAED,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,CAAC,CAAC,CAAC;IACf,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,eAAe,IACd,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,EACzC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAClB,MAAC,OAAO,IAAC,IAAI,EAAC,QAAQ,aACpB,KAAC,OAAO,CAAC,OAAO,IAAC,gBAAgB,EAAE,SAAS,KAAK,QAAQ,YACtD,QAAQ,GACO,EAClB,KAAC,OAAO,CAAC,OAAO,cAAE,WAAW,GAAmB,IACxC,CACX,YAED,KAAC,SAAS,kBACR,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,UAAU,EACpB,GAAG,EAAE,GAAG,IACJ,SAAS,EACT,cAAc,cAElB,yBAAO,QAAQ,GAAQ,IACb,GACI,CACnB,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 */\n\nimport classNames from 'classnames';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { Tooltip } from '../tooltip';\n\ntype CodeProps = {\n /** The content of the code */\n children?: React.ReactNode;\n /** Whether the code is disabled */\n isDisabled?: boolean;\n /** Whether the code is runnable */\n isRunnable?: boolean;\n /** The description of the code, will be displayed in a tooltip */\n description?: string;\n /** The callback function triggered when the inline code is clicked */\n onClick?: (\n e:\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEvent<HTMLElement>,\n ) => void;\n};\n\nexport const Code = <T extends React.ElementType = 'button'>({\n children,\n className,\n isDisabled = false,\n style,\n isRunnable = false,\n description,\n onClick,\n as,\n ref,\n htmlAttributes,\n ...restProps\n}: PolymorphicCommonProps<T, CodeProps>) => {\n const Component: React.ElementType = as ?? (onClick ? 'button' : 'span');\n\n const classes = classNames(\n 'ndl-code',\n {\n 'ndl-disabled': isDisabled,\n 'ndl-runnable': isRunnable,\n },\n className,\n );\n\n const handleClick = (e: React.MouseEvent<HTMLElement, MouseEvent>) => {\n if (isDisabled) {\n e.preventDefault();\n return;\n }\n\n onClick?.(e);\n };\n\n return (\n <ConditionalWrap\n shouldWrap={Boolean(description) === true}\n wrap={(children) => (\n <Tooltip type=\"simple\">\n <Tooltip.Trigger hasButtonWrapper={Component === 'button'}>\n {children}\n </Tooltip.Trigger>\n <Tooltip.Content>{description}</Tooltip.Content>\n </Tooltip>\n )}\n >\n <Component\n className={classes}\n style={style}\n onClick={handleClick}\n disabled={isDisabled}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n <code>{children}</code>\n </Component>\n </ConditionalWrap>\n );\n};\n"]}
1
+ {"version":3,"file":"Code.js","sourceRoot":"","sources":["../../../src/code/Code.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,UAAU,MAAM,YAAY,CAAC;AAGpC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAmBrC,MAAM,CAAC,MAAM,IAAI,GAAG,CAAyC,EAYtB,EAAE,EAAE;QAZkB,EAC3D,QAAQ,EACR,SAAS,EACT,UAAU,GAAG,KAAK,EAClB,KAAK,EACL,UAAU,GAAG,KAAK,EAClB,WAAW,EACX,OAAO,EACP,EAAE,EACF,GAAG,EACH,cAAc,OAEuB,EADlC,SAAS,cAX+C,uHAY5D,CADa;IAEZ,MAAM,SAAS,GAAsB,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAEzE,MAAM,OAAO,GAAG,UAAU,CACxB,UAAU,EACV;QACE,cAAc,EAAE,UAAU;QAC1B,cAAc,EAAE,UAAU;KAC3B,EACD,SAAS,CACV,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,KAAgD,EAAE,EAAE;QACvE,IAAI,UAAU,EAAE,CAAC;YACf,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,OAAO;QACT,CAAC;QAED,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,KAAK,CAAC,CAAC;IACnB,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,eAAe,IACd,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,EACzC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAClB,MAAC,OAAO,IAAC,IAAI,EAAC,QAAQ,aACpB,KAAC,OAAO,CAAC,OAAO,IAAC,gBAAgB,EAAE,SAAS,KAAK,QAAQ,YACtD,QAAQ,GACO,EAClB,KAAC,OAAO,CAAC,OAAO,cAAE,WAAW,GAAmB,IACxC,CACX,YAED,KAAC,SAAS,kBACR,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,UAAU,EACpB,GAAG,EAAE,GAAG,IACJ,SAAS,EACT,cAAc,cAElB,yBAAO,QAAQ,GAAQ,IACb,GACI,CACnB,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 */\n\nimport classNames from 'classnames';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { Tooltip } from '../tooltip';\n\ntype CodeProps = {\n /** The content of the code */\n children?: React.ReactNode;\n /** Whether the code is disabled */\n isDisabled?: boolean;\n /** Whether the code is runnable */\n isRunnable?: boolean;\n /** The description of the code, will be displayed in a tooltip */\n description?: string;\n /** The callback function triggered when the inline code is clicked */\n onClick?: (\n event:\n | React.MouseEvent<HTMLElement, MouseEvent>\n | React.KeyboardEvent<HTMLElement>,\n ) => void;\n};\n\nexport const Code = <T extends React.ElementType = 'button'>({\n children,\n className,\n isDisabled = false,\n style,\n isRunnable = false,\n description,\n onClick,\n as,\n ref,\n htmlAttributes,\n ...restProps\n}: PolymorphicCommonProps<T, CodeProps>) => {\n const Component: React.ElementType = as ?? (onClick ? 'button' : 'span');\n\n const classes = classNames(\n 'ndl-code',\n {\n 'ndl-disabled': isDisabled,\n 'ndl-runnable': isRunnable,\n },\n className,\n );\n\n const handleClick = (event: React.MouseEvent<HTMLElement, MouseEvent>) => {\n if (isDisabled) {\n event.preventDefault();\n return;\n }\n\n onClick?.(event);\n };\n\n return (\n <ConditionalWrap\n shouldWrap={Boolean(description) === true}\n wrap={(children) => (\n <Tooltip type=\"simple\">\n <Tooltip.Trigger hasButtonWrapper={Component === 'button'}>\n {children}\n </Tooltip.Trigger>\n <Tooltip.Content>{description}</Tooltip.Content>\n </Tooltip>\n )}\n >\n <Component\n className={classes}\n style={style}\n onClick={handleClick}\n disabled={isDisabled}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n <code>{children}</code>\n </Component>\n </ConditionalWrap>\n );\n};\n"]}
@@ -75,9 +75,9 @@ export const CodeBlock = (_a) => {
75
75
  // wrapLongLines
76
76
  showLineNumbers: shouldShowLineNumbers, children: code }) }) })] }), _jsx("div", { className: classNames('ndl-code-block-actions', {
77
77
  'ndl-disabled': isDisabled,
78
- }), children: actions === null || actions === void 0 ? void 0 : actions.map((iconButtonProps, i) => {
78
+ }), children: actions === null || actions === void 0 ? void 0 : actions.map((iconButtonProps, index) => {
79
79
  var _a;
80
- return (_jsx(CleanIconButton, Object.assign({ isDisabled: isDisabled }, iconButtonProps, { description: `${(_a = iconButtonProps.description) !== null && _a !== void 0 ? _a : 'CodeBlock Action'}`, htmlAttributes: Object.assign({ 'data-testid': `ndl-action-button-${i}` }, iconButtonProps.htmlAttributes) }), i));
80
+ return (_jsx(CleanIconButton, Object.assign({ isDisabled: isDisabled }, iconButtonProps, { description: `${(_a = iconButtonProps.description) !== null && _a !== void 0 ? _a : 'CodeBlock Action'}`, htmlAttributes: Object.assign({ 'data-testid': `ndl-action-button-${index}` }, iconButtonProps.htmlAttributes) }), index));
81
81
  }) }), shouldShowExpandButton && (_jsx("div", { className: "ndl-code-block-expand-button", children: _jsx(CleanIconButton, { description: isExpanded ? 'Collapse' : 'Expand', tooltipProps: {
82
82
  root: {
83
83
  shouldCloseOnReferenceClick: true,
@@ -1 +1 @@
1
- {"version":3,"file":"CodeBlock.js","sourceRoot":"","sources":["../../../src/code-block/CodeBlock.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG3E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qDAAqD,CAAC;AAC7F,OAAO,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AAGzF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAavD,MAAM,cAAc,GAAG,KAAK,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OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAC,CAAC,eAAe,EAAE,CAAC,EAAE,EAAE;;oBAAC,OAAA,CACpC,KAAC,eAAe,kBAEd,UAAU,EAAE,UAAU,IAClB,eAAe,IACnB,WAAW,EAAE,GAAG,MAAA,eAAe,CAAC,WAAW,mCAAI,kBAAkB,EAAE,EACnE,cAAc,kBACZ,aAAa,EAAE,qBAAqB,CAAC,EAAE,IACpC,eAAe,CAAC,cAAc,MAN9B,CAAC,CAQN,CACH,CAAA;iBAAA,CAAC,GACE,EACL,sBAAsB,IAAI,CACzB,cAAK,SAAS,EAAC,8BAA8B,YAC3C,KAAC,eAAe,IACd,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,EAC/C,YAAY,EAAE;wBACZ,IAAI,EAAE;4BACJ,2BAA2B,EAAE,IAAI;yBAClC;qBACF,EACD,OAAO,EAAE,YAAY,YAEpB,UAAU,CAAC,CAAC,CAAC,KAAC,oBAAoB,KAAG,CAAC,CAAC,CAAC,KAAC,sBAAsB,KAAG,GACnD,GACd,CACP,KACS,CACb,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 classNames from 'classnames';\nimport type React from 'react';\nimport { PrismLight as SyntaxHighlighter } from 'react-syntax-highlighter';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { type IconButton } from '../icon-button';\nimport { ChevronDownIconOutline } from '../icons/generated/heroIcons/ChevronDownIconOutline';\nimport { ChevronUpIconOutline } from '../icons/generated/heroIcons/ChevronUpIconOutline';\nimport { type LanguageProp } from './code-languages';\nimport { type CodeTheme } from './code-themes';\nimport { useCodeLanguage } from './hooks/use-code-language';\nimport { useCodeTheme } from './hooks/use-code-theme';\nimport { useExpandable } from './hooks/use-expandable';\n\ninterface CodeBlockProps {\n code: string;\n isDisabled?: boolean;\n maxHeight?: number;\n language: LanguageProp | 'text';\n shouldShowLineNumbers?: boolean;\n theme?: CodeTheme;\n heading?: React.ReactNode;\n actions?: React.ComponentProps<typeof IconButton<'button'>>[];\n}\n\nconst defaultElement = 'div';\n\nexport const CodeBlock = <T extends React.ElementType = 'button'>({\n as,\n maxHeight,\n code,\n language,\n shouldShowLineNumbers,\n theme,\n heading,\n actions,\n isDisabled,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n // TODO: Should not be polymorphic (at least not defaulting to a button)\n}: PolymorphicCommonProps<T, CodeBlockProps>) => {\n const Component: React.ElementType = as ?? defaultElement;\n\n const {\n containerHeight,\n isExpanded,\n toggleExpand,\n hasOverflowingContent,\n ref: syntaxHighlighterWrapperRef,\n } = useExpandable(maxHeight, code);\n const codeTheme = useCodeTheme(theme);\n const codeLanguage = useCodeLanguage(language);\n\n const hasMaxHeight = maxHeight !== undefined;\n const hasHeading = Boolean(heading);\n const numberOfActions = actions?.length ?? 0;\n\n const shouldShowExpandButton = hasMaxHeight && hasOverflowingContent;\n const rightPadding = hasHeading\n ? 0\n : Math.max(numberOfActions * 36, (shouldShowExpandButton ? 1 : 0) * 36) + 8;\n\n return (\n <Component\n ref={ref}\n className={classNames('ndl-code-block-container', className)}\n style={{ height: containerHeight, ...style }}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"n-flex n-flex-col n-h-full\">\n {hasHeading && (\n <div\n className={classNames('ndl-code-block-title', {\n 'ndl-disabled': isDisabled,\n })}\n style={{\n maxWidth: `calc(100% - ${(actions?.length ?? 0) * 36 + 20}px)`,\n }}\n data-testid=\"ndl-code-block-title\"\n >\n {heading}\n </div>\n )}\n <div\n className={classNames('ndl-code-content-container', {\n 'ndl-disabled': isDisabled,\n })}\n style={{\n height: hasHeading ? 'calc(100% - 24px - 12px)' : '100%',\n }}\n >\n <div\n ref={syntaxHighlighterWrapperRef}\n className=\"ndl-highlight-wrapper\"\n tabIndex={0}\n role=\"region\"\n aria-label={`Code content ${isDisabled ? '(disabled)' : ''}`}\n >\n <SyntaxHighlighter\n language={codeLanguage}\n style={{\n ...codeTheme,\n 'pre[class*=\"language-\"]': {\n border: 0,\n color: 'var(--theme-color-neutral-text-default)',\n lineHeight: '1',\n padding: `0 ${rightPadding}px 0.75em 0.75em`,\n width: 'fit-content',\n },\n }}\n codeTagProps={{ className: 'n-code' }}\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 showLineNumbers={shouldShowLineNumbers}\n >\n {code}\n </SyntaxHighlighter>\n </div>\n </div>\n </div>\n <div\n className={classNames('ndl-code-block-actions', {\n 'ndl-disabled': isDisabled,\n })}\n >\n {actions?.map((iconButtonProps, i) => (\n <CleanIconButton\n key={i}\n isDisabled={isDisabled}\n {...iconButtonProps}\n description={`${iconButtonProps.description ?? 'CodeBlock Action'}`}\n htmlAttributes={{\n 'data-testid': `ndl-action-button-${i}`,\n ...iconButtonProps.htmlAttributes,\n }}\n />\n ))}\n </div>\n {shouldShowExpandButton && (\n <div className=\"ndl-code-block-expand-button\">\n <CleanIconButton\n description={isExpanded ? 'Collapse' : 'Expand'}\n tooltipProps={{\n root: {\n shouldCloseOnReferenceClick: true,\n },\n }}\n onClick={toggleExpand}\n >\n {isExpanded ? <ChevronUpIconOutline /> : <ChevronDownIconOutline />}\n </CleanIconButton>\n </div>\n )}\n </Component>\n );\n};\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,CAAC,CAAC,KAAC,sBAAsB,KAAG,GACnD,GACd,CACP,KACS,CACb,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 classNames from 'classnames';\nimport type React from 'react';\nimport { PrismLight as SyntaxHighlighter } from 'react-syntax-highlighter';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { type IconButton } from '../icon-button';\nimport { ChevronDownIconOutline } from '../icons/generated/heroIcons/ChevronDownIconOutline';\nimport { ChevronUpIconOutline } from '../icons/generated/heroIcons/ChevronUpIconOutline';\nimport { type LanguageProp } from './code-languages';\nimport { type CodeTheme } from './code-themes';\nimport { useCodeLanguage } from './hooks/use-code-language';\nimport { useCodeTheme } from './hooks/use-code-theme';\nimport { useExpandable } from './hooks/use-expandable';\n\ninterface CodeBlockProps {\n code: string;\n isDisabled?: boolean;\n maxHeight?: number;\n language: LanguageProp | 'text';\n shouldShowLineNumbers?: boolean;\n theme?: CodeTheme;\n heading?: React.ReactNode;\n actions?: React.ComponentProps<typeof IconButton<'button'>>[];\n}\n\nconst defaultElement = 'div';\n\nexport const CodeBlock = <T extends React.ElementType = 'button'>({\n as,\n maxHeight,\n code,\n language,\n shouldShowLineNumbers,\n theme,\n heading,\n actions,\n isDisabled,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n // TODO: Should not be polymorphic (at least not defaulting to a button)\n}: PolymorphicCommonProps<T, CodeBlockProps>) => {\n const Component: React.ElementType = as ?? defaultElement;\n\n const {\n containerHeight,\n isExpanded,\n toggleExpand,\n hasOverflowingContent,\n ref: syntaxHighlighterWrapperRef,\n } = useExpandable(maxHeight, code);\n const codeTheme = useCodeTheme(theme);\n const codeLanguage = useCodeLanguage(language);\n\n const hasMaxHeight = maxHeight !== undefined;\n const hasHeading = Boolean(heading);\n const numberOfActions = actions?.length ?? 0;\n\n const shouldShowExpandButton = hasMaxHeight && hasOverflowingContent;\n const rightPadding = hasHeading\n ? 0\n : Math.max(numberOfActions * 36, (shouldShowExpandButton ? 1 : 0) * 36) + 8;\n\n return (\n <Component\n ref={ref}\n className={classNames('ndl-code-block-container', className)}\n style={{ height: containerHeight, ...style }}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"n-flex n-flex-col n-h-full\">\n {hasHeading && (\n <div\n className={classNames('ndl-code-block-title', {\n 'ndl-disabled': isDisabled,\n })}\n style={{\n maxWidth: `calc(100% - ${(actions?.length ?? 0) * 36 + 20}px)`,\n }}\n data-testid=\"ndl-code-block-title\"\n >\n {heading}\n </div>\n )}\n <div\n className={classNames('ndl-code-content-container', {\n 'ndl-disabled': isDisabled,\n })}\n style={{\n height: hasHeading ? 'calc(100% - 24px - 12px)' : '100%',\n }}\n >\n <div\n ref={syntaxHighlighterWrapperRef}\n className=\"ndl-highlight-wrapper\"\n tabIndex={0}\n role=\"region\"\n aria-label={`Code content ${isDisabled ? '(disabled)' : ''}`}\n >\n <SyntaxHighlighter\n language={codeLanguage}\n style={{\n ...codeTheme,\n 'pre[class*=\"language-\"]': {\n border: 0,\n color: 'var(--theme-color-neutral-text-default)',\n lineHeight: '1',\n padding: `0 ${rightPadding}px 0.75em 0.75em`,\n width: 'fit-content',\n },\n }}\n codeTagProps={{ className: 'n-code' }}\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 showLineNumbers={shouldShowLineNumbers}\n >\n {code}\n </SyntaxHighlighter>\n </div>\n </div>\n </div>\n <div\n className={classNames('ndl-code-block-actions', {\n 'ndl-disabled': isDisabled,\n })}\n >\n {actions?.map((iconButtonProps, index) => (\n <CleanIconButton\n key={index}\n isDisabled={isDisabled}\n {...iconButtonProps}\n description={`${iconButtonProps.description ?? 'CodeBlock Action'}`}\n htmlAttributes={{\n 'data-testid': `ndl-action-button-${index}`,\n ...iconButtonProps.htmlAttributes,\n }}\n />\n ))}\n </div>\n {shouldShowExpandButton && (\n <div className=\"ndl-code-block-expand-button\">\n <CleanIconButton\n description={isExpanded ? 'Collapse' : 'Expand'}\n tooltipProps={{\n root: {\n shouldCloseOnReferenceClick: true,\n },\n }}\n onClick={toggleExpand}\n >\n {isExpanded ? <ChevronUpIconOutline /> : <ChevronDownIconOutline />}\n </CleanIconButton>\n </div>\n )}\n </Component>\n );\n};\n"]}
@@ -48,7 +48,7 @@ export const ColorPicker = forwardRef(function ColorPicker({ color, onChange, sw
48
48
  if (typeof color === 'object' && 'r' in color) {
49
49
  return rgbaToHsva(color);
50
50
  }
51
- return Object.assign(Object.assign({ h: 0, s: 0, v: 0 }, color), { a: 1 });
51
+ return Object.assign(Object.assign({ h: 0, s: 0, v: 0 }, color), { a: 1 }); // oxlint-disable-line id-length
52
52
  }, [color]);
53
53
  const [hsva, setHsva] = useState(derivedHsva);
54
54
  const [format, setFormat] = useState({
@@ -68,7 +68,7 @@ export const ColorPicker = forwardRef(function ColorPicker({ color, onChange, sw
68
68
  });
69
69
  };
70
70
  return (_jsxs("div", { ref: ref, className: classNames('ndl-color-picker', className), style: style, children: [_jsx(Saturation, { hsva: hsva, className: "ndl-color-picker-saturation", onChange: (newColor) => {
71
- handleChange(Object.assign(Object.assign(Object.assign({}, hsva), newColor), { a: hsva.a }));
71
+ handleChange(Object.assign(Object.assign(Object.assign({}, hsva), newColor), { a: hsva.a })); // oxlint-disable-line id-length
72
72
  }, pointer: (_a) => {
73
73
  var { left, top } = _a, props = __rest(_a, ["left", "top"]);
74
74
  return (_jsx(Pointer, Object.assign({ left: left === null || left === void 0 ? void 0 : left.toString(), top: top === null || top === void 0 ? void 0 : top.toString() }, props, { hsva: hsva })));
@@ -92,12 +92,12 @@ export const ColorPicker = forwardRef(function ColorPicker({ color, onChange, sw
92
92
  setIsEyeDropperActiveState(false);
93
93
  });
94
94
  }, description: "Pick color from the screen with eye dropper tool", children: _jsx(EyeDropperIconOutline, {}) })), _jsx(Hue, { className: "ndl-color-picker-hue", hue: hsva.h, onChange: (newHue) => {
95
- handleChange(Object.assign(Object.assign({}, hsva), { h: newHue.h }));
95
+ handleChange(Object.assign(Object.assign({}, hsva), { h: newHue.h })); // oxlint-disable-line id-length
96
96
  }, radius: tokens.borderRadius['lg'], pointer: (props) => (_jsx(Pointer, Object.assign({}, props, { hsva: {
97
- a: 1,
98
- h: hsva.h,
99
- s: 100,
100
- v: 100,
97
+ a: 1, // oxlint-disable-line id-length
98
+ h: hsva.h, // oxlint-disable-line id-length
99
+ s: 100, // oxlint-disable-line id-length
100
+ v: 100, // oxlint-disable-line id-length
101
101
  } }))) })] }), _jsxs("div", { className: "ndl-color-picker-inputs", children: [_jsx(Select, { size: "small", type: "select", ariaLabel: "Color format", style: {
102
102
  flexShrink: 0,
103
103
  }, selectProps: {
@@ -137,8 +137,8 @@ const HexInput = ({ hsva, onChange, }) => {
137
137
  useEffect(() => {
138
138
  setInputValue(removeHashPrefix(hsvaToHex(hsva)));
139
139
  }, [hsva]);
140
- const handleChange = (e) => {
141
- const value = removeHashPrefix(e.target.value);
140
+ const handleChange = (event) => {
141
+ const value = removeHashPrefix(event.target.value);
142
142
  // Always update the input value for immediate feedback
143
143
  setInputValue(value);
144
144
  // Check if the input is a valid hex color (only 6 characters)
@@ -151,8 +151,8 @@ const HexInput = ({ hsva, onChange, }) => {
151
151
  return (_jsx(TextInput, { size: "small", value: inputValue, leadingElement: _jsx("div", { className: "ndl-color-picker-hex-input-prefix", children: "#" }), onChange: handleChange, isFluid: true, htmlAttributes: {
152
152
  'aria-label': 'Hex color code',
153
153
  maxLength: 6,
154
- onCopy: (e) => {
155
- e.preventDefault();
154
+ onCopy: (event) => {
155
+ event.preventDefault();
156
156
  navigator.clipboard.writeText(hexValue);
157
157
  },
158
158
  } }));
@@ -160,21 +160,21 @@ const HexInput = ({ hsva, onChange, }) => {
160
160
  const RgbInput = ({ hsva, onChange, }) => {
161
161
  const rgba = hsvaToRgba(hsva);
162
162
  const [rgbValues, setRgbValues] = useState({
163
- b: rgba.b,
164
- g: rgba.g,
165
- r: rgba.r,
163
+ b: rgba.b, // oxlint-disable-line id-length
164
+ g: rgba.g, // oxlint-disable-line id-length
165
+ r: rgba.r, // oxlint-disable-line id-length
166
166
  });
167
167
  // Update input values when hsva changes from outside
168
168
  useEffect(() => {
169
169
  const newRgba = hsvaToRgba(hsva);
170
170
  setRgbValues({
171
- b: newRgba.b,
172
- g: newRgba.g,
173
- r: newRgba.r,
171
+ b: newRgba.b, // oxlint-disable-line id-length
172
+ g: newRgba.g, // oxlint-disable-line id-length
173
+ r: newRgba.r, // oxlint-disable-line id-length
174
174
  });
175
175
  }, [hsva]);
176
- const handleChange = (channel, e) => {
177
- const value = parseInt(e.target.value, 10);
176
+ const handleChange = (channel, event) => {
177
+ const value = parseInt(event.target.value, 10);
178
178
  // Validate the input is a number between 0-255
179
179
  const validValue = isNaN(value) ? 0 : Math.max(0, Math.min(255, value));
180
180
  const newRgbValues = Object.assign(Object.assign({}, rgbValues), { [channel]: validValue });
@@ -183,17 +183,17 @@ const RgbInput = ({ hsva, onChange, }) => {
183
183
  const hexColor = `#${newRgbValues.r.toString(16).padStart(2, '0')}${newRgbValues.g.toString(16).padStart(2, '0')}${newRgbValues.b.toString(16).padStart(2, '0')}`;
184
184
  onChange(hexColor);
185
185
  };
186
- return (_jsxs("div", { className: "ndl-color-picker-rgb-inputs", children: [_jsx(TextInput, { size: "small", className: "ndl-color-picker-rgb-input", value: rgbValues.r.toString(), onChange: (e) => handleChange('r', e), htmlAttributes: {
186
+ return (_jsxs("div", { className: "ndl-color-picker-rgb-inputs", children: [_jsx(TextInput, { size: "small", className: "ndl-color-picker-rgb-input", value: rgbValues.r.toString(), onChange: (event) => handleChange('r', event), htmlAttributes: {
187
187
  'aria-label': 'Red',
188
188
  max: '255',
189
189
  min: '0',
190
190
  type: 'number',
191
- } }), _jsx(TextInput, { size: "small", className: "ndl-color-picker-rgb-input", value: rgbValues.g.toString(), onChange: (e) => handleChange('g', e), htmlAttributes: {
191
+ } }), _jsx(TextInput, { size: "small", className: "ndl-color-picker-rgb-input", value: rgbValues.g.toString(), onChange: (event) => handleChange('g', event), htmlAttributes: {
192
192
  'aria-label': 'Green',
193
193
  max: '255',
194
194
  min: '0',
195
195
  type: 'number',
196
- } }), _jsx(TextInput, { size: "small", className: "ndl-color-picker-rgb-input", value: rgbValues.b.toString(), onChange: (e) => handleChange('b', e), htmlAttributes: {
196
+ } }), _jsx(TextInput, { size: "small", className: "ndl-color-picker-rgb-input", value: rgbValues.b.toString(), onChange: (event) => handleChange('b', event), htmlAttributes: {
197
197
  'aria-label': 'Blue',
198
198
  max: '255',
199
199
  min: '0',
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker.js","sourceRoot":"","sources":["../../../src/color-picker/ColorPicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,qBAAqB,CAAC;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAEL,SAAS,EAET,SAAS,EACT,UAAU,EACV,GAAG,EAGH,SAAS,EACT,UAAU,EACV,UAAU,EACV,QAAQ,GACT,MAAM,kBAAkB,CAAC;AAC1B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjE,OAA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D,CAAC,EACF,KAAK,EAAE,EAAE,eAAe,EAAE,SAAS,CAAC,SAAS,CAAC,EAAE,EAChD,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,IAN7B,QAAQ,CAOb,CACH,CAAC;QACJ,CAAC,CAAC,GACE,CACP,CAAC;AACJ,CAAC,CAAC;AACF,MAAM,OAAO,GAAG,CAAC,EACf,SAAS,EACT,IAAI,EACJ,GAAG,EACH,IAAI,GAC+B,EAAE,EAAE;IACvC,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9B,OAAO,CACL,cACE,KAAK,EAAE;YACL,eAAe,EAAE,QAAQ,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG;YACnE,IAAI;YACJ,GAAG;SACJ,EACD,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,0BAA0B,CAAC,GAC5D,CACH,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 'eyedropper-polyfill';\n\nimport { tokens } from '@neo4j-ndl/base';\nimport {\n type HexColor,\n hexToHsva,\n type HsvaColor,\n hsvaToHex,\n hsvaToRgba,\n Hue,\n type PointerProps,\n type RgbaColor,\n rgbaToHex,\n rgbaToHsva,\n Saturation,\n validHex,\n} from '@uiw/react-color';\nimport classNames from 'classnames';\nimport { forwardRef, useEffect, useMemo, useState } from 'react';\n\nimport { CleanIconButton } from '../clean-icon-button';\nimport { EyeDropperIconOutline } from '../icons/generated/heroIcons/EyeDropperIconOutline';\nimport { Select } from '../select';\nimport { TextInput } from '../text-input';\n\n/**\n * @remarks\n * By default the `swatches` prop is set to the available graph colors (`tokens.graph`) from `@neo4j-ndl/base`.\n *\n * @remarks\n * Where `HsvaColor`, `RgbaColor`, and `HexColor` types are from `@uiw/react-color`, and represent different color formats:\n *\n * - `HexColor`: A string in the format `#RRGGBB` (e.g., `#ff0000`).\n * - `RgbaColor`: An object with numeric properties `{ r, g, b, a }` for red, green, blue (0–255), and alpha (0–1).\n * - `HsvaColor`: An object with numeric properties `{ h, s, v, a }` for hue (0–360), saturation (0–100), value (0–100), and alpha (0–1).\n *\n * Visit [react-color](https://uiwjs.github.io/react-color/#/) for more information.\n */\ntype ColorPickerProps = {\n /** The current color value. Can be provided in HSVA, RGBA, or Hex format. The component will automatically convert between formats as needed. */\n color: HsvaColor | RgbaColor | HexColor;\n /** Optional array of predefined color swatches for quick selection. Each swatch can be in HSVA, RGBA, or Hex format. */\n swatches?: (HsvaColor | RgbaColor | HexColor)[];\n /** Whether to display the eye dropper tool that allows users to sample colors from anywhere on the screen. */\n shouldShowEyeDropper?: boolean;\n /** Callback function triggered when the color value changes. Receives an object containing the new color in all three formats (hex, rgb, hsva) for convenience. */\n onChange: (newColor: {\n hex: HexColor;\n rgb: RgbaColor;\n hsva: HsvaColor;\n }) => void;\n /** Additional class name to apply to the root color picker container. */\n className?: string;\n /** Additional inline styles to apply to the root color picker container. */\n style?: React.CSSProperties;\n\n /** The target element to portal the menu to. If not provided, the menu will not be portaled. */\n portalTarget?: HTMLElement | null;\n /** The floating strategy to use for the menu. If not provided, the menu will be positioned absolutely. */\n floatingStrategy?: 'absolute' | 'fixed';\n};\n\nexport const ColorPicker = forwardRef<HTMLDivElement, ColorPickerProps>(\n function ColorPicker(\n {\n color,\n onChange,\n swatches = Object.values(tokens.graph).filter(validHex),\n shouldShowEyeDropper = true,\n className,\n style,\n portalTarget,\n floatingStrategy = 'absolute',\n },\n ref,\n ) {\n const [isEyeDropperActiveState, setIsEyeDropperActiveState] =\n useState(false);\n\n const derivedHsva = useMemo(() => {\n if (typeof color === 'string') {\n return hexToHsva(color);\n }\n if (typeof color === 'object' && 'r' in color) {\n return rgbaToHsva(color);\n }\n return { h: 0, s: 0, v: 0, ...(color as object), a: 1 } as HsvaColor;\n }, [color]);\n\n const [hsva, setHsva] = useState<HsvaColor>(derivedHsva);\n\n const [format, setFormat] = useState<{\n label: string;\n value: string;\n }>({\n label: 'Hex',\n value: 'hex',\n });\n\n const isEyeDropperActive = 'EyeDropper' in window && shouldShowEyeDropper;\n\n const handleChange = (hsva: HsvaColor) => {\n setHsva(hsva);\n const hex = hsvaToHex(hsva);\n const rgb = hsvaToRgba(hsva);\n onChange({\n // used since typescript cannot infer the type of the color\n hex: `#${hex.split('#')[1]}`,\n hsva,\n rgb,\n });\n };\n\n return (\n <div\n ref={ref}\n className={classNames('ndl-color-picker', className)}\n style={style}\n >\n <Saturation\n hsva={hsva}\n className=\"ndl-color-picker-saturation\"\n onChange={(newColor) => {\n handleChange({ ...hsva, ...newColor, a: hsva.a });\n }}\n pointer={({ left, top, ...props }) => (\n <Pointer\n left={left?.toString()}\n top={top?.toString()}\n {...props}\n hsva={hsva}\n />\n )}\n radius={tokens.borderRadius['lg']}\n />\n <Swatch\n colors={swatches}\n hsva={hsva}\n onChange={(newColor) => {\n handleChange(newColor);\n }}\n />\n\n <div className=\"ndl-color-picker-hue-container\">\n {isEyeDropperActive && (\n <CleanIconButton\n size=\"small\"\n isActive={isEyeDropperActiveState}\n onClick={() => {\n setIsEyeDropperActiveState(true);\n // TODO: Remove the any casting when polyfiller is not needed anymore. https://developer.mozilla.org/en-US/docs/Web/API/EyeDropper\n // Type assertion to handle the unknown type\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n const eyeDropper = new (window as any).EyeDropper();\n eyeDropper\n .open()\n .then((result: { sRGBHex: string }) => {\n handleChange(hexToHsva(result.sRGBHex));\n })\n .catch((err: Error) => {\n console.error(err);\n })\n .finally(() => {\n setIsEyeDropperActiveState(false);\n });\n }}\n description=\"Pick color from the screen with eye dropper tool\"\n >\n <EyeDropperIconOutline />\n </CleanIconButton>\n )}\n <Hue\n className=\"ndl-color-picker-hue\"\n hue={hsva.h}\n onChange={(newHue) => {\n handleChange({ ...hsva, h: newHue.h });\n }}\n radius={tokens.borderRadius['lg']}\n pointer={(props) => (\n <Pointer\n {...props}\n hsva={{\n a: 1,\n h: hsva.h,\n s: 100,\n v: 100,\n }}\n />\n )}\n />\n </div>\n\n <div className=\"ndl-color-picker-inputs\">\n <Select\n size=\"small\"\n type=\"select\"\n ariaLabel=\"Color format\"\n style={{\n flexShrink: 0,\n }}\n selectProps={{\n isSearchable: false,\n menuPortalTarget: portalTarget,\n menuPosition: floatingStrategy,\n onChange: (newFormat) => {\n if (!newFormat) {\n return;\n }\n setFormat({\n label: newFormat.label,\n value: newFormat.value,\n });\n },\n options: [\n {\n label: 'Hex',\n value: 'hex',\n },\n {\n label: 'RGB',\n value: 'rgb',\n },\n ],\n value: { label: format.label, value: format.value },\n }}\n />\n {format.value === 'hex' && (\n <HexInput\n hsva={hsva}\n onChange={(newColor) => {\n handleChange(hexToHsva(newColor));\n }}\n />\n )}\n {format.value === 'rgb' && (\n <RgbInput\n hsva={hsva}\n onChange={(newColor) => {\n handleChange(hexToHsva(newColor));\n }}\n />\n )}\n </div>\n </div>\n );\n },\n);\n\nconst removeHashPrefix = (hex: string): string => hex.replace('#', '');\n\nconst HexInput = ({\n hsva,\n onChange,\n}: {\n hsva: HsvaColor;\n onChange: (newColor: string) => void;\n}) => {\n const [inputValue, setInputValue] = useState<string>(() =>\n removeHashPrefix(hsvaToHex(hsva)),\n );\n\n // Update input value when hsva changes from outside\n useEffect(() => {\n setInputValue(removeHashPrefix(hsvaToHex(hsva)));\n }, [hsva]);\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const value = removeHashPrefix(e.target.value);\n\n // Always update the input value for immediate feedback\n setInputValue(value);\n\n // Check if the input is a valid hex color (only 6 characters)\n const isValidHex = /^[0-9A-Fa-f]{6}$/.test(value);\n\n if (isValidHex) {\n onChange(`#${value}`);\n }\n };\n\n const hexValue = hsvaToHex(hsva);\n\n return (\n <TextInput\n size=\"small\"\n value={inputValue}\n leadingElement={\n <div className=\"ndl-color-picker-hex-input-prefix\">#</div>\n }\n onChange={handleChange}\n isFluid\n htmlAttributes={{\n 'aria-label': 'Hex color code',\n maxLength: 6,\n onCopy: (e) => {\n e.preventDefault();\n navigator.clipboard.writeText(hexValue);\n },\n }}\n />\n );\n};\n\nconst RgbInput = ({\n hsva,\n onChange,\n}: {\n hsva: HsvaColor;\n onChange: (newColor: string) => void;\n}) => {\n const rgba = hsvaToRgba(hsva);\n const [rgbValues, setRgbValues] = useState({\n b: rgba.b,\n g: rgba.g,\n r: rgba.r,\n });\n\n // Update input values when hsva changes from outside\n useEffect(() => {\n const newRgba = hsvaToRgba(hsva);\n setRgbValues({\n b: newRgba.b,\n g: newRgba.g,\n r: newRgba.r,\n });\n }, [hsva]);\n\n const handleChange = (\n channel: 'r' | 'g' | 'b',\n e: React.ChangeEvent<HTMLInputElement>,\n ) => {\n const value = parseInt(e.target.value, 10);\n\n // Validate the input is a number between 0-255\n const validValue = isNaN(value) ? 0 : Math.max(0, Math.min(255, value));\n\n const newRgbValues = {\n ...rgbValues,\n [channel]: validValue,\n };\n\n setRgbValues(newRgbValues);\n\n // Convert RGB to hex and call onChange\n const hexColor = `#${newRgbValues.r.toString(16).padStart(2, '0')}${newRgbValues.g.toString(16).padStart(2, '0')}${newRgbValues.b.toString(16).padStart(2, '0')}`;\n onChange(hexColor);\n };\n\n return (\n <div className=\"ndl-color-picker-rgb-inputs\">\n <TextInput\n size=\"small\"\n className=\"ndl-color-picker-rgb-input\"\n value={rgbValues.r.toString()}\n onChange={(e) => handleChange('r', e)}\n htmlAttributes={{\n 'aria-label': 'Red',\n max: '255',\n min: '0',\n type: 'number',\n }}\n />\n <TextInput\n size=\"small\"\n className=\"ndl-color-picker-rgb-input\"\n value={rgbValues.g.toString()}\n onChange={(e) => handleChange('g', e)}\n htmlAttributes={{\n 'aria-label': 'Green',\n max: '255',\n min: '0',\n type: 'number',\n }}\n />\n <TextInput\n size=\"small\"\n className=\"ndl-color-picker-rgb-input\"\n value={rgbValues.b.toString()}\n onChange={(e) => handleChange('b', e)}\n htmlAttributes={{\n 'aria-label': 'Blue',\n max: '255',\n min: '0',\n type: 'number',\n }}\n />\n </div>\n );\n};\n\nconst Swatch = ({\n colors,\n onChange,\n hsva,\n}: {\n colors: (HsvaColor | RgbaColor | HexColor)[];\n hsva: HsvaColor;\n onChange: (newColor: HsvaColor) => void;\n}) => {\n return (\n <div className=\"ndl-color-picker-swatch\">\n {colors.map((color) => {\n const hexColor =\n typeof color === 'string'\n ? color\n : typeof color === 'object' && 'r' in color\n ? rgbaToHex(color)\n : hsvaToHex(color);\n const hsvaColor =\n typeof color === 'string'\n ? hexToHsva(color)\n : 'r' in color\n ? rgbaToHsva(color)\n : color;\n\n const isActive =\n hsva.h === hsvaColor.h &&\n hsva.s === hsvaColor.s &&\n hsva.v === hsvaColor.v;\n\n return (\n <button\n type=\"button\"\n key={hexColor}\n aria-label={hexColor}\n className={classNames('ndl-color-picker-swatch-color', {\n 'ndl-color-picker-swatch-color-active': isActive,\n })}\n style={{ backgroundColor: hsvaToHex(hsvaColor) }}\n onClick={() => onChange(hsvaColor)}\n />\n );\n })}\n </div>\n );\n};\nconst Pointer = ({\n prefixCls,\n left,\n top,\n hsva,\n}: PointerProps & { hsva: HsvaColor }) => {\n const rgba = hsvaToRgba(hsva);\n return (\n <div\n style={{\n backgroundColor: `rgba(${rgba.r}, ${rgba.g}, ${rgba.b}, ${rgba.a})`,\n left,\n top,\n }}\n className={classNames(prefixCls, 'ndl-color-picker-pointer')}\n />\n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G;SACJ,EACD,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,0BAA0B,CAAC,GAC5D,CACH,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 'eyedropper-polyfill';\n\nimport { tokens } from '@neo4j-ndl/base';\nimport {\n type HexColor,\n hexToHsva,\n type HsvaColor,\n hsvaToHex,\n hsvaToRgba,\n Hue,\n type PointerProps,\n type RgbaColor,\n rgbaToHex,\n rgbaToHsva,\n Saturation,\n validHex,\n} from '@uiw/react-color';\nimport classNames from 'classnames';\nimport { forwardRef, useEffect, useMemo, useState } from 'react';\n\nimport { CleanIconButton } from '../clean-icon-button';\nimport { EyeDropperIconOutline } from '../icons/generated/heroIcons/EyeDropperIconOutline';\nimport { Select } from '../select';\nimport { TextInput } from '../text-input';\n\n/**\n * @remarks\n * By default the `swatches` prop is set to the available graph colors (`tokens.graph`) from `@neo4j-ndl/base`.\n *\n * @remarks\n * Where `HsvaColor`, `RgbaColor`, and `HexColor` types are from `@uiw/react-color`, and represent different color formats:\n *\n * - `HexColor`: A string in the format `#RRGGBB` (e.g., `#ff0000`).\n * - `RgbaColor`: An object with numeric properties `{ r, g, b, a }` for red, green, blue (0–255), and alpha (0–1).\n * - `HsvaColor`: An object with numeric properties `{ h, s, v, a }` for hue (0–360), saturation (0–100), value (0–100), and alpha (0–1).\n *\n * Visit [react-color](https://uiwjs.github.io/react-color/#/) for more information.\n */\ntype ColorPickerProps = {\n /** The current color value. Can be provided in HSVA, RGBA, or Hex format. The component will automatically convert between formats as needed. */\n color: HsvaColor | RgbaColor | HexColor;\n /** Optional array of predefined color swatches for quick selection. Each swatch can be in HSVA, RGBA, or Hex format. */\n swatches?: (HsvaColor | RgbaColor | HexColor)[];\n /** Whether to display the eye dropper tool that allows users to sample colors from anywhere on the screen. */\n shouldShowEyeDropper?: boolean;\n /** Callback function triggered when the color value changes. Receives an object containing the new color in all three formats (hex, rgb, hsva) for convenience. */\n onChange: (newColor: {\n hex: HexColor;\n rgb: RgbaColor;\n hsva: HsvaColor;\n }) => void;\n /** Additional class name to apply to the root color picker container. */\n className?: string;\n /** Additional inline styles to apply to the root color picker container. */\n style?: React.CSSProperties;\n\n /** The target element to portal the menu to. If not provided, the menu will not be portaled. */\n portalTarget?: HTMLElement | null;\n /** The floating strategy to use for the menu. If not provided, the menu will be positioned absolutely. */\n floatingStrategy?: 'absolute' | 'fixed';\n};\n\nexport const ColorPicker = forwardRef<HTMLDivElement, ColorPickerProps>(\n function ColorPicker(\n {\n color,\n onChange,\n swatches = Object.values(tokens.graph).filter(validHex),\n shouldShowEyeDropper = true,\n className,\n style,\n portalTarget,\n floatingStrategy = 'absolute',\n },\n ref,\n ) {\n const [isEyeDropperActiveState, setIsEyeDropperActiveState] =\n useState(false);\n\n const derivedHsva = useMemo(() => {\n if (typeof color === 'string') {\n return hexToHsva(color);\n }\n if (typeof color === 'object' && 'r' in color) {\n return rgbaToHsva(color);\n }\n return { h: 0, s: 0, v: 0, ...(color as object), a: 1 } as HsvaColor; // oxlint-disable-line id-length\n }, [color]);\n\n const [hsva, setHsva] = useState<HsvaColor>(derivedHsva);\n\n const [format, setFormat] = useState<{\n label: string;\n value: string;\n }>({\n label: 'Hex',\n value: 'hex',\n });\n\n const isEyeDropperActive = 'EyeDropper' in window && shouldShowEyeDropper;\n\n const handleChange = (hsva: HsvaColor) => {\n setHsva(hsva);\n const hex = hsvaToHex(hsva);\n const rgb = hsvaToRgba(hsva);\n onChange({\n // used since typescript cannot infer the type of the color\n hex: `#${hex.split('#')[1]}`,\n hsva,\n rgb,\n });\n };\n\n return (\n <div\n ref={ref}\n className={classNames('ndl-color-picker', className)}\n style={style}\n >\n <Saturation\n hsva={hsva}\n className=\"ndl-color-picker-saturation\"\n onChange={(newColor) => {\n handleChange({ ...hsva, ...newColor, a: hsva.a }); // oxlint-disable-line id-length\n }}\n pointer={({ left, top, ...props }) => (\n <Pointer\n left={left?.toString()}\n top={top?.toString()}\n {...props}\n hsva={hsva}\n />\n )}\n radius={tokens.borderRadius['lg']}\n />\n <Swatch\n colors={swatches}\n hsva={hsva}\n onChange={(newColor) => {\n handleChange(newColor);\n }}\n />\n\n <div className=\"ndl-color-picker-hue-container\">\n {isEyeDropperActive && (\n <CleanIconButton\n size=\"small\"\n isActive={isEyeDropperActiveState}\n onClick={() => {\n setIsEyeDropperActiveState(true);\n // TODO: Remove the any casting when polyfiller is not needed anymore. https://developer.mozilla.org/en-US/docs/Web/API/EyeDropper\n // Type assertion to handle the unknown type\n // oxlint-disable-next-line @typescript-eslint/no-explicit-any\n const eyeDropper = new (window as any).EyeDropper();\n eyeDropper\n .open()\n .then((result: { sRGBHex: string }) => {\n handleChange(hexToHsva(result.sRGBHex));\n })\n .catch((err: Error) => {\n console.error(err);\n })\n .finally(() => {\n setIsEyeDropperActiveState(false);\n });\n }}\n description=\"Pick color from the screen with eye dropper tool\"\n >\n <EyeDropperIconOutline />\n </CleanIconButton>\n )}\n <Hue\n className=\"ndl-color-picker-hue\"\n hue={hsva.h}\n onChange={(newHue) => {\n handleChange({ ...hsva, h: newHue.h }); // oxlint-disable-line id-length\n }}\n radius={tokens.borderRadius['lg']}\n pointer={(props) => (\n <Pointer\n {...props}\n hsva={{\n a: 1, // oxlint-disable-line id-length\n h: hsva.h, // oxlint-disable-line id-length\n s: 100, // oxlint-disable-line id-length\n v: 100, // oxlint-disable-line id-length\n }}\n />\n )}\n />\n </div>\n\n <div className=\"ndl-color-picker-inputs\">\n <Select\n size=\"small\"\n type=\"select\"\n ariaLabel=\"Color format\"\n style={{\n flexShrink: 0,\n }}\n selectProps={{\n isSearchable: false,\n menuPortalTarget: portalTarget,\n menuPosition: floatingStrategy,\n onChange: (newFormat) => {\n if (!newFormat) {\n return;\n }\n setFormat({\n label: newFormat.label,\n value: newFormat.value,\n });\n },\n options: [\n {\n label: 'Hex',\n value: 'hex',\n },\n {\n label: 'RGB',\n value: 'rgb',\n },\n ],\n value: { label: format.label, value: format.value },\n }}\n />\n {format.value === 'hex' && (\n <HexInput\n hsva={hsva}\n onChange={(newColor) => {\n handleChange(hexToHsva(newColor));\n }}\n />\n )}\n {format.value === 'rgb' && (\n <RgbInput\n hsva={hsva}\n onChange={(newColor) => {\n handleChange(hexToHsva(newColor));\n }}\n />\n )}\n </div>\n </div>\n );\n },\n);\n\nconst removeHashPrefix = (hex: string): string => hex.replace('#', '');\n\nconst HexInput = ({\n hsva,\n onChange,\n}: {\n hsva: HsvaColor;\n onChange: (newColor: string) => void;\n}) => {\n const [inputValue, setInputValue] = useState<string>(() =>\n removeHashPrefix(hsvaToHex(hsva)),\n );\n\n // Update input value when hsva changes from outside\n useEffect(() => {\n setInputValue(removeHashPrefix(hsvaToHex(hsva)));\n }, [hsva]);\n\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const value = removeHashPrefix(event.target.value);\n\n // Always update the input value for immediate feedback\n setInputValue(value);\n\n // Check if the input is a valid hex color (only 6 characters)\n const isValidHex = /^[0-9A-Fa-f]{6}$/.test(value);\n\n if (isValidHex) {\n onChange(`#${value}`);\n }\n };\n\n const hexValue = hsvaToHex(hsva);\n\n return (\n <TextInput\n size=\"small\"\n value={inputValue}\n leadingElement={\n <div className=\"ndl-color-picker-hex-input-prefix\">#</div>\n }\n onChange={handleChange}\n isFluid\n htmlAttributes={{\n 'aria-label': 'Hex color code',\n maxLength: 6,\n onCopy: (event) => {\n event.preventDefault();\n navigator.clipboard.writeText(hexValue);\n },\n }}\n />\n );\n};\n\nconst RgbInput = ({\n hsva,\n onChange,\n}: {\n hsva: HsvaColor;\n onChange: (newColor: string) => void;\n}) => {\n const rgba = hsvaToRgba(hsva);\n const [rgbValues, setRgbValues] = useState({\n b: rgba.b, // oxlint-disable-line id-length\n g: rgba.g, // oxlint-disable-line id-length\n r: rgba.r, // oxlint-disable-line id-length\n });\n\n // Update input values when hsva changes from outside\n useEffect(() => {\n const newRgba = hsvaToRgba(hsva);\n setRgbValues({\n b: newRgba.b, // oxlint-disable-line id-length\n g: newRgba.g, // oxlint-disable-line id-length\n r: newRgba.r, // oxlint-disable-line id-length\n });\n }, [hsva]);\n\n const handleChange = (\n channel: 'r' | 'g' | 'b',\n event: React.ChangeEvent<HTMLInputElement>,\n ) => {\n const value = parseInt(event.target.value, 10);\n\n // Validate the input is a number between 0-255\n const validValue = isNaN(value) ? 0 : Math.max(0, Math.min(255, value));\n\n const newRgbValues = {\n ...rgbValues,\n [channel]: validValue,\n };\n\n setRgbValues(newRgbValues);\n\n // Convert RGB to hex and call onChange\n const hexColor = `#${newRgbValues.r.toString(16).padStart(2, '0')}${newRgbValues.g.toString(16).padStart(2, '0')}${newRgbValues.b.toString(16).padStart(2, '0')}`;\n onChange(hexColor);\n };\n\n return (\n <div className=\"ndl-color-picker-rgb-inputs\">\n <TextInput\n size=\"small\"\n className=\"ndl-color-picker-rgb-input\"\n value={rgbValues.r.toString()}\n onChange={(event) => handleChange('r', event)}\n htmlAttributes={{\n 'aria-label': 'Red',\n max: '255',\n min: '0',\n type: 'number',\n }}\n />\n <TextInput\n size=\"small\"\n className=\"ndl-color-picker-rgb-input\"\n value={rgbValues.g.toString()}\n onChange={(event) => handleChange('g', event)}\n htmlAttributes={{\n 'aria-label': 'Green',\n max: '255',\n min: '0',\n type: 'number',\n }}\n />\n <TextInput\n size=\"small\"\n className=\"ndl-color-picker-rgb-input\"\n value={rgbValues.b.toString()}\n onChange={(event) => handleChange('b', event)}\n htmlAttributes={{\n 'aria-label': 'Blue',\n max: '255',\n min: '0',\n type: 'number',\n }}\n />\n </div>\n );\n};\n\nconst Swatch = ({\n colors,\n onChange,\n hsva,\n}: {\n colors: (HsvaColor | RgbaColor | HexColor)[];\n hsva: HsvaColor;\n onChange: (newColor: HsvaColor) => void;\n}) => {\n return (\n <div className=\"ndl-color-picker-swatch\">\n {colors.map((color) => {\n const hexColor =\n typeof color === 'string'\n ? color\n : typeof color === 'object' && 'r' in color\n ? rgbaToHex(color)\n : hsvaToHex(color);\n const hsvaColor =\n typeof color === 'string'\n ? hexToHsva(color)\n : 'r' in color\n ? rgbaToHsva(color)\n : color;\n\n const isActive =\n hsva.h === hsvaColor.h &&\n hsva.s === hsvaColor.s &&\n hsva.v === hsvaColor.v;\n\n return (\n <button\n type=\"button\"\n key={hexColor}\n aria-label={hexColor}\n className={classNames('ndl-color-picker-swatch-color', {\n 'ndl-color-picker-swatch-color-active': isActive,\n })}\n style={{ backgroundColor: hsvaToHex(hsvaColor) }}\n onClick={() => onChange(hsvaColor)}\n />\n );\n })}\n </div>\n );\n};\nconst Pointer = ({\n prefixCls,\n left,\n top,\n hsva,\n}: PointerProps & { hsva: HsvaColor }) => {\n const rgba = hsvaToRgba(hsva);\n return (\n <div\n style={{\n backgroundColor: `rgba(${rgba.r}, ${rgba.g}, ${rgba.b}, ${rgba.a})`,\n left,\n top,\n }}\n className={classNames(prefixCls, 'ndl-color-picker-pointer')}\n />\n );\n};\n"]}
@@ -23,35 +23,35 @@ import { useState } from 'react';
23
23
  import { ColorPicker } from '../ColorPicker';
24
24
  const Component = () => {
25
25
  const [color, setColor] = useState({
26
- a: 1,
27
- b: 0,
28
- g: 0,
29
- r: 0,
26
+ a: 1, // oxlint-disable-line id-length
27
+ b: 0, // oxlint-disable-line id-length
28
+ g: 0, // oxlint-disable-line id-length
29
+ r: 0, // oxlint-disable-line id-length
30
30
  });
31
31
  return (_jsx(ColorPicker, { color: color, onChange: (newColor) => setColor(newColor.rgb), swatches: [
32
32
  {
33
- a: 1,
34
- b: 0,
35
- g: 0,
36
- r: 0,
33
+ a: 1, // oxlint-disable-line id-length
34
+ b: 0, // oxlint-disable-line id-length
35
+ g: 0, // oxlint-disable-line id-length
36
+ r: 0, // oxlint-disable-line id-length
37
37
  },
38
38
  {
39
- a: 1,
40
- b: 255,
41
- g: 0,
42
- r: 0,
39
+ a: 1, // oxlint-disable-line id-length
40
+ b: 255, // oxlint-disable-line id-length
41
+ g: 0, // oxlint-disable-line id-length
42
+ r: 0, // oxlint-disable-line id-length
43
43
  },
44
44
  {
45
- a: 1,
46
- b: 0,
47
- g: 255,
48
- r: 0,
45
+ a: 1, // oxlint-disable-line id-length
46
+ b: 0, // oxlint-disable-line id-length
47
+ g: 255, // oxlint-disable-line id-length
48
+ r: 0, // oxlint-disable-line id-length
49
49
  },
50
50
  {
51
- a: 1,
52
- b: 0,
53
- g: 0,
54
- r: 255,
51
+ a: 1, // oxlint-disable-line id-length
52
+ b: 0, // oxlint-disable-line id-length
53
+ g: 0, // oxlint-disable-line id-length
54
+ r: 255, // oxlint-disable-line id-length
55
55
  },
56
56
  ] }));
57
57
  };
@@ -1 +1 @@
1
- {"version":3,"file":"color-picker-custom-swatches.story.js","sourceRoot":"","sources":["../../../../src/color-picker/stories/color-picker-custom-swatches.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC;QACjC,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;KACL,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,WAAW,IACV,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAC9C,QAAQ,EAAE;YACR;gBACE,CAAC,EAAE,CAAC;gBACJ,CAAC,EAAE,CAAC;gBACJ,CAAC,EAAE,CAAC;gBACJ,CAAC,EAAE,CAAC;aACL;YACD;gBACE,CAAC,EAAE,CAAC;gBACJ,CAAC,EAAE,GAAG;gBACN,CAAC,EAAE,CAAC;gBACJ,CAAC,EAAE,CAAC;aACL;YACD;gBACE,CAAC,EAAE,CAAC;gBACJ,CAAC,EAAE,CAAC;gBACJ,CAAC,EAAE,GAAG;gBACN,CAAC,EAAE,CAAC;aACL;YACD;gBACE,CAAC,EAAE,CAAC;gBACJ,CAAC,EAAE,CAAC;gBACJ,CAAC,EAAE,CAAC;gBACJ,CAAC,EAAE,GAAG;aACP;SACF,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { useState } from 'react';\n\nimport { ColorPicker } from '../ColorPicker';\n\nconst Component = () => {\n const [color, setColor] = useState({\n a: 1,\n b: 0,\n g: 0,\n r: 0,\n });\n\n return (\n <ColorPicker\n color={color}\n onChange={(newColor) => setColor(newColor.rgb)}\n swatches={[\n {\n a: 1,\n b: 0,\n g: 0,\n r: 0,\n },\n {\n a: 1,\n b: 255,\n g: 0,\n r: 0,\n },\n {\n a: 1,\n b: 0,\n g: 255,\n r: 0,\n },\n {\n a: 1,\n b: 0,\n g: 0,\n r: 255,\n },\n ]}\n />\n );\n};\n\nexport default Component;\n"]}
1
+ {"version":3,"file":"color-picker-custom-swatches.story.js","sourceRoot":"","sources":["../../../../src/color-picker/stories/color-picker-custom-swatches.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC;QACjC,CAAC,EAAE,CAAC,EAAE,gCAAgC;QACtC,CAAC,EAAE,CAAC,EAAE,gCAAgC;QACtC,CAAC,EAAE,CAAC,EAAE,gCAAgC;QACtC,CAAC,EAAE,CAAC,EAAE,gCAAgC;KACvC,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,WAAW,IACV,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAC9C,QAAQ,EAAE;YACR;gBACE,CAAC,EAAE,CAAC,EAAE,gCAAgC;gBACtC,CAAC,EAAE,CAAC,EAAE,gCAAgC;gBACtC,CAAC,EAAE,CAAC,EAAE,gCAAgC;gBACtC,CAAC,EAAE,CAAC,EAAE,gCAAgC;aACvC;YACD;gBACE,CAAC,EAAE,CAAC,EAAE,gCAAgC;gBACtC,CAAC,EAAE,GAAG,EAAE,gCAAgC;gBACxC,CAAC,EAAE,CAAC,EAAE,gCAAgC;gBACtC,CAAC,EAAE,CAAC,EAAE,gCAAgC;aACvC;YACD;gBACE,CAAC,EAAE,CAAC,EAAE,gCAAgC;gBACtC,CAAC,EAAE,CAAC,EAAE,gCAAgC;gBACtC,CAAC,EAAE,GAAG,EAAE,gCAAgC;gBACxC,CAAC,EAAE,CAAC,EAAE,gCAAgC;aACvC;YACD;gBACE,CAAC,EAAE,CAAC,EAAE,gCAAgC;gBACtC,CAAC,EAAE,CAAC,EAAE,gCAAgC;gBACtC,CAAC,EAAE,CAAC,EAAE,gCAAgC;gBACtC,CAAC,EAAE,GAAG,EAAE,gCAAgC;aACzC;SACF,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { useState } from 'react';\n\nimport { ColorPicker } from '../ColorPicker';\n\nconst Component = () => {\n const [color, setColor] = useState({\n a: 1, // oxlint-disable-line id-length\n b: 0, // oxlint-disable-line id-length\n g: 0, // oxlint-disable-line id-length\n r: 0, // oxlint-disable-line id-length\n });\n\n return (\n <ColorPicker\n color={color}\n onChange={(newColor) => setColor(newColor.rgb)}\n swatches={[\n {\n a: 1, // oxlint-disable-line id-length\n b: 0, // oxlint-disable-line id-length\n g: 0, // oxlint-disable-line id-length\n r: 0, // oxlint-disable-line id-length\n },\n {\n a: 1, // oxlint-disable-line id-length\n b: 255, // oxlint-disable-line id-length\n g: 0, // oxlint-disable-line id-length\n r: 0, // oxlint-disable-line id-length\n },\n {\n a: 1, // oxlint-disable-line id-length\n b: 0, // oxlint-disable-line id-length\n g: 255, // oxlint-disable-line id-length\n r: 0, // oxlint-disable-line id-length\n },\n {\n a: 1, // oxlint-disable-line id-length\n b: 0, // oxlint-disable-line id-length\n g: 0, // oxlint-disable-line id-length\n r: 255, // oxlint-disable-line id-length\n },\n ]}\n />\n );\n};\n\nexport default Component;\n"]}