@rio-cloud/rio-uikit 2.2.0 → 2.3.0-beta.1

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 (412) hide show
  1. package/AnalyticsAnalysisOverlay.d.ts +1 -0
  2. package/AnalyticsAnalysisOverlay.js +5 -0
  3. package/AnalyticsAnalysisOverlay.js.map +1 -0
  4. package/Table.d.ts +2 -0
  5. package/Table.js +23 -0
  6. package/Table.js.map +1 -0
  7. package/TableCol.d.ts +2 -2
  8. package/TableCol.js +1 -1
  9. package/TableHead.d.ts +2 -2
  10. package/TableHead.js +1 -1
  11. package/TableSettingsDialog.d.ts +2 -2
  12. package/TableSettingsDialog.js +1 -1
  13. package/TableToolbar.js +3 -2
  14. package/analyticsAnalysisUtils.d.ts +1 -0
  15. package/analyticsAnalysisUtils.js +13 -0
  16. package/analyticsAnalysisUtils.js.map +1 -0
  17. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.d.ts +18 -0
  18. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.js +128 -0
  19. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.js.map +1 -0
  20. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.d.ts +9 -0
  21. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.js +73 -0
  22. package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.js.map +1 -0
  23. package/components/applicationHeader/AppMenuContent.js.map +1 -1
  24. package/components/applicationHeader/ApplicationActionBar.js +4 -4
  25. package/components/applicationHeader/ApplicationActionBar.js.map +1 -1
  26. package/components/applicationHeader/CollapsedNavItem.js +5 -14
  27. package/components/applicationHeader/CollapsedNavItem.js.map +1 -1
  28. package/components/applicationHeader/NavItems.js +10 -10
  29. package/components/applicationHeader/NavItems.js.map +1 -1
  30. package/components/assetTree/AssetTree.js +23 -23
  31. package/components/assetTree/AssetTree.js.map +1 -1
  32. package/components/assetTree/TreeNothingFound.js +2 -2
  33. package/components/assetTree/TreeNothingFound.js.map +1 -1
  34. package/components/assetTree/treeUtils.js.map +1 -1
  35. package/components/autosuggest/AutoSuggest.js +31 -31
  36. package/components/autosuggest/AutoSuggest.js.map +1 -1
  37. package/components/autosuggest/AutoSuggestAddons.js +9 -9
  38. package/components/autosuggest/AutoSuggestAddons.js.map +1 -1
  39. package/components/banner/BannerActions.js +2 -2
  40. package/components/banner/BannerActions.js.map +1 -1
  41. package/components/banner/BannerIcon.js +3 -3
  42. package/components/banner/BannerIcon.js.map +1 -1
  43. package/components/banner/BannerPage.js +4 -4
  44. package/components/banner/BannerPage.js.map +1 -1
  45. package/components/button/Button.d.ts +7 -0
  46. package/components/button/Button.js +73 -65
  47. package/components/button/Button.js.map +1 -1
  48. package/components/checkbox/Checkbox.js +18 -17
  49. package/components/checkbox/Checkbox.js.map +1 -1
  50. package/components/datepicker/DateRangePicker.js +0 -2
  51. package/components/datepicker/DateRangePicker.js.map +1 -1
  52. package/components/datepicker/DayPicker.js +16 -16
  53. package/components/datepicker/DayPicker.js.map +1 -1
  54. package/components/dialog/Dialog.js.map +1 -1
  55. package/components/dialog/DialogHeader.js +23 -20
  56. package/components/dialog/DialogHeader.js.map +1 -1
  57. package/components/dialog/MediaDialog.js +1 -1
  58. package/components/dialog/MediaDialog.js.map +1 -1
  59. package/components/editableContent/EditableContent.js +7 -7
  60. package/components/editableContent/EditableContent.js.map +1 -1
  61. package/components/expander/ExpanderList.d.ts +5 -0
  62. package/components/expander/ExpanderList.js +25 -16
  63. package/components/expander/ExpanderList.js.map +1 -1
  64. package/components/expander/ExpanderPanel.d.ts +5 -0
  65. package/components/expander/ExpanderPanel.js +29 -28
  66. package/components/expander/ExpanderPanel.js.map +1 -1
  67. package/components/fade/FadeExpander.js +1 -1
  68. package/components/fade/FadeExpander.js.map +1 -1
  69. package/components/filepicker/FilePicker.js.map +1 -1
  70. package/components/loadMore/LoadMoreButton.d.ts +5 -0
  71. package/components/loadMore/LoadMoreButton.js +33 -29
  72. package/components/loadMore/LoadMoreButton.js.map +1 -1
  73. package/components/map/components/features/ContextMenu.js +13 -13
  74. package/components/map/components/features/ContextMenu.js.map +1 -1
  75. package/components/map/components/features/basics/InfoBubble.js.map +1 -1
  76. package/components/map/components/features/settings/MapSettingsTile.js.map +1 -1
  77. package/components/map/components/features/settings/builtinSettings/MapTypeSettings.js +6 -6
  78. package/components/map/components/features/settings/builtinSettings/MapTypeSettings.js.map +1 -1
  79. package/components/map/utils/eventHandling.js +18 -18
  80. package/components/map/utils/eventHandling.js.map +1 -1
  81. package/components/map/utils/positions.d.ts +1 -1
  82. package/components/map/utils/positions.js +15 -12
  83. package/components/map/utils/positions.js.map +1 -1
  84. package/components/map/utils/rendering.d.ts +1 -1
  85. package/components/menuItems/MenuItems.js +6 -6
  86. package/components/menuItems/MenuItems.js.map +1 -1
  87. package/components/notification/NotificationsContainer.js.map +1 -1
  88. package/components/numberInput/NumberInput.js +57 -56
  89. package/components/numberInput/NumberInput.js.map +1 -1
  90. package/components/popover/Popover.js +4 -4
  91. package/components/popover/Popover.js.map +1 -1
  92. package/components/resizer/Resizer.js +6 -3
  93. package/components/resizer/Resizer.js.map +1 -1
  94. package/components/selects/BaseSelectDropdown.js +34 -32
  95. package/components/selects/BaseSelectDropdown.js.map +1 -1
  96. package/components/selects/MultiselectTogglePlaceholder.js.map +1 -1
  97. package/components/selects/MultiselectToggleSelection.js +11 -11
  98. package/components/selects/MultiselectToggleSelection.js.map +1 -1
  99. package/components/sidebars/Sidebar.js +12 -12
  100. package/components/sidebars/Sidebar.js.map +1 -1
  101. package/components/sidebars/SidebarCloseButton.js +2 -2
  102. package/components/sidebars/SidebarCloseButton.js.map +1 -1
  103. package/components/smoothScrollbars/SmoothScrollbars.d.ts +4 -3
  104. package/components/smoothScrollbars/SmoothScrollbars.js +11 -11
  105. package/components/smoothScrollbars/SmoothScrollbars.js.map +1 -1
  106. package/components/states/CustomState.js.map +1 -1
  107. package/components/svgImage/svgConverter.js.map +1 -1
  108. package/components/table/Table.d.ts +267 -0
  109. package/components/table/Table.js +233 -0
  110. package/components/table/Table.js.map +1 -0
  111. package/components/table/Table.types.d.ts +207 -0
  112. package/components/table/TableBody.d.ts +10 -0
  113. package/components/table/TableBody.js +5 -0
  114. package/components/table/TableBody.js.map +1 -0
  115. package/components/table/TableCard.d.ts +63 -0
  116. package/components/table/TableCard.js +150 -0
  117. package/components/table/TableCard.js.map +1 -0
  118. package/components/table/TableColumn.d.ts +47 -0
  119. package/components/table/TableColumn.js +5 -0
  120. package/components/table/TableColumn.js.map +1 -0
  121. package/components/table/TableExpandedContentRow.d.ts +22 -0
  122. package/components/table/TableExpandedContentRow.js +5 -0
  123. package/components/table/TableExpandedContentRow.js.map +1 -0
  124. package/components/table/TableExpandedRow.d.ts +17 -0
  125. package/components/table/TableExpandedRow.js +5 -0
  126. package/components/table/TableExpandedRow.js.map +1 -0
  127. package/components/table/TableExpanderButton.d.ts +25 -0
  128. package/components/table/TableExpanderButton.js +22 -0
  129. package/components/table/TableExpanderButton.js.map +1 -0
  130. package/components/table/TableFooter.d.ts +13 -0
  131. package/components/table/TableFooter.js +5 -0
  132. package/components/table/TableFooter.js.map +1 -0
  133. package/components/table/TableGroupFooterRow.d.ts +18 -0
  134. package/components/table/TableGroupFooterRow.js +5 -0
  135. package/components/table/TableGroupFooterRow.js.map +1 -0
  136. package/components/table/TableGroupRow.d.ts +24 -0
  137. package/components/table/TableGroupRow.js +5 -0
  138. package/components/table/TableGroupRow.js.map +1 -0
  139. package/components/table/TableHeader.d.ts +9 -0
  140. package/components/table/TableHeader.js +5 -0
  141. package/components/table/TableHeader.js.map +1 -0
  142. package/components/table/TableHeaderColumn.d.ts +70 -0
  143. package/components/table/TableHeaderColumn.js +5 -0
  144. package/components/table/TableHeaderColumn.js.map +1 -0
  145. package/components/table/TableHeaderRow.d.ts +9 -0
  146. package/components/table/TableHeaderRow.js +5 -0
  147. package/components/table/TableHeaderRow.js.map +1 -0
  148. package/components/table/TableRow.d.ts +19 -0
  149. package/components/table/TableRow.js +5 -0
  150. package/components/table/TableRow.js.map +1 -0
  151. package/components/table/TableSpacerRow.d.ts +12 -0
  152. package/components/table/TableSpacerRow.js +5 -0
  153. package/components/table/TableSpacerRow.js.map +1 -0
  154. package/components/table/TableToolbar.d.ts +23 -1
  155. package/components/table/TableToolbar.js +38 -4
  156. package/components/table/TableToolbar.js.map +1 -1
  157. package/components/table/TableViewToggles.d.ts +18 -0
  158. package/components/table/TableViewToggles.js +59 -87
  159. package/components/table/TableViewToggles.js.map +1 -1
  160. package/components/table/layout/columnSizing.d.ts +3 -0
  161. package/components/table/layout/columnSizing.js +23 -0
  162. package/components/table/layout/columnSizing.js.map +1 -0
  163. package/components/table/layout/useDraggableColumns.d.ts +14 -0
  164. package/components/table/layout/useDraggableColumns.js +47 -0
  165. package/components/table/layout/useDraggableColumns.js.map +1 -0
  166. package/components/table/layout/useHorizontalSectionSync.d.ts +11 -0
  167. package/components/table/layout/useHorizontalSectionSync.js +39 -0
  168. package/components/table/layout/useHorizontalSectionSync.js.map +1 -0
  169. package/components/table/layout/useMeasuredColumnMaxWidths.d.ts +12 -0
  170. package/components/table/layout/useMeasuredColumnMaxWidths.js +85 -0
  171. package/components/table/layout/useMeasuredColumnMaxWidths.js.map +1 -0
  172. package/components/table/layout/useResizableColumns.d.ts +14 -0
  173. package/components/table/layout/useResizableColumns.js +91 -0
  174. package/components/table/layout/useResizableColumns.js.map +1 -0
  175. package/components/table/layout/useTableLayout.d.ts +25 -0
  176. package/components/table/layout/useTableLayout.js +56 -0
  177. package/components/table/layout/useTableLayout.js.map +1 -0
  178. package/components/table/layout/useTableVirtualization.d.ts +22 -0
  179. package/components/table/layout/useTableVirtualization.js +125 -0
  180. package/components/table/layout/useTableVirtualization.js.map +1 -0
  181. package/components/table/model/buildTableViewModel.d.ts +28 -0
  182. package/components/table/model/buildTableViewModel.js +221 -0
  183. package/components/table/model/buildTableViewModel.js.map +1 -0
  184. package/components/table/model/resolveCellContent.d.ts +2 -0
  185. package/components/table/model/resolveCellContent.js +5 -0
  186. package/components/table/model/resolveCellContent.js.map +1 -0
  187. package/components/table/model/resolveRowMeta.d.ts +2 -0
  188. package/components/table/model/resolveRowMeta.js +15 -0
  189. package/components/table/model/resolveRowMeta.js.map +1 -0
  190. package/components/table/model/resolveTableClassConfig.d.ts +48 -0
  191. package/components/table/model/resolveTableClassConfig.js +64 -0
  192. package/components/table/model/resolveTableClassConfig.js.map +1 -0
  193. package/components/table/model/tableViewModel.types.d.ts +153 -0
  194. package/components/table/native/TableCol.js.map +1 -0
  195. package/components/table/{TableHead.js → native/TableHead.js} +2 -2
  196. package/components/table/native/TableHead.js.map +1 -0
  197. package/components/table/native/TableSettingsColumnButtons.js +59 -0
  198. package/components/table/native/TableSettingsColumnButtons.js.map +1 -0
  199. package/components/table/{TableSettingsColumnDetails.js → native/TableSettingsColumnDetails.js} +2 -2
  200. package/components/table/native/TableSettingsColumnDetails.js.map +1 -0
  201. package/components/table/{TableSettingsDialog.d.ts → native/TableSettingsDialog.d.ts} +2 -3
  202. package/components/table/native/TableSettingsDialog.js +216 -0
  203. package/components/table/native/TableSettingsDialog.js.map +1 -0
  204. package/components/table/{TableSettingsDialogFooter.js → native/TableSettingsDialogFooter.js} +2 -2
  205. package/components/table/native/TableSettingsDialogFooter.js.map +1 -0
  206. package/components/table/{TableSettingsListContainer.js → native/TableSettingsListContainer.js} +8 -8
  207. package/components/table/native/TableSettingsListContainer.js.map +1 -0
  208. package/components/table/native/TableSettingsListItem.js +100 -0
  209. package/components/table/native/TableSettingsListItem.js.map +1 -0
  210. package/components/table/parse/parseBody.d.ts +3 -0
  211. package/components/table/parse/parseBody.js +13 -0
  212. package/components/table/parse/parseBody.js.map +1 -0
  213. package/components/table/parse/parseColumns.d.ts +3 -0
  214. package/components/table/parse/parseColumns.js +81 -0
  215. package/components/table/parse/parseColumns.js.map +1 -0
  216. package/components/table/parse/parseFooter.d.ts +3 -0
  217. package/components/table/parse/parseFooter.js +39 -0
  218. package/components/table/parse/parseFooter.js.map +1 -0
  219. package/components/table/parse/parseHeaders.d.ts +4 -0
  220. package/components/table/parse/parseHeaders.js +89 -0
  221. package/components/table/parse/parseHeaders.js.map +1 -0
  222. package/components/table/parse/parseRows.d.ts +3 -0
  223. package/components/table/parse/parseRows.js +93 -0
  224. package/components/table/parse/parseRows.js.map +1 -0
  225. package/components/table/parse/tableChildGuards.d.ts +25 -0
  226. package/components/table/parse/tableChildGuards.js +29 -0
  227. package/components/table/parse/tableChildGuards.js.map +1 -0
  228. package/components/table/render/body/TableBodyRow.d.ts +16 -0
  229. package/components/table/render/body/TableBodyRow.js +84 -0
  230. package/components/table/render/body/TableBodyRow.js.map +1 -0
  231. package/components/table/render/body/TableBodySection.d.ts +20 -0
  232. package/components/table/render/body/TableBodySection.js +68 -0
  233. package/components/table/render/body/TableBodySection.js.map +1 -0
  234. package/components/table/render/body/TableDataRow.d.ts +15 -0
  235. package/components/table/render/body/TableDataRow.js +143 -0
  236. package/components/table/render/body/TableDataRow.js.map +1 -0
  237. package/components/table/render/body/TableEmptyRow.d.ts +7 -0
  238. package/components/table/render/body/TableEmptyRow.js +6 -0
  239. package/components/table/render/body/TableEmptyRow.js.map +1 -0
  240. package/components/table/render/body/TableExpandedRow.d.ts +8 -0
  241. package/components/table/render/body/TableExpandedRow.js +84 -0
  242. package/components/table/render/body/TableExpandedRow.js.map +1 -0
  243. package/components/table/render/body/TableGroupRow.d.ts +8 -0
  244. package/components/table/render/body/TableGroupRow.js +21 -0
  245. package/components/table/render/body/TableGroupRow.js.map +1 -0
  246. package/components/table/render/body/TableSpacerRow.d.ts +7 -0
  247. package/components/table/render/body/TableSpacerRow.js +15 -0
  248. package/components/table/render/body/TableSpacerRow.js.map +1 -0
  249. package/components/table/render/footer/TableFooterCell.d.ts +8 -0
  250. package/components/table/render/footer/TableFooterCell.js +31 -0
  251. package/components/table/render/footer/TableFooterCell.js.map +1 -0
  252. package/components/table/render/footer/TableFooterContent.d.ts +6 -0
  253. package/components/table/render/footer/TableFooterContent.js +6 -0
  254. package/components/table/render/footer/TableFooterContent.js.map +1 -0
  255. package/components/table/render/footer/TableFooterSection.d.ts +10 -0
  256. package/components/table/render/footer/TableFooterSection.js +28 -0
  257. package/components/table/render/footer/TableFooterSection.js.map +1 -0
  258. package/components/table/render/header/TableBatchDropdown.d.ts +9 -0
  259. package/components/table/render/header/TableBatchDropdown.js +28 -0
  260. package/components/table/render/header/TableBatchDropdown.js.map +1 -0
  261. package/components/table/render/header/TableColumnFilter.d.ts +66 -0
  262. package/components/table/render/header/TableColumnFilter.js +70 -0
  263. package/components/table/render/header/TableColumnFilter.js.map +1 -0
  264. package/components/table/render/header/TableDraggableHeaderCell.d.ts +3 -0
  265. package/components/table/render/header/TableDraggableHeaderCell.js +54 -0
  266. package/components/table/render/header/TableDraggableHeaderCell.js.map +1 -0
  267. package/components/table/render/header/TableHeader.types.d.ts +35 -0
  268. package/components/table/render/header/TableHeaderCellContent.d.ts +3 -0
  269. package/components/table/render/header/TableHeaderCellContent.js +57 -0
  270. package/components/table/render/header/TableHeaderCellContent.js.map +1 -0
  271. package/components/table/render/header/TableHeaderCellResizeHandle.d.ts +3 -0
  272. package/components/table/render/header/TableHeaderCellResizeHandle.js +22 -0
  273. package/components/table/render/header/TableHeaderCellResizeHandle.js.map +1 -0
  274. package/components/table/render/header/TableHeaderDragOverlay.d.ts +13 -0
  275. package/components/table/render/header/TableHeaderDragOverlay.js +35 -0
  276. package/components/table/render/header/TableHeaderDragOverlay.js.map +1 -0
  277. package/components/table/render/header/TableHeaderSection.d.ts +3 -0
  278. package/components/table/render/header/TableHeaderSection.js +104 -0
  279. package/components/table/render/header/TableHeaderSection.js.map +1 -0
  280. package/components/table/render/header/TableHeaderSelectionCell.d.ts +9 -0
  281. package/components/table/render/header/TableHeaderSelectionCell.js +41 -0
  282. package/components/table/render/header/TableHeaderSelectionCell.js.map +1 -0
  283. package/components/table/render/header/TableStaticHeaderCell.d.ts +3 -0
  284. package/components/table/render/header/TableStaticHeaderCell.js +36 -0
  285. package/components/table/render/header/TableStaticHeaderCell.js.map +1 -0
  286. package/components/table/render/header/resolveAriaSort.d.ts +2 -0
  287. package/components/table/render/header/resolveAriaSort.js +8 -0
  288. package/components/table/render/header/resolveAriaSort.js.map +1 -0
  289. package/components/table/render/header/resolveColumnCollisionDetection.d.ts +2 -0
  290. package/components/table/render/header/resolveColumnCollisionDetection.js +9 -0
  291. package/components/table/render/header/resolveColumnCollisionDetection.js.map +1 -0
  292. package/components/table/render/header/resolveHeaderCellClassName.d.ts +10 -0
  293. package/components/table/render/header/resolveHeaderCellClassName.js +22 -0
  294. package/components/table/render/header/resolveHeaderCellClassName.js.map +1 -0
  295. package/components/table/render/header/resolveHeaderCellStyle.d.ts +829 -0
  296. package/components/table/render/header/resolveHeaderCellStyle.js +9 -0
  297. package/components/table/render/header/resolveHeaderCellStyle.js.map +1 -0
  298. package/components/table/selection/useTableSelection.d.ts +82 -0
  299. package/components/table/selection/useTableSelection.js +35 -0
  300. package/components/table/selection/useTableSelection.js.map +1 -0
  301. package/components/table/settings/TableColumnsDropdown.d.ts +90 -0
  302. package/components/table/settings/TableColumnsDropdown.js +137 -0
  303. package/components/table/settings/TableColumnsDropdown.js.map +1 -0
  304. package/components/table/settings/TableColumnsDropdownItem.d.ts +8 -0
  305. package/components/table/settings/TableColumnsDropdownItem.js +66 -0
  306. package/components/table/settings/TableColumnsDropdownItem.js.map +1 -0
  307. package/components/table/shared/getAlignClassName.d.ts +3 -0
  308. package/components/table/shared/getAlignClassName.js +6 -0
  309. package/components/table/shared/getAlignClassName.js.map +1 -0
  310. package/components/table/shared/getInteractiveRowProps.d.ts +14 -0
  311. package/components/table/shared/getInteractiveRowProps.js +15 -0
  312. package/components/table/shared/getInteractiveRowProps.js.map +1 -0
  313. package/components/table/shared/resolveTableAria.d.ts +2 -0
  314. package/components/table/shared/resolveTableAria.js +6 -0
  315. package/components/table/shared/resolveTableAria.js.map +1 -0
  316. package/components/table/tableSizing.constants.d.ts +4 -0
  317. package/components/table/tableSizing.constants.js +8 -0
  318. package/components/table/tableSizing.constants.js.map +1 -0
  319. package/components/teaser/TeaserContainer.js +3 -3
  320. package/components/teaser/TeaserContainer.js.map +1 -1
  321. package/components/virtualList/VirtualList.js +16 -13
  322. package/components/virtualList/VirtualList.js.map +1 -1
  323. package/googleAnalyticsUtils.d.ts +1 -0
  324. package/googleAnalyticsUtils.js +9 -0
  325. package/googleAnalyticsUtils.js.map +1 -0
  326. package/hooks/useCookies.js +17 -17
  327. package/hooks/useCookies.js.map +1 -1
  328. package/hooks/useDraggableElement.d.ts +35 -0
  329. package/hooks/useDraggableElement.js +49 -0
  330. package/hooks/useDraggableElement.js.map +1 -0
  331. package/hooks/useElapsedTime.js +4 -4
  332. package/hooks/useElapsedTime.js.map +1 -1
  333. package/hooks/useLocationSuggestions.js +13 -10
  334. package/hooks/useLocationSuggestions.js.map +1 -1
  335. package/hooks/useMergeRefs.js +12 -12
  336. package/hooks/useMergeRefs.js.map +1 -1
  337. package/hooks/usePrevious.d.ts +1 -1
  338. package/hooks/usePrevious.js.map +1 -1
  339. package/hooks/useResizeObserver.js +25 -10
  340. package/hooks/useResizeObserver.js.map +1 -1
  341. package/hooks/useRioCookieConsent.js +7 -4
  342. package/hooks/useRioCookieConsent.js.map +1 -1
  343. package/hooks/useSorting.js +10 -10
  344. package/hooks/useSorting.js.map +1 -1
  345. package/hooks/useStorage.js +12 -12
  346. package/hooks/useStorage.js.map +1 -1
  347. package/hooks/useSum.js +10 -7
  348. package/hooks/useSum.js.map +1 -1
  349. package/hooks/useTableSelection.js.map +1 -1
  350. package/hooks/useTimeout.js +6 -3
  351. package/hooks/useTimeout.js.map +1 -1
  352. package/package.json +3 -3
  353. package/routeUtils.js +12 -10
  354. package/utils/analytics/analyticsAnalysisUtils.d.ts +27 -0
  355. package/utils/analytics/analyticsAnalysisUtils.js +161 -0
  356. package/utils/analytics/analyticsAnalysisUtils.js.map +1 -0
  357. package/utils/analytics/autoTracking.d.ts +14 -0
  358. package/utils/analytics/autoTracking.js +19 -0
  359. package/utils/analytics/autoTracking.js.map +1 -0
  360. package/utils/analytics/createAnalyticsOverlayTooltip.d.ts +36 -0
  361. package/utils/analytics/createAnalyticsOverlayTooltip.js +203 -0
  362. package/utils/analytics/createAnalyticsOverlayTooltip.js.map +1 -0
  363. package/utils/analytics/googleAnalyticsUtils.d.ts +37 -0
  364. package/utils/analytics/googleAnalyticsUtils.js +37 -0
  365. package/utils/analytics/googleAnalyticsUtils.js.map +1 -0
  366. package/utils/analytics/logAnalyticsOverlayUnmatchedEntries.d.ts +8 -0
  367. package/utils/analytics/logAnalyticsOverlayUnmatchedEntries.js +61 -0
  368. package/utils/analytics/logAnalyticsOverlayUnmatchedEntries.js.map +1 -0
  369. package/utils/analytics/useAnalyticsOverlayDom.d.ts +11 -0
  370. package/utils/analytics/useAnalyticsOverlayDom.js +120 -0
  371. package/utils/analytics/useAnalyticsOverlayDom.js.map +1 -0
  372. package/utils/arrayMove.js +11 -0
  373. package/utils/arrayMove.js.map +1 -0
  374. package/utils/cssuseragent.js +2 -2
  375. package/utils/cssuseragent.js.map +1 -1
  376. package/utils/deviceUtils.js.map +1 -1
  377. package/utils/formatUtils.js.map +1 -1
  378. package/utils/hasUtilityClass.js +3 -3
  379. package/utils/hasUtilityClass.js.map +1 -1
  380. package/utils/hidePiiData.js.map +1 -1
  381. package/utils/init/checkForReleaseVersion.js +4 -4
  382. package/utils/init/checkForReleaseVersion.js.map +1 -1
  383. package/utils/init/styledLogs.js.map +1 -1
  384. package/utils/mergeRefs.js +3 -3
  385. package/utils/mergeRefs.js.map +1 -1
  386. package/utils/routeUtils.d.ts +32 -1
  387. package/utils/routeUtils.js +85 -67
  388. package/utils/routeUtils.js.map +1 -1
  389. package/utils/storageUtils.js +9 -9
  390. package/utils/storageUtils.js.map +1 -1
  391. package/version.d.ts +1 -1
  392. package/version.js +2 -2
  393. package/version.js.map +1 -1
  394. package/components/table/TableCol.js.map +0 -1
  395. package/components/table/TableHead.js.map +0 -1
  396. package/components/table/TableSettingsColumnButtons.js +0 -45
  397. package/components/table/TableSettingsColumnButtons.js.map +0 -1
  398. package/components/table/TableSettingsColumnDetails.js.map +0 -1
  399. package/components/table/TableSettingsDialog.js +0 -208
  400. package/components/table/TableSettingsDialog.js.map +0 -1
  401. package/components/table/TableSettingsDialogFooter.js.map +0 -1
  402. package/components/table/TableSettingsListContainer.js.map +0 -1
  403. package/components/table/TableSettingsListItem.js +0 -96
  404. package/components/table/TableSettingsListItem.js.map +0 -1
  405. /package/components/table/{TableCol.d.ts → native/TableCol.d.ts} +0 -0
  406. /package/components/table/{TableCol.js → native/TableCol.js} +0 -0
  407. /package/components/table/{TableHead.d.ts → native/TableHead.d.ts} +0 -0
  408. /package/components/table/{TableSettingsColumnButtons.d.ts → native/TableSettingsColumnButtons.d.ts} +0 -0
  409. /package/components/table/{TableSettingsColumnDetails.d.ts → native/TableSettingsColumnDetails.d.ts} +0 -0
  410. /package/components/table/{TableSettingsDialogFooter.d.ts → native/TableSettingsDialogFooter.d.ts} +0 -0
  411. /package/components/table/{TableSettingsListContainer.d.ts → native/TableSettingsListContainer.d.ts} +0 -0
  412. /package/components/table/{TableSettingsListItem.d.ts → native/TableSettingsListItem.d.ts} +0 -0
@@ -8,11 +8,11 @@ import { DOWN as O, scrollItemIntoView as T, UP as g } from "../../utils/scrollI
8
8
  import $ from "../../hooks/useEffectOnce.js";
9
9
  import ee from "../../hooks/useKey.js";
10
10
  import te from "./DropdownHeader.js";
11
- import re from "./NoItemMessage.js";
12
- import se from "../spinner/Spinner.js";
11
+ import se from "./NoItemMessage.js";
12
+ import re from "../spinner/Spinner.js";
13
13
  const B = "data-item-id", ne = 0, H = "focus", L = O, be = (h) => {
14
14
  const {
15
- isOpen: r = !1,
15
+ isOpen: s = !1,
16
16
  isLoading: l = !1,
17
17
  updateDOMValues: u = N,
18
18
  onOpen: i = N,
@@ -27,33 +27,33 @@ const B = "data-item-id", ne = 0, H = "focus", L = O, be = (h) => {
27
27
  keyboardUsed: f,
28
28
  noItemMessage: W,
29
29
  dropdownClassName: X
30
- } = h, [n, k] = y(m || ne), [q, A] = y(f), w = _(L), s = _(null);
30
+ } = h, [n, k] = y(m || ne), [q, A] = y(f), w = _(L), r = _(null);
31
31
  b(() => {
32
- r && s.current && (s.current.scrollTop = 0);
33
- }, [r]), b(() => {
34
- typeof m == "number" && k(m), typeof f == "boolean" && A(f), r || (w.current = L);
35
- }, [m, f, r]), $(() => {
32
+ s && r.current && (r.current.scrollTop = 0);
33
+ }, [s]), b(() => {
34
+ typeof m == "number" && k(m), typeof f == "boolean" && A(f), s || (w.current = L);
35
+ }, [m, f, s]), $(() => {
36
36
  const e = F();
37
37
  u(e);
38
38
  });
39
- const I = Z({ pullRight: G, dropup: K, autoDropDirection: j, dropdownMenuRef: s }, [r]);
39
+ const I = Z({ pullRight: G, dropup: K, autoDropDirection: j, dropdownMenuRef: r }, [s]);
40
40
  Y(() => {
41
- if (s.current) {
42
- const e = s.current.parentElement;
41
+ if (r.current) {
42
+ const e = r.current.parentElement;
43
43
  I.dropup ? e?.classList.add("dropup") : e?.classList.remove("dropup");
44
44
  }
45
- }, [I, s]), b(() => {
46
- s.current && u(F());
47
- }, [s.current]), b(() => {
48
- r && T(
45
+ }, [I, r]), b(() => {
46
+ r.current && u(F());
47
+ }, [r.current]), b(() => {
48
+ s && T(
49
49
  w.current || L,
50
- s.current,
50
+ r.current,
51
51
  D()
52
52
  );
53
- }, [n, r]);
54
- const [v, U] = y(r);
55
- r && !v ? (i(I.dropup), U(r)) : !r && v && (E(), U(r)), ee((e) => {
56
- if (r)
53
+ }, [n, s]);
54
+ const [v, U] = y(s);
55
+ s && !v ? (i(I.dropup), U(s)) : !s && v && (E(), U(s)), ee((e) => {
56
+ if (s)
57
57
  switch (e.key) {
58
58
  case "Escape": {
59
59
  E();
@@ -68,11 +68,11 @@ const B = "data-item-id", ne = 0, H = "focus", L = O, be = (h) => {
68
68
  break;
69
69
  }
70
70
  case "ArrowUp": {
71
- e.preventDefault(), M(g), T(g, s.current, D());
71
+ e.preventDefault(), M(g), T(g, r.current, D());
72
72
  break;
73
73
  }
74
74
  case "ArrowDown": {
75
- e.preventDefault(), M(O), T(O, s.current, D());
75
+ e.preventDefault(), M(O), T(O, r.current, D());
76
76
  break;
77
77
  }
78
78
  }
@@ -92,12 +92,14 @@ const B = "data-item-id", ne = 0, H = "focus", L = O, be = (h) => {
92
92
  w.current = e;
93
93
  const a = e === g ? o.length - 1 : 0;
94
94
  k(t < 0 ? a : t), A(!0);
95
- }, S = () => s.current?.getElementsByTagName("a") || [], F = () => {
96
- if (s.current)
97
- return [...S()].map((t) => ({
98
- id: t.getAttribute(B),
99
- text: t.textContent
100
- }));
95
+ }, S = () => r.current?.getElementsByTagName("a") || [], F = () => {
96
+ if (r.current)
97
+ return [...S()].map(
98
+ (t) => ({
99
+ id: t.getAttribute(B),
100
+ text: t.textContent
101
+ })
102
+ );
101
103
  }, D = () => [...S()].find((t) => t.className.includes(H)), z = (e) => {
102
104
  if (e.preventDefault(), V(o))
103
105
  return;
@@ -111,8 +113,8 @@ const B = "data-item-id", ne = 0, H = "focus", L = O, be = (h) => {
111
113
  const t = e.currentTarget.getElementsByTagName("input")[0].value, a = o.find((d) => d.id === t);
112
114
  p(a);
113
115
  }, R = C("dropdown-menu", I.pullRight && "pull-right", X);
114
- return V(o) ? /* @__PURE__ */ c(re, { noItemMessage: W, className: R }) : /* @__PURE__ */ x("ul", { className: R, ref: s, role: "menu", children: [
115
- l && /* @__PURE__ */ c("div", { className: "display-flex justify-content-center padding-10", children: /* @__PURE__ */ c(se, {}) }),
116
+ return V(o) ? /* @__PURE__ */ c(se, { noItemMessage: W, className: R }) : /* @__PURE__ */ x("ul", { className: R, ref: r, role: "menu", children: [
117
+ l && /* @__PURE__ */ c("div", { className: "display-flex justify-content-center padding-10", children: /* @__PURE__ */ c(re, {}) }),
116
118
  !l && o.map((e, t) => {
117
119
  if (e.header)
118
120
  return /* @__PURE__ */ c(te, { icon: e.icon, label: e.label }, e.id);
@@ -143,8 +145,8 @@ const B = "data-item-id", ne = 0, H = "focus", L = O, be = (h) => {
143
145
  ) }, e.id);
144
146
  })
145
147
  ] });
146
- }, Ne = (h, r, l) => {
147
- const u = h.filter((i) => i.text.toLowerCase().includes(r.toLowerCase()));
148
+ }, Ne = (h, s, l) => {
149
+ const u = h.filter((i) => i.text.toLowerCase().includes(s.toLowerCase()));
148
150
  return l.filter((i) => u.find((p) => p.id === i.id));
149
151
  };
150
152
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"BaseSelectDropdown.js","sources":["../../../src/components/selects/BaseSelectDropdown.tsx"],"sourcesContent":["import type React from 'react';\nimport { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { isEmpty } from 'es-toolkit/compat';\nimport { noop } from 'es-toolkit/function';\n\nimport classNames from '../../utils/classNames';\nimport { useDropDirection } from '../../utils/useDropDirection';\nimport { DOWN, scrollItemIntoView, UP } from '../../utils/scrollItemIntoView';\nimport useEffectOnce from '../../hooks/useEffectOnce';\nimport useKey from '../../useKey';\nimport DropdownHeader from './DropdownHeader';\nimport NoItemMessage from './NoItemMessage';\nimport Spinner from '../spinner/Spinner';\n\nconst DATA_ATTRIBUTE_ID = 'data-item-id';\nconst DEFAULT_FOCUSED_ITEM_INDEX = 0;\nconst HIGHLIGHT_CLASS = 'focus';\nconst DEFAULT_SCROLL_DIRECTION = DOWN;\n\nexport type OptionDOMValue = {\n id: string;\n text: string;\n};\n\nexport type SelectOption = {\n /**\n * Used to identify an option.\n */\n id: string;\n\n /**\n * The option item text.\n */\n label: string | React.ReactNode;\n\n /**\n * Icon to be displayed in front of the label.\n */\n icon?: React.ReactNode;\n\n /**\n * Defines whether the menu item is selected.\n *\n * @default false\n */\n selected?: boolean;\n\n /**\n * Setting \"disabled\" to true will disable the respective item.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Will treat the given value as a menu header\n */\n header?: boolean;\n};\n\nexport type BaseSelectDropdownProps<T extends SelectOption> = {\n options?: T[];\n isOpen?: boolean;\n isLoading?: boolean;\n updateDOMValues?: (values: OptionDOMValue[] | undefined) => void;\n onOpen?: (hasDropup: boolean) => void;\n onSelect?: (selectedItem: T | undefined) => void;\n onClose?: () => void;\n placeholder?: string | React.ReactNode;\n dropup?: boolean;\n pullRight?: boolean;\n autoDropDirection?: boolean;\n noItemMessage?: string | React.ReactNode;\n focusedItemIndex?: number;\n dropdownClassName?: string;\n keyboardUsed?: boolean;\n useActiveClass?: boolean;\n};\n\nconst BaseSelectDropdown = <T extends SelectOption>(props: BaseSelectDropdownProps<T>) => {\n const {\n isOpen = false,\n isLoading = false,\n updateDOMValues = noop,\n onOpen = noop,\n onSelect = noop,\n onClose = noop,\n options = [],\n autoDropDirection = true,\n dropup = false,\n pullRight = false,\n useActiveClass = false,\n focusedItemIndex: externalFocusedItemIndex,\n keyboardUsed: externalKeyboardUsed,\n noItemMessage,\n dropdownClassName,\n } = props;\n\n const [focusedItemIndex, setFocusedItemIndex] = useState(externalFocusedItemIndex || DEFAULT_FOCUSED_ITEM_INDEX);\n const [keyboardUsed, setKeyboardUsed] = useState(externalKeyboardUsed);\n const lastScrollDirectionRef = useRef<typeof UP | typeof DOWN>(DEFAULT_SCROLL_DIRECTION);\n\n const dropdownMenuRef = useRef<HTMLUListElement>(null);\n\n // Reset scroll position whenever the menu opens to avoid retaining old scroll offsets\n useEffect(() => {\n if (isOpen && dropdownMenuRef.current) {\n dropdownMenuRef.current.scrollTop = 0;\n }\n }, [isOpen]);\n\n // Keep internal focus state in sync when the dropdown opens/closes or when parent-controlled values change\n useEffect(() => {\n if (typeof externalFocusedItemIndex === 'number') {\n setFocusedItemIndex(externalFocusedItemIndex);\n }\n\n if (typeof externalKeyboardUsed === 'boolean') {\n setKeyboardUsed(externalKeyboardUsed);\n }\n\n if (!isOpen) {\n lastScrollDirectionRef.current = DEFAULT_SCROLL_DIRECTION;\n }\n }, [externalFocusedItemIndex, externalKeyboardUsed, isOpen]);\n\n useEffectOnce(() => {\n // all available items need to be rendered in order to know their DOM value\n // which will be used for filtering in the parent component\n const currentItemDOMValues = updateItemDOMValues();\n updateDOMValues(currentItemDOMValues);\n });\n\n // Overwrite position of dropdown menu in case auto drop is enabled\n const dropDirection = useDropDirection({ pullRight, dropup, autoDropDirection, dropdownMenuRef }, [isOpen]);\n\n // Add or remove the \"dropup\" class from the parent Select/Multiselect component to position\n // the dropdown element accordingly via CSS\n useLayoutEffect(() => {\n if (dropdownMenuRef.current) {\n const parent = dropdownMenuRef.current.parentElement;\n if (dropDirection.dropup) {\n parent?.classList.add('dropup');\n } else {\n parent?.classList.remove('dropup');\n }\n }\n }, [dropDirection, dropdownMenuRef]);\n\n useEffect(() => {\n if (dropdownMenuRef.current) {\n updateDOMValues(updateItemDOMValues());\n }\n }, [dropdownMenuRef.current]);\n\n // Scroll the focused item into view whenever focus changes\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n\n scrollItemIntoView(\n lastScrollDirectionRef.current || DEFAULT_SCROLL_DIRECTION,\n dropdownMenuRef.current,\n getFocusedOptionNode()\n );\n }, [focusedItemIndex, isOpen]);\n\n // update internal state for isOpen\n const [previousIsOpen, setPreviousIsOpen] = useState(isOpen);\n if (isOpen && !previousIsOpen) {\n onOpen(dropDirection.dropup);\n setPreviousIsOpen(isOpen);\n } else if (!isOpen && previousIsOpen) {\n onClose();\n setPreviousIsOpen(isOpen);\n }\n\n useKey(event => {\n if (isOpen) {\n switch (event.key) {\n case 'Escape': {\n // close dropdown on esc\n onClose();\n break;\n }\n case 'Tab': {\n // close dropdown on tab\n onClose();\n break;\n }\n case 'Enter': {\n // select item on enter\n selectOptionOnEnter(event);\n break;\n }\n case 'ArrowUp': {\n // prevent scrolling the page when dropdown menu is open\n event.preventDefault();\n\n // select item above on arrow up key\n focusOption(UP);\n scrollItemIntoView(UP, dropdownMenuRef.current, getFocusedOptionNode());\n break;\n }\n case 'ArrowDown': {\n // prevent scrolling the page when dropdown menu is open\n event.preventDefault();\n\n // select item below on arrow down key\n focusOption(DOWN);\n scrollItemIntoView(DOWN, dropdownMenuRef.current, getFocusedOptionNode());\n break;\n }\n default:\n break;\n }\n }\n });\n\n const focusOption = (direction: typeof UP | typeof DOWN) => {\n let nextFocusedItem = 0;\n\n switch (direction) {\n case UP: {\n nextFocusedItem = focusedItemIndex <= 0 ? focusedItemIndex : focusedItemIndex - 1;\n break;\n }\n case DOWN: {\n nextFocusedItem = focusedItemIndex === options.length - 1 ? focusedItemIndex : focusedItemIndex + 1;\n break;\n }\n default:\n break;\n }\n\n lastScrollDirectionRef.current = direction;\n\n // In case the next item index is negative, means outside the bounds of the items,\n // reset it depending on the current direction\n const indexLimit = direction === UP ? options.length - 1 : 0;\n\n setFocusedItemIndex(nextFocusedItem < 0 ? indexLimit : nextFocusedItem);\n setKeyboardUsed(true);\n };\n\n const getOptionNodes = () => {\n const node = dropdownMenuRef.current;\n return node?.getElementsByTagName('a') || [];\n };\n\n const updateItemDOMValues = () => {\n if (dropdownMenuRef.current) {\n const optionNodes = getOptionNodes();\n return [...optionNodes].map(item => {\n return {\n id: item.getAttribute(DATA_ATTRIBUTE_ID),\n text: item.textContent,\n } as OptionDOMValue;\n });\n }\n };\n\n const getFocusedOptionNode = () => {\n const optionNodes = getOptionNodes();\n return [...optionNodes].find(item => item.className.includes(HIGHLIGHT_CLASS));\n };\n\n const selectOptionOnEnter = (event: KeyboardEvent) => {\n event.preventDefault();\n\n // When no filter result was found, avoid selecting anything\n if (isEmpty(options)) {\n return;\n }\n\n const match = getFocusedOptionNode();\n\n if (match) {\n const selectedItem = options.find(option => option.id === match.getAttribute(DATA_ATTRIBUTE_ID));\n onSelect(selectedItem);\n }\n };\n\n const handleOptionChange = (event: React.MouseEvent<HTMLAnchorElement>) => {\n event.preventDefault();\n\n const optionId = event.currentTarget.getElementsByTagName('input')[0].value;\n const selectedItem = options.find(option => option.id === optionId);\n\n onSelect(selectedItem);\n };\n\n const dropdownMenuClasses = classNames('dropdown-menu', dropDirection.pullRight && 'pull-right', dropdownClassName);\n\n // Don't show the dropdown, when no match are found when filtering unless there is a not found message\n if (isEmpty(options)) {\n return <NoItemMessage noItemMessage={noItemMessage} className={dropdownMenuClasses} />;\n }\n\n return (\n <ul className={dropdownMenuClasses} ref={dropdownMenuRef} role='menu'>\n {isLoading && (\n <div className='display-flex justify-content-center padding-10'>\n <Spinner />\n </div>\n )}\n {!isLoading &&\n options.map((option, index) => {\n if (option.header) {\n return <DropdownHeader key={option.id} icon={option.icon} label={option.label} />;\n }\n\n // Show focused style only when keyboard is in use\n const anchorClassNames = classNames(\n keyboardUsed && focusedItemIndex === index ? HIGHLIGHT_CLASS : '',\n option.disabled && 'pointer-events-none',\n 'display-flex align-items-center gap-3'\n );\n\n const wrapperClassNames = classNames(\n option.disabled && 'disabled',\n useActiveClass && option.selected && 'active'\n );\n\n return (\n <li key={option.id} className={wrapperClassNames} role='listitem'>\n <a\n role='menuitem'\n className={anchorClassNames}\n data-item-id={option.id}\n data-item-index={index}\n // Note, we need to assign the click callback only when it's not disabled\n // otherwise the functions is still triggered\n onClick={option.disabled ? undefined : handleOptionChange}\n >\n <span className='selected-option-dropdown-item'>\n {option.icon && <>{option.icon}</>}\n {option.label}\n </span>\n <input type='hidden' value={option.id} />\n </a>\n </li>\n );\n })}\n </ul>\n );\n};\n\nexport const filterOptions = <T extends SelectOption>(\n itemDOMValues: OptionDOMValue[],\n filterValue: string,\n options: T[]\n) => {\n const filteredDOMValues = itemDOMValues.filter(item => item.text.toLowerCase().includes(filterValue.toLowerCase()));\n\n // Filter the options according to the filtered DOM values and map the IDs since the filter cannot be done\n // on the options itself as they might contain arbitrary components\n return options.filter(option => {\n return filteredDOMValues.find(domValue => domValue.id === option.id);\n });\n};\n\nexport default BaseSelectDropdown;\n"],"names":["DATA_ATTRIBUTE_ID","DEFAULT_FOCUSED_ITEM_INDEX","HIGHLIGHT_CLASS","DEFAULT_SCROLL_DIRECTION","DOWN","BaseSelectDropdown","props","isOpen","isLoading","updateDOMValues","noop","onOpen","onSelect","onClose","options","autoDropDirection","dropup","pullRight","useActiveClass","externalFocusedItemIndex","externalKeyboardUsed","noItemMessage","dropdownClassName","focusedItemIndex","setFocusedItemIndex","useState","keyboardUsed","setKeyboardUsed","lastScrollDirectionRef","useRef","dropdownMenuRef","useEffect","useEffectOnce","currentItemDOMValues","updateItemDOMValues","dropDirection","useDropDirection","useLayoutEffect","parent","scrollItemIntoView","getFocusedOptionNode","previousIsOpen","setPreviousIsOpen","useKey","event","selectOptionOnEnter","focusOption","UP","direction","nextFocusedItem","indexLimit","getOptionNodes","item","isEmpty","match","selectedItem","option","handleOptionChange","optionId","dropdownMenuClasses","classNames","jsx","NoItemMessage","Spinner","index","DropdownHeader","anchorClassNames","wrapperClassNames","jsxs","Fragment","filterOptions","itemDOMValues","filterValue","filteredDOMValues","domValue"],"mappings":";;;;;;;;;;;;AAcA,MAAMA,IAAoB,gBACpBC,KAA6B,GAC7BC,IAAkB,SAClBC,IAA2BC,GA8D3BC,KAAqB,CAAyBC,MAAsC;AACtF,QAAM;AAAA,IACF,QAAAC,IAAS;AAAA,IACT,WAAAC,IAAY;AAAA,IACZ,iBAAAC,IAAkBC;AAAA,IAClB,QAAAC,IAASD;AAAA,IACT,UAAAE,IAAWF;AAAA,IACX,SAAAG,IAAUH;AAAA,IACV,SAAAI,IAAU,CAAA;AAAA,IACV,mBAAAC,IAAoB;AAAA,IACpB,QAAAC,IAAS;AAAA,IACT,WAAAC,IAAY;AAAA,IACZ,gBAAAC,IAAiB;AAAA,IACjB,kBAAkBC;AAAA,IAClB,cAAcC;AAAA,IACd,eAAAC;AAAA,IACA,mBAAAC;AAAA,EAAA,IACAhB,GAEE,CAACiB,GAAkBC,CAAmB,IAAIC,EAASN,KAA4BlB,EAA0B,GACzG,CAACyB,GAAcC,CAAe,IAAIF,EAASL,CAAoB,GAC/DQ,IAAyBC,EAAgC1B,CAAwB,GAEjF2B,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B;AAAA,QAC/DsD,EAAO,YAAY;AAAA,QACnB;AAAA,MAAA,GAGEW,IAAoBP;AAAA,QACtBJ,EAAO,YAAY;AAAA,QACnBtC,KAAkBsC,EAAO,YAAY;AAAA,MAAA;AAGzC,aACI,gBAAAK,EAAC,MAAA,EAAmB,WAAWM,GAAmB,MAAK,YACnD,UAAA,gBAAAC;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,MAAK;AAAA,UACL,WAAWF;AAAA,UACX,gBAAcV,EAAO;AAAA,UACrB,mBAAiBQ;AAAA,UAGjB,SAASR,EAAO,WAAW,SAAYC;AAAA,UAEvC,UAAA;AAAA,YAAA,gBAAAW,EAAC,QAAA,EAAK,WAAU,iCACX,UAAA;AAAA,cAAAZ,EAAO,QAAQ,gBAAAK,EAAAQ,GAAA,EAAG,UAAAb,EAAO,MAAK;AAAA,cAC9BA,EAAO;AAAA,YAAA,GACZ;AAAA,8BACC,SAAA,EAAM,MAAK,UAAS,OAAOA,EAAO,GAAA,CAAI;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA,EAC3C,GAfKA,EAAO,EAgBhB;AAAA,IAER,CAAC;AAAA,EAAA,GACT;AAER,GAEac,KAAgB,CACzBC,GACAC,GACA1D,MACC;AACD,QAAM2D,IAAoBF,EAAc,OAAO,CAAAnB,MAAQA,EAAK,KAAK,YAAA,EAAc,SAASoB,EAAY,YAAA,CAAa,CAAC;AAIlH,SAAO1D,EAAQ,OAAO,CAAA0C,MACXiB,EAAkB,KAAK,CAAAC,MAAYA,EAAS,OAAOlB,EAAO,EAAE,CACtE;AACL;"}
1
+ {"version":3,"file":"BaseSelectDropdown.js","sources":["../../../src/components/selects/BaseSelectDropdown.tsx"],"sourcesContent":["import type React from 'react';\nimport { useEffect, useLayoutEffect, useRef, useState } from 'react';\nimport { isEmpty } from 'es-toolkit/compat';\nimport { noop } from 'es-toolkit/function';\n\nimport classNames from '../../utils/classNames';\nimport { useDropDirection } from '../../utils/useDropDirection';\nimport { DOWN, scrollItemIntoView, UP } from '../../utils/scrollItemIntoView';\nimport useEffectOnce from '../../hooks/useEffectOnce';\nimport useKey from '../../useKey';\nimport DropdownHeader from './DropdownHeader';\nimport NoItemMessage from './NoItemMessage';\nimport Spinner from '../spinner/Spinner';\n\nconst DATA_ATTRIBUTE_ID = 'data-item-id';\nconst DEFAULT_FOCUSED_ITEM_INDEX = 0;\nconst HIGHLIGHT_CLASS = 'focus';\nconst DEFAULT_SCROLL_DIRECTION = DOWN;\n\nexport type OptionDOMValue = {\n id: string;\n text: string;\n};\n\nexport type SelectOption = {\n /**\n * Used to identify an option.\n */\n id: string;\n\n /**\n * The option item text.\n */\n label: string | React.ReactNode;\n\n /**\n * Icon to be displayed in front of the label.\n */\n icon?: React.ReactNode;\n\n /**\n * Defines whether the menu item is selected.\n *\n * @default false\n */\n selected?: boolean;\n\n /**\n * Setting \"disabled\" to true will disable the respective item.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Will treat the given value as a menu header\n */\n header?: boolean;\n};\n\nexport type BaseSelectDropdownProps<T extends SelectOption> = {\n options?: T[];\n isOpen?: boolean;\n isLoading?: boolean;\n updateDOMValues?: (values: OptionDOMValue[] | undefined) => void;\n onOpen?: (hasDropup: boolean) => void;\n onSelect?: (selectedItem: T | undefined) => void;\n onClose?: () => void;\n placeholder?: string | React.ReactNode;\n dropup?: boolean;\n pullRight?: boolean;\n autoDropDirection?: boolean;\n noItemMessage?: string | React.ReactNode;\n focusedItemIndex?: number;\n dropdownClassName?: string;\n keyboardUsed?: boolean;\n useActiveClass?: boolean;\n};\n\nconst BaseSelectDropdown = <T extends SelectOption>(props: BaseSelectDropdownProps<T>) => {\n const {\n isOpen = false,\n isLoading = false,\n updateDOMValues = noop,\n onOpen = noop,\n onSelect = noop,\n onClose = noop,\n options = [],\n autoDropDirection = true,\n dropup = false,\n pullRight = false,\n useActiveClass = false,\n focusedItemIndex: externalFocusedItemIndex,\n keyboardUsed: externalKeyboardUsed,\n noItemMessage,\n dropdownClassName,\n } = props;\n\n const [focusedItemIndex, setFocusedItemIndex] = useState(externalFocusedItemIndex || DEFAULT_FOCUSED_ITEM_INDEX);\n const [keyboardUsed, setKeyboardUsed] = useState(externalKeyboardUsed);\n const lastScrollDirectionRef = useRef<typeof UP | typeof DOWN>(DEFAULT_SCROLL_DIRECTION);\n\n const dropdownMenuRef = useRef<HTMLUListElement>(null);\n\n // Reset scroll position whenever the menu opens to avoid retaining old scroll offsets\n useEffect(() => {\n if (isOpen && dropdownMenuRef.current) {\n dropdownMenuRef.current.scrollTop = 0;\n }\n }, [isOpen]);\n\n // Keep internal focus state in sync when the dropdown opens/closes or when parent-controlled values change\n useEffect(() => {\n if (typeof externalFocusedItemIndex === 'number') {\n setFocusedItemIndex(externalFocusedItemIndex);\n }\n\n if (typeof externalKeyboardUsed === 'boolean') {\n setKeyboardUsed(externalKeyboardUsed);\n }\n\n if (!isOpen) {\n lastScrollDirectionRef.current = DEFAULT_SCROLL_DIRECTION;\n }\n }, [externalFocusedItemIndex, externalKeyboardUsed, isOpen]);\n\n useEffectOnce(() => {\n // all available items need to be rendered in order to know their DOM value\n // which will be used for filtering in the parent component\n const currentItemDOMValues = updateItemDOMValues();\n updateDOMValues(currentItemDOMValues);\n });\n\n // Overwrite position of dropdown menu in case auto drop is enabled\n const dropDirection = useDropDirection({ pullRight, dropup, autoDropDirection, dropdownMenuRef }, [isOpen]);\n\n // Add or remove the \"dropup\" class from the parent Select/Multiselect component to position\n // the dropdown element accordingly via CSS\n useLayoutEffect(() => {\n if (dropdownMenuRef.current) {\n const parent = dropdownMenuRef.current.parentElement;\n if (dropDirection.dropup) {\n parent?.classList.add('dropup');\n } else {\n parent?.classList.remove('dropup');\n }\n }\n }, [dropDirection, dropdownMenuRef]);\n\n useEffect(() => {\n if (dropdownMenuRef.current) {\n updateDOMValues(updateItemDOMValues());\n }\n }, [dropdownMenuRef.current]);\n\n // Scroll the focused item into view whenever focus changes\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n\n scrollItemIntoView(\n lastScrollDirectionRef.current || DEFAULT_SCROLL_DIRECTION,\n dropdownMenuRef.current,\n getFocusedOptionNode()\n );\n }, [focusedItemIndex, isOpen]);\n\n // update internal state for isOpen\n const [previousIsOpen, setPreviousIsOpen] = useState(isOpen);\n if (isOpen && !previousIsOpen) {\n onOpen(dropDirection.dropup);\n setPreviousIsOpen(isOpen);\n } else if (!isOpen && previousIsOpen) {\n onClose();\n setPreviousIsOpen(isOpen);\n }\n\n useKey(event => {\n if (isOpen) {\n switch (event.key) {\n case 'Escape': {\n // close dropdown on esc\n onClose();\n break;\n }\n case 'Tab': {\n // close dropdown on tab\n onClose();\n break;\n }\n case 'Enter': {\n // select item on enter\n selectOptionOnEnter(event);\n break;\n }\n case 'ArrowUp': {\n // prevent scrolling the page when dropdown menu is open\n event.preventDefault();\n\n // select item above on arrow up key\n focusOption(UP);\n scrollItemIntoView(UP, dropdownMenuRef.current, getFocusedOptionNode());\n break;\n }\n case 'ArrowDown': {\n // prevent scrolling the page when dropdown menu is open\n event.preventDefault();\n\n // select item below on arrow down key\n focusOption(DOWN);\n scrollItemIntoView(DOWN, dropdownMenuRef.current, getFocusedOptionNode());\n break;\n }\n default:\n break;\n }\n }\n });\n\n const focusOption = (direction: typeof UP | typeof DOWN) => {\n let nextFocusedItem = 0;\n\n switch (direction) {\n case UP: {\n nextFocusedItem = focusedItemIndex <= 0 ? focusedItemIndex : focusedItemIndex - 1;\n break;\n }\n case DOWN: {\n nextFocusedItem = focusedItemIndex === options.length - 1 ? focusedItemIndex : focusedItemIndex + 1;\n break;\n }\n default:\n break;\n }\n\n lastScrollDirectionRef.current = direction;\n\n // In case the next item index is negative, means outside the bounds of the items,\n // reset it depending on the current direction\n const indexLimit = direction === UP ? options.length - 1 : 0;\n\n setFocusedItemIndex(nextFocusedItem < 0 ? indexLimit : nextFocusedItem);\n setKeyboardUsed(true);\n };\n\n const getOptionNodes = () => {\n const node = dropdownMenuRef.current;\n return node?.getElementsByTagName('a') || [];\n };\n\n const updateItemDOMValues = () => {\n if (dropdownMenuRef.current) {\n const optionNodes = getOptionNodes();\n return [...optionNodes].map(\n item =>\n ({\n id: item.getAttribute(DATA_ATTRIBUTE_ID),\n text: item.textContent,\n }) as OptionDOMValue\n );\n }\n };\n\n const getFocusedOptionNode = () => {\n const optionNodes = getOptionNodes();\n return [...optionNodes].find(item => item.className.includes(HIGHLIGHT_CLASS));\n };\n\n const selectOptionOnEnter = (event: KeyboardEvent) => {\n event.preventDefault();\n\n // When no filter result was found, avoid selecting anything\n if (isEmpty(options)) {\n return;\n }\n\n const match = getFocusedOptionNode();\n\n if (match) {\n const selectedItem = options.find(option => option.id === match.getAttribute(DATA_ATTRIBUTE_ID));\n onSelect(selectedItem);\n }\n };\n\n const handleOptionChange = (event: React.MouseEvent<HTMLAnchorElement>) => {\n event.preventDefault();\n\n const optionId = event.currentTarget.getElementsByTagName('input')[0].value;\n const selectedItem = options.find(option => option.id === optionId);\n\n onSelect(selectedItem);\n };\n\n const dropdownMenuClasses = classNames('dropdown-menu', dropDirection.pullRight && 'pull-right', dropdownClassName);\n\n // Don't show the dropdown, when no match are found when filtering unless there is a not found message\n if (isEmpty(options)) {\n return <NoItemMessage noItemMessage={noItemMessage} className={dropdownMenuClasses} />;\n }\n\n return (\n <ul className={dropdownMenuClasses} ref={dropdownMenuRef} role='menu'>\n {isLoading && (\n <div className='display-flex justify-content-center padding-10'>\n <Spinner />\n </div>\n )}\n {!isLoading &&\n options.map((option, index) => {\n if (option.header) {\n return <DropdownHeader key={option.id} icon={option.icon} label={option.label} />;\n }\n\n // Show focused style only when keyboard is in use\n const anchorClassNames = classNames(\n keyboardUsed && focusedItemIndex === index ? HIGHLIGHT_CLASS : '',\n option.disabled && 'pointer-events-none',\n 'display-flex align-items-center gap-3'\n );\n\n const wrapperClassNames = classNames(\n option.disabled && 'disabled',\n useActiveClass && option.selected && 'active'\n );\n\n return (\n <li key={option.id} className={wrapperClassNames} role='listitem'>\n <a\n role='menuitem'\n className={anchorClassNames}\n data-item-id={option.id}\n data-item-index={index}\n // Note, we need to assign the click callback only when it's not disabled\n // otherwise the functions is still triggered\n onClick={option.disabled ? undefined : handleOptionChange}\n >\n <span className='selected-option-dropdown-item'>\n {option.icon && <>{option.icon}</>}\n {option.label}\n </span>\n <input type='hidden' value={option.id} />\n </a>\n </li>\n );\n })}\n </ul>\n );\n};\n\nexport const filterOptions = <T extends SelectOption>(\n itemDOMValues: OptionDOMValue[],\n filterValue: string,\n options: T[]\n) => {\n const filteredDOMValues = itemDOMValues.filter(item => item.text.toLowerCase().includes(filterValue.toLowerCase()));\n\n // Filter the options according to the filtered DOM values and map the IDs since the filter cannot be done\n // on the options itself as they might contain arbitrary components\n return options.filter(option => filteredDOMValues.find(domValue => domValue.id === option.id));\n};\n\nexport default BaseSelectDropdown;\n"],"names":["DATA_ATTRIBUTE_ID","DEFAULT_FOCUSED_ITEM_INDEX","HIGHLIGHT_CLASS","DEFAULT_SCROLL_DIRECTION","DOWN","BaseSelectDropdown","props","isOpen","isLoading","updateDOMValues","noop","onOpen","onSelect","onClose","options","autoDropDirection","dropup","pullRight","useActiveClass","externalFocusedItemIndex","externalKeyboardUsed","noItemMessage","dropdownClassName","focusedItemIndex","setFocusedItemIndex","useState","keyboardUsed","setKeyboardUsed","lastScrollDirectionRef","useRef","dropdownMenuRef","useEffect","useEffectOnce","currentItemDOMValues","updateItemDOMValues","dropDirection","useDropDirection","useLayoutEffect","parent","scrollItemIntoView","getFocusedOptionNode","previousIsOpen","setPreviousIsOpen","useKey","event","selectOptionOnEnter","focusOption","UP","direction","nextFocusedItem","indexLimit","getOptionNodes","item","isEmpty","match","selectedItem","option","handleOptionChange","optionId","dropdownMenuClasses","classNames","jsx","NoItemMessage","Spinner","index","DropdownHeader","anchorClassNames","wrapperClassNames","jsxs","Fragment","filterOptions","itemDOMValues","filterValue","filteredDOMValues","domValue"],"mappings":";;;;;;;;;;;;AAcA,MAAMA,IAAoB,gBACpBC,KAA6B,GAC7BC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AAI;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA,EAC3C,GAfKA,EAAO,EAgBhB;AAAA,IAER,CAAC;AAAA,EAAA,GACT;AAER,GAEac,KAAgB,CACzBC,GACAC,GACA1D,MACC;AACD,QAAM2D,IAAoBF,EAAc,OAAO,CAAAnB,MAAQA,EAAK,KAAK,YAAA,EAAc,SAASoB,EAAY,YAAA,CAAa,CAAC;AAIlH,SAAO1D,EAAQ,OAAO,CAAA0C,MAAUiB,EAAkB,KAAK,OAAYC,EAAS,OAAOlB,EAAO,EAAE,CAAC;AACjG;"}
@@ -1 +1 @@
1
- {"version":3,"file":"MultiselectTogglePlaceholder.js","sources":["../../../src/components/selects/MultiselectTogglePlaceholder.tsx"],"sourcesContent":["import type React from 'react';\n\nexport type MultiselectTogglePlaceholderProps = {\n placeholder: string | React.ReactNode;\n};\n\nconst MultiselectTogglePlaceholder = ({ placeholder }: MultiselectTogglePlaceholderProps) => {\n return placeholder ? <span className='placeholder'>{placeholder}</span> : <span />;\n};\n\nexport default MultiselectTogglePlaceholder;\n"],"names":["MultiselectTogglePlaceholder","placeholder"],"mappings":";AAMA,MAAMA,IAA+B,CAAC,EAAE,aAAAC,QAC7BA,sBAAe,QAAA,EAAK,WAAU,eAAe,UAAAA,EAAA,CAAY,sBAAW,QAAA,CAAA,CAAK;"}
1
+ {"version":3,"file":"MultiselectTogglePlaceholder.js","sources":["../../../src/components/selects/MultiselectTogglePlaceholder.tsx"],"sourcesContent":["import type React from 'react';\n\nexport type MultiselectTogglePlaceholderProps = {\n placeholder: string | React.ReactNode;\n};\n\nconst MultiselectTogglePlaceholder = ({ placeholder }: MultiselectTogglePlaceholderProps) =>\n placeholder ? <span className='placeholder'>{placeholder}</span> : <span />;\n\nexport default MultiselectTogglePlaceholder;\n"],"names":["MultiselectTogglePlaceholder","placeholder","jsx"],"mappings":";AAMA,MAAMA,IAA+B,CAAC,EAAE,aAAAC,EAAA,MACpCA,IAAc,gBAAAC,EAAC,QAAA,EAAK,WAAU,eAAe,UAAAD,EAAA,CAAY,sBAAW,QAAA,CAAA,CAAK;"}
@@ -1,4 +1,4 @@
1
- import { jsxs as a, jsx as s } from "react/jsx-runtime";
1
+ import { jsxs as t, jsx as s } from "react/jsx-runtime";
2
2
  import { isEmpty as v } from "es-toolkit/compat";
3
3
  import r from "../../utils/classNames.js";
4
4
  const y = (d) => {
@@ -15,13 +15,13 @@ const y = (d) => {
15
15
  } = d;
16
16
  if (!n || v(n))
17
17
  return null;
18
- const o = (e) => m.indexOf(e.id) !== -1, u = (e, l) => {
18
+ const o = (e) => m.indexOf(e.id) !== -1, N = (e, l) => {
19
19
  if (c) {
20
- const t = r("margin-right-5", !o(e) && "inactiveIcon");
21
- return /* @__PURE__ */ s("span", { className: t, children: e.icon }, e.id);
20
+ const a = r("margin-right-5", !o(e) && "inactiveIcon");
21
+ return /* @__PURE__ */ s("span", { className: a, children: e.icon }, e.id);
22
22
  }
23
- return /* @__PURE__ */ a("span", { className: "selected-option", children: [
24
- /* @__PURE__ */ a("span", { className: "selected-label", children: [
23
+ return /* @__PURE__ */ t("span", { className: "selected-option", children: [
24
+ /* @__PURE__ */ t("span", { className: "selected-label", children: [
25
25
  e.icon && /* @__PURE__ */ s("span", { className: "margin-right-5", children: e.icon }),
26
26
  e.label
27
27
  ] }),
@@ -29,21 +29,21 @@ const y = (d) => {
29
29
  "span",
30
30
  {
31
31
  className: "removeIcon",
32
- onClick: (t) => {
33
- f(t, e.id);
32
+ onClick: (a) => {
33
+ f(a, e.id);
34
34
  },
35
35
  children: /* @__PURE__ */ s("span", { className: "rioglyph rioglyph-remove" })
36
36
  }
37
37
  )
38
38
  ] }, l);
39
- }, N = r(
39
+ }, u = r(
40
40
  !c && !i && "selected-option-list",
41
41
  p && "flex-wrap",
42
42
  h && "margin-left-0",
43
43
  I && "padding-left-1"
44
44
  );
45
- return /* @__PURE__ */ a("span", { className: N, children: [
46
- n.filter((e) => i ? !e.header : o(e)).map((e, l) => u(e, l)),
45
+ return /* @__PURE__ */ t("span", { className: u, children: [
46
+ n.filter((e) => i ? !e.header : o(e)).map((e, l) => N(e, l)),
47
47
  g
48
48
  ] });
49
49
  };
@@ -1 +1 @@
1
- {"version":3,"file":"MultiselectToggleSelection.js","sources":["../../../src/components/selects/MultiselectToggleSelection.tsx"],"sourcesContent":["import type React from 'react';\nimport type { PropsWithChildren } from 'react';\nimport { isEmpty } from 'es-toolkit/compat';\n\nimport classNames from '../../utils/classNames';\nimport type { SelectOption } from './BaseSelectDropdown';\n\nexport type MultiselectToggleSelectionProps = {\n options: SelectOption[];\n selectedItemIds: string[];\n showSelectedItemIcon: boolean;\n showUnselectedItemIcons: boolean;\n multiline: boolean;\n hasInputAddon: boolean;\n hasFilter: boolean;\n onRemoveItem: (event: React.MouseEvent<HTMLSpanElement>, itemId: string) => void;\n};\n\nconst MultiselectToggleSelection = (props: PropsWithChildren<MultiselectToggleSelectionProps>) => {\n const {\n options,\n selectedItemIds,\n showSelectedItemIcon,\n showUnselectedItemIcons,\n multiline,\n hasInputAddon,\n hasFilter,\n onRemoveItem,\n children,\n } = props;\n\n if (!options || isEmpty(options)) {\n return null;\n }\n\n const isItemSelected = (item: SelectOption) => {\n return selectedItemIds.indexOf(item.id) !== -1;\n };\n\n const renderSelectionItem = (item: SelectOption, index: number) => {\n if (showSelectedItemIcon) {\n const inactiveClassNames = classNames('margin-right-5', !isItemSelected(item) && 'inactiveIcon');\n\n return (\n <span key={item.id} className={inactiveClassNames}>\n {item.icon}\n </span>\n );\n }\n\n return (\n <span key={index} className='selected-option'>\n <span className='selected-label'>\n {item.icon && <span className='margin-right-5'>{item.icon}</span>}\n {item.label}\n </span>\n <span\n className='removeIcon'\n onClick={event => {\n onRemoveItem(event, item.id);\n }}\n >\n <span className='rioglyph rioglyph-remove' />\n </span>\n </span>\n );\n };\n\n const optionListClassNames = classNames(\n !showSelectedItemIcon && !showUnselectedItemIcons && 'selected-option-list',\n multiline && 'flex-wrap',\n hasInputAddon && 'margin-left-0',\n hasFilter && 'padding-left-1'\n );\n\n return (\n <span className={optionListClassNames}>\n {options\n .filter(option => (showUnselectedItemIcons ? !option.header : isItemSelected(option)))\n .map((option, index) => renderSelectionItem(option, index))}\n {children}\n </span>\n );\n};\n\nexport default MultiselectToggleSelection;\n"],"names":["MultiselectToggleSelection","props","options","selectedItemIds","showSelectedItemIcon","showUnselectedItemIcons","multiline","hasInputAddon","hasFilter","onRemoveItem","children","isEmpty","isItemSelected","item","renderSelectionItem","index","inactiveClassNames","classNames","jsxs","jsx","event","optionListClassNames","option"],"mappings":";;;AAkBA,MAAMA,IAA6B,CAACC,MAA8D;AAC9F,QAAM;AAAA,IACF,SAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,yBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,eAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,EAAA,IACAT;AAEJ,MAAI,CAACC,KAAWS,EAAQT,CAAO;AAC3B,WAAO;AAGX,QAAMU,IAAiB,CAACC,MACbV,EAAgB,QAAQU,EAAK,EAAE,MAAM,IAG1CC,IAAsB,CAACD,GAAoBE,MAAkB;AAC/D,QAAIX,GAAsB;AACtB,YAAMY,IAAqBC,EAAW,kBAAkB,CAACL,EAAeC,CAAI,KAAK,cAAc;AAE/F,+BACK,QAAA,EAAmB,WAAWG,GAC1B,UAAAH,EAAK,KAAA,GADCA,EAAK,EAEhB;AAAA,IAER;AAEA,WACI,gBAAAK,EAAC,QAAA,EAAiB,WAAU,mBACxB,UAAA;AAAA,MAAA,gBAAAA,EAAC,QAAA,EAAK,WAAU,kBACX,UAAA;AAAA,QAAAL,EAAK,QAAQ,gBAAAM,EAAC,QAAA,EAAK,WAAU,kBAAkB,YAAK,MAAK;AAAA,QACzDN,EAAK;AAAA,MAAA,GACV;AAAA,MACA,gBAAAM;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,WAAU;AAAA,UACV,SAAS,CAAAC,MAAS;AACd,YAAAX,EAAaW,GAAOP,EAAK,EAAE;AAAA,UAC/B;AAAA,UAEA,UAAA,gBAAAM,EAAC,QAAA,EAAK,WAAU,2BAAA,CAA2B;AAAA,QAAA;AAAA,MAAA;AAAA,IAC/C,EAAA,GAZOJ,CAaX;AAAA,EAER,GAEMM,IAAuBJ;AAAA,IACzB,CAACb,KAAwB,CAACC,KAA2B;AAAA,IACrDC,KAAa;AAAA,IACbC,KAAiB;AAAA,IACjBC,KAAa;AAAA,EAAA;AAGjB,SACI,gBAAAU,EAAC,QAAA,EAAK,WAAWG,GACZ,UAAA;AAAA,IAAAnB,EACI,OAAO,CAAAoB,MAAWjB,IAA0B,CAACiB,EAAO,SAASV,EAAeU,CAAM,CAAE,EACpF,IAAI,CAACA,GAAQP,MAAUD,EAAoBQ,GAAQP,CAAK,CAAC;AAAA,IAC7DL;AAAA,EAAA,GACL;AAER;"}
1
+ {"version":3,"file":"MultiselectToggleSelection.js","sources":["../../../src/components/selects/MultiselectToggleSelection.tsx"],"sourcesContent":["import type React from 'react';\nimport type { PropsWithChildren } from 'react';\nimport { isEmpty } from 'es-toolkit/compat';\n\nimport classNames from '../../utils/classNames';\nimport type { SelectOption } from './BaseSelectDropdown';\n\nexport type MultiselectToggleSelectionProps = {\n options: SelectOption[];\n selectedItemIds: string[];\n showSelectedItemIcon: boolean;\n showUnselectedItemIcons: boolean;\n multiline: boolean;\n hasInputAddon: boolean;\n hasFilter: boolean;\n onRemoveItem: (event: React.MouseEvent<HTMLSpanElement>, itemId: string) => void;\n};\n\nconst MultiselectToggleSelection = (props: PropsWithChildren<MultiselectToggleSelectionProps>) => {\n const {\n options,\n selectedItemIds,\n showSelectedItemIcon,\n showUnselectedItemIcons,\n multiline,\n hasInputAddon,\n hasFilter,\n onRemoveItem,\n children,\n } = props;\n\n if (!options || isEmpty(options)) {\n return null;\n }\n\n const isItemSelected = (item: SelectOption) => selectedItemIds.indexOf(item.id) !== -1;\n\n const renderSelectionItem = (item: SelectOption, index: number) => {\n if (showSelectedItemIcon) {\n const inactiveClassNames = classNames('margin-right-5', !isItemSelected(item) && 'inactiveIcon');\n\n return (\n <span key={item.id} className={inactiveClassNames}>\n {item.icon}\n </span>\n );\n }\n\n return (\n <span key={index} className='selected-option'>\n <span className='selected-label'>\n {item.icon && <span className='margin-right-5'>{item.icon}</span>}\n {item.label}\n </span>\n <span\n className='removeIcon'\n onClick={event => {\n onRemoveItem(event, item.id);\n }}\n >\n <span className='rioglyph rioglyph-remove' />\n </span>\n </span>\n );\n };\n\n const optionListClassNames = classNames(\n !showSelectedItemIcon && !showUnselectedItemIcons && 'selected-option-list',\n multiline && 'flex-wrap',\n hasInputAddon && 'margin-left-0',\n hasFilter && 'padding-left-1'\n );\n\n return (\n <span className={optionListClassNames}>\n {options\n .filter(option => (showUnselectedItemIcons ? !option.header : isItemSelected(option)))\n .map((option, index) => renderSelectionItem(option, index))}\n {children}\n </span>\n );\n};\n\nexport default MultiselectToggleSelection;\n"],"names":["MultiselectToggleSelection","props","options","selectedItemIds","showSelectedItemIcon","showUnselectedItemIcons","multiline","hasInputAddon","hasFilter","onRemoveItem","children","isEmpty","isItemSelected","item","renderSelectionItem","index","inactiveClassNames","classNames","jsxs","jsx","event","optionListClassNames","option"],"mappings":";;;AAkBA,MAAMA,IAA6B,CAACC,MAA8D;AAC9F,QAAM;AAAA,IACF,SAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,yBAAAC;AAAA,IACA,WAAAC;AAAA,IACA,eAAAC;AAAA,IACA,WAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC;AAAA,EAAA,IACAT;AAEJ,MAAI,CAACC,KAAWS,EAAQT,CAAO;AAC3B,WAAO;AAGX,QAAMU,IAAiB,CAACC,MAAuBV,EAAgB,QAAQU,EAAK,EAAE,MAAM,IAE9EC,IAAsB,CAACD,GAAoBE,MAAkB;AAC/D,QAAIX,GAAsB;AACtB,YAAMY,IAAqBC,EAAW,kBAAkB,CAACL,EAAeC,CAAI,KAAK,cAAc;AAE/F,+BACK,QAAA,EAAmB,WAAWG,GAC1B,UAAAH,EAAK,KAAA,GADCA,EAAK,EAEhB;AAAA,IAER;AAEA,WACI,gBAAAK,EAAC,QAAA,EAAiB,WAAU,mBACxB,UAAA;AAAA,MAAA,gBAAAA,EAAC,QAAA,EAAK,WAAU,kBACX,UAAA;AAAA,QAAAL,EAAK,QAAQ,gBAAAM,EAAC,QAAA,EAAK,WAAU,kBAAkB,YAAK,MAAK;AAAA,QACzDN,EAAK;AAAA,MAAA,GACV;AAAA,MACA,gBAAAM;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,WAAU;AAAA,UACV,SAAS,CAAAC,MAAS;AACd,YAAAX,EAAaW,GAAOP,EAAK,EAAE;AAAA,UAC/B;AAAA,UAEA,UAAA,gBAAAM,EAAC,QAAA,EAAK,WAAU,2BAAA,CAA2B;AAAA,QAAA;AAAA,MAAA;AAAA,IAC/C,EAAA,GAZOJ,CAaX;AAAA,EAER,GAEMM,IAAuBJ;AAAA,IACzB,CAACb,KAAwB,CAACC,KAA2B;AAAA,IACrDC,KAAa;AAAA,IACbC,KAAiB;AAAA,IACjBC,KAAa;AAAA,EAAA;AAGjB,SACI,gBAAAU,EAAC,QAAA,EAAK,WAAWG,GACZ,UAAA;AAAA,IAAAnB,EACI,OAAO,CAAAoB,MAAWjB,IAA0B,CAACiB,EAAO,SAASV,EAAeU,CAAM,CAAE,EACpF,IAAI,CAACA,GAAQP,MAAUD,EAAoBQ,GAAQP,CAAK,CAAC;AAAA,IAC7DL;AAAA,EAAA,GACL;AAER;"}
@@ -65,25 +65,25 @@ const Ue = 350, Ae = 100, Ye = 800, j = 0, Ge = 400, Pe = 800, Ve = 0.14, je = 5
65
65
  headerClassName: de = "",
66
66
  footerClassName: ce = "",
67
67
  backdropClassName: me = "",
68
- className: ue = "",
68
+ className: fe = "",
69
69
  children: O,
70
- ...fe
71
- } = n, [he, g] = i(V(l)), [S, v] = i(r ? t.MODE_FLY : t.MODE_FLUID), [a, z] = i(se), [be, H] = i(!1), [I, pe] = i(!1), [N, Ee] = i(F === C.RIGHT), u = P(null), B = P(null);
70
+ ...ue
71
+ } = n, [he, g] = i(V(l)), [S, v] = i(r ? t.MODE_FLY : t.MODE_FLUID), [a, z] = i(se), [be, H] = i(!1), [I, pe] = i(!1), [N, Ee] = i(F === C.RIGHT), f = P(null), B = P(null);
72
72
  b(() => {
73
- u.current && S === t.MODE_FLY && u.current.parentNode?.className.includes("right") && Ee(!0);
74
- }, [u.current, S]);
73
+ f.current && S === t.MODE_FLY && f.current.parentNode?.className.includes("right") && Ee(!0);
74
+ }, [f.current, S]);
75
75
  const [k, Te] = i(o);
76
76
  k !== o && Te(o);
77
77
  const [Se, Ie] = i(l);
78
- Se !== l && (console.log("update internal width"), g(V(l)), Ie(l)), He(() => f(), je), b(() => f(), []), b(() => {
79
- o || setTimeout(() => f());
78
+ Se !== l && (console.log("update internal width"), g(V(l)), Ie(l)), He(() => u(), je), b(() => u(), []), b(() => {
79
+ o || setTimeout(() => u());
80
80
  }, [o]), b(() => {
81
81
  const e = document.querySelector(".module-content");
82
82
  e && (B.current = e);
83
83
  }, []), Be(() => {
84
84
  !re && T && a && (z(!1), W(!1));
85
85
  });
86
- const f = () => {
86
+ const u = () => {
87
87
  const e = B.current?.clientWidth;
88
88
  if (r || y === j)
89
89
  return;
@@ -101,7 +101,7 @@ const Ue = 350, Ae = 100, Ye = 800, j = 0, Ge = 400, Pe = 800, Ve = 0.14, je = 5
101
101
  g((A) => {
102
102
  const ye = F === t.RIGHT ? A + e : A - e, Y = ke(K, h, ye);
103
103
  return pe(Y === d), L && !I ? d : Y;
104
- }), f();
104
+ }), u();
105
105
  }, Le = () => {
106
106
  document.body?.classList.add("pointer-events-none"), H(!0);
107
107
  }, Ce = () => {
@@ -111,7 +111,7 @@ const Ue = 350, Ae = 100, Ye = 800, j = 0, Ge = 400, Pe = 800, Ve = 0.14, je = 5
111
111
  z(e), W(e);
112
112
  }, Fe = m(
113
113
  "Sidebar",
114
- ue,
114
+ fe,
115
115
  o && "closed",
116
116
  a && "width-100vw sidebar-fullscreen",
117
117
  I && !a && "max-width-50vw width-50vw",
@@ -153,7 +153,7 @@ const Ue = 350, Ae = 100, Ye = 800, j = 0, Ge = 400, Pe = 800, Ve = 0.14, je = 5
153
153
  /* @__PURE__ */ s(
154
154
  We.div,
155
155
  {
156
- ...fe,
156
+ ...ue,
157
157
  initial: k && "sidebarEnter",
158
158
  animate: "sidebarVisible",
159
159
  exit: "sidebarExit",
@@ -162,7 +162,7 @@ const Ue = 350, Ae = 100, Ye = 800, j = 0, Ge = 400, Pe = 800, Ve = 0.14, je = 5
162
162
  transition: { duration: Ve },
163
163
  className: Fe,
164
164
  style: { width: he },
165
- ref: u,
165
+ ref: f,
166
166
  children: we
167
167
  }
168
168
  ),
@@ -1 +1 @@
1
- {"version":3,"file":"Sidebar.js","sources":["../../../src/components/sidebars/Sidebar.tsx"],"sourcesContent":["import React, { type PropsWithChildren, useEffect, useRef, useState } from 'react';\nimport { motion } from 'motion/react';\nimport { noop } from 'es-toolkit/function';\nimport { toNumber } from 'es-toolkit/compat';\n\nimport classNames from '../../utils/classNames';\nimport SidebarFooter from './SidebarFooter';\nimport SidebarBackdrop from './SidebarBackdrop';\nimport SidebarFullscreenToggle from './SidebarFullscreenToggle';\nimport SidebarCloseButton from './SidebarCloseButton';\nimport Resizer from '../resizer/Resizer';\nimport useWindowResize from '../../hooks/useWindowResize';\nimport useEsc from '../../hooks/useEsc';\nimport getWidthInBoundaries from '../../utils/getWidthInBoundaries';\nimport type { ObjectValues } from '../../utils/ObjectValues';\nimport SmoothScrollbars from '../smoothScrollbars/SmoothScrollbars';\n\nconst DEFAULT_WIDTH = 350;\nconst DEFAULT_MIN_WIDTH = 100;\nconst DEFAULT_MAX_WIDTH = 800;\nconst DEFAULT_SWITCH_MODE_BREAKPOINT = 0;\n\n// Values define the min and max width for the module-content\n// where the fluid sidebar automatically changes to \"fly\" and back.\nconst MIN_MODULE_CONTENT_WIDTH = 400;\nconst MAX_MODULE_CONTENT_WIDTH = 800;\n\nconst ANIMATION_DURATION = 0.14;\nconst RESIZE_THROTTLE = 500;\n\nconst SidebarPosition = {\n LEFT: 'left',\n RIGHT: 'right',\n} as const;\n\nconst SidebarMode = {\n MODE_FLY: 'fly',\n MODE_FLUID: 'fluid',\n};\n\ntype AnimationVariantProps = {\n fromRight: boolean;\n closed?: boolean;\n};\n\nconst animationVariants = {\n sidebarEnter: ({ fromRight }: AnimationVariantProps) => {\n return {\n x: fromRight ? '100%' : '-100%',\n opacity: 0,\n };\n },\n sidebarVisible: ({ fromRight, closed }: AnimationVariantProps) => {\n return {\n x: !closed ? 0 : fromRight ? '100%' : '-100%',\n opacity: closed ? 0 : 1,\n display: closed ? 'none' : 'block',\n };\n },\n sidebarExit: ({ fromRight }: AnimationVariantProps) => {\n return {\n x: fromRight ? '100%' : '-100%',\n opacity: 0,\n };\n },\n};\n\nexport type SidebarProps = {\n /**\n * Defines if the component will overlap the body content.\n *\n * @default false\n */\n fly?: boolean;\n\n /**\n * Defines whether the component is hidden or not.\n *\n * @default false\n */\n closed?: boolean;\n\n /**\n * Hides the close button. This may be used when the sidebar is always visible and may not be closed.\n *\n * @default false\n */\n disableClose?: boolean;\n\n /**\n * Callback function triggered when clicking the close icon.\n */\n onClose?: VoidFunction;\n\n /**\n * The Footer content. For example a save button.\n */\n footer?: string | React.ReactNode;\n\n /**\n * Additional classes added to the Sidebar footer.\n */\n footerClassName?: string;\n\n /**\n * Additional buttons to be rendered in the header.\n */\n headerButtons?: React.ReactNode;\n\n /**\n * Additional classes added to the Sidebar header.\n */\n headerClassName?: string;\n\n /**\n * Shows a sidebar header border\n */\n showHeaderBorder?: boolean;\n\n /**\n * Defines the width of the component. The value is set as pixel value as inline style.\n * Note: In the past, the type allowed to pass in a sting value like \"400px\" but that is not\n * possible anymore due to internal width calculations. To be backwards compatible for non\n * Typescript projects, the width is converted to a number.\n *\n * @default 350\n */\n width?: number;\n\n /**\n * Defines the minimum width in px of the component that will take effect when resizing.\n *\n * @default 100\n */\n minWidth?: number;\n\n /**\n * Defines the maximum width in px of the component that will take effect when resizing.\n *\n * @default 800\n */\n maxWidth?: number;\n\n /**\n * Opens Sidebar in fullscreen, means 100vw.\n *\n * @default false\n */\n openInFullscreen?: boolean;\n\n /**\n * Callback for when the fullscreen is toggled.\n */\n onFullScreenChange?: (newFullscreenState: boolean) => void;\n\n /**\n * Enables the fullscreen functionality and shows the fullscreen toggle.\n *\n * @default false\n */\n enableFullscreenToggle?: boolean;\n\n /**\n * Translated tooltip text for the fullscreen toggle button.\n */\n fullscreenToggleTooltip?: string;\n\n /**\n * Tells the sidebar where it is positioned. This will affect the resizing behavior\n * respectively. Note: the position need to be set properly whe using the resize\n * functionality to know on which side of the sidebar to attach the resizer handle.\n *\n * It is also relevant when the sidebar mode is set to `fly` to properly animate\n * the sidebar into the view.\n *\n * Possible values are:\n *\n * - `'left'`\n * - `'right'`\n * - `Sidebar.LEFT`\n * - `Sidebar.RIGHT`\n *\n * @default 'left'\n */\n position?: ObjectValues<typeof SidebarPosition>;\n\n /**\n * Defines whether or not the sidebar is resizable.\n * @default false\n */\n resizable?: boolean;\n\n /**\n * Callback for when the resize is done.\n */\n onResizeEnd?: VoidFunction;\n\n /**\n * Defines the breakpoint in pixel when the sidebar mode shall be changed. If the window width is lower\n * than the given breakpoint the mode is set to `fly`. If the window width is higher the mode is set\n * to `fluid`. This functionality is disabled by default and will be enabled when defining a breakpoint\n * higher than 0.\n */\n switchModeBreakpoint?: number;\n\n /**\n * By default the fullscreen mode can be left with \"esc\". If this is unwanted it can be disabled.\n *\n * @default false\n */\n disableEsc?: boolean;\n\n /**\n * Defined whether or not a backdrop will be rendered behind the Sidebar to avoid clicks outside.\n *\n * @default false\n */\n hasBackdrop?: boolean;\n\n /**\n * Defined whether or not the UIKIT SmoothScrollbar is active.\n *\n * @default false\n */\n hasSmoothScrollbar?: boolean;\n\n /**\n * Defined whether or not the backdrop is visible similar to the backdrop for modal dialogs.\n *\n * @default false\n */\n makeBackdropVisible?: boolean;\n\n /**\n * Callback for when the backdrop is clicked. This comes in handy when handling transient data from\n * the sidebar which need to be saved first and handle clicks outside.\n */\n onBackdropClick?: VoidFunction;\n\n /**\n * Additional ref added to the Sidebar body.\n */\n bodyRef?: React.MutableRefObject<HTMLDivElement | null>;\n\n /**\n * Content that will be displayed in the components header.\n */\n title?: string | React.ReactNode;\n\n /**\n * Additional classes added to the Sidebar title.\n */\n titleClassName?: string;\n\n /**\n * Additional classes added to the Sidebar backdrop.\n */\n backdropClassName?: string;\n\n /**\n * Additional classes added to the Sidebar body.\n */\n bodyClassName?: string;\n\n /**\n * Additional classes added on the wrapper element.\n */\n className?: string;\n};\n\nconst Sidebar = (props: PropsWithChildren<SidebarProps>) => {\n const {\n fly = false,\n closed = false,\n title = '',\n footer,\n resizable = false,\n position,\n width = DEFAULT_WIDTH,\n minWidth = DEFAULT_MIN_WIDTH,\n maxWidth = DEFAULT_MAX_WIDTH,\n hasBackdrop = false,\n hasSmoothScrollbar = false,\n makeBackdropVisible = false,\n enableFullscreenToggle = false,\n fullscreenToggleTooltip,\n openInFullscreen = false,\n showHeaderBorder = false,\n disableClose = false,\n bodyRef,\n headerButtons,\n switchModeBreakpoint = DEFAULT_SWITCH_MODE_BREAKPOINT,\n onClose = noop,\n onResizeEnd = noop,\n onFullScreenChange = noop,\n onBackdropClick = noop,\n disableEsc = false,\n titleClassName = '',\n bodyClassName = '',\n headerClassName = '',\n footerClassName = '',\n backdropClassName = '',\n className = '',\n children,\n ...remainingProps\n } = props;\n\n const [internalWidth, setInternalWidth] = useState(toNumber(width));\n const [sidebarMode, setSidebarMode] = useState(fly ? Sidebar.MODE_FLY : Sidebar.MODE_FLUID);\n const [isFullscreen, setIsFullscreen] = useState(openInFullscreen);\n const [isResize, setIsResize] = useState(false);\n const [isSplit, setIsSplit] = useState(false);\n const [isRight, setIsRight] = useState(position === SidebarPosition.RIGHT);\n\n const sidebarRef = useRef<HTMLDivElement>(null);\n\n // Used to keep the external reference to the module-content to avoid querying the DOM\n // periodically on window resize\n const moduleContentRef: React.MutableRefObject<HTMLDivElement | null> = useRef(null);\n\n // Position fallback in case the position property is not defined but the sidebar mode is fly\n // and we want to animate it, we nee to know the direction from where th sidebar is coming from.\n // That's why we check the ApplicationLayoutSidebar class if the sidebar inside is right aligned\n // or not and us this value instead.\n // Note: the position need to be set properly whe using the resize functionality to know on which\n // side of the sidebar to attach the resizer handle.\n useEffect(() => {\n if (sidebarRef.current && sidebarMode === Sidebar.MODE_FLY) {\n const sidebarLayout = sidebarRef.current.parentNode as HTMLDivElement;\n if (sidebarLayout?.className.includes('right')) {\n setIsRight(true);\n }\n }\n }, [sidebarRef.current, sidebarMode]);\n\n // Keep the previous closed state in order to prevent animation when switching sidebar mode\n const [previousClosed, setPreviousClosed] = useState(closed);\n if (previousClosed !== closed) {\n setPreviousClosed(closed);\n }\n\n // Update internal width from outside\n const [previousWidth, setPreviousWidth] = useState(width);\n if (previousWidth !== width) {\n console.log('update internal width');\n setInternalWidth(toNumber(width));\n setPreviousWidth(width);\n }\n\n // Switch between mode \"fly\" and \"fluid\"\n useWindowResize(() => adaptSidebarMode(), RESIZE_THROTTLE);\n\n // Initially check breakpoint after mounting the component\n useEffect(() => adaptSidebarMode(), []);\n\n // When Sidebar opens, check for available module-content width and\n // switch sidebar mode to fly in case\n useEffect(() => {\n if (!closed) {\n setTimeout(() => adaptSidebarMode());\n }\n }, [closed]);\n\n useEffect(() => {\n const moduleContent = document.querySelector('.module-content');\n if (moduleContent) {\n moduleContentRef.current = moduleContent as HTMLDivElement;\n }\n }, []);\n\n // Close the fullscreen with \"esc\"\n useEsc(() => {\n if (!disableEsc && enableFullscreenToggle && isFullscreen) {\n setIsFullscreen(false);\n onFullScreenChange(false);\n }\n });\n\n const adaptSidebarMode = () => {\n const moduleContentWidth = moduleContentRef.current?.clientWidth;\n\n if (fly || switchModeBreakpoint === DEFAULT_SWITCH_MODE_BREAKPOINT) {\n return;\n }\n\n const isModuleContentTooSmall = moduleContentWidth && moduleContentWidth <= MIN_MODULE_CONTENT_WIDTH;\n const isModuleContentBigEnough = moduleContentWidth && moduleContentWidth > MAX_MODULE_CONTENT_WIDTH;\n\n const isWindowSmallerThanBreakpoint = window.innerWidth <= switchModeBreakpoint;\n\n // switch to fly when module-content is less than x pixel and back if it is bigger\n if (isModuleContentTooSmall || isWindowSmallerThanBreakpoint) {\n setSidebarMode(Sidebar.MODE_FLY);\n return;\n }\n\n // if module-content is bigger and is initially fluid set back to initial fluid state\n if (isModuleContentBigEnough && !isWindowSmallerThanBreakpoint) {\n setSidebarMode(Sidebar.MODE_FLUID);\n return;\n }\n };\n\n const handleResize = (diff: number) => {\n const wasSplit = isSplit;\n const halfWindowWidth = window.innerWidth * 0.5;\n const usedMaxWidth = maxWidth || halfWindowWidth;\n\n // Check for sidebar width if it is half the window size. If it was before but the sidebar was resized so it is\n // no longer half window size, set the sidebar with to half window size to avoid jumping sidebar to old width\n setInternalWidth(oldWidth => {\n const updatedWidth = position === Sidebar.RIGHT ? oldWidth + diff : oldWidth - diff;\n const newWidth = getWidthInBoundaries(minWidth, usedMaxWidth, updatedWidth);\n\n const newIsSplit = newWidth === halfWindowWidth;\n setIsSplit(newIsSplit);\n\n return wasSplit && !isSplit ? halfWindowWidth : newWidth;\n });\n\n adaptSidebarMode();\n };\n\n const handleResizeStart = () => {\n const body = document.body;\n body?.classList.add('pointer-events-none');\n setIsResize(true);\n };\n\n const handleResizeEnd = () => {\n const body = document.body;\n body?.classList.remove('pointer-events-none');\n setIsResize(false);\n onResizeEnd();\n };\n\n const handleFullscreenChange = () => {\n const newFullscreenState = !isFullscreen;\n setIsFullscreen(newFullscreenState);\n onFullScreenChange(newFullscreenState);\n };\n\n const wrapperClasses = classNames(\n 'Sidebar',\n className,\n closed && 'closed',\n isFullscreen && 'width-100vw sidebar-fullscreen',\n isSplit && !isFullscreen && 'max-width-50vw width-50vw',\n sidebarMode === SidebarMode.MODE_FLY ? 'fly' : isFullscreen ? 'fly' : 'fluid'\n );\n\n const headerClassNames = classNames('SidebarHeader', headerClassName, showHeaderBorder && 'show-border');\n const titleClassNames = classNames('SidebarTitle', titleClassName);\n const bodyClassNames = classNames('SidebarBody', bodyClassName);\n\n const resizeLimitClasses = classNames('SidebarResizeLimit', isResize && 'display-block');\n\n const resizeIndicatorPosition = maxWidth || window.innerWidth * 0.5;\n const resizeLimitStyle = isRight ? { right: resizeIndicatorPosition } : { left: resizeIndicatorPosition };\n\n const sidebarContent = (\n <>\n <div className={resizeLimitClasses} style={resizeLimitStyle} />\n <div className='SidebarContent'>\n <div className={headerClassNames}>\n <div className={titleClassNames}>{title}</div>\n <div className='SidebarButtons non-printable close'>\n {headerButtons}\n {enableFullscreenToggle && (\n <SidebarFullscreenToggle\n isFullscreen={isFullscreen}\n onClick={handleFullscreenChange}\n tooltip={fullscreenToggleTooltip}\n />\n )}\n {!disableClose && (headerButtons || enableFullscreenToggle) && (\n <div className='SidebarButtons-spacer' />\n )}\n {!disableClose && <SidebarCloseButton onClick={onClose} />}\n </div>\n </div>\n {hasSmoothScrollbar ? (\n <SmoothScrollbars slideIn className={bodyClassNames} ref={bodyRef}>\n {children}\n </SmoothScrollbars>\n ) : (\n <div className={bodyClassNames} ref={bodyRef}>\n {children}\n </div>\n )}\n\n <SidebarFooter footer={footer} className={footerClassName} />\n </div>\n {resizable && (\n <Resizer\n onResizeStart={handleResizeStart}\n onResize={handleResize}\n onResizeEnd={handleResizeEnd}\n direction={Resizer.HORIZONTAL}\n position={isRight ? Resizer.LEFT : Resizer.RIGHT}\n />\n )}\n </>\n );\n\n return (\n <>\n <motion.div\n {...remainingProps}\n initial={previousClosed && 'sidebarEnter'}\n animate='sidebarVisible'\n // Cannot exit animation as sidebar is moved to offscreen by CSS class, means is still mounted\n exit='sidebarExit'\n variants={animationVariants}\n custom={{ fromRight: isRight, closed }}\n transition={{ duration: ANIMATION_DURATION }}\n className={wrapperClasses}\n style={{ width: internalWidth }}\n ref={sidebarRef}\n >\n {sidebarContent}\n </motion.div>\n {hasBackdrop && !closed && (\n <SidebarBackdrop\n className={backdropClassName}\n makeBackdropVisible={makeBackdropVisible}\n onClick={onBackdropClick}\n />\n )}\n </>\n );\n};\n\nSidebar.LEFT = SidebarPosition.LEFT;\nSidebar.RIGHT = SidebarPosition.RIGHT;\n\nSidebar.MODE_FLY = SidebarMode.MODE_FLY;\nSidebar.MODE_FLUID = SidebarMode.MODE_FLUID;\n\nexport default Sidebar;\n"],"names":["DEFAULT_WIDTH","DEFAULT_MIN_WIDTH","DEFAULT_MAX_WIDTH","DEFAULT_SWITCH_MODE_BREAKPOINT","MIN_MODULE_CONTENT_WIDTH","MAX_MODULE_CONTENT_WIDTH","ANIMATION_DURATION","RESIZE_THROTTLE","SidebarPosition","SidebarMode","animationVariants","fromRight","closed","Sidebar","props","fly","title","footer","resizable","position","width","minWidth","maxWidth","hasBackdrop","hasSmoothScrollbar","makeBackdropVisible","enableFullscreenToggle","fullscreenToggleTooltip","openInFullscreen","showHeaderBorder","disableClose","bodyRef","headerButtons","switchModeBreakpoint","onClose","noop","onResizeEnd","onFullScreenChange","onBackdropClick","disableEsc","titleClassName","bodyClassName","headerClassName","footerClassName","backdropClassName","className","children","remainingProps","internalWidth","setInternalWidth","useState","toNumber","sidebarMode","setSidebarMode","isFullscreen","setIsFullscreen","isResize","setIsResize","isSplit","setIsSplit","isRight","setIsRight","sidebarRef","useRef","moduleContentRef","useEffect","previousClosed","setPreviousClosed","previousWidth","setPreviousWidth","useWindowResize","adaptSidebarMode","moduleContent","useEsc","moduleContentWidth","isModuleContentTooSmall","isModuleContentBigEnough","isWindowSmallerThanBreakpoint","handleResize","diff","wasSplit","halfWindowWidth","usedMaxWidth","oldWidth","updatedWidth","newWidth","getWidthInBoundaries","handleResizeStart","handleResizeEnd","handleFullscreenChange","newFullscreenState","wrapperClasses","classNames","headerClassNames","titleClassNames","bodyClassNames","resizeLimitClasses","resizeIndicatorPosition","sidebarContent","jsxs","Fragment","jsx","SidebarFullscreenToggle","SidebarCloseButton","SmoothScrollbars","SidebarFooter","Resizer","motion","SidebarBackdrop"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAMA,KAAgB,KAChBC,KAAoB,KACpBC,KAAoB,KACpBC,IAAiC,GAIjCC,KAA2B,KAC3BC,KAA2B,KAE3BC,KAAqB,MACrBC,KAAkB,KAElBC,IAAkB;AAAA,EACpB,MAAM;AAAA,EACN,OAAO;AACX,GAEMC,IAAc;AAAA,EAChB,UAAU;AAAA,EACV,YAAY;AAChB,GAOMC,KAAoB;AAAA,EACtB,cAAc,CAAC,EAAE,WAAAC,SACN;AAAA,IACH,GAAGA,IAAY,SAAS;AAAA,IACxB,SAAS;AAAA,EAAA;AAAA,EAGjB,gBAAgB,CAAC,EAAE,WAAAA,GAAW,QAAAC,SACnB;AAAA,IACH,GAAIA,IAAaD,IAAY,SAAS,UAAzB;AAAA,IACb,SAASC,IAAS,IAAI;AAAA,IACtB,SAASA,IAAS,SAAS;AAAA,EAAA;AAAA,EAGnC,aAAa,CAAC,EAAE,WAAAD,SACL;AAAA,IACH,GAAGA,IAAY,SAAS;AAAA,IACxB,SAAS;AAAA,EAAA;AAGrB,GA6MME,IAAU,CAACC,MAA2C;AACxD,QAAM;AAAA,IACF,KAAAC,IAAM;AAAA,IACN,QAAAH,IAAS;AAAA,IACT,OAAAI,IAAQ;AAAA,IACR,QAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,UAAAC;AAAA,IACA,OAAAC,IAAQpB;AAAA,IACR,UAAAqB,IAAWpB;AAAA,IACX,UAAAqB,IAAWpB;AAAA,IACX,aAAAqB,IAAc;AAAA,IACd,oBAAAC,IAAqB;AAAA,IACrB,qBAAAC,IAAsB;AAAA,IACtB,wBAAAC,IAAyB;AAAA,IACzB,yBAAAC;AAAA,IACA,kBAAAC,KAAmB;AAAA,IACnB,kBAAAC,KAAmB;AAAA,IAC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AA,MAACO;AAAA,MAAA;AAAA,QACG,WAAWhE;AAAA,QACX,qBAAAnB;AAAA,QACA,SAASa;AAAA,MAAA;AAAA,IAAA;AAAA,EACb,GAER;AAER;AAEAzB,EAAQ,OAAOL,EAAgB;AAC/BK,EAAQ,QAAQL,EAAgB;AAEhCK,EAAQ,WAAWJ,EAAY;AAC/BI,EAAQ,aAAaJ,EAAY;"}
1
+ {"version":3,"file":"Sidebar.js","sources":["../../../src/components/sidebars/Sidebar.tsx"],"sourcesContent":["import React, { type PropsWithChildren, useEffect, useRef, useState } from 'react';\nimport { motion } from 'motion/react';\nimport { noop } from 'es-toolkit/function';\nimport { toNumber } from 'es-toolkit/compat';\n\nimport classNames from '../../utils/classNames';\nimport SidebarFooter from './SidebarFooter';\nimport SidebarBackdrop from './SidebarBackdrop';\nimport SidebarFullscreenToggle from './SidebarFullscreenToggle';\nimport SidebarCloseButton from './SidebarCloseButton';\nimport Resizer from '../resizer/Resizer';\nimport useWindowResize from '../../hooks/useWindowResize';\nimport useEsc from '../../hooks/useEsc';\nimport getWidthInBoundaries from '../../utils/getWidthInBoundaries';\nimport type { ObjectValues } from '../../utils/ObjectValues';\nimport SmoothScrollbars from '../smoothScrollbars/SmoothScrollbars';\n\nconst DEFAULT_WIDTH = 350;\nconst DEFAULT_MIN_WIDTH = 100;\nconst DEFAULT_MAX_WIDTH = 800;\nconst DEFAULT_SWITCH_MODE_BREAKPOINT = 0;\n\n// Values define the min and max width for the module-content\n// where the fluid sidebar automatically changes to \"fly\" and back.\nconst MIN_MODULE_CONTENT_WIDTH = 400;\nconst MAX_MODULE_CONTENT_WIDTH = 800;\n\nconst ANIMATION_DURATION = 0.14;\nconst RESIZE_THROTTLE = 500;\n\nconst SidebarPosition = {\n LEFT: 'left',\n RIGHT: 'right',\n} as const;\n\nconst SidebarMode = {\n MODE_FLY: 'fly',\n MODE_FLUID: 'fluid',\n};\n\ntype AnimationVariantProps = {\n fromRight: boolean;\n closed?: boolean;\n};\n\nconst animationVariants = {\n sidebarEnter: ({ fromRight }: AnimationVariantProps) => ({\n x: fromRight ? '100%' : '-100%',\n opacity: 0,\n }),\n sidebarVisible: ({ fromRight, closed }: AnimationVariantProps) => ({\n x: !closed ? 0 : fromRight ? '100%' : '-100%',\n opacity: closed ? 0 : 1,\n display: closed ? 'none' : 'block',\n }),\n sidebarExit: ({ fromRight }: AnimationVariantProps) => ({\n x: fromRight ? '100%' : '-100%',\n opacity: 0,\n }),\n};\n\nexport type SidebarProps = {\n /**\n * Defines if the component will overlap the body content.\n *\n * @default false\n */\n fly?: boolean;\n\n /**\n * Defines whether the component is hidden or not.\n *\n * @default false\n */\n closed?: boolean;\n\n /**\n * Hides the close button. This may be used when the sidebar is always visible and may not be closed.\n *\n * @default false\n */\n disableClose?: boolean;\n\n /**\n * Callback function triggered when clicking the close icon.\n */\n onClose?: VoidFunction;\n\n /**\n * The Footer content. For example a save button.\n */\n footer?: string | React.ReactNode;\n\n /**\n * Additional classes added to the Sidebar footer.\n */\n footerClassName?: string;\n\n /**\n * Additional buttons to be rendered in the header.\n */\n headerButtons?: React.ReactNode;\n\n /**\n * Additional classes added to the Sidebar header.\n */\n headerClassName?: string;\n\n /**\n * Shows a sidebar header border\n */\n showHeaderBorder?: boolean;\n\n /**\n * Defines the width of the component. The value is set as pixel value as inline style.\n * Note: In the past, the type allowed to pass in a sting value like \"400px\" but that is not\n * possible anymore due to internal width calculations. To be backwards compatible for non\n * Typescript projects, the width is converted to a number.\n *\n * @default 350\n */\n width?: number;\n\n /**\n * Defines the minimum width in px of the component that will take effect when resizing.\n *\n * @default 100\n */\n minWidth?: number;\n\n /**\n * Defines the maximum width in px of the component that will take effect when resizing.\n *\n * @default 800\n */\n maxWidth?: number;\n\n /**\n * Opens Sidebar in fullscreen, means 100vw.\n *\n * @default false\n */\n openInFullscreen?: boolean;\n\n /**\n * Callback for when the fullscreen is toggled.\n */\n onFullScreenChange?: (newFullscreenState: boolean) => void;\n\n /**\n * Enables the fullscreen functionality and shows the fullscreen toggle.\n *\n * @default false\n */\n enableFullscreenToggle?: boolean;\n\n /**\n * Translated tooltip text for the fullscreen toggle button.\n */\n fullscreenToggleTooltip?: string;\n\n /**\n * Tells the sidebar where it is positioned. This will affect the resizing behavior\n * respectively. Note: the position need to be set properly whe using the resize\n * functionality to know on which side of the sidebar to attach the resizer handle.\n *\n * It is also relevant when the sidebar mode is set to `fly` to properly animate\n * the sidebar into the view.\n *\n * Possible values are:\n *\n * - `'left'`\n * - `'right'`\n * - `Sidebar.LEFT`\n * - `Sidebar.RIGHT`\n *\n * @default 'left'\n */\n position?: ObjectValues<typeof SidebarPosition>;\n\n /**\n * Defines whether or not the sidebar is resizable.\n * @default false\n */\n resizable?: boolean;\n\n /**\n * Callback for when the resize is done.\n */\n onResizeEnd?: VoidFunction;\n\n /**\n * Defines the breakpoint in pixel when the sidebar mode shall be changed. If the window width is lower\n * than the given breakpoint the mode is set to `fly`. If the window width is higher the mode is set\n * to `fluid`. This functionality is disabled by default and will be enabled when defining a breakpoint\n * higher than 0.\n */\n switchModeBreakpoint?: number;\n\n /**\n * By default the fullscreen mode can be left with \"esc\". If this is unwanted it can be disabled.\n *\n * @default false\n */\n disableEsc?: boolean;\n\n /**\n * Defined whether or not a backdrop will be rendered behind the Sidebar to avoid clicks outside.\n *\n * @default false\n */\n hasBackdrop?: boolean;\n\n /**\n * Defined whether or not the UIKIT SmoothScrollbar is active.\n *\n * @default false\n */\n hasSmoothScrollbar?: boolean;\n\n /**\n * Defined whether or not the backdrop is visible similar to the backdrop for modal dialogs.\n *\n * @default false\n */\n makeBackdropVisible?: boolean;\n\n /**\n * Callback for when the backdrop is clicked. This comes in handy when handling transient data from\n * the sidebar which need to be saved first and handle clicks outside.\n */\n onBackdropClick?: VoidFunction;\n\n /**\n * Additional ref added to the Sidebar body.\n */\n bodyRef?: React.MutableRefObject<HTMLDivElement | null>;\n\n /**\n * Content that will be displayed in the components header.\n */\n title?: string | React.ReactNode;\n\n /**\n * Additional classes added to the Sidebar title.\n */\n titleClassName?: string;\n\n /**\n * Additional classes added to the Sidebar backdrop.\n */\n backdropClassName?: string;\n\n /**\n * Additional classes added to the Sidebar body.\n */\n bodyClassName?: string;\n\n /**\n * Additional classes added on the wrapper element.\n */\n className?: string;\n};\n\nconst Sidebar = (props: PropsWithChildren<SidebarProps>) => {\n const {\n fly = false,\n closed = false,\n title = '',\n footer,\n resizable = false,\n position,\n width = DEFAULT_WIDTH,\n minWidth = DEFAULT_MIN_WIDTH,\n maxWidth = DEFAULT_MAX_WIDTH,\n hasBackdrop = false,\n hasSmoothScrollbar = false,\n makeBackdropVisible = false,\n enableFullscreenToggle = false,\n fullscreenToggleTooltip,\n openInFullscreen = false,\n showHeaderBorder = false,\n disableClose = false,\n bodyRef,\n headerButtons,\n switchModeBreakpoint = DEFAULT_SWITCH_MODE_BREAKPOINT,\n onClose = noop,\n onResizeEnd = noop,\n onFullScreenChange = noop,\n onBackdropClick = noop,\n disableEsc = false,\n titleClassName = '',\n bodyClassName = '',\n headerClassName = '',\n footerClassName = '',\n backdropClassName = '',\n className = '',\n children,\n ...remainingProps\n } = props;\n\n const [internalWidth, setInternalWidth] = useState(toNumber(width));\n const [sidebarMode, setSidebarMode] = useState(fly ? Sidebar.MODE_FLY : Sidebar.MODE_FLUID);\n const [isFullscreen, setIsFullscreen] = useState(openInFullscreen);\n const [isResize, setIsResize] = useState(false);\n const [isSplit, setIsSplit] = useState(false);\n const [isRight, setIsRight] = useState(position === SidebarPosition.RIGHT);\n\n const sidebarRef = useRef<HTMLDivElement>(null);\n\n // Used to keep the external reference to the module-content to avoid querying the DOM\n // periodically on window resize\n const moduleContentRef: React.MutableRefObject<HTMLDivElement | null> = useRef(null);\n\n // Position fallback in case the position property is not defined but the sidebar mode is fly\n // and we want to animate it, we nee to know the direction from where th sidebar is coming from.\n // That's why we check the ApplicationLayoutSidebar class if the sidebar inside is right aligned\n // or not and us this value instead.\n // Note: the position need to be set properly whe using the resize functionality to know on which\n // side of the sidebar to attach the resizer handle.\n useEffect(() => {\n if (sidebarRef.current && sidebarMode === Sidebar.MODE_FLY) {\n const sidebarLayout = sidebarRef.current.parentNode as HTMLDivElement;\n if (sidebarLayout?.className.includes('right')) {\n setIsRight(true);\n }\n }\n }, [sidebarRef.current, sidebarMode]);\n\n // Keep the previous closed state in order to prevent animation when switching sidebar mode\n const [previousClosed, setPreviousClosed] = useState(closed);\n if (previousClosed !== closed) {\n setPreviousClosed(closed);\n }\n\n // Update internal width from outside\n const [previousWidth, setPreviousWidth] = useState(width);\n if (previousWidth !== width) {\n console.log('update internal width');\n setInternalWidth(toNumber(width));\n setPreviousWidth(width);\n }\n\n // Switch between mode \"fly\" and \"fluid\"\n useWindowResize(() => adaptSidebarMode(), RESIZE_THROTTLE);\n\n // Initially check breakpoint after mounting the component\n useEffect(() => adaptSidebarMode(), []);\n\n // When Sidebar opens, check for available module-content width and\n // switch sidebar mode to fly in case\n useEffect(() => {\n if (!closed) {\n setTimeout(() => adaptSidebarMode());\n }\n }, [closed]);\n\n useEffect(() => {\n const moduleContent = document.querySelector('.module-content');\n if (moduleContent) {\n moduleContentRef.current = moduleContent as HTMLDivElement;\n }\n }, []);\n\n // Close the fullscreen with \"esc\"\n useEsc(() => {\n if (!disableEsc && enableFullscreenToggle && isFullscreen) {\n setIsFullscreen(false);\n onFullScreenChange(false);\n }\n });\n\n const adaptSidebarMode = () => {\n const moduleContentWidth = moduleContentRef.current?.clientWidth;\n\n if (fly || switchModeBreakpoint === DEFAULT_SWITCH_MODE_BREAKPOINT) {\n return;\n }\n\n const isModuleContentTooSmall = moduleContentWidth && moduleContentWidth <= MIN_MODULE_CONTENT_WIDTH;\n const isModuleContentBigEnough = moduleContentWidth && moduleContentWidth > MAX_MODULE_CONTENT_WIDTH;\n\n const isWindowSmallerThanBreakpoint = window.innerWidth <= switchModeBreakpoint;\n\n // switch to fly when module-content is less than x pixel and back if it is bigger\n if (isModuleContentTooSmall || isWindowSmallerThanBreakpoint) {\n setSidebarMode(Sidebar.MODE_FLY);\n return;\n }\n\n // if module-content is bigger and is initially fluid set back to initial fluid state\n if (isModuleContentBigEnough && !isWindowSmallerThanBreakpoint) {\n setSidebarMode(Sidebar.MODE_FLUID);\n return;\n }\n };\n\n const handleResize = (diff: number) => {\n const wasSplit = isSplit;\n const halfWindowWidth = window.innerWidth * 0.5;\n const usedMaxWidth = maxWidth || halfWindowWidth;\n\n // Check for sidebar width if it is half the window size. If it was before but the sidebar was resized so it is\n // no longer half window size, set the sidebar with to half window size to avoid jumping sidebar to old width\n setInternalWidth(oldWidth => {\n const updatedWidth = position === Sidebar.RIGHT ? oldWidth + diff : oldWidth - diff;\n const newWidth = getWidthInBoundaries(minWidth, usedMaxWidth, updatedWidth);\n\n const newIsSplit = newWidth === halfWindowWidth;\n setIsSplit(newIsSplit);\n\n return wasSplit && !isSplit ? halfWindowWidth : newWidth;\n });\n\n adaptSidebarMode();\n };\n\n const handleResizeStart = () => {\n const body = document.body;\n body?.classList.add('pointer-events-none');\n setIsResize(true);\n };\n\n const handleResizeEnd = () => {\n const body = document.body;\n body?.classList.remove('pointer-events-none');\n setIsResize(false);\n onResizeEnd();\n };\n\n const handleFullscreenChange = () => {\n const newFullscreenState = !isFullscreen;\n setIsFullscreen(newFullscreenState);\n onFullScreenChange(newFullscreenState);\n };\n\n const wrapperClasses = classNames(\n 'Sidebar',\n className,\n closed && 'closed',\n isFullscreen && 'width-100vw sidebar-fullscreen',\n isSplit && !isFullscreen && 'max-width-50vw width-50vw',\n sidebarMode === SidebarMode.MODE_FLY ? 'fly' : isFullscreen ? 'fly' : 'fluid'\n );\n\n const headerClassNames = classNames('SidebarHeader', headerClassName, showHeaderBorder && 'show-border');\n const titleClassNames = classNames('SidebarTitle', titleClassName);\n const bodyClassNames = classNames('SidebarBody', bodyClassName);\n\n const resizeLimitClasses = classNames('SidebarResizeLimit', isResize && 'display-block');\n\n const resizeIndicatorPosition = maxWidth || window.innerWidth * 0.5;\n const resizeLimitStyle = isRight ? { right: resizeIndicatorPosition } : { left: resizeIndicatorPosition };\n\n const sidebarContent = (\n <>\n <div className={resizeLimitClasses} style={resizeLimitStyle} />\n <div className='SidebarContent'>\n <div className={headerClassNames}>\n <div className={titleClassNames}>{title}</div>\n <div className='SidebarButtons non-printable close'>\n {headerButtons}\n {enableFullscreenToggle && (\n <SidebarFullscreenToggle\n isFullscreen={isFullscreen}\n onClick={handleFullscreenChange}\n tooltip={fullscreenToggleTooltip}\n />\n )}\n {!disableClose && (headerButtons || enableFullscreenToggle) && (\n <div className='SidebarButtons-spacer' />\n )}\n {!disableClose && <SidebarCloseButton onClick={onClose} />}\n </div>\n </div>\n {hasSmoothScrollbar ? (\n <SmoothScrollbars slideIn className={bodyClassNames} ref={bodyRef}>\n {children}\n </SmoothScrollbars>\n ) : (\n <div className={bodyClassNames} ref={bodyRef}>\n {children}\n </div>\n )}\n\n <SidebarFooter footer={footer} className={footerClassName} />\n </div>\n {resizable && (\n <Resizer\n onResizeStart={handleResizeStart}\n onResize={handleResize}\n onResizeEnd={handleResizeEnd}\n direction={Resizer.HORIZONTAL}\n position={isRight ? Resizer.LEFT : Resizer.RIGHT}\n />\n )}\n </>\n );\n\n return (\n <>\n <motion.div\n {...remainingProps}\n initial={previousClosed && 'sidebarEnter'}\n animate='sidebarVisible'\n // Cannot exit animation as sidebar is moved to offscreen by CSS class, means is still mounted\n exit='sidebarExit'\n variants={animationVariants}\n custom={{ fromRight: isRight, closed }}\n transition={{ duration: ANIMATION_DURATION }}\n className={wrapperClasses}\n style={{ width: internalWidth }}\n ref={sidebarRef}\n >\n {sidebarContent}\n </motion.div>\n {hasBackdrop && !closed && (\n <SidebarBackdrop\n className={backdropClassName}\n makeBackdropVisible={makeBackdropVisible}\n onClick={onBackdropClick}\n />\n )}\n </>\n );\n};\n\nSidebar.LEFT = SidebarPosition.LEFT;\nSidebar.RIGHT = SidebarPosition.RIGHT;\n\nSidebar.MODE_FLY = SidebarMode.MODE_FLY;\nSidebar.MODE_FLUID = SidebarMode.MODE_FLUID;\n\nexport default Sidebar;\n"],"names":["DEFAULT_WIDTH","DEFAULT_MIN_WIDTH","DEFAULT_MAX_WIDTH","DEFAULT_SWITCH_MODE_BREAKPOINT","MIN_MODULE_CONTENT_WIDTH","MAX_MODULE_CONTENT_WIDTH","ANIMATION_DURATION","RESIZE_THROTTLE","SidebarPosition","SidebarMode","animationVariants","fromRight","closed","Sidebar","props","fly","title","footer","resizable","position","width","minWidth","maxWidth","hasBackdrop","hasSmoothScrollbar","makeBackdropVisible","enableFullscreenToggle","fullscreenToggleTooltip","openInFullscreen","showHeaderBorder","disableClose","bodyRef","headerButtons","switchModeBreakpoint","onClose","noop","onResizeEnd","onFullScreenChange","onBackdropClick","disableEsc","titleClassName","bodyClassName","headerClassName","footerClassName","backdropClassName","className","children","remainingProps","internalWidth","setInternalWidth","useState","toNumber","sidebarMode","setSidebarMode","isFullscreen","setIsFullscreen","isResize","setIsResize","isSplit","setIsSplit","isRight","setIsRight","sidebarRef","useRef","moduleContentRef","useEffect","previousClosed","setPreviousClosed","previousWidth","setPreviousWidth","useWindowResize","adaptSidebarMode","moduleContent","useEsc","moduleContentWidth","isModuleContentTooSmall","isModuleContentBigEnough","isWindowSmallerThanBreakpoint","handleResize","diff","wasSplit","halfWindowWidth","usedMaxWidth","oldWidth","updatedWidth","newWidth","getWidthInBoundaries","handleResizeStart","handleResizeEnd","handleFullscreenChange","newFullscreenState","wrapperClasses","classNames","headerClassNames","titleClassNames","bodyClassNames","resizeLimitClasses","resizeIndicatorPosition","sidebarContent","jsxs","Fragment","jsx","SidebarFullscreenToggle","SidebarCloseButton","SmoothScrollbars","SidebarFooter","Resizer","motion","SidebarBackdrop"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAMA,KAAgB,KAChBC,KAAoB,KACpBC,KAAoB,KACpBC,IAAiC,GAIjCC,KAA2B,KAC3BC,KAA2B,KAE3BC,KAAqB,MACrBC,KAAkB,KAElBC,IAAkB;AAAA,EACpB,MAAM;AAAA,EACN,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e } from "es-toolkit/function";
3
3
  import t from "../button/Button.js";
4
- const a = ({ onClick: r = e }) => /* @__PURE__ */ o(t, { bsStyle: t.MUTED, iconOnly: !0, onClick: r, "data-testid": "sidebarCloseButton", children: /* @__PURE__ */ o("span", { className: "rioglyph rioglyph-remove" }) });
4
+ const l = ({ onClick: r = e }) => /* @__PURE__ */ o(t, { bsStyle: t.MUTED, iconOnly: !0, onClick: r, "data-testid": "sidebarCloseButton", children: /* @__PURE__ */ o("span", { className: "rioglyph rioglyph-remove" }) });
5
5
  export {
6
- a as default
6
+ l as default
7
7
  };
8
8
  //# sourceMappingURL=SidebarCloseButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SidebarCloseButton.js","sources":["../../../src/components/sidebars/SidebarCloseButton.tsx"],"sourcesContent":["import { noop } from 'es-toolkit/function';\n\nimport Button from '../button/Button';\n\nexport type SidebarCloseButtonProps = {\n onClick?: VoidFunction;\n};\n\nconst SidebarCloseButton = ({ onClick = noop }: SidebarCloseButtonProps) => {\n return (\n <Button bsStyle={Button.MUTED} iconOnly onClick={onClick} data-testid='sidebarCloseButton'>\n <span className='rioglyph rioglyph-remove' />\n </Button>\n );\n};\n\nexport default SidebarCloseButton;\n"],"names":["SidebarCloseButton","onClick","noop","jsx","Button"],"mappings":";;;AAQA,MAAMA,IAAqB,CAAC,EAAE,SAAAC,IAAUC,QAEhC,gBAAAC,EAACC,GAAA,EAAO,SAASA,EAAO,OAAO,UAAQ,IAAC,SAAAH,GAAkB,eAAY,sBAClE,UAAA,gBAAAE,EAAC,QAAA,EAAK,WAAU,4BAA2B,GAC/C;"}
1
+ {"version":3,"file":"SidebarCloseButton.js","sources":["../../../src/components/sidebars/SidebarCloseButton.tsx"],"sourcesContent":["import { noop } from 'es-toolkit/function';\n\nimport Button from '../button/Button';\n\nexport type SidebarCloseButtonProps = {\n onClick?: VoidFunction;\n};\n\nconst SidebarCloseButton = ({ onClick = noop }: SidebarCloseButtonProps) => (\n <Button bsStyle={Button.MUTED} iconOnly onClick={onClick} data-testid='sidebarCloseButton'>\n <span className='rioglyph rioglyph-remove' />\n </Button>\n);\n\nexport default SidebarCloseButton;\n"],"names":["SidebarCloseButton","onClick","noop","jsx","Button"],"mappings":";;;AAQA,MAAMA,IAAqB,CAAC,EAAE,SAAAC,IAAUC,QACpC,gBAAAC,EAACC,KAAO,SAASA,EAAO,OAAO,UAAQ,IAAC,SAAAH,GAAkB,eAAY,sBAClE,4BAAC,QAAA,EAAK,WAAU,4BAA2B,EAAA,CAC/C;"}
@@ -1,5 +1,6 @@
1
- import { default as React } from 'react';
1
+ import { default as React, AriaRole } from 'react';
2
2
  export type SmoothScrollbarsProps = {
3
+ role?: AriaRole;
3
4
  /**
4
5
  * Defines whether the scrollbars should slide in on hover.
5
6
  *
@@ -39,13 +40,13 @@ export type SmoothScrollbarsProps = {
39
40
  *
40
41
  * @default 0
41
42
  */
42
- autoHeightMin?: number;
43
+ autoHeightMin?: number | string;
43
44
  /**
44
45
  * Maximum height when auto-height is enabled.
45
46
  *
46
47
  * @default 200
47
48
  */
48
- autoHeightMax?: number;
49
+ autoHeightMax?: number | string;
49
50
  /**
50
51
  * Scroll callback, forwarded to the underlying scrollbars instance.
51
52
  */
@@ -6,10 +6,10 @@ import s from "../../utils/classNames.js";
6
6
  const E = 100, P = R(
7
7
  (i, m) => {
8
8
  const {
9
- slideIn: u = !1,
9
+ slideIn: b = !1,
10
10
  largeTrack: l = !1,
11
- trackOffset: c = !1,
12
- className: b = "",
11
+ trackOffset: t = !1,
12
+ className: u = "",
13
13
  onScroll: d = O,
14
14
  tagName: f = "div",
15
15
  autoHeight: h = !1,
@@ -18,28 +18,28 @@ const E = 100, P = R(
18
18
  children: v,
19
19
  style: y,
20
20
  ...k
21
- } = i, a = n(null), t = n(null);
22
- S(m, () => a.current), V(() => {
23
- if (!t.current || !a.current)
21
+ } = i, a = n(null), c = n(null);
22
+ S(m, () => a.current, []), V(() => {
23
+ if (!c.current || !a.current)
24
24
  return;
25
25
  const r = x(() => {
26
26
  a.current && a.current.update();
27
27
  }, E), o = new ResizeObserver(r);
28
- return o.observe(t.current), () => {
28
+ return o.observe(c.current), () => {
29
29
  o.disconnect(), r.cancel();
30
30
  };
31
31
  }, []);
32
- const T = s(b, u && "scrollbar-fly-in", "smooth-scrollbar-wrapper"), z = s(
32
+ const T = s(u, b && "scrollbar-fly-in", "smooth-scrollbar-wrapper"), z = s(
33
33
  "scrollbar-track-vertical",
34
34
  l && "scrollbar-track-size-large",
35
- c && "scrollbar-track-offset"
35
+ t && "scrollbar-track-offset"
36
36
  ), g = s(
37
37
  "scrollbar-thumb-vertical",
38
38
  l && "scrollbar-thumb-size-large"
39
39
  ), H = s(
40
40
  "scrollbar-track-horizontal",
41
41
  l && "scrollbar-track-size-large",
42
- c && "scrollbar-track-offset"
42
+ t && "scrollbar-track-offset"
43
43
  ), w = s(
44
44
  "scrollbar-thumb-horizontal",
45
45
  l && "scrollbar-thumb-size-large"
@@ -61,7 +61,7 @@ const E = 100, P = R(
61
61
  renderThumbVertical: (r) => /* @__PURE__ */ e("div", { ...r, className: g }),
62
62
  renderTrackHorizontal: (r) => /* @__PURE__ */ e("div", { ...r, className: H }),
63
63
  renderThumbHorizontal: (r) => /* @__PURE__ */ e("div", { ...r, className: w }),
64
- children: /* @__PURE__ */ e("div", { className: "scrollbar-content-wrapper", ref: t, children: v })
64
+ children: /* @__PURE__ */ e("div", { className: "scrollbar-content-wrapper", ref: c, children: v })
65
65
  }
66
66
  );
67
67
  }