@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
@@ -41,8 +41,9 @@ import { Typography } from '../typography';
41
41
  const DrawerComponent = function DrawerComponent(_a) {
42
42
  var { children, className = '', isExpanded, onExpandedChange, position = 'left', type = 'overlay', isResizeable = false, resizeableProps, isCloseable = true, isPortaled = false, portalProps = {}, htmlAttributes, style, ref, as } = _a, restProps = __rest(_a, ["children", "className", "isExpanded", "onExpandedChange", "position", "type", "isResizeable", "resizeableProps", "isCloseable", "isPortaled", "portalProps", "htmlAttributes", "style", "ref", "as"]);
43
43
  const setOnExpandedChange = useCallback(() => {
44
- if (onExpandedChange)
44
+ if (onExpandedChange) {
45
45
  onExpandedChange(!isExpanded);
46
+ }
46
47
  }, [isExpanded, onExpandedChange]);
47
48
  const classes = classNames('ndl-drawer', className, {
48
49
  'ndl-drawer-expanded': isExpanded,
@@ -85,22 +86,22 @@ const DrawerComponent = function DrawerComponent(_a) {
85
86
  };
86
87
  DrawerComponent.displayName = 'Drawer';
87
88
  const DrawerHeader = (_a) => {
88
- var { children, className = '' } = _a, restProps = __rest(_a, ["children", "className"]);
89
+ var { children, className = '', htmlAttributes } = _a, restProps = __rest(_a, ["children", "className", "htmlAttributes"]);
89
90
  const classes = classNames('ndl-drawer-header', className);
90
91
  if (typeof children === 'string' || typeof children === 'number') {
91
- return (_jsx(Typography, Object.assign({ variant: "title-3" }, restProps, { className: classes, children: children })));
92
+ return (_jsx(Typography, Object.assign({ className: classes, variant: "title-3" }, restProps, htmlAttributes, { children: children })));
92
93
  }
93
- return (_jsx("div", Object.assign({}, restProps, { className: classes, children: children })));
94
+ return (_jsx("div", Object.assign({ className: classes }, restProps, htmlAttributes, { children: children })));
94
95
  };
95
96
  const DrawerActions = (_a) => {
96
- var { children, className = '' } = _a, restProps = __rest(_a, ["children", "className"]);
97
+ var { children, className = '', htmlAttributes } = _a, restProps = __rest(_a, ["children", "className", "htmlAttributes"]);
97
98
  const classes = classNames('ndl-drawer-actions', className);
98
- return (_jsx("div", Object.assign({}, restProps, { className: classes, children: children })));
99
+ return (_jsx("div", Object.assign({ className: classes }, restProps, htmlAttributes, { children: children })));
99
100
  };
100
101
  const DrawerBody = (_a) => {
101
- var { children, className = '' } = _a, restProps = __rest(_a, ["children", "className"]);
102
+ var { children, className = '', htmlAttributes } = _a, restProps = __rest(_a, ["children", "className", "htmlAttributes"]);
102
103
  const classes = classNames('ndl-drawer-body', className);
103
- return (_jsx("div", { className: "ndl-drawer-body-wrapper", children: _jsx("div", Object.assign({}, restProps, { className: classes, children: children })) }));
104
+ return (_jsx("div", { className: "ndl-drawer-body-wrapper", children: _jsx("div", Object.assign({ className: classes }, restProps, htmlAttributes, { children: children })) }));
104
105
  };
105
106
  const Drawer = Object.assign(DrawerComponent, {
106
107
  Actions: DrawerActions,
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../../src/drawer/Drawer.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,SAAS,EAAuB,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAuB,WAAW,EAAE,MAAM,OAAO,CAAC;AAMzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA4C3C,MAAM,eAAe,GAAG,SAAS,eAAe,CAE9C,EAiBuC;QAjBvC,EACA,QAAQ,EACR,SAAS,GAAG,EAAE,EACd,UAAU,EACV,gBAAgB,EAChB,QAAQ,GAAG,MAAM,EACjB,IAAI,GAAG,SAAS,EAChB,YAAY,GAAG,KAAK,EACpB,eAAe,EACf,WAAW,GAAG,IAAI,EAClB,UAAU,GAAG,KAAK,EAClB,WA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,EAAE,UAAU;IAChB,MAAM,EAAE,YAAY;CACrB,CAAC,CAAC;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { FloatingPortal } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { Resizable, type ResizableProps } from 're-resizable';\nimport type React from 'react';\nimport { type ComponentProps, useCallback } from 'react';\n\nimport {\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { XMarkIconOutline } from '../icons';\nimport { Typography } from '../typography';\n\ntype DrawerPosition = 'left' | 'right';\n\ntype DrawerType = 'overlay' | 'push';\n\ntype DrawerProps = {\n /** Controls whether the drawer is open (expanded) or closed (collapsed). */\n isExpanded: boolean;\n\n /** Callback functions fired when the drawer's expanded state changes. */\n onExpandedChange?: (expanded: boolean) => void;\n\n /** Position where the drawer appears on screen. By default, it appears from the left. */\n position?: DrawerPosition;\n\n /** How the drawer affects the layout of sibling content. By default, it overlays content. */\n type?: DrawerType;\n\n /** Enables horizontal resizing of the drawer, by default it is not resizable. */\n isResizeable?: boolean;\n\n /** To use this prop the isResizeable prop must be set to true. For overriding the third party library props: https://github.com/bokuweb/re-resizable */\n resizeableProps?: ResizableProps;\n\n /** Whether a close button (X) is displayed in the drawer. */\n isCloseable?: boolean;\n\n /** Whether to portal the content */\n isPortaled?: boolean;\n\n /** The content to display within the drawer. */\n children: React.ReactNode;\n\n /** Additional CSS classes to apply to the drawer container. */\n className?: string;\n\n /**\n * Props to pass to the portal from @floating-ui/react FloatingPortal\n * @see https://floating-ui.com/docs/floatingportal\n */\n portalProps?: ComponentProps<typeof FloatingPortal>;\n};\n\nconst DrawerComponent = function DrawerComponent<\n T extends React.ElementType = 'div',\n>({\n children,\n className = '',\n isExpanded,\n onExpandedChange,\n position = 'left',\n type = 'overlay',\n isResizeable = false,\n resizeableProps,\n isCloseable = true,\n isPortaled = false,\n portalProps = {},\n htmlAttributes,\n style,\n ref,\n as,\n ...restProps\n}: PolymorphicCommonProps<T, DrawerProps>) {\n const setOnExpandedChange = useCallback(() => {\n if (onExpandedChange) onExpandedChange(!isExpanded);\n }, [isExpanded, onExpandedChange]);\n\n const classes = classNames('ndl-drawer', className, {\n 'ndl-drawer-expanded': isExpanded,\n 'ndl-drawer-left': position === 'left',\n 'ndl-drawer-overlay': type === 'overlay',\n 'ndl-drawer-push': type === 'push',\n 'ndl-drawer-right': position === 'right',\n });\n\n const resizableStylePosition = type === 'overlay' ? 'absolute' : 'relative';\n const shouldRenderInPortal = isPortaled && type === 'overlay';\n const Component = as ?? 'div';\n\n const Close = () => (\n <>\n {isCloseable && (\n <CleanIconButton\n className=\"ndl-drawer-close-button\"\n onClick={setOnExpandedChange}\n description=\"Close\"\n size=\"medium\"\n htmlAttributes={{\n title: 'Close drawer',\n }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n )}\n </>\n );\n\n if (isResizeable) {\n return (\n <ConditionalWrap\n shouldWrap={shouldRenderInPortal}\n wrap={(wrapChildren) => (\n <FloatingPortal preserveTabOrder={true} {...portalProps}>\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <Resizable\n as={Component}\n defaultSize={{\n height: '100%',\n width: 'auto',\n }}\n {...resizeableProps}\n className={classes}\n style={{\n position: resizableStylePosition,\n ...style,\n ...resizeableProps?.style,\n }}\n boundsByDirection={true}\n bounds=\"parent\"\n handleStyles={{\n /*\n * adding a small offset to the handle to make it easier to click\n * if the content of the drawer is scrollable, most noticeable if not using\n * a mouse on mac or chrome on windows with the fluent scrollbars\n */\n right: {\n right: '-8px',\n },\n }}\n enable={{\n bottom: false,\n bottomLeft: false,\n bottomRight: false,\n left: position === 'right',\n right: position === 'left',\n top: false,\n topLeft: false,\n topRight: false,\n }}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n <Close />\n </Resizable>\n </ConditionalWrap>\n );\n }\n\n return (\n <ConditionalWrap\n shouldWrap={shouldRenderInPortal}\n wrap={(wrapChildren) => (\n <FloatingPortal preserveTabOrder={true} {...portalProps}>\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n <Close />\n </Component>\n </ConditionalWrap>\n );\n};\n\nDrawerComponent.displayName = 'Drawer';\n\ntype DrawerHeaderProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'h5'>;\n};\n\nconst DrawerHeader = ({\n children,\n className = '',\n ...restProps\n}: DrawerHeaderProps) => {\n const classes = classNames('ndl-drawer-header', className);\n\n if (typeof children === 'string' || typeof children === 'number') {\n return (\n <Typography variant=\"title-3\" {...restProps} className={classes}>\n {children}\n </Typography>\n );\n }\n\n return (\n <div {...restProps} className={classes}>\n {children}\n </div>\n );\n};\n\ntype DrawerActionsProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerActions = ({\n children,\n className = '',\n ...restProps\n}: DrawerActionsProps) => {\n const classes = classNames('ndl-drawer-actions', className);\n\n return (\n <div {...restProps} className={classes}>\n {children}\n </div>\n );\n};\n\ntype DrawerBodyProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerBody = ({\n children,\n className = '',\n ...restProps\n}: DrawerBodyProps) => {\n const classes = classNames('ndl-drawer-body', className);\n\n return (\n <div className=\"ndl-drawer-body-wrapper\">\n <div {...restProps} className={classes}>\n {children}\n </div>\n </div>\n );\n};\n\nconst Drawer = Object.assign(DrawerComponent, {\n Actions: DrawerActions,\n Body: DrawerBody,\n Header: DrawerHeader,\n});\n\nexport { Drawer };\n"]}
1
+ {"version":3,"file":"Drawer.js","sourceRoot":"","sources":["../../../src/drawer/Drawer.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,SAAS,EAAuB,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAuB,WAAW,EAAE,MAAM,OAAO,CAAC;AAMzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA4C3C,MAAM,eAAe,GAAG,SAAS,eAAe,CAE9C,EAiBuC;QAjBvC,EACA,QAAQ,EACR,SAAS,GAAG,EAAE,EACd,UAAU,EACV,gBAAgB,EAChB,QAAQ,GAAG,MAAM,EACjB,IAAI,GAAG,SAAS,EAChB,YAAY,GAAG,KAAK,EACpB,eAAe,EACf,WAAW,GAAG,IAAI,EAClB,UAAU,GAAG,KAAK,EAClB,WAAW,GAAG,EAAE,EAChB,cAAc,EACd,KAAK,EACL,GAAG,EACH,EAAE,OAEqC,EADpC,SAAS,cAhBZ,sMAiBD,CADa;IAEZ,MAAM,mBAAmB,GAAG,WAAW,CAAC,GAAG,EAAE;QAC3C,IAAI,gBAAgB,EAAE,CAAC;YACrB,gBAAgB,CAAC,CAAC,UAAU,CAAC,CAAC;QAChC,CAA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weden 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 { FloatingPortal } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { Resizable, type ResizableProps } from 're-resizable';\nimport type React from 'react';\nimport { type ComponentProps, useCallback } from 'react';\n\nimport {\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport { CleanIconButton } from '../clean-icon-button';\nimport { ConditionalWrap } from '../conditional-wrap';\nimport { XMarkIconOutline } from '../icons';\nimport { Typography } from '../typography';\n\ntype DrawerPosition = 'left' | 'right';\n\ntype DrawerType = 'overlay' | 'push';\n\ntype DrawerProps = {\n /** Controls whether the drawer is open (expanded) or closed (collapsed). */\n isExpanded: boolean;\n\n /** Callback functions fired when the drawer's expanded state changes. */\n onExpandedChange?: (expanded: boolean) => void;\n\n /** Position where the drawer appears on screen. By default, it appears from the left. */\n position?: DrawerPosition;\n\n /** How the drawer affects the layout of sibling content. By default, it overlays content. */\n type?: DrawerType;\n\n /** Enables horizontal resizing of the drawer, by default it is not resizable. */\n isResizeable?: boolean;\n\n /** To use this prop the isResizeable prop must be set to true. For overriding the third party library props: https://github.com/bokuweb/re-resizable */\n resizeableProps?: ResizableProps;\n\n /** Whether a close button (X) is displayed in the drawer. */\n isCloseable?: boolean;\n\n /** Whether to portal the content */\n isPortaled?: boolean;\n\n /** The content to display within the drawer. */\n children: React.ReactNode;\n\n /** Additional CSS classes to apply to the drawer container. */\n className?: string;\n\n /**\n * Props to pass to the portal from @floating-ui/react FloatingPortal\n * @see https://floating-ui.com/docs/floatingportal\n */\n portalProps?: ComponentProps<typeof FloatingPortal>;\n};\n\nconst DrawerComponent = function DrawerComponent<\n T extends React.ElementType = 'div',\n>({\n children,\n className = '',\n isExpanded,\n onExpandedChange,\n position = 'left',\n type = 'overlay',\n isResizeable = false,\n resizeableProps,\n isCloseable = true,\n isPortaled = false,\n portalProps = {},\n htmlAttributes,\n style,\n ref,\n as,\n ...restProps\n}: PolymorphicCommonProps<T, DrawerProps>) {\n const setOnExpandedChange = useCallback(() => {\n if (onExpandedChange) {\n onExpandedChange(!isExpanded);\n }\n }, [isExpanded, onExpandedChange]);\n\n const classes = classNames('ndl-drawer', className, {\n 'ndl-drawer-expanded': isExpanded,\n 'ndl-drawer-left': position === 'left',\n 'ndl-drawer-overlay': type === 'overlay',\n 'ndl-drawer-push': type === 'push',\n 'ndl-drawer-right': position === 'right',\n });\n\n const resizableStylePosition = type === 'overlay' ? 'absolute' : 'relative';\n const shouldRenderInPortal = isPortaled && type === 'overlay';\n const Component = as ?? 'div';\n\n const Close = () => (\n <>\n {isCloseable && (\n <CleanIconButton\n className=\"ndl-drawer-close-button\"\n onClick={setOnExpandedChange}\n description=\"Close\"\n size=\"medium\"\n htmlAttributes={{\n title: 'Close drawer',\n }}\n >\n <XMarkIconOutline />\n </CleanIconButton>\n )}\n </>\n );\n\n if (isResizeable) {\n return (\n <ConditionalWrap\n shouldWrap={shouldRenderInPortal}\n wrap={(wrapChildren) => (\n <FloatingPortal preserveTabOrder={true} {...portalProps}>\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <Resizable\n as={Component}\n defaultSize={{\n height: '100%',\n width: 'auto',\n }}\n {...resizeableProps}\n className={classes}\n style={{\n position: resizableStylePosition,\n ...style,\n ...resizeableProps?.style,\n }}\n boundsByDirection={true}\n bounds=\"parent\"\n handleStyles={{\n /*\n * adding a small offset to the handle to make it easier to click\n * if the content of the drawer is scrollable, most noticeable if not using\n * a mouse on mac or chrome on windows with the fluent scrollbars\n */\n right: {\n right: '-8px',\n },\n }}\n enable={{\n bottom: false,\n bottomLeft: false,\n bottomRight: false,\n left: position === 'right',\n right: position === 'left',\n top: false,\n topLeft: false,\n topRight: false,\n }}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n <Close />\n </Resizable>\n </ConditionalWrap>\n );\n }\n\n return (\n <ConditionalWrap\n shouldWrap={shouldRenderInPortal}\n wrap={(wrapChildren) => (\n <FloatingPortal preserveTabOrder={true} {...portalProps}>\n {wrapChildren}\n </FloatingPortal>\n )}\n >\n <Component\n className={classes}\n style={style}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n <Close />\n </Component>\n </ConditionalWrap>\n );\n};\n\nDrawerComponent.displayName = 'Drawer';\n\ntype DrawerHeaderProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'h5'>;\n};\n\nconst DrawerHeader = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerHeaderProps) => {\n const classes = classNames('ndl-drawer-header', className);\n\n if (typeof children === 'string' || typeof children === 'number') {\n return (\n <Typography\n className={classes}\n variant=\"title-3\"\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Typography>\n );\n }\n\n return (\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n );\n};\n\ntype DrawerActionsProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerActions = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerActionsProps) => {\n const classes = classNames('ndl-drawer-actions', className);\n\n return (\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n );\n};\n\ntype DrawerBodyProps = {\n children: React.ReactNode;\n className?: string;\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst DrawerBody = ({\n children,\n className = '',\n htmlAttributes,\n ...restProps\n}: DrawerBodyProps) => {\n const classes = classNames('ndl-drawer-body', className);\n\n return (\n <div className=\"ndl-drawer-body-wrapper\">\n <div className={classes} {...restProps} {...htmlAttributes}>\n {children}\n </div>\n </div>\n );\n};\n\nconst Drawer = Object.assign(DrawerComponent, {\n Actions: DrawerActions,\n Body: DrawerBody,\n Header: DrawerHeader,\n});\n\nexport { Drawer };\n"]}
@@ -1,3 +1,14 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
13
  /**
3
14
  *
@@ -28,7 +39,8 @@ import { ChevronDownIconOutline } from '../icons';
28
39
  *
29
40
  *
30
41
  */
31
- export const DropdownButton = function DropdownButton({ as, children, size = 'medium', isDisabled = false, isFloating = false, leadingElement, isOpen = false, onClick, className, style, htmlAttributes, ref, }) {
42
+ export const DropdownButton = function DropdownButton(_a) {
43
+ var { as, children, size = 'medium', isDisabled = false, isFloating = false, leadingElement, isOpen = false, onClick, className, style, htmlAttributes, ref } = _a, restProps = __rest(_a, ["as", "children", "size", "isDisabled", "isFloating", "leadingElement", "isOpen", "onClick", "className", "style", "htmlAttributes", "ref"]);
32
44
  const classes = classNames('ndl-dropdown-btn', className, {
33
45
  'ndl-disabled': isDisabled,
34
46
  'ndl-floating-btn': isFloating,
@@ -38,7 +50,7 @@ export const DropdownButton = function DropdownButton({ as, children, size = 'me
38
50
  'ndl-small': size === 'small',
39
51
  });
40
52
  const Component = as !== null && as !== void 0 ? as : 'button';
41
- return (_jsx(Component, Object.assign({ className: classes, disabled: isDisabled, onClick: onClick, "aria-expanded": isOpen, ref: ref, style: style }, htmlAttributes, { children: _jsxs("div", { className: "ndl-dropdown-btn-inner", children: [_jsxs("div", { className: "ndl-dropdown-btn-leading-wrapper", children: [leadingElement, _jsx("span", { className: "ndl-dropdown-btn-content", children: children })] }), _jsx(ChevronDownIconOutline, { className: classNames('ndl-dropdown-button-icon', {
53
+ return (_jsx(Component, Object.assign({ className: classes, disabled: isDisabled, onClick: onClick, "aria-expanded": isOpen, ref: ref, style: style }, restProps, htmlAttributes, { children: _jsxs("div", { className: "ndl-dropdown-btn-inner", children: [_jsxs("div", { className: "ndl-dropdown-btn-leading-wrapper", children: [leadingElement, _jsx("span", { className: "ndl-dropdown-btn-content", children: children })] }), _jsx(ChevronDownIconOutline, { className: classNames('ndl-dropdown-button-icon', {
42
54
  'ndl-dropdown-button-icon-open': isOpen,
43
55
  }) })] }) })));
44
56
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownButton.js","sourceRoot":"","sources":["../../../src/dropdown-button/DropdownButton.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AAIpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AA6BlD;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,cAAc,CAEnD,EACA,EAAE,EACF,QAAQ,EACR,IAAI,GAAG,QAAQ,EACf,UAAU,GAAG,KAAK,EAClB,UAAU,GAAG,KAAK,EAClB,cAAc,EACd,MAAM,GAAG,KAAK,EACd,OAAO,EACP,SAAS,EACT,KAAK,EACL,cAAc,EACd,GAAG,GAC4C;IAC/C,MAAM,OAAO,GAAG,UAAU,CAAC,kBAAkB,EAAE,SAAS,EAAE;QACxD,cAAc,EAAE,UAAU;QAC1B,kBAAkB,EAAE,UAAU;QAC9B,WAAW,EAAE,IAAI,KAAK,OAAO;QAC7B,YAAY,EAAE,IAAI,KAAK,QAAQ;QAC/B,UAAU,EAAE,MAAM;QAClB,WAAW,EAAE,IAAI,KAAK,OAAO;KAC9B,CAAC,CAAC;IAEH,MAAM,SAAS,GAAsB,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,QAAQ,CAAC;IAEpD,OAAO,CACL,KAAC,SAAS,kBACR,SAAS,EAAE,OAAO,EAClB,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,OAAO,mBACD,MAAM,EACrB,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,IACR,cAAc,cAElB,eAAK,SAAS,EAAC,wBAAwB,aACrC,eAAK,SAAS,EAAC,kCAAkC,aAC9C,cAAc,EACf,eAAM,SAAS,EAAC,0BAA0B,YAAE,QAAQ,GAAQ,IACxD,EAEN,KAAC,sBAAsB,IACrB,SAAS,EAAE,UAAU,CAAC,0BAA0B,EAAE;wBAChD,+BAA+B,EAAE,MAAM;qBACxC,CAAC,GACF,IACE,IACI,CACb,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport type React from 'react';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { ChevronDownIconOutline } from '../icons';\n\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype DropdownButtonProps = {\n /** Content displayed in the button */\n children: React.ReactNode;\n /** Size of button */\n size?: 'small' | 'medium' | 'large';\n /** Whether the button is in floating state */\n isFloating?: boolean;\n /** Whether the button is in disabled state */\n isDisabled?: boolean;\n /** Element that is shown before the button content */\n leadingElement?: React.ReactNode;\n /** If the dropdown is activated */\n isOpen?: boolean;\n /** Callback function to be called when the button is clicked */\n onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n /** Additional classnames */\n className?: string;\n};\n\n/**\n *\n *\n * DropdownButton Component\n *\n *\n */\n\nexport const DropdownButton = function DropdownButton<\n T extends React.ElementType = 'button',\n>({\n as,\n children,\n size = 'medium',\n isDisabled = false,\n isFloating = false,\n leadingElement,\n isOpen = false,\n onClick,\n className,\n style,\n htmlAttributes,\n ref,\n}: PolymorphicCommonProps<T, DropdownButtonProps>) {\n const classes = classNames('ndl-dropdown-btn', className, {\n 'ndl-disabled': isDisabled,\n 'ndl-floating-btn': isFloating,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-open': isOpen,\n 'ndl-small': size === 'small',\n });\n\n const Component: React.ElementType = as ?? 'button';\n\n return (\n <Component\n className={classes}\n disabled={isDisabled}\n onClick={onClick}\n aria-expanded={isOpen}\n ref={ref}\n style={style}\n {...htmlAttributes}\n >\n <div className=\"ndl-dropdown-btn-inner\">\n <div className=\"ndl-dropdown-btn-leading-wrapper\">\n {leadingElement}\n <span className=\"ndl-dropdown-btn-content\">{children}</span>\n </div>\n\n <ChevronDownIconOutline\n className={classNames('ndl-dropdown-button-icon', {\n 'ndl-dropdown-button-icon-open': isOpen,\n })}\n />\n </div>\n </Component>\n );\n};\n"]}
1
+ {"version":3,"file":"DropdownButton.js","sourceRoot":"","sources":["../../../src/dropdown-button/DropdownButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,UAAU,MAAM,YAAY,CAAC;AAIpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AA6BlD;;;;;;GAMG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,cAAc,CAEnD,EAc+C;QAd/C,EACA,EAAE,EACF,QAAQ,EACR,IAAI,GAAG,QAAQ,EACf,UAAU,GAAG,KAAK,EAClB,UAAU,GAAG,KAAK,EAClB,cAAc,EACd,MAAM,GAAG,KAAK,EACd,OAAO,EACP,SAAS,EACT,KAAK,EACL,cAAc,EACd,GAAG,OAE4C,EAD5C,SAAS,cAbZ,4IAcD,CADa;IAEZ,MAAM,OAAO,GAAG,UAAU,CAAC,kBAAkB,EAAE,SAAS,EAAE;QACxD,cAAc,EAAE,UAAU;QAC1B,kBAAkB,EAAE,UAAU;QAC9B,WAAW,EAAE,IAAI,KAAK,OAAO;QAC7B,YAAY,EAAE,IAAI,KAAK,QAAQ;QAC/B,UAAU,EAAE,MAAM;QAClB,WAAW,EAAE,IAAI,KAAK,OAAO;KAC9B,CAAC,CAAC;IAEH,MAAM,SAAS,GAAsB,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,QAAQ,CAAC;IAEpD,OAAO,CACL,KAAC,SAAS,kBACR,SAAS,EAAE,OAAO,EAClB,QAAQ,EAAE,UAAU,EACpB,OAAO,EAAE,OAAO,mBACD,MAAM,EACrB,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,IACR,SAAS,EACT,cAAc,cAElB,eAAK,SAAS,EAAC,wBAAwB,aACrC,eAAK,SAAS,EAAC,kCAAkC,aAC9C,cAAc,EACf,eAAM,SAAS,EAAC,0BAA0B,YAAE,QAAQ,GAAQ,IACxD,EAEN,KAAC,sBAAsB,IACrB,SAAS,EAAE,UAAU,CAAC,0BAA0B,EAAE;wBAChD,+BAA+B,EAAE,MAAM;qBACxC,CAAC,GACF,IACE,IACI,CACb,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport type React from 'react';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { ChevronDownIconOutline } from '../icons';\n\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype DropdownButtonProps = {\n /** Content displayed in the button */\n children: React.ReactNode;\n /** Size of button */\n size?: 'small' | 'medium' | 'large';\n /** Whether the button is in floating state */\n isFloating?: boolean;\n /** Whether the button is in disabled state */\n isDisabled?: boolean;\n /** Element that is shown before the button content */\n leadingElement?: React.ReactNode;\n /** If the dropdown is activated */\n isOpen?: boolean;\n /** Callback function to be called when the button is clicked */\n onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n /** Additional classnames */\n className?: string;\n};\n\n/**\n *\n *\n * DropdownButton Component\n *\n *\n */\n\nexport const DropdownButton = function DropdownButton<\n T extends React.ElementType = 'button',\n>({\n as,\n children,\n size = 'medium',\n isDisabled = false,\n isFloating = false,\n leadingElement,\n isOpen = false,\n onClick,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, DropdownButtonProps>) {\n const classes = classNames('ndl-dropdown-btn', className, {\n 'ndl-disabled': isDisabled,\n 'ndl-floating-btn': isFloating,\n 'ndl-large': size === 'large',\n 'ndl-medium': size === 'medium',\n 'ndl-open': isOpen,\n 'ndl-small': size === 'small',\n });\n\n const Component: React.ElementType = as ?? 'button';\n\n return (\n <Component\n className={classes}\n disabled={isDisabled}\n onClick={onClick}\n aria-expanded={isOpen}\n ref={ref}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-dropdown-btn-inner\">\n <div className=\"ndl-dropdown-btn-leading-wrapper\">\n {leadingElement}\n <span className=\"ndl-dropdown-btn-content\">{children}</span>\n </div>\n\n <ChevronDownIconOutline\n className={classNames('ndl-dropdown-button-icon', {\n 'ndl-dropdown-button-icon-open': isOpen,\n })}\n />\n </div>\n </Component>\n );\n};\n"]}
@@ -63,8 +63,9 @@ const DropzoneComponent = (_a) => {
63
63
  if (acceptedFileExtensions && acceptedFileExtensions.length > 0) {
64
64
  for (const file of acceptedFiles) {
65
65
  const isAccepted = acceptedFileExtensions.some((extension) => {
66
- if (file.name.endsWith(extension))
66
+ if (file.name.endsWith(extension)) {
67
67
  return true;
68
+ }
68
69
  });
69
70
  if (!isAccepted) {
70
71
  setIsRejected(true);
@@ -105,7 +106,7 @@ const DropzoneComponent = (_a) => {
105
106
  };
106
107
  const DropzoneLoadingProgressBarComponent = (_a) => {
107
108
  var { progressBarPrecentage, progressBarMinute, htmlAttributes, className, style, ref } = _a, restProps = __rest(_a, ["progressBarPrecentage", "progressBarMinute", "htmlAttributes", "className", "style", "ref"]);
108
- return (_jsxs("div", { className: "ndl-dropzone-loading-progress-bar-wrapper", children: [_jsxs("div", { className: "ndl-dropzone-loading-progress-bar-indicators", children: [_jsx(Typography, { className: "ndl-dropzone-loading-progress-bar-precentage", variant: "subheading-small", children: progressBarPrecentage + '%' }), Boolean(progressBarMinute) && (_jsx(Typography, { className: "ndl-dropzone-loading-progress-bar-minute", variant: "body-medium", children: `(${progressBarMinute} minutes left)` }))] }), _jsx(ProgressBar, Object.assign({ className: classNames('ndl-dropzone-loading-progress-bar', className), value: progressBarPrecentage, size: "large", htmlAttributes: htmlAttributes, ref: ref, style: style }, restProps))] }));
109
+ return (_jsxs("div", { className: "ndl-dropzone-loading-progress-bar-wrapper", children: [_jsxs("div", { className: "ndl-dropzone-loading-progress-bar-indicators", children: [_jsx(Typography, { className: "ndl-dropzone-loading-progress-bar-precentage", variant: "subheading-small", children: `${progressBarPrecentage}%` }), Boolean(progressBarMinute) && (_jsx(Typography, { className: "ndl-dropzone-loading-progress-bar-minute", variant: "body-medium", children: `(${progressBarMinute} minutes left)` }))] }), _jsx(ProgressBar, Object.assign({ className: classNames('ndl-dropzone-loading-progress-bar', className), value: progressBarPrecentage, size: "large", htmlAttributes: htmlAttributes, ref: ref, style: style }, restProps))] }));
109
110
  };
110
111
  const Dropzone = Object.assign(DropzoneComponent, {
111
112
  LoadingProgressBar: DropzoneLoadingProgressBarComponent,
@@ -1 +1 @@
1
- {"version":3,"file":"Dropzone.js","sourceRoot":"","sources":["../../../src/dropzone/Dropzone.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAkB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAIL,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAqC3C;;;;;;GAMG;AAEH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC;AAEzB,MAAM,QAAQ,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,MAAK,QAAQ,CAAC;AAE5C,MAAM,iBAAiB,GAAG,CAAC,EAYS,EAAE,EAAE;QAZb,EACzB,eAAe,EACf,yBAAyB,EACzB,cAAc,EACd,OAAO,EACP,YAAY,EACZ,sBAAsB,EACtB,cAAc,EACd,KAAK,EACL,SAAS,EACT,G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,CADa;IAEZ,OAAO,CACL,eAAK,SAAS,EAAC,2CAA2C,aACxD,eAAK,SAAS,EAAC,8CAA8C,aAC3D,KAAC,UAAU,IACT,SAAS,EAAC,8CAA8C,EACxD,OAAO,EAAC,kBAAkB,YAEzB,qBAAqB,GAAG,GAAG,GACjB,EACZ,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAC7B,KAAC,UAAU,IACT,SAAS,EAAC,0CAA0C,EACpD,OAAO,EAAC,aAAa,YACrB,IAAI,iBAAiB,gBAAgB,GAAc,CACtD,IACG,EACN,KAAC,WAAW,kBACV,SAAS,EAAE,UAAU,CAAC,mCAAmC,EAAE,SAAS,CAAC,EACrE,KAAK,EAAE,qBAAqB,EAC5B,IAAI,EAAC,OAAO,EACZ,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,IACR,SAAS,EACb,IACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE;IAChD,kBAAkB,EAAE,mCAAmC;CACxD,CAAC,CAAC;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { useMergeRefs } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { detect } from 'detect-browser';\nimport { type RefObject, useMemo, useRef, useState } from 'react';\nimport {\n type DropEvent,\n type DropzoneOptions,\n type FileRejection,\n useDropzone,\n} from 'react-dropzone';\nimport { useResizeObserver } from 'usehooks-ts';\n\nimport { type CommonProps } from '../_common/types';\nimport { Banner } from '../banner';\nimport {\n DocumentArrowUpIconOutline,\n DocumentArrowUpIconSolid,\n XCircleIconSolid,\n} from '../icons';\nimport { ProgressBar } from '../progress-bar';\nimport { Typography } from '../typography';\n\n/**\n *\n *\n * Types\n *\n *\n */\ntype DropzoneProps = {\n /** Props for the underlying `react-dropzone` component. Don't use `accept`. If using custom file extensions as this option is broken. Instead use the `acceptedFileExtensions` property. */\n dropZoneOptions: DropzoneOptions;\n\n /** Informational text that highlights the supported file types, will be displayed in the footer. */\n supportedFilesDescription?: React.ReactNode;\n\n /** Element to display when uploading the file.*/\n loadingElement?: React.ReactNode;\n\n /** Use when wanting a custom heading. */\n heading?: React.ReactNode;\n\n /** Message to be shown when file is rejected. */\n rejectedText?: React.ReactNode;\n\n /** The accepted file extensions for the Drag-and-Drop. */\n acceptedFileExtensions?: string[];\n};\n\ntype DropzoneLoadingProgressBarProps = {\n /** The percentage of the progress bar. */\n progressBarPrecentage: number;\n\n /** The time in minute left to upload the file. */\n progressBarMinute?: number;\n};\n\n/**\n *\n *\n * Helpers\n *\n *\n */\n\nconst browser = detect();\n\nconst isSafari = browser?.name === 'safari';\n\nconst DropzoneComponent = ({\n dropZoneOptions,\n supportedFilesDescription,\n loadingElement,\n heading,\n rejectedText,\n acceptedFileExtensions,\n htmlAttributes,\n style,\n className,\n ref,\n ...restProps\n}: CommonProps<'div', DropzoneProps>) => {\n /**\n * We intercept the onDrop function in order to enforce\n * custom file extensions. Before calling the onDrop props we check\n * if the custom file extensions is acceptable. If the extension\n * conforms to acceptedFileExtensions, we call onDrop. Otherwise, we\n * present an error message.\n */\n function onDropInterceptor<T extends File>(\n acceptedFiles: T[],\n fileRejections: FileRejection[],\n event: DropEvent,\n ) {\n if (acceptedFileExtensions && acceptedFileExtensions.length > 0) {\n for (const file of acceptedFiles) {\n const isAccepted = acceptedFileExtensions.some((extension) => {\n if (file.name.endsWith(extension)) return true;\n });\n if (!isAccepted) {\n setIsRejected(true);\n return;\n }\n }\n }\n setIsRejected(false);\n dropZoneOptions.onDrop?.(acceptedFiles, fileRejections, event);\n }\n\n const [isRejected, setIsRejected] = useState(false);\n const dropZoneRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs([dropZoneRef, ref]);\n const isDisabled = dropZoneOptions?.disabled || Boolean(loadingElement);\n\n const {\n getRootProps,\n getInputProps,\n isDragActive,\n isDragAccept,\n isDragReject,\n open,\n } = useDropzone({\n ...dropZoneOptions,\n disabled: isDisabled,\n noClick: true,\n onDrop: onDropInterceptor,\n });\n\n const { width } = useResizeObserver({\n ref: dropZoneRef as RefObject<HTMLElement>,\n });\n\n const isUploading = Boolean(loadingElement);\n\n const titleText =\n isDragActive && isDragReject\n ? 'Format not supported'\n : isDragActive && !isDragReject\n ? 'Drop file'\n : null;\n\n const computedFileImage =\n (isDragActive && isDragAccept) || isUploading ? (\n <DocumentArrowUpIconSolid className=\"n-size-token-48 n-text-primary-bg-strong\" />\n ) : (\n <XCircleIconSolid className=\"n-size-token-48 n-text-danger-bg-strong\" />\n );\n\n const wrapperClasses = classNames('ndl-dropzone', className, {\n 'ndl-drag-active': isDragActive,\n 'ndl-drag-disabled': dropZoneOptions?.disabled,\n 'ndl-file-invalid': isDragActive && isDragReject,\n });\n\n useMemo(() => {\n if (isDragActive && isRejected) {\n setIsRejected(false);\n }\n }, [isDragActive, isRejected]);\n\n return (\n <>\n {isRejected && (\n <Banner className=\"ndl-dropzone-error-alert\" variant=\"danger\">\n <Banner.Header>Error</Banner.Header>\n <Banner.Description>\n {Boolean(rejectedText) || 'File extension not supported.'}\n </Banner.Description>\n </Banner>\n )}\n <div\n ref={mergedRef}\n className={wrapperClasses}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-dropzone-inner-wrapper\" {...getRootProps()}>\n <input aria-label=\"Drag and drop area\" {...getInputProps()} />\n <div className=\"ndl-dropzone-inner\">\n {/* Illustration should be visible only after arbitrary width */}\n {width !== undefined && width > 230 && (\n <>\n {isDragActive && !isSafari ? (\n computedFileImage\n ) : (\n <DocumentArrowUpIconOutline className=\"ndl-dropzone-upload-icon\" />\n )}\n </>\n )}\n {!isUploading && (\n <div className=\"ndl-dnd-title-container\">\n <Typography variant=\"subheading-medium\">\n {titleText ||\n (heading ?? (\n <>\n Drag <span className=\"n-font-light\">&</span> Drop\n </>\n ))}\n </Typography>\n {!isDragReject && (\n <div className=\"ndl-dnd-subtitle\">\n <Typography variant=\"body-medium\">or</Typography>{' '}\n <button\n className=\"ndl-dnd-browse-link\"\n onClick={() => open()}\n disabled={isDisabled}\n type=\"button\"\n >\n Browse\n </button>\n </div>\n )}\n </div>\n )}\n <div className=\"ndl-dropzone-footer\">\n {isUploading && <>{loadingElement}</>}\n {!isUploading && (\n <div className=\"ndl-file-support-text\">\n {supportedFilesDescription}\n </div>\n )}\n </div>\n </div>\n </div>\n </div>\n </>\n );\n};\n\nconst DropzoneLoadingProgressBarComponent = ({\n progressBarPrecentage,\n progressBarMinute,\n htmlAttributes,\n className,\n style,\n ref,\n ...restProps\n}: CommonProps<'div', DropzoneLoadingProgressBarProps>) => {\n return (\n <div className=\"ndl-dropzone-loading-progress-bar-wrapper\">\n <div className=\"ndl-dropzone-loading-progress-bar-indicators\">\n <Typography\n className=\"ndl-dropzone-loading-progress-bar-precentage\"\n variant=\"subheading-small\"\n >\n {progressBarPrecentage + '%'}\n </Typography>\n {Boolean(progressBarMinute) && (\n <Typography\n className=\"ndl-dropzone-loading-progress-bar-minute\"\n variant=\"body-medium\"\n >{`(${progressBarMinute} minutes left)`}</Typography>\n )}\n </div>\n <ProgressBar\n className={classNames('ndl-dropzone-loading-progress-bar', className)}\n value={progressBarPrecentage}\n size=\"large\"\n htmlAttributes={htmlAttributes}\n ref={ref}\n style={style}\n {...restProps}\n />\n </div>\n );\n};\n\nconst Dropzone = Object.assign(DropzoneComponent, {\n LoadingProgressBar: DropzoneLoadingProgressBarComponent,\n});\n\nexport { Dropzone };\n"]}
1
+ {"version":3,"file":"Dropzone.js","sourceRoot":"","sources":["../../../src/dropzone/Dropzone.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAkB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAIL,WAAW,GACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,EACxB,gBAAgB,GACjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAqC3C;;;;;;GAMG;AAEH,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC;AAEzB,MAAM,QAAQ,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,MAAK,QAAQ,CAAC;AAE5C,MAAM,iBAAiB,GAAG,CAAC,EAYS,EAAE,EAAE;QAZb,EACzB,eAAe,EACf,yBAAyB,EACzB,cAAc,EACd,OAAO,EACP,YAAY,EACZ,sBAAsB,EACtB,cAAc,EACd,KAAK,EACL,SAAS,EACT,GAAG,OAE+B,EAD/B,SAAS,cAXa,sKAY1B,CADa;IAEZ;;;;;;OAMG;IACH,SAAS,iBAAiB,CACxB,aAAkB,EAClB,cAA+B,EAC/B,KAAgB;;QAEhB,IAAI,sBAAsB,IAAI,sB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,OAAO,EAAC,kBAAkB,YAEzB,GAAG,qBAAqB,GAAG,GACjB,EACZ,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAC7B,KAAC,UAAU,IACT,SAAS,EAAC,0CAA0C,EACpD,OAAO,EAAC,aAAa,YACrB,IAAI,iBAAiB,gBAAgB,GAAc,CACtD,IACG,EACN,KAAC,WAAW,kBACV,SAAS,EAAE,UAAU,CAAC,mCAAmC,EAAE,SAAS,CAAC,EACrE,KAAK,EAAE,qBAAqB,EAC5B,IAAI,EAAC,OAAO,EACZ,cAAc,EAAE,cAAc,EAC9B,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,IACR,SAAS,EACb,IACE,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE;IAChD,kBAAkB,EAAE,mCAAmC;CACxD,CAAC,CAAC;AAEH,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { useMergeRefs } from '@floating-ui/react';\nimport classNames from 'classnames';\nimport { detect } from 'detect-browser';\nimport { type RefObject, useMemo, useRef, useState } from 'react';\nimport {\n type DropEvent,\n type DropzoneOptions,\n type FileRejection,\n useDropzone,\n} from 'react-dropzone';\nimport { useResizeObserver } from 'usehooks-ts';\n\nimport { type CommonProps } from '../_common/types';\nimport { Banner } from '../banner';\nimport {\n DocumentArrowUpIconOutline,\n DocumentArrowUpIconSolid,\n XCircleIconSolid,\n} from '../icons';\nimport { ProgressBar } from '../progress-bar';\nimport { Typography } from '../typography';\n\n/**\n *\n *\n * Types\n *\n *\n */\ntype DropzoneProps = {\n /** Props for the underlying `react-dropzone` component. Don't use `accept`. If using custom file extensions as this option is broken. Instead use the `acceptedFileExtensions` property. */\n dropZoneOptions: DropzoneOptions;\n\n /** Informational text that highlights the supported file types, will be displayed in the footer. */\n supportedFilesDescription?: React.ReactNode;\n\n /** Element to display when uploading the file.*/\n loadingElement?: React.ReactNode;\n\n /** Use when wanting a custom heading. */\n heading?: React.ReactNode;\n\n /** Message to be shown when file is rejected. */\n rejectedText?: React.ReactNode;\n\n /** The accepted file extensions for the Drag-and-Drop. */\n acceptedFileExtensions?: string[];\n};\n\ntype DropzoneLoadingProgressBarProps = {\n /** The percentage of the progress bar. */\n progressBarPrecentage: number;\n\n /** The time in minute left to upload the file. */\n progressBarMinute?: number;\n};\n\n/**\n *\n *\n * Helpers\n *\n *\n */\n\nconst browser = detect();\n\nconst isSafari = browser?.name === 'safari';\n\nconst DropzoneComponent = ({\n dropZoneOptions,\n supportedFilesDescription,\n loadingElement,\n heading,\n rejectedText,\n acceptedFileExtensions,\n htmlAttributes,\n style,\n className,\n ref,\n ...restProps\n}: CommonProps<'div', DropzoneProps>) => {\n /**\n * We intercept the onDrop function in order to enforce\n * custom file extensions. Before calling the onDrop props we check\n * if the custom file extensions is acceptable. If the extension\n * conforms to acceptedFileExtensions, we call onDrop. Otherwise, we\n * present an error message.\n */\n function onDropInterceptor<T extends File>(\n acceptedFiles: T[],\n fileRejections: FileRejection[],\n event: DropEvent,\n ) {\n if (acceptedFileExtensions && acceptedFileExtensions.length > 0) {\n for (const file of acceptedFiles) {\n const isAccepted = acceptedFileExtensions.some((extension) => {\n if (file.name.endsWith(extension)) {\n return true;\n }\n });\n if (!isAccepted) {\n setIsRejected(true);\n return;\n }\n }\n }\n setIsRejected(false);\n dropZoneOptions.onDrop?.(acceptedFiles, fileRejections, event);\n }\n\n const [isRejected, setIsRejected] = useState(false);\n const dropZoneRef = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs([dropZoneRef, ref]);\n const isDisabled = dropZoneOptions?.disabled || Boolean(loadingElement);\n\n const {\n getRootProps,\n getInputProps,\n isDragActive,\n isDragAccept,\n isDragReject,\n open,\n } = useDropzone({\n ...dropZoneOptions,\n disabled: isDisabled,\n noClick: true,\n onDrop: onDropInterceptor,\n });\n\n const { width } = useResizeObserver({\n ref: dropZoneRef as RefObject<HTMLElement>,\n });\n\n const isUploading = Boolean(loadingElement);\n\n const titleText =\n isDragActive && isDragReject\n ? 'Format not supported'\n : isDragActive && !isDragReject\n ? 'Drop file'\n : null;\n\n const computedFileImage =\n (isDragActive && isDragAccept) || isUploading ? (\n <DocumentArrowUpIconSolid className=\"n-size-token-48 n-text-primary-bg-strong\" />\n ) : (\n <XCircleIconSolid className=\"n-size-token-48 n-text-danger-bg-strong\" />\n );\n\n const wrapperClasses = classNames('ndl-dropzone', className, {\n 'ndl-drag-active': isDragActive,\n 'ndl-drag-disabled': dropZoneOptions?.disabled,\n 'ndl-file-invalid': isDragActive && isDragReject,\n });\n\n useMemo(() => {\n if (isDragActive && isRejected) {\n setIsRejected(false);\n }\n }, [isDragActive, isRejected]);\n\n return (\n <>\n {isRejected && (\n <Banner className=\"ndl-dropzone-error-alert\" variant=\"danger\">\n <Banner.Header>Error</Banner.Header>\n <Banner.Description>\n {Boolean(rejectedText) || 'File extension not supported.'}\n </Banner.Description>\n </Banner>\n )}\n <div\n ref={mergedRef}\n className={wrapperClasses}\n style={style}\n {...restProps}\n {...htmlAttributes}\n >\n <div className=\"ndl-dropzone-inner-wrapper\" {...getRootProps()}>\n <input aria-label=\"Drag and drop area\" {...getInputProps()} />\n <div className=\"ndl-dropzone-inner\">\n {/* Illustration should be visible only after arbitrary width */}\n {width !== undefined && width > 230 && (\n <>\n {isDragActive && !isSafari ? (\n computedFileImage\n ) : (\n <DocumentArrowUpIconOutline className=\"ndl-dropzone-upload-icon\" />\n )}\n </>\n )}\n {!isUploading && (\n <div className=\"ndl-dnd-title-container\">\n <Typography variant=\"subheading-medium\">\n {titleText ||\n (heading ?? (\n <>\n Drag <span className=\"n-font-light\">&</span> Drop\n </>\n ))}\n </Typography>\n {!isDragReject && (\n <div className=\"ndl-dnd-subtitle\">\n <Typography variant=\"body-medium\">or</Typography>{' '}\n <button\n className=\"ndl-dnd-browse-link\"\n onClick={() => open()}\n disabled={isDisabled}\n type=\"button\"\n >\n Browse\n </button>\n </div>\n )}\n </div>\n )}\n <div className=\"ndl-dropzone-footer\">\n {isUploading && <>{loadingElement}</>}\n {!isUploading && (\n <div className=\"ndl-file-support-text\">\n {supportedFilesDescription}\n </div>\n )}\n </div>\n </div>\n </div>\n </div>\n </>\n );\n};\n\nconst DropzoneLoadingProgressBarComponent = ({\n progressBarPrecentage,\n progressBarMinute,\n htmlAttributes,\n className,\n style,\n ref,\n ...restProps\n}: CommonProps<'div', DropzoneLoadingProgressBarProps>) => {\n return (\n <div className=\"ndl-dropzone-loading-progress-bar-wrapper\">\n <div className=\"ndl-dropzone-loading-progress-bar-indicators\">\n <Typography\n className=\"ndl-dropzone-loading-progress-bar-precentage\"\n variant=\"subheading-small\"\n >\n {`${progressBarPrecentage}%`}\n </Typography>\n {Boolean(progressBarMinute) && (\n <Typography\n className=\"ndl-dropzone-loading-progress-bar-minute\"\n variant=\"body-medium\"\n >{`(${progressBarMinute} minutes left)`}</Typography>\n )}\n </div>\n <ProgressBar\n className={classNames('ndl-dropzone-loading-progress-bar', className)}\n value={progressBarPrecentage}\n size=\"large\"\n htmlAttributes={htmlAttributes}\n ref={ref}\n style={style}\n {...restProps}\n />\n </div>\n );\n};\n\nconst Dropzone = Object.assign(DropzoneComponent, {\n LoadingProgressBar: DropzoneLoadingProgressBarComponent,\n});\n\nexport { Dropzone };\n"]}
@@ -22,9 +22,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
22
22
  import { Dropzone } from '@neo4j-ndl/react';
23
23
  const Component = () => {
24
24
  const onDrop = (files) => {
25
- alert('attempted to upload ' +
26
- files.length +
27
- ' file(s). Check console logs for more info');
25
+ alert(`attempted to upload ${files.length} file(s). Check console logs for more info`);
28
26
  };
29
27
  return (_jsx(Dropzone, { supportedFilesDescription: "Supports: CSV", dropZoneOptions: {
30
28
  accept: { 'text/csv': ['.csv'] },
@@ -1 +1 @@
1
- {"version":3,"file":"dropzone-csv-files.story.js","sourceRoot":"","sources":["../../../../src/dropzone/stories/dropzone-csv-files.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,MAAM,GAA8B,CAAC,KAAK,EAAE,EAAE;QAClD,KAAK,CACH,sBAAsB;YACpB,KAAK,CAAC,MAAM;YACZ,4CAA4C,CAC/C,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,QAAQ,IACP,yBAAyB,EAAC,eAAe,EACzC,eAAe,EAAE;YACf,MAAM,EAAE,EAAE,UAAU,EAAE,CAAC,MAAM,CAAC,EAAE;YAChC,MAAM;SACP,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { Dropzone } from '@neo4j-ndl/react';\nimport { type DropzoneOptions } from 'react-dropzone';\n\nconst Component = () => {\n const onDrop: DropzoneOptions['onDrop'] = (files) => {\n alert(\n 'attempted to upload ' +\n files.length +\n ' file(s). Check console logs for more info',\n );\n };\n\n return (\n <Dropzone\n supportedFilesDescription=\"Supports: CSV\"\n dropZoneOptions={{\n accept: { 'text/csv': ['.csv'] },\n onDrop,\n }}\n />\n );\n};\n\nexport default Component;\n"]}
1
+ {"version":3,"file":"dropzone-csv-files.story.js","sourceRoot":"","sources":["../../../../src/dropzone/stories/dropzone-csv-files.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,MAAM,GAA8B,CAAC,KAAK,EAAE,EAAE;QAClD,KAAK,CACH,uBACE,KAAK,CAAC,MACR,4CAA4C,CAC7C,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,QAAQ,IACP,yBAAyB,EAAC,eAAe,EACzC,eAAe,EAAE;YACf,MAAM,EAAE,EAAE,UAAU,EAAE,CAAC,MAAM,CAAC,EAAE;YAChC,MAAM;SACP,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { Dropzone } from '@neo4j-ndl/react';\nimport { type DropzoneOptions } from 'react-dropzone';\n\nconst Component = () => {\n const onDrop: DropzoneOptions['onDrop'] = (files) => {\n alert(\n `attempted to upload ${\n files.length\n } file(s). Check console logs for more info`,\n );\n };\n\n return (\n <Dropzone\n supportedFilesDescription=\"Supports: CSV\"\n dropZoneOptions={{\n accept: { 'text/csv': ['.csv'] },\n onDrop,\n }}\n />\n );\n};\n\nexport default Component;\n"]}
@@ -22,9 +22,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
22
22
  import { Dropzone } from '@neo4j-ndl/react';
23
23
  const Component = () => {
24
24
  const onDrop = (files) => {
25
- alert('attempted to upload ' +
26
- files.length +
27
- ' file(s). Check console logs for more info');
25
+ alert(`attempted to upload ${files.length} file(s). Check console logs for more info`);
28
26
  };
29
27
  return (_jsx(Dropzone, { supportedFilesDescription: "Supports: .dump", acceptedFileExtensions: ['.dump'], dropZoneOptions: {
30
28
  onDrop,
@@ -1 +1 @@
1
- {"version":3,"file":"dropzone-custom-extensions.story.js","sourceRoot":"","sources":["../../../../src/dropzone/stories/dropzone-custom-extensions.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,MAAM,GAA8B,CAAC,KAAK,EAAE,EAAE;QAClD,KAAK,CACH,sBAAsB;YACpB,KAAK,CAAC,MAAM;YACZ,4CAA4C,CAC/C,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,QAAQ,IACP,yBAAyB,EAAC,iBAAiB,EAC3C,sBAAsB,EAAE,CAAC,OAAO,CAAC,EACjC,eAAe,EAAE;YACf,MAAM;SACP,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { Dropzone } from '@neo4j-ndl/react';\nimport { type DropzoneOptions } from 'react-dropzone';\n\nconst Component = () => {\n const onDrop: DropzoneOptions['onDrop'] = (files) => {\n alert(\n 'attempted to upload ' +\n files.length +\n ' file(s). Check console logs for more info',\n );\n };\n\n return (\n <Dropzone\n supportedFilesDescription=\"Supports: .dump\"\n acceptedFileExtensions={['.dump']}\n dropZoneOptions={{\n onDrop,\n }}\n />\n );\n};\n\nexport default Component;\n"]}
1
+ {"version":3,"file":"dropzone-custom-extensions.story.js","sourceRoot":"","sources":["../../../../src/dropzone/stories/dropzone-custom-extensions.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,MAAM,GAA8B,CAAC,KAAK,EAAE,EAAE;QAClD,KAAK,CACH,uBACE,KAAK,CAAC,MACR,4CAA4C,CAC7C,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,QAAQ,IACP,yBAAyB,EAAC,iBAAiB,EAC3C,sBAAsB,EAAE,CAAC,OAAO,CAAC,EACjC,eAAe,EAAE;YACf,MAAM;SACP,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { Dropzone } from '@neo4j-ndl/react';\nimport { type DropzoneOptions } from 'react-dropzone';\n\nconst Component = () => {\n const onDrop: DropzoneOptions['onDrop'] = (files) => {\n alert(\n `attempted to upload ${\n files.length\n } file(s). Check console logs for more info`,\n );\n };\n\n return (\n <Dropzone\n supportedFilesDescription=\"Supports: .dump\"\n acceptedFileExtensions={['.dump']}\n dropZoneOptions={{\n onDrop,\n }}\n />\n );\n};\n\nexport default Component;\n"]}
@@ -22,9 +22,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
22
22
  import { Dropzone } from '@neo4j-ndl/react';
23
23
  const Component = () => {
24
24
  const onDrop = (files) => {
25
- alert('attempted to upload ' +
26
- files.length +
27
- ' file(s). Check console logs for more info');
25
+ alert(`attempted to upload ${files.length} file(s). Check console logs for more info`);
28
26
  };
29
27
  return (_jsx(Dropzone, { dropZoneOptions: {
30
28
  onDrop,
@@ -1 +1 @@
1
- {"version":3,"file":"dropzone-default.story.js","sourceRoot":"","sources":["../../../../src/dropzone/stories/dropzone-default.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,MAAM,GAA8B,CAAC,KAAK,EAAE,EAAE;QAClD,KAAK,CACH,sBAAsB;YACpB,KAAK,CAAC,MAAM;YACZ,4CAA4C,CAC/C,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,QAAQ,IACP,eAAe,EAAE;YACf,MAAM;SACP,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { Dropzone } from '@neo4j-ndl/react';\nimport { type DropzoneOptions } from 'react-dropzone';\n\nconst Component = () => {\n const onDrop: DropzoneOptions['onDrop'] = (files) => {\n alert(\n 'attempted to upload ' +\n files.length +\n ' file(s). Check console logs for more info',\n );\n };\n\n return (\n <Dropzone\n dropZoneOptions={{\n onDrop,\n }}\n />\n );\n};\n\nexport default Component;\n"]}
1
+ {"version":3,"file":"dropzone-default.story.js","sourceRoot":"","sources":["../../../../src/dropzone/stories/dropzone-default.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,MAAM,GAA8B,CAAC,KAAK,EAAE,EAAE;QAClD,KAAK,CACH,uBACE,KAAK,CAAC,MACR,4CAA4C,CAC7C,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,QAAQ,IACP,eAAe,EAAE;YACf,MAAM;SACP,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { Dropzone } from '@neo4j-ndl/react';\nimport { type DropzoneOptions } from 'react-dropzone';\n\nconst Component = () => {\n const onDrop: DropzoneOptions['onDrop'] = (files) => {\n alert(\n `attempted to upload ${\n files.length\n } file(s). Check console logs for more info`,\n );\n };\n\n return (\n <Dropzone\n dropZoneOptions={{\n onDrop,\n }}\n />\n );\n};\n\nexport default Component;\n"]}
@@ -22,9 +22,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
22
22
  import { Dropzone } from '@neo4j-ndl/react';
23
23
  const Component = () => {
24
24
  const onDrop = (files) => {
25
- alert('attempted to upload ' +
26
- files.length +
27
- ' file(s). Check console logs for more info');
25
+ alert(`attempted to upload ${files.length} file(s). Check console logs for more info`);
28
26
  };
29
27
  return (_jsx(Dropzone, { supportedFilesDescription: "Supports: CSV Files", dropZoneOptions: {
30
28
  accept: { 'text/csv': ['.csv'] },
@@ -1 +1 @@
1
- {"version":3,"file":"dropzone-disabled.story.js","sourceRoot":"","sources":["../../../../src/dropzone/stories/dropzone-disabled.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,MAAM,GAA8B,CAAC,KAAK,EAAE,EAAE;QAClD,KAAK,CACH,sBAAsB;YACpB,KAAK,CAAC,MAAM;YACZ,4CAA4C,CAC/C,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,QAAQ,IACP,yBAAyB,EAAC,qBAAqB,EAC/C,eAAe,EAAE;YACf,MAAM,EAAE,EAAE,UAAU,EAAE,CAAC,MAAM,CAAC,EAAE;YAChC,MAAM;YACN,QAAQ,EAAE,IAAI;SACf,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { Dropzone } from '@neo4j-ndl/react';\nimport { type DropzoneOptions } from 'react-dropzone';\n\nconst Component = () => {\n const onDrop: DropzoneOptions['onDrop'] = (files) => {\n alert(\n 'attempted to upload ' +\n files.length +\n ' file(s). Check console logs for more info',\n );\n };\n\n return (\n <Dropzone\n supportedFilesDescription=\"Supports: CSV Files\"\n dropZoneOptions={{\n accept: { 'text/csv': ['.csv'] },\n onDrop,\n disabled: true,\n }}\n />\n );\n};\n\nexport default Component;\n"]}
1
+ {"version":3,"file":"dropzone-disabled.story.js","sourceRoot":"","sources":["../../../../src/dropzone/stories/dropzone-disabled.story.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,MAAM,GAA8B,CAAC,KAAK,EAAE,EAAE;QAClD,KAAK,CACH,uBACE,KAAK,CAAC,MACR,4CAA4C,CAC7C,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,QAAQ,IACP,yBAAyB,EAAC,qBAAqB,EAC/C,eAAe,EAAE;YACf,MAAM,EAAE,EAAE,UAAU,EAAE,CAAC,MAAM,CAAC,EAAE;YAChC,MAAM;YACN,QAAQ,EAAE,IAAI;SACf,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { Dropzone } from '@neo4j-ndl/react';\nimport { type DropzoneOptions } from 'react-dropzone';\n\nconst Component = () => {\n const onDrop: DropzoneOptions['onDrop'] = (files) => {\n alert(\n `attempted to upload ${\n files.length\n } file(s). Check console logs for more info`,\n );\n };\n\n return (\n <Dropzone\n supportedFilesDescription=\"Supports: CSV Files\"\n dropZoneOptions={{\n accept: { 'text/csv': ['.csv'] },\n onDrop,\n disabled: true,\n }}\n />\n );\n};\n\nexport default Component;\n"]}
@@ -1,3 +1,14 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import { jsx as _jsx } from "react/jsx-runtime";
2
13
  /**
3
14
  *
@@ -25,7 +36,8 @@ import { getRadius, getSpacing } from '../_common/utils';
25
36
  * Flex is a general-purpose container that helps
26
37
  * lay out components with consistent spacing in a row or column.
27
38
  */
28
- export const Flex = ({ as, gap = '8', rowGap, columnGap, children, borderRadius, flexDirection = 'column', flexWrap = 'nowrap', alignItems, justifyContent, className, style, htmlAttributes, ref, }) => {
39
+ export const Flex = (_a) => {
40
+ var { as, gap = '8', rowGap, columnGap, children, borderRadius, flexDirection = 'column', flexWrap = 'nowrap', alignItems, justifyContent, className, style, htmlAttributes, ref } = _a, restProps = __rest(_a, ["as", "gap", "rowGap", "columnGap", "children", "borderRadius", "flexDirection", "flexWrap", "alignItems", "justifyContent", "className", "style", "htmlAttributes", "ref"]);
29
41
  const Component = (as || 'div');
30
42
  // If gap is not provided,
31
43
  // and rowGap and columnGap are not provided,
@@ -43,6 +55,6 @@ export const Flex = ({ as, gap = '8', rowGap, columnGap, children, borderRadius,
43
55
  gap: gapFormatted,
44
56
  borderRadius: getRadius(borderRadius, 'borderRadius'),
45
57
  };
46
- return (_jsx(Component, Object.assign({ ref: ref, className: className, style: Object.assign(Object.assign({}, additionalStyle), style) }, htmlAttributes, { children: children })));
58
+ return (_jsx(Component, Object.assign({ ref: ref, className: className, style: Object.assign(Object.assign({}, additionalStyle), style) }, restProps, htmlAttributes, { children: children })));
47
59
  };
48
60
  //# sourceMappingURL=Flex.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Flex.js","sourceRoot":"","sources":["../../../src/flex/Flex.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AASzC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM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\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 { tokens } from '@neo4j-ndl/base';\nimport type React from 'react';\n\nimport {\n type PolymorphicCommonProps,\n type Radius,\n type ReactComponent,\n type Spacing,\n} from '../_common/types';\nimport { getRadius, getSpacing } from '../_common/utils';\n\ntype AllowedFlexElements = 'div' | 'span' | 'ul' | 'ol' | 'li';\n\ntype BaseFlexProps = {\n /**\n * @default tokens.space['4']\n */\n gap?: Spacing;\n /**\n * @default undefined\n */\n rowGap?: Spacing;\n /**\n * @default undefined\n */\n columnGap?: Spacing;\n /**\n * @default undefined\n */\n borderRadius?: Radius;\n /**\n * Flex direction is set to column by default.\n * The `row-reverse` and `column-reverse` values\n * are skipped due to accessibility concerns.\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction#accessibility_concerns\n *\n * @default row\n */\n flexDirection?: Exclude<\n React.CSSProperties['flexDirection'],\n 'row-reverse' | 'column-reverse'\n >;\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/flex-wrap\n * @default nowrap\n */\n flexWrap?: React.CSSProperties['flexWrap'];\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content\n * @default undefined\n */\n justifyContent?: React.CSSProperties['justifyContent'];\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/align-items\n * @default undefined\n */\n alignItems?: React.CSSProperties['alignItems'];\n children?: React.ReactNode;\n style?: React.CSSProperties;\n};\n\n/**\n * Flex is a general-purpose container that helps\n * lay out components with consistent spacing in a row or column.\n */\nexport const Flex = <T extends AllowedFlexElements = 'div'>({\n as,\n gap = '8',\n rowGap,\n columnGap,\n children,\n borderRadius,\n flexDirection = 'column',\n flexWrap = 'nowrap',\n alignItems,\n justifyContent,\n className,\n style,\n htmlAttributes,\n ref,\n}: PolymorphicCommonProps<T, BaseFlexProps>) => {\n const Component = (as || 'div') as unknown as ReactComponent;\n\n // If gap is not provided,\n // and rowGap and columnGap are not provided,\n // then use the default value.\n const gapPx = getSpacing(gap, 'gap');\n const rowGapPx = rowGap ? tokens.space[rowGap] : undefined;\n const columnGapPx = columnGap ? tokens.space[columnGap] : undefined;\n const gapFormatted = `${rowGapPx ?? gapPx} ${columnGapPx ?? gapPx}`;\n\n const additionalStyle: React.CSSProperties = {\n flexDirection,\n alignItems,\n flexWrap,\n justifyContent,\n display: 'flex',\n gap: gapFormatted,\n borderRadius: getRadius(borderRadius, 'borderRadius'),\n };\n\n return (\n <Component\n ref={ref}\n className={className}\n style={{ ...additionalStyle, ...style }}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n"]}
1
+ {"version":3,"file":"Flex.js","sourceRoot":"","sources":["../../../src/flex/Flex.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AASzC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAoDzD;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAwC,EAgBjB,EAAE,EAAE;QAhBa,EAC1D,EAAE,EACF,GAAG,GAAG,GAAG,EACT,MAAM,EACN,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,aAAa,GAAG,QAAQ,EACxB,QAAQ,GAAG,QAAQ,EACnB,UAAU,EACV,cAAc,EACd,SAAS,EACT,KAAK,EACL,cAAc,EACd,GAAG,OAEsC,EADtC,SAAS,cAf8C,4KAgB3D,CADa;IAEZ,MAAM,SAAS,GAAG,CAAC,EAAE,IAAI,KAAK,CAA8B,CAAC;IAE7D,0BAA0B;IAC1B,6CAA6C;IAC7C,8BAA8B;IAC9B,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3D,MAAM,WAAW,GAAG,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACpE,MAAM,YAAY,GAAG,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,KAAK,IAAI,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,KAAK,EAAE,CAAC;IAEpE,MAAM,eAAe,GAAwB;QAC3C,aAAa;QACb,UAAU;QACV,QAAQ;QACR,cAAc;QACd,OAAO,EAAE,MAAM;QACf,GAAG,EAAE,YAAY;QACjB,YAAY,EAAE,SAAS,CAAC,YAAY,EAAE,cAAc,CAAC;KACtD,CAAC;IAEF,OAAO,CACL,KAAC,SAAS,kBACR,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,EACpB,KAAK,kCAAO,eAAe,GAAK,KAAK,KACjC,SAAS,EACT,cAAc,cAEjB,QAAQ,IACC,CACb,CAAC;AACJ,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\n\nimport { tokens } from '@neo4j-ndl/base';\nimport type React from 'react';\n\nimport {\n type PolymorphicCommonProps,\n type Radius,\n type ReactComponent,\n type Spacing,\n} from '../_common/types';\nimport { getRadius, getSpacing } from '../_common/utils';\n\ntype AllowedFlexElements = 'div' | 'span' | 'ul' | 'ol' | 'li';\n\ntype BaseFlexProps = {\n /**\n * @default tokens.space['4']\n */\n gap?: Spacing;\n /**\n * @default undefined\n */\n rowGap?: Spacing;\n /**\n * @default undefined\n */\n columnGap?: Spacing;\n /**\n * @default undefined\n */\n borderRadius?: Radius;\n /**\n * Flex direction is set to column by default.\n * The `row-reverse` and `column-reverse` values\n * are skipped due to accessibility concerns.\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction#accessibility_concerns\n *\n * @default row\n */\n flexDirection?: Exclude<\n React.CSSProperties['flexDirection'],\n 'row-reverse' | 'column-reverse'\n >;\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/flex-wrap\n * @default nowrap\n */\n flexWrap?: React.CSSProperties['flexWrap'];\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content\n * @default undefined\n */\n justifyContent?: React.CSSProperties['justifyContent'];\n /**\n * @see https://developer.mozilla.org/en-US/docs/Web/CSS/align-items\n * @default undefined\n */\n alignItems?: React.CSSProperties['alignItems'];\n children?: React.ReactNode;\n style?: React.CSSProperties;\n};\n\n/**\n * Flex is a general-purpose container that helps\n * lay out components with consistent spacing in a row or column.\n */\nexport const Flex = <T extends AllowedFlexElements = 'div'>({\n as,\n gap = '8',\n rowGap,\n columnGap,\n children,\n borderRadius,\n flexDirection = 'column',\n flexWrap = 'nowrap',\n alignItems,\n justifyContent,\n className,\n style,\n htmlAttributes,\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, BaseFlexProps>) => {\n const Component = (as || 'div') as unknown as ReactComponent;\n\n // If gap is not provided,\n // and rowGap and columnGap are not provided,\n // then use the default value.\n const gapPx = getSpacing(gap, 'gap');\n const rowGapPx = rowGap ? tokens.space[rowGap] : undefined;\n const columnGapPx = columnGap ? tokens.space[columnGap] : undefined;\n const gapFormatted = `${rowGapPx ?? gapPx} ${columnGapPx ?? gapPx}`;\n\n const additionalStyle: React.CSSProperties = {\n flexDirection,\n alignItems,\n flexWrap,\n justifyContent,\n display: 'flex',\n gap: gapFormatted,\n borderRadius: getRadius(borderRadius, 'borderRadius'),\n };\n\n return (\n <Component\n ref={ref}\n className={className}\n style={{ ...additionalStyle, ...style }}\n {...restProps}\n {...htmlAttributes}\n >\n {children}\n </Component>\n );\n};\n"]}
@@ -1,3 +1,14 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
13
  /**
3
14
  *
@@ -55,12 +66,14 @@ const HorizontalLines = ({ height = 24 }) => {
55
66
  *
56
67
  */
57
68
  const MAX_WIDTH = 200;
58
- export const GraphLabel = ({ type = 'node', color, isDisabled = false, isSelected = false, as, onClick, className, style, children, htmlAttributes, isFluid = false, size = 'large', ref, }) => {
69
+ export const GraphLabel = (_a) => {
70
+ var { type = 'node', color, isDisabled = false, isSelected = false, as, onClick, className, style, children, htmlAttributes, isFluid = false, size = 'large', ref } = _a, restProps = __rest(_a, ["type", "color", "isDisabled", "isSelected", "as", "onClick", "className", "style", "children", "htmlAttributes", "isFluid", "size", "ref"]);
59
71
  const [isHover, setIsHover] = useState(false);
60
72
  const handleMouseEnter = (event) => {
61
73
  setIsHover(true);
62
- if (htmlAttributes && htmlAttributes.onMouseEnter !== undefined)
74
+ if (htmlAttributes && htmlAttributes.onMouseEnter !== undefined) {
63
75
  htmlAttributes.onMouseEnter(event);
76
+ }
64
77
  };
65
78
  const handleMouseLeave = (event) => {
66
79
  var _a;
@@ -101,8 +114,9 @@ export const GraphLabel = ({ type = 'node', color, isDisabled = false, isSelecte
101
114
  const hoverColor = useMemo(() => getHoverColor(backgroundColor ? backgroundColor : tokens.palette.lemon[40]), [backgroundColor]);
102
115
  const textColor = useMemo(() => getTextColorFromBackground(backgroundColor ? backgroundColor : tokens.palette.lemon[40]), [backgroundColor]);
103
116
  const disabledTextColor = useMemo(() => getDisabledTextColor(backgroundColor ? backgroundColor : tokens.palette.lemon[40]), [backgroundColor]);
104
- if (isHover && !isDisabled)
117
+ if (isHover && !isDisabled) {
105
118
  backgroundColor = hoverColor;
119
+ }
106
120
  const commonClasses = classNames('ndl-graph-label', className, {
107
121
  'ndl-disabled': isDisabled,
108
122
  'ndl-interactable': isButton,
@@ -128,7 +142,7 @@ export const GraphLabel = ({ type = 'node', color, isDisabled = false, isSelecte
128
142
  onClick: handleClick,
129
143
  onMouseEnter: handleMouseEnter,
130
144
  onMouseLeave: handleMouseLeave,
131
- }), { ref: ref }, htmlAttributes, { children: [type === 'relationshipLeft' || type === 'relationship' ? (_jsx(HexagonEnd, { direction: "left", color: backgroundColor, height: height })) : (_jsx(SquareEnd, { direction: "left", color: backgroundColor, height: height })), _jsxs("div", { className: "ndl-relationship-label-container", style: {
145
+ }), { ref: ref }, restProps, htmlAttributes, { children: [type === 'relationshipLeft' || type === 'relationship' ? (_jsx(HexagonEnd, { direction: "left", color: backgroundColor, height: height })) : (_jsx(SquareEnd, { direction: "left", color: backgroundColor, height: height })), _jsxs("div", { className: "ndl-relationship-label-container", style: {
132
146
  backgroundColor: backgroundColor,
133
147
  }, children: [_jsx("div", { className: "ndl-relationship-label-content", children: children }), _jsx(HorizontalLines, { height: height })] }), type === 'relationshipRight' || type === 'relationship' ? (_jsx(HexagonEnd, { direction: "right", color: backgroundColor, height: height })) : (_jsx(SquareEnd, { direction: "right", color: backgroundColor, height: height }))] })));
134
148
  }
@@ -1 +1 @@
1
- {"version":3,"file":"GraphLabel.js","sourceRoot":"","sources":["../../../src/graph-label/GraphLabel.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAM1C,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,0BAA0B,GAC3B,MAAM,SAAS,CAAC;AAgDjB;;;;;;GAMG;AAEH,MAAM,UAAU,GAAG,CAAC,EAClB,SAAS,GAAG,MAAM,EAClB,KAAK,EACL,cAAc,EACd,MAAM,GAAG,EAAE,GACK,EAAE,EAAE;IACpB,MAAM,OAAO,GAAG,UAAU,CAAC,iBAAiB,EAAE;QAC5C,UAAU,EAAE,SAAS,KAAK,MAAM;QAChC,WAAW,EAAE,SAAS,KAAK,OAAO;KACnC,CAAC,CAAC;IAEH,OAAO,CACL,6BAAK,SAAS,EAAE,OAAO,IAAM,cAAc,eACzC,cACE,SAAS,EAAC,uBAAuB,EACjC,KAAK,EAAC,GAAG,EACT,MAAM,EAAE,MAAM,EACd,OAAO,EAAC,UAAU,EAClB,mBAAmB,EAAC,MAAM,EAC1B,IAAI,EAAC,MAAM,EACX,KAAK,EAAC,4BAA4B,YAGlC,eACE,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EACtB,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,oMAAoM,GACtM,GACE,EACN,cACE,SAAS,EAAC,wBAAwB,EAClC,KAAK,EAAC,IAAI,EACV,MAAM,EAAE,M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,KACS,CACb,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,MAAM,OAAO,GAAG,UAAU,CAAC,wBAAwB,EAAE,aAAa,CAAC,CAAC;QAEpE,OAAO,CACL,KAAC,SAAS,kBACR,KAAK,kBACH,eAAe,EAAE,eAAe,EAChC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,EACjD,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,IACnC,KAAK,GAEV,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,WAAW,EACpB,YAAY,EAAE,gBAAgB,EAC9B,YAAY,EAAE,gBAAgB,EAC9B,GAAG,EAAE,GAAG,IACJ,cAAc,cAElB,cAAK,SAAS,EAAC,gCAAgC,YAAE,QAAQ,GAAO,IACtD,CACb,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { tokens } from '@neo4j-ndl/base';\nimport classNames from 'classnames';\nimport type React from 'react';\nimport { useMemo, useState } from 'react';\n\nimport {\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport {\n getDisabledTextColor,\n getHoverColor,\n getTextColorFromBackground,\n} from './color';\n\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype GraphLabelProps = {\n /** The type of label */\n type:\n | 'node'\n | 'relationship'\n | 'propertyKey'\n | 'relationshipLeft'\n | 'relationshipRight';\n /** Callback function that is called when the label is clicked */\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n /** Additional styles to apply to the label */\n style?: React.CSSProperties;\n /** Content displayed inside the label */\n children?: React.ReactNode;\n /** The background color of the label */\n color?: string;\n /** Whether the label is disabled */\n isDisabled?: boolean;\n /** Additional class names */\n className?: string;\n /** Whether the label is selected */\n isSelected?: boolean;\n /** Whether the label should expand to full available width */\n isFluid?: boolean;\n /** The size of the label */\n size?: 'small' | 'large';\n};\n\ntype HexagonEndProps = {\n /** The direction of the hexagon end */\n direction: 'left' | 'right';\n /** The color of the hexagon end */\n color?: string;\n /** The height of the hexagon end in pixels */\n height?: number;\n /** HTML attributes */\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n/**\n *\n *\n * Helpers\n *\n *\n */\n\nconst HexagonEnd = ({\n direction = 'left',\n color,\n htmlAttributes,\n height = 24,\n}: HexagonEndProps) => {\n const classes = classNames('ndl-hexagon-end', {\n 'ndl-left': direction === 'left',\n 'ndl-right': direction === 'right',\n });\n\n return (\n <div className={classes} {...htmlAttributes}>\n <svg\n className=\"ndl-hexagon-end-inner\"\n width=\"9\"\n height={height}\n viewBox=\"0 0 9 24\"\n preserveAspectRatio=\"none\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n {/* triangle */}\n <path\n style={{ fill: color }}\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M5.73024 1.03676C6.08165 0.397331 6.75338 0 7.48301 0H9V24H7.483C6.75338 24 6.08165 23.6027 5.73024 22.9632L0.315027 13.1094C-0.105009 12.4376 -0.105009 11.5624 0.315026 10.8906L5.73024 1.03676Z\"\n />\n </svg>\n <svg\n className=\"ndl-hexagon-end-active\"\n width=\"13\"\n height={height + 6}\n viewBox=\"0 0 13 30\"\n preserveAspectRatio=\"none\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M10.075 2C9.12474 2 8.24318 2.54521 7.74867 3.43873L2.21419 13.4387C1.68353 14.3976 1.68353 15.6024 2.21419 16.5613L7.74867 26.5613C8.24318 27.4548 9.12474 28 10.075 28H13V30H10.075C8.49126 30 7.022 29.0913 6.1978 27.6021L0.663324 17.6021C-0.221109 16.0041 -0.221108 13.9959 0.663325 12.3979L6.1978 2.39789C7.022 0.90869 8.49126 0 10.075 0H13V2H10.075Z\"\n />\n </svg>\n </div>\n );\n};\n\ntype SquareEndProps = {\n /** The direction of the square end (where it's rounded and has the active state) */\n direction: 'left' | 'right';\n /** The color of the square end */\n color: string;\n /** The height of the square end in pixels */\n height: number;\n /** HTML attributes */\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst SquareEnd = ({\n direction = 'left',\n color,\n height = 24,\n htmlAttributes,\n}: SquareEndProps) => {\n const classes = classNames('ndl-square-end', {\n 'ndl-left': direction === 'left',\n 'ndl-right': direction === 'right',\n });\n\n return (\n <div className={classes} {...htmlAttributes}>\n <div\n className=\"ndl-square-end-inner\"\n style={{ backgroundColor: color }}\n />\n <svg\n className=\"ndl-square-end-active\"\n width=\"7\"\n height={height + 6}\n preserveAspectRatio=\"none\"\n viewBox=\"0 0 7 30\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M 3.8774 2 C 3.2697 2 2.7917 2.248 2.3967 2.6605 C 1.928 3.1498 1.7993 3.8555 1.7993 4.5331 V 13.8775 V 25.4669 C 1.7993 26.1445 1.928 26.8502 2.3967 27.3395 C 2.7917 27.752 3.2697 28 3.8774 28 H 7 V 30 H 3.8774 C 2.6211 30 1.4369 29.4282 0.5895 28.4485 C 0.1462 27.936 0.0002 27.2467 0.0002 26.5691 L -0.0002 13.8775 L 0.0002 3.4309 C 0.0002 2.7533 0.1462 2.064 0.5895 1.5515 C 1.4368 0.5718 2.6211 0 3.8774 0 H 7 V 2 H 3.8774 Z\"\n />\n </svg>\n </div>\n );\n};\n\ntype HorizontalLinesProps = {\n height?: number;\n};\n\nconst HorizontalLines = ({ height = 24 }: HorizontalLinesProps) => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n height={height + 6}\n preserveAspectRatio=\"none\"\n viewBox=\"0 0 37 30\"\n fill=\"none\"\n className=\"ndl-relationship-label-lines\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M 37 2 H 0 V 0 H 37 V 2 Z\"\n />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M 37 30 H 0 V 28 H 37 V 30 Z\"\n />\n </svg>\n );\n};\n\n/**\n *\n *\n * GraphLabel Component\n *\n *\n */\n\nconst MAX_WIDTH = 200;\n\nexport const GraphLabel = <T extends React.ElementType = 'button'>({\n type = 'node',\n color,\n isDisabled = false,\n isSelected = false,\n as,\n onClick,\n className,\n style,\n children,\n htmlAttributes,\n isFluid = false,\n size = 'large',\n ref,\n}: PolymorphicCommonProps<T, GraphLabelProps>) => {\n const [isHover, setIsHover] = useState(false);\n\n const handleMouseEnter = (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => {\n setIsHover(true);\n\n if (htmlAttributes && htmlAttributes.onMouseEnter !== undefined)\n htmlAttributes.onMouseEnter(event);\n };\n\n const handleMouseLeave = (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => {\n setIsHover(false);\n\n htmlAttributes?.onMouseLeave?.(event);\n };\n\n const Component: React.ElementType = as ?? 'button';\n const isButton = Component === 'button';\n\n const handleClick = (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => {\n // By default, a <button /> element with disabled set to true will not get its\n // on click handler called. To support the same behavior on <a /> tags we\n // swallow the event here when disabled, since the <a /> tag with disabled set to\n // true will have its onClick handler called\n if (isDisabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n if (onClick) {\n onClick(event);\n }\n };\n\n let backgroundColor = useMemo(() => {\n if (color === undefined) {\n switch (type) {\n case 'node':\n return tokens.graph['1'];\n case 'relationship':\n case 'relationshipLeft':\n case 'relationshipRight':\n return tokens.theme.light.color.neutral.bg.strong;\n default:\n return tokens.theme.light.color.neutral.bg.strongest;\n }\n }\n return color;\n }, [color, type]);\n\n const hoverColor = useMemo(\n () =>\n getHoverColor(\n backgroundColor ? backgroundColor : tokens.palette.lemon[40],\n ),\n [backgroundColor],\n );\n const textColor = useMemo(\n () =>\n getTextColorFromBackground(\n backgroundColor ? backgroundColor : tokens.palette.lemon[40],\n ),\n [backgroundColor],\n );\n const disabledTextColor = useMemo(\n () =>\n getDisabledTextColor(\n backgroundColor ? backgroundColor : tokens.palette.lemon[40],\n ),\n [backgroundColor],\n );\n\n if (isHover && !isDisabled) backgroundColor = hoverColor;\n\n const commonClasses = classNames('ndl-graph-label', className, {\n 'ndl-disabled': isDisabled,\n 'ndl-interactable': isButton,\n 'ndl-selected': isSelected,\n 'ndl-small': size === 'small',\n });\n\n if (type === 'node') {\n const classes = classNames('ndl-node-label', commonClasses);\n\n return (\n <Component\n className={classes}\n ref={ref}\n style={{\n backgroundColor: backgroundColor,\n color: isDisabled ? disabledTextColor : textColor,\n maxWidth: isFluid ? '100%' : MAX_WIDTH,\n ...style,\n }}\n {...(isButton && {\n disabled: isDisabled,\n onClick: handleClick,\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n })}\n {...htmlAttributes}\n >\n <div className=\"ndl-node-label-content\">{children}</div>\n </Component>\n );\n } else if (\n type === 'relationship' ||\n type === 'relationshipLeft' ||\n type === 'relationshipRight'\n ) {\n const classes = classNames('ndl-relationship-label', commonClasses);\n const height = size === 'small' ? 20 : 24;\n\n return (\n <Component\n style={{\n maxWidth: isFluid ? '100%' : MAX_WIDTH,\n ...style,\n color: isDisabled ? disabledTextColor : textColor,\n }}\n className={classes}\n {...(isButton && {\n disabled: isDisabled,\n onClick: handleClick,\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n })}\n ref={ref}\n {...htmlAttributes}\n >\n {type === 'relationshipLeft' || type === 'relationship' ? (\n <HexagonEnd\n direction=\"left\"\n color={backgroundColor}\n height={height}\n />\n ) : (\n <SquareEnd direction=\"left\" color={backgroundColor} height={height} />\n )}\n <div\n className=\"ndl-relationship-label-container\"\n style={{\n backgroundColor: backgroundColor,\n }}\n >\n <div className=\"ndl-relationship-label-content\">{children}</div>\n <HorizontalLines height={height} />\n </div>\n {type === 'relationshipRight' || type === 'relationship' ? (\n <HexagonEnd\n direction=\"right\"\n color={backgroundColor}\n height={height}\n />\n ) : (\n <SquareEnd\n direction=\"right\"\n color={backgroundColor}\n height={height}\n />\n )}\n </Component>\n );\n } else {\n const classes = classNames('ndl-property-key-label', commonClasses);\n\n return (\n <Component\n style={{\n backgroundColor: backgroundColor,\n color: isDisabled ? disabledTextColor : textColor,\n maxWidth: isFluid ? '100%' : MAX_WIDTH,\n ...style,\n }}\n className={classes}\n onClick={handleClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n ref={ref}\n {...htmlAttributes}\n >\n <div className=\"ndl-property-key-label-content\">{children}</div>\n </Component>\n );\n }\n};\n"]}
1
+ {"version":3,"file":"GraphLabel.js","sourceRoot":"","sources":["../../../src/graph-label/GraphLabel.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAM1C,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,0BAA0B,GAC3B,MAAM,SAAS,CAAC;AAgDjB;;;;;;GAMG;AAEH,MAAM,UAAU,GAAG,CAAC,EAClB,SAAS,GAAG,MAAM,EAClB,KAAK,E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EAAC,gCAAgC,YAAE,QAAQ,GAAO,IACtD,CACb,CAAC;IACJ,CAAC;AACH,CAAC,CAAC","sourcesContent":["/**\n *\n * Copyright (c) \"Neo4j\"\n * Neo4j Sweden AB [http://neo4j.com]\n *\n * This file is part of Neo4j.\n *\n * Neo4j is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n */\nimport { tokens } from '@neo4j-ndl/base';\nimport classNames from 'classnames';\nimport type React from 'react';\nimport { useMemo, useState } from 'react';\n\nimport {\n type HtmlAttributes,\n type PolymorphicCommonProps,\n} from '../_common/types';\nimport {\n getDisabledTextColor,\n getHoverColor,\n getTextColorFromBackground,\n} from './color';\n\n/**\n *\n *\n * Types\n *\n *\n */\n\ntype GraphLabelProps = {\n /** The type of label */\n type:\n | 'node'\n | 'relationship'\n | 'propertyKey'\n | 'relationshipLeft'\n | 'relationshipRight';\n /** Callback function that is called when the label is clicked */\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n /** Additional styles to apply to the label */\n style?: React.CSSProperties;\n /** Content displayed inside the label */\n children?: React.ReactNode;\n /** The background color of the label */\n color?: string;\n /** Whether the label is disabled */\n isDisabled?: boolean;\n /** Additional class names */\n className?: string;\n /** Whether the label is selected */\n isSelected?: boolean;\n /** Whether the label should expand to full available width */\n isFluid?: boolean;\n /** The size of the label */\n size?: 'small' | 'large';\n};\n\ntype HexagonEndProps = {\n /** The direction of the hexagon end */\n direction: 'left' | 'right';\n /** The color of the hexagon end */\n color?: string;\n /** The height of the hexagon end in pixels */\n height?: number;\n /** HTML attributes */\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n/**\n *\n *\n * Helpers\n *\n *\n */\n\nconst HexagonEnd = ({\n direction = 'left',\n color,\n htmlAttributes,\n height = 24,\n}: HexagonEndProps) => {\n const classes = classNames('ndl-hexagon-end', {\n 'ndl-left': direction === 'left',\n 'ndl-right': direction === 'right',\n });\n\n return (\n <div className={classes} {...htmlAttributes}>\n <svg\n className=\"ndl-hexagon-end-inner\"\n width=\"9\"\n height={height}\n viewBox=\"0 0 9 24\"\n preserveAspectRatio=\"none\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n {/* triangle */}\n <path\n style={{ fill: color }}\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M5.73024 1.03676C6.08165 0.397331 6.75338 0 7.48301 0H9V24H7.483C6.75338 24 6.08165 23.6027 5.73024 22.9632L0.315027 13.1094C-0.105009 12.4376 -0.105009 11.5624 0.315026 10.8906L5.73024 1.03676Z\"\n />\n </svg>\n <svg\n className=\"ndl-hexagon-end-active\"\n width=\"13\"\n height={height + 6}\n viewBox=\"0 0 13 30\"\n preserveAspectRatio=\"none\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M10.075 2C9.12474 2 8.24318 2.54521 7.74867 3.43873L2.21419 13.4387C1.68353 14.3976 1.68353 15.6024 2.21419 16.5613L7.74867 26.5613C8.24318 27.4548 9.12474 28 10.075 28H13V30H10.075C8.49126 30 7.022 29.0913 6.1978 27.6021L0.663324 17.6021C-0.221109 16.0041 -0.221108 13.9959 0.663325 12.3979L6.1978 2.39789C7.022 0.90869 8.49126 0 10.075 0H13V2H10.075Z\"\n />\n </svg>\n </div>\n );\n};\n\ntype SquareEndProps = {\n /** The direction of the square end (where it's rounded and has the active state) */\n direction: 'left' | 'right';\n /** The color of the square end */\n color: string;\n /** The height of the square end in pixels */\n height: number;\n /** HTML attributes */\n htmlAttributes?: HtmlAttributes<'div'>;\n};\n\nconst SquareEnd = ({\n direction = 'left',\n color,\n height = 24,\n htmlAttributes,\n}: SquareEndProps) => {\n const classes = classNames('ndl-square-end', {\n 'ndl-left': direction === 'left',\n 'ndl-right': direction === 'right',\n });\n\n return (\n <div className={classes} {...htmlAttributes}>\n <div\n className=\"ndl-square-end-inner\"\n style={{ backgroundColor: color }}\n />\n <svg\n className=\"ndl-square-end-active\"\n width=\"7\"\n height={height + 6}\n preserveAspectRatio=\"none\"\n viewBox=\"0 0 7 30\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M 3.8774 2 C 3.2697 2 2.7917 2.248 2.3967 2.6605 C 1.928 3.1498 1.7993 3.8555 1.7993 4.5331 V 13.8775 V 25.4669 C 1.7993 26.1445 1.928 26.8502 2.3967 27.3395 C 2.7917 27.752 3.2697 28 3.8774 28 H 7 V 30 H 3.8774 C 2.6211 30 1.4369 29.4282 0.5895 28.4485 C 0.1462 27.936 0.0002 27.2467 0.0002 26.5691 L -0.0002 13.8775 L 0.0002 3.4309 C 0.0002 2.7533 0.1462 2.064 0.5895 1.5515 C 1.4368 0.5718 2.6211 0 3.8774 0 H 7 V 2 H 3.8774 Z\"\n />\n </svg>\n </div>\n );\n};\n\ntype HorizontalLinesProps = {\n height?: number;\n};\n\nconst HorizontalLines = ({ height = 24 }: HorizontalLinesProps) => {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n height={height + 6}\n preserveAspectRatio=\"none\"\n viewBox=\"0 0 37 30\"\n fill=\"none\"\n className=\"ndl-relationship-label-lines\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M 37 2 H 0 V 0 H 37 V 2 Z\"\n />\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M 37 30 H 0 V 28 H 37 V 30 Z\"\n />\n </svg>\n );\n};\n\n/**\n *\n *\n * GraphLabel Component\n *\n *\n */\n\nconst MAX_WIDTH = 200;\n\nexport const GraphLabel = <T extends React.ElementType = 'button'>({\n type = 'node',\n color,\n isDisabled = false,\n isSelected = false,\n as,\n onClick,\n className,\n style,\n children,\n htmlAttributes,\n isFluid = false,\n size = 'large',\n ref,\n ...restProps\n}: PolymorphicCommonProps<T, GraphLabelProps>) => {\n const [isHover, setIsHover] = useState(false);\n\n const handleMouseEnter = (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => {\n setIsHover(true);\n\n if (htmlAttributes && htmlAttributes.onMouseEnter !== undefined) {\n htmlAttributes.onMouseEnter(event);\n }\n };\n\n const handleMouseLeave = (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => {\n setIsHover(false);\n\n htmlAttributes?.onMouseLeave?.(event);\n };\n\n const Component: React.ElementType = as ?? 'button';\n const isButton = Component === 'button';\n\n const handleClick = (\n event: React.MouseEvent<HTMLButtonElement, MouseEvent>,\n ) => {\n // By default, a <button /> element with disabled set to true will not get its\n // on click handler called. To support the same behavior on <a /> tags we\n // swallow the event here when disabled, since the <a /> tag with disabled set to\n // true will have its onClick handler called\n if (isDisabled) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n if (onClick) {\n onClick(event);\n }\n };\n\n let backgroundColor = useMemo(() => {\n if (color === undefined) {\n switch (type) {\n case 'node':\n return tokens.graph['1'];\n case 'relationship':\n case 'relationshipLeft':\n case 'relationshipRight':\n return tokens.theme.light.color.neutral.bg.strong;\n default:\n return tokens.theme.light.color.neutral.bg.strongest;\n }\n }\n return color;\n }, [color, type]);\n\n const hoverColor = useMemo(\n () =>\n getHoverColor(\n backgroundColor ? backgroundColor : tokens.palette.lemon[40],\n ),\n [backgroundColor],\n );\n const textColor = useMemo(\n () =>\n getTextColorFromBackground(\n backgroundColor ? backgroundColor : tokens.palette.lemon[40],\n ),\n [backgroundColor],\n );\n const disabledTextColor = useMemo(\n () =>\n getDisabledTextColor(\n backgroundColor ? backgroundColor : tokens.palette.lemon[40],\n ),\n [backgroundColor],\n );\n\n if (isHover && !isDisabled) {\n backgroundColor = hoverColor;\n }\n\n const commonClasses = classNames('ndl-graph-label', className, {\n 'ndl-disabled': isDisabled,\n 'ndl-interactable': isButton,\n 'ndl-selected': isSelected,\n 'ndl-small': size === 'small',\n });\n\n if (type === 'node') {\n const classes = classNames('ndl-node-label', commonClasses);\n\n return (\n <Component\n className={classes}\n ref={ref}\n style={{\n backgroundColor: backgroundColor,\n color: isDisabled ? disabledTextColor : textColor,\n maxWidth: isFluid ? '100%' : MAX_WIDTH,\n ...style,\n }}\n {...(isButton && {\n disabled: isDisabled,\n onClick: handleClick,\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n })}\n {...htmlAttributes}\n >\n <div className=\"ndl-node-label-content\">{children}</div>\n </Component>\n );\n } else if (\n type === 'relationship' ||\n type === 'relationshipLeft' ||\n type === 'relationshipRight'\n ) {\n const classes = classNames('ndl-relationship-label', commonClasses);\n const height = size === 'small' ? 20 : 24;\n\n return (\n <Component\n style={{\n maxWidth: isFluid ? '100%' : MAX_WIDTH,\n ...style,\n color: isDisabled ? disabledTextColor : textColor,\n }}\n className={classes}\n {...(isButton && {\n disabled: isDisabled,\n onClick: handleClick,\n onMouseEnter: handleMouseEnter,\n onMouseLeave: handleMouseLeave,\n })}\n ref={ref}\n {...restProps}\n {...htmlAttributes}\n >\n {type === 'relationshipLeft' || type === 'relationship' ? (\n <HexagonEnd\n direction=\"left\"\n color={backgroundColor}\n height={height}\n />\n ) : (\n <SquareEnd direction=\"left\" color={backgroundColor} height={height} />\n )}\n <div\n className=\"ndl-relationship-label-container\"\n style={{\n backgroundColor: backgroundColor,\n }}\n >\n <div className=\"ndl-relationship-label-content\">{children}</div>\n <HorizontalLines height={height} />\n </div>\n {type === 'relationshipRight' || type === 'relationship' ? (\n <HexagonEnd\n direction=\"right\"\n color={backgroundColor}\n height={height}\n />\n ) : (\n <SquareEnd\n direction=\"right\"\n color={backgroundColor}\n height={height}\n />\n )}\n </Component>\n );\n } else {\n const classes = classNames('ndl-property-key-label', commonClasses);\n\n return (\n <Component\n style={{\n backgroundColor: backgroundColor,\n color: isDisabled ? disabledTextColor : textColor,\n maxWidth: isFluid ? '100%' : MAX_WIDTH,\n ...style,\n }}\n className={classes}\n onClick={handleClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n ref={ref}\n {...htmlAttributes}\n >\n <div className=\"ndl-property-key-label-content\">{children}</div>\n </Component>\n );\n }\n};\n"]}
@@ -19,7 +19,7 @@
19
19
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
20
  */
21
21
 
22
- import { IconButton } from '../';
22
+ import { IconButton } from '..';
23
23
  import { IconButtonActive, IconButtonActiveSrc, IconButtonDefault, IconButtonDefaultSrc, IconButtonDisabled, IconButtonDisabledSrc, IconButtonFloating, IconButtonFloatingSrc, IconButtonLoading, IconButtonLoadingSrc, IconButtonSizes, IconButtonSizesSrc, IconButtonTone, IconButtonToneSrc, } from '.';
24
24
  const componentMeta = {
25
25
  component: IconButton,