@neo4j-ndl/react 4.1.5 → 4.1.6

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 (525) hide show
  1. package/lib/cjs/_common/CodeBlockWrapper.js +5 -4
  2. package/lib/cjs/_common/CodeBlockWrapper.js.map +1 -1
  3. package/lib/cjs/_common/utils.js +4 -2
  4. package/lib/cjs/_common/utils.js.map +1 -1
  5. package/lib/cjs/accordion/Accordion.js +9 -6
  6. package/lib/cjs/accordion/Accordion.js.map +1 -1
  7. package/lib/cjs/accordion/accordion-types.js.map +1 -1
  8. package/lib/cjs/accordion/stories/accordion.stories.js +1 -1
  9. package/lib/cjs/accordion/stories/accordion.stories.js.map +1 -1
  10. package/lib/cjs/avatar/Avatar.js +1 -1
  11. package/lib/cjs/avatar/Avatar.js.map +1 -1
  12. package/lib/cjs/banner/Banner.js +3 -2
  13. package/lib/cjs/banner/Banner.js.map +1 -1
  14. package/lib/cjs/banner/stories/banner.stories.js +1 -1
  15. package/lib/cjs/banner/stories/banner.stories.js.map +1 -1
  16. package/lib/cjs/box/Box.js +14 -2
  17. package/lib/cjs/box/Box.js.map +1 -1
  18. package/lib/cjs/box/stories/box.stories.js +2 -2
  19. package/lib/cjs/box/stories/box.stories.js.map +1 -1
  20. package/lib/cjs/breadcrumbs/Breadcrumbs.js +10 -7
  21. package/lib/cjs/breadcrumbs/Breadcrumbs.js.map +1 -1
  22. package/lib/cjs/button/stories/button.stories.js +2 -2
  23. package/lib/cjs/button/stories/button.stories.js.map +1 -1
  24. package/lib/cjs/checkbox/Checkbox.js +2 -1
  25. package/lib/cjs/checkbox/Checkbox.js.map +1 -1
  26. package/lib/cjs/checkbox/stories/checkbox.stories.js +1 -1
  27. package/lib/cjs/checkbox/stories/checkbox.stories.js.map +1 -1
  28. package/lib/cjs/clipboard-button/ClipboardButton.js +6 -3
  29. package/lib/cjs/clipboard-button/ClipboardButton.js.map +1 -1
  30. package/lib/cjs/color-picker/ColorPicker.js +2 -1
  31. package/lib/cjs/color-picker/ColorPicker.js.map +1 -1
  32. package/lib/cjs/data-grid/Components.js +9 -6
  33. package/lib/cjs/data-grid/Components.js.map +1 -1
  34. package/lib/cjs/data-grid/DataGrid.js +16 -4
  35. package/lib/cjs/data-grid/DataGrid.js.map +1 -1
  36. package/lib/cjs/data-grid/data-grid-nav/data-grid-nav.js +28 -14
  37. package/lib/cjs/data-grid/data-grid-nav/data-grid-nav.js.map +1 -1
  38. package/lib/cjs/data-grid/data-grid-nav/helpers.js +2 -1
  39. package/lib/cjs/data-grid/data-grid-nav/helpers.js.map +1 -1
  40. package/lib/cjs/data-grid/stories/datagrid-component-overriding.story.js +1 -3
  41. package/lib/cjs/data-grid/stories/datagrid-component-overriding.story.js.map +1 -1
  42. package/lib/cjs/data-grid/stories/datagrid-in-dialog.story.js +2 -1
  43. package/lib/cjs/data-grid/stories/datagrid-in-dialog.story.js.map +1 -1
  44. package/lib/cjs/data-grid/stories/datagrid-keyboard-navigation.story.js +2 -1
  45. package/lib/cjs/data-grid/stories/datagrid-keyboard-navigation.story.js.map +1 -1
  46. package/lib/cjs/data-grid/stories/datagrid-kitchen-sink.story.js +1 -2
  47. package/lib/cjs/data-grid/stories/datagrid-kitchen-sink.story.js.map +1 -1
  48. package/lib/cjs/data-grid/stories/datagrid-search-and-filters.stories.js +13 -10
  49. package/lib/cjs/data-grid/stories/datagrid-search-and-filters.stories.js.map +1 -1
  50. package/lib/cjs/date-picker/DatePicker.js +2 -1
  51. package/lib/cjs/date-picker/DatePicker.js.map +1 -1
  52. package/lib/cjs/date-picker/stories/date-picker-range.story.js +1 -1
  53. package/lib/cjs/date-picker/stories/date-picker-range.story.js.map +1 -1
  54. package/lib/cjs/date-picker/stories/date-picker.stories.js +1 -1
  55. package/lib/cjs/date-picker/stories/date-picker.stories.js.map +1 -1
  56. package/lib/cjs/dialog/Dialog.js +20 -13
  57. package/lib/cjs/dialog/Dialog.js.map +1 -1
  58. package/lib/cjs/dialog/dialog-context.js +35 -6
  59. package/lib/cjs/dialog/dialog-context.js.map +1 -1
  60. package/lib/cjs/dialog/stories/dialog.stories.js +1 -1
  61. package/lib/cjs/dialog/stories/dialog.stories.js.map +1 -1
  62. package/lib/cjs/divider/stories/divider.stories.js +1 -1
  63. package/lib/cjs/divider/stories/divider.stories.js.map +1 -1
  64. package/lib/cjs/drawer/Drawer.js +9 -8
  65. package/lib/cjs/drawer/Drawer.js.map +1 -1
  66. package/lib/cjs/dropdown-button/DropdownButton.js +14 -2
  67. package/lib/cjs/dropdown-button/DropdownButton.js.map +1 -1
  68. package/lib/cjs/dropzone/Dropzone.js +3 -2
  69. package/lib/cjs/dropzone/Dropzone.js.map +1 -1
  70. package/lib/cjs/dropzone/stories/dropzone-csv-files.story.js +1 -3
  71. package/lib/cjs/dropzone/stories/dropzone-csv-files.story.js.map +1 -1
  72. package/lib/cjs/dropzone/stories/dropzone-custom-extensions.story.js +1 -3
  73. package/lib/cjs/dropzone/stories/dropzone-custom-extensions.story.js.map +1 -1
  74. package/lib/cjs/dropzone/stories/dropzone-default.story.js +1 -3
  75. package/lib/cjs/dropzone/stories/dropzone-default.story.js.map +1 -1
  76. package/lib/cjs/dropzone/stories/dropzone-disabled.story.js +1 -3
  77. package/lib/cjs/dropzone/stories/dropzone-disabled.story.js.map +1 -1
  78. package/lib/cjs/flex/Flex.js +14 -2
  79. package/lib/cjs/flex/Flex.js.map +1 -1
  80. package/lib/cjs/graph-label/GraphLabel.js +18 -4
  81. package/lib/cjs/graph-label/GraphLabel.js.map +1 -1
  82. package/lib/cjs/icon-button/stories/icon-button.stories.js +1 -1
  83. package/lib/cjs/icon-button/stories/icon-button.stories.js.map +1 -1
  84. package/lib/cjs/icon-button-array/IconButtonArray.js +14 -2
  85. package/lib/cjs/icon-button-array/IconButtonArray.js.map +1 -1
  86. package/lib/cjs/icon-button-array/index.js +1 -1
  87. package/lib/cjs/icon-button-array/index.js.map +1 -1
  88. package/lib/cjs/icon-button-array/stories/icon-button-array.stories.js +1 -1
  89. package/lib/cjs/icon-button-array/stories/icon-button-array.stories.js.map +1 -1
  90. package/lib/cjs/icons/wrapIcon.js +1 -1
  91. package/lib/cjs/icons/wrapIcon.js.map +1 -1
  92. package/lib/cjs/inline-edit/InlineEdit.js +18 -6
  93. package/lib/cjs/inline-edit/InlineEdit.js.map +1 -1
  94. package/lib/cjs/kbd/Kbd.js +5 -3
  95. package/lib/cjs/kbd/Kbd.js.map +1 -1
  96. package/lib/cjs/kbd/stories/kbd.stories.js +1 -1
  97. package/lib/cjs/kbd/stories/kbd.stories.js.map +1 -1
  98. package/lib/cjs/loading-bar/LoadingBar.js +14 -2
  99. package/lib/cjs/loading-bar/LoadingBar.js.map +1 -1
  100. package/lib/cjs/loading-spinner/LoadingSpinner.js +1 -1
  101. package/lib/cjs/loading-spinner/LoadingSpinner.js.map +1 -1
  102. package/lib/cjs/logo/stories/logo.stories.js +1 -1
  103. package/lib/cjs/logo/stories/logo.stories.js.map +1 -1
  104. package/lib/cjs/menu/Menu.js +9 -6
  105. package/lib/cjs/menu/Menu.js.map +1 -1
  106. package/lib/cjs/popover/Popover.js +6 -4
  107. package/lib/cjs/popover/Popover.js.map +1 -1
  108. package/lib/cjs/popover/stories/popover-custom-offset.story.js +2 -1
  109. package/lib/cjs/popover/stories/popover-custom-offset.story.js.map +1 -1
  110. package/lib/cjs/popover/stories/popover-separate-anchor.story.js +1 -1
  111. package/lib/cjs/popover/stories/popover-separate-anchor.story.js.map +1 -1
  112. package/lib/cjs/progress-bar/ProgressBar.js +1 -1
  113. package/lib/cjs/progress-bar/ProgressBar.js.map +1 -1
  114. package/lib/cjs/radio/Radio.js +2 -1
  115. package/lib/cjs/radio/Radio.js.map +1 -1
  116. package/lib/cjs/radio/stories/radio.stories.js +1 -1
  117. package/lib/cjs/radio/stories/radio.stories.js.map +1 -1
  118. package/lib/cjs/select/Overrides.js +1 -1
  119. package/lib/cjs/select/Overrides.js.map +1 -1
  120. package/lib/cjs/select/Select.js +18 -6
  121. package/lib/cjs/select/Select.js.map +1 -1
  122. package/lib/cjs/side-navigation/SideNavigation.js +5 -4
  123. package/lib/cjs/side-navigation/SideNavigation.js.map +1 -1
  124. package/lib/cjs/skeleton/Skeleton.js +14 -2
  125. package/lib/cjs/skeleton/Skeleton.js.map +1 -1
  126. package/lib/cjs/skeleton/stories/skeleton.stories.js +1 -1
  127. package/lib/cjs/skeleton/stories/skeleton.stories.js.map +1 -1
  128. package/lib/cjs/spotlight/Spotlight.js +33 -14
  129. package/lib/cjs/spotlight/Spotlight.js.map +1 -1
  130. package/lib/cjs/spotlight/SpotlightProvider.js +6 -3
  131. package/lib/cjs/spotlight/SpotlightProvider.js.map +1 -1
  132. package/lib/cjs/spotlight/SpotlightTarget.js +14 -2
  133. package/lib/cjs/spotlight/SpotlightTarget.js.map +1 -1
  134. package/lib/cjs/spotlight/SpotlightTour.js +1 -1
  135. package/lib/cjs/spotlight/SpotlightTour.js.map +1 -1
  136. package/lib/cjs/spotlight/stories/spotlight.stories.js +1 -1
  137. package/lib/cjs/spotlight/stories/spotlight.stories.js.map +1 -1
  138. package/lib/cjs/spotlight/use-indicator.js +2 -1
  139. package/lib/cjs/spotlight/use-indicator.js.map +1 -1
  140. package/lib/cjs/status-label/StatusLabel.js +1 -1
  141. package/lib/cjs/status-label/StatusLabel.js.map +1 -1
  142. package/lib/cjs/switch/Switch.js +2 -1
  143. package/lib/cjs/switch/Switch.js.map +1 -1
  144. package/lib/cjs/switch/stories/switch.stories.js +1 -1
  145. package/lib/cjs/switch/stories/switch.stories.js.map +1 -1
  146. package/lib/cjs/tabs/stories/tabs-disabled.story.js +1 -1
  147. package/lib/cjs/tabs/stories/tabs-disabled.story.js.map +1 -1
  148. package/lib/cjs/tabs/stories/tabs-fill-variants.story.js +1 -1
  149. package/lib/cjs/tabs/stories/tabs-fill-variants.story.js.map +1 -1
  150. package/lib/cjs/tabs/stories/tabs-overflow.story.js +1 -1
  151. package/lib/cjs/tabs/stories/tabs-overflow.story.js.map +1 -1
  152. package/lib/cjs/tabs/stories/tabs-sizes.story.js +1 -1
  153. package/lib/cjs/tabs/stories/tabs-sizes.story.js.map +1 -1
  154. package/lib/cjs/tabs/use-tabs-scroll-overflow.js +8 -4
  155. package/lib/cjs/tabs/use-tabs-scroll-overflow.js.map +1 -1
  156. package/lib/cjs/tag/Tag.js +14 -2
  157. package/lib/cjs/tag/Tag.js.map +1 -1
  158. package/lib/cjs/text-area/TextArea.js +14 -2
  159. package/lib/cjs/text-area/TextArea.js.map +1 -1
  160. package/lib/cjs/text-area/stories/text-area.stories.js +1 -1
  161. package/lib/cjs/text-area/stories/text-area.stories.js.map +1 -1
  162. package/lib/cjs/text-input/TextInput.js +14 -2
  163. package/lib/cjs/text-input/TextInput.js.map +1 -1
  164. package/lib/cjs/text-link/TextLink.js +14 -2
  165. package/lib/cjs/text-link/TextLink.js.map +1 -1
  166. package/lib/cjs/text-overflow/TextOverflow.js +2 -1
  167. package/lib/cjs/text-overflow/TextOverflow.js.map +1 -1
  168. package/lib/cjs/text-overflow/stories/text-overflow.stories.js +1 -1
  169. package/lib/cjs/text-overflow/stories/text-overflow.stories.js.map +1 -1
  170. package/lib/cjs/text-overflow/text-overflow-utils.js +12 -6
  171. package/lib/cjs/text-overflow/text-overflow-utils.js.map +1 -1
  172. package/lib/cjs/text-overflow/use-ellipsis-observer.js +2 -1
  173. package/lib/cjs/text-overflow/use-ellipsis-observer.js.map +1 -1
  174. package/lib/cjs/text-overflow/use-truncate-with-button.js +4 -2
  175. package/lib/cjs/text-overflow/use-truncate-with-button.js.map +1 -1
  176. package/lib/cjs/theme/ThemeProvider.js +2 -1
  177. package/lib/cjs/theme/ThemeProvider.js.map +1 -1
  178. package/lib/cjs/time-picker/TimePicker.js +22 -8
  179. package/lib/cjs/time-picker/TimePicker.js.map +1 -1
  180. package/lib/cjs/time-picker/stories/time-picker.stories.js +1 -1
  181. package/lib/cjs/time-picker/stories/time-picker.stories.js.map +1 -1
  182. package/lib/cjs/timezone-picker/TimeZonePicker.js +8 -4
  183. package/lib/cjs/timezone-picker/TimeZonePicker.js.map +1 -1
  184. package/lib/cjs/timezone-picker/generate-timezone-options.js +15 -9
  185. package/lib/cjs/timezone-picker/generate-timezone-options.js.map +1 -1
  186. package/lib/cjs/timezone-picker/stories/timezone-picker.stories.js +1 -1
  187. package/lib/cjs/timezone-picker/stories/timezone-picker.stories.js.map +1 -1
  188. package/lib/cjs/toast/Toast.js +11 -6
  189. package/lib/cjs/toast/Toast.js.map +1 -1
  190. package/lib/cjs/tooltip/Tooltip.js +35 -15
  191. package/lib/cjs/tooltip/Tooltip.js.map +1 -1
  192. package/lib/cjs/tree-view/TreeItemWrapper.js +3 -1
  193. package/lib/cjs/tree-view/TreeItemWrapper.js.map +1 -1
  194. package/lib/cjs/tree-view/TreeView.js +2 -1
  195. package/lib/cjs/tree-view/TreeView.js.map +1 -1
  196. package/lib/cjs/tree-view/TreeViewItem.js +3 -1
  197. package/lib/cjs/tree-view/TreeViewItem.js.map +1 -1
  198. package/lib/cjs/tree-view/TreeViewTextItem.js +1 -2
  199. package/lib/cjs/tree-view/TreeViewTextItem.js.map +1 -1
  200. package/lib/cjs/tree-view/TreeViewTrail.js +14 -2
  201. package/lib/cjs/tree-view/TreeViewTrail.js.map +1 -1
  202. package/lib/cjs/wizard/Wizard.js +3 -2
  203. package/lib/cjs/wizard/Wizard.js.map +1 -1
  204. package/lib/esm/_common/CodeBlockWrapper.js +5 -4
  205. package/lib/esm/_common/CodeBlockWrapper.js.map +1 -1
  206. package/lib/esm/_common/utils.js +4 -2
  207. package/lib/esm/_common/utils.js.map +1 -1
  208. package/lib/esm/accordion/Accordion.js +9 -6
  209. package/lib/esm/accordion/Accordion.js.map +1 -1
  210. package/lib/esm/accordion/accordion-types.js.map +1 -1
  211. package/lib/esm/accordion/stories/accordion.stories.js +1 -1
  212. package/lib/esm/accordion/stories/accordion.stories.js.map +1 -1
  213. package/lib/esm/avatar/Avatar.js +1 -1
  214. package/lib/esm/avatar/Avatar.js.map +1 -1
  215. package/lib/esm/banner/Banner.js +3 -2
  216. package/lib/esm/banner/Banner.js.map +1 -1
  217. package/lib/esm/banner/stories/banner.stories.js +1 -1
  218. package/lib/esm/banner/stories/banner.stories.js.map +1 -1
  219. package/lib/esm/box/Box.js +14 -2
  220. package/lib/esm/box/Box.js.map +1 -1
  221. package/lib/esm/box/stories/box.stories.js +2 -2
  222. package/lib/esm/box/stories/box.stories.js.map +1 -1
  223. package/lib/esm/breadcrumbs/Breadcrumbs.js +10 -7
  224. package/lib/esm/breadcrumbs/Breadcrumbs.js.map +1 -1
  225. package/lib/esm/button/stories/button.stories.js +1 -1
  226. package/lib/esm/button/stories/button.stories.js.map +1 -1
  227. package/lib/esm/checkbox/Checkbox.js +2 -1
  228. package/lib/esm/checkbox/Checkbox.js.map +1 -1
  229. package/lib/esm/checkbox/stories/checkbox.stories.js +1 -1
  230. package/lib/esm/checkbox/stories/checkbox.stories.js.map +1 -1
  231. package/lib/esm/clipboard-button/ClipboardButton.js +6 -3
  232. package/lib/esm/clipboard-button/ClipboardButton.js.map +1 -1
  233. package/lib/esm/color-picker/ColorPicker.js +2 -1
  234. package/lib/esm/color-picker/ColorPicker.js.map +1 -1
  235. package/lib/esm/data-grid/Components.js +9 -6
  236. package/lib/esm/data-grid/Components.js.map +1 -1
  237. package/lib/esm/data-grid/DataGrid.js +16 -4
  238. package/lib/esm/data-grid/DataGrid.js.map +1 -1
  239. package/lib/esm/data-grid/data-grid-nav/data-grid-nav.js +28 -14
  240. package/lib/esm/data-grid/data-grid-nav/data-grid-nav.js.map +1 -1
  241. package/lib/esm/data-grid/data-grid-nav/helpers.js +2 -1
  242. package/lib/esm/data-grid/data-grid-nav/helpers.js.map +1 -1
  243. package/lib/esm/data-grid/stories/datagrid-component-overriding.story.js +1 -3
  244. package/lib/esm/data-grid/stories/datagrid-component-overriding.story.js.map +1 -1
  245. package/lib/esm/data-grid/stories/datagrid-in-dialog.story.js +2 -1
  246. package/lib/esm/data-grid/stories/datagrid-in-dialog.story.js.map +1 -1
  247. package/lib/esm/data-grid/stories/datagrid-keyboard-navigation.story.js +2 -1
  248. package/lib/esm/data-grid/stories/datagrid-keyboard-navigation.story.js.map +1 -1
  249. package/lib/esm/data-grid/stories/datagrid-kitchen-sink.story.js +1 -2
  250. package/lib/esm/data-grid/stories/datagrid-kitchen-sink.story.js.map +1 -1
  251. package/lib/esm/data-grid/stories/datagrid-search-and-filters.stories.js +9 -6
  252. package/lib/esm/data-grid/stories/datagrid-search-and-filters.stories.js.map +1 -1
  253. package/lib/esm/date-picker/DatePicker.js +2 -1
  254. package/lib/esm/date-picker/DatePicker.js.map +1 -1
  255. package/lib/esm/date-picker/stories/date-picker-range.story.js +1 -1
  256. package/lib/esm/date-picker/stories/date-picker-range.story.js.map +1 -1
  257. package/lib/esm/date-picker/stories/date-picker.stories.js +1 -1
  258. package/lib/esm/date-picker/stories/date-picker.stories.js.map +1 -1
  259. package/lib/esm/dialog/Dialog.js +20 -13
  260. package/lib/esm/dialog/Dialog.js.map +1 -1
  261. package/lib/esm/dialog/dialog-context.js +1 -2
  262. package/lib/esm/dialog/dialog-context.js.map +1 -1
  263. package/lib/esm/dialog/stories/dialog.stories.js +1 -1
  264. package/lib/esm/dialog/stories/dialog.stories.js.map +1 -1
  265. package/lib/esm/divider/stories/divider.stories.js +1 -1
  266. package/lib/esm/divider/stories/divider.stories.js.map +1 -1
  267. package/lib/esm/drawer/Drawer.js +9 -8
  268. package/lib/esm/drawer/Drawer.js.map +1 -1
  269. package/lib/esm/dropdown-button/DropdownButton.js +14 -2
  270. package/lib/esm/dropdown-button/DropdownButton.js.map +1 -1
  271. package/lib/esm/dropzone/Dropzone.js +3 -2
  272. package/lib/esm/dropzone/Dropzone.js.map +1 -1
  273. package/lib/esm/dropzone/stories/dropzone-csv-files.story.js +1 -3
  274. package/lib/esm/dropzone/stories/dropzone-csv-files.story.js.map +1 -1
  275. package/lib/esm/dropzone/stories/dropzone-custom-extensions.story.js +1 -3
  276. package/lib/esm/dropzone/stories/dropzone-custom-extensions.story.js.map +1 -1
  277. package/lib/esm/dropzone/stories/dropzone-default.story.js +1 -3
  278. package/lib/esm/dropzone/stories/dropzone-default.story.js.map +1 -1
  279. package/lib/esm/dropzone/stories/dropzone-disabled.story.js +1 -3
  280. package/lib/esm/dropzone/stories/dropzone-disabled.story.js.map +1 -1
  281. package/lib/esm/flex/Flex.js +14 -2
  282. package/lib/esm/flex/Flex.js.map +1 -1
  283. package/lib/esm/graph-label/GraphLabel.js +18 -4
  284. package/lib/esm/graph-label/GraphLabel.js.map +1 -1
  285. package/lib/esm/icon-button/stories/icon-button.stories.js +1 -1
  286. package/lib/esm/icon-button/stories/icon-button.stories.js.map +1 -1
  287. package/lib/esm/icon-button-array/IconButtonArray.js +14 -2
  288. package/lib/esm/icon-button-array/IconButtonArray.js.map +1 -1
  289. package/lib/esm/icon-button-array/index.js +1 -1
  290. package/lib/esm/icon-button-array/index.js.map +1 -1
  291. package/lib/esm/icon-button-array/stories/icon-button-array.stories.js +1 -1
  292. package/lib/esm/icon-button-array/stories/icon-button-array.stories.js.map +1 -1
  293. package/lib/esm/icons/wrapIcon.js +1 -1
  294. package/lib/esm/icons/wrapIcon.js.map +1 -1
  295. package/lib/esm/inline-edit/InlineEdit.js +18 -6
  296. package/lib/esm/inline-edit/InlineEdit.js.map +1 -1
  297. package/lib/esm/kbd/Kbd.js +5 -3
  298. package/lib/esm/kbd/Kbd.js.map +1 -1
  299. package/lib/esm/kbd/stories/kbd.stories.js +1 -1
  300. package/lib/esm/kbd/stories/kbd.stories.js.map +1 -1
  301. package/lib/esm/loading-bar/LoadingBar.js +14 -2
  302. package/lib/esm/loading-bar/LoadingBar.js.map +1 -1
  303. package/lib/esm/loading-spinner/LoadingSpinner.js +1 -1
  304. package/lib/esm/loading-spinner/LoadingSpinner.js.map +1 -1
  305. package/lib/esm/logo/stories/logo.stories.js +1 -1
  306. package/lib/esm/logo/stories/logo.stories.js.map +1 -1
  307. package/lib/esm/menu/Menu.js +9 -6
  308. package/lib/esm/menu/Menu.js.map +1 -1
  309. package/lib/esm/popover/Popover.js +6 -4
  310. package/lib/esm/popover/Popover.js.map +1 -1
  311. package/lib/esm/popover/stories/popover-custom-offset.story.js +2 -1
  312. package/lib/esm/popover/stories/popover-custom-offset.story.js.map +1 -1
  313. package/lib/esm/popover/stories/popover-separate-anchor.story.js +1 -1
  314. package/lib/esm/popover/stories/popover-separate-anchor.story.js.map +1 -1
  315. package/lib/esm/progress-bar/ProgressBar.js +1 -1
  316. package/lib/esm/progress-bar/ProgressBar.js.map +1 -1
  317. package/lib/esm/radio/Radio.js +2 -1
  318. package/lib/esm/radio/Radio.js.map +1 -1
  319. package/lib/esm/radio/stories/radio.stories.js +1 -1
  320. package/lib/esm/radio/stories/radio.stories.js.map +1 -1
  321. package/lib/esm/select/Overrides.js +1 -1
  322. package/lib/esm/select/Overrides.js.map +1 -1
  323. package/lib/esm/select/Select.js +18 -6
  324. package/lib/esm/select/Select.js.map +1 -1
  325. package/lib/esm/side-navigation/SideNavigation.js +5 -4
  326. package/lib/esm/side-navigation/SideNavigation.js.map +1 -1
  327. package/lib/esm/skeleton/Skeleton.js +14 -2
  328. package/lib/esm/skeleton/Skeleton.js.map +1 -1
  329. package/lib/esm/skeleton/stories/skeleton.stories.js +1 -1
  330. package/lib/esm/skeleton/stories/skeleton.stories.js.map +1 -1
  331. package/lib/esm/spotlight/Spotlight.js +33 -14
  332. package/lib/esm/spotlight/Spotlight.js.map +1 -1
  333. package/lib/esm/spotlight/SpotlightProvider.js +6 -3
  334. package/lib/esm/spotlight/SpotlightProvider.js.map +1 -1
  335. package/lib/esm/spotlight/SpotlightTarget.js +14 -2
  336. package/lib/esm/spotlight/SpotlightTarget.js.map +1 -1
  337. package/lib/esm/spotlight/SpotlightTour.js +1 -1
  338. package/lib/esm/spotlight/SpotlightTour.js.map +1 -1
  339. package/lib/esm/spotlight/stories/spotlight.stories.js +1 -1
  340. package/lib/esm/spotlight/stories/spotlight.stories.js.map +1 -1
  341. package/lib/esm/spotlight/use-indicator.js +2 -1
  342. package/lib/esm/spotlight/use-indicator.js.map +1 -1
  343. package/lib/esm/status-label/StatusLabel.js +1 -1
  344. package/lib/esm/status-label/StatusLabel.js.map +1 -1
  345. package/lib/esm/switch/Switch.js +2 -1
  346. package/lib/esm/switch/Switch.js.map +1 -1
  347. package/lib/esm/switch/stories/switch.stories.js +1 -1
  348. package/lib/esm/switch/stories/switch.stories.js.map +1 -1
  349. package/lib/esm/tabs/stories/tabs-disabled.story.js +1 -1
  350. package/lib/esm/tabs/stories/tabs-disabled.story.js.map +1 -1
  351. package/lib/esm/tabs/stories/tabs-fill-variants.story.js +1 -1
  352. package/lib/esm/tabs/stories/tabs-fill-variants.story.js.map +1 -1
  353. package/lib/esm/tabs/stories/tabs-overflow.story.js +1 -1
  354. package/lib/esm/tabs/stories/tabs-overflow.story.js.map +1 -1
  355. package/lib/esm/tabs/stories/tabs-sizes.story.js +1 -1
  356. package/lib/esm/tabs/stories/tabs-sizes.story.js.map +1 -1
  357. package/lib/esm/tabs/use-tabs-scroll-overflow.js +8 -4
  358. package/lib/esm/tabs/use-tabs-scroll-overflow.js.map +1 -1
  359. package/lib/esm/tag/Tag.js +14 -2
  360. package/lib/esm/tag/Tag.js.map +1 -1
  361. package/lib/esm/text-area/TextArea.js +14 -2
  362. package/lib/esm/text-area/TextArea.js.map +1 -1
  363. package/lib/esm/text-area/stories/text-area.stories.js +1 -1
  364. package/lib/esm/text-area/stories/text-area.stories.js.map +1 -1
  365. package/lib/esm/text-input/TextInput.js +14 -2
  366. package/lib/esm/text-input/TextInput.js.map +1 -1
  367. package/lib/esm/text-link/TextLink.js +14 -2
  368. package/lib/esm/text-link/TextLink.js.map +1 -1
  369. package/lib/esm/text-overflow/TextOverflow.js +2 -1
  370. package/lib/esm/text-overflow/TextOverflow.js.map +1 -1
  371. package/lib/esm/text-overflow/stories/text-overflow.stories.js +1 -1
  372. package/lib/esm/text-overflow/stories/text-overflow.stories.js.map +1 -1
  373. package/lib/esm/text-overflow/text-overflow-utils.js +12 -6
  374. package/lib/esm/text-overflow/text-overflow-utils.js.map +1 -1
  375. package/lib/esm/text-overflow/use-ellipsis-observer.js +2 -1
  376. package/lib/esm/text-overflow/use-ellipsis-observer.js.map +1 -1
  377. package/lib/esm/text-overflow/use-truncate-with-button.js +4 -2
  378. package/lib/esm/text-overflow/use-truncate-with-button.js.map +1 -1
  379. package/lib/esm/theme/ThemeProvider.js +2 -1
  380. package/lib/esm/theme/ThemeProvider.js.map +1 -1
  381. package/lib/esm/time-picker/TimePicker.js +22 -8
  382. package/lib/esm/time-picker/TimePicker.js.map +1 -1
  383. package/lib/esm/time-picker/stories/time-picker.stories.js +1 -1
  384. package/lib/esm/time-picker/stories/time-picker.stories.js.map +1 -1
  385. package/lib/esm/timezone-picker/TimeZonePicker.js +8 -4
  386. package/lib/esm/timezone-picker/TimeZonePicker.js.map +1 -1
  387. package/lib/esm/timezone-picker/generate-timezone-options.js +15 -9
  388. package/lib/esm/timezone-picker/generate-timezone-options.js.map +1 -1
  389. package/lib/esm/timezone-picker/stories/timezone-picker.stories.js +1 -1
  390. package/lib/esm/timezone-picker/stories/timezone-picker.stories.js.map +1 -1
  391. package/lib/esm/toast/Toast.js +11 -6
  392. package/lib/esm/toast/Toast.js.map +1 -1
  393. package/lib/esm/tooltip/Tooltip.js +35 -15
  394. package/lib/esm/tooltip/Tooltip.js.map +1 -1
  395. package/lib/esm/tree-view/TreeItemWrapper.js +3 -1
  396. package/lib/esm/tree-view/TreeItemWrapper.js.map +1 -1
  397. package/lib/esm/tree-view/TreeView.js +2 -1
  398. package/lib/esm/tree-view/TreeView.js.map +1 -1
  399. package/lib/esm/tree-view/TreeViewItem.js +3 -1
  400. package/lib/esm/tree-view/TreeViewItem.js.map +1 -1
  401. package/lib/esm/tree-view/TreeViewTextItem.js +1 -2
  402. package/lib/esm/tree-view/TreeViewTextItem.js.map +1 -1
  403. package/lib/esm/tree-view/TreeViewTrail.js +14 -2
  404. package/lib/esm/tree-view/TreeViewTrail.js.map +1 -1
  405. package/lib/esm/wizard/Wizard.js +3 -2
  406. package/lib/esm/wizard/Wizard.js.map +1 -1
  407. package/lib/types/_common/CodeBlockWrapper.d.ts +1 -1
  408. package/lib/types/_common/CodeBlockWrapper.d.ts.map +1 -1
  409. package/lib/types/_common/utils.d.ts.map +1 -1
  410. package/lib/types/accordion/Accordion.d.ts +4 -4
  411. package/lib/types/accordion/Accordion.d.ts.map +1 -1
  412. package/lib/types/accordion/accordion-types.d.ts +1 -1
  413. package/lib/types/accordion/accordion-types.d.ts.map +1 -1
  414. package/lib/types/accordion/stories/accordion.stories.d.ts +4 -4
  415. package/lib/types/avatar/Avatar.d.ts.map +1 -1
  416. package/lib/types/banner/Banner.d.ts +1 -1
  417. package/lib/types/banner/Banner.d.ts.map +1 -1
  418. package/lib/types/box/Box.d.ts +1 -1
  419. package/lib/types/box/Box.d.ts.map +1 -1
  420. package/lib/types/box/stories/box.stories.d.ts +1 -1
  421. package/lib/types/breadcrumbs/Breadcrumbs.d.ts +3 -3
  422. package/lib/types/breadcrumbs/Breadcrumbs.d.ts.map +1 -1
  423. package/lib/types/breadcrumbs/stories/breadcrumbs.stories.d.ts +3 -3
  424. package/lib/types/button/stories/button.stories.d.ts +1 -1
  425. package/lib/types/button/stories/button.stories.d.ts.map +1 -1
  426. package/lib/types/checkbox/Checkbox.d.ts.map +1 -1
  427. package/lib/types/clipboard-button/ClipboardButton.d.ts.map +1 -1
  428. package/lib/types/color-picker/ColorPicker.d.ts.map +1 -1
  429. package/lib/types/data-grid/Components.d.ts.map +1 -1
  430. package/lib/types/data-grid/DataGrid.d.ts +23 -23
  431. package/lib/types/data-grid/DataGrid.d.ts.map +1 -1
  432. package/lib/types/data-grid/data-grid-nav/data-grid-nav.d.ts.map +1 -1
  433. package/lib/types/data-grid/data-grid-nav/helpers.d.ts.map +1 -1
  434. package/lib/types/data-grid/stories/datagrid-component-overriding.story.d.ts.map +1 -1
  435. package/lib/types/data-grid/stories/datagrid-in-dialog.story.d.ts.map +1 -1
  436. package/lib/types/data-grid/stories/datagrid-keyboard-navigation.story.d.ts.map +1 -1
  437. package/lib/types/data-grid/stories/datagrid-kitchen-sink.story.d.ts.map +1 -1
  438. package/lib/types/data-grid/stories/datagrid-pinned-columns.stories.d.ts +1 -1
  439. package/lib/types/data-grid/stories/datagrid-placeholder-states.stories.d.ts +1 -1
  440. package/lib/types/data-grid/stories/datagrid-search-and-filters.stories.d.ts +1 -1
  441. package/lib/types/data-grid/stories/datagrid-search-and-filters.stories.d.ts.map +1 -1
  442. package/lib/types/date-picker/DatePicker.d.ts.map +1 -1
  443. package/lib/types/date-picker/stories/date-picker-range.story.d.ts.map +1 -1
  444. package/lib/types/dialog/Dialog.d.ts +6 -6
  445. package/lib/types/dialog/Dialog.d.ts.map +1 -1
  446. package/lib/types/dialog/dialog-context.d.ts.map +1 -1
  447. package/lib/types/drawer/Drawer.d.ts +3 -3
  448. package/lib/types/drawer/Drawer.d.ts.map +1 -1
  449. package/lib/types/dropdown-button/DropdownButton.d.ts +1 -1
  450. package/lib/types/dropdown-button/DropdownButton.d.ts.map +1 -1
  451. package/lib/types/dropzone/Dropzone.d.ts.map +1 -1
  452. package/lib/types/flex/Flex.d.ts +1 -1
  453. package/lib/types/flex/Flex.d.ts.map +1 -1
  454. package/lib/types/flex/stories/flex.stories.d.ts +1 -1
  455. package/lib/types/graph-label/GraphLabel.d.ts +1 -1
  456. package/lib/types/graph-label/GraphLabel.d.ts.map +1 -1
  457. package/lib/types/icon-button-array/IconButtonArray.d.ts +2 -2
  458. package/lib/types/icon-button-array/IconButtonArray.d.ts.map +1 -1
  459. package/lib/types/icon-button-array/index.d.ts +1 -1
  460. package/lib/types/icon-button-array/index.d.ts.map +1 -1
  461. package/lib/types/inline-edit/InlineEdit.d.ts +1 -1
  462. package/lib/types/inline-edit/InlineEdit.d.ts.map +1 -1
  463. package/lib/types/kbd/Kbd.d.ts.map +1 -1
  464. package/lib/types/loading-bar/LoadingBar.d.ts +1 -1
  465. package/lib/types/loading-bar/LoadingBar.d.ts.map +1 -1
  466. package/lib/types/menu/Menu.d.ts +2 -2
  467. package/lib/types/menu/Menu.d.ts.map +1 -1
  468. package/lib/types/popover/Popover.d.ts +1 -1
  469. package/lib/types/popover/Popover.d.ts.map +1 -1
  470. package/lib/types/popover/stories/popover-custom-offset.story.d.ts.map +1 -1
  471. package/lib/types/radio/Radio.d.ts.map +1 -1
  472. package/lib/types/select/Overrides.d.ts +1 -2
  473. package/lib/types/select/Overrides.d.ts.map +1 -1
  474. package/lib/types/select/Select.d.ts +1 -1
  475. package/lib/types/select/Select.d.ts.map +1 -1
  476. package/lib/types/side-navigation/SideNavigation.d.ts +1 -1
  477. package/lib/types/side-navigation/SideNavigation.d.ts.map +1 -1
  478. package/lib/types/side-navigation/stories/side-nav.stories.d.ts +1 -1
  479. package/lib/types/skeleton/Skeleton.d.ts +1 -1
  480. package/lib/types/skeleton/Skeleton.d.ts.map +1 -1
  481. package/lib/types/skeleton/stories/skeleton.stories.d.ts +1 -1
  482. package/lib/types/spotlight/Spotlight.d.ts +6 -6
  483. package/lib/types/spotlight/Spotlight.d.ts.map +1 -1
  484. package/lib/types/spotlight/SpotlightProvider.d.ts.map +1 -1
  485. package/lib/types/spotlight/SpotlightTarget.d.ts +1 -1
  486. package/lib/types/spotlight/SpotlightTarget.d.ts.map +1 -1
  487. package/lib/types/spotlight/use-indicator.d.ts.map +1 -1
  488. package/lib/types/switch/Switch.d.ts.map +1 -1
  489. package/lib/types/tabs/use-tabs-scroll-overflow.d.ts.map +1 -1
  490. package/lib/types/tag/Tag.d.ts +1 -1
  491. package/lib/types/tag/Tag.d.ts.map +1 -1
  492. package/lib/types/text-area/TextArea.d.ts +1 -1
  493. package/lib/types/text-area/TextArea.d.ts.map +1 -1
  494. package/lib/types/text-input/TextInput.d.ts +1 -1
  495. package/lib/types/text-input/TextInput.d.ts.map +1 -1
  496. package/lib/types/text-link/TextLink.d.ts +1 -1
  497. package/lib/types/text-link/TextLink.d.ts.map +1 -1
  498. package/lib/types/text-overflow/TextOverflow.d.ts.map +1 -1
  499. package/lib/types/text-overflow/text-overflow-utils.d.ts.map +1 -1
  500. package/lib/types/text-overflow/use-ellipsis-observer.d.ts.map +1 -1
  501. package/lib/types/text-overflow/use-truncate-with-button.d.ts.map +1 -1
  502. package/lib/types/theme/ThemeProvider.d.ts.map +1 -1
  503. package/lib/types/time-picker/TimePicker.d.ts +1 -1
  504. package/lib/types/time-picker/TimePicker.d.ts.map +1 -1
  505. package/lib/types/time-picker/stories/time-picker.stories.d.ts +1 -1
  506. package/lib/types/timezone-picker/TimeZonePicker.d.ts.map +1 -1
  507. package/lib/types/timezone-picker/generate-timezone-options.d.ts.map +1 -1
  508. package/lib/types/toast/Toast.d.ts +1 -1
  509. package/lib/types/toast/Toast.d.ts.map +1 -1
  510. package/lib/types/tooltip/Tooltip.d.ts +8 -7
  511. package/lib/types/tooltip/Tooltip.d.ts.map +1 -1
  512. package/lib/types/tree-view/TreeItemWrapper.d.ts.map +1 -1
  513. package/lib/types/tree-view/TreeView.d.ts.map +1 -1
  514. package/lib/types/tree-view/TreeViewItem.d.ts.map +1 -1
  515. package/lib/types/tree-view/TreeViewTrail.d.ts +2 -1
  516. package/lib/types/tree-view/TreeViewTrail.d.ts.map +1 -1
  517. package/lib/types/wizard/Wizard.d.ts +1 -1
  518. package/lib/types/wizard/Wizard.d.ts.map +1 -1
  519. package/package.json +1 -1
  520. package/lib/cjs/dropdown-button/avatar-test.stories.tsx.js +0 -31
  521. package/lib/cjs/dropdown-button/avatar-test.stories.tsx.js.map +0 -1
  522. package/lib/esm/dropdown-button/avatar-test.stories.tsx.js +0 -27
  523. package/lib/esm/dropdown-button/avatar-test.stories.tsx.js.map +0 -1
  524. package/lib/types/dropdown-button/avatar-test.stories.tsx.d.ts +0 -24
  525. package/lib/types/dropdown-button/avatar-test.stories.tsx.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Box.js","sourceRoot":"","sources":["../../../src/box/Box.tsx"],"names":[],"mappings":";;;;AA2BA,4CAAyD;AAmClD,MAAM,GAAG,GAAG,CAAsC,EACvD,EAAE,GAAG,KAAU,EACf,OAAO,EACP,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,cAAc,EACd,GAAG,GACqC,EAAE,EAAE;IAC5C,MAAM,SAAS,GAAsB,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,KAAK,CAAC;IAEjD,MAAM,eAAe,GAAG;QACtB,YAAY,EAAE,IAAA,iBAAS,EAAC,YAAY,EAAE,cAAc,CAAC;QACrD,OAAO,EAAE,IAAA,kBAAU,EAAC,OAAO,EAAE,SAAS,CAAC;QACvC,eAAe,EAAE,IAAA,kBAAU,EAAC,eAAe,EAAE,iBAAiB,CAAC;QAC/D,iBAAiB,EAAE,IAAA,kBAAU,EAAC,iBAAiB,EAAE,mBAAmB,CAAC;QACrE,aAAa,EAAE,IAAA,kBAAU,EAAC,aAAa,EAAE,eAAe,CAAC;QACzD,gBAAgB,EAAE,IAAA,kBAAU,EAAC,gBAAgB,EAAE,kBAAkB,CAAC;QAClE,kBAAkB,EAAE,IAAA,kBAAU,EAAC,kBAAkB,EAAE,oBAAoB,CAAC;KACzE,CAAC;IAEF,OAAO,CACL,uBAAC,SAAS,kBACR,GAAG,EAAE,GAAG,EACR,KAAK,kCAAO,eAAe,GAAK,KAAK,KACjC,cAAc,cAEjB,QAAQ,IACC,CACb,CAAC;AACJ,CAAC,CAAC;AAnCW,QAAA,GAAG,OAmCd","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport type React from 'react';\n\nimport {\n type PolymorphicCommonProps,\n type Radius,\n type Spacing,\n} from '../_common/types';\nimport { getRadius, getSpacing } from '../_common/utils';\n\ntype BaseBoxProps = {\n /**\n * @default tokens.space['4']\n */\n padding?: Spacing;\n /**\n * @default undefined\n */\n paddingBlockStart?: Spacing;\n /**\n * @default undefined\n */\n paddingBlockEnd?: Spacing;\n /**\n * @default undefined\n */\n paddingInline?: Spacing;\n /**\n * @default undefined\n */\n paddingInlineStart?: Spacing;\n /**\n * @default undefined\n */\n paddingInlineEnd?: Spacing;\n /**\n * @default undefined\n */\n borderRadius?: Radius;\n children?: React.ReactNode;\n style?: React.CSSProperties;\n};\n\nexport const Box = <T extends React.ElementType = 'div'>({\n as = 'div' as T,\n padding,\n paddingInline,\n paddingInlineStart,\n paddingInlineEnd,\n paddingBlockEnd,\n paddingBlockStart,\n borderRadius,\n children,\n style,\n htmlAttributes,\n ref,\n}: PolymorphicCommonProps<T, BaseBoxProps>) => {\n const Component: React.ElementType = as ?? 'div';\n\n const additionalStyle = {\n borderRadius: getRadius(borderRadius, 'borderRadius'),\n padding: getSpacing(padding, 'padding'),\n paddingBlockEnd: getSpacing(paddingBlockEnd, 'paddingBlockEnd'),\n paddingBlockStart: getSpacing(paddingBlockStart, 'paddingBlockStart'),\n paddingInline: getSpacing(paddingInline, 'paddingInline'),\n paddingInlineEnd: getSpacing(paddingInlineEnd, 'paddingInlineEnd'),\n paddingInlineStart: getSpacing(paddingInlineStart, 'paddingInlineStart'),\n };\n\n return (\n <Component\n ref={ref}\n style={{ ...additionalStyle, ...style }}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n"]}
1
+ {"version":3,"file":"Box.js","sourceRoot":"","sources":["../../../src/box/Box.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AA2BA,4CAAyD;AAmClD,MAAM,GAAG,GAAG,CAAsC,EAcf,EAAE,EAAE;QAdW,EACvD,EAAE,GAAG,KAAU,EACf,OAAO,EACP,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,cAAc,EACd,GAAG,OAEqC,EADrC,SAAS,cAb2C,kLAcxD,CADa;IAEZ,MAAM,SAAS,GAAsB,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,KAAK,CAAC;IAEjD,MAAM,eAAe,GAAG;QACtB,YAAY,EAAE,IAAA,iBAAS,EAAC,YAAY,EAAE,cAAc,CAAC;QACrD,OAAO,EAAE,IAAA,kBAAU,EAAC,OAAO,EAAE,SAAS,CAAC;QACvC,eAAe,EAAE,IAAA,kBAAU,EAAC,eAAe,EAAE,iBAAiB,CAAC;QAC/D,iBAAiB,EAAE,IAAA,kBAAU,EAAC,iBAAiB,EAAE,mBAAmB,CAAC;QACrE,aAAa,EAAE,IAAA,kBAAU,EAAC,aAAa,EAAE,eAAe,CAAC;QACzD,gBAAgB,EAAE,IAAA,kBAAU,EAAC,gBAAgB,EAAE,kBAAkB,CAAC;QAClE,kBAAkB,EAAE,IAAA,kBAAU,EAAC,kBAAkB,EAAE,oBAAoB,CAAC;KACzE,CAAC;IAEF,OAAO,CACL,uBAAC,SAAS,kBACR,GAAG,EAAE,GAAG,EACR,KAAK,kCAAO,eAAe,GAAK,KAAK,KACjC,SAAS,EACT,cAAc,cAEjB,QAAQ,IACC,CACb,CAAC;AACJ,CAAC,CAAC;AArCW,QAAA,GAAG,OAqCd","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport type React from 'react';\n\nimport {\n type PolymorphicCommonProps,\n type Radius,\n type Spacing,\n} from '../_common/types';\nimport { getRadius, getSpacing } from '../_common/utils';\n\ntype BaseBoxProps = {\n /**\n * @default tokens.space['4']\n */\n padding?: Spacing;\n /**\n * @default undefined\n */\n paddingBlockStart?: Spacing;\n /**\n * @default undefined\n */\n paddingBlockEnd?: Spacing;\n /**\n * @default undefined\n */\n paddingInline?: Spacing;\n /**\n * @default undefined\n */\n paddingInlineStart?: Spacing;\n /**\n * @default undefined\n */\n paddingInlineEnd?: Spacing;\n /**\n * @default undefined\n */\n borderRadius?: Radius;\n children?: React.ReactNode;\n style?: React.CSSProperties;\n};\n\nexport const Box = <T extends React.ElementType = 'div'>({\n as = 'div' as T,\n padding,\n paddingInline,\n paddingInlineStart,\n paddingInlineEnd,\n paddingBlockEnd,\n paddingBlockStart,\n borderRadius,\n children,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, BaseBoxProps>) => {\n const Component: React.ElementType = as ?? 'div';\n\n const additionalStyle = {\n borderRadius: getRadius(borderRadius, 'borderRadius'),\n padding: getSpacing(padding, 'padding'),\n paddingBlockEnd: getSpacing(paddingBlockEnd, 'paddingBlockEnd'),\n paddingBlockStart: getSpacing(paddingBlockStart, 'paddingBlockStart'),\n paddingInline: getSpacing(paddingInline, 'paddingInline'),\n paddingInlineEnd: getSpacing(paddingInlineEnd, 'paddingInlineEnd'),\n paddingInlineStart: getSpacing(paddingInlineStart, 'paddingInlineStart'),\n };\n\n return (\n <Component\n ref={ref}\n style={{ ...additionalStyle, ...style }}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n"]}
@@ -22,8 +22,8 @@
22
22
  "use strict";
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.Default = void 0;
25
- const __1 = require("../../");
26
- const _1 = require("./");
25
+ const __1 = require("../..");
26
+ const _1 = require(".");
27
27
  const componentMeta = {
28
28
  component: __1.Box,
29
29
  id: 'components-box',
@@ -1 +1 @@
1
- {"version":3,"file":"box.stories.js","sourceRoot":"","sources":["../../../../src/box/stories/box.stories.tsx"],"names":[],"mappings":";;;AAsBA,8BAA6B;AAC7B,yBAA+C;AAE/C,MAAM,aAAa,GAAG;IACpB,SAAS,EAAE,OAAG;IACd,EAAE,EAAE,gBAAgB;IACpB,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5B;IACD,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,KAAK,EAAE,gBAAgB;CACG,CAAC;AAE7B,kBAAe,aAAa,CAAC;AAGhB,QAAA,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,QAAQ,EAAE,KAAK;QACf,SAAS,EAAE,8DAA8D;QACzE,OAAO,EAAE,GAAG;KACb;IACD,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,gBAAa;gBACnB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,aAAU;CACnB,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { type Meta, type StoryObj } from '@storybook/react-vite';\n\nimport { Box } from '../../';\nimport { BoxDefault, BoxDefaultSrc } from './';\n\nconst componentMeta = {\n component: Box,\n id: 'components-box',\n parameters: {\n controls: { disable: true },\n },\n tags: ['docsPage'],\n title: 'Components/Box',\n} satisfies Meta<typeof Box>;\n\nexport default componentMeta;\ntype Story = StoryObj<typeof componentMeta>;\n\nexport const Default: Story = {\n args: {\n children: 'Box',\n className: 'n-bg-primary-bg-weak n-border n-border-primary-border-strong',\n padding: '8',\n },\n parameters: {\n docs: {\n source: {\n code: BoxDefaultSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: BoxDefault,\n};\n"]}
1
+ {"version":3,"file":"box.stories.js","sourceRoot":"","sources":["../../../../src/box/stories/box.stories.tsx"],"names":[],"mappings":";;;AAsBA,6BAA4B;AAC5B,wBAA8C;AAE9C,MAAM,aAAa,GAAG;IACpB,SAAS,EAAE,OAAG;IACd,EAAE,EAAE,gBAAgB;IACpB,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5B;IACD,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,KAAK,EAAE,gBAAgB;CACG,CAAC;AAE7B,kBAAe,aAAa,CAAC;AAGhB,QAAA,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,QAAQ,EAAE,KAAK;QACf,SAAS,EAAE,8DAA8D;QACzE,OAAO,EAAE,GAAG;KACb;IACD,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,gBAAa;gBACnB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,aAAU;CACnB,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { type Meta, type StoryObj } from '@storybook/react-vite';\n\nimport { Box } from '../..';\nimport { BoxDefault, BoxDefaultSrc } from '.';\n\nconst componentMeta = {\n component: Box,\n id: 'components-box',\n parameters: {\n controls: { disable: true },\n },\n tags: ['docsPage'],\n title: 'Components/Box',\n} satisfies Meta<typeof Box>;\n\nexport default componentMeta;\ntype Story = StoryObj<typeof componentMeta>;\n\nexport const Default: Story = {\n args: {\n children: 'Box',\n className: 'n-bg-primary-bg-weak n-border n-border-primary-border-strong',\n padding: '8',\n },\n parameters: {\n docs: {\n source: {\n code: BoxDefaultSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: BoxDefault,\n};\n"]}
@@ -39,12 +39,13 @@ const jsx_runtime_1 = require("react/jsx-runtime");
39
39
  const icons_1 = require("@neo4j-ndl/react/icons");
40
40
  const classnames_1 = __importDefault(require("classnames"));
41
41
  const react_1 = require("react");
42
- const BreadcrumbsComponent = ({ children, className, htmlAttributes, style, ref, shouldWrap = true, }) => {
42
+ const BreadcrumbsComponent = (_a) => {
43
+ var { children, className, htmlAttributes, style, ref, shouldWrap = true } = _a, restProps = __rest(_a, ["children", "className", "htmlAttributes", "style", "ref", "shouldWrap"]);
43
44
  const classes = (0, classnames_1.default)('ndl-breadcrumbs', className);
44
45
  const listClasses = (0, classnames_1.default)('ndl-breadcrumbs-list', {
45
46
  'ndl-breadcrumbs-wrap': shouldWrap,
46
47
  });
47
- return ((0, jsx_runtime_1.jsx)("nav", Object.assign({ "aria-label": "Breadcrumb", ref: ref, className: classes, style: style }, htmlAttributes, { children: (0, jsx_runtime_1.jsx)("ol", { className: listClasses, children: children }) })));
48
+ return ((0, jsx_runtime_1.jsx)("nav", Object.assign({ "aria-label": "Breadcrumb", ref: ref, className: classes, style: style }, restProps, htmlAttributes, { children: (0, jsx_runtime_1.jsx)("ol", { className: listClasses, children: children }) })));
48
49
  };
49
50
  const BreadcrumbsItemContext = (0, react_1.createContext)(null);
50
51
  const useBreadcrumbsItemContext = () => {
@@ -55,21 +56,23 @@ const useBreadcrumbsItemContext = () => {
55
56
  return context;
56
57
  };
57
58
  exports.useBreadcrumbsItemContext = useBreadcrumbsItemContext;
58
- const BreadcrumbsItem = ({ children, className, style, htmlAttributes, ref, }) => {
59
+ const BreadcrumbsItem = (_a) => {
60
+ var { children, className, style, htmlAttributes, ref } = _a, restProps = __rest(_a, ["children", "className", "style", "htmlAttributes", "ref"]);
59
61
  const classes = (0, classnames_1.default)('ndl-breadcrumbs-item', className);
60
- return ((0, jsx_runtime_1.jsx)(BreadcrumbsItemContext.Provider, { value: { isInBreadcrumbsItem: true }, children: (0, jsx_runtime_1.jsx)("li", Object.assign({ ref: ref, className: classes, style: style }, htmlAttributes, { children: (0, jsx_runtime_1.jsx)("div", { className: "ndl-breadcrumbs-item-inner", children: children }) })) }));
62
+ return ((0, jsx_runtime_1.jsx)(BreadcrumbsItemContext.Provider, { value: { isInBreadcrumbsItem: true }, children: (0, jsx_runtime_1.jsx)("li", Object.assign({ ref: ref, className: classes, style: style }, htmlAttributes, restProps, { children: (0, jsx_runtime_1.jsx)("div", { className: "ndl-breadcrumbs-item-inner", children: children }) })) }));
61
63
  };
62
64
  const BreadcrumbsButton = (_a) => {
63
65
  var { children, as, className, style, htmlAttributes, ref, leadingElement, trailingElement } = _a, restProps = __rest(_a, ["children", "as", "className", "style", "htmlAttributes", "ref", "leadingElement", "trailingElement"]);
64
66
  (0, exports.useBreadcrumbsItemContext)();
65
67
  const Component = as !== null && as !== void 0 ? as : 'button';
66
68
  const classes = (0, classnames_1.default)('ndl-breadcrumbs-button ndl-breadcrumbs-sibling-hover', className);
67
- return ((0, jsx_runtime_1.jsxs)(Component, Object.assign({ ref: ref, className: classes, style: style }, restProps, htmlAttributes, { children: [Boolean(leadingElement) && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-breadcrumbs-button-leading-element", children: leadingElement })), (0, jsx_runtime_1.jsx)("div", { className: "ndl-breadcrumbs-button-content", children: children }), Boolean(trailingElement) && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-breadcrumbs-button-trailing-element", children: trailingElement }))] })));
69
+ return ((0, jsx_runtime_1.jsxs)(Component, Object.assign({ ref: ref, className: classes, style: style }, htmlAttributes, restProps, { children: [Boolean(leadingElement) && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-breadcrumbs-button-leading-element", children: leadingElement })), (0, jsx_runtime_1.jsx)("div", { className: "ndl-breadcrumbs-button-content", children: children }), Boolean(trailingElement) && ((0, jsx_runtime_1.jsx)("div", { className: "ndl-breadcrumbs-button-trailing-element", children: trailingElement }))] })));
68
70
  };
69
- const BreadcrumbsSelectButton = ({ onClick, children, className, style, htmlAttributes, ariaLabel, ref, }) => {
71
+ const BreadcrumbsSelectButton = (_a) => {
72
+ var { onClick, children, className, style, htmlAttributes, ariaLabel, ref } = _a, restProps = __rest(_a, ["onClick", "children", "className", "style", "htmlAttributes", "ariaLabel", "ref"]);
70
73
  (0, exports.useBreadcrumbsItemContext)();
71
74
  const classes = (0, classnames_1.default)('ndl-breadcrumbs-select', className);
72
- return ((0, jsx_runtime_1.jsx)(BreadcrumbsButton, { ref: ref, as: "button", className: classes, style: style, onClick: onClick, htmlAttributes: Object.assign(Object.assign({}, htmlAttributes), { 'aria-label': ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : htmlAttributes === null || htmlAttributes === void 0 ? void 0 : htmlAttributes['aria-label'] }), leadingElement: (0, jsx_runtime_1.jsx)(icons_1.ChevronDownIconOutline, {}), children: children }));
75
+ return ((0, jsx_runtime_1.jsx)(BreadcrumbsButton, Object.assign({ ref: ref, as: "button", className: classes, style: style, onClick: onClick, htmlAttributes: Object.assign(Object.assign({}, htmlAttributes), { 'aria-label': ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : htmlAttributes === null || htmlAttributes === void 0 ? void 0 : htmlAttributes['aria-label'] }), leadingElement: (0, jsx_runtime_1.jsx)(icons_1.ChevronDownIconOutline, {}) }, restProps, { children: children })));
73
76
  };
74
77
  const BreadcrumbsLink = (_a) => {
75
78
  var { children, as, className, style, htmlAttributes, ariaCurrent = false, ref } = _a, restProps = __rest(_a, ["children", "as", "className", "style", "htmlAttributes", "ariaCurrent", "ref"]);
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumbs.js","sourceRoot":"","sources":["../../../src/breadcrumbs/Breadcrumbs.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,kDAAgE;AAChE,4DAAoC;AAEpC,iCAAkD;AAelD,MAAM,oBAAoB,GAAG,CAAC,EAC5B,QAAQ,EACR,SAAS,EACT,cAAc,EACd,KAAK,EACL,GAAG,EACH,UAAU,GAAG,IAAI,GACoB,EAAE,EAAE;IACzC,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;IACzD,MAAM,WAAW,GAAG,IAAA,oBAAU,EAAC,sBAAsB,EAAE;QACrD,sBAAsB,EAAE,UAAU;KACnC,CAAC,CAAC;IACH,OAAO,CACL,4DACa,YAAY,EACvB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,IACR,cAAc,cAElB,+BAAI,SAAS,EAAE,WAAW,YAAG,QAAQ,GAAM,IACvC,CACP,CAAC;AACJ,CAAC,CAAC;AAMF,MAAM,sBAAsB,GAAG,IAAA,qBAAa,EAC1C,IAAI,CACL,CAAC;AAEK,MAAM,yBA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BAA8B,EAAE,OAAO,CAAC,WAAW,CAAC;KACrD,EACD,SAAS,CACV,CAAC;IAEF,OAAO,CACL,uBAAC,SAAS,kBACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,kBACE,WAAW,IACrB,SAAS,EACT,cAAc,cAEjB,QAAQ,IACC,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,oBAAoB,EAAE;IACtD,MAAM,EAAE,iBAAiB;IACzB,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,eAAe;IACrB,YAAY,EAAE,uBAAuB;CACtC,CAAC,CAAC;AAEM,kCAAW","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 { ChevronDownIconOutline } from '@neo4j-ndl/react/icons';\nimport classNames from 'classnames';\nimport type React from 'react';\nimport { createContext, useContext } from 'react';\n\nimport {\n type CommonProps,\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\n\ntype BreadcrumbsProps = {\n /** Content to be rendered. Should only be `Breadcrumbs.Item`. */\n children?: React.ReactNode;\n /** Additional classnames. */\n shouldWrap?: boolean;\n};\n\nconst BreadcrumbsComponent = ({\n children,\n className,\n htmlAttributes,\n style,\n ref,\n shouldWrap = true,\n}: CommonProps<'nav', BreadcrumbsProps>) => {\n const classes = classNames('ndl-breadcrumbs', className);\n const listClasses = classNames('ndl-breadcrumbs-list', {\n 'ndl-breadcrumbs-wrap': shouldWrap,\n });\n return (\n <nav\n aria-label=\"Breadcrumb\"\n ref={ref}\n className={classes}\n style={style}\n {...htmlAttributes}\n >\n <ol className={listClasses}>{children}</ol>\n </nav>\n );\n};\n\ntype BreadcrumbsItemContextType = {\n isInBreadcrumbsItem: boolean;\n};\n\nconst BreadcrumbsItemContext = createContext<BreadcrumbsItemContextType | null>(\n null,\n);\n\nexport const useBreadcrumbsItemContext = (): BreadcrumbsItemContextType => {\n const context = useContext(BreadcrumbsItemContext);\n if (!context) {\n throw new Error('This component must be used within a <Breadcrumbs.Item>');\n }\n\n return context;\n};\n\ntype BreadcrumbsItemProps = {\n /** Content to be rendered. Should be either `Breadcrumbs.Link`, `Breadcrumbs.Button` or `Breadcrumbs.SelectButton`. */\n children?: React.ReactNode;\n};\n\nconst BreadcrumbsItem = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n}: CommonProps<'li', BreadcrumbsItemProps>) => {\n const classes = classNames('ndl-breadcrumbs-item', className);\n\n return (\n <BreadcrumbsItemContext.Provider value={{ isInBreadcrumbsItem: true }}>\n <li ref={ref} className={classes} style={style} {...htmlAttributes}>\n <div className=\"ndl-breadcrumbs-item-inner\">{children}</div>\n </li>\n </BreadcrumbsItemContext.Provider>\n );\n};\n\ntype InteractiveBreadcrumbProps = {\n /** Content to be rendered. */\n children?: React.ReactNode;\n} & (\n | {\n as: 'button';\n /**\n * Event handler for when the button is clicked. Only applicable if `as` is `'button'`.\n */\n onClick?: (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => void;\n }\n | {\n as: 'a';\n /**\n * The href of the link. Only applicable if `as` is `'a'`.\n */\n href: HtmlAttributes<'a'>['href'];\n /**\n * The target of the link. Only applicable if `as` is `'a'`.\n */\n target?: HtmlAttributes<'a'>['target'];\n }\n | {\n /**\n * What HTML element to render the root element as.\n */\n as?: React.ElementType;\n }\n);\n\ntype BreadcrumbsButtonProps = InteractiveBreadcrumbProps & {\n /** Leading element to be rendered. */\n leadingElement?: React.ReactNode;\n /** Trailing element to be rendered. */\n trailingElement?: React.ReactNode;\n};\n\nconst BreadcrumbsButton = <T extends React.ElementType = 'button'>({\n children,\n as,\n className,\n style,\n htmlAttributes,\n ref,\n leadingElement,\n trailingElement,\n ...restProps\n}: PolymorphicCommonProps<T, BreadcrumbsButtonProps>) => {\n useBreadcrumbsItemContext();\n\n const Component: React.ElementType = as ?? 'button';\n\n const classes = classNames(\n 'ndl-breadcrumbs-button ndl-breadcrumbs-sibling-hover',\n className,\n );\n\n return (\n <Component\n ref={ref}\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n {Boolean(leadingElement) && (\n <div className=\"ndl-breadcrumbs-button-leading-element\">\n {leadingElement}\n </div>\n )}\n <div className=\"ndl-breadcrumbs-button-content\">{children}</div>\n {Boolean(trailingElement) && (\n <div className=\"ndl-breadcrumbs-button-trailing-element\">\n {trailingElement}\n </div>\n )}\n </Component>\n );\n};\n\ntype BreadcrumbsSelectButtonProps = {\n /** Event handler for when the button is clicked. Should be used to open a `Menu`. */\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /** Aria label needed for accessibility. */\n ariaLabel: string;\n /** Content to be rendered. */\n children?: React.ReactNode;\n /** Additional classnames. */\n className?: string;\n /** Additional css styling. */\n style?: React.CSSProperties;\n /** HTML attributes. */\n htmlAttributes?: HtmlAttributes<'button'>;\n};\n\nconst BreadcrumbsSelectButton = ({\n onClick,\n children,\n className,\n style,\n htmlAttributes,\n ariaLabel,\n ref,\n}: CommonProps<'button', BreadcrumbsSelectButtonProps>) => {\n useBreadcrumbsItemContext();\n\n const classes = classNames('ndl-breadcrumbs-select', className);\n\n return (\n <BreadcrumbsButton\n ref={ref}\n as=\"button\"\n className={classes}\n style={style}\n onClick={onClick}\n htmlAttributes={{\n ...htmlAttributes,\n 'aria-label': ariaLabel ?? htmlAttributes?.['aria-label'],\n }}\n leadingElement={<ChevronDownIconOutline />}\n >\n {children}\n </BreadcrumbsButton>\n );\n};\n\ntype BreadcrumbsLinkProps = InteractiveBreadcrumbProps & {\n /**\n * Whether the link is the current item. Use `'page'` if it indicates the current page and `'step'` for steps (in a multi-step wizard for example).\n * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current\n */\n ariaCurrent?: React.AriaAttributes['aria-current'];\n};\n\nconst BreadcrumbsLink = <T extends React.ElementType = 'a'>({\n children,\n as,\n className,\n style,\n htmlAttributes,\n ariaCurrent = false,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, BreadcrumbsLinkProps>) => {\n useBreadcrumbsItemContext();\n\n const Component: React.ElementType = as ?? 'a';\n\n const classes = classNames(\n 'ndl-breadcrumbs-link',\n {\n 'ndl-breadcrumbs-link-current': Boolean(ariaCurrent),\n },\n className,\n );\n\n return (\n <Component\n ref={ref}\n className={classes}\n style={style}\n aria-current={ariaCurrent}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst Breadcrumbs = Object.assign(BreadcrumbsComponent, {\n Button: BreadcrumbsButton,\n Item: BreadcrumbsItem,\n Link: BreadcrumbsLink,\n SelectButton: BreadcrumbsSelectButton,\n});\n\nexport { Breadcrumbs };\n"]}
1
+ {"version":3,"file":"Breadcrumbs.js","sourceRoot":"","sources":["../../../src/breadcrumbs/Breadcrumbs.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,kDAAgE;AAChE,4DAAoC;AAEpC,iCAAkD;AAelD,MAAM,oBAAoB,GAAG,CAAC,EAQS,EAAE,EAAE;QARb,EAC5B,QAAQ,EACR,SAAS,EACT,cAAc,EACd,KAAK,EACL,GAAG,EACH,UAAU,GAAG,IAAI,OAEoB,EADlC,SAAS,cAPgB,yEAQ7B,CADa;IAEZ,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,iBAAiB,EAAE,SAAS,CAAC,CAA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,cAAc,uBAAd,cAAc,CAAG,YAAY,CAAC,KAE3D,cAAc,EAAE,uBAAC,8BAAsB,KAAG,IACtC,SAAS,cAEZ,QAAQ,IACS,CACrB,CAAC;AACJ,CAAC,CAAC;AAUF,MAAM,eAAe,GAAG,CAAoC,EASV,EAAE,EAAE;QATM,EAC1D,QAAQ,EACR,EAAE,EACF,SAAS,EACT,KAAK,EACL,cAAc,EACd,WAAW,GAAG,KAAK,EACnB,GAAG,OAE6C,EAD7C,SAAS,cAR8C,gFAS3D,CADa;IAEZ,IAAA,iCAAyB,GAAE,CAAC;IAE5B,MAAM,SAAS,GAAsB,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,GAAG,CAAC;IAE/C,MAAM,OAAO,GAAG,IAAA,oBAAU,EACxB,sBAAsB,EACtB;QACE,8BAA8B,EAAE,OAAO,CAAC,WAAW,CAAC;KACrD,EACD,SAAS,CACV,CAAC;IAEF,OAAO,CACL,uBAAC,SAAS,kBACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,KAAK,kBACE,WAAW,IACrB,SAAS,EACT,cAAc,cAEjB,QAAQ,IACC,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,oBAAoB,EAAE;IACtD,MAAM,EAAE,iBAAiB;IACzB,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,eAAe;IACrB,YAAY,EAAE,uBAAuB;CACtC,CAAC,CAAC;AAEM,kCAAW","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 { ChevronDownIconOutline } from '@neo4j-ndl/react/icons';\nimport classNames from 'classnames';\nimport type React from 'react';\nimport { createContext, useContext } from 'react';\n\nimport {\n type CommonProps,\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\n\ntype BreadcrumbsProps = {\n /** Content to be rendered. Should only be `Breadcrumbs.Item`. */\n children?: React.ReactNode;\n /** Additional classnames. */\n shouldWrap?: boolean;\n};\n\nconst BreadcrumbsComponent = ({\n children,\n className,\n htmlAttributes,\n style,\n ref,\n shouldWrap = true,\n ...restProps\n}: CommonProps<'nav', BreadcrumbsProps>) => {\n const classes = classNames('ndl-breadcrumbs', className);\n const listClasses = classNames('ndl-breadcrumbs-list', {\n 'ndl-breadcrumbs-wrap': shouldWrap,\n });\n return (\n <nav\n aria-label=\"Breadcrumb\"\n ref={ref}\n className={classes}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <ol className={listClasses}>{children}</ol>\n </nav>\n );\n};\n\ntype BreadcrumbsItemContextType = {\n isInBreadcrumbsItem: boolean;\n};\n\nconst BreadcrumbsItemContext = createContext<BreadcrumbsItemContextType | null>(\n null,\n);\n\nexport const useBreadcrumbsItemContext = (): BreadcrumbsItemContextType => {\n const context = useContext(BreadcrumbsItemContext);\n if (!context) {\n throw new Error('This component must be used within a <Breadcrumbs.Item>');\n }\n\n return context;\n};\n\ntype BreadcrumbsItemProps = {\n /** Content to be rendered. Should be either `Breadcrumbs.Link`, `Breadcrumbs.Button` or `Breadcrumbs.SelectButton`. */\n children?: React.ReactNode;\n};\n\nconst BreadcrumbsItem = ({\n children,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'li', BreadcrumbsItemProps>) => {\n const classes = classNames('ndl-breadcrumbs-item', className);\n\n return (\n <BreadcrumbsItemContext.Provider value={{ isInBreadcrumbsItem: true }}>\n <li\n ref={ref}\n className={classes}\n style={style}\n {...htmlAttributes}\n {...restProps}\n >\n <div className=\"ndl-breadcrumbs-item-inner\">{children}</div>\n </li>\n </BreadcrumbsItemContext.Provider>\n );\n};\n\ntype InteractiveBreadcrumbProps = {\n /** Content to be rendered. */\n children?: React.ReactNode;\n} & (\n | {\n as: 'button';\n /**\n * Event handler for when the button is clicked. Only applicable if `as` is `'button'`.\n */\n onClick?: (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => void;\n }\n | {\n as: 'a';\n /**\n * The href of the link. Only applicable if `as` is `'a'`.\n */\n href: HtmlAttributes<'a'>['href'];\n /**\n * The target of the link. Only applicable if `as` is `'a'`.\n */\n target?: HtmlAttributes<'a'>['target'];\n }\n | {\n /**\n * What HTML element to render the root element as.\n */\n as?: React.ElementType;\n }\n);\n\ntype BreadcrumbsButtonProps = InteractiveBreadcrumbProps & {\n /** Leading element to be rendered. */\n leadingElement?: React.ReactNode;\n /** Trailing element to be rendered. */\n trailingElement?: React.ReactNode;\n};\n\nconst BreadcrumbsButton = <T extends React.ElementType = 'button'>({\n children,\n as,\n className,\n style,\n htmlAttributes,\n ref,\n leadingElement,\n trailingElement,\n ...restProps\n}: PolymorphicCommonProps<T, BreadcrumbsButtonProps>) => {\n useBreadcrumbsItemContext();\n\n const Component: React.ElementType = as ?? 'button';\n\n const classes = classNames(\n 'ndl-breadcrumbs-button ndl-breadcrumbs-sibling-hover',\n className,\n );\n\n return (\n <Component\n ref={ref}\n className={classes}\n style={style}\n {...htmlAttributes}\n {...restProps}\n >\n {Boolean(leadingElement) && (\n <div className=\"ndl-breadcrumbs-button-leading-element\">\n {leadingElement}\n </div>\n )}\n <div className=\"ndl-breadcrumbs-button-content\">{children}</div>\n {Boolean(trailingElement) && (\n <div className=\"ndl-breadcrumbs-button-trailing-element\">\n {trailingElement}\n </div>\n )}\n </Component>\n );\n};\n\ntype BreadcrumbsSelectButtonProps = {\n /** Event handler for when the button is clicked. Should be used to open a `Menu`. */\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /** Aria label needed for accessibility. */\n ariaLabel: string;\n /** Content to be rendered. */\n children?: React.ReactNode;\n /** Additional classnames. */\n className?: string;\n /** Additional css styling. */\n style?: React.CSSProperties;\n /** HTML attributes. */\n htmlAttributes?: HtmlAttributes<'button'>;\n};\n\nconst BreadcrumbsSelectButton = ({\n onClick,\n children,\n className,\n style,\n htmlAttributes,\n ariaLabel,\n ref,\n ...restProps\n}: CommonProps<'button', BreadcrumbsSelectButtonProps>) => {\n useBreadcrumbsItemContext();\n\n const classes = classNames('ndl-breadcrumbs-select', className);\n\n return (\n <BreadcrumbsButton\n ref={ref}\n as=\"button\"\n className={classes}\n style={style}\n onClick={onClick}\n htmlAttributes={{\n ...htmlAttributes,\n 'aria-label': ariaLabel ?? htmlAttributes?.['aria-label'],\n }}\n leadingElement={<ChevronDownIconOutline />}\n {...restProps}\n >\n {children}\n </BreadcrumbsButton>\n );\n};\n\ntype BreadcrumbsLinkProps = InteractiveBreadcrumbProps & {\n /**\n * Whether the link is the current item. Use `'page'` if it indicates the current page and `'step'` for steps (in a multi-step wizard for example).\n * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current\n */\n ariaCurrent?: React.AriaAttributes['aria-current'];\n};\n\nconst BreadcrumbsLink = <T extends React.ElementType = 'a'>({\n children,\n as,\n className,\n style,\n htmlAttributes,\n ariaCurrent = false,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, BreadcrumbsLinkProps>) => {\n useBreadcrumbsItemContext();\n\n const Component: React.ElementType = as ?? 'a';\n\n const classes = classNames(\n 'ndl-breadcrumbs-link',\n {\n 'ndl-breadcrumbs-link-current': Boolean(ariaCurrent),\n },\n className,\n );\n\n return (\n <Component\n ref={ref}\n className={classes}\n style={style}\n aria-current={ariaCurrent}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n\nconst Breadcrumbs = Object.assign(BreadcrumbsComponent, {\n Button: BreadcrumbsButton,\n Item: BreadcrumbsItem,\n Link: BreadcrumbsLink,\n SelectButton: BreadcrumbsSelectButton,\n});\n\nexport { Breadcrumbs };\n"]}
@@ -23,10 +23,10 @@
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.Floating = exports.Disabled = exports.Loading = exports.Variants = exports.Fluid = exports.WithLeadingVisual = exports.Sizes = void 0;
25
25
  const jsx_runtime_1 = require("react/jsx-runtime");
26
- const button_1 = require("../../button");
26
+ const __1 = require("..");
27
27
  const _1 = require(".");
28
28
  const componentMeta = {
29
- component: button_1.ButtonBase,
29
+ component: __1.ButtonBase,
30
30
  decorators: [
31
31
  (Story) => ((0, jsx_runtime_1.jsx)("div", { className: "n-flex n-justify-center n-w-full", children: (0, jsx_runtime_1.jsx)(Story, {}) })),
32
32
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"button.stories.js","sourceRoot":"","sources":["../../../../src/button/stories/button.stories.tsx"],"names":[],"mappings":";;;;AAuBA,yCAA0C;AAC1C,wBAeW;AAEX,MAAM,aAAa,GAA4B;IAC7C,SAAS,EAAE,mBAAU;IACrB,UAAU,EAAE;QACV,CAAC,KAAK,EAAE,EAAE,CAAC,CACT,gCAAK,SAAS,EAAC,kCAAkC,YAC/C,uBAAC,KAAK,KAAG,GACL,CACP;KACF;IACD,EAAE,EAAE,mBAAmB;IACvB,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5B;IACD,KAAK,EAAE,mBAAmB;CACO,CAAC;AAEpC,kBAAe,aAAa,CAAC;AAGhB,QAAA,KAAK,GAAU;IAC1B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,iBAAc;gBACpB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,cAAW;CACpB,CAAC;AAEW,QAAA,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EAAE;gBACN,IAAI,EAAE,oBAAiB;gBACvB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,iBAAc;CACvB,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 { type Meta, type StoryObj } from '@storybook/react-vite';\n\nimport { ButtonBase } from '../../button';\nimport {\n ButtonDisabled,\n ButtonDisabledSrc,\n ButtonFloating,\n ButtonFloatingSrc,\n ButtonFluid,\n ButtonFluidSrc,\n ButtonLeadingIcon,\n ButtonLeadingIconSrc,\n ButtonLoading,\n ButtonLoadingSrc,\n ButtonSizes,\n ButtonSizesSrc,\n ButtonVariants,\n ButtonVariantsSrc,\n} from '.';\n\nconst componentMeta: Meta<typeof ButtonBase> = {\n component: ButtonBase,\n decorators: [\n (Story) => (\n <div className=\"n-flex n-justify-center n-w-full\">\n <Story />\n </div>\n ),\n ],\n id: 'components-button',\n parameters: {\n controls: { disable: true },\n },\n title: 'Components/Button',\n} satisfies Meta<typeof ButtonBase>;\n\nexport default componentMeta;\ntype Story = StoryObj<typeof componentMeta>;\n\nexport const Sizes: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ButtonSizesSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ButtonSizes,\n};\n\nexport const WithLeadingVisual: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ButtonLeadingIconSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ButtonLeadingIcon,\n};\n\nexport const Fluid: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ButtonFluidSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ButtonFluid,\n};\n\nexport const Variants: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ButtonVariantsSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ButtonVariants,\n};\n\nexport const Loading: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ButtonLoadingSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ButtonLoading,\n};\n\nexport const Disabled: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ButtonDisabledSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ButtonDisabled,\n};\n\nexport const Floating: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ButtonFloatingSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ButtonFloating,\n};\n"]}
1
+ {"version":3,"file":"button.stories.js","sourceRoot":"","sources":["../../../../src/button/stories/button.stories.tsx"],"names":[],"mappings":";;;;AAuBA,0BAAgC;AAChC,wBAeW;AAEX,MAAM,aAAa,GAA4B;IAC7C,SAAS,EAAE,cAAU;IACrB,UAAU,EAAE;QACV,CAAC,KAAK,EAAE,EAAE,CAAC,CACT,gCAAK,SAAS,EAAC,kCAAkC,YAC/C,uBAAC,KAAK,KAAG,GACL,CACP;KACF;IACD,EAAE,EAAE,mBAAmB;IACvB,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5B;IACD,KAAK,EAAE,mBAAmB;CACO,CAAC;AAEpC,kBAAe,aAAa,CAAC;AAGhB,QAAA,KAAK,GAAU;IAC1B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,iBAAc;gBACpB,QAA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AAC;AAEW,QAAA,QAAQ,GAAU;IAC7B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,oBAAiB;gBACvB,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,iBAAc;CACvB,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 { type Meta, type StoryObj } from '@storybook/react-vite';\n\nimport { ButtonBase } from '..';\nimport {\n ButtonDisabled,\n ButtonDisabledSrc,\n ButtonFloating,\n ButtonFloatingSrc,\n ButtonFluid,\n ButtonFluidSrc,\n ButtonLeadingIcon,\n ButtonLeadingIconSrc,\n ButtonLoading,\n ButtonLoadingSrc,\n ButtonSizes,\n ButtonSizesSrc,\n ButtonVariants,\n ButtonVariantsSrc,\n} from '.';\n\nconst componentMeta: Meta<typeof ButtonBase> = {\n component: ButtonBase,\n decorators: [\n (Story) => (\n <div className=\"n-flex n-justify-center n-w-full\">\n <Story />\n </div>\n ),\n ],\n id: 'components-button',\n parameters: {\n controls: { disable: true },\n },\n title: 'Components/Button',\n} satisfies Meta<typeof ButtonBase>;\n\nexport default componentMeta;\ntype Story = StoryObj<typeof componentMeta>;\n\nexport const Sizes: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ButtonSizesSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ButtonSizes,\n};\n\nexport const WithLeadingVisual: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ButtonLeadingIconSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ButtonLeadingIcon,\n};\n\nexport const Fluid: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ButtonFluidSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ButtonFluid,\n};\n\nexport const Variants: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ButtonVariantsSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ButtonVariants,\n};\n\nexport const Loading: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ButtonLoadingSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ButtonLoading,\n};\n\nexport const Disabled: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ButtonDisabledSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ButtonDisabled,\n};\n\nexport const Floating: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: ButtonFloatingSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: ButtonFloating,\n};\n"]}
@@ -66,8 +66,9 @@ const Checkbox = (_a) => {
66
66
  }, [isIndeterminate]);
67
67
  /** TODO: Label handling. We can get rid of this annoying stuff as soon as we do proper form control. */
68
68
  const labelContent = (0, react_2.useMemo)(() => {
69
- if (Boolean(label) === false)
69
+ if (Boolean(label) === false) {
70
70
  return null;
71
+ }
71
72
  if (typeof label === 'string') {
72
73
  return ((0, jsx_runtime_1.jsx)("span", { title: label, className: "ndl-checkbox-label-text", children: label }));
73
74
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../src/checkbox/Checkbox.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,8CAAkD;AAClD,4DAAoC;AACpC,iCAAmD;A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AE;QAChC,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK;YAAE,OAAO,IAAI,CAAC;QAE1C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,OAAO,CACL,iCAAM,KAAK,EAAE,KAAK,EAAE,SAAS,EAAC,yBAAyB,YACpD,KAAK,GACD,CACR,CAAC;QACJ,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,KAAK,EAAE,CAAC;YAC7D,IAAA,4BAAoB,EAClB,+GAA+G,CAChH,CAAC;QACJ,CAAC;IACH,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAEvB,OAAO,CACL,mCAAO,SAAS,EAAE,oBAAoB,aACnC,eAAe,KAAK,IAAI,IAAI,YAAY,EACzC,gDACE,GAAG,EAAE,UAAU,EACf,IAAI,EAAC,UAAU,gBACH,SAAS,EACrB,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,gBAAgB,EAC1B,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,eAAe,IACtB,SAAS,EACT,cAAc,EAClB,EACD,OAAO,CAAC,eAAe,CAAC,KAAK,KAAK,IAAI,YAAY,IAC7C,CACT,CAAC;AACJ,CAAC,CAAC;AArFW,QAAA,QAAQ,YAqFnB","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 { useMergeRefs } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { useEffect, useMemo, useRef } from 'react';\n\nimport { type CommonProps, type HtmlAttributes } from '../_common/types';\nimport { useSemiControlledInput } from '../_common/use-semi-controlled-input';\nimport { needleWarningMessage } from '../_common/utils';\n\ntype CheckboxProps = {\n /** Whether the checkbox is checked */\n isChecked?: boolean;\n /** Checks the input by default in uncontrolled mode */\n isDefaultChecked?: boolean; // isDefaultChecked sounds weird to me?\n /** Whether the checkbox is indeterminate */\n isIndeterminate?: boolean;\n /** Whether the checkbox is disabled */\n isDisabled?: boolean;\n /** Whether the checkbox & label should take the full available width of its container */\n isFluid?: boolean;\n /** The value of the checkbox */\n value?: HtmlAttributes<'input'>['value']; // should this be required?\n /** Whether the label should be displayed before the checkbox */\n hasLeadingLabel?: boolean;\n /** The callback function triggered when the checkbox value changes */\n onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;\n /** The callback function triggered when the checkbox is clicked */\n onClick?: (event: React.MouseEvent<HTMLInputElement>) => void;\n} & (\n | {\n /** The aria label of the checkbox. Required if the label is not a string. */\n ariaLabel: string;\n /** The label of the checkbox. If not a string, supply an aria label for screen reader support. */\n label?: undefined;\n }\n | {\n ariaLabel?: string;\n label: React.ReactNode;\n }\n);\n\nexport const Checkbox = ({\n isChecked,\n isDefaultChecked,\n isIndeterminate = false,\n isFluid = false,\n isDisabled = false,\n hasLeadingLabel,\n ariaLabel,\n onChange,\n onClick,\n value,\n label,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'input', CheckboxProps>) => {\n const internalRef = useRef<HTMLInputElement>(null);\n const mergedRefs = useMergeRefs([internalRef, ref]);\n\n const [isCheckedState, internalOnChange] = useSemiControlledInput({\n inputType: 'checkbox',\n isControlled: isChecked !== undefined,\n onChange,\n state: isChecked ?? isDefaultChecked ?? false,\n });\n\n const labelWrappingClasses = classNames('ndl-checkbox-label', {\n 'ndl-disabled': isDisabled,\n 'ndl-fluid': isFluid,\n });\n\n const checkboxClasses = classNames('ndl-checkbox', className, {\n 'ndl-disabled': isDisabled,\n });\n\n useEffect(() => {\n if (internalRef.current) {\n internalRef.current.indeterminate = isIndeterminate;\n }\n }, [isIndeterminate]);\n\n /** TODO: Label handling. We can get rid of this annoying stuff as soon as we do proper form control. */\n const labelContent = useMemo(() => {\n if (Boolean(label) === false) return null;\n\n if (typeof label === 'string') {\n return (\n <span title={label} className=\"ndl-checkbox-label-text\">\n {label}\n </span>\n );\n }\n return label;\n }, [label]);\n\n useEffect(() => {\n if (Boolean(label) === false && Boolean(ariaLabel) === false) {\n needleWarningMessage(\n 'Checkbox needs a valid label or ariaLabel: https://dequeuniversity.com/rules/axe/4.2/label?application=axeAPI',\n );\n }\n }, [ariaLabel, label]);\n\n return (\n <label className={labelWrappingClasses}>\n {hasLeadingLabel === true && labelContent}\n <input\n ref={mergedRefs}\n type=\"checkbox\"\n aria-label={ariaLabel}\n disabled={isDisabled}\n checked={isCheckedState}\n onClick={onClick}\n onChange={internalOnChange}\n value={value}\n style={style}\n className={checkboxClasses}\n {...restProps}\n {...htmlAttributes}\n />\n {Boolean(hasLeadingLabel) === false && labelContent}\n </label>\n );\n};\n"]}
1
+ {"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../src/checkbox/Checkbox.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,8CAAkD;AAClD,4DAAoC;AACpC,iCAAmD;AAGnD,oFAA8E;AAC9E,4CAAwD;AAkCjD,MAAM,QAAQ,GAAG,CAAC,EAiBa,EAAE,EAAE;;QAjBjB,EACvB,SAAS,EACT,gBAAgB,EAChB,eAA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,QAAQ,EAAE,CAAC;YAC9B,OAAO,CACL,iCAAM,KAAK,EAAE,KAAK,EAAE,SAAS,EAAC,yBAAyB,YACpD,KAAK,GACD,CACR,CAAC;QACJ,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,KAAK,EAAE,CAAC;YAC7D,IAAA,4BAAoB,EAClB,+GAA+G,CAChH,CAAC;QACJ,CAAC;IACH,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAEvB,OAAO,CACL,mCAAO,SAAS,EAAE,oBAAoB,aACnC,eAAe,KAAK,IAAI,IAAI,YAAY,EACzC,gDACE,GAAG,EAAE,UAAU,EACf,IAAI,EAAC,UAAU,gBACH,SAAS,EACrB,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,gBAAgB,EAC1B,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,eAAe,IACtB,SAAS,EACT,cAAc,EAClB,EACD,OAAO,CAAC,eAAe,CAAC,KAAK,KAAK,IAAI,YAAY,IAC7C,CACT,CAAC;AACJ,CAAC,CAAC;AAvFW,QAAA,QAAQ,YAuFnB","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 { useMergeRefs } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { useEffect, useMemo, useRef } from 'react';\n\nimport { type CommonProps, type HtmlAttributes } from '../_common/types';\nimport { useSemiControlledInput } from '../_common/use-semi-controlled-input';\nimport { needleWarningMessage } from '../_common/utils';\n\ntype CheckboxProps = {\n /** Whether the checkbox is checked */\n isChecked?: boolean;\n /** Checks the input by default in uncontrolled mode */\n isDefaultChecked?: boolean; // isDefaultChecked sounds weird to me?\n /** Whether the checkbox is indeterminate */\n isIndeterminate?: boolean;\n /** Whether the checkbox is disabled */\n isDisabled?: boolean;\n /** Whether the checkbox & label should take the full available width of its container */\n isFluid?: boolean;\n /** The value of the checkbox */\n value?: HtmlAttributes<'input'>['value']; // should this be required?\n /** Whether the label should be displayed before the checkbox */\n hasLeadingLabel?: boolean;\n /** The callback function triggered when the checkbox value changes */\n onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;\n /** The callback function triggered when the checkbox is clicked */\n onClick?: (event: React.MouseEvent<HTMLInputElement>) => void;\n} & (\n | {\n /** The aria label of the checkbox. Required if the label is not a string. */\n ariaLabel: string;\n /** The label of the checkbox. If not a string, supply an aria label for screen reader support. */\n label?: undefined;\n }\n | {\n ariaLabel?: string;\n label: React.ReactNode;\n }\n);\n\nexport const Checkbox = ({\n isChecked,\n isDefaultChecked,\n isIndeterminate = false,\n isFluid = false,\n isDisabled = false,\n hasLeadingLabel,\n ariaLabel,\n onChange,\n onClick,\n value,\n label,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: CommonProps<'input', CheckboxProps>) => {\n const internalRef = useRef<HTMLInputElement>(null);\n const mergedRefs = useMergeRefs([internalRef, ref]);\n\n const [isCheckedState, internalOnChange] = useSemiControlledInput({\n inputType: 'checkbox',\n isControlled: isChecked !== undefined,\n onChange,\n state: isChecked ?? isDefaultChecked ?? false,\n });\n\n const labelWrappingClasses = classNames('ndl-checkbox-label', {\n 'ndl-disabled': isDisabled,\n 'ndl-fluid': isFluid,\n });\n\n const checkboxClasses = classNames('ndl-checkbox', className, {\n 'ndl-disabled': isDisabled,\n });\n\n useEffect(() => {\n if (internalRef.current) {\n internalRef.current.indeterminate = isIndeterminate;\n }\n }, [isIndeterminate]);\n\n /** TODO: Label handling. We can get rid of this annoying stuff as soon as we do proper form control. */\n const labelContent = useMemo(() => {\n if (Boolean(label) === false) {\n return null;\n }\n\n if (typeof label === 'string') {\n return (\n <span title={label} className=\"ndl-checkbox-label-text\">\n {label}\n </span>\n );\n }\n return label;\n }, [label]);\n\n useEffect(() => {\n if (Boolean(label) === false && Boolean(ariaLabel) === false) {\n needleWarningMessage(\n 'Checkbox needs a valid label or ariaLabel: https://dequeuniversity.com/rules/axe/4.2/label?application=axeAPI',\n );\n }\n }, [ariaLabel, label]);\n\n return (\n <label className={labelWrappingClasses}>\n {hasLeadingLabel === true && labelContent}\n <input\n ref={mergedRefs}\n type=\"checkbox\"\n aria-label={ariaLabel}\n disabled={isDisabled}\n checked={isCheckedState}\n onClick={onClick}\n onChange={internalOnChange}\n value={value}\n style={style}\n className={checkboxClasses}\n {...restProps}\n {...htmlAttributes}\n />\n {Boolean(hasLeadingLabel) === false && labelContent}\n </label>\n );\n};\n"]}
@@ -24,7 +24,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
24
24
  exports.Controlled = exports.Full = exports.Disabled = exports.HasLeadingLabel = exports.NoLabel = exports.Indeterminate = exports.Default = void 0;
25
25
  const jsx_runtime_1 = require("react/jsx-runtime");
26
26
  const index_1 = require("../../index");
27
- const _1 = require("./");
27
+ const _1 = require(".");
28
28
  const componentMeta = {
29
29
  title: 'Components/Checkbox',
30
30
  id: 'components-checkbox',
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.stories.js","sourceRoot":"","sources":["../../../../src/checkbox/stories/checkbox.stories.tsx"],"names":[],"mappings":";;;;AAsBA,uCAAuC;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C9B,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,4BAAyB;aAChC;SACF;KACF;CACF,CAAC;AAEW,QAAA,QAAQ,GAAU;IAC7B,IAAI,EAAE,EAAE;IACR,MAAM,EAAE,mBAAgB;IACxB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,sBAAmB;aAC1B;SACF;KACF;CACF,CAAC;AAEW,QAAA,IAAI,GAAU;IACzB,IAAI,EAAE,EAAE;IACR,MAAM,EAAE,eAAY;IACpB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,kBAAe;aACtB;SACF;KACF;CACF,CAAC;AAEW,QAAA,UAAU,GAAU;IAC/B,IAAI,EAAE,EAAE;IACR,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,wBAAqB;gBAC3B,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;aACb;SACF;KACF;IACD,MAAM,EAAE,qBAAkB;CAC3B,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { type Meta, type StoryObj } from '@storybook/react-vite';\n\nimport { Checkbox } from '../../index';\nimport {\n CheckboxControlled,\n CheckboxControlledSrc,\n CheckboxDefault,\n CheckboxDefaultSrc,\n CheckboxDisabled,\n CheckboxDisabledSrc,\n CheckboxFull,\n CheckboxFullSrc,\n CheckboxHasLabelBefore,\n CheckboxHasLabelBeforeSrc,\n CheckboxIndeterminate,\n CheckboxIndeterminateSrc,\n CheckboxNoLabel,\n CheckboxNoLabelSrc,\n} from './';\n\nconst componentMeta: Meta<typeof Checkbox> = {\n title: 'Components/Checkbox',\n id: 'components-checkbox',\n component: Checkbox,\n tags: ['docsPage'],\n argTypes: {\n ref: {\n description: 'Ref to the `input` element',\n },\n },\n parameters: {\n controls: { disable: true },\n },\n decorators: [\n (Story) => (\n <div className=\"n-flex n-justify-center\">\n <Story />\n </div>\n ),\n ],\n};\n\nexport default componentMeta;\ntype Story = StoryObj<typeof componentMeta>;\n\nexport const Default: Story = {\n args: {},\n render: CheckboxDefault,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: CheckboxDefaultSrc,\n },\n },\n },\n};\n\nexport const Indeterminate: Story = {\n args: {},\n render: CheckboxIndeterminate,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: CheckboxIndeterminateSrc,\n },\n },\n },\n};\n\nexport const NoLabel: Story = {\n args: {},\n render: CheckboxNoLabel,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: CheckboxNoLabelSrc,\n },\n },\n },\n};\n\nexport const HasLeadingLabel: Story = {\n args: {},\n render: CheckboxHasLabelBefore,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: CheckboxHasLabelBeforeSrc,\n },\n },\n },\n};\n\nexport const Disabled: Story = {\n args: {},\n render: CheckboxDisabled,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: CheckboxDisabledSrc,\n },\n },\n },\n};\n\nexport const Full: Story = {\n args: {},\n render: CheckboxFull,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: CheckboxFullSrc,\n },\n },\n },\n};\n\nexport const Controlled: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: CheckboxControlledSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: CheckboxControlled,\n};\n"]}
1
+ {"version":3,"file":"checkbox.stories.js","sourceRoot":"","sources":["../../../../src/checkbox/stories/checkbox.stories.tsx"],"names":[],"mappings":";;;;AAsBA,uCAAuC;AACvC,wBAeW;AAEX,MAAM,aAAa,GAA0B;IAC3C,KAAK,EAAE,qBAAqB;IAC5B,EAAE,EAAE,qBAAqB;IACzB,SAAS,EAAE,gBAAQ;IACnB,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,QAAQ,EAAE;QACR,GAAG,EAAE;YACH,WAAW,EAAE,4BAA4B;SAC1C;KACF;IACD,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;KAC5B;IACD,UAAU,EAAE;QACV,CAAC,KAAK,EAAE,EAAE,CAAC,CACT,gCAAK,SAAS,EAAC,yBAAyB,YACtC,uBAAC,KAAK,KAAG,GACL,CACP;KACF;CACF,CAAC;AAEF,kBAAe,aAAa,CAAC;AAGhB,QAAA,OAAO,GAAU;IAC5B,IAAI,EAAE,EAAE;IACR,MAAM,EAAE,kBAAe;IACvB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,qBAAkB;aACzB;SACF;KACF;CACF,CAAC;AAEW,QAAA,aAAa,GAAU;IAClC,IAAI,EAAE,EAAE;IACR,MAAM,EAAE,wBAAqB;IAC7B,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,MAAM,EAAE;gBACN,QAAQ,EAAE,KAAK;gBACf,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,2BAAwB;aAC/B;SAC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4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { type Meta, type StoryObj } from '@storybook/react-vite';\n\nimport { Checkbox } from '../../index';\nimport {\n CheckboxControlled,\n CheckboxControlledSrc,\n CheckboxDefault,\n CheckboxDefaultSrc,\n CheckboxDisabled,\n CheckboxDisabledSrc,\n CheckboxFull,\n CheckboxFullSrc,\n CheckboxHasLabelBefore,\n CheckboxHasLabelBeforeSrc,\n CheckboxIndeterminate,\n CheckboxIndeterminateSrc,\n CheckboxNoLabel,\n CheckboxNoLabelSrc,\n} from '.';\n\nconst componentMeta: Meta<typeof Checkbox> = {\n title: 'Components/Checkbox',\n id: 'components-checkbox',\n component: Checkbox,\n tags: ['docsPage'],\n argTypes: {\n ref: {\n description: 'Ref to the `input` element',\n },\n },\n parameters: {\n controls: { disable: true },\n },\n decorators: [\n (Story) => (\n <div className=\"n-flex n-justify-center\">\n <Story />\n </div>\n ),\n ],\n};\n\nexport default componentMeta;\ntype Story = StoryObj<typeof componentMeta>;\n\nexport const Default: Story = {\n args: {},\n render: CheckboxDefault,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: CheckboxDefaultSrc,\n },\n },\n },\n};\n\nexport const Indeterminate: Story = {\n args: {},\n render: CheckboxIndeterminate,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: CheckboxIndeterminateSrc,\n },\n },\n },\n};\n\nexport const NoLabel: Story = {\n args: {},\n render: CheckboxNoLabel,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: CheckboxNoLabelSrc,\n },\n },\n },\n};\n\nexport const HasLeadingLabel: Story = {\n args: {},\n render: CheckboxHasLabelBefore,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: CheckboxHasLabelBeforeSrc,\n },\n },\n },\n};\n\nexport const Disabled: Story = {\n args: {},\n render: CheckboxDisabled,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: CheckboxDisabledSrc,\n },\n },\n },\n};\n\nexport const Full: Story = {\n args: {},\n render: CheckboxFull,\n parameters: {\n docs: {\n source: {\n language: 'tsx',\n type: 'code',\n code: CheckboxFullSrc,\n },\n },\n },\n};\n\nexport const Controlled: Story = {\n args: {},\n parameters: {\n docs: {\n source: {\n code: CheckboxControlledSrc,\n language: 'tsx',\n type: 'code',\n },\n },\n },\n render: CheckboxControlled,\n};\n"]}
@@ -76,8 +76,9 @@ const ConfirmationButton = (_a) => {
76
76
  },
77
77
  },
78
78
  }, onClick: (event) => {
79
- if (onClick)
79
+ if (onClick) {
80
80
  onClick(event);
81
+ }
81
82
  handleClick();
82
83
  }, className: restProps.className, htmlAttributes: htmlAttributes, children: icon })));
83
84
  }
@@ -93,8 +94,9 @@ const ConfirmationButton = (_a) => {
93
94
  },
94
95
  },
95
96
  }, onClick: (event) => {
96
- if (onClick)
97
+ if (onClick) {
97
98
  onClick(event);
99
+ }
98
100
  handleClick();
99
101
  }, className: restProps.className, htmlAttributes: htmlAttributes, children: icon })));
100
102
  }
@@ -114,8 +116,9 @@ const ConfirmationButton = (_a) => {
114
116
  onMouseEnter: handleOpenTooltip,
115
117
  onMouseLeave: handleCloseTooltip,
116
118
  }, children: (0, jsx_runtime_1.jsx)(outlined_button_1.OutlinedButton, Object.assign({ variant: "neutral" }, restProps.buttonProps, { onClick: (event) => {
117
- if (onClick)
119
+ if (onClick) {
118
120
  onClick(event);
121
+ }
119
122
  handleClick();
120
123
  }, leadingVisual: icon, className: restProps.className, htmlAttributes: htmlAttributes, children: children })) }), (0, jsx_runtime_1.jsx)(tooltip_1.Tooltip.Content, { children: content })] })));
121
124
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ClipboardButton.js","sourceRoot":"","sources":["../../../src/clipboard-button/ClipboardButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,kDAA0B;AAG1B,4DAAuD;AACvD,oCAA8C;AAC9C,gDAA4C;AAC5C,oCAAmD;AACnD,wDAAoD;AACpD,wCAAqC;AAmCrC,MAAM,kBAAkB,GAAG,CAAC,EAUF,EAAE,EAAE;QAVF,EAC1B,WAAW,EACX,kBAAkB,EAClB,IAAI,EACJ,QAAQ,EACR,OAAO,EACP,cAAc,EACd,YAAY,EACZ,IAAI,GAAG,mBAAmB,OAEF,EADrB,SAAS,cATc,8GAU3B,CADa;IAEZ,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACtE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,eAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAElD,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;YACvB,YAAY,CAAC,SAAS,CAAC,CAAC;QAC1B,CAAC;QAED,MAAM,YAAY,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE;YAC1C,YAAY,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC,EAAE,IAAI,CAAC,CAAC;QAET,YAAY,CAAC,YAAY,CAAC,CAAC;IAC7B,CAAC,CAAC;IAEF,MAAM,kBAAkB,GAAG,GAAG,EAAE;QAC9B,SAAS,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC,CAAC;IAEF,MAAM,iBAAiB,GAAG,GAAG,EAAE;QAC7B,SAAS,CAAC,IAAI,CAAC,CAAC;IAClB,CAAC,CAAC;IAEF,MAAM,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,IAAI,GACiB,EAAE,EAAE;IACzB,MAAM,CAAC,EAAE,YAAY,CAAC,GAAG,IAAA,0BAAkB,GAAE,CAAC;IAE9C,MAAM,gBAAgB,GAAG,IAAI,KAAK,iBAAiB,CAAC;IACpD,MAAM,YAAY,GAAG,IAAI,KAAK,aAAa,CAAC;IAE5C,MAAM,KAAK,GAAG,gBAAgB;QAC5B,CAAC,CAAC;YACE,mBAAmB,EAAE;gBACnB,UAAU;gBACV,IAAI;aACL;YACD,IAAI,EAAE,iBAA0B;SACjC;QACH,CAAC,CAAC,YAAY;YACZ,CAAC,CAAC;gBACE,eAAe,EAAE;oBACf,WAAW,EAAE,mBAAmB;oBAChC,UAAU;oBACV,IAAI;iBACL;gBACD,IAAI,EAAE,aAAsB;aAC7B;YACH,CAAC,CAAC;gBACE,oBAAoB,EAAE;oBACpB,WAAW,EAAE,mBAAmB;oBAChC,UAAU;oBACV,IAAI;iBACL;gBACD,IAAI,EAAE,mBAA4B;aACnC,CAAC;IAER,OAAO,CACL,uBAAC,kBAAkB,kBACjB,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,EACvC,WAAW,EAAC,mBAAmB,EAC/B,kBAAkB,EAAC,QAAQ,IACvB,KAAK,IACT,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAC,eAAe,EACzB,IAAI,EAAE,uBAAC,+BAAuB,IAAC,SAAS,EAAC,cAAc,GAAG,EAC1D,cAAc,EAAE,cAAc,YAE7B,IAAI,KAAK,iBAAiB,IAAI,MAAM,IAClB,CACtB,CAAC;AACJ,CAAC,CAAC;AArDW,QAAA,eAAe,mBAqD1B","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 React from 'react';\n\nimport { type ButtonSizes } from '../button';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { useCopyToClipboard } from '../hooks';\nimport { IconButton } from '../icon-button';\nimport { Square2StackIconOutline } from '../icons';\nimport { OutlinedButton } from '../outlined-button';\nimport { Tooltip } from '../tooltip';\n\ntype ConfirmationButtonProps = {\n description: string;\n actionFeedbackText: string;\n tooltipProps?: Omit<React.ComponentProps<typeof Tooltip>, 'children'>;\n onClick?: React.ComponentPropsWithoutRef<'button'>['onClick'];\n children: React.ReactNode;\n className?: string;\n icon: React.ReactNode;\n htmlAttributes?: React.ComponentPropsWithoutRef<'button'>;\n} & (\n | {\n type: 'clean-icon-button';\n cleanIconButtonProps?: Omit<\n React.ComponentProps<typeof CleanIconButton>,\n 'children' | 'onClick' | 'tooltip'\n >;\n }\n | {\n type: 'icon-button';\n iconButtonProps?: Omit<\n React.ComponentProps<typeof IconButton>,\n 'children' | 'onClick' | 'tooltip'\n >;\n }\n | {\n type: 'outlined-button';\n outlinedButtonProps?: Omit<\n React.ComponentProps<typeof OutlinedButton>,\n 'children' | 'onClick' | 'tooltip'\n >;\n }\n);\n\nconst ConfirmationButton = ({\n description,\n actionFeedbackText,\n icon,\n children,\n onClick,\n htmlAttributes,\n tooltipProps,\n type = 'clean-icon-button',\n ...restProps\n}: ConfirmationButtonProps) => {\n const [timeoutId, setTimeoutId] = React.useState<number | null>(null);\n const [isOpen, setIsOpen] = React.useState(false);\n\n const handleClick = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n }\n\n const newTimeoutId = window.setTimeout(() => {\n setTimeoutId(null);\n }, 2000);\n\n setTimeoutId(newTimeoutId);\n };\n\n const handleCloseTooltip = () => {\n setIsOpen(false);\n };\n\n const handleOpenTooltip = () => {\n setIsOpen(true);\n };\n\n const content = timeoutId === null ? description : actionFeedbackText;\n /* Controlling the tip to make it disappear in a timely manner*/\n\n if (type === 'clean-icon-button') {\n return (\n <CleanIconButton\n {...(\n restProps as {\n cleanIconButtonProps: React.ComponentProps<typeof CleanIconButton>;\n }\n ).cleanIconButtonProps}\n description={content}\n tooltipProps={{\n root: {\n ...tooltipProps,\n isOpen: isOpen || timeoutId !== null,\n },\n trigger: {\n htmlAttributes: {\n onBlur: handleCloseTooltip,\n onFocus: handleOpenTooltip,\n onMouseEnter: handleOpenTooltip,\n onMouseLeave: handleCloseTooltip,\n },\n },\n }}\n onClick={(event) => {\n if (onClick) onClick(event);\n handleClick();\n }}\n className={restProps.className}\n htmlAttributes={htmlAttributes}\n >\n {icon}\n </CleanIconButton>\n );\n } else if (type === 'icon-button') {\n return (\n <IconButton\n {...(\n restProps as {\n iconButtonProps: React.ComponentProps<typeof IconButton>;\n }\n ).iconButtonProps}\n description={content}\n tooltipProps={{\n root: {\n ...tooltipProps,\n isOpen: isOpen || timeoutId !== null,\n },\n trigger: {\n htmlAttributes: {\n onBlur: handleCloseTooltip,\n onFocus: handleOpenTooltip,\n onMouseEnter: handleOpenTooltip,\n onMouseLeave: handleCloseTooltip,\n },\n },\n }}\n onClick={(event) => {\n if (onClick) onClick(event);\n handleClick();\n }}\n className={restProps.className}\n htmlAttributes={htmlAttributes}\n >\n {icon}\n </IconButton>\n );\n } else if (type === 'outlined-button') {\n return (\n <Tooltip\n type=\"simple\"\n isOpen={isOpen || timeoutId !== null}\n {...tooltipProps}\n onOpenChange={(open) => {\n if (open) {\n handleOpenTooltip();\n } else {\n handleCloseTooltip();\n }\n tooltipProps?.onOpenChange?.(open);\n }}\n >\n <Tooltip.Trigger\n hasButtonWrapper\n htmlAttributes={{\n onBlur: handleCloseTooltip,\n onFocus: handleOpenTooltip,\n onMouseEnter: handleOpenTooltip,\n onMouseLeave: handleCloseTooltip,\n }}\n >\n <OutlinedButton\n variant=\"neutral\"\n {...(\n restProps as {\n buttonProps: React.ComponentProps<typeof OutlinedButton>;\n }\n ).buttonProps}\n onClick={(event) => {\n if (onClick) onClick(event);\n handleClick();\n }}\n leadingVisual={icon}\n className={restProps.className}\n htmlAttributes={htmlAttributes}\n >\n {children}\n </OutlinedButton>\n </Tooltip.Trigger>\n <Tooltip.Content>{content}</Tooltip.Content>\n </Tooltip>\n );\n }\n};\n\ninterface ClipboardButtonProps {\n /** The text that should be set to users clipboard */\n textToCopy: string;\n tooltipProps?: Omit<React.ComponentProps<typeof Tooltip>, 'children'>;\n isDisabled?: boolean;\n size?: ButtonSizes;\n htmlAttributes?: React.ComponentPropsWithoutRef<'button'>;\n type?: 'outlined-button' | 'clean-icon-button' | 'icon-button';\n}\n\nexport const ClipboardButton = ({\n textToCopy,\n isDisabled,\n size,\n tooltipProps,\n htmlAttributes,\n type,\n}: ClipboardButtonProps) => {\n const [, copyFunction] = useCopyToClipboard();\n\n const isOutlinedButton = type === 'outlined-button';\n const isIconButton = type === 'icon-button';\n\n const props = isOutlinedButton\n ? {\n outlinedButtonProps: {\n isDisabled,\n size,\n },\n type: 'outlined-button' as const,\n }\n : isIconButton\n ? {\n iconButtonProps: {\n description: 'Copy to clipboard',\n isDisabled,\n size,\n },\n type: 'icon-button' as const,\n }\n : {\n cleanIconButtonProps: {\n description: 'Copy to clipboard',\n isDisabled,\n size,\n },\n type: 'clean-icon-button' as const,\n };\n\n return (\n <ConfirmationButton\n onClick={() => copyFunction(textToCopy)}\n description=\"Copy to clipboard\"\n actionFeedbackText=\"Copied\"\n {...props}\n tooltipProps={tooltipProps}\n className=\"n-gap-token-8\"\n icon={<Square2StackIconOutline className=\"ndl-icon-svg\" />}\n htmlAttributes={htmlAttributes}\n >\n {type === 'outlined-button' && 'Copy'}\n </ConfirmationButton>\n );\n};\n"]}
1
+ {"version":3,"file":"ClipboardButton.js","sourceRoot":"","sources":["../../../src/clipboard-button/ClipboardButton.tsx"],"names":[],"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IAE9C,MAAM,gBAAgB,GAAG,IAAI,KAAK,iBAAiB,CAAC;IACpD,MAAM,YAAY,GAAG,IAAI,KAAK,aAAa,CAAC;IAE5C,MAAM,KAAK,GAAG,gBAAgB;QAC5B,CAAC,CAAC;YACE,mBAAmB,EAAE;gBACnB,UAAU;gBACV,IAAI;aACL;YACD,IAAI,EAAE,iBAA0B;SACjC;QACH,CAAC,CAAC,YAAY;YACZ,CAAC,CAAC;gBACE,eAAe,EAAE;oBACf,WAAW,EAAE,mBAAmB;oBAChC,UAAU;oBACV,IAAI;iBACL;gBACD,IAAI,EAAE,aAAsB;aAC7B;YACH,CAAC,CAAC;gBACE,oBAAoB,EAAE;oBACpB,WAAW,EAAE,mBAAmB;oBAChC,UAAU;oBACV,IAAI;iBACL;gBACD,IAAI,EAAE,mBAA4B;aACnC,CAAC;IAER,OAAO,CACL,uBAAC,kBAAkB,kBACjB,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,EACvC,WAAW,EAAC,mBAAmB,EAC/B,kBAAkB,EAAC,QAAQ,IACvB,KAAK,IACT,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAC,eAAe,EACzB,IAAI,EAAE,uBAAC,+BAAuB,IAAC,SAAS,EAAC,cAAc,GAAG,EAC1D,cAAc,EAAE,cAAc,YAE7B,IAAI,KAAK,iBAAiB,IAAI,MAAM,IAClB,CACtB,CAAC;AACJ,CAAC,CAAC;AArDW,QAAA,eAAe,mBAqD1B","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 React from 'react';\n\nimport { type ButtonSizes } from '../button';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { useCopyToClipboard } from '../hooks';\nimport { IconButton } from '../icon-button';\nimport { Square2StackIconOutline } from '../icons';\nimport { OutlinedButton } from '../outlined-button';\nimport { Tooltip } from '../tooltip';\n\ntype ConfirmationButtonProps = {\n description: string;\n actionFeedbackText: string;\n tooltipProps?: Omit<React.ComponentProps<typeof Tooltip>, 'children'>;\n onClick?: React.ComponentPropsWithoutRef<'button'>['onClick'];\n children: React.ReactNode;\n className?: string;\n icon: React.ReactNode;\n htmlAttributes?: React.ComponentPropsWithoutRef<'button'>;\n} & (\n | {\n type: 'clean-icon-button';\n cleanIconButtonProps?: Omit<\n React.ComponentProps<typeof CleanIconButton>,\n 'children' | 'onClick' | 'tooltip'\n >;\n }\n | {\n type: 'icon-button';\n iconButtonProps?: Omit<\n React.ComponentProps<typeof IconButton>,\n 'children' | 'onClick' | 'tooltip'\n >;\n }\n | {\n type: 'outlined-button';\n outlinedButtonProps?: Omit<\n React.ComponentProps<typeof OutlinedButton>,\n 'children' | 'onClick' | 'tooltip'\n >;\n }\n);\n\nconst ConfirmationButton = ({\n description,\n actionFeedbackText,\n icon,\n children,\n onClick,\n htmlAttributes,\n tooltipProps,\n type = 'clean-icon-button',\n ...restProps\n}: ConfirmationButtonProps) => {\n const [timeoutId, setTimeoutId] = React.useState<number | null>(null);\n const [isOpen, setIsOpen] = React.useState(false);\n\n const handleClick = () => {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n }\n\n const newTimeoutId = window.setTimeout(() => {\n setTimeoutId(null);\n }, 2000);\n\n setTimeoutId(newTimeoutId);\n };\n\n const handleCloseTooltip = () => {\n setIsOpen(false);\n };\n\n const handleOpenTooltip = () => {\n setIsOpen(true);\n };\n\n const content = timeoutId === null ? description : actionFeedbackText;\n /* Controlling the tip to make it disappear in a timely manner*/\n\n if (type === 'clean-icon-button') {\n return (\n <CleanIconButton\n {...(\n restProps as {\n cleanIconButtonProps: React.ComponentProps<typeof CleanIconButton>;\n }\n ).cleanIconButtonProps}\n description={content}\n tooltipProps={{\n root: {\n ...tooltipProps,\n isOpen: isOpen || timeoutId !== null,\n },\n trigger: {\n htmlAttributes: {\n onBlur: handleCloseTooltip,\n onFocus: handleOpenTooltip,\n onMouseEnter: handleOpenTooltip,\n onMouseLeave: handleCloseTooltip,\n },\n },\n }}\n onClick={(event) => {\n if (onClick) {\n onClick(event);\n }\n handleClick();\n }}\n className={restProps.className}\n htmlAttributes={htmlAttributes}\n >\n {icon}\n </CleanIconButton>\n );\n } else if (type === 'icon-button') {\n return (\n <IconButton\n {...(\n restProps as {\n iconButtonProps: React.ComponentProps<typeof IconButton>;\n }\n ).iconButtonProps}\n description={content}\n tooltipProps={{\n root: {\n ...tooltipProps,\n isOpen: isOpen || timeoutId !== null,\n },\n trigger: {\n htmlAttributes: {\n onBlur: handleCloseTooltip,\n onFocus: handleOpenTooltip,\n onMouseEnter: handleOpenTooltip,\n onMouseLeave: handleCloseTooltip,\n },\n },\n }}\n onClick={(event) => {\n if (onClick) {\n onClick(event);\n }\n handleClick();\n }}\n className={restProps.className}\n htmlAttributes={htmlAttributes}\n >\n {icon}\n </IconButton>\n );\n } else if (type === 'outlined-button') {\n return (\n <Tooltip\n type=\"simple\"\n isOpen={isOpen || timeoutId !== null}\n {...tooltipProps}\n onOpenChange={(open) => {\n if (open) {\n handleOpenTooltip();\n } else {\n handleCloseTooltip();\n }\n tooltipProps?.onOpenChange?.(open);\n }}\n >\n <Tooltip.Trigger\n hasButtonWrapper\n htmlAttributes={{\n onBlur: handleCloseTooltip,\n onFocus: handleOpenTooltip,\n onMouseEnter: handleOpenTooltip,\n onMouseLeave: handleCloseTooltip,\n }}\n >\n <OutlinedButton\n variant=\"neutral\"\n {...(\n restProps as {\n buttonProps: React.ComponentProps<typeof OutlinedButton>;\n }\n ).buttonProps}\n onClick={(event) => {\n if (onClick) {\n onClick(event);\n }\n handleClick();\n }}\n leadingVisual={icon}\n className={restProps.className}\n htmlAttributes={htmlAttributes}\n >\n {children}\n </OutlinedButton>\n </Tooltip.Trigger>\n <Tooltip.Content>{content}</Tooltip.Content>\n </Tooltip>\n );\n }\n};\n\ninterface ClipboardButtonProps {\n /** The text that should be set to users clipboard */\n textToCopy: string;\n tooltipProps?: Omit<React.ComponentProps<typeof Tooltip>, 'children'>;\n isDisabled?: boolean;\n size?: ButtonSizes;\n htmlAttributes?: React.ComponentPropsWithoutRef<'button'>;\n type?: 'outlined-button' | 'clean-icon-button' | 'icon-button';\n}\n\nexport const ClipboardButton = ({\n textToCopy,\n isDisabled,\n size,\n tooltipProps,\n htmlAttributes,\n type,\n}: ClipboardButtonProps) => {\n const [, copyFunction] = useCopyToClipboard();\n\n const isOutlinedButton = type === 'outlined-button';\n const isIconButton = type === 'icon-button';\n\n const props = isOutlinedButton\n ? {\n outlinedButtonProps: {\n isDisabled,\n size,\n },\n type: 'outlined-button' as const,\n }\n : isIconButton\n ? {\n iconButtonProps: {\n description: 'Copy to clipboard',\n isDisabled,\n size,\n },\n type: 'icon-button' as const,\n }\n : {\n cleanIconButtonProps: {\n description: 'Copy to clipboard',\n isDisabled,\n size,\n },\n type: 'clean-icon-button' as const,\n };\n\n return (\n <ConfirmationButton\n onClick={() => copyFunction(textToCopy)}\n description=\"Copy to clipboard\"\n actionFeedbackText=\"Copied\"\n {...props}\n tooltipProps={tooltipProps}\n className=\"n-gap-token-8\"\n icon={<Square2StackIconOutline className=\"ndl-icon-svg\" />}\n htmlAttributes={htmlAttributes}\n >\n {type === 'outlined-button' && 'Copy'}\n </ConfirmationButton>\n );\n};\n"]}
@@ -103,8 +103,9 @@ exports.ColorPicker = (0, react_1.forwardRef)(function ColorPicker({ color, onCh
103
103
  }, selectProps: {
104
104
  isSearchable: false,
105
105
  onChange: (newFormat) => {
106
- if (!newFormat)
106
+ if (!newFormat) {
107
107
  return;
108
+ }
108
109
  setFormat({
109
110
  label: newFormat.label,
110
111
  value: newFormat.value,
@@ -1 +1 @@
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,iCAAwD;AAExD,4DAAuD;AACvD,oCAAiD;AACjD,sCAAmC;AACnC,8CAA0C;AAqB7B,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,GACN,EACD,GAAG;IAEH,MAAM,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,GACzD,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAElB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAGjC;QACD,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,KAAK;KACb,CAAC,CAAC;IAEH,MAAM,kBAAkB,GAAG,YAAY,IAAI,MAAM,IAAI,oBAAoB,CAAC;IAE1E,MAAM,IAAI,GACR,OAAO,KAAK,KAAK,QAAQ;QACvB,CAAC,CAAC,IAAA,uBAAS,EAAC,KAAK,CAAC;QAClB,CAAC,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,GAAG,IAAI,KAAK;YACzC,CAAC,CAAC,IAAA,wBAAU,EAAC,KAAK,CAAC;YACnB,CAAC,+BAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,IAAM,KAAgB,KAAE,CAAC,EAAE,CAAC,GAAE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AA,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, useState } from 'react';\n\nimport { CleanIconButton } from '../clean-icon-button';\nimport { EyeDropperIconOutline } from '../icons';\nimport { Select } from '../select';\nimport { TextInput } from '../text-input';\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\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 },\n ref,\n ) {\n const [isEyeDropperActiveState, setIsEyeDropperActiveState] =\n useState(false);\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 hsva =\n typeof color === 'string'\n ? hexToHsva(color)\n : typeof color === 'object' && 'r' in color\n ? rgbaToHsva(color)\n : { h: 0, s: 0, v: 0, ...(color as object), a: 1 };\n\n const handleChange = (hsva: HsvaColor) => {\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 // eslint-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\"\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 onChange: (newFormat) => {\n if (!newFormat) return;\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 HexInput = ({\n hsva,\n onChange,\n}: {\n hsva: HsvaColor;\n onChange: (newColor: string) => void;\n}) => {\n const [inputValue, setInputValue] = useState<string>(\n () => hsvaToHex(hsva).split('#')[1],\n );\n\n // Update input value when hsva changes from outside\n useEffect(() => {\n setInputValue(hsvaToHex(hsva).split('#')[1]);\n }, [hsva]);\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n // Remove # if user pastes a hex code with it\n const value = e.target.value.split('#')[1];\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 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,iCAAwD;AAExD,4DAAuD;AACvD,oCAAiD;AACjD,sCAAmC;AACnC,8CAA0C;AAqB7B,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,GACN,EACD,GAAG;IAEH,MAAM,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,GACzD,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAElB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAGjC;QACD,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,KAAK;KACb,CAAC,CAAC;IAEH,MAAM,kBAAkB,GAAG,YAAY,IAAI,MAA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U,EAAC,KAAK,CAAC;oBACnB,CAAC,CAAC,KAAK,CAAC;YAEd,MAAM,QAAQ,GACZ,IAAI,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;gBACtB,IAAI,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;gBACtB,IAAI,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC;YAEzB,OAAO,CACL,iDAEc,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, useState } from 'react';\n\nimport { CleanIconButton } from '../clean-icon-button';\nimport { EyeDropperIconOutline } from '../icons';\nimport { Select } from '../select';\nimport { TextInput } from '../text-input';\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\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 },\n ref,\n ) {\n const [isEyeDropperActiveState, setIsEyeDropperActiveState] =\n useState(false);\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 hsva =\n typeof color === 'string'\n ? hexToHsva(color)\n : typeof color === 'object' && 'r' in color\n ? rgbaToHsva(color)\n : { h: 0, s: 0, v: 0, ...(color as object), a: 1 };\n\n const handleChange = (hsva: HsvaColor) => {\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 // eslint-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\"\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 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 HexInput = ({\n hsva,\n onChange,\n}: {\n hsva: HsvaColor;\n onChange: (newColor: string) => void;\n}) => {\n const [inputValue, setInputValue] = useState<string>(\n () => hsvaToHex(hsva).split('#')[1],\n );\n\n // Update input value when hsva changes from outside\n useEffect(() => {\n setInputValue(hsvaToHex(hsva).split('#')[1]);\n }, [hsva]);\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n // Remove # if user pastes a hex code with it\n const value = e.target.value.split('#')[1];\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 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"]}
@@ -135,12 +135,14 @@ const ActionCell = ({ cell, innerCleanIconButtonProps, innerMenuProps, }) => {
135
135
  const [isActionsOpen, setIsActionsOpen] = (0, react_2.useState)(false);
136
136
  if (!cell ||
137
137
  !cell.column.columnDef.meta ||
138
- typeof ((_b = (_a = cell.column.columnDef) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.isActionCell) !== 'object')
138
+ typeof ((_b = (_a = cell.column.columnDef) === null || _a === void 0 ? void 0 : _a.meta) === null || _b === void 0 ? void 0 : _b.isActionCell) !== 'object') {
139
139
  return null;
140
+ }
140
141
  const { actions, onOpenChange } = cell.column.columnDef.meta.isActionCell;
141
- if (isSkeletonLoading)
142
+ if (isSkeletonLoading) {
142
143
  return null;
143
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(clean_icon_button_1.CleanIconButton, Object.assign({ as: "button", size: "medium", description: `Actions`, ref: actionsButtonRef, isActive: isActionsOpen, onClick: () => {
144
+ }
145
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(clean_icon_button_1.CleanIconButton, Object.assign({ as: "button", size: "medium", description: "Actions", ref: actionsButtonRef, isActive: isActionsOpen, onClick: () => {
144
146
  onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(!isActionsOpen);
145
147
  setIsActionsOpen(!isActionsOpen);
146
148
  } }, innerCleanIconButtonProps, { htmlAttributes: Object.assign({ tabIndex: 0 }, innerCleanIconButtonProps === null || innerCleanIconButtonProps === void 0 ? void 0 : innerCleanIconButtonProps.htmlAttributes), children: (innerCleanIconButtonProps === null || innerCleanIconButtonProps === void 0 ? void 0 : innerCleanIconButtonProps.children) || ((0, jsx_runtime_1.jsx)(icons_1.EllipsisHorizontalIconOutline, {})) })), (0, jsx_runtime_1.jsx)(menu_1.Menu, Object.assign({ isOpen: isActionsOpen, anchorRef: actionsButtonRef, onClose: () => {
@@ -189,9 +191,10 @@ const ColumnControls = (_a) => {
189
191
  ];
190
192
  const actionsButtonRef = (0, react_2.useRef)(null);
191
193
  const [isActionsOpen, setIsActionsOpen] = (0, react_2.useState)(false);
192
- if (!actions || actions.length === 0)
194
+ if (!actions || actions.length === 0) {
193
195
  return null;
194
- return newActions.length > 0 ? ((0, jsx_runtime_1.jsx)("div", Object.assign({ ref: ref, className: (0, classnames_1.default)('ndl-header-action-group', className), style: style }, restProps, htmlAttributes, { children: children || ((0, jsx_runtime_1.jsxs)(react_2.Fragment, { children: [(0, jsx_runtime_1.jsx)(clean_icon_button_1.CleanIconButton, { size: "small", description: `Actions`, ref: actionsButtonRef, isActive: isActionsOpen, onClick: () => {
196
+ }
197
+ return newActions.length > 0 ? ((0, jsx_runtime_1.jsx)("div", Object.assign({ ref: ref, className: (0, classnames_1.default)('ndl-header-action-group', className), style: style }, restProps, htmlAttributes, { children: children || ((0, jsx_runtime_1.jsxs)(react_2.Fragment, { children: [(0, jsx_runtime_1.jsx)(clean_icon_button_1.CleanIconButton, { size: "small", description: "Actions", ref: actionsButtonRef, isActive: isActionsOpen, onClick: () => {
195
198
  setIsActionsOpen(!isActionsOpen);
196
199
  }, htmlAttributes: {
197
200
  tabIndex: 0,
@@ -397,7 +400,7 @@ const Navigation = (_a) => {
397
400
  var { children, className, style, htmlAttributes, ref } = _a, restProps = __rest(_a, ["children", "className", "style", "htmlAttributes", "ref"]);
398
401
  const { tableProps, components, isSkeletonLoading, skeletonProps, isSmallNavigation, } = (0, data_grid_context_1.useDataGridContext)();
399
402
  const { getPageCount } = tableProps;
400
- return ((0, jsx_runtime_1.jsx)("div", Object.assign({ ref: ref, style: Object.assign(Object.assign({}, style), (isSmallNavigation && { justifyContent: 'end' })), className: (0, classnames_1.default)('ndl-data-grid-navigation', className) }, restProps, htmlAttributes, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children || ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [components.TableResults && (0, jsx_runtime_1.jsx)(components.TableResults, {}), (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, Object.assign({ onBackground: "weak", shape: "rectangular", height: "36px" }, skeletonProps, { isLoading: isSkeletonLoading, children: (0, jsx_runtime_1.jsxs)("div", { className: 'ndl-data-grid-navigation-right-items', children: [getPageCount() > 1 && components.Pagination && ((0, jsx_runtime_1.jsx)(components.Pagination, {})), components.RowsPerPage && (0, jsx_runtime_1.jsx)(components.RowsPerPage, {})] }) }))] })) }) })));
403
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({ ref: ref, style: Object.assign(Object.assign({}, style), (isSmallNavigation && { justifyContent: 'end' })), className: (0, classnames_1.default)('ndl-data-grid-navigation', className) }, restProps, htmlAttributes, { children: (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children || ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [components.TableResults && (0, jsx_runtime_1.jsx)(components.TableResults, {}), (0, jsx_runtime_1.jsx)(skeleton_1.Skeleton, Object.assign({ onBackground: "weak", shape: "rectangular", height: "36px" }, skeletonProps, { isLoading: isSkeletonLoading, children: (0, jsx_runtime_1.jsxs)("div", { className: "ndl-data-grid-navigation-right-items", children: [getPageCount() > 1 && components.Pagination && ((0, jsx_runtime_1.jsx)(components.Pagination, {})), components.RowsPerPage && (0, jsx_runtime_1.jsx)(components.RowsPerPage, {})] }) }))] })) }) })));
401
404
  };
402
405
  exports.Navigation = Navigation;
403
406
  const LoadingPlaceholder = (_a) => {