@rio-cloud/rio-uikit 2.0.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (567) hide show
  1. package/CircularProgress.d.ts +2 -0
  2. package/CircularProgress.js +5 -0
  3. package/CircularProgress.js.map +1 -0
  4. package/RadioCardGroup.d.ts +2 -0
  5. package/RadioCardGroup.js +7 -0
  6. package/RadioCardGroup.js.map +1 -0
  7. package/SearchHighlightText.d.ts +2 -0
  8. package/SearchHighlightText.js +5 -0
  9. package/SearchHighlightText.js.map +1 -0
  10. package/TextTruncateMiddle.d.ts +2 -0
  11. package/TextTruncateMiddle.js +5 -0
  12. package/TextTruncateMiddle.js.map +1 -0
  13. package/Tracker.d.ts +2 -0
  14. package/Tracker.js +5 -0
  15. package/Tracker.js.map +1 -0
  16. package/classNames.d.ts +2 -0
  17. package/classNames.js +5 -0
  18. package/classNames.js.map +1 -0
  19. package/components/accentBar/AccentBar.js +1 -1
  20. package/components/accentBar/AccentBar.js.map +1 -1
  21. package/components/actionBarItem/ActionBarItem.d.ts +2 -2
  22. package/components/actionBarItem/ActionBarItem.js +7 -7
  23. package/components/actionBarItem/ActionBarItem.js.map +1 -1
  24. package/components/actionBarItem/ActionBarItemIcon.js +1 -1
  25. package/components/actionBarItem/ActionBarItemIcon.js.map +1 -1
  26. package/components/actionBarItem/ActionBarItemList.js +1 -1
  27. package/components/actionBarItem/ActionBarItemList.js.map +1 -1
  28. package/components/actionBarItem/ActionBarItemListItem.js +1 -1
  29. package/components/actionBarItem/ActionBarItemListItem.js.map +1 -1
  30. package/components/actionBarItem/ActionBarItemListSeparator.js +1 -1
  31. package/components/actionBarItem/ActionBarItemListSeparator.js.map +1 -1
  32. package/components/actionBarItem/ActionBarItemPopoverContent.js +3 -3
  33. package/components/actionBarItem/ActionBarItemPopoverContent.js.map +1 -1
  34. package/components/actionBarItem/ActionBarOverlay.js +1 -1
  35. package/components/actionBarItem/ActionBarOverlay.js.map +1 -1
  36. package/components/activity/Activity.js +1 -1
  37. package/components/activity/Activity.js.map +1 -1
  38. package/components/animatedTextReveal/AnimatedTextReveal.js +1 -1
  39. package/components/animatedTextReveal/AnimatedTextReveal.js.map +1 -1
  40. package/components/applicationHeader/AppMenu.js +2 -2
  41. package/components/applicationHeader/AppMenu.js.map +1 -1
  42. package/components/applicationHeader/AppMenuDropdown.js +13 -11
  43. package/components/applicationHeader/AppMenuDropdown.js.map +1 -1
  44. package/components/applicationHeader/ApplicationHeader.d.ts +6 -7
  45. package/components/applicationHeader/ApplicationHeader.js +1 -1
  46. package/components/applicationHeader/ApplicationHeader.js.map +1 -1
  47. package/components/applicationHeader/MobileHeaderModal.js +8 -8
  48. package/components/applicationHeader/MobileHeaderModal.js.map +1 -1
  49. package/components/applicationHeader/MobileSubmoduleNavigation.js +1 -1
  50. package/components/applicationHeader/MobileSubmoduleNavigation.js.map +1 -1
  51. package/components/applicationHeader/NavItems.js +4 -4
  52. package/components/applicationHeader/NavItems.js.map +1 -1
  53. package/components/applicationLayout/ApplicationLayout.js +10 -10
  54. package/components/applicationLayout/ApplicationLayout.js.map +1 -1
  55. package/components/applicationLayout/ApplicationLayoutBody.js +2 -2
  56. package/components/applicationLayout/ApplicationLayoutBody.js.map +1 -1
  57. package/components/applicationLayout/ApplicationLayoutBodyBanner.js +1 -1
  58. package/components/applicationLayout/ApplicationLayoutBodyBanner.js.map +1 -1
  59. package/components/applicationLayout/ApplicationLayoutBodyBottomBar.js +1 -1
  60. package/components/applicationLayout/ApplicationLayoutBodyBottomBar.js.map +1 -1
  61. package/components/applicationLayout/ApplicationLayoutBodyNavigation.js +1 -1
  62. package/components/applicationLayout/ApplicationLayoutBodyNavigation.js.map +1 -1
  63. package/components/applicationLayout/ApplicationLayoutHeader.js +1 -1
  64. package/components/applicationLayout/ApplicationLayoutHeader.js.map +1 -1
  65. package/components/applicationLayout/ApplicationLayoutSidebar.js +1 -1
  66. package/components/applicationLayout/ApplicationLayoutSidebar.js.map +1 -1
  67. package/components/applicationLayout/SubNavigation.d.ts +7 -0
  68. package/components/applicationLayout/SubNavigation.js +1 -1
  69. package/components/applicationLayout/SubNavigation.js.map +1 -1
  70. package/components/assetTree/AssetTree.d.ts +7 -0
  71. package/components/assetTree/AssetTree.js +1 -1
  72. package/components/assetTree/AssetTree.js.map +1 -1
  73. package/components/assetTree/Tree.d.ts +15 -0
  74. package/components/assetTree/Tree.js +1 -1
  75. package/components/assetTree/Tree.js.map +1 -1
  76. package/components/assetTree/TreeIcon.d.ts +30 -0
  77. package/components/assetTree/TreeIcon.js +16 -0
  78. package/components/assetTree/TreeIcon.js.map +1 -0
  79. package/components/assetTree/TreeLeaf.js +23 -23
  80. package/components/assetTree/TreeLeaf.js.map +1 -1
  81. package/components/assetTree/TreeNode.js +25 -25
  82. package/components/assetTree/TreeNode.js.map +1 -1
  83. package/components/assetTree/TreeNodeContainer.js +1 -1
  84. package/components/assetTree/TreeNodeContainer.js.map +1 -1
  85. package/components/assetTree/TreeOption.js +3 -3
  86. package/components/assetTree/TreeOption.js.map +1 -1
  87. package/components/assetTree/TreeOptions.js +4 -4
  88. package/components/assetTree/TreeOptions.js.map +1 -1
  89. package/components/assetTree/TreeRoot.js +3 -3
  90. package/components/assetTree/TreeRoot.js.map +1 -1
  91. package/components/assetTree/TreeSearch.d.ts +2 -0
  92. package/components/assetTree/TreeSearch.js +3 -3
  93. package/components/assetTree/TreeSearch.js.map +1 -1
  94. package/components/assetTree/TreeSidebar.js +1 -1
  95. package/components/assetTree/TreeSidebar.js.map +1 -1
  96. package/components/assetTree/TreeSidebarCategories.js +4 -4
  97. package/components/assetTree/TreeSidebarCategories.js.map +1 -1
  98. package/components/assetTree/TreeSummary.js +1 -1
  99. package/components/assetTree/TreeSummary.js.map +1 -1
  100. package/components/assetTree/TypeCounter.js +1 -1
  101. package/components/assetTree/TypeCounter.js.map +1 -1
  102. package/components/autosuggest/AutoSuggest.js +1 -1
  103. package/components/autosuggest/AutoSuggest.js.map +1 -1
  104. package/components/avatar/Avatar.js +1 -1
  105. package/components/avatar/Avatar.js.map +1 -1
  106. package/components/banner/Banner.js +1 -1
  107. package/components/banner/Banner.js.map +1 -1
  108. package/components/banner/BannerContent.js +1 -1
  109. package/components/banner/BannerContent.js.map +1 -1
  110. package/components/barList/BarList.d.ts +26 -0
  111. package/components/barList/BarList.js +1 -1
  112. package/components/barList/BarList.js.map +1 -1
  113. package/components/bottomSheet/BottomSheet.d.ts +17 -3
  114. package/components/bottomSheet/BottomSheet.js +1 -1
  115. package/components/bottomSheet/BottomSheet.js.map +1 -1
  116. package/components/bottomSheet/TimedBottomSheet.d.ts +10 -0
  117. package/components/bottomSheet/TimedBottomSheet.js.map +1 -1
  118. package/components/button/Button.d.ts +53 -7
  119. package/components/button/Button.js +87 -64
  120. package/components/button/Button.js.map +1 -1
  121. package/components/button/ButtonToolbar.js +1 -1
  122. package/components/button/ButtonToolbar.js.map +1 -1
  123. package/components/button/ToggleButton.d.ts +4 -1
  124. package/components/button/ToggleButton.js.map +1 -1
  125. package/components/calendarStripe/CalendarStripe.d.ts +1 -1
  126. package/components/calendarStripe/CalendarStripe.js +48 -50
  127. package/components/calendarStripe/CalendarStripe.js.map +1 -1
  128. package/components/card/Card.js +1 -1
  129. package/components/card/Card.js.map +1 -1
  130. package/components/charts/Area.d.ts +2 -2
  131. package/components/charts/Area.js.map +1 -1
  132. package/components/charts/Line.d.ts +2 -2
  133. package/components/charts/Line.js.map +1 -1
  134. package/components/charts/RadialBarChart.js +106 -103
  135. package/components/charts/RadialBarChart.js.map +1 -1
  136. package/components/checkbox/Checkbox.d.ts +0 -3
  137. package/components/checkbox/Checkbox.js +6 -6
  138. package/components/checkbox/Checkbox.js.map +1 -1
  139. package/components/circularProgress/CircularProgress.d.ts +139 -0
  140. package/components/circularProgress/CircularProgress.js +197 -0
  141. package/components/circularProgress/CircularProgress.js.map +1 -0
  142. package/components/clearableInput/ClearableInput.d.ts +21 -20
  143. package/components/clearableInput/ClearableInput.js +9 -9
  144. package/components/clearableInput/ClearableInput.js.map +1 -1
  145. package/components/collapse/Collapse.d.ts +3 -0
  146. package/components/collapse/Collapse.js +12 -12
  147. package/components/collapse/Collapse.js.map +1 -1
  148. package/components/contentLoader/ContentLoader.d.ts +10 -2
  149. package/components/contentLoader/ContentLoader.js.map +1 -1
  150. package/components/dataTabs/DataTabHeader.js +1 -1
  151. package/components/dataTabs/DataTabHeader.js.map +1 -1
  152. package/components/dataTabs/DataTabs.d.ts +6 -0
  153. package/components/dataTabs/DataTabs.js +4 -4
  154. package/components/dataTabs/DataTabs.js.map +1 -1
  155. package/components/datepicker/DatePicker.js +6 -6
  156. package/components/datepicker/DatePicker.js.map +1 -1
  157. package/components/datepicker/DateRangePicker.js +1 -1
  158. package/components/datepicker/DateRangePicker.js.map +1 -1
  159. package/components/datepicker/DayPicker.js +1 -1
  160. package/components/datepicker/DayPicker.js.map +1 -1
  161. package/components/dialog/ConfirmationDialog.d.ts +22 -0
  162. package/components/dialog/ConfirmationDialog.js.map +1 -1
  163. package/components/dialog/Dialog.d.ts +13 -1
  164. package/components/dialog/Dialog.js +55 -55
  165. package/components/dialog/Dialog.js.map +1 -1
  166. package/components/dialog/DialogBody.js +1 -1
  167. package/components/dialog/DialogBody.js.map +1 -1
  168. package/components/dialog/DialogFooter.js +1 -1
  169. package/components/dialog/DialogFooter.js.map +1 -1
  170. package/components/dialog/DialogHeader.js +1 -1
  171. package/components/dialog/DialogHeader.js.map +1 -1
  172. package/components/dialog/MediaDialog.js +1 -1
  173. package/components/dialog/MediaDialog.js.map +1 -1
  174. package/components/dialog/ReleaseNotesDialog.d.ts +3 -3
  175. package/components/dialog/ReleaseNotesDialog.js.map +1 -1
  176. package/components/dialog/SplitDialog.js +1 -1
  177. package/components/dialog/SplitDialog.js.map +1 -1
  178. package/components/divider/Divider.js +1 -1
  179. package/components/divider/Divider.js.map +1 -1
  180. package/components/dropdown/ButtonDropdown.d.ts +4 -0
  181. package/components/dropdown/ButtonDropdown.js +52 -52
  182. package/components/dropdown/ButtonDropdown.js.map +1 -1
  183. package/components/dropdown/DropdownSubmenu.d.ts +4 -0
  184. package/components/dropdown/DropdownSubmenu.js +3 -3
  185. package/components/dropdown/DropdownSubmenu.js.map +1 -1
  186. package/components/dropdown/DropdownToggleButton.d.ts +1 -1
  187. package/components/dropdown/DropdownToggleButton.js +4 -3
  188. package/components/dropdown/DropdownToggleButton.js.map +1 -1
  189. package/components/dropdown/SplitCaretButton.js +6 -6
  190. package/components/dropdown/SplitCaretButton.js.map +1 -1
  191. package/components/editableContent/EditableContent.d.ts +6 -0
  192. package/components/editableContent/EditableContent.js +1 -1
  193. package/components/editableContent/EditableContent.js.map +1 -1
  194. package/components/ellipsis/TextTruncateMiddle.d.ts +23 -0
  195. package/components/ellipsis/TextTruncateMiddle.js +21 -0
  196. package/components/ellipsis/TextTruncateMiddle.js.map +1 -0
  197. package/components/expander/ExpanderList.d.ts +3 -0
  198. package/components/expander/ExpanderList.js +5 -5
  199. package/components/expander/ExpanderList.js.map +1 -1
  200. package/components/expander/ExpanderPanel.d.ts +14 -4
  201. package/components/expander/ExpanderPanel.js +1 -1
  202. package/components/expander/ExpanderPanel.js.map +1 -1
  203. package/components/fade/Fade.d.ts +1 -1
  204. package/components/fade/Fade.js.map +1 -1
  205. package/components/feedback/FeedbackRating.js +1 -1
  206. package/components/feedback/FeedbackRating.js.map +1 -1
  207. package/components/feedback/FeedbackReactions.js +1 -1
  208. package/components/feedback/FeedbackReactions.js.map +1 -1
  209. package/components/filepicker/FilePicker.d.ts +0 -2
  210. package/components/filepicker/FilePicker.js.map +1 -1
  211. package/components/formLabel/FormLabel.js +6 -9
  212. package/components/formLabel/FormLabel.js.map +1 -1
  213. package/components/formLabel/LabeledElement.js +1 -1
  214. package/components/formLabel/LabeledElement.js.map +1 -1
  215. package/components/groupedItemList/GroupedItemList.d.ts +10 -7
  216. package/components/groupedItemList/GroupedItemList.js.map +1 -1
  217. package/components/listMenu/ListMenu.js +2 -5
  218. package/components/listMenu/ListMenu.js.map +1 -1
  219. package/components/listMenu/ListMenuGroup.d.ts +2 -1
  220. package/components/listMenu/ListMenuGroup.js +2 -2
  221. package/components/listMenu/ListMenuGroup.js.map +1 -1
  222. package/components/loadMore/LoadMoreButton.js +1 -1
  223. package/components/loadMore/LoadMoreButton.js.map +1 -1
  224. package/components/loadMore/LoadMoreProgress.js +1 -1
  225. package/components/loadMore/LoadMoreProgress.js.map +1 -1
  226. package/components/map/components/Map.js.map +1 -1
  227. package/components/map/components/constants.js.map +1 -1
  228. package/components/map/components/features/ContextMenuItem.d.ts +1 -1
  229. package/components/map/components/features/ContextMenuItem.js +2 -17
  230. package/components/map/components/features/ContextMenuItem.js.map +1 -1
  231. package/components/map/components/features/MapSettings.js +4 -4
  232. package/components/map/components/features/MapSettings.js.map +1 -1
  233. package/components/map/components/features/basics/Polyline.d.ts +4 -1
  234. package/components/map/components/features/basics/Polyline.js +1 -1
  235. package/components/map/components/features/basics/Polyline.js.map +1 -1
  236. package/components/map/components/features/layers/MarkerLayer.d.ts +3 -1
  237. package/components/map/components/features/layers/MarkerLayer.js.map +1 -1
  238. package/components/map/components/features/layers/clustering/ClusterLayer.js +1 -1
  239. package/components/map/components/features/layers/clustering/ClusterLayer.js.map +1 -1
  240. package/components/map/components/features/layers/clustering/SimpleClusterLayer.d.ts +3 -2
  241. package/components/map/components/features/layers/clustering/SimpleClusterLayer.js.map +1 -1
  242. package/components/map/components/features/layers/overlayLayers/RoadRestrictionLayer.js +7 -7
  243. package/components/map/components/features/layers/overlayLayers/RoadRestrictionLayer.js.map +1 -1
  244. package/components/map/components/features/layers/overlayLayers/TrafficLayer.js +4 -4
  245. package/components/map/components/features/layers/overlayLayers/TrafficLayer.js.map +1 -1
  246. package/components/map/components/features/settings/MapSettingsItem.js +1 -1
  247. package/components/map/components/features/settings/MapSettingsItem.js.map +1 -1
  248. package/components/map/components/features/settings/MapSettingsPanel.js +6 -20
  249. package/components/map/components/features/settings/MapSettingsPanel.js.map +1 -1
  250. package/components/map/components/features/settings/MapSettingsTile.js +87 -61
  251. package/components/map/components/features/settings/MapSettingsTile.js.map +1 -1
  252. package/components/map/components/features/settings/ZoomButtons.js +1 -1
  253. package/components/map/components/features/settings/ZoomButtons.js.map +1 -1
  254. package/components/map/components/features/settings/builtinSettings/MapTypeSettings.d.ts +38 -1
  255. package/components/map/components/features/settings/builtinSettings/MapTypeSettings.js +128 -92
  256. package/components/map/components/features/settings/builtinSettings/MapTypeSettings.js.map +1 -1
  257. package/components/map/utils/clustering.d.ts +6 -1
  258. package/components/map/utils/clustering.js +25 -19
  259. package/components/map/utils/clustering.js.map +1 -1
  260. package/components/map/utils/eventHandling.js +9 -9
  261. package/components/map/utils/eventHandling.js.map +1 -1
  262. package/components/map/utils/mapUtils.d.ts +6 -6
  263. package/components/map/utils/mapUtils.js +14 -19
  264. package/components/map/utils/mapUtils.js.map +1 -1
  265. package/components/map/utils/rendering.d.ts +1 -1
  266. package/components/map/utils/rendering.js +23 -23
  267. package/components/map/utils/rendering.js.map +1 -1
  268. package/components/mapMarker/ClusterMapMarker.js +1 -1
  269. package/components/mapMarker/ClusterMapMarker.js.map +1 -1
  270. package/components/mapMarker/SingleMapMarker.js +1 -1
  271. package/components/mapMarker/SingleMapMarker.js.map +1 -1
  272. package/components/menuItems/MenuItem.d.ts +23 -0
  273. package/components/menuItems/MenuItem.js +1 -1
  274. package/components/menuItems/MenuItem.js.map +1 -1
  275. package/components/menuItems/MenuItemList.js +1 -1
  276. package/components/menuItems/MenuItemList.js.map +1 -1
  277. package/components/navigation/AppNavigationBar.js +4 -4
  278. package/components/navigation/AppNavigationBar.js.map +1 -1
  279. package/components/noData/NoData.js +1 -1
  280. package/components/noData/NoData.js.map +1 -1
  281. package/components/notification/Notification.js +4 -4
  282. package/components/notification/Notification.js.map +1 -1
  283. package/components/numberControl/NumberControl.js +4 -4
  284. package/components/numberControl/NumberControl.js.map +1 -1
  285. package/components/numberInput/NumberInput.js +1 -1
  286. package/components/numberInput/NumberInput.js.map +1 -1
  287. package/components/onboarding/OnboardingTip.d.ts +18 -12
  288. package/components/onboarding/OnboardingTip.js +4 -4
  289. package/components/onboarding/OnboardingTip.js.map +1 -1
  290. package/components/overlay/OverlayTrigger.d.ts +43 -1
  291. package/components/overlay/OverlayTrigger.js.map +1 -1
  292. package/components/page/Page.js +1 -1
  293. package/components/page/Page.js.map +1 -1
  294. package/components/pager/Pager.d.ts +3 -0
  295. package/components/pager/Pager.js +1 -1
  296. package/components/pager/Pager.js.map +1 -1
  297. package/components/popover/Popover.d.ts +1 -0
  298. package/components/popover/Popover.js.map +1 -1
  299. package/components/preloader/ImagePreloader.d.ts +1 -1
  300. package/components/preloader/ImagePreloader.js.map +1 -1
  301. package/components/radiobutton/RadioButton.d.ts +10 -6
  302. package/components/radiobutton/RadioButton.js +5 -5
  303. package/components/radiobutton/RadioButton.js.map +1 -1
  304. package/components/radiobutton/RadioCardGroup.d.ts +86 -0
  305. package/components/radiobutton/RadioCardGroup.js +110 -0
  306. package/components/radiobutton/RadioCardGroup.js.map +1 -0
  307. package/components/releaseNotes/ReleaseNotes.d.ts +0 -3
  308. package/components/releaseNotes/ReleaseNotes.js.map +1 -1
  309. package/components/resizer/Resizer.d.ts +17 -3
  310. package/components/resizer/Resizer.js +1 -1
  311. package/components/resizer/Resizer.js.map +1 -1
  312. package/components/responsiveColumnStripe/ResponsiveColumnStripe.js +1 -1
  313. package/components/responsiveColumnStripe/ResponsiveColumnStripe.js.map +1 -1
  314. package/components/rioglyph/Rioglyph.d.ts +20 -8
  315. package/components/rioglyph/Rioglyph.js +1 -1
  316. package/components/rioglyph/Rioglyph.js.map +1 -1
  317. package/components/rioglyph/RioglyphIconType.d.ts +1 -1
  318. package/components/rules/RuleConnector.js +1 -1
  319. package/components/rules/RuleConnector.js.map +1 -1
  320. package/components/rules/RuleContainer.js +27 -27
  321. package/components/rules/RuleContainer.js.map +1 -1
  322. package/components/rules/RulesWrapper.js +1 -1
  323. package/components/rules/RulesWrapper.js.map +1 -1
  324. package/components/saveableInput/SaveableDateInput.d.ts +20 -2
  325. package/components/saveableInput/SaveableDateInput.js +1 -1
  326. package/components/saveableInput/SaveableDateInput.js.map +1 -1
  327. package/components/saveableInput/SaveableInput.d.ts +10 -2
  328. package/components/saveableInput/SaveableInput.js +49 -49
  329. package/components/saveableInput/SaveableInput.js.map +1 -1
  330. package/components/searchHighlight/SearchHighlightText.d.ts +28 -0
  331. package/components/searchHighlight/SearchHighlightText.js +15 -0
  332. package/components/searchHighlight/SearchHighlightText.js.map +1 -0
  333. package/components/selects/BaseSelectDropdown.js +90 -79
  334. package/components/selects/BaseSelectDropdown.js.map +1 -1
  335. package/components/selects/ClearButton.js +4 -4
  336. package/components/selects/ClearButton.js.map +1 -1
  337. package/components/selects/Multiselect.js +6 -6
  338. package/components/selects/Multiselect.js.map +1 -1
  339. package/components/selects/MultiselectToggleFilter.js +4 -4
  340. package/components/selects/MultiselectToggleFilter.js.map +1 -1
  341. package/components/selects/MultiselectToggleSelection.js +1 -1
  342. package/components/selects/MultiselectToggleSelection.js.map +1 -1
  343. package/components/selects/Select.d.ts +5 -0
  344. package/components/selects/Select.js +93 -93
  345. package/components/selects/Select.js.map +1 -1
  346. package/components/selects/SelectFilter.js +1 -1
  347. package/components/selects/SelectFilter.js.map +1 -1
  348. package/components/selects/WithFeedbackAndAddon.js +1 -1
  349. package/components/selects/WithFeedbackAndAddon.js.map +1 -1
  350. package/components/sidebars/Sidebar.d.ts +19 -3
  351. package/components/sidebars/Sidebar.js +54 -54
  352. package/components/sidebars/Sidebar.js.map +1 -1
  353. package/components/sidebars/SidebarBackdrop.js +4 -4
  354. package/components/sidebars/SidebarBackdrop.js.map +1 -1
  355. package/components/sidebars/SidebarFooter.js +1 -1
  356. package/components/sidebars/SidebarFooter.js.map +1 -1
  357. package/components/sidebars/SidebarFullscreenToggle.js +4 -4
  358. package/components/sidebars/SidebarFullscreenToggle.js.map +1 -1
  359. package/components/slider/RangeSlider.d.ts +15 -0
  360. package/components/slider/RangeSlider.js +1 -1
  361. package/components/slider/RangeSlider.js.map +1 -1
  362. package/components/slider/Slider.d.ts +9 -0
  363. package/components/slider/Slider.js +1 -1
  364. package/components/slider/Slider.js.map +1 -1
  365. package/components/smoothScrollbars/SmoothScrollbars.d.ts +44 -0
  366. package/components/smoothScrollbars/SmoothScrollbars.js +1 -1
  367. package/components/smoothScrollbars/SmoothScrollbars.js.map +1 -1
  368. package/components/spinner/Spinner.d.ts +3 -3
  369. package/components/spinner/Spinner.js +5 -4
  370. package/components/spinner/Spinner.js.map +1 -1
  371. package/components/states/CustomState.d.ts +69 -1
  372. package/components/states/CustomState.js +1 -1
  373. package/components/states/CustomState.js.map +1 -1
  374. package/components/states/EmptyState.d.ts +1 -1
  375. package/components/states/EmptyState.js.map +1 -1
  376. package/components/states/ErrorState.d.ts +1 -1
  377. package/components/states/ErrorState.js.map +1 -1
  378. package/components/states/ForbiddenState.d.ts +1 -1
  379. package/components/states/ForbiddenState.js.map +1 -1
  380. package/components/states/MaintenanceState.d.ts +1 -1
  381. package/components/states/MaintenanceState.js.map +1 -1
  382. package/components/states/NotBookedState.d.ts +1 -1
  383. package/components/states/NotBookedState.js.map +1 -1
  384. package/components/states/NotFoundState.d.ts +1 -1
  385. package/components/states/NotFoundState.js.map +1 -1
  386. package/components/states/StateButton.js +1 -1
  387. package/components/states/StateButton.js.map +1 -1
  388. package/components/states/StateIcon.d.ts +14 -1
  389. package/components/states/StateIcon.js.map +1 -1
  390. package/components/statsWidget/StatsWidget.d.ts +2 -0
  391. package/components/statsWidget/StatsWidget.js +1 -1
  392. package/components/statsWidget/StatsWidget.js.map +1 -1
  393. package/components/statsWidget/StatsWidgetBody.d.ts +1 -0
  394. package/components/statsWidget/StatsWidgetBody.js +1 -1
  395. package/components/statsWidget/StatsWidgetBody.js.map +1 -1
  396. package/components/statsWidget/StatsWidgetFooter.js +1 -1
  397. package/components/statsWidget/StatsWidgetFooter.js.map +1 -1
  398. package/components/statsWidget/StatsWidgetHeader.js +1 -1
  399. package/components/statsWidget/StatsWidgetHeader.js.map +1 -1
  400. package/components/statsWidget/StatsWidgetNumber.d.ts +2 -0
  401. package/components/statsWidget/StatsWidgetNumber.js +2 -2
  402. package/components/statsWidget/StatsWidgetNumber.js.map +1 -1
  403. package/components/statsWidget/StatsWidgetSpacer.js +1 -1
  404. package/components/statsWidget/StatsWidgetSpacer.js.map +1 -1
  405. package/components/statsWidget/StatsWidgets.js +1 -1
  406. package/components/statsWidget/StatsWidgets.js.map +1 -1
  407. package/components/statusBar/StatusBar.d.ts +98 -3
  408. package/components/statusBar/StatusBar.js +24 -17
  409. package/components/statusBar/StatusBar.js.map +1 -1
  410. package/components/statusBar/StatusBarIcon.d.ts +2 -2
  411. package/components/statusBar/StatusBarIcon.js +4 -4
  412. package/components/statusBar/StatusBarIcon.js.map +1 -1
  413. package/components/statusBar/StatusBarLabel.d.ts +2 -2
  414. package/components/statusBar/StatusBarLabel.js +5 -7
  415. package/components/statusBar/StatusBarLabel.js.map +1 -1
  416. package/components/statusBar/StatusBarProgressBar.d.ts +1 -1
  417. package/components/statusBar/StatusBarProgressBar.js +1 -1
  418. package/components/statusBar/StatusBarProgressBar.js.map +1 -1
  419. package/components/steppedProgressBar/SteppedProgressBar.d.ts +1 -1
  420. package/components/steppedProgressBar/SteppedProgressBar.js +1 -1
  421. package/components/steppedProgressBar/SteppedProgressBar.js.map +1 -1
  422. package/components/switch/Switch.d.ts +28 -1
  423. package/components/switch/Switch.js +77 -35
  424. package/components/switch/Switch.js.map +1 -1
  425. package/components/table/SortArrowDown.d.ts +1 -1
  426. package/components/table/SortArrowDown.js.map +1 -1
  427. package/components/table/SortArrowUp.d.ts +1 -1
  428. package/components/table/SortArrowUp.js.map +1 -1
  429. package/components/table/TableCardsSorting.js +4 -4
  430. package/components/table/TableCardsSorting.js.map +1 -1
  431. package/components/table/TableHead.js +1 -1
  432. package/components/table/TableHead.js.map +1 -1
  433. package/components/table/TableSearch.js +1 -1
  434. package/components/table/TableSearch.js.map +1 -1
  435. package/components/table/TableSettingsColumnButtons.d.ts +1 -1
  436. package/components/table/TableSettingsColumnButtons.js +1 -1
  437. package/components/table/TableSettingsColumnButtons.js.map +1 -1
  438. package/components/table/TableSettingsColumnDetails.d.ts +1 -1
  439. package/components/table/TableSettingsColumnDetails.js +1 -1
  440. package/components/table/TableSettingsColumnDetails.js.map +1 -1
  441. package/components/table/TableSettingsDialog.d.ts +56 -1
  442. package/components/table/TableSettingsDialog.js +170 -144
  443. package/components/table/TableSettingsDialog.js.map +1 -1
  444. package/components/table/TableSettingsDialogFooter.js +9 -9
  445. package/components/table/TableSettingsDialogFooter.js.map +1 -1
  446. package/components/table/TableSettingsListContainer.d.ts +1 -1
  447. package/components/table/TableSettingsListContainer.js.map +1 -1
  448. package/components/table/TableSettingsListItem.d.ts +1 -1
  449. package/components/table/TableSettingsListItem.js +8 -8
  450. package/components/table/TableSettingsListItem.js.map +1 -1
  451. package/components/table/TableToolbar.js +1 -1
  452. package/components/table/TableToolbar.js.map +1 -1
  453. package/components/table/TableViewToggles.d.ts +21 -1
  454. package/components/table/TableViewToggles.js +1 -1
  455. package/components/table/TableViewToggles.js.map +1 -1
  456. package/components/tag/Tag.d.ts +7 -2
  457. package/components/tag/Tag.js +1 -1
  458. package/components/tag/Tag.js.map +1 -1
  459. package/components/tag/TagList.js +1 -1
  460. package/components/tag/TagList.js.map +1 -1
  461. package/components/tagManager/CustomSuggestionItem.js +1 -1
  462. package/components/tagManager/CustomSuggestionItem.js.map +1 -1
  463. package/components/tagManager/TagManager.d.ts +29 -2
  464. package/components/tagManager/TagManager.js +6 -6
  465. package/components/tagManager/TagManager.js.map +1 -1
  466. package/components/tagManager/TagManagerItemList.d.ts +1 -1
  467. package/components/tagManager/TagManagerItemList.js +1 -1
  468. package/components/tagManager/TagManagerItemList.js.map +1 -1
  469. package/components/teaser/Teaser.d.ts +57 -55
  470. package/components/teaser/Teaser.js +1 -1
  471. package/components/teaser/Teaser.js.map +1 -1
  472. package/components/teaser/TeaserContainer.d.ts +1 -1
  473. package/components/teaser/TeaserContainer.js +1 -1
  474. package/components/teaser/TeaserContainer.js.map +1 -1
  475. package/components/timepicker/TimePicker.d.ts +20 -0
  476. package/components/timepicker/TimePicker.js +153 -99
  477. package/components/timepicker/TimePicker.js.map +1 -1
  478. package/components/tooltip/SimpleTooltip.d.ts +22 -4
  479. package/components/tooltip/SimpleTooltip.js.map +1 -1
  480. package/components/tooltip/Tooltip.d.ts +22 -2
  481. package/components/tooltip/Tooltip.js +1 -1
  482. package/components/tooltip/Tooltip.js.map +1 -1
  483. package/components/tracker/Tracker.d.ts +85 -0
  484. package/components/tracker/Tracker.js +54 -0
  485. package/components/tracker/Tracker.js.map +1 -0
  486. package/components/tracker/TrackerBlock.d.ts +11 -0
  487. package/components/tracker/TrackerBlock.js +34 -0
  488. package/components/tracker/TrackerBlock.js.map +1 -0
  489. package/components/video/ResponsiveVideo.d.ts +8 -3
  490. package/components/video/ResponsiveVideo.js +1 -1
  491. package/components/video/ResponsiveVideo.js.map +1 -1
  492. package/hooks/useCookies.d.ts +79 -0
  493. package/hooks/useCookies.js +33 -0
  494. package/hooks/useCookies.js.map +1 -0
  495. package/hooks/useInterval.js +5 -5
  496. package/hooks/useInterval.js.map +1 -1
  497. package/hooks/useIsFocusWithin.js +3 -3
  498. package/hooks/useIsFocusWithin.js.map +1 -1
  499. package/hooks/useKey.d.ts +1 -1
  500. package/hooks/useKey.js.map +1 -1
  501. package/hooks/useLatest.d.ts +16 -0
  502. package/hooks/useLatest.js +11 -0
  503. package/hooks/useLatest.js.map +1 -0
  504. package/hooks/useOnboarding.d.ts +86 -80
  505. package/hooks/useOnboarding.js.map +1 -1
  506. package/hooks/usePostMessage.d.ts +2 -1
  507. package/hooks/usePostMessage.js.map +1 -1
  508. package/hooks/useRioCookieConsent.d.ts +49 -0
  509. package/hooks/useRioCookieConsent.js +44 -0
  510. package/hooks/useRioCookieConsent.js.map +1 -0
  511. package/hooks/useSearch.d.ts +1 -1
  512. package/hooks/useSearch.js +28 -17
  513. package/hooks/useSearch.js.map +1 -1
  514. package/hooks/useSearchHighlight.d.ts +60 -0
  515. package/hooks/useSearchHighlight.js +54 -0
  516. package/hooks/useSearchHighlight.js.map +1 -0
  517. package/hooks/useTableExport.js.map +1 -1
  518. package/hooks/useTimeout.js +11 -11
  519. package/hooks/useTimeout.js.map +1 -1
  520. package/hooks/useUncontrollable.d.ts +1 -1
  521. package/hooks/useUncontrollable.js.map +1 -1
  522. package/hooks/useUrlState.d.ts +62 -0
  523. package/hooks/useUrlState.js +137 -0
  524. package/hooks/useUrlState.js.map +1 -0
  525. package/mergeClassNameOverrides.d.ts +1 -0
  526. package/mergeClassNameOverrides.js +5 -0
  527. package/mergeClassNameOverrides.js.map +1 -0
  528. package/package.json +18 -21
  529. package/routeUtils.js +11 -5
  530. package/routeUtils.js.map +1 -1
  531. package/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js +1 -1
  532. package/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js.map +1 -1
  533. package/useCookies.d.ts +2 -0
  534. package/useCookies.js +5 -0
  535. package/useCookies.js.map +1 -0
  536. package/useRioCookieConsent.d.ts +2 -0
  537. package/useRioCookieConsent.js +5 -0
  538. package/useRioCookieConsent.js.map +1 -0
  539. package/useSearchHighlight.d.ts +2 -0
  540. package/useSearchHighlight.js +6 -0
  541. package/useSearchHighlight.js.map +1 -0
  542. package/useUrlState.d.ts +2 -0
  543. package/useUrlState.js +5 -0
  544. package/useUrlState.js.map +1 -0
  545. package/utils/classNames.d.ts +3 -0
  546. package/utils/classNames.js +5 -0
  547. package/utils/classNames.js.map +1 -0
  548. package/utils/colorScheme.js +14 -13
  549. package/utils/colorScheme.js.map +1 -1
  550. package/utils/cssuseragent.js.map +1 -1
  551. package/utils/mergeClassNameOverrides.d.ts +1 -0
  552. package/utils/mergeClassNameOverrides.js +55 -0
  553. package/utils/mergeClassNameOverrides.js.map +1 -0
  554. package/utils/routeUtils.d.ts +122 -13
  555. package/utils/routeUtils.js +89 -31
  556. package/utils/routeUtils.js.map +1 -1
  557. package/utils/scrollItemIntoView.js +12 -11
  558. package/utils/scrollItemIntoView.js.map +1 -1
  559. package/utils/urlFeatureToggles.js +19 -20
  560. package/utils/urlFeatureToggles.js.map +1 -1
  561. package/version.d.ts +1 -1
  562. package/version.js +1 -1
  563. package/version.js.map +1 -1
  564. package/components/states/BaseStateProps.d.ts +0 -66
  565. package/components/statusBar/StatusBar.types.d.ts +0 -85
  566. package/components/table/TableSettingsDialog.types.d.ts +0 -39
  567. package/components/tagManager/TagManagerTag.d.ts +0 -5
@@ -1,7 +1,7 @@
1
1
  import { jsx as e, jsxs as d } from "react/jsx-runtime";
2
2
  import { createContext as H, useState as y, useRef as E, useEffect as x } from "react";
3
3
  import { useReducedMotion as T, AnimatePresence as b, motion as C } from "motion/react";
4
- import q from "classnames";
4
+ import q from "../../utils/classNames.js";
5
5
  import D from "../card/Card.js";
6
6
  import m from "../button/Button.js";
7
7
  import F from "./BannerActions.js";
@@ -1 +1 @@
1
- {"version":3,"file":"Banner.js","sources":["../../../src/components/banner/Banner.tsx"],"sourcesContent":["import { useState, useEffect, createContext, useRef, type ReactNode } from 'react';\nimport { motion, AnimatePresence, useReducedMotion } from 'motion/react';\n\nimport classNames from 'classnames';\n\nimport Card from '../card/Card';\nimport Button from '../button/Button';\nimport BannerPageActions from './BannerActions';\nimport BannerPageContent from './BannerContent';\nimport BannerPageIcon from './BannerIcon';\nimport BannerPage from './BannerPage';\n\nconst BannerContext = createContext<{ nextPage: () => void; prevPage: () => void } | undefined>(undefined);\n\ntype BannerProps = {\n /**\n * Defines if the content is shown or not.\n *\n * @default true\n */\n show: boolean;\n\n /**\n * Defines if a close button is shown or not. You can still add a custom\n * CTA button to the content that handles visibility.\n *\n * @default true\n */\n dismissible?: boolean;\n\n /**\n * Callback when the close button is clicked.\n *\n * @returns\n */\n onClose?: () => void;\n\n /**\n * Defines the time when the next page is shown in milliseconds.\n *\n * @default 20_000\n */\n pageTimeout?: number;\n\n /**\n * Defines if the page navigation buttons shall be shown or not.\n *\n * @default true\n */\n showPageNavigation?: boolean;\n\n /**\n * Defines if a border is shown or not. When placed on a white background, please disable the border\n * so it looks better.\n *\n * @default true\n */\n border?: boolean;\n\n /**\n * Enables or disables initial animation.\n *\n * @default true\n */\n initialAnimation?: boolean;\n\n /**\n * Additional classname added to the wrapper element.\n */\n className?: string;\n\n /**\n * The actual banner content. Wrap your content in a <Banner.Page> component.\n *\n * When having multiple pages, usa an array of <Banner.Page> components.\n */\n children: ReactNode | ReactNode[];\n};\n\nconst Banner = (props: BannerProps) => {\n const {\n show = true,\n dismissible = true,\n onClose = () => {},\n pageTimeout = 20_000,\n showPageNavigation = true,\n border = true,\n initialAnimation = true,\n className = '',\n children,\n ...remainingProps\n } = props;\n\n const pages = Array.isArray(children) ? children : [children];\n const pageAmount = pages.length;\n const hasMultiplePages = pageAmount > 1;\n\n const [currentPage, setCurrentPage] = useState(0);\n\n const shouldReduceMotion = useReducedMotion();\n const hasAnimation = !shouldReduceMotion && initialAnimation;\n\n const contentRef = useRef<HTMLDivElement>(null);\n const [contentHeight, setContentHeight] = useState(0);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: \"currentPage\" resets interval on manual page change\n useEffect(() => {\n if (!show || pageAmount === 1) {\n return;\n }\n\n const interval = setInterval(() => {\n nextPage();\n }, pageTimeout);\n\n return () => clearInterval(interval);\n }, [pageAmount, pageTimeout, show, currentPage]);\n\n // Update height measurement after layout is complete\n // biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>\n useEffect(() => {\n if (!contentRef.current) {\n return;\n }\n\n // Use ResizeObserver to get accurate measurements after layout\n const resizeObserver = new ResizeObserver(entries => {\n const entry = entries[0];\n if (entry) {\n // Use getBoundingClientRect for most accurate height\n const height = entry.target.getBoundingClientRect().height;\n setContentHeight(height);\n }\n });\n\n resizeObserver.observe(contentRef.current);\n\n return () => resizeObserver.disconnect();\n }, [show, currentPage]);\n\n const nextPage = () => {\n if (hasMultiplePages) {\n setCurrentPage(prev => (prev + 1) % pageAmount);\n }\n };\n\n const prevPage = () => {\n if (hasMultiplePages) {\n setCurrentPage(prev => (prev - 1 + pageAmount) % pageAmount);\n }\n };\n\n const cardClasses = classNames(\n 'Banner display-flex text-color-darker overflow-hidden',\n 'position-relative',\n !border && 'border-color-white',\n className\n );\n\n return (\n <BannerContext.Provider value={{ nextPage, prevPage }}>\n <AnimatePresence>\n {show && (\n <motion.div\n initial={{ height: 0, opacity: 0 }}\n animate={{ height: contentHeight, opacity: 1 }}\n exit={{ height: 0, opacity: 0 }}\n transition={{\n height: { duration: 0.2 },\n opacity: { duration: 0.2 },\n ease: 'easeInOut',\n }}\n >\n <div ref={contentRef} style={{ position: 'relative' }}>\n <Card className={cardClasses} padding={20} {...remainingProps}>\n <div className='flex-1-1 overflow-hidden'>\n <AnimatePresence mode='wait'>\n <motion.div\n key={currentPage}\n initial={hasAnimation ? { opacity: 0, x: 100 } : false}\n animate={{ opacity: 1, x: 0 }}\n exit={hasAnimation ? { opacity: 0, x: -100 } : undefined}\n transition={{\n duration: 1.5,\n ease: [0.25, 1, 0.5, 1],\n }}\n >\n {pages[currentPage]}\n </motion.div>\n </AnimatePresence>\n\n {hasMultiplePages && showPageNavigation && (\n <div className='margin-5'>\n <div className='position-absolute bottom-5' style={{ right: '45px' }}>\n <div className='display-flex'>\n <Button\n bsStyle='muted'\n bsSize='xs'\n onClick={prevPage}\n iconName='rioglyph-arrow-left'\n iconOnly\n />\n <Button\n bsStyle='muted'\n bsSize='xs'\n onClick={nextPage}\n iconName='rioglyph-arrow-right'\n iconOnly\n />\n </div>\n </div>\n </div>\n )}\n </div>\n {dismissible && (\n <div className='flex-0 margin-left-10 margin-right--5 margin-top--5 margin-top-0-ls align-self-start align-self-center-ls'>\n <Button\n bsStyle='muted'\n bsSize='sm'\n onClick={onClose}\n iconName='rioglyph-remove'\n iconOnly\n />\n </div>\n )}\n </Card>\n </div>\n </motion.div>\n )}\n </AnimatePresence>\n </BannerContext.Provider>\n );\n};\n\nBanner.Page = BannerPage;\nBanner.Icon = BannerPageIcon;\nBanner.Content = BannerPageContent;\nBanner.Actions = BannerPageActions;\n\nexport default Banner;\n"],"names":["BannerContext","createContext","Banner","props","show","dismissible","onClose","pageTimeout","showPageNavigation","border","initialAnimation","className","children","remainingProps","pages","pageAmount","hasMultiplePages","currentPage","setCurrentPage","useState","hasAnimation","useReducedMotion","contentRef","useRef","contentHeight","setContentHeight","useEffect","interval","nextPage","resizeObserver","entries","entry","height","prev","prevPage","cardClasses","classNames","jsx","AnimatePresence","motion","jsxs","Card","Button","BannerPage","BannerPageIcon","BannerPageContent","BannerPageActions"],"mappings":";;;;;;;;;;AAYA,MAAMA,IAAgBC,EAA0E,MAAS,GAmEnGC,IAAS,CAACC,MAAuB;AACnC,QAAM;AAAA,IACF,MAAAC,IAAO;AAAA,IACP,aAAAC,IAAc;AAAA,IACd,SAAAC,IAAU,MAAM;AAAA,IAAC;AAAA,IACjB,aAAAC,IAAc;AAAA,IACd,oBAAAC,IAAqB;AAAA,IACrB,QAAAC,IAAS;AAAA,IACT,kBAAAC,IAAmB;AAAA,IACnB,WAAAC,IAAY;AAAA,IACZ,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACHV,GAEEW,IAAQ,MAAM,QAAQF,CAAQ,IAAIA,IAAW,CAACA,CAAQ,GACtDG,IAAaD,EAAM,QACnBE,IAAmBD,IAAa,GAEhC,CAACE,GAAaC,CAAc,IAAIC,EAAS,CAAC,GAG1CC,IAAe,CADMC,EAAA,KACiBX,GAEtCY,IAAaC,EAAuB,IAAI,GACxC,CAACC,GAAeC,CAAgB,IAAIN,EAAS,CAAC;AAGpD,EAAAO,EAAU,MAAM;AACZ,QAAI,CAACtB,KAAQW,MAAe;AACxB;AAGJ,UAAMY,IAAW,YAAY,MAAM;AAC/B,MAAAC,EAAA;AAAA,IACJ,GAAGrB,CAAW;A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AAA,UAAA;AAAA,YACG,SAAQ;AAAA,YACR,QAAO;AAAA,YACP,SAASpC;AAAA,YACT,UAAS;AAAA,YACT,UAAQ;AAAA,UAAA;AAAA,QAAA,EACZ,CACJ;AAAA,MAAA,EAAA,CAER,EAAA,CACJ;AAAA,IAAA;AAAA,EAAA,GAGZ,EAAA,CACJ;AAER;AAEAJ,EAAO,OAAOyC;AACdzC,EAAO,OAAO0C;AACd1C,EAAO,UAAU2C;AACjB3C,EAAO,UAAU4C;"}
1
+ {"version":3,"file":"Banner.js","sources":["../../../src/components/banner/Banner.tsx"],"sourcesContent":["import { useState, useEffect, createContext, useRef, type ReactNode } from 'react';\nimport { motion, AnimatePresence, useReducedMotion } from 'motion/react';\n\nimport classNames from '../../utils/classNames';\nimport Card from '../card/Card';\nimport Button from '../button/Button';\nimport BannerPageActions from './BannerActions';\nimport BannerPageContent from './BannerContent';\nimport BannerPageIcon from './BannerIcon';\nimport BannerPage from './BannerPage';\n\nconst BannerContext = createContext<{ nextPage: () => void; prevPage: () => void } | undefined>(undefined);\n\ntype BannerProps = {\n /**\n * Defines if the content is shown or not.\n *\n * @default true\n */\n show: boolean;\n\n /**\n * Defines if a close button is shown or not. You can still add a custom\n * CTA button to the content that handles visibility.\n *\n * @default true\n */\n dismissible?: boolean;\n\n /**\n * Callback when the close button is clicked.\n *\n * @returns\n */\n onClose?: () => void;\n\n /**\n * Defines the time when the next page is shown in milliseconds.\n *\n * @default 20_000\n */\n pageTimeout?: number;\n\n /**\n * Defines if the page navigation buttons shall be shown or not.\n *\n * @default true\n */\n showPageNavigation?: boolean;\n\n /**\n * Defines if a border is shown or not. When placed on a white background, please disable the border\n * so it looks better.\n *\n * @default true\n */\n border?: boolean;\n\n /**\n * Enables or disables initial animation.\n *\n * @default true\n */\n initialAnimation?: boolean;\n\n /**\n * Additional classname added to the wrapper element.\n */\n className?: string;\n\n /**\n * The actual banner content. Wrap your content in a <Banner.Page> component.\n *\n * When having multiple pages, usa an array of <Banner.Page> components.\n */\n children: ReactNode | ReactNode[];\n};\n\nconst Banner = (props: BannerProps) => {\n const {\n show = true,\n dismissible = true,\n onClose = () => {},\n pageTimeout = 20_000,\n showPageNavigation = true,\n border = true,\n initialAnimation = true,\n className = '',\n children,\n ...remainingProps\n } = props;\n\n const pages = Array.isArray(children) ? children : [children];\n const pageAmount = pages.length;\n const hasMultiplePages = pageAmount > 1;\n\n const [currentPage, setCurrentPage] = useState(0);\n\n const shouldReduceMotion = useReducedMotion();\n const hasAnimation = !shouldReduceMotion && initialAnimation;\n\n const contentRef = useRef<HTMLDivElement>(null);\n const [contentHeight, setContentHeight] = useState(0);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: \"currentPage\" resets interval on manual page change\n useEffect(() => {\n if (!show || pageAmount === 1) {\n return;\n }\n\n const interval = setInterval(() => {\n nextPage();\n }, pageTimeout);\n\n return () => clearInterval(interval);\n }, [pageAmount, pageTimeout, show, currentPage]);\n\n // Update height measurement after layout is complete\n // biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>\n useEffect(() => {\n if (!contentRef.current) {\n return;\n }\n\n // Use ResizeObserver to get accurate measurements after layout\n const resizeObserver = new ResizeObserver(entries => {\n const entry = entries[0];\n if (entry) {\n // Use getBoundingClientRect for most accurate height\n const height = entry.target.getBoundingClientRect().height;\n setContentHeight(height);\n }\n });\n\n resizeObserver.observe(contentRef.current);\n\n return () => resizeObserver.disconnect();\n }, [show, currentPage]);\n\n const nextPage = () => {\n if (hasMultiplePages) {\n setCurrentPage(prev => (prev + 1) % pageAmount);\n }\n };\n\n const prevPage = () => {\n if (hasMultiplePages) {\n setCurrentPage(prev => (prev - 1 + pageAmount) % pageAmount);\n }\n };\n\n const cardClasses = classNames(\n 'Banner display-flex text-color-darker overflow-hidden',\n 'position-relative',\n !border && 'border-color-white',\n className\n );\n\n return (\n <BannerContext.Provider value={{ nextPage, prevPage }}>\n <AnimatePresence>\n {show && (\n <motion.div\n initial={{ height: 0, opacity: 0 }}\n animate={{ height: contentHeight, opacity: 1 }}\n exit={{ height: 0, opacity: 0 }}\n transition={{\n height: { duration: 0.2 },\n opacity: { duration: 0.2 },\n ease: 'easeInOut',\n }}\n >\n <div ref={contentRef} style={{ position: 'relative' }}>\n <Card className={cardClasses} padding={20} {...remainingProps}>\n <div className='flex-1-1 overflow-hidden'>\n <AnimatePresence mode='wait'>\n <motion.div\n key={currentPage}\n initial={hasAnimation ? { opacity: 0, x: 100 } : false}\n animate={{ opacity: 1, x: 0 }}\n exit={hasAnimation ? { opacity: 0, x: -100 } : undefined}\n transition={{\n duration: 1.5,\n ease: [0.25, 1, 0.5, 1],\n }}\n >\n {pages[currentPage]}\n </motion.div>\n </AnimatePresence>\n\n {hasMultiplePages && showPageNavigation && (\n <div className='margin-5'>\n <div className='position-absolute bottom-5' style={{ right: '45px' }}>\n <div className='display-flex'>\n <Button\n bsStyle='muted'\n bsSize='xs'\n onClick={prevPage}\n iconName='rioglyph-arrow-left'\n iconOnly\n />\n <Button\n bsStyle='muted'\n bsSize='xs'\n onClick={nextPage}\n iconName='rioglyph-arrow-right'\n iconOnly\n />\n </div>\n </div>\n </div>\n )}\n </div>\n {dismissible && (\n <div className='flex-0 margin-left-10 margin-right--5 margin-top--5 margin-top-0-ls align-self-start align-self-center-ls'>\n <Button\n bsStyle='muted'\n bsSize='sm'\n onClick={onClose}\n iconName='rioglyph-remove'\n iconOnly\n />\n </div>\n )}\n </Card>\n </div>\n </motion.div>\n )}\n </AnimatePresence>\n </BannerContext.Provider>\n );\n};\n\nBanner.Page = BannerPage;\nBanner.Icon = BannerPageIcon;\nBanner.Content = BannerPageContent;\nBanner.Actions = BannerPageActions;\n\nexport default Banner;\n"],"names":["BannerContext","createContext","Banner","props","show","dismissible","onClose","pageTimeout","showPageNavigation","border","initialAnimation","className","children","remainingProps","pages","pageAmount","hasMultiplePages","currentPage","setCurrentPage","useState","hasAnimation","useReducedMotion","contentRef","useRef","contentHeight","setContentHeight","useEffect","interval","nextPage","resizeObserver","entries","entry","height","prev","prevPage","cardClasses","classNames","jsx","AnimatePresence","motion","jsxs","Card","Button","BannerPage","BannerPageIcon","BannerPageContent","BannerPageActions"],"mappings":";;;;;;;;;;AAWA,MAAMA,IAAgBC,EAA0E,MAAS,GAmEnGC,IAAS,CAACC,MAAuB;AACnC,QAAM;AAAA,IACF,MAAAC,IAAO;AAAA,IACP,aAAAC,IAAc;AAAA,IACd,SAAAC,IAAU,MAAM;AAAA,IAAC;AAAA,IACjB,aAAAC,IAAc;AAAA,IACd,oBAAAC,IAAqB;AAAA,IACrB,QAAAC,IAAS;AAAA,IACT,kBAAAC,IAAmB;AAAA,IACnB,WAAAC,IAAY;AAAA,IACZ,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACHV,GAEEW,IAAQ,MAAM,QAAQF,CAAQ,IAAIA,IAAW,CAACA,CAAQ,GACtDG,IAAaD,EAAM,QACnBE,IAAmBD,IAAa,GAEhC,CAACE,GAAaC,CAAc,IAAIC,EAAS,CAAC,GAG1CC,IAAe,CADMC,EAAA,KACiBX,GAEtCY,IAAaC,EAAuB,IAAI,GACxC,CAACC,GAAeC,CAAgB,IAAIN,EAAS,CAAC;AAGpD,EAAAO,EAAU,MAAM;AACZ,QAAI,CAACtB,KAAQW,MAAe;AACxB;AAGJ,UAAMY,IAAW,YAAY,MAAM;AAC/B,MAAAC,EAAA;AAAA,IACJ,GAAGrB,CAAW;AAEd,WAAO,MAAM,cAAcoB,CAAQ;AAAA,EACvC,GAAG,CAACZ,GAAYR,GAAaH,GAAMa,CAAW,CAAC,GAI/CS,EAAU,MAAM;AACZ,QAAI,CAACJ,EAAW;AACZ;AAIJ,UAAMO,IAAiB,IAAI,eAAe,CAAAC,MAAW;AACjD,YAAMC,IAAQD,EAAQ,CAAC;AACvB,UAAIC,GAAO;AAEP,cAAMC,IAASD,EAAM,OAAO,sBAAA,EAAwB;AACpD,QAAAN,EAAiBO,CAAM;AAAA,MAC3B;AAAA,IACJ,CAAC;AAED,WAAAH,EAAe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time";
2
- import f from "classnames";
2
+ import f from "../../utils/classNames.js";
3
3
  import x from "../../hooks/useResizeObserver.js";
4
4
  const h = 400, z = (r) => {
5
5
  const {
@@ -1 +1 @@
1
- {"version":3,"file":"BannerContent.js","sources":["../../../src/components/banner/BannerContent.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react';\nimport classNames from 'classnames';\n\nimport useResizeObserver from '../../useResizeObserver';\n\nconst DEFAULT_MIN_WIDTH_BREAKPOINT = 400;\n\ntype BannerContentProps = Partial<Pick<HTMLDivElement, 'id'>> & {\n /**\n * The title for the banner.\n */\n title?: string | React.ReactElement;\n\n /**\n * Use this to add the banner call-to-action buttons. Wrap them in a <Banner.Actions> component.\n */\n actions?: React.ReactElement;\n\n /**\n * Breakpoint in pixels where the action buttons are placed under the banner text.\n *\n * On larger screens, the buttons are next to the text.\n *\n * @default 400\n */\n minWidthBreakpoint?: number;\n\n /**\n * Additional classname added to the wrapper element.\n */\n className?: string;\n};\n\nconst BannerContent = (props: PropsWithChildren<BannerContentProps>) => {\n const {\n title,\n actions,\n children,\n minWidthBreakpoint = DEFAULT_MIN_WIDTH_BREAKPOINT,\n className = '',\n ...remainingProps\n } = props;\n\n // Check size of the container for responsive breakpoints\n const [contentRef, _, { inlineSize }] = useResizeObserver();\n const containerWidth = inlineSize ?? 0;\n\n const contentWithActionClass = classNames(\n 'flex-1-1',\n 'BannerContent',\n 'display-flex gap-15',\n containerWidth < minWidthBreakpoint ? 'flex-column' : 'flex-row align-items-center',\n className\n );\n\n if (actions) {\n return (\n <div ref={contentRef} className={contentWithActionClass} {...remainingProps}>\n <div className='flex-1-1 min-width-100'>\n {title && <div className='text-size-16 text-medium'>{title}</div>}\n {children}\n </div>\n {actions}\n </div>\n );\n }\n\n return (\n <div className='flex-1-1'>\n {title && <div className='text-size-16 text-medium'>{title}</div>}\n {children}\n </div>\n );\n};\n\nexport default BannerContent;\n"],"names":["DEFAULT_MIN_WIDTH_BREAKPOINT","BannerContent","props","title","actions","children","minWidthBreakpoint","className","remainingProps","contentRef","_","inlineSize","useResizeObserver","contentWithActionClass","classNames","jsxs","jsx"],"mappings":";;;AAKA,MAAMA,IAA+B,KA4B/BC,IAAgB,CAACC,MAAiD;AACpE,QAAM;AAAA,IACF,OAAAC;AAAA,IACA,SAAAC;AAAA,IACA,UAAAC;AAAA,IACA,oBAAAC,IAAqBN;AAAA,IACrB,WAAAO,IAAY;AAAA,IACZ,GAAGC;AAAA,EAAA,IACHN,GAGE,CAACO,GAAYC,GAAG,EAAE,YAAAC,EAAA,CAAY,IAAIC,EAAA,GAGlCC,IAAyBC;AAAA,IAC3B;AAAA,IACA;AAAA,IACA;AAAA,KALmBH,KAAc,KAMhBL,IAAqB,gBAAgB;AAAA,IACtDC;AAAA,EAAA;AAGJ,SAAIH,sBAEK,OAAA,EAAI,KAAKK,GAAY,WAAWI,GAAyB,GAAGL,GACzD,UAAA;AAAA,IAAA,gBAAAO,EAAC,OAAA,EAAI,WAAU,0BACV,UAAA;AAAA,MAAAZ,KAAS,gBAAAa,EAAC,OAAA,EAAI,WAAU,4BAA4B,UAAAb,GAAM;AAAA,MAC1DE;AAAA,IAAA,GACL;AAAA,IACCD;AAAA,EAAA,GACL,IAKJ,gBAAAW,EAAC,OAAA,EAAI,WAAU,YACV,UAAA;AAAA,IAAAZ,KAAS,gBAAAa,EAAC,OAAA,EAAI,WAAU,4BAA4B,UAAAb,GAAM;AAAA,IAC1DE;AAAA,EAAA,GACL;AAER;"}
1
+ {"version":3,"file":"BannerContent.js","sources":["../../../src/components/banner/BannerContent.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react';\n\nimport classNames from '../../utils/classNames';\nimport useResizeObserver from '../../useResizeObserver';\n\nconst DEFAULT_MIN_WIDTH_BREAKPOINT = 400;\n\ntype BannerContentProps = Partial<Pick<HTMLDivElement, 'id'>> & {\n /**\n * The title for the banner.\n */\n title?: string | React.ReactElement;\n\n /**\n * Use this to add the banner call-to-action buttons. Wrap them in a <Banner.Actions> component.\n */\n actions?: React.ReactElement;\n\n /**\n * Breakpoint in pixels where the action buttons are placed under the banner text.\n *\n * On larger screens, the buttons are next to the text.\n *\n * @default 400\n */\n minWidthBreakpoint?: number;\n\n /**\n * Additional classname added to the wrapper element.\n */\n className?: string;\n};\n\nconst BannerContent = (props: PropsWithChildren<BannerContentProps>) => {\n const {\n title,\n actions,\n children,\n minWidthBreakpoint = DEFAULT_MIN_WIDTH_BREAKPOINT,\n className = '',\n ...remainingProps\n } = props;\n\n // Check size of the container for responsive breakpoints\n const [contentRef, _, { inlineSize }] = useResizeObserver();\n const containerWidth = inlineSize ?? 0;\n\n const contentWithActionClass = classNames(\n 'flex-1-1',\n 'BannerContent',\n 'display-flex gap-15',\n containerWidth < minWidthBreakpoint ? 'flex-column' : 'flex-row align-items-center',\n className\n );\n\n if (actions) {\n return (\n <div ref={contentRef} className={contentWithActionClass} {...remainingProps}>\n <div className='flex-1-1 min-width-100'>\n {title && <div className='text-size-16 text-medium'>{title}</div>}\n {children}\n </div>\n {actions}\n </div>\n );\n }\n\n return (\n <div className='flex-1-1'>\n {title && <div className='text-size-16 text-medium'>{title}</div>}\n {children}\n </div>\n );\n};\n\nexport default BannerContent;\n"],"names":["DEFAULT_MIN_WIDTH_BREAKPOINT","BannerContent","props","title","actions","children","minWidthBreakpoint","className","remainingProps","contentRef","_","inlineSize","useResizeObserver","contentWithActionClass","classNames","jsxs","jsx"],"mappings":";;;AAKA,MAAMA,IAA+B,KA4B/BC,IAAgB,CAACC,MAAiD;AACpE,QAAM;AAAA,IACF,OAAAC;AAAA,IACA,SAAAC;AAAA,IACA,UAAAC;AAAA,IACA,oBAAAC,IAAqBN;AAAA,IACrB,WAAAO,IAAY;AAAA,IACZ,GAAGC;AAAA,EAAA,IACHN,GAGE,CAACO,GAAYC,GAAG,EAAE,YAAAC,EAAA,CAAY,IAAIC,EAAA,GAGlCC,IAAyBC;AAAA,IAC3B;AAAA,IACA;AAAA,IACA;AAAA,KALmBH,KAAc,KAMhBL,IAAqB,gBAAgB;AAAA,IACtDC;AAAA,EAAA;AAGJ,SAAIH,sBAEK,OAAA,EAAI,KAAKK,GAAY,WAAWI,GAAyB,GAAGL,GACzD,UAAA;AAAA,IAAA,gBAAAO,EAAC,OAAA,EAAI,WAAU,0BACV,UAAA;AAAA,MAAAZ,KAAS,gBAAAa,EAAC,OAAA,EAAI,WAAU,4BAA4B,UAAAb,GAAM;AAAA,MAC1DE;AAAA,IAAA,GACL;AAAA,IACCD;AAAA,EAAA,GACL,IAKJ,gBAAAW,EAAC,OAAA,EAAI,WAAU,YACV,UAAA;AAAA,IAAAZ,KAAS,gBAAAa,EAAC,OAAA,EAAI,WAAU,4BAA4B,UAAAb,GAAM;AAAA,IAC1DE;AAAA,EAAA,GACL;AAER;"}
@@ -1,12 +1,38 @@
1
1
  import { default as React } from 'react';
2
2
  import { SortDirectionType } from '../../utils/SortUtils';
3
+ /**
4
+ * A single entry in the BarList.
5
+ *
6
+ * @template T Custom payload merged into the row data.
7
+ */
3
8
  export type BarListRow<T> = T & {
9
+ /**
10
+ * Optional unique identifier. Falls back to `name` when not provided.
11
+ */
4
12
  key?: string;
13
+ /**
14
+ * Optional URL. When provided, the label renders as a link.
15
+ */
5
16
  href?: string;
17
+ /**
18
+ * Numeric value used for sorting and bar width calculations.
19
+ */
6
20
  value: number;
21
+ /**
22
+ * Label shown for the bar.
23
+ */
7
24
  name: string;
25
+ /**
26
+ * Text color override for this specific row.
27
+ */
8
28
  color?: string;
29
+ /**
30
+ * Progress color override for this specific row.
31
+ */
9
32
  barColor?: string;
33
+ /**
34
+ * Background color override for this specific row.
35
+ */
10
36
  background?: string;
11
37
  };
12
38
  /**
@@ -1,7 +1,7 @@
1
1
  import { jsxs as h, jsx as e } from "react/jsx-runtime";
2
2
  import f, { useMemo as j } from "react";
3
- import n from "classnames";
4
3
  import { motion as u } from "motion/react";
4
+ import n from "../../utils/classNames.js";
5
5
  import { SortDirection as A } from "../../utils/SortUtils.js";
6
6
  import { useSortedBars as H } from "./useSortedBars.js";
7
7
  const O = {
@@ -1 +1 @@
1
- {"version":3,"file":"BarList.js","sources":["../../../src/components/barList/BarList.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport classNames from 'classnames';\nimport { motion, type Variants } from 'motion/react';\n\nimport { SortDirection, type SortDirectionType } from '../../utils/SortUtils';\nimport { useSortedBars } from './useSortedBars';\n\nexport type BarListRow<T> = T & {\n key?: string;\n href?: string;\n value: number;\n name: string;\n color?: string; // individual progress color override\n barColor?: string; // individual bar color override\n background?: string; // individual background override\n};\n\n/**\n * Props for the BarList component.\n *\n * @template T - The type of the custom data associated with each bar row.\n */\ntype BarListProps<T = unknown> = React.HTMLAttributes<HTMLDivElement> & {\n /**\n * Array of bar row data to be rendered.\n */\n data: BarListRow<T>[];\n\n /**\n * Optional function to format the numeric value displayed on the right side of each bar.\n * Can return a string or a React element.\n *\n * @example\n * valueFormatter={(value) => `${value}%`}\n */\n valueFormatter?: (value: number) => string | React.ReactElement;\n\n /**\n * A reference value used to calculate relative widths.\n * If not provided, the maximum value in `data` will be used.\n *\n * @default max(data.value)\n */\n referenceValue?: number;\n\n /**\n * Whether to animate the bar width transitions using Framer Motion.\n *\n * @default false\n */\n showAnimation?: boolean;\n\n /**\n * Callback fired when a bar is clicked.\n *\n * @param payload - The full data object of the clicked bar.\n */\n onSelectRow?: (payload: BarListRow<T>) => void;\n\n /**\n * The sort order for the bars. Options are 'asc', 'desc', or 'none'.\n *\n * @default 'none'\n */\n sortOrder?: SortDirectionType | 'none';\n\n /**\n * Height of each bar row in pixels.\n *\n * @default 32\n */\n rowHeight?: number;\n\n /**\n * Opacity applied to non-hovered bars (between 0 and 1).\n *\n * @default 0.5\n */\n opacity?: number;\n\n /**\n * CSS color string used for the active/progress portion of each bar.\n *\n * @default 'bg-highlight-light'\n */\n barColor?: string;\n\n /**\n * CSS color string used for the text labels.\n *\n * @default 'text-color-darker'\n */\n labelColor?: string;\n\n /**\n * CSS color string used for the bar background.\n *\n * @default 'bg-transparent'\n */\n background?: string;\n\n /**\n * Additional className added to the wrapper element.\n */\n className?: string;\n};\n\n// Animation variants\nconst containerVariants: Variants = {\n animate: {\n transition: {\n staggerChildren: 0.1,\n },\n },\n};\n\nconst barVariants: Variants = {\n initial: { width: 0 },\n animate: (width: number) => ({\n width: `${width}%`,\n transition: { duration: 0.8, ease: 'easeOut' },\n }),\n};\n\nconst DEFAULT_ROW_HEIGHT = 25;\nconst DEFAULT_OPACITY = 0.5;\n\nconst BarListInner = <T,>(props: BarListProps<T>, forwardedRef: React.ForwardedRef<HTMLDivElement>) => {\n const {\n data = [],\n valueFormatter = value => value.toString(),\n showAnimation = false,\n onSelectRow,\n referenceValue,\n sortOrder = SortDirection.DESCENDING,\n barColor = 'bg-highlight-light',\n labelColor = 'text-color-darker',\n background = 'bg-transparent',\n rowHeight = DEFAULT_ROW_HEIGHT,\n opacity = DEFAULT_OPACITY,\n className = '',\n ...remainingProps\n } = props;\n\n const sortedData = useSortedBars(data, sortOrder, item => item.value);\n\n const [hoveredIndex, setHoveredIndex] = React.useState<number | null>(null);\n\n const widths = useMemo(() => {\n const base = referenceValue ?? Math.max(...sortedData.map(item => item.value), 0);\n return sortedData.map(item => (base === 0 || item.value === 0 ? 0 : Math.max((item.value / base) * 100, 2)));\n }, [sortedData, referenceValue]);\n\n return (\n <div\n {...remainingProps}\n ref={forwardedRef}\n className={classNames('display-flex justify-content-between gap-15', className)}\n >\n <motion.div\n variants={showAnimation ? containerVariants : undefined}\n initial='initial'\n animate='animate'\n className='width-100pct space-y-5'\n >\n {sortedData.map((item, index) => {\n const width = widths[index];\n\n const itemLabelColor = item.color ?? labelColor;\n const itemBarColor = item.barColor ?? barColor;\n const itemBackground = item.background ?? background;\n\n return (\n <div\n key={item.key ?? item.name}\n onMouseEnter={() => setHoveredIndex(index)}\n onMouseLeave={() => setHoveredIndex(null)}\n onClick={() => onSelectRow?.(item)}\n className={classNames(\n 'position-relative width-100pct rounded-small',\n 'transition-all transition-ease-in-out transition-duration-01',\n itemBackground,\n onSelectRow && 'cursor-pointer',\n hoveredIndex === index && 'bg-lightest'\n )}\n >\n {/* Animated Progress Bar */}\n <motion.div\n custom={width}\n variants={showAnimation ? barVariants : undefined}\n className={classNames(\n 'display-flex align-items-center rounded-small',\n 'transition-all transition-ease-in-out transition-duration-01',\n itemBarColor\n )}\n style={{ height: `${rowHeight}px`, opacity: hoveredIndex === index ? 1 : opacity }}\n role='presentation'\n />\n\n {/* Label */}\n <div className='position-absolute left-0 top-50pct translate-y-50pct display-flex width-100pct padding-left-10'>\n {item.href ? (\n <a\n href={item.href}\n className={itemLabelColor}\n target='_blank'\n rel='noreferrer'\n onClick={event => event.stopPropagation()}\n >\n {item.name}\n </a>\n ) : (\n <div className={itemLabelColor}>{item.name}</div>\n )}\n </div>\n </div>\n );\n })}\n </motion.div>\n\n {/* legend */}\n <div className='space-y-5'>\n {sortedData.map(item => (\n <div\n key={item.key ?? item.name}\n className={classNames('display-flex align-items-center justify-content-end')}\n style={{ height: `${rowHeight}px` }}\n >\n <div className='text-color-darkest'>{valueFormatter(item.value)}</div>\n </div>\n ))}\n </div>\n </div>\n );\n};\n\nBarListInner.displayName = 'BarList';\n\nconst BarList = React.forwardRef(BarListInner) as <T>(\n props: BarListProps<T> & { ref?: React.ForwardedRef<HTMLDivElement> }\n) => ReturnType<typeof BarListInner>;\n\nexport default BarList;\n"],"names":["containerVariants","barVariants","width","DEFAULT_ROW_HEIGHT","DEFAULT_OPACITY","BarListInner","props","forwardedRef","data","valueFormatter","value","showAnimation","onSelectRow","referenceValue","sortOrder","SortDirection","barColor","labelColor","background","rowHeight","opacity","className","remainingProps","sortedData","useSortedBars","item","hoveredIndex","setHoveredIndex","React","widths","useMemo","base","jsxs","classNames","jsx","motion","index","itemLabelColor","itemBarColor","itemBackground","event","BarList"],"mappings":";;;;;;AA4GA,MAAMA,IAA8B;AAAA,EAChC,SAAS;AAAA,IACL,YAAY;AAAA,MACR,iBAAiB;AAAA,IAAA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G,GAAiB,UAAAZ,EAAK,MAAK,EAAA,CAEnD;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBAxCKA,EAAK,OAAOA,EAAK;AAAA,cAAA;AAAA,YA2ClC,CAAC;AAAA,UAAA;AAAA,QAAA;AAAA,0BAIJ,OAAA,EAAI,WAAU,aACV,UAAAF,EAAW,IAAI,CAAAE,MACZ,gBAAAS;AAAA,UAAC;AAAA,UAAA;AAAA,YAEG,WAAWD,EAAW,qDAAqD;AAAA,YAC3E,OAAO,EAAE,QAAQ,GAAGd,CAAS,KAAA;AAAA,YAE7B,4BAAC,OAAA,EAAI,WAAU,sBAAsB,UAAAV,EAAegB,EAAK,KAAK,EAAA,CAAE;AAAA,UAAA;AAAA,UAJ3DA,EAAK,OAAOA,EAAK;AAAA,QAAA,CAM7B,EAAA,CACL;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGZ;AAEApB,EAAa,cAAc;AAE3B,MAAMoC,IAAUb,EAAM,WAAWvB,CAAY;"}
1
+ {"version":3,"file":"BarList.js","sources":["../../../src/components/barList/BarList.tsx"],"sourcesContent":["import React, { useMemo } from 'react';\nimport { motion, type Variants } from 'motion/react';\n\nimport classNames from '../../utils/classNames';\nimport { SortDirection, type SortDirectionType } from '../../utils/SortUtils';\nimport { useSortedBars } from './useSortedBars';\n\n/**\n * A single entry in the BarList.\n *\n * @template T Custom payload merged into the row data.\n */\nexport type BarListRow<T> = T & {\n /**\n * Optional unique identifier. Falls back to `name` when not provided.\n */\n key?: string;\n\n /**\n * Optional URL. When provided, the label renders as a link.\n */\n href?: string;\n\n /**\n * Numeric value used for sorting and bar width calculations.\n */\n value: number;\n\n /**\n * Label shown for the bar.\n */\n name: string;\n\n /**\n * Text color override for this specific row.\n */\n color?: string;\n\n /**\n * Progress color override for this specific row.\n */\n barColor?: string;\n\n /**\n * Background color override for this specific row.\n */\n background?: string;\n};\n\n/**\n * Props for the BarList component.\n *\n * @template T - The type of the custom data associated with each bar row.\n */\ntype BarListProps<T = unknown> = React.HTMLAttributes<HTMLDivElement> & {\n /**\n * Array of bar row data to be rendered.\n */\n data: BarListRow<T>[];\n\n /**\n * Optional function to format the numeric value displayed on the right side of each bar.\n * Can return a string or a React element.\n *\n * @example\n * valueFormatter={(value) => `${value}%`}\n */\n valueFormatter?: (value: number) => string | React.ReactElement;\n\n /**\n * A reference value used to calculate relative widths.\n * If not provided, the maximum value in `data` will be used.\n *\n * @default max(data.value)\n */\n referenceValue?: number;\n\n /**\n * Whether to animate the bar width transitions using Framer Motion.\n *\n * @default false\n */\n showAnimation?: boolean;\n\n /**\n * Callback fired when a bar is clicked.\n *\n * @param payload - The full data object of the clicked bar.\n */\n onSelectRow?: (payload: BarListRow<T>) => void;\n\n /**\n * The sort order for the bars. Options are 'asc', 'desc', or 'none'.\n *\n * @default 'none'\n */\n sortOrder?: SortDirectionType | 'none';\n\n /**\n * Height of each bar row in pixels.\n *\n * @default 32\n */\n rowHeight?: number;\n\n /**\n * Opacity applied to non-hovered bars (between 0 and 1).\n *\n * @default 0.5\n */\n opacity?: number;\n\n /**\n * CSS color string used for the active/progress portion of each bar.\n *\n * @default 'bg-highlight-light'\n */\n barColor?: string;\n\n /**\n * CSS color string used for the text labels.\n *\n * @default 'text-color-darker'\n */\n labelColor?: string;\n\n /**\n * CSS color string used for the bar background.\n *\n * @default 'bg-transparent'\n */\n background?: string;\n\n /**\n * Additional className added to the wrapper element.\n */\n className?: string;\n};\n\n// Animation variants\nconst containerVariants: Variants = {\n animate: {\n transition: {\n staggerChildren: 0.1,\n },\n },\n};\n\nconst barVariants: Variants = {\n initial: { width: 0 },\n animate: (width: number) => ({\n width: `${width}%`,\n transition: { duration: 0.8, ease: 'easeOut' },\n }),\n};\n\nconst DEFAULT_ROW_HEIGHT = 25;\nconst DEFAULT_OPACITY = 0.5;\n\nconst BarListInner = <T,>(props: BarListProps<T>, forwardedRef: React.ForwardedRef<HTMLDivElement>) => {\n const {\n data = [],\n valueFormatter = value => value.toString(),\n showAnimation = false,\n onSelectRow,\n referenceValue,\n sortOrder = SortDirection.DESCENDING,\n barColor = 'bg-highlight-light',\n labelColor = 'text-color-darker',\n background = 'bg-transparent',\n rowHeight = DEFAULT_ROW_HEIGHT,\n opacity = DEFAULT_OPACITY,\n className = '',\n ...remainingProps\n } = props;\n\n const sortedData = useSortedBars(data, sortOrder, item => item.value);\n\n const [hoveredIndex, setHoveredIndex] = React.useState<number | null>(null);\n\n const widths = useMemo(() => {\n const base = referenceValue ?? Math.max(...sortedData.map(item => item.value), 0);\n return sortedData.map(item => (base === 0 || item.value === 0 ? 0 : Math.max((item.value / base) * 100, 2)));\n }, [sortedData, referenceValue]);\n\n return (\n <div\n {...remainingProps}\n ref={forwardedRef}\n className={classNames('display-flex justify-content-between gap-15', className)}\n >\n <motion.div\n variants={showAnimation ? containerVariants : undefined}\n initial='initial'\n animate='animate'\n className='width-100pct space-y-5'\n >\n {sortedData.map((item, index) => {\n const width = widths[index];\n\n const itemLabelColor = item.color ?? labelColor;\n const itemBarColor = item.barColor ?? barColor;\n const itemBackground = item.background ?? background;\n\n return (\n <div\n key={item.key ?? item.name}\n onMouseEnter={() => setHoveredIndex(index)}\n onMouseLeave={() => setHoveredIndex(null)}\n onClick={() => onSelectRow?.(item)}\n className={classNames(\n 'position-relative width-100pct rounded-small',\n 'transition-all transition-ease-in-out transition-duration-01',\n itemBackground,\n onSelectRow && 'cursor-pointer',\n hoveredIndex === index && 'bg-lightest'\n )}\n >\n {/* Animated Progress Bar */}\n <motion.div\n custom={width}\n variants={showAnimation ? barVariants : undefined}\n className={classNames(\n 'display-flex align-items-center rounded-small',\n 'transition-all transition-ease-in-out transition-duration-01',\n itemBarColor\n )}\n style={{ height: `${rowHeight}px`, opacity: hoveredIndex === index ? 1 : opacity }}\n role='presentation'\n />\n\n {/* Label */}\n <div className='position-absolute left-0 top-50pct translate-y-50pct display-flex width-100pct padding-left-10'>\n {item.href ? (\n <a\n href={item.href}\n className={itemLabelColor}\n target='_blank'\n rel='noreferrer'\n onClick={event => event.stopPropagation()}\n >\n {item.name}\n </a>\n ) : (\n <div className={itemLabelColor}>{item.name}</div>\n )}\n </div>\n </div>\n );\n })}\n </motion.div>\n\n {/* legend */}\n <div className='space-y-5'>\n {sortedData.map(item => (\n <div\n key={item.key ?? item.name}\n className={classNames('display-flex align-items-center justify-content-end')}\n style={{ height: `${rowHeight}px` }}\n >\n <div className='text-color-darkest'>{valueFormatter(item.value)}</div>\n </div>\n ))}\n </div>\n </div>\n );\n};\n\nBarListInner.displayName = 'BarList';\n\nconst BarList = React.forwardRef(BarListInner) as <T>(\n props: BarListProps<T> & { ref?: React.ForwardedRef<HTMLDivElement> }\n) => ReturnType<typeof BarListInner>;\n\nexport default BarList;\n"],"names":["containerVariants","barVariants","width","DEFAULT_ROW_HEIGHT","DEFAULT_OPACITY","BarListInner","props","forwardedRef","data","valueFormatter","value","showAnimation","onSelectRow","referenceValue","sortOrder","SortDirection","barColor","labelColor","background","rowHeight","opacity","className","remainingProps","sortedData","useSortedBars","item","hoveredIndex","setHoveredIndex","React","widths","useMemo","base","jsxs","classNames","jsx","motion","index","itemLabelColor","itemBarColor","itemBackground","event","BarList"],"mappings":";;;;;;AA4IA,MAAMA,IAA8B;AAAA,EAChC,SAAS;AAAA,IACL,YAAY;AAAA,MACR,iBAAiB;AAAA,IAAA;AAAA,EACrB;AAER,GAEMC,IAAwB;AAAA,EAC1B,SAAS,EAAE,OAAO,EAAA;AAAA,EAClB,SAAS,CAACC,OAAmB;AAAA,IACzB,OAAO,GAAGA,CAAK;AAAA,IACf,YAAY,EAAE,UAAU,KAAK,MAAM,UAAA;AAAA,EAAU;AAErD,GAEMC,IAAqB,IACrBC,IAAkB,KAElBC,IAAe,CAAKC,GAAwBC,MAAqD;AACnG,QAAM;AAAA,IACF,MAAAC,IAAO,CAAA;AAAA,IACP,gBAAAC,IAAiB,CAAAC,MAASA,EAAM,SAAA;AAAA,IAChC,eAAAC,IAAgB;AAAA,IAChB,aAAAC;AAAA,IACA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AAK,KAAK,EAAA,CAAE;AAAA,UAAA;AAAA,UAJ3DA,EAAK,OAAOA,EAAK;AAAA,QAAA,CAM7B,EAAA,CACL;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGZ;AAEApB,EAAa,cAAc;AAE3B,MAAMoC,IAAUb,EAAM,WAAWvB,CAAY;"}
@@ -2,6 +2,7 @@ import { MutableRefObject, PropsWithChildren, ReactElement, ReactNode } from 're
2
2
  export type BottomSheetProps = {
3
3
  /**
4
4
  * Set the visibility of the bottom sheet. The component is already mounted and just moved offscreen.
5
+ *
5
6
  * @default false
6
7
  */
7
8
  show: boolean;
@@ -36,32 +37,45 @@ export type BottomSheetProps = {
36
37
  showMaximizeButton?: boolean;
37
38
  /**
38
39
  * The callback function triggered when the maximize button is clicked and the height changes.
40
+ *
41
+ * @default () => {}
39
42
  */
40
43
  onHeightChange?: VoidFunction;
41
44
  /**
42
45
  * Set to `true` to detach the bottom sheet from the left side and the bottom and create a little offset.
46
+ *
43
47
  * @default false
44
48
  */
45
49
  detach?: boolean;
46
50
  /**
47
51
  * Defines the amount of pixels for the sheet.
52
+ *
48
53
  * @default 15
49
54
  */
50
55
  detachOffset?: number;
51
56
  /**
52
57
  * Set to `true` to render a modal like backdrop to emphasize the bottom sheet.
58
+ *
53
59
  * @default false
54
60
  */
55
61
  hasBackdrop?: boolean;
56
62
  /**
57
63
  * Callback function triggered when the backdrop is clicked. Usually used to close the bottom sheet.
64
+ *
65
+ * @default () => {}
58
66
  */
59
67
  onBackdropClick?: VoidFunction;
60
- /** A react ref added to the bottom sheet body. */
68
+ /**
69
+ * A react ref added to the bottom sheet body.
70
+ */
61
71
  bodyRef?: MutableRefObject<HTMLDivElement | null>;
62
- /** Additional classes to be set on the body element. */
72
+ /**
73
+ * Additional classes to be set on the body element.
74
+ */
63
75
  bodyClassName?: string;
64
- /** Additional classes to be set on the wrapping element. */
76
+ /**
77
+ * Additional classes to be set on the wrapping element.
78
+ */
65
79
  className?: string;
66
80
  };
67
81
  declare const BottomSheet: (props: BottomSheetProps & PropsWithChildren) => ReactElement;
@@ -1,9 +1,9 @@
1
1
  import { jsxs as n, Fragment as I, jsx as e } from "react/jsx-runtime";
2
2
  import { useState as g, useEffect as M } from "react";
3
3
  import { createPortal as j } from "react-dom";
4
- import f from "classnames";
5
4
  import { motion as R } from "motion/react";
6
5
  import { isFunction as V } from "es-toolkit/predicate";
6
+ import f from "../../utils/classNames.js";
7
7
  import { getOrCreatePortalRoot as _ } from "../../utils/portalRoot.js";
8
8
  const $ = -1e3, r = 15, J = (u) => {
9
9
  const {
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheet.js","sources":["../../../src/components/bottomSheet/BottomSheet.tsx"],"sourcesContent":["import {\n type MutableRefObject,\n type PropsWithChildren,\n type ReactElement,\n type ReactNode,\n useEffect,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport classNames from 'classnames';\nimport { motion } from 'motion/react';\nimport { isFunction } from 'es-toolkit/predicate';\n\nimport { getOrCreatePortalRoot } from '../../utils/portalRoot';\n\nconst OFFSET_POSITION = -1000;\nconst DEFAULT_OFFSET_PX = 15;\n\nexport type BottomSheetProps = {\n /**\n * Set the visibility of the bottom sheet. The component is already mounted and just moved offscreen.\n * @default false\n */\n show: boolean;\n\n /**\n * Callback for when the sheet closes.\n */\n onClose?: (isShown: boolean) => void;\n\n /**\n * The width of the bottom sheet. This is useful for desktop when not using the entire screen width.\n * When no width is given it will take the width of the content and maximum `100%` of the screen.\n * So it this case you might want to apply a `max-width-xxx` via `className` to control it better.\n */\n width?: number | string;\n\n /**\n * The height of the bottom sheet. If no height is given, the height is automatically\n * calculated from the content.\n */\n height?: number | string;\n\n /**\n * The title content shown in the header. If no title is given, the bottom sheet header is not shown.\n */\n title?: string | ReactNode;\n\n /**\n * Defines whether or not the close button is shown.\n * @default true\n */\n showCloseButton?: boolean;\n\n /**\n * Defines whether or not the maximize button in the header is shown.\n * @default false\n */\n showMaximizeButton?: boolean;\n\n /**\n * The callback function triggered when the maximize button is clicked and the height changes.\n */\n onHeightChange?: VoidFunction;\n\n /**\n * Set to `true` to detach the bottom sheet from the left side and the bottom and create a little offset.\n * @default false\n */\n detach?: boolean;\n\n /**\n * Defines the amount of pixels for the sheet.\n * @default 15\n */\n detachOffset?: number;\n\n /**\n * Set to `true` to render a modal like backdrop to emphasize the bottom sheet.\n * @default false\n */\n hasBackdrop?: boolean;\n\n /**\n * Callback function triggered when the backdrop is clicked. Usually used to close the bottom sheet.\n */\n onBackdropClick?: VoidFunction;\n\n /** A react ref added to the bottom sheet body. */\n bodyRef?: MutableRefObject<HTMLDivElement | null>;\n\n /** Additional classes to be set on the body element. */\n bodyClassName?: string;\n\n /** Additional classes to be set on the wrapping element. */\n className?: string;\n};\n\nconst BottomSheet = (props: BottomSheetProps & PropsWithChildren) => {\n const {\n show = false,\n onClose,\n width,\n height,\n title,\n detach = false,\n detachOffset = DEFAULT_OFFSET_PX,\n hasBackdrop = false,\n showCloseButton = true,\n showMaximizeButton = false,\n onHeightChange = () => {},\n bodyRef,\n bodyClassName,\n className,\n children,\n onBackdropClick = () => {},\n ...remainingProps\n } = props;\n\n const [isShown, setIsShown] = useState(show);\n const [isMaxHeight, setIsMaxHeight] = useState(false);\n\n useEffect(() => setIsShown(show), [show]);\n\n const modalRoot = getOrCreatePortalRoot();\n\n const handleToggle = () => {\n const newValue = !isShown;\n if (isFunction(onClose)) {\n onClose(newValue);\n } else {\n setIsShown(newValue);\n }\n };\n\n const handleBackdropClick = () => {\n onBackdropClick();\n handleToggle();\n };\n\n const handleMaximize = () => {\n const newValue = !isMaxHeight;\n setIsMaxHeight(newValue);\n onHeightChange();\n };\n\n const sheetClasses = classNames(\n 'bottom-sheet',\n 'position-fixed left-0',\n !height && !isMaxHeight && 'height-auto',\n 'bg-white',\n 'shadow-hard',\n detach ? 'rounded' : 'rounded-top-left rounded-top-right',\n className && className\n );\n\n const sheetBodyClasses = classNames('bottom-sheet-body', 'height-100pct', bodyClassName && bodyClassName);\n\n const sheetHeight = isMaxHeight ? window.innerHeight : height;\n\n // Note: we always have to kep the body element in the DOM as there might be a ref assigned to it.\n // Unmounting it will lead to losing the reference and breaking the functionality that is implemented on that ref.\n // That is the reason why there is no \"AnimatePresence\" with an \"exit\" animation here.\n // Instead, we change the \"animate\" values.\n\n return createPortal(\n <>\n <motion.div\n {...remainingProps}\n className={sheetClasses}\n style={{\n width,\n maxWidth: detach ? `calc(100% - ${DEFAULT_OFFSET_PX * 2}px)` : '100%',\n margin: detach ? `${DEFAULT_OFFSET_PX}px` : 0,\n }}\n initial={{ opacity: 0 }}\n animate={{\n opacity: isShown ? 1 : 0,\n y: 0,\n bottom: isShown ? 0 : OFFSET_POSITION,\n height: isShown ? sheetHeight : 0,\n }}\n >\n <div className='bottom-sheet-header'>\n {title && (\n <div\n className={\n 'bottom-sheet-title display-flex justify-content-between padding-15 ' +\n 'border border-top-none border-left-none border-right-none border-color-lighter'\n }\n >\n <div className='text-size-18'>{title}</div>\n </div>\n )}\n {showCloseButton && (\n <div className='bottom-sheet-close position-absolute top-10 right-10'>\n <button type='button' className='btn btn-muted btn-sm btn-icon-only' onClick={handleToggle}>\n <span className='rioglyph rioglyph-remove' />\n </button>\n </div>\n )}\n {showMaximizeButton && (\n <div\n className={\n 'bottom-sheet-maximize height-30 ' +\n 'position-absolute top-5 left-50pct translate-x-50 cursor-pointer'\n }\n onClick={handleMaximize}\n >\n <div className='height-5 width-40 rounded bg-lighter' />\n </div>\n )}\n </div>\n <div className={sheetBodyClasses} ref={bodyRef}>\n {isShown && children}\n </div>\n </motion.div>\n\n {hasBackdrop && isShown && <div className='bottom-sheet-backdrop' onClick={handleBackdropClick} />}\n </>,\n modalRoot\n ) as ReactElement;\n};\n\nexport default BottomSheet;\n"],"names":["OFFSET_POSITION","DEFAULT_OFFSET_PX","BottomSheet","props","show","onClose","width","height","title","detach","detachOffset","hasBackdrop","showCloseButton","showMaximizeButton","onHeightChange","bodyRef","bodyClassName","className","children","onBackdropClick","remainingProps","isShown","setIsShown","useState","isMaxHeight","setIsMaxHeight","useEffect","modalRoot","getOrCreatePortalRoot","handleToggle","newValue","isFunction","handleBackdropClick","handleMaximize","sheetClasses","classNames","sheetBodyClasses","sheetHeight","createPortal","jsxs","Fragment","motion","jsx"],"mappings":";;;;;;;AAeA,MAAMA,IAAkB,MAClBC,IAAoB,IAkFpBC,IAAc,CAACC,MAAgD;AACjE,QAAM;AAAA,IACF,MAAAC,IAAO;AAAA,IACP,SAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC,IAAS;AAAA,IACT,cAAAC,IAAeT;AAAA,IACf,aAAAU,IAAc;AAAA,IACd,iBAAAC,IAAkB;AAAA,IAClB,oBAAAC,IAAqB;AAAA,IACrB,gBAAAC,IAAiB,MAAM;AAAA,IAAC;AAAA,IACxB,SAAAC;AAAA,IACA,eAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,iBAAAC,IAAkB,MAAM;AAAA,IAAC;AAAA,IACzB,GAAGC;AAAA,EAAA,IACHjB,GAEE,CAACkB,GAASC,CAAU,IAAIC,EAASnB,CAAI,GACrC,CAACoB,GAAaC,CAAc,IAAIF,EAAS,EAAK;AAEpD,EAAAG,EAAU,MAAMJ,EAAWlB,CAAI,GAAG,CAACA,CAAI,CAAC;AAExC,QAAMuB,IAAYC,EAAA,GAEZC,IAAe,MAAM;AACvB,UAAMC,IAAW,CAACT;AAClB,IAAIU,EAAW1B,CAAO,IAClBA,EAAQyB,CAAQ,IAEhBR,EAAWQ,CAAQ;AAAA,EAE3B,GAEME,IAAsB,MAAM;AAC9B,IAAAb,EAAA,GACAU,EAAA;AAAA,EACJ,GAEMI,IAAiB,MAAM;AAEzB,IAAAR,EADiB,CAACD,CACK,GACvBV,EAAA;AAAA,EACJ,GAEMoB,IAAeC;AAAA,IACjB;AAAA,IACA;AAAA,IACA,CAAC5B,KAAU,CAACiB,KAAe;AAAA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uCAAA,CAAuC;AAAA,gBAAA;AAAA,cAAA;AAAA,YAC1D,GAER;AAAA,8BACC,OAAA,EAAI,WAAWN,GAAkB,KAAKrB,GAClC,eAAWG,EAAA,CAChB;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,MAGHP,KAAeU,KAAW,gBAAAqB,EAAC,SAAI,WAAU,yBAAwB,SAASV,EAAA,CAAqB;AAAA,IAAA,GACpG;AAAA,IACAL;AAAA,EAAA;AAER;"}
1
+ {"version":3,"file":"BottomSheet.js","sources":["../../../src/components/bottomSheet/BottomSheet.tsx"],"sourcesContent":["import {\n type MutableRefObject,\n type PropsWithChildren,\n type ReactElement,\n type ReactNode,\n useEffect,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\nimport { motion } from 'motion/react';\nimport { isFunction } from 'es-toolkit/predicate';\n\nimport classNames from '../../utils/classNames';\nimport { getOrCreatePortalRoot } from '../../utils/portalRoot';\n\nconst OFFSET_POSITION = -1000;\nconst DEFAULT_OFFSET_PX = 15;\n\nexport type BottomSheetProps = {\n /**\n * Set the visibility of the bottom sheet. The component is already mounted and just moved offscreen.\n *\n * @default false\n */\n show: boolean;\n\n /**\n * Callback for when the sheet closes.\n */\n onClose?: (isShown: boolean) => void;\n\n /**\n * The width of the bottom sheet. This is useful for desktop when not using the entire screen width.\n * When no width is given it will take the width of the content and maximum `100%` of the screen.\n * So it this case you might want to apply a `max-width-xxx` via `className` to control it better.\n */\n width?: number | string;\n\n /**\n * The height of the bottom sheet. If no height is given, the height is automatically\n * calculated from the content.\n */\n height?: number | string;\n\n /**\n * The title content shown in the header. If no title is given, the bottom sheet header is not shown.\n */\n title?: string | ReactNode;\n\n /**\n * Defines whether or not the close button is shown.\n * @default true\n */\n showCloseButton?: boolean;\n\n /**\n * Defines whether or not the maximize button in the header is shown.\n * @default false\n */\n showMaximizeButton?: boolean;\n\n /**\n * The callback function triggered when the maximize button is clicked and the height changes.\n *\n * @default () => {}\n */\n onHeightChange?: VoidFunction;\n\n /**\n * Set to `true` to detach the bottom sheet from the left side and the bottom and create a little offset.\n *\n * @default false\n */\n detach?: boolean;\n\n /**\n * Defines the amount of pixels for the sheet.\n *\n * @default 15\n */\n detachOffset?: number;\n\n /**\n * Set to `true` to render a modal like backdrop to emphasize the bottom sheet.\n *\n * @default false\n */\n hasBackdrop?: boolean;\n\n /**\n * Callback function triggered when the backdrop is clicked. Usually used to close the bottom sheet.\n *\n * @default () => {}\n */\n onBackdropClick?: VoidFunction;\n\n /**\n * A react ref added to the bottom sheet body.\n */\n bodyRef?: MutableRefObject<HTMLDivElement | null>;\n\n /**\n * Additional classes to be set on the body element.\n */\n bodyClassName?: string;\n\n /**\n * Additional classes to be set on the wrapping element.\n */\n className?: string;\n};\n\nconst BottomSheet = (props: BottomSheetProps & PropsWithChildren) => {\n const {\n show = false,\n onClose,\n width,\n height,\n title,\n detach = false,\n detachOffset = DEFAULT_OFFSET_PX,\n hasBackdrop = false,\n showCloseButton = true,\n showMaximizeButton = false,\n onHeightChange = () => {},\n bodyRef,\n bodyClassName,\n className,\n children,\n onBackdropClick = () => {},\n ...remainingProps\n } = props;\n\n const [isShown, setIsShown] = useState(show);\n const [isMaxHeight, setIsMaxHeight] = useState(false);\n\n useEffect(() => setIsShown(show), [show]);\n\n const modalRoot = getOrCreatePortalRoot();\n\n const handleToggle = () => {\n const newValue = !isShown;\n if (isFunction(onClose)) {\n onClose(newValue);\n } else {\n setIsShown(newValue);\n }\n };\n\n const handleBackdropClick = () => {\n onBackdropClick();\n handleToggle();\n };\n\n const handleMaximize = () => {\n const newValue = !isMaxHeight;\n setIsMaxHeight(newValue);\n onHeightChange();\n };\n\n const sheetClasses = classNames(\n 'bottom-sheet',\n 'position-fixed left-0',\n !height && !isMaxHeight && 'height-auto',\n 'bg-white',\n 'shadow-hard',\n detach ? 'rounded' : 'rounded-top-left rounded-top-right',\n className && className\n );\n\n const sheetBodyClasses = classNames('bottom-sheet-body', 'height-100pct', bodyClassName && bodyClassName);\n\n const sheetHeight = isMaxHeight ? window.innerHeight : height;\n\n // Note: we always have to kep the body element in the DOM as there might be a ref assigned to it.\n // Unmounting it will lead to losing the reference and breaking the functionality that is implemented on that ref.\n // That is the reason why there is no \"AnimatePresence\" with an \"exit\" animation here.\n // Instead, we change the \"animate\" values.\n\n return createPortal(\n <>\n <motion.div\n {...remainingProps}\n className={sheetClasses}\n style={{\n width,\n maxWidth: detach ? `calc(100% - ${DEFAULT_OFFSET_PX * 2}px)` : '100%',\n margin: detach ? `${DEFAULT_OFFSET_PX}px` : 0,\n }}\n initial={{ opacity: 0 }}\n animate={{\n opacity: isShown ? 1 : 0,\n y: 0,\n bottom: isShown ? 0 : OFFSET_POSITION,\n height: isShown ? sheetHeight : 0,\n }}\n >\n <div className='bottom-sheet-header'>\n {title && (\n <div\n className={\n 'bottom-sheet-title display-flex justify-content-between padding-15 ' +\n 'border border-top-none border-left-none border-right-none border-color-lighter'\n }\n >\n <div className='text-size-18'>{title}</div>\n </div>\n )}\n {showCloseButton && (\n <div className='bottom-sheet-close position-absolute top-10 right-10'>\n <button type='button' className='btn btn-muted btn-sm btn-icon-only' onClick={handleToggle}>\n <span className='rioglyph rioglyph-remove' />\n </button>\n </div>\n )}\n {showMaximizeButton && (\n <div\n className={\n 'bottom-sheet-maximize height-30 ' +\n 'position-absolute top-5 left-50pct translate-x-50 cursor-pointer'\n }\n onClick={handleMaximize}\n >\n <div className='height-5 width-40 rounded bg-lighter' />\n </div>\n )}\n </div>\n <div className={sheetBodyClasses} ref={bodyRef}>\n {isShown && children}\n </div>\n </motion.div>\n\n {hasBackdrop && isShown && <div className='bottom-sheet-backdrop' onClick={handleBackdropClick} />}\n </>,\n modalRoot\n ) as ReactElement;\n};\n\nexport default BottomSheet;\n"],"names":["OFFSET_POSITION","DEFAULT_OFFSET_PX","BottomSheet","props","show","onClose","width","height","title","detach","detachOffset","hasBackdrop","showCloseButton","showMaximizeButton","onHeightChange","bodyRef","bodyClassName","className","children","onBackdropClick","remainingProps","isShown","setIsShown","useState","isMaxHeight","setIsMaxHeight","useEffect","modalRoot","getOrCreatePortalRoot","handleToggle","newValue","isFunction","handleBackdropClick","handleMaximize","sheetClasses","classNames","sheetBodyClasses","sheetHeight","createPortal","jsxs","Fragment","motion","jsx"],"mappings":";;;;;;;AAeA,MAAMA,IAAkB,MAClBC,IAAoB,IAgGpBC,IAAc,CAACC,MAAgD;AACjE,QAAM;AAAA,IACF,MAAAC,IAAO;AAAA,IACP,SAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC;AAAA,IACA,OAAAC;AAAA,IACA,QAAAC,IAAS;AAAA,IACT,cAAAC,IAAeT;AAAA,IACf,aAAAU,IAAc;AAAA,IACd,iBAAAC,IAAkB;AAAA,IAClB,oBAAAC,IAAqB;AAAA,IACrB,gBAAAC,IAAiB,MAAM;AAAA,IAAC;AAAA,IACxB,SAAAC;AAAA,IACA,eAAAC;AAAA,IACA,WAAAC;AAAA,IACA,UAAAC;AAAA,IACA,iBAAAC,IAAkB,MAAM;AAAA,IAAC;AAAA,IACzB,GAAGC;AAAA,EAAA,IACHjB,GAEE,CAACkB,GAASC,CAAU,IAAIC,EAASnB,CAAI,GACrC,CAACoB,GAAaC,CAAc,IAAIF,EAAS,EAAK;AAEpD,EAAAG,EAAU,MAAMJ,EAAWlB,CAAI,GAAG,CAACA,CAAI,CAAC;AAExC,QAAMuB,IAAYC,EAAA,GAEZC,IAAe,MAAM;AACvB,UAAMC,IAAW,CAACT;AAClB,IAAIU,EAAW1B,CAAO,IAClBA,EAAQyB,CAAQ,IAEhBR,EAAWQ,CAAQ;AAAA,EAE3B,GAEME,IAAsB,MAAM;AAC9B,IAAAb,EAAA,GACAU,EAAA;AAAA,EACJ,GAEMI,IAAiB,MAAM;AAEzB,IAAAR,EADiB,CAACD,CACK,GACvBV,EAAA;AAAA,EACJ,GAEMoB,IAAeC;AAAA,IACjB;AAAA,IACA;AAAA,IACA,CAAC5B,KAAU,CAACiB,KAAe;AAAA,IAC3B;A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AuC;AAAA,gBAAA;AAAA,cAAA;AAAA,YAC1D,GAER;AAAA,8BACC,OAAA,EAAI,WAAWN,GAAkB,KAAKrB,GAClC,eAAWG,EAAA,CAChB;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,MAGHP,KAAeU,KAAW,gBAAAqB,EAAC,SAAI,WAAU,yBAAwB,SAASV,EAAA,CAAqB;AAAA,IAAA,GACpG;AAAA,IACAL;AAAA,EAAA;AAER;"}
@@ -4,6 +4,8 @@ type TimedBottomSheetProps = {
4
4
  * The `dismissed` flag can be used to tell this component that the user has clicked on the content
5
5
  * of the component like a button or a link. In this case, the bottom sheet will store a flag in the
6
6
  * localStorage to hide the bottom sheet for the next time and it will close the sheet right away.
7
+ *
8
+ * @default false
7
9
  */
8
10
  dismissed?: boolean;
9
11
  /**
@@ -27,11 +29,13 @@ type TimedBottomSheetProps = {
27
29
  hideAfter?: number;
28
30
  /**
29
31
  * With this enabled, the BottomSheet will not hide automatically.
32
+ *
30
33
  * @default false
31
34
  */
32
35
  alwaysOn?: boolean;
33
36
  /**
34
37
  * Enables or disabled the close button.
38
+ *
35
39
  * @default true
36
40
  */
37
41
  showCloseButton?: boolean;
@@ -41,6 +45,8 @@ type TimedBottomSheetProps = {
41
45
  width?: number;
42
46
  /**
43
47
  * Flag to allow to remove the localStorage flag again once the component is not needed anymore.
48
+ *
49
+ * @default false
44
50
  */
45
51
  cleanupLocalStorage?: boolean;
46
52
  /**
@@ -51,11 +57,15 @@ type TimedBottomSheetProps = {
51
57
  localStoragePrefix?: string;
52
58
  /**
53
59
  * Callback function that gets triggered when the user closed the bottom sheet with the close button.
60
+ *
61
+ * @default () => {}
54
62
  * @returns void
55
63
  */
56
64
  onClose?: () => void;
57
65
  /**
58
66
  * Optional className to be set on the body.
67
+ *
68
+ * @default 'padding-25 margin-right-25'
59
69
  */
60
70
  bodyClassName?: string;
61
71
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"TimedBottomSheet.js","sources":["../../../src/components/bottomSheet/TimedBottomSheet.tsx"],"sourcesContent":["import { useState, useEffect, type PropsWithChildren } from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport BottomSheet from './BottomSheet';\nimport useTimeout from '../../hooks/useTimeout';\nimport useLocalStorage from '../../useLocalStorage';\n\nconst DEFAULT_SHOW_AFTER = 0; // immediately after mount\nconst DEFAULT_HIDE_AFTER = 3_600_000; // after 1 hour\n\n// Features:\n// [x] show delayed\n// [x] option to hide automatically after x\n// [x] store closed user state in localStorage\n// [x] don't show when user has clicked to hide - per feature\n// [x] Cleanup localStorage feature\n// [x] hide on click inside of content (button or link, etc.) - control from outside\n// [-] GA tracking of user hide click - should be done outside\n\ntype TimedBottomSheetProps = {\n /**\n * The `dismissed` flag can be used to tell this component that the user has clicked on the content\n * of the component like a button or a link. In this case, the bottom sheet will store a flag in the\n * localStorage to hide the bottom sheet for the next time and it will close the sheet right away.\n */\n dismissed?: boolean;\n\n /**\n * The `featureName` prop is used to name the localStorage flag that is used to control the visibility.\n * It should be unique to avoid conflicts with other timed bottom sheets.\n */\n featureName: string;\n\n /**\n * Defines the time in milliseconds when the bottom sheet shall be shown. Default value is 0 to show it right away.\n *\n * @default 0\n */\n showAfter?: number;\n\n /**\n * Defines the time in milliseconds when the bottom sheet hides itself automatically. Default value is 3_600_000\n * to hide it after 1 hour. In this case, the localStorage flag is not set and the bottom sheet will be shown\n * on the next page load.\n *\n * @default 3_600_000\n */\n hideAfter?: number;\n\n /**\n * With this enabled, the BottomSheet will not hide automatically.\n * @default false\n */\n alwaysOn?: boolean;\n\n /**\n * Enables or disabled the close button.\n * @default true\n */\n showCloseButton?: boolean;\n\n /**\n * Optional width of the bottom sheet. Alternatively, you can set a `max-width-xxx` via className instead.\n */\n width?: number;\n\n /**\n * Flag to allow to remove the localStorage flag again once the component is not needed anymore.\n */\n cleanupLocalStorage?: boolean;\n\n /**\n * A prefix that will be used for the local storage flag to store whether the bottom sheet should be hidden.\n *\n * Use this prefix for your service name for instance.\n */\n localStoragePrefix?: string;\n\n /**\n * Callback function that gets triggered when the user closed the bottom sheet with the close button.\n * @returns void\n */\n onClose?: () => void;\n\n /**\n * Optional className to be set on the body.\n */\n bodyClassName?: string;\n\n /**\n * Optional className to be set on the component. Use this to define a max-width value.\n */\n className?: string;\n};\n\nconst sanitizeFeatureName = (value: string) => `${value.charAt(0).toUpperCase()}${value.slice(1)}`.replaceAll(' ', '');\n\n/**\n * A wrapper component for the BottomSheet that allows to control it's visibility via timers and to use\n * the localStorage to save user interaction.\n *\n * Don't forget to cleanup the localStorage for the user when removing a feature\n * by setting \"cleanupLocalStorage\" to \"true\" and deploy it like this.\n * The cleanup will remove the localStorage flag on mount and will not show the bottom sheet.\n *\n * @example\n const [isDismissed, setIsDismissed] = useState(false);\n\n const handleClose = () => { // If needed trigger Google Analytics here };\n\n return (\n <TimedBottomSheet\n dismissed={isDismissed}\n featureName='dummyBottomSheet'\n showAfter={1_000}\n hideAfter={15_000}\n className='max-width-500'\n onClose={handleClose}\n >\n <div className='display-flex align-items-center gap-20'>\n Lorem ipsum dolor sit amet\n <Button bsStyle={Button.PRIMARY} onClick={() => setIsDismissed(true)}>\n Got it\n </Button>\n </div>\n </TimedBottomSheet>\n );\n */\nexport const TimedBottomSheet = (props: PropsWithChildren<TimedBottomSheetProps>) => {\n const {\n dismissed = false,\n featureName,\n showAfter = DEFAULT_SHOW_AFTER,\n hideAfter = DEFAULT_HIDE_AFTER,\n alwaysOn = false,\n showCloseButton = true,\n width,\n cleanupLocalStorage = false,\n onClose = noop,\n bodyClassName = 'padding-25 margin-right-25',\n localStoragePrefix = '',\n className,\n children,\n ...remainingProps\n } = props;\n\n const [showBottomSheet, setShowBottomSheet] = useState(false);\n\n const [isHiddenByUser, setIsHiddenByUser, removeIsHiddenFlag] = useLocalStorage(\n `${localStoragePrefix}hide${sanitizeFeatureName(featureName)}`,\n false\n );\n\n // In case the visibility is controlled by the outside, means the user clicked on the\n // content of the bottom sheet, close the sheet and set the localStorage flag for not\n // showing it again\n const [prevDismissed, setPrevDismissed] = useState(dismissed);\n if (dismissed && dismissed !== prevDismissed) {\n setPrevDismissed(dismissed);\n setIsHiddenByUser(true);\n setShowBottomSheet(false);\n }\n\n // Show the bottom sheet automatically after a given amount of time\n useTimeout(() => {\n if (!dismissed && !isHiddenByUser && !cleanupLocalStorage) {\n setShowBottomSheet(true);\n }\n }, showAfter);\n\n // Hide the bottom sheet automatically after a given amount of time\n useTimeout(() => setShowBottomSheet(alwaysOn ? true : false), showAfter + hideAfter);\n\n // Cleanup functionality. The cleanup will remove the localStorage flag on mount\n // and will not show the bottom sheet.\n useEffect(() => {\n if (cleanupLocalStorage) {\n removeIsHiddenFlag();\n }\n }, []);\n\n const handleCloseBottomSheet = () => {\n setShowBottomSheet(false);\n setIsHiddenByUser(true);\n onClose();\n };\n\n return (\n <div {...remainingProps}>\n <BottomSheet\n show={showBottomSheet}\n width={width}\n detach\n showCloseButton={showCloseButton}\n onClose={handleCloseBottomSheet}\n className={className}\n bodyClassName={bodyClassName}\n >\n {children}\n </BottomSheet>\n </div>\n );\n};\n\nexport default TimedBottomSheet;\n"],"names":["DEFAULT_SHOW_AFTER","DEFAULT_HIDE_AFTER","sanitizeFeatureName","value","TimedBottomSheet","props","dismissed","featureName","showAfter","hideAfter","alwaysOn","showCloseButton","width","cleanupLocalStorage","onClose","noop","bodyClassName","localStoragePrefix","className","children","remainingProps","showBottomSheet","setShowBottomSheet","useState","isHiddenByUser","setIsHiddenByUser","removeIsHiddenFlag","useLocalStorage","prevDismissed","setPrevDismissed","useTimeout","useEffect","jsx","BottomSheet"],"mappings":";;;;;;AAOA,MAAMA,IAAqB,GACrBC,IAAqB,MAuFrBC,IAAsB,CAACC,MAAkB,GAAGA,EAAM,OAAO,CAAC,EAAE,YAAA,CAAa,GAAGA,EAAM,MAAM,CAAC,CAAC,GAAG,WAAW,KAAK,EAAE,GAiCxGC,IAAmB,CAACC,MAAoD;AACjF,QAAM;AAAA,IACF,WAAAC,IAAY;AA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;"}
1
+ {"version":3,"file":"TimedBottomSheet.js","sources":["../../../src/components/bottomSheet/TimedBottomSheet.tsx"],"sourcesContent":["import { useState, useEffect, type PropsWithChildren } from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport BottomSheet from './BottomSheet';\nimport useTimeout from '../../hooks/useTimeout';\nimport useLocalStorage from '../../useLocalStorage';\n\nconst DEFAULT_SHOW_AFTER = 0; // immediately after mount\nconst DEFAULT_HIDE_AFTER = 3_600_000; // after 1 hour\n\n// Features:\n// [x] show delayed\n// [x] option to hide automatically after x\n// [x] store closed user state in localStorage\n// [x] don't show when user has clicked to hide - per feature\n// [x] Cleanup localStorage feature\n// [x] hide on click inside of content (button or link, etc.) - control from outside\n// [-] GA tracking of user hide click - should be done outside\n\ntype TimedBottomSheetProps = {\n /**\n * The `dismissed` flag can be used to tell this component that the user has clicked on the content\n * of the component like a button or a link. In this case, the bottom sheet will store a flag in the\n * localStorage to hide the bottom sheet for the next time and it will close the sheet right away.\n *\n * @default false\n */\n dismissed?: boolean;\n\n /**\n * The `featureName` prop is used to name the localStorage flag that is used to control the visibility.\n * It should be unique to avoid conflicts with other timed bottom sheets.\n */\n featureName: string;\n\n /**\n * Defines the time in milliseconds when the bottom sheet shall be shown. Default value is 0 to show it right away.\n *\n * @default 0\n */\n showAfter?: number;\n\n /**\n * Defines the time in milliseconds when the bottom sheet hides itself automatically. Default value is 3_600_000\n * to hide it after 1 hour. In this case, the localStorage flag is not set and the bottom sheet will be shown\n * on the next page load.\n *\n * @default 3_600_000\n */\n hideAfter?: number;\n\n /**\n * With this enabled, the BottomSheet will not hide automatically.\n *\n * @default false\n */\n alwaysOn?: boolean;\n\n /**\n * Enables or disabled the close button.\n *\n * @default true\n */\n showCloseButton?: boolean;\n\n /**\n * Optional width of the bottom sheet. Alternatively, you can set a `max-width-xxx` via className instead.\n */\n width?: number;\n\n /**\n * Flag to allow to remove the localStorage flag again once the component is not needed anymore.\n *\n * @default false\n */\n cleanupLocalStorage?: boolean;\n\n /**\n * A prefix that will be used for the local storage flag to store whether the bottom sheet should be hidden.\n *\n * Use this prefix for your service name for instance.\n */\n localStoragePrefix?: string;\n\n /**\n * Callback function that gets triggered when the user closed the bottom sheet with the close button.\n *\n * @default () => {}\n * @returns void\n */\n onClose?: () => void;\n\n /**\n * Optional className to be set on the body.\n *\n * @default 'padding-25 margin-right-25'\n */\n bodyClassName?: string;\n\n /**\n * Optional className to be set on the component. Use this to define a max-width value.\n */\n className?: string;\n};\n\nconst sanitizeFeatureName = (value: string) => `${value.charAt(0).toUpperCase()}${value.slice(1)}`.replaceAll(' ', '');\n\n/**\n * A wrapper component for the BottomSheet that allows to control it's visibility via timers and to use\n * the localStorage to save user interaction.\n *\n * Don't forget to cleanup the localStorage for the user when removing a feature\n * by setting \"cleanupLocalStorage\" to \"true\" and deploy it like this.\n * The cleanup will remove the localStorage flag on mount and will not show the bottom sheet.\n *\n * @example\n const [isDismissed, setIsDismissed] = useState(false);\n\n const handleClose = () => { // If needed trigger Google Analytics here };\n\n return (\n <TimedBottomSheet\n dismissed={isDismissed}\n featureName='dummyBottomSheet'\n showAfter={1_000}\n hideAfter={15_000}\n className='max-width-500'\n onClose={handleClose}\n >\n <div className='display-flex align-items-center gap-20'>\n Lorem ipsum dolor sit amet\n <Button bsStyle={Button.PRIMARY} onClick={() => setIsDismissed(true)}>\n Got it\n </Button>\n </div>\n </TimedBottomSheet>\n );\n */\nexport const TimedBottomSheet = (props: PropsWithChildren<TimedBottomSheetProps>) => {\n const {\n dismissed = false,\n featureName,\n showAfter = DEFAULT_SHOW_AFTER,\n hideAfter = DEFAULT_HIDE_AFTER,\n alwaysOn = false,\n showCloseButton = true,\n width,\n cleanupLocalStorage = false,\n onClose = noop,\n bodyClassName = 'padding-25 margin-right-25',\n localStoragePrefix = '',\n className,\n children,\n ...remainingProps\n } = props;\n\n const [showBottomSheet, setShowBottomSheet] = useState(false);\n\n const [isHiddenByUser, setIsHiddenByUser, removeIsHiddenFlag] = useLocalStorage(\n `${localStoragePrefix}hide${sanitizeFeatureName(featureName)}`,\n false\n );\n\n // In case the visibility is controlled by the outside, means the user clicked on the\n // content of the bottom sheet, close the sheet and set the localStorage flag for not\n // showing it again\n const [prevDismissed, setPrevDismissed] = useState(dismissed);\n if (dismissed && dismissed !== prevDismissed) {\n setPrevDismissed(dismissed);\n setIsHiddenByUser(true);\n setShowBottomSheet(false);\n }\n\n // Show the bottom sheet automatically after a given amount of time\n useTimeout(() => {\n if (!dismissed && !isHiddenByUser && !cleanupLocalStorage) {\n setShowBottomSheet(true);\n }\n }, showAfter);\n\n // Hide the bottom sheet automatically after a given amount of time\n useTimeout(() => setShowBottomSheet(alwaysOn ? true : false), showAfter + hideAfter);\n\n // Cleanup functionality. The cleanup will remove the localStorage flag on mount\n // and will not show the bottom sheet.\n useEffect(() => {\n if (cleanupLocalStorage) {\n removeIsHiddenFlag();\n }\n }, []);\n\n const handleCloseBottomSheet = () => {\n setShowBottomSheet(false);\n setIsHiddenByUser(true);\n onClose();\n };\n\n return (\n <div {...remainingProps}>\n <BottomSheet\n show={showBottomSheet}\n width={width}\n detach\n showCloseButton={showCloseButton}\n onClose={handleCloseBottomSheet}\n className={className}\n bodyClassName={bodyClassName}\n >\n {children}\n </BottomSheet>\n </div>\n );\n};\n\nexport default TimedBottomSheet;\n"],"names":["DEFAULT_SHOW_AFTER","DEFAULT_HIDE_AFTER","sanitizeFeatureName","value","TimedBottomSheet","props","dismissed","featureName","showAfter","hideAfter","alwaysOn","showCloseButton","width","cleanupLocalStorage","onClose","noop","bodyClassName","localStoragePrefix","className","children","remainingProps","showBottomSheet","setShowBottomSheet","useState","isHiddenByUser","setIsHiddenByUser","removeIsHiddenFlag","useLocalStorage","prevDismissed","setPrevDismissed","useTimeout","useEffect","jsx","BottomSheet"],"mappings":";;;;;;AAOA,MAAMA,IAAqB,GACrBC,IAAqB,MAiGrBC,IAAsB,CAACC,MAAkB,GAAGA,EAAM,OAAO,CAAC,EAAE,YAAA,CAAa,GAAG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AAI,GACtBX,EAAA;AAAA,MACJ;AAAA,MAUY,WAAAI;AAAA,MACA,eAAAF;AAAA,MAEC,UAAAG;AAAA,IAAA;AAAA,EAAA,GAET;AAER;"}
@@ -30,11 +30,13 @@ export type BUTTON_SIZE = ObjectValues<typeof SIZES_MAP>;
30
30
  type RegularButton = {
31
31
  /**
32
32
  * Use the button as a toggle button. The toggle state can be controlled via the `active` prop.
33
+ *
33
34
  * @default false
34
35
  */
35
36
  asToggle?: false;
36
37
  /**
37
38
  * Callback function triggered when clicking the button.
39
+ *
38
40
  * @param event The MouseEvent that triggered the click.
39
41
  */
40
42
  onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
@@ -42,16 +44,18 @@ type RegularButton = {
42
44
  type ToggleButton = {
43
45
  /**
44
46
  * Use the button as a toggle button. The toggle state can be controlled via the `active` prop.
47
+ *
45
48
  * @default false
46
49
  */
47
50
  asToggle: true;
48
51
  /**
49
52
  * Callback function triggered when clicking the button.
53
+ *
50
54
  * @param value The new value of the toggle button.
51
55
  */
52
56
  onClick?: (value: boolean) => void;
53
57
  };
54
- export type ButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'type' | 'onClick'> & {
58
+ type BaseButtonProps = {
55
59
  /**
56
60
  * Whether the button should be disabled.
57
61
  *
@@ -60,22 +64,20 @@ export type ButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'type' | 'onClick'>
60
64
  disabled?: boolean;
61
65
  /**
62
66
  * Set the button toggled. Should be used in combination with "asToggle" prop.
67
+ *
63
68
  * @default false
64
69
  */
65
70
  active?: boolean;
66
- /**
67
- * Defines the type of the button. This may be used for form submit buttons.
68
- * @default 'button'
69
- */
70
- type?: 'button' | 'submit';
71
71
  /**
72
72
  * Use when the content of the button is an icon only to adapt the button spacing accordingly.
73
+ *
73
74
  * @default false
74
75
  */
75
76
  iconOnly?: boolean;
76
77
  /**
77
78
  * Adds right side spacing for an icon. This should be used when having navigation buttons
78
79
  * that use an icon on the right side.
80
+ *
79
81
  * @default false
80
82
  */
81
83
  iconRight?: boolean;
@@ -88,17 +90,19 @@ export type ButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'type' | 'onClick'>
88
90
  * Defines whether the button text break into multiple lines when the button space exceeds.
89
91
  *
90
92
  * Multiline buttons should be used as exception only.
93
+ *
91
94
  * @default false
92
95
  */
93
96
  multiline?: boolean;
94
97
  /**
95
98
  * Defines whether the button takes up the full width of the parent element.
99
+ *
96
100
  * @default false
97
101
  */
98
102
  block?: boolean;
99
103
  /**
100
104
  * Sets the button style.
101
- * @default "default"
105
+ * @default 'default'
102
106
  */
103
107
  bsStyle?: BUTTON_STYLE;
104
108
  /**
@@ -115,6 +119,7 @@ export type ButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'type' | 'onClick'>
115
119
  noRippleEffect?: boolean;
116
120
  /**
117
121
  * Number of the index used for keyboard support.
122
+ *
118
123
  * @default 0
119
124
  */
120
125
  tabIndex?: number;
@@ -122,7 +127,48 @@ export type ButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'type' | 'onClick'>
122
127
  * Additional classes to be set on the button element.
123
128
  */
124
129
  className?: string;
130
+ };
131
+ type NativeButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'as' | 'type' | 'onClick' | 'ref'> & BaseButtonProps & {
132
+ /**
133
+ * Defines this component as a native button element.
134
+ *
135
+ * @default 'button'
136
+ */
137
+ as?: 'button';
138
+ /**
139
+ * Defines the type of the button. This may be used for form submit buttons.
140
+ *
141
+ * @default 'button'
142
+ */
143
+ type?: 'button' | 'submit';
125
144
  } & (RegularButton | ToggleButton);
145
+ type LinkButtonProps = Omit<HTMLProps<HTMLAnchorElement>, 'as' | 'type' | 'onClick' | 'ref'> & BaseButtonProps & {
146
+ /**
147
+ * Defines this component as a link element.
148
+ */
149
+ as: 'a';
150
+ /**
151
+ * Native button type is not supported when using `as="a"`.
152
+ */
153
+ type?: never;
154
+ /**
155
+ * Defines the destination URL for the link button.
156
+ */
157
+ href: string;
158
+ /**
159
+ * Toggle behavior is not supported when using `as="a"`.
160
+ *
161
+ * @default false
162
+ */
163
+ asToggle?: false;
164
+ /**
165
+ * Callback function triggered when clicking the link.
166
+ *
167
+ * @param event The MouseEvent that triggered the click.
168
+ */
169
+ onClick?: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void;
170
+ };
171
+ export type ButtonProps = NativeButtonProps | LinkButtonProps;
126
172
  type Props = PropsWithChildren<ButtonProps>;
127
173
  type ButtonType = ForwardRefExoticComponent<Props & RefAttributes<HTMLButtonElement>> & {
128
174
  DEFAULT: 'default';