@neo4j-ndl/react 4.20.0 → 4.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (439) hide show
  1. package/lib/cjs/_common/export-stories-utils.js +1 -1
  2. package/lib/cjs/_common/export-stories-utils.js.map +1 -1
  3. package/lib/cjs/_common/utils.js +3 -3
  4. package/lib/cjs/_common/utils.js.map +1 -1
  5. package/lib/cjs/_generated/style-rules/color-utils.js +3 -0
  6. package/lib/cjs/_generated/style-rules/color-utils.js.map +1 -1
  7. package/lib/cjs/_generated/style-rules/date-utils.js +14 -13
  8. package/lib/cjs/_generated/style-rules/date-utils.js.map +1 -1
  9. package/lib/cjs/_generated/style-rules/literal-schemas.js +5 -3
  10. package/lib/cjs/_generated/style-rules/literal-schemas.js.map +1 -1
  11. package/lib/cjs/ai/code-preview/CodePreview.js +1 -1
  12. package/lib/cjs/ai/code-preview/CodePreview.js.map +1 -1
  13. package/lib/cjs/ai/file-tag/FileTag.js.map +1 -1
  14. package/lib/cjs/ai/image-tag/ImageTag.js.map +1 -1
  15. package/lib/cjs/ai/prompt/Prompt.js +10 -10
  16. package/lib/cjs/ai/prompt/Prompt.js.map +1 -1
  17. package/lib/cjs/ai/prompt/stories/prompt-advanced.story.js +1 -1
  18. package/lib/cjs/ai/prompt/stories/prompt-advanced.story.js.map +1 -1
  19. package/lib/cjs/ai/prompt/stories/prompt-context.story.js +1 -1
  20. package/lib/cjs/ai/prompt/stories/prompt-context.story.js.map +1 -1
  21. package/lib/cjs/ai/prompt/stories/prompt-default.story.js +1 -1
  22. package/lib/cjs/ai/prompt/stories/prompt-default.story.js.map +1 -1
  23. package/lib/cjs/ai/prompt/stories/prompt-header.story.js +1 -1
  24. package/lib/cjs/ai/prompt/stories/prompt-header.story.js.map +1 -1
  25. package/lib/cjs/ai/response/Response.js +4 -4
  26. package/lib/cjs/ai/response/Response.js.map +1 -1
  27. package/lib/cjs/ai/response/stories/response-full-example.story.js +1 -1
  28. package/lib/cjs/ai/response/stories/response-full-example.story.js.map +1 -1
  29. package/lib/cjs/ai/suggestion/Suggestion.js.map +1 -1
  30. package/lib/cjs/ai/thinking/thinking-duration-formatter.js +5 -5
  31. package/lib/cjs/ai/thinking/thinking-duration-formatter.js.map +1 -1
  32. package/lib/cjs/banner/Banner.js +2 -2
  33. package/lib/cjs/banner/Banner.js.map +1 -1
  34. package/lib/cjs/button/ButtonBase.js +4 -4
  35. package/lib/cjs/button/ButtonBase.js.map +1 -1
  36. package/lib/cjs/code/Code.js +3 -3
  37. package/lib/cjs/code/Code.js.map +1 -1
  38. package/lib/cjs/code-block/CodeBlock.js +2 -2
  39. package/lib/cjs/code-block/CodeBlock.js.map +1 -1
  40. package/lib/cjs/color-picker/ColorPicker.js +22 -22
  41. package/lib/cjs/color-picker/ColorPicker.js.map +1 -1
  42. package/lib/cjs/color-picker/stories/color-picker-custom-swatches.story.js +20 -20
  43. package/lib/cjs/color-picker/stories/color-picker-custom-swatches.story.js.map +1 -1
  44. package/lib/cjs/color-picker/stories/color-picker-default.story.js +4 -4
  45. package/lib/cjs/color-picker/stories/color-picker-default.story.js.map +1 -1
  46. package/lib/cjs/color-picker/stories/color-picker-dialog.story.js +4 -4
  47. package/lib/cjs/color-picker/stories/color-picker-dialog.story.js.map +1 -1
  48. package/lib/cjs/color-picker/stories/color-picker-without-eyedropper.story.js +4 -4
  49. package/lib/cjs/color-picker/stories/color-picker-without-eyedropper.story.js.map +1 -1
  50. package/lib/cjs/combobox/stories/combobox-large-data-set.story.js +1 -1
  51. package/lib/cjs/combobox/stories/combobox-large-data-set.story.js.map +1 -1
  52. package/lib/cjs/data-grid/Components.js +20 -20
  53. package/lib/cjs/data-grid/Components.js.map +1 -1
  54. package/lib/cjs/data-grid/DataGrid.js +3 -3
  55. package/lib/cjs/data-grid/DataGrid.js.map +1 -1
  56. package/lib/cjs/data-grid/data-grid-nav/data-grid-nav.js +55 -54
  57. package/lib/cjs/data-grid/data-grid-nav/data-grid-nav.js.map +1 -1
  58. package/lib/cjs/data-grid/data-grid-nav/helpers.js +1 -1
  59. package/lib/cjs/data-grid/data-grid-nav/helpers.js.map +1 -1
  60. package/lib/cjs/data-grid/data-grid-nav/index.js +2 -2
  61. package/lib/cjs/data-grid/data-grid-nav/index.js.map +1 -1
  62. package/lib/cjs/data-grid/helpers/index.js +42 -40
  63. package/lib/cjs/data-grid/helpers/index.js.map +1 -1
  64. package/lib/cjs/data-grid/stories/datagrid-in-dialog.story.js +10 -7
  65. package/lib/cjs/data-grid/stories/datagrid-in-dialog.story.js.map +1 -1
  66. package/lib/cjs/data-grid/stories/datagrid-keyboard-navigation.story.js +10 -7
  67. package/lib/cjs/data-grid/stories/datagrid-keyboard-navigation.story.js.map +1 -1
  68. package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +5 -5
  69. package/lib/cjs/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -1
  70. package/lib/cjs/data-grid/stories/datagrid-search-and-filters.stories.js +1 -1
  71. package/lib/cjs/data-grid/stories/datagrid-search-and-filters.stories.js.map +1 -1
  72. package/lib/cjs/data-grid/stories/datagrid-virtualization.story.js +5 -5
  73. package/lib/cjs/data-grid/stories/datagrid-virtualization.story.js.map +1 -1
  74. package/lib/cjs/data-grid/style-rules/evaluate.js +23 -23
  75. package/lib/cjs/data-grid/style-rules/evaluate.js.map +1 -1
  76. package/lib/cjs/data-grid/style-rules/types.js +1 -1
  77. package/lib/cjs/data-grid/style-rules/types.js.map +1 -1
  78. package/lib/cjs/dialog/Dialog.js +5 -5
  79. package/lib/cjs/dialog/Dialog.js.map +1 -1
  80. package/lib/cjs/dialog/dialog-types.js.map +1 -1
  81. package/lib/cjs/drawer/Drawer.js +5 -5
  82. package/lib/cjs/drawer/Drawer.js.map +1 -1
  83. package/lib/cjs/dropdown-button/DropdownButton.js +4 -4
  84. package/lib/cjs/dropdown-button/DropdownButton.js.map +1 -1
  85. package/lib/cjs/dropzone/stories/dropzone-full.story.js +1 -1
  86. package/lib/cjs/dropzone/stories/dropzone-full.story.js.map +1 -1
  87. package/lib/cjs/flex/stories/flex-default.story.js +1 -1
  88. package/lib/cjs/flex/stories/flex-default.story.js.map +1 -1
  89. package/lib/cjs/hooks/index.js +3 -3
  90. package/lib/cjs/hooks/index.js.map +1 -1
  91. package/lib/cjs/icon-button-base/IconButtonBase.js +4 -4
  92. package/lib/cjs/icon-button-base/IconButtonBase.js.map +1 -1
  93. package/lib/cjs/icons/generated/custom/ScatterPlot.js +30 -0
  94. package/lib/cjs/icons/generated/custom/ScatterPlot.js.map +1 -0
  95. package/lib/cjs/icons/generated/custom/index.js +4 -2
  96. package/lib/cjs/icons/generated/custom/index.js.map +1 -1
  97. package/lib/cjs/inline-edit/InlineEdit.js +8 -8
  98. package/lib/cjs/inline-edit/InlineEdit.js.map +1 -1
  99. package/lib/cjs/kbd/kbd-utils.js +2 -2
  100. package/lib/cjs/kbd/kbd-utils.js.map +1 -1
  101. package/lib/cjs/modal/Modal.js +6 -6
  102. package/lib/cjs/modal/Modal.js.map +1 -1
  103. package/lib/cjs/next/tree-view/TreeView.js +23 -23
  104. package/lib/cjs/next/tree-view/TreeView.js.map +1 -1
  105. package/lib/cjs/next/tree-view/stories/tree-view-lazy.story.js +1 -1
  106. package/lib/cjs/next/tree-view/stories/tree-view-lazy.story.js.map +1 -1
  107. package/lib/cjs/next/tree-view/stories/tree-view-multi.story.js +6 -6
  108. package/lib/cjs/next/tree-view/stories/tree-view-multi.story.js.map +1 -1
  109. package/lib/cjs/popover/Popover.js.map +1 -1
  110. package/lib/cjs/popover/stories/popover-custom-offset.story.js +3 -3
  111. package/lib/cjs/popover/stories/popover-custom-offset.story.js.map +1 -1
  112. package/lib/cjs/popover/use-popover.js +2 -0
  113. package/lib/cjs/popover/use-popover.js.map +1 -1
  114. package/lib/cjs/segmented-control/SegmentedControl.js.map +1 -1
  115. package/lib/cjs/select/Overrides.js +30 -30
  116. package/lib/cjs/select/Overrides.js.map +1 -1
  117. package/lib/cjs/select-icon-button/SelectIconButton.js +4 -4
  118. package/lib/cjs/select-icon-button/SelectIconButton.js.map +1 -1
  119. package/lib/cjs/selectable-tag/stories/selectable-tag-sizes.story.js +1 -1
  120. package/lib/cjs/selectable-tag/stories/selectable-tag-sizes.story.js.map +1 -1
  121. package/lib/cjs/side-navigation/SideNavigation.js +9 -9
  122. package/lib/cjs/side-navigation/SideNavigation.js.map +1 -1
  123. package/lib/cjs/slider/Slider.js +1 -1
  124. package/lib/cjs/slider/Slider.js.map +1 -1
  125. package/lib/cjs/slider/stories/slider-single-controlled.story.js +2 -2
  126. package/lib/cjs/slider/stories/slider-single-controlled.story.js.map +1 -1
  127. package/lib/cjs/spotlight/Spotlight.js +6 -6
  128. package/lib/cjs/spotlight/Spotlight.js.map +1 -1
  129. package/lib/cjs/spotlight/SpotlightProvider.js +6 -6
  130. package/lib/cjs/spotlight/SpotlightProvider.js.map +1 -1
  131. package/lib/cjs/spotlight/SpotlightTarget.js +18 -16
  132. package/lib/cjs/spotlight/SpotlightTarget.js.map +1 -1
  133. package/lib/cjs/status-indicator/StatusIndicator.js +4 -2
  134. package/lib/cjs/status-indicator/StatusIndicator.js.map +1 -1
  135. package/lib/cjs/tabs/Tabs.js +3 -3
  136. package/lib/cjs/tabs/Tabs.js.map +1 -1
  137. package/lib/cjs/tabs/use-tabs-scroll-overflow.js +2 -2
  138. package/lib/cjs/tabs/use-tabs-scroll-overflow.js.map +1 -1
  139. package/lib/cjs/text-input/stories/text-input-full.story.js +1 -1
  140. package/lib/cjs/text-input/stories/text-input-full.story.js.map +1 -1
  141. package/lib/cjs/text-input/stories/text-input-with-icons.story.js +1 -1
  142. package/lib/cjs/text-input/stories/text-input-with-icons.story.js.map +1 -1
  143. package/lib/cjs/theme/agnostic.js +4 -4
  144. package/lib/cjs/theme/agnostic.js.map +1 -1
  145. package/lib/cjs/time-picker/TimePicker.js +24 -24
  146. package/lib/cjs/time-picker/TimePicker.js.map +1 -1
  147. package/lib/cjs/time-picker/generate-time-options.js +3 -3
  148. package/lib/cjs/time-picker/generate-time-options.js.map +1 -1
  149. package/lib/cjs/timezone-picker/TimeZonePicker.js +44 -44
  150. package/lib/cjs/timezone-picker/TimeZonePicker.js.map +1 -1
  151. package/lib/cjs/timezone-picker/generate-timezone-options.js +5 -5
  152. package/lib/cjs/timezone-picker/generate-timezone-options.js.map +1 -1
  153. package/lib/cjs/toast/ToastControlled.js +1 -1
  154. package/lib/cjs/toast/ToastControlled.js.map +1 -1
  155. package/lib/cjs/tooltip/use-tooltip.js +8 -1
  156. package/lib/cjs/tooltip/use-tooltip.js.map +1 -1
  157. package/lib/cjs/tree-view/TreeItemWrapper.js +8 -8
  158. package/lib/cjs/tree-view/TreeItemWrapper.js.map +1 -1
  159. package/lib/cjs/tree-view/TreeView.js +6 -2
  160. package/lib/cjs/tree-view/TreeView.js.map +1 -1
  161. package/lib/cjs/tree-view/TreeViewTextItem.js +17 -17
  162. package/lib/cjs/tree-view/TreeViewTextItem.js.map +1 -1
  163. package/lib/cjs/tree-view/tree-view-keyboard-coordinates.js +2 -0
  164. package/lib/cjs/tree-view/tree-view-keyboard-coordinates.js.map +1 -1
  165. package/lib/cjs/tree-view/tree-view-utils.js +12 -12
  166. package/lib/cjs/tree-view/tree-view-utils.js.map +1 -1
  167. package/lib/esm/_common/export-stories-utils.js +1 -1
  168. package/lib/esm/_common/export-stories-utils.js.map +1 -1
  169. package/lib/esm/_common/utils.js +3 -3
  170. package/lib/esm/_common/utils.js.map +1 -1
  171. package/lib/esm/_generated/style-rules/color-utils.js +3 -0
  172. package/lib/esm/_generated/style-rules/color-utils.js.map +1 -1
  173. package/lib/esm/_generated/style-rules/date-utils.js +14 -13
  174. package/lib/esm/_generated/style-rules/date-utils.js.map +1 -1
  175. package/lib/esm/_generated/style-rules/literal-schemas.js +5 -3
  176. package/lib/esm/_generated/style-rules/literal-schemas.js.map +1 -1
  177. package/lib/esm/ai/code-preview/CodePreview.js +1 -1
  178. package/lib/esm/ai/code-preview/CodePreview.js.map +1 -1
  179. package/lib/esm/ai/file-tag/FileTag.js.map +1 -1
  180. package/lib/esm/ai/image-tag/ImageTag.js.map +1 -1
  181. package/lib/esm/ai/prompt/Prompt.js +10 -10
  182. package/lib/esm/ai/prompt/Prompt.js.map +1 -1
  183. package/lib/esm/ai/prompt/stories/prompt-advanced.story.js +1 -1
  184. package/lib/esm/ai/prompt/stories/prompt-advanced.story.js.map +1 -1
  185. package/lib/esm/ai/prompt/stories/prompt-context.story.js +1 -1
  186. package/lib/esm/ai/prompt/stories/prompt-context.story.js.map +1 -1
  187. package/lib/esm/ai/prompt/stories/prompt-default.story.js +1 -1
  188. package/lib/esm/ai/prompt/stories/prompt-default.story.js.map +1 -1
  189. package/lib/esm/ai/prompt/stories/prompt-header.story.js +1 -1
  190. package/lib/esm/ai/prompt/stories/prompt-header.story.js.map +1 -1
  191. package/lib/esm/ai/response/Response.js +4 -4
  192. package/lib/esm/ai/response/Response.js.map +1 -1
  193. package/lib/esm/ai/response/stories/response-full-example.story.js +1 -1
  194. package/lib/esm/ai/response/stories/response-full-example.story.js.map +1 -1
  195. package/lib/esm/ai/suggestion/Suggestion.js.map +1 -1
  196. package/lib/esm/ai/thinking/thinking-duration-formatter.js +5 -5
  197. package/lib/esm/ai/thinking/thinking-duration-formatter.js.map +1 -1
  198. package/lib/esm/banner/Banner.js +2 -2
  199. package/lib/esm/banner/Banner.js.map +1 -1
  200. package/lib/esm/button/ButtonBase.js +4 -4
  201. package/lib/esm/button/ButtonBase.js.map +1 -1
  202. package/lib/esm/code/Code.js +3 -3
  203. package/lib/esm/code/Code.js.map +1 -1
  204. package/lib/esm/code-block/CodeBlock.js +2 -2
  205. package/lib/esm/code-block/CodeBlock.js.map +1 -1
  206. package/lib/esm/color-picker/ColorPicker.js +22 -22
  207. package/lib/esm/color-picker/ColorPicker.js.map +1 -1
  208. package/lib/esm/color-picker/stories/color-picker-custom-swatches.story.js +20 -20
  209. package/lib/esm/color-picker/stories/color-picker-custom-swatches.story.js.map +1 -1
  210. package/lib/esm/color-picker/stories/color-picker-default.story.js +4 -4
  211. package/lib/esm/color-picker/stories/color-picker-default.story.js.map +1 -1
  212. package/lib/esm/color-picker/stories/color-picker-dialog.story.js +4 -4
  213. package/lib/esm/color-picker/stories/color-picker-dialog.story.js.map +1 -1
  214. package/lib/esm/color-picker/stories/color-picker-without-eyedropper.story.js +4 -4
  215. package/lib/esm/color-picker/stories/color-picker-without-eyedropper.story.js.map +1 -1
  216. package/lib/esm/combobox/stories/combobox-large-data-set.story.js +1 -1
  217. package/lib/esm/combobox/stories/combobox-large-data-set.story.js.map +1 -1
  218. package/lib/esm/data-grid/Components.js +20 -20
  219. package/lib/esm/data-grid/Components.js.map +1 -1
  220. package/lib/esm/data-grid/DataGrid.js +3 -3
  221. package/lib/esm/data-grid/DataGrid.js.map +1 -1
  222. package/lib/esm/data-grid/data-grid-nav/data-grid-nav.js +55 -54
  223. package/lib/esm/data-grid/data-grid-nav/data-grid-nav.js.map +1 -1
  224. package/lib/esm/data-grid/data-grid-nav/helpers.js +1 -1
  225. package/lib/esm/data-grid/data-grid-nav/helpers.js.map +1 -1
  226. package/lib/esm/data-grid/data-grid-nav/index.js +2 -2
  227. package/lib/esm/data-grid/data-grid-nav/index.js.map +1 -1
  228. package/lib/esm/data-grid/helpers/index.js +42 -40
  229. package/lib/esm/data-grid/helpers/index.js.map +1 -1
  230. package/lib/esm/data-grid/stories/datagrid-in-dialog.story.js +10 -7
  231. package/lib/esm/data-grid/stories/datagrid-in-dialog.story.js.map +1 -1
  232. package/lib/esm/data-grid/stories/datagrid-keyboard-navigation.story.js +10 -7
  233. package/lib/esm/data-grid/stories/datagrid-keyboard-navigation.story.js.map +1 -1
  234. package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js +5 -5
  235. package/lib/esm/data-grid/stories/datagrid-rule-based-styling-datetime.story.js.map +1 -1
  236. package/lib/esm/data-grid/stories/datagrid-search-and-filters.stories.js +1 -1
  237. package/lib/esm/data-grid/stories/datagrid-search-and-filters.stories.js.map +1 -1
  238. package/lib/esm/data-grid/stories/datagrid-virtualization.story.js +5 -5
  239. package/lib/esm/data-grid/stories/datagrid-virtualization.story.js.map +1 -1
  240. package/lib/esm/data-grid/style-rules/evaluate.js +23 -23
  241. package/lib/esm/data-grid/style-rules/evaluate.js.map +1 -1
  242. package/lib/esm/data-grid/style-rules/types.js +1 -1
  243. package/lib/esm/data-grid/style-rules/types.js.map +1 -1
  244. package/lib/esm/dialog/Dialog.js +5 -5
  245. package/lib/esm/dialog/Dialog.js.map +1 -1
  246. package/lib/esm/dialog/dialog-types.js.map +1 -1
  247. package/lib/esm/drawer/Drawer.js +5 -5
  248. package/lib/esm/drawer/Drawer.js.map +1 -1
  249. package/lib/esm/dropdown-button/DropdownButton.js +4 -4
  250. package/lib/esm/dropdown-button/DropdownButton.js.map +1 -1
  251. package/lib/esm/dropzone/stories/dropzone-full.story.js +1 -1
  252. package/lib/esm/dropzone/stories/dropzone-full.story.js.map +1 -1
  253. package/lib/esm/flex/stories/flex-default.story.js +1 -1
  254. package/lib/esm/flex/stories/flex-default.story.js.map +1 -1
  255. package/lib/esm/hooks/index.js +3 -3
  256. package/lib/esm/hooks/index.js.map +1 -1
  257. package/lib/esm/icon-button-base/IconButtonBase.js +4 -4
  258. package/lib/esm/icon-button-base/IconButtonBase.js.map +1 -1
  259. package/lib/esm/icons/generated/custom/ScatterPlot.js +28 -0
  260. package/lib/esm/icons/generated/custom/ScatterPlot.js.map +1 -0
  261. package/lib/esm/icons/generated/custom/index.js +1 -0
  262. package/lib/esm/icons/generated/custom/index.js.map +1 -1
  263. package/lib/esm/inline-edit/InlineEdit.js +8 -8
  264. package/lib/esm/inline-edit/InlineEdit.js.map +1 -1
  265. package/lib/esm/kbd/kbd-utils.js +2 -2
  266. package/lib/esm/kbd/kbd-utils.js.map +1 -1
  267. package/lib/esm/modal/Modal.js +6 -6
  268. package/lib/esm/modal/Modal.js.map +1 -1
  269. package/lib/esm/next/tree-view/TreeView.js +23 -23
  270. package/lib/esm/next/tree-view/TreeView.js.map +1 -1
  271. package/lib/esm/next/tree-view/stories/tree-view-lazy.story.js +1 -1
  272. package/lib/esm/next/tree-view/stories/tree-view-lazy.story.js.map +1 -1
  273. package/lib/esm/next/tree-view/stories/tree-view-multi.story.js +6 -6
  274. package/lib/esm/next/tree-view/stories/tree-view-multi.story.js.map +1 -1
  275. package/lib/esm/popover/Popover.js.map +1 -1
  276. package/lib/esm/popover/stories/popover-custom-offset.story.js +3 -3
  277. package/lib/esm/popover/stories/popover-custom-offset.story.js.map +1 -1
  278. package/lib/esm/popover/use-popover.js +2 -0
  279. package/lib/esm/popover/use-popover.js.map +1 -1
  280. package/lib/esm/segmented-control/SegmentedControl.js.map +1 -1
  281. package/lib/esm/select/Overrides.js +30 -30
  282. package/lib/esm/select/Overrides.js.map +1 -1
  283. package/lib/esm/select-icon-button/SelectIconButton.js +4 -4
  284. package/lib/esm/select-icon-button/SelectIconButton.js.map +1 -1
  285. package/lib/esm/selectable-tag/stories/selectable-tag-sizes.story.js +1 -1
  286. package/lib/esm/selectable-tag/stories/selectable-tag-sizes.story.js.map +1 -1
  287. package/lib/esm/side-navigation/SideNavigation.js +9 -9
  288. package/lib/esm/side-navigation/SideNavigation.js.map +1 -1
  289. package/lib/esm/slider/Slider.js +1 -1
  290. package/lib/esm/slider/Slider.js.map +1 -1
  291. package/lib/esm/slider/stories/slider-single-controlled.story.js +2 -2
  292. package/lib/esm/slider/stories/slider-single-controlled.story.js.map +1 -1
  293. package/lib/esm/spotlight/Spotlight.js +6 -6
  294. package/lib/esm/spotlight/Spotlight.js.map +1 -1
  295. package/lib/esm/spotlight/SpotlightProvider.js +6 -6
  296. package/lib/esm/spotlight/SpotlightProvider.js.map +1 -1
  297. package/lib/esm/spotlight/SpotlightTarget.js +18 -16
  298. package/lib/esm/spotlight/SpotlightTarget.js.map +1 -1
  299. package/lib/esm/status-indicator/StatusIndicator.js +4 -2
  300. package/lib/esm/status-indicator/StatusIndicator.js.map +1 -1
  301. package/lib/esm/tabs/Tabs.js +3 -3
  302. package/lib/esm/tabs/Tabs.js.map +1 -1
  303. package/lib/esm/tabs/use-tabs-scroll-overflow.js +2 -2
  304. package/lib/esm/tabs/use-tabs-scroll-overflow.js.map +1 -1
  305. package/lib/esm/text-input/stories/text-input-full.story.js +1 -1
  306. package/lib/esm/text-input/stories/text-input-full.story.js.map +1 -1
  307. package/lib/esm/text-input/stories/text-input-with-icons.story.js +1 -1
  308. package/lib/esm/text-input/stories/text-input-with-icons.story.js.map +1 -1
  309. package/lib/esm/theme/agnostic.js +3 -3
  310. package/lib/esm/theme/agnostic.js.map +1 -1
  311. package/lib/esm/time-picker/TimePicker.js +24 -24
  312. package/lib/esm/time-picker/TimePicker.js.map +1 -1
  313. package/lib/esm/time-picker/generate-time-options.js +3 -3
  314. package/lib/esm/time-picker/generate-time-options.js.map +1 -1
  315. package/lib/esm/timezone-picker/TimeZonePicker.js +44 -44
  316. package/lib/esm/timezone-picker/TimeZonePicker.js.map +1 -1
  317. package/lib/esm/timezone-picker/generate-timezone-options.js +5 -5
  318. package/lib/esm/timezone-picker/generate-timezone-options.js.map +1 -1
  319. package/lib/esm/toast/ToastControlled.js +1 -1
  320. package/lib/esm/toast/ToastControlled.js.map +1 -1
  321. package/lib/esm/tooltip/use-tooltip.js +8 -1
  322. package/lib/esm/tooltip/use-tooltip.js.map +1 -1
  323. package/lib/esm/tree-view/TreeItemWrapper.js +8 -8
  324. package/lib/esm/tree-view/TreeItemWrapper.js.map +1 -1
  325. package/lib/esm/tree-view/TreeView.js +6 -2
  326. package/lib/esm/tree-view/TreeView.js.map +1 -1
  327. package/lib/esm/tree-view/TreeViewTextItem.js +17 -17
  328. package/lib/esm/tree-view/TreeViewTextItem.js.map +1 -1
  329. package/lib/esm/tree-view/tree-view-keyboard-coordinates.js +2 -0
  330. package/lib/esm/tree-view/tree-view-keyboard-coordinates.js.map +1 -1
  331. package/lib/esm/tree-view/tree-view-utils.js +12 -12
  332. package/lib/esm/tree-view/tree-view-utils.js.map +1 -1
  333. package/lib/types/_common/export-stories-utils.d.ts +1 -1
  334. package/lib/types/_common/utils.d.ts +3 -3
  335. package/lib/types/_generated/style-rules/color-utils.d.ts.map +1 -1
  336. package/lib/types/_generated/style-rules/date-utils.d.ts +3 -3
  337. package/lib/types/_generated/style-rules/date-utils.d.ts.map +1 -1
  338. package/lib/types/_generated/style-rules/literal-schemas.d.ts.map +1 -1
  339. package/lib/types/ai/code-preview/CodePreview.d.ts +1 -1
  340. package/lib/types/ai/file-tag/FileTag.d.ts +1 -1
  341. package/lib/types/ai/file-tag/FileTag.d.ts.map +1 -1
  342. package/lib/types/ai/image-tag/ImageTag.d.ts +1 -1
  343. package/lib/types/ai/image-tag/ImageTag.d.ts.map +1 -1
  344. package/lib/types/ai/prompt/Prompt.d.ts +3 -3
  345. package/lib/types/ai/prompt/Prompt.d.ts.map +1 -1
  346. package/lib/types/ai/suggestion/Suggestion.d.ts +1 -1
  347. package/lib/types/ai/suggestion/Suggestion.d.ts.map +1 -1
  348. package/lib/types/ai/thinking/thinking-duration-formatter.d.ts +5 -5
  349. package/lib/types/banner/Banner.d.ts +1 -1
  350. package/lib/types/banner/Banner.d.ts.map +1 -1
  351. package/lib/types/button/ButtonBase.d.ts +2 -2
  352. package/lib/types/button/ButtonBase.d.ts.map +1 -1
  353. package/lib/types/code/Code.d.ts +1 -1
  354. package/lib/types/code/Code.d.ts.map +1 -1
  355. package/lib/types/data-grid/Components.d.ts +2 -2
  356. package/lib/types/data-grid/Components.d.ts.map +1 -1
  357. package/lib/types/data-grid/DataGrid.d.ts +2 -2
  358. package/lib/types/data-grid/data-grid-nav/data-grid-nav.d.ts +4 -4
  359. package/lib/types/data-grid/data-grid-nav/data-grid-nav.d.ts.map +1 -1
  360. package/lib/types/data-grid/data-grid-nav/helpers.d.ts +1 -1
  361. package/lib/types/data-grid/data-grid-nav/index.d.ts +1 -1
  362. package/lib/types/data-grid/data-grid-nav/index.d.ts.map +1 -1
  363. package/lib/types/data-grid/helpers/index.d.ts +5 -5
  364. package/lib/types/data-grid/helpers/index.d.ts.map +1 -1
  365. package/lib/types/data-grid/stories/datagrid-in-dialog.story.d.ts.map +1 -1
  366. package/lib/types/data-grid/stories/datagrid-keyboard-navigation.story.d.ts.map +1 -1
  367. package/lib/types/data-grid/stories/datagrid-pinned-columns.stories.d.ts +2 -2
  368. package/lib/types/data-grid/stories/datagrid-search-and-filters.stories.d.ts +2 -2
  369. package/lib/types/data-grid/stories/datagrid-virtualization.story.d.ts.map +1 -1
  370. package/lib/types/data-grid/style-rules/evaluate.d.ts +1 -1
  371. package/lib/types/dialog/Dialog.d.ts.map +1 -1
  372. package/lib/types/dialog/dialog-types.d.ts +1 -1
  373. package/lib/types/dialog/dialog-types.d.ts.map +1 -1
  374. package/lib/types/drawer/Drawer.d.ts +1 -1
  375. package/lib/types/drawer/Drawer.d.ts.map +1 -1
  376. package/lib/types/dropdown-button/DropdownButton.d.ts +1 -1
  377. package/lib/types/dropdown-button/DropdownButton.d.ts.map +1 -1
  378. package/lib/types/hooks/index.d.ts +3 -3
  379. package/lib/types/icon-button-base/IconButtonBase.d.ts +1 -1
  380. package/lib/types/icon-button-base/IconButtonBase.d.ts.map +1 -1
  381. package/lib/types/icons/generated/custom/ScatterPlot.d.ts +29 -0
  382. package/lib/types/icons/generated/custom/ScatterPlot.d.ts.map +1 -0
  383. package/lib/types/icons/generated/custom/index.d.ts +1 -0
  384. package/lib/types/icons/generated/custom/index.d.ts.map +1 -1
  385. package/lib/types/modal/Modal.d.ts +1 -1
  386. package/lib/types/modal/Modal.d.ts.map +1 -1
  387. package/lib/types/popover/Popover.d.ts.map +1 -1
  388. package/lib/types/popover/use-popover.d.ts.map +1 -1
  389. package/lib/types/segmented-control/SegmentedControl.d.ts +1 -1
  390. package/lib/types/segmented-control/SegmentedControl.d.ts.map +1 -1
  391. package/lib/types/select/Overrides.d.ts.map +1 -1
  392. package/lib/types/select-icon-button/SelectIconButton.d.ts +1 -1
  393. package/lib/types/select-icon-button/SelectIconButton.d.ts.map +1 -1
  394. package/lib/types/selectable-tag/stories/selectable-tag-sizes.story.d.ts.map +1 -1
  395. package/lib/types/spotlight/SpotlightProvider.d.ts.map +1 -1
  396. package/lib/types/spotlight/SpotlightTarget.d.ts +4 -3
  397. package/lib/types/spotlight/SpotlightTarget.d.ts.map +1 -1
  398. package/lib/types/status-indicator/StatusIndicator.d.ts.map +1 -1
  399. package/lib/types/tabs/Tabs.d.ts +1 -1
  400. package/lib/types/tabs/Tabs.d.ts.map +1 -1
  401. package/lib/types/theme/agnostic.d.ts +2 -2
  402. package/lib/types/theme/agnostic.d.ts.map +1 -1
  403. package/lib/types/tooltip/use-tooltip.d.ts.map +1 -1
  404. package/lib/types/tree-view/TreeView.d.ts.map +1 -1
  405. package/lib/types/tree-view/TreeViewTextItem.d.ts.map +1 -1
  406. package/lib/types/tree-view/tree-view-keyboard-coordinates.d.ts.map +1 -1
  407. package/lib/types/tree-view/tree-view-utils.d.ts +12 -12
  408. package/lib/types/tree-view/tree-view-utils.d.ts.map +1 -1
  409. package/package.json +5 -3
  410. package/skills/ndl-react/SKILL.md +54 -3
  411. package/skills/ndl-react/components/ai/file-tag.md +1 -1
  412. package/skills/ndl-react/components/ai/image-tag.md +1 -1
  413. package/skills/ndl-react/components/ai/prompt.md +10 -10
  414. package/skills/ndl-react/components/ai/response.md +1 -1
  415. package/skills/ndl-react/components/ai/suggestion.md +1 -1
  416. package/skills/ndl-react/components/banner.md +1 -1
  417. package/skills/ndl-react/components/clean-icon-button.md +1 -1
  418. package/skills/ndl-react/components/code.md +1 -1
  419. package/skills/ndl-react/components/combobox.md +1 -1
  420. package/skills/ndl-react/components/data-grid.md +35 -28
  421. package/skills/ndl-react/components/dialog.md +1 -1
  422. package/skills/ndl-react/components/drawer.md +1 -1
  423. package/skills/ndl-react/components/dropdown-button.md +1 -1
  424. package/skills/ndl-react/components/dropzone.md +1 -1
  425. package/skills/ndl-react/components/filled-button.md +2 -2
  426. package/skills/ndl-react/components/flex.md +2 -2
  427. package/skills/ndl-react/components/icon-button.md +1 -1
  428. package/skills/ndl-react/components/modal.md +1 -1
  429. package/skills/ndl-react/components/next/tree-view.md +8 -8
  430. package/skills/ndl-react/components/outlined-button.md +2 -2
  431. package/skills/ndl-react/components/popover.md +3 -3
  432. package/skills/ndl-react/components/segmented-control.md +1 -1
  433. package/skills/ndl-react/components/select-icon-button.md +1 -1
  434. package/skills/ndl-react/components/selectable-tag.md +10 -4
  435. package/skills/ndl-react/components/slider.md +2 -2
  436. package/skills/ndl-react/components/tabs.md +1 -1
  437. package/skills/ndl-react/components/text-button.md +2 -2
  438. package/skills/ndl-react/components/text-input.md +2 -2
  439. package/skills/ndl-react/references/styling.md +290 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Banner.js","sourceRoot":"","sources":["../../../src/banner/Banner.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4DAAoC;AAOpC,4DAAuD;AACvD,kFAA+E;AAC/E,4FAAyF;AACzF,wGAAqG;AACrG,4GAAyG;AACzG,wGAAqG;AACrG,oFAAiF;AACjF,8CAA2C;AA8C3C,MAAM,UAAU,GAAG,CAAC,EAAE,OAAO,EAA8B,EAAE,EAAE;IAC7D,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;QAC1B,QAAQ,OAAO,EAAE,CAAC;YAChB,KAAK,SAAS;gBACZ,OAAO,uBAAC,2CAAoB,KAAG,CAAC;YAClC,KAAK,SAAS;gBACZ,OAAO,uBAAC,2DAA4B,KAAG,CAAC;YAC1C,KAAK,QAAQ;gBACX,OAAO,uBAAC,uDAA0B,KAAG,CAAC;YACxC,KAAK,MAAM;gBACT,OAAO,uBAAC,uDAA0B,KAAG,CAAC;YACxC,KAAK,SAAS;gBACZ,OAAO,uBAAC,iCAAe,KAAG,CAAC;YAC7B;gBACE,OAAO,IAAI,CAA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AS,EACT,cAAc,eAEjB,OAAO,IAAI,uBAAC,UAAU,IAAC,OAAO,EAAE,OAAO,GAAI,EAC5C,gCAAK,SAAS,EAAC,oBAAoB,YAAE,QAAQ,GAAO,EACnD,WAAW,IAAI,CACd,uBAAC,mCAAe,IACd,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,WAAW,EACpB,WAAW,EAAE,IAAI,EACjB,cAAc,EAAE,EAAE,YAAY,EAAE,OAAO,EAAE,YAEzC,uBAAC,mCAAgB,KAAG,GACJ,CACnB,KACO,CACX,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;IAC5C,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,iBAAiB;IAC9B,MAAM,EAAE,YAAY;CACrB,CAAC,CAAC;AAEM,wBAAM","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,4DAAoC;AAOpC,4DAAuD;AACvD,kFAA+E;AAC/E,4FAAyF;AACzF,wGAAqG;AACrG,4GAAyG;AACzG,wGAAqG;AACrG,oFAAiF;AACjF,8CAA2C;AA8C3C,MAAM,UAAU,GAAG,CAAC,EAAE,OAAO,EAA8B,EAAE,EAAE;IAC7D,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE;QAC1B,QAAQ,OAAO,EAAE,CAAC;YAChB,KAAK,SAAS;gBACZ,OAAO,uBAAC,2CAAoB,KAAG,CAAC;YAClC,KAAK,SAAS;gBACZ,OAAO,uBAAC,2DAA4B,KAAG,CAAC;YAC1C,KAAK,QAAQ;gBACX,OAAO,uBAAC,uDAA0B,KAAG,CAAC;YACxC,KAAK,MAAM;gBACT,OAAO,uBAAC,uDAA0B,KAAG,CAAC;YACxC,KAAK,SAAS;gBACZ,OAAO,uBAAC,iCAAe,KAAG,CAAC;YAC7B;gBACE,OAAO,IAAI,CAAC;QAChB,CAAC;IACH,CAAC,CAAC,EAAE,CAAC;IAEL,OAAO,gCAAK,SAAS,EAAC,wBAAwB,YAAE,aAAa,GAAO,CAAC;AACvE,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,EAO+B,EAAE,EAAE;QAPnC,EACpB,QAAQ,EACR,SAAS,EACT,KAAK,EACL,cAAc,EACd,GAAG,OAEgD,EADhD,SAAS,cANQ,2DAOrB,CADa;IAEZ,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,mBAAmB,EAAE,SAAS,CAAC,CAAC;IAC3D,OAAO,CACL,uBAAC,uBAAU,kBACT,EAAE,EAAC,MAAM,EACT,OAAO,EAAC,SAAS,EACjB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AAE,aAAa;IACtB,WAAW,EAAE,iBAAiB;IAC9B,MAAM,EAAE,YAAY;CACrB,CAAC,CAAC;AAEM,wBAAM","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"]}
@@ -53,18 +53,18 @@ const ButtonBase = (_a) => {
53
53
  [`ndl-${buttonFill}-button`]: buttonFill,
54
54
  [`ndl-${variant}`]: variant,
55
55
  });
56
- const handleClick = (e) => {
56
+ const handleClick = (event) => {
57
57
  if (!isInteractable) {
58
58
  // By default, a <button /> element with disabled set to true will not get its
59
59
  // on click handler called. To support the same behavior on <a /> tags we
60
60
  // swallow the event here when disabled, since the <a /> tag with disabled set to
61
61
  // true will have its onClick handler called
62
- e.preventDefault();
63
- e.stopPropagation();
62
+ event.preventDefault();
63
+ event.stopPropagation();
64
64
  return;
65
65
  }
66
66
  if (onClick) {
67
- onClick(e);
67
+ onClick(event);
68
68
  }
69
69
  };
70
70
  return ((0, jsx_runtime_1.jsx)(Component, Object.assign({ type: type, onClick: handleClick, disabled: isDisabled, "aria-disabled": !isInteractable, className: classes, style: style, ref: ref }, restProps, htmlAttributes, { children: (0, jsx_runtime_1.jsxs)("div", { className: "ndl-btn-inner", children: [Boolean(leadingVisual) && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-btn-leading-element", children: leadingVisual })), Boolean(children) && ((0, jsx_runtime_1.jsx)("span", { className: "ndl-btn-content", children: children })), isLoading && ((0, jsx_runtime_1.jsx)(ButtonSpinner_1.ButtonSpinner, { loadingMessage: loadingMessage, size: size }))] }) })));
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonBase.js","sourceRoot":"","sources":["../../../src/button/ButtonBase.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4DAAoC;AAGpC,4DAAyD;AAgElD,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,IAAA,oBAAU,EAAC,SAAS,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\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;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4DAAoC;AAGpC,4DAAyD;AAgElD,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,IAAA,oBAAU,EAAC,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,CAClB,KAAsD,EACtD,EAAE;QACF,IAAI,CAAC,cAAc,EAAE,CAAC;YACpB,8EAA8E;YAC9E,yEAAyE;YACzE,iFAAiF;YACjF,4CAA4C;YAC5C,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,KAAK,CAAC,eAAe,EAAE,CAAC;YACxB,OAAO;QACT,CAAC;QAED,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,uBAAC,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,iCAAK,SAAS,EAAC,eAAe,aAC3B,OAAO,CAAC,aAAa,CAAC,IAAI,CACzB,gCAAK,SAAS,EAAC,yBAAyB,YAAE,aAAa,GAAO,CAC/D,EACA,OAAO,CAAC,QAAQ,CAAC,IAAI,CACpB,iCAAM,SAAS,EAAC,iBAAiB,YAAE,QAAQ,GAAQ,CACpD,EACA,SAAS,IAAI,CACZ,uBAAC,6BAAa,IAAC,cAAc,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,GAAI,CAC9D,IACG,IACI,CACb,CAAC;AACJ,CAAC,CAAC;AA7EW,QAAA,UAAU,cA6ErB","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"]}
@@ -46,12 +46,12 @@ const Code = (_a) => {
46
46
  'ndl-disabled': isDisabled,
47
47
  'ndl-runnable': isRunnable,
48
48
  }, className);
49
- const handleClick = (e) => {
49
+ const handleClick = (event) => {
50
50
  if (isDisabled) {
51
- e.preventDefault();
51
+ event.preventDefault();
52
52
  return;
53
53
  }
54
- onClick === null || onClick === void 0 ? void 0 : onClick(e);
54
+ onClick === null || onClick === void 0 ? void 0 : onClick(event);
55
55
  };
56
56
  return ((0, jsx_runtime_1.jsx)(conditional_wrap_1.ConditionalWrap, { shouldWrap: Boolean(description) === true, wrap: (children) => ((0, jsx_runtime_1.jsxs)(tooltip_1.Tooltip, { type: "simple", children: [(0, jsx_runtime_1.jsx)(tooltip_1.Tooltip.Trigger, { hasButtonWrapper: Component === 'button', children: children }), (0, jsx_runtime_1.jsx)(tooltip_1.Tooltip.Content, { children: description })] })), children: (0, jsx_runtime_1.jsx)(Component, Object.assign({ className: classes, style: style, onClick: handleClick, disabled: isDisabled, ref: ref }, restProps, htmlAttributes, { children: (0, jsx_runtime_1.jsx)("code", { children: children }) })) }));
57
57
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Code.js","sourceRoot":"","sources":["../../../src/code/Code.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,4DAAoC;AAGpC,0DAAsD;AACtD,wCAAqC;AAmB9B,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,IAAA,oBAAU,EACxB,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,uBAAC,kCAAe,IACd,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,EACzC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAClB,wBAAC,iBAAO,IAAC,IAAI,EAAC,QAAQ,aACpB,uBAAC,iBAAO,CAAC,OAAO,IAAC,gBAAgB,EAAE,SAAS,KAAK,QAAQ,YACtD,QAAQ,GACO,EAClB,uBAAC,iBAAO,CAAC,OAAO,cAAE,WAAW,GAAmB,IACxC,CACX,YAED,uBAAC,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,2CAAO,QAAQ,GAAQ,IACb,GACI,CACnB,CAAC;AACJ,CAAC,CAAC;AA1DW,QAAA,IAAI,QA0Df","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,4DAAoC;AAGpC,0DAAsD;AACtD,wCAAqC;AAmB9B,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,IAAA,oBAAU,EACxB,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,uBAAC,kCAAe,IACd,UAAU,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,IAAI,EACzC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAClB,wBAAC,iBAAO,IAAC,IAAI,EAAC,QAAQ,aACpB,uBAAC,iBAAO,CAAC,OAAO,IAAC,gBAAgB,EAAE,SAAS,KAAK,QAAQ,YACtD,QAAQ,GACO,EAClB,uBAAC,iBAAO,CAAC,OAAO,cAAE,WAAW,GAAmB,IACxC,CACX,YAED,uBAAC,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,2CAAO,QAAQ,GAAQ,IACb,GACI,CACnB,CAAC;AACJ,CAAC,CAAC;AA1DW,QAAA,IAAI,QA0Df","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"]}
@@ -81,9 +81,9 @@ const CodeBlock = (_a) => {
81
81
  // wrapLongLines
82
82
  showLineNumbers: shouldShowLineNumbers, children: code }) }) })] }), (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)('ndl-code-block-actions', {
83
83
  'ndl-disabled': isDisabled,
84
- }), children: actions === null || actions === void 0 ? void 0 : actions.map((iconButtonProps, i) => {
84
+ }), children: actions === null || actions === void 0 ? void 0 : actions.map((iconButtonProps, index) => {
85
85
  var _a;
86
- return ((0, jsx_runtime_1.jsx)(clean_icon_button_1.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));
86
+ return ((0, jsx_runtime_1.jsx)(clean_icon_button_1.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));
87
87
  }) }), shouldShowExpandButton && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-code-block-expand-button", children: (0, jsx_runtime_1.jsx)(clean_icon_button_1.CleanIconButton, { description: isExpanded ? 'Collapse' : 'Expand', tooltipProps: {
88
88
  root: {
89
89
  shouldCloseOnReferenceClick: true,
@@ -1 +1 @@
1
- {"version":3,"file":"CodeBlock.js","sourceRoot":"","sources":["../../../src/code-block/CodeBlock.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4DAAoC;AAEpC,uEAA2E;AAG3E,4DAAuD;AAEvD,gGAA6F;AAC7F,4FAAyF;AAGzF,iEAA4D;AAC5D,2DAAsD;AACtD,2DAAuD;AAavD,MAAM,cAAc,GAAG,KAAK,CAAC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C9C,cAAc,EAAE,UAAU;iBAC3B,CAAC,YAED,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,GAAG,CAAC,CAAC,eAAe,EAAE,CAAC,EAAE,EAAE;;oBAAC,OAAA,CACpC,uBAAC,mCAAe,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,gCAAK,SAAS,EAAC,8BAA8B,YAC3C,uBAAC,mCAAe,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,uBAAC,2CAAoB,KAAG,CAAC,CAAC,CAAC,uBAAC,+CAAsB,KAAG,GACnD,GACd,CACP,KACS,CACb,CAAC;AACJ,CAAC,CAAC;AArIW,QAAA,SAAS,aAqIpB","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};\n"]}
1
+ {"version":3,"file":"CodeBlock.js","sourceRoot":"","sources":["../../../src/code-block/CodeBlock.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,4DAAoC;AAEpC,uEAA2E;AAG3E,4DAAuD;AAEvD,gGAA6F;AAC7F,4FAAyF;AAGzF,iEAA4D;AAC5D,2DAAsD;AACtD,2DAAuD;AAavD,MAAM,cAAc,GAAG,KAAK,CAAC;AAEtB,MAAM,SAAS,GAAG,CAAyC,EAgBtB,EAAE,EAAE;;QAhBkB,EAChE,EAAE,EACF,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,qBAAqB,EACrB,KAAK,EACL,OAAO,EACP,OAAO,EACP,UAAU,EACV,SAAS,EACT,KAAK,EACL,cAAc,EACd,GAAG,OAGuC,EAFvC,SAAS,cAdoD,4JAgBjE,CAFa;IACZ,wEAAwE;;IAExE,MAAM,SAAS,GAAsB,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,cAAc,CAAC;IAE1D,MAAM,EACJ,eAAe,EACf,UAAU,EACV,YAAY,EACZ,qBAAqB,EACrB,GAAG,EAAE,2BAA2B,GACjC,GAAG,IAAA,8BAAa,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACnC,MAAM,SAAS,GAAG,IAAA,6BAAY,EAAC,KAAK,CAAC,CAAC;IACtC,MAAM,YAAY,GAAG,IAAA,mCAAe,EAAC,QAAQ,CAAC,CAAC;IAE/C,MAAM,YAAY,GAAG,SAAS,KAAK,SAAS,CAAC;IAC7C,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACpC,MAAM,eAAe,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,mCAAI,CAAC,CAAC;IAE7C,MAAM,sBAAsB,GAAG,YAAY,IAAI,q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o4j 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"]}
@@ -54,7 +54,7 @@ exports.ColorPicker = (0, react_1.forwardRef)(function ColorPicker({ color, onCh
54
54
  if (typeof color === 'object' && 'r' in color) {
55
55
  return (0, react_color_1.rgbaToHsva)(color);
56
56
  }
57
- return Object.assign(Object.assign({ h: 0, s: 0, v: 0 }, color), { a: 1 });
57
+ return Object.assign(Object.assign({ h: 0, s: 0, v: 0 }, color), { a: 1 }); // oxlint-disable-line id-length
58
58
  }, [color]);
59
59
  const [hsva, setHsva] = (0, react_1.useState)(derivedHsva);
60
60
  const [format, setFormat] = (0, react_1.useState)({
@@ -74,7 +74,7 @@ exports.ColorPicker = (0, react_1.forwardRef)(function ColorPicker({ color, onCh
74
74
  });
75
75
  };
76
76
  return ((0, jsx_runtime_1.jsxs)("div", { ref: ref, className: (0, classnames_1.default)('ndl-color-picker', className), style: style, children: [(0, jsx_runtime_1.jsx)(react_color_1.Saturation, { hsva: hsva, className: "ndl-color-picker-saturation", onChange: (newColor) => {
77
- handleChange(Object.assign(Object.assign(Object.assign({}, hsva), newColor), { a: hsva.a }));
77
+ handleChange(Object.assign(Object.assign(Object.assign({}, hsva), newColor), { a: hsva.a })); // oxlint-disable-line id-length
78
78
  }, pointer: (_a) => {
79
79
  var { left, top } = _a, props = __rest(_a, ["left", "top"]);
80
80
  return ((0, jsx_runtime_1.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 })));
@@ -98,12 +98,12 @@ exports.ColorPicker = (0, react_1.forwardRef)(function ColorPicker({ color, onCh
98
98
  setIsEyeDropperActiveState(false);
99
99
  });
100
100
  }, description: "Pick color from the screen with eye dropper tool", children: (0, jsx_runtime_1.jsx)(EyeDropperIconOutline_1.EyeDropperIconOutline, {}) })), (0, jsx_runtime_1.jsx)(react_color_1.Hue, { className: "ndl-color-picker-hue", hue: hsva.h, onChange: (newHue) => {
101
- handleChange(Object.assign(Object.assign({}, hsva), { h: newHue.h }));
101
+ handleChange(Object.assign(Object.assign({}, hsva), { h: newHue.h })); // oxlint-disable-line id-length
102
102
  }, radius: base_1.tokens.borderRadius['lg'], pointer: (props) => ((0, jsx_runtime_1.jsx)(Pointer, Object.assign({}, props, { hsva: {
103
- a: 1,
104
- h: hsva.h,
105
- s: 100,
106
- v: 100,
103
+ a: 1, // oxlint-disable-line id-length
104
+ h: hsva.h, // oxlint-disable-line id-length
105
+ s: 100, // oxlint-disable-line id-length
106
+ v: 100, // oxlint-disable-line id-length
107
107
  } }))) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "ndl-color-picker-inputs", children: [(0, jsx_runtime_1.jsx)(select_1.Select, { size: "small", type: "select", ariaLabel: "Color format", style: {
108
108
  flexShrink: 0,
109
109
  }, selectProps: {
@@ -143,8 +143,8 @@ const HexInput = ({ hsva, onChange, }) => {
143
143
  (0, react_1.useEffect)(() => {
144
144
  setInputValue(removeHashPrefix((0, react_color_1.hsvaToHex)(hsva)));
145
145
  }, [hsva]);
146
- const handleChange = (e) => {
147
- const value = removeHashPrefix(e.target.value);
146
+ const handleChange = (event) => {
147
+ const value = removeHashPrefix(event.target.value);
148
148
  // Always update the input value for immediate feedback
149
149
  setInputValue(value);
150
150
  // Check if the input is a valid hex color (only 6 characters)
@@ -157,8 +157,8 @@ const HexInput = ({ hsva, onChange, }) => {
157
157
  return ((0, jsx_runtime_1.jsx)(text_input_1.TextInput, { size: "small", value: inputValue, leadingElement: (0, jsx_runtime_1.jsx)("div", { className: "ndl-color-picker-hex-input-prefix", children: "#" }), onChange: handleChange, isFluid: true, htmlAttributes: {
158
158
  'aria-label': 'Hex color code',
159
159
  maxLength: 6,
160
- onCopy: (e) => {
161
- e.preventDefault();
160
+ onCopy: (event) => {
161
+ event.preventDefault();
162
162
  navigator.clipboard.writeText(hexValue);
163
163
  },
164
164
  } }));
@@ -166,21 +166,21 @@ const HexInput = ({ hsva, onChange, }) => {
166
166
  const RgbInput = ({ hsva, onChange, }) => {
167
167
  const rgba = (0, react_color_1.hsvaToRgba)(hsva);
168
168
  const [rgbValues, setRgbValues] = (0, react_1.useState)({
169
- b: rgba.b,
170
- g: rgba.g,
171
- r: rgba.r,
169
+ b: rgba.b, // oxlint-disable-line id-length
170
+ g: rgba.g, // oxlint-disable-line id-length
171
+ r: rgba.r, // oxlint-disable-line id-length
172
172
  });
173
173
  // Update input values when hsva changes from outside
174
174
  (0, react_1.useEffect)(() => {
175
175
  const newRgba = (0, react_color_1.hsvaToRgba)(hsva);
176
176
  setRgbValues({
177
- b: newRgba.b,
178
- g: newRgba.g,
179
- r: newRgba.r,
177
+ b: newRgba.b, // oxlint-disable-line id-length
178
+ g: newRgba.g, // oxlint-disable-line id-length
179
+ r: newRgba.r, // oxlint-disable-line id-length
180
180
  });
181
181
  }, [hsva]);
182
- const handleChange = (channel, e) => {
183
- const value = parseInt(e.target.value, 10);
182
+ const handleChange = (channel, event) => {
183
+ const value = parseInt(event.target.value, 10);
184
184
  // Validate the input is a number between 0-255
185
185
  const validValue = isNaN(value) ? 0 : Math.max(0, Math.min(255, value));
186
186
  const newRgbValues = Object.assign(Object.assign({}, rgbValues), { [channel]: validValue });
@@ -189,17 +189,17 @@ const RgbInput = ({ hsva, onChange, }) => {
189
189
  const hexColor = `#${newRgbValues.r.toString(16).padStart(2, '0')}${newRgbValues.g.toString(16).padStart(2, '0')}${newRgbValues.b.toString(16).padStart(2, '0')}`;
190
190
  onChange(hexColor);
191
191
  };
192
- return ((0, jsx_runtime_1.jsxs)("div", { className: "ndl-color-picker-rgb-inputs", children: [(0, jsx_runtime_1.jsx)(text_input_1.TextInput, { size: "small", className: "ndl-color-picker-rgb-input", value: rgbValues.r.toString(), onChange: (e) => handleChange('r', e), htmlAttributes: {
192
+ return ((0, jsx_runtime_1.jsxs)("div", { className: "ndl-color-picker-rgb-inputs", children: [(0, jsx_runtime_1.jsx)(text_input_1.TextInput, { size: "small", className: "ndl-color-picker-rgb-input", value: rgbValues.r.toString(), onChange: (event) => handleChange('r', event), htmlAttributes: {
193
193
  'aria-label': 'Red',
194
194
  max: '255',
195
195
  min: '0',
196
196
  type: 'number',
197
- } }), (0, jsx_runtime_1.jsx)(text_input_1.TextInput, { size: "small", className: "ndl-color-picker-rgb-input", value: rgbValues.g.toString(), onChange: (e) => handleChange('g', e), htmlAttributes: {
197
+ } }), (0, jsx_runtime_1.jsx)(text_input_1.TextInput, { size: "small", className: "ndl-color-picker-rgb-input", value: rgbValues.g.toString(), onChange: (event) => handleChange('g', event), htmlAttributes: {
198
198
  'aria-label': 'Green',
199
199
  max: '255',
200
200
  min: '0',
201
201
  type: 'number',
202
- } }), (0, jsx_runtime_1.jsx)(text_input_1.TextInput, { size: "small", className: "ndl-color-picker-rgb-input", value: rgbValues.b.toString(), onChange: (e) => handleChange('b', e), htmlAttributes: {
202
+ } }), (0, jsx_runtime_1.jsx)(text_input_1.TextInput, { size: "small", className: "ndl-color-picker-rgb-input", value: rgbValues.b.toString(), onChange: (event) => handleChange('b', event), htmlAttributes: {
203
203
  'aria-label': 'Blue',
204
204
  max: '255',
205
205
  min: '0',
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker.js","sourceRoot":"","sources":["../../../src/color-picker/ColorPicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;;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;gBACtB,IAAI,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC;YAEzB,OAAO,CACL,mCACE,IAAI,EAAC,QAAQ,gBAED,QAAQ,EACpB,SAAS,EAAE,IAAA,oBAAU,EAAC,+BAA+B,EAAE;oBACrD,sCAAsC,EAAE,QAAQ;iBACjD,CAAC,EACF,KAAK,EAAE,EAAE,eAAe,EAAE,IAAA,uBAAS,EAAC,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,IAAA,wBAAU,EAAC,IAAI,CAAC,CAAC;IAC9B,OAAO,CACL,gCACE,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,IAAA,oBAAU,EAAC,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 );\n};\n"]}
1
+ {"version":3,"file":"ColorPicker.js","sourceRoot":"","sources":["../../../src/color-picker/ColorPicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,+BAA6B;AAE7B,0CAAyC;AACzC,kDAa0B;AAC1B,4DAAoC;AACpC,iCAAiE;AAEjE,4DAAuD;AACvD,8FAA2F;AAC3F,sCAAmC;AACnC,8CAA0C;AAuC7B,QAAA,WAAW,GAAG,IAAA,kBAAU,EACnC,SAAS,WAAW,CAClB,EACE,KAAK,EACL,QAAQ,EACR,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,aAAM,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,sBAAQ,CAAC,EACvD,oBAAoB,GAAG,IAAI,EAC3B,SAAS,EACT,KAAK,EACL,YAAY,EACZ,gBAAgB,GAAG,UAAU,GAC9B,EACD,GAAG;IAEH,MAAM,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,GACzD,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAElB,MAAM,WAAW,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC/B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,IAAA,uBAAS,EAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;QACD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,GAAG,IAAI,KAAK,EAAE,CAAC;YAC9C,OAAO,IAAA,wBAAU,EAAC,KAAK,CAAC,CAAC;QAC3B,CAAC;QACD,OAAO,8BAAE,CAAC,EAAE,CAAC,EAA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CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG;YACnE,IAAI;YACJ,GAAG;SACJ,EACD,SAAS,EAAE,IAAA,oBAAU,EAAC,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"]}
@@ -25,35 +25,35 @@ const react_1 = require("react");
25
25
  const ColorPicker_1 = require("../ColorPicker");
26
26
  const Component = () => {
27
27
  const [color, setColor] = (0, react_1.useState)({
28
- a: 1,
29
- b: 0,
30
- g: 0,
31
- r: 0,
28
+ a: 1, // oxlint-disable-line id-length
29
+ b: 0, // oxlint-disable-line id-length
30
+ g: 0, // oxlint-disable-line id-length
31
+ r: 0, // oxlint-disable-line id-length
32
32
  });
33
33
  return ((0, jsx_runtime_1.jsx)(ColorPicker_1.ColorPicker, { color: color, onChange: (newColor) => setColor(newColor.rgb), swatches: [
34
34
  {
35
- a: 1,
36
- b: 0,
37
- g: 0,
38
- r: 0,
35
+ a: 1, // oxlint-disable-line id-length
36
+ b: 0, // oxlint-disable-line id-length
37
+ g: 0, // oxlint-disable-line id-length
38
+ r: 0, // oxlint-disable-line id-length
39
39
  },
40
40
  {
41
- a: 1,
42
- b: 255,
43
- g: 0,
44
- r: 0,
41
+ a: 1, // oxlint-disable-line id-length
42
+ b: 255, // oxlint-disable-line id-length
43
+ g: 0, // oxlint-disable-line id-length
44
+ r: 0, // oxlint-disable-line id-length
45
45
  },
46
46
  {
47
- a: 1,
48
- b: 0,
49
- g: 255,
50
- r: 0,
47
+ a: 1, // oxlint-disable-line id-length
48
+ b: 0, // oxlint-disable-line id-length
49
+ g: 255, // oxlint-disable-line id-length
50
+ r: 0, // oxlint-disable-line id-length
51
51
  },
52
52
  {
53
- a: 1,
54
- b: 0,
55
- g: 0,
56
- r: 255,
53
+ a: 1, // oxlint-disable-line id-length
54
+ b: 0, // oxlint-disable-line id-length
55
+ g: 0, // oxlint-disable-line id-length
56
+ r: 255, // oxlint-disable-line id-length
57
57
  },
58
58
  ] }));
59
59
  };
@@ -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,iCAAiC;AAEjC,gDAA6C;AAE7C,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC;QACjC,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;KACL,CAAC,CAAC;IAEH,OAAO,CACL,uBAAC,yBAAW,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,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { 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,iCAAiC;AAEjC,gDAA6C;AAE7C,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC;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,uBAAC,yBAAW,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,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { 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"]}
@@ -25,10 +25,10 @@ const react_1 = require("react");
25
25
  const ColorPicker_1 = require("../ColorPicker");
26
26
  const Component = () => {
27
27
  const [color, setColor] = (0, react_1.useState)({
28
- a: 1,
29
- b: 0,
30
- g: 0,
31
- r: 0,
28
+ a: 1, // oxlint-disable-line id-length
29
+ b: 0, // oxlint-disable-line id-length
30
+ g: 0, // oxlint-disable-line id-length
31
+ r: 0, // oxlint-disable-line id-length
32
32
  });
33
33
  return ((0, jsx_runtime_1.jsx)(ColorPicker_1.ColorPicker, { color: color, onChange: (newColor) => setColor(newColor.rgb) }));
34
34
  };
@@ -1 +1 @@
1
- {"version":3,"file":"color-picker-default.story.js","sourceRoot":"","sources":["../../../../src/color-picker/stories/color-picker-default.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,iCAAiC;AAEjC,gDAA6C;AAE7C,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC;QACjC,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;KACL,CAAC,CAAC;IAEH,OAAO,CACL,uBAAC,yBAAW,IACV,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,GAC9C,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { 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 />\n );\n};\n\nexport default Component;\n"]}
1
+ {"version":3,"file":"color-picker-default.story.js","sourceRoot":"","sources":["../../../../src/color-picker/stories/color-picker-default.story.tsx"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,iCAAiC;AAEjC,gDAA6C;AAE7C,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC;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,uBAAC,yBAAW,IACV,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,GAC9C,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { 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 />\n );\n};\n\nexport default Component;\n"]}
@@ -29,10 +29,10 @@ const Component = () => {
29
29
  const handleClick = () => setIsOpen((prev) => !prev);
30
30
  const handleClose = () => setIsOpen(false);
31
31
  const [color, setColor] = (0, react_2.useState)({
32
- a: 1,
33
- b: 0,
34
- g: 0,
35
- r: 0,
32
+ a: 1, // oxlint-disable-line id-length
33
+ b: 0, // oxlint-disable-line id-length
34
+ g: 0, // oxlint-disable-line id-length
35
+ r: 0, // oxlint-disable-line id-length
36
36
  });
37
37
  return ((0, jsx_runtime_1.jsxs)("div", { className: "n-flex n-items-center n-justify-centern-w-full", children: [(0, jsx_runtime_1.jsx)(react_1.FilledButton, { onClick: handleClick, htmlAttributes: { 'aria-haspopup': 'dialog' }, children: "Open Dialog" }), (0, jsx_runtime_1.jsxs)(react_1.Dialog, { onClose: handleClose, isOpen: isOpen, children: [(0, jsx_runtime_1.jsx)(react_1.Dialog.Header, { children: "Header" }), (0, jsx_runtime_1.jsx)(react_1.Dialog.Content, { className: "n-max-h-96 n-overflow-y-auto", children: (0, jsx_runtime_1.jsx)(react_1.ColorPicker, { color: color, onChange: (newColor) => setColor(newColor.rgb), floatingStrategy: "fixed" }) })] })] }));
38
38
  };