@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 +1 @@
1
- {"version":3,"file":"SimpleTooltip.js","sources":["../../../src/components/tooltip/SimpleTooltip.tsx"],"sourcesContent":["import React, { type MutableRefObject, type PropsWithChildren } from 'react';\n\nimport Tooltip, { type TooltipProps } from './Tooltip';\nimport OverlayTrigger from '../overlay/OverlayTrigger';\nimport { PLACEMENT } from '../../values/Placement';\nimport { TRIGGER, type TriggerType } from '../../values/Trigger';\n\nexport type delayProp = {\n show: number;\n hide: number;\n};\n\nexport type SimpleTooltipProps = Omit<TooltipProps, 'content'> & {\n /**\n * The tooltip content.\n */\n content: string | React.ReactNode;\n\n /**\n * Specify which action or actions trigger Overlay visibility.\n * Possible values are: `hover`, `click`, `focus`\n * @default 'hover'\n */\n trigger?: TriggerType;\n\n /**\n * The react ref object assigned to the target of the tooltip.\n */\n targetRef?: MutableRefObject<HTMLDivElement>;\n\n /**\n * A millisecond delay amount to show the Overlay once triggered.\n * If passed an Object, you can control the show and hide timeouts individually.\n */\n delay?: number | delayProp;\n\n /**\n * A Popper.js config object passed to the the underlying popper instance.\n */\n popperConfig?: object;\n};\n\nconst SimpleTooltip = (props: PropsWithChildren<SimpleTooltipProps>) => {\n const {\n children,\n placement = PLACEMENT.AUTO,\n trigger,\n content,\n delay,\n popperConfig,\n targetRef,\n ...remainingProps\n } = props;\n\n return (\n <OverlayTrigger\n placement={placement}\n trigger={trigger}\n overlay={\n <Tooltip {...remainingProps} ref={targetRef}>\n {content}\n </Tooltip>\n }\n delay={delay}\n popperConfig={popperConfig}\n >\n {children}\n </OverlayTrigger>\n );\n};\n\nSimpleTooltip.TRIGGER_CLICK = TRIGGER.CLICK;\nSimpleTooltip.TRIGGER_HOVER = TRIGGER.HOVER;\nSimpleTooltip.TRIGGER_FOCUS = TRIGGER.FOCUS;\n\nexport default SimpleTooltip;\n"],"names":["SimpleTooltip","props","children","placement","PLACEMENT","trigger","content","delay","popperConfig","targetRef","remainingProps","jsx","OverlayTrigger","Tooltip","TRIGGER"],"mappings":";;;;;AA0CA,MAAMA,IAAgB,CAACC,MAAiD;AACpE,QAAM;AAAA,IACF,UAAAC;AAAA,IACA,WAAAC,IAAYC,EAAU;AAAA,IACtB,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,OAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACHT;AAEJ,SACI,gBAAAU;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,WAAAT;AAAA,MACA,SAAAE;AAAA,MACA,SACI,gBAAAM,EAACE,GAAA,EAAS,GAAGH,GAAgB,KAAKD,GAC7B,UAAAH,GACL;AAAA,MAEJ,OAAAC;AAAA,MACA,cAAAC;AAAA,MAEC,UAAAN;AAAA,IAAA;AAAA,EAAA;AAGb;AAEAF,EAAc,gBAAgBc,EAAQ;AACtCd,EAAc,gBAAgBc,EAAQ;AACtCd,EAAc,gBAAgBc,EAAQ;"}
1
+ {"version":3,"file":"SimpleTooltip.js","sources":["../../../src/components/tooltip/SimpleTooltip.tsx"],"sourcesContent":["import type { MutableRefObject, PropsWithChildren } from 'react';\n\nimport Tooltip, { type TooltipProps } from './Tooltip';\nimport OverlayTrigger from '../overlay/OverlayTrigger';\nimport { PLACEMENT } from '../../values/Placement';\nimport { TRIGGER, type TriggerType } from '../../values/Trigger';\n\nexport type DelayProp = {\n /**\n * A millisecond delay amount before showing the Overlay once triggered.\n */\n show: number;\n\n /**\n * A millisecond delay amount before hiding the Overlay once triggered.\n */\n hide: number;\n};\n\nexport type SimpleTooltipProps = Omit<TooltipProps, 'content'> & {\n /**\n * The tooltip content.\n */\n content: string | React.ReactNode;\n\n /**\n * Specify which action or actions trigger Overlay visibility.\n *\n * Possible values are:\n *\n * - `'hover'`\n * - `'click'`\n * - `'focus'`\n *\n * @default 'hover'\n */\n trigger?: TriggerType;\n\n /**\n * The react ref object assigned to the target of the tooltip.\n */\n targetRef?: MutableRefObject<HTMLDivElement>;\n\n /**\n * A millisecond delay amount to show the Overlay once triggered.\n * If passed an Object, you can control the show and hide timeouts individually.\n *\n * @example\n * {\n * show: 1_000,\n * delay: 500,\n * }\n */\n delay?: number | DelayProp;\n\n /**\n * A Popper.js config object passed to the the underlying popper instance.\n */\n popperConfig?: object;\n};\n\nconst SimpleTooltip = (props: PropsWithChildren<SimpleTooltipProps>) => {\n const {\n children,\n placement = PLACEMENT.AUTO,\n trigger,\n content,\n delay,\n popperConfig,\n targetRef,\n ...remainingProps\n } = props;\n\n return (\n <OverlayTrigger\n placement={placement}\n trigger={trigger}\n overlay={\n <Tooltip {...remainingProps} ref={targetRef}>\n {content}\n </Tooltip>\n }\n delay={delay}\n popperConfig={popperConfig}\n >\n {children}\n </OverlayTrigger>\n );\n};\n\nSimpleTooltip.TRIGGER_CLICK = TRIGGER.CLICK;\nSimpleTooltip.TRIGGER_HOVER = TRIGGER.HOVER;\nSimpleTooltip.TRIGGER_FOCUS = TRIGGER.FOCUS;\n\nexport default SimpleTooltip;\n"],"names":["SimpleTooltip","props","children","placement","PLACEMENT","trigger","content","delay","popperConfig","targetRef","remainingProps","jsx","OverlayTrigger","Tooltip","TRIGGER"],"mappings":";;;;;AA6DA,MAAMA,IAAgB,CAACC,MAAiD;AACpE,QAAM;AAAA,IACF,UAAAC;AAAA,IACA,WAAAC,IAAYC,EAAU;AAAA,IACtB,SAAAC;AAAA,IACA,SAAAC;AAAA,IACA,OAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACHT;AAEJ,SACI,gBAAAU;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,WAAAT;AAAA,MACA,SAAAE;AAAA,MACA,SACI,gBAAAM,EAACE,GAAA,EAAS,GAAGH,GAAgB,KAAKD,GAC7B,UAAAH,GACL;AAAA,MAEJ,OAAAC;AAAA,MACA,cAAAC;AAAA,MAEC,UAAAN;AAAA,IAAA;AAAA,EAAA;AAGb;AAEAF,EAAc,gBAAgBc,EAAQ;AACtCd,EAAc,gBAAgBc,EAAQ;AACtCd,EAAc,gBAAgBc,EAAQ;"}
@@ -21,28 +21,48 @@ export type TooltipProps = {
21
21
  /**
22
22
  * Sets the direction the Tooltip is positioned towards. This is generally provided by the
23
23
  * OverlayTrigger component positioning the tooltip.
24
+ *
24
25
  * @default 'bottom'
25
26
  */
26
27
  placement?: ObjectValues<typeof PLACEMENT>;
27
28
  /**
28
29
  * Defines the position of the text content.
29
- * Possible values are: `"center"` | `"left"` | `"right"`
30
+ *
31
+ * Possible values are:
32
+ *
33
+ * - `'center'`
34
+ * - `'left'`
35
+ * - `'right'`
36
+ *
30
37
  * @default 'center'
31
38
  */
32
39
  textAlignment?: ObjectValues<typeof TEXT_ALIGNMENT>;
33
40
  /**
34
41
  * Defines the look of the tooltip.
35
42
  * Possible values are: `default` and `onboarding`
43
+ *
36
44
  * @default 'default'
37
45
  */
38
46
  tooltipStyle?: ObjectValues<typeof STYLE_MAP>;
39
47
  /**
40
48
  * Defines the width of 'the tooltip.
41
- * Possible values are: 'auto' | 100 | 150 | 200 | 250 | 300 | 350 | 400 | 450 | 500
49
+ * Possible values are:
50
+ *
51
+ * - `'auto'`
52
+ * - `100`
53
+ * - `150`
54
+ * - `200`
55
+ * - `250`
56
+ * - `300`
57
+ * - `350`
58
+ * - `400`
59
+ * - `450`
60
+ * - `500`
42
61
  */
43
62
  width?: TooltipWidth;
44
63
  /**
45
64
  * Render Tooltips on mobile devices.
65
+ *
46
66
  * @default false
47
67
  */
48
68
  allowOnTouch?: boolean;
@@ -1,7 +1,7 @@
1
1
  import { jsx as t, jsxs as M } from "react/jsx-runtime";
2
2
  import { forwardRef as I, useState as w, useEffect as G } from "react";
3
- import l from "classnames";
4
3
  import { omit as g } from "es-toolkit/compat";
4
+ import l from "../../utils/classNames.js";
5
5
  import { isDesktop as h } from "../../utils/deviceUtils.js";
6
6
  import { PLACEMENT as x } from "../../values/Placement.js";
7
7
  import { TEXT_ALIGNMENT as o } from "../../values/TextAlignment.js";
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.js","sources":["../../../src/components/tooltip/Tooltip.tsx"],"sourcesContent":["import {\n useEffect,\n useState,\n forwardRef,\n type CSSProperties,\n type ForwardedRef,\n type PropsWithChildren,\n type HTMLAttributes,\n} from 'react';\nimport classNames from 'classnames';\nimport { omit } from 'es-toolkit/compat';\n\nimport { isDesktop } from '../../utils/deviceUtils';\nimport { PLACEMENT } from '../../values/Placement';\nimport { TEXT_ALIGNMENT } from '../../values/TextAlignment';\nimport type { ObjectValues } from '../../utils/ObjectValues';\nimport type { RefComponent } from '../../utils/RefComponent';\n\nconst STYLE_MAP = {\n STYLE_DEFAULT: 'default',\n STYLE_ONBOARDING: 'onboarding',\n} as const;\n\nconst TEXT_ALIGNMENT_MAP = {\n TEXT_ALIGNMENT_LEFT: TEXT_ALIGNMENT.LEFT,\n TEXT_ALIGNMENT_CENTER: TEXT_ALIGNMENT.CENTER,\n TEXT_ALIGNMENT_RIGHT: TEXT_ALIGNMENT.RIGHT,\n} as const;\n\nexport type TooltipWidth = 'auto' | 100 | 150 | 200 | 250 | 300 | 350 | 400 | 450 | 500;\n\nexport type TooltipProps = {\n /**\n * An HTML id attribute, necessary for accessibility.\n */\n id?: string;\n\n /**\n * Sets the direction the Tooltip is positioned towards. This is generally provided by the\n * OverlayTrigger component positioning the tooltip.\n * @default 'bottom'\n */\n placement?: ObjectValues<typeof PLACEMENT>;\n\n /**\n * Defines the position of the text content.\n * Possible values are: `\"center\"` | `\"left\"` | `\"right\"`\n * @default 'center'\n */\n textAlignment?: ObjectValues<typeof TEXT_ALIGNMENT>;\n\n /**\n * Defines the look of the tooltip.\n * Possible values are: `default` and `onboarding`\n * @default 'default'\n */\n tooltipStyle?: ObjectValues<typeof STYLE_MAP>;\n\n /**\n * Defines the width of 'the tooltip.\n * Possible values are: 'auto' | 100 | 150 | 200 | 250 | 300 | 350 | 400 | 450 | 500\n */\n width?: TooltipWidth;\n\n /**\n * Render Tooltips on mobile devices.\n * @default false\n */\n allowOnTouch?: boolean;\n\n /**\n * Additional props assigned to the arrow element. Internally used.\n */\n arrowProps?: Record<string, unknown>;\n\n /**\n * Additional style properties assigned to the wrapper element.\n */\n style?: CSSProperties;\n\n /**\n * Additional classes to be set on the wrapper element.\n */\n className?: string;\n\n /**\n * Additional classes to be set on the inner element.\n */\n innerClassName?: string;\n} & Omit<HTMLAttributes<HTMLDivElement>, 'id' | 'style' | 'className'>;\n\nexport type TooltipType = RefComponent<PropsWithChildren<TooltipProps>> &\n typeof STYLE_MAP &\n typeof PLACEMENT &\n typeof TEXT_ALIGNMENT_MAP;\n\nconst Tooltip = forwardRef((props: PropsWithChildren<TooltipProps>, ref: ForwardedRef<HTMLDivElement>) => {\n const {\n allowOnTouch = false,\n arrowProps,\n children,\n className = '',\n innerClassName = '',\n placement = 'bottom',\n style,\n textAlignment = 'center',\n tooltipStyle = 'default',\n width = 'auto',\n ...remainingProps\n } = omit(props, ['popper', 'positionLeft', 'positionTop']);\n\n // Mount the component but don't show it yet via CSS.\n // After it is mounted, we set the visibility class to use CSS animation\n const [isMounted, setIsMounted] = useState(false);\n useEffect(() => setIsMounted(true), []);\n\n if (!isDesktop() && !allowOnTouch) {\n // Workaround: we have to return a DOM node as otherwise the\n // react-transition library would throw an error on mobile\n // when triggering a browser reflow and accessing the node directly.\n return <span className='display-none' />;\n }\n\n const wrapperClasses = classNames(\n 'tooltip',\n tooltipStyle && `tooltip-${tooltipStyle}`,\n placement,\n 'fade',\n isMounted && 'show',\n className\n );\n\n const innerClasses = classNames(\n 'tooltip-inner',\n textAlignment && `text-${textAlignment}`,\n width && `width-${width}`,\n innerClassName && innerClassName\n );\n\n /* eslint-disable react/no-unknown-property */\n return (\n <div\n {...remainingProps}\n role='tooltip'\n // x-placement is used by the css to define how to position the arrow.\n x-placement={placement}\n ref={ref}\n className={wrapperClasses}\n style={{ ...style }}\n data-offset={20}\n >\n <div className='tooltip-arrow' {...arrowProps} />\n <div className={innerClasses}>{children}</div>\n </div>\n );\n}) as TooltipType;\n\n// statics\nObject.assign(Tooltip, STYLE_MAP);\nObject.assign(Tooltip, PLACEMENT); // is keyed as-is\nObject.assign(Tooltip, TEXT_ALIGNMENT_MAP);\n\nexport default Tooltip;\n"],"names":["STYLE_MAP","TEXT_ALIGNMENT_MAP","TEXT_ALIGNMENT","Tooltip","forwardRef","props","ref","allowOnTouch","arrowProps","children","className","innerClassName","placement","style","textAlignment","tooltipStyle","width","remainingProps","omit","isMounted","setIsMounted","useState","useEffect","isDesktop","jsx","wrapperClasses","classNames","innerClasses","jsxs","PLACEMENT"],"mappings":";;;;;;;AAkBA,MAAMA,IAAY;AAAA,EACd,eAAe;AAAA,EACf,kBAAkB;AACtB,GAEMC,IAAqB;AAAA,EACvB,qBAAqBC,EAAe;AAAA,EACpC,uBAAuBA,EAAe;AAAA,EACtC,sBAAsBA,EAAe;AACzC,GAqEMC,IAAUC,EAAW,CAACC,GAAwCC,MAAsC;AACtG,QAAM;AAAA,IACF,cAAAC,IAAe;AAAA,IACf,YAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,gBAAAC,IAAiB;AAAA,IACjB,WAAAC,IAAY;AAAA,IACZ,OAAAC;AAAA,IACA,eAAAC,IAAgB;AAAA,IAChB,cAAAC,IAAe;AAAA,IACf,OAAAC,IAAQ;AAAA,IACR,GAAGC;AAAA,EAAA,IACHC,EAAKb,GAAO,CAAC,UAAU,gBAAgB,aAAa,CAAC,GAInD,CAACc,GAAWC,CAAY,IAAIC,EAAS,EAAK;AAGhD,MAFAC,EAAU,MAAMF,EAAa,EAAI,GAAG,CAAA,CAAE,GAElC,CAACG,OAAe,CAAChB;AAIjB,WAAO,gBAAAiB,EAAC,QAAA,EAAK,WAAU,eAAA,CAAe;AAG1C,QAAMC,IAAiBC;AAAA,IACnB;AAAA,IACAX,KAAgB,WAAWA,CAAY;AAAA,IACvCH;AAAA,IACA;AAAA,IACAO,KAAa;AAAA,IACbT;AAAA,EAAA,GAGEiB,IAAeD;AAAA,IACjB;AAAA,IACAZ,KAAiB,QAAQA,CAAa;AAAA,IACtCE,KAAS,SAASA,CAAK;AAAA,IACvBL,KAAkBA;AAAA,EAAA;AAItB,SACI,gBAAAiB;AAAA,IAAC;AAAA,IAAA;AAAA,MACI,GAAGX;AAAA,MACJ,MAAK;AAAA,MAEL,eAAaL;AAAA,MACb,KAAAN;AAAA,MACA,WAAWmB;AAAA,MACX,OAAO,EAAE,GAAGZ,EAAA;AAAA,MACZ,eAAa;AAAA,MAEb,UAAA;AAAA,QAAA,gBAAAW,EAAC,OAAA,EAAI,WAAU,iBAAiB,GAAGhB,EAAA,CAAY;AAAA,QAC/C,gBAAAgB,EAAC,OAAA,EAAI,WAAWG,GAAe,UAAAlB,EAAA,CAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGpD,CAAC;AAGD,OAAO,OAAON,GAASH,CAAS;AAChC,OAAO,OAAOG,GAAS0B,CAAS;AAChC,OAAO,OAAO1B,GAASF,CAAkB;"}
1
+ {"version":3,"file":"Tooltip.js","sources":["../../../src/components/tooltip/Tooltip.tsx"],"sourcesContent":["import {\n useEffect,\n useState,\n forwardRef,\n type CSSProperties,\n type ForwardedRef,\n type PropsWithChildren,\n type HTMLAttributes,\n} from 'react';\nimport { omit } from 'es-toolkit/compat';\n\nimport classNames from '../../utils/classNames';\nimport { isDesktop } from '../../utils/deviceUtils';\nimport { PLACEMENT } from '../../values/Placement';\nimport { TEXT_ALIGNMENT } from '../../values/TextAlignment';\nimport type { ObjectValues } from '../../utils/ObjectValues';\nimport type { RefComponent } from '../../utils/RefComponent';\n\nconst STYLE_MAP = {\n STYLE_DEFAULT: 'default',\n STYLE_ONBOARDING: 'onboarding',\n} as const;\n\nconst TEXT_ALIGNMENT_MAP = {\n TEXT_ALIGNMENT_LEFT: TEXT_ALIGNMENT.LEFT,\n TEXT_ALIGNMENT_CENTER: TEXT_ALIGNMENT.CENTER,\n TEXT_ALIGNMENT_RIGHT: TEXT_ALIGNMENT.RIGHT,\n} as const;\n\nexport type TooltipWidth = 'auto' | 100 | 150 | 200 | 250 | 300 | 350 | 400 | 450 | 500;\n\nexport type TooltipProps = {\n /**\n * An HTML id attribute, necessary for accessibility.\n */\n id?: string;\n\n /**\n * Sets the direction the Tooltip is positioned towards. This is generally provided by the\n * OverlayTrigger component positioning the tooltip.\n *\n * @default 'bottom'\n */\n placement?: ObjectValues<typeof PLACEMENT>;\n\n /**\n * Defines the position of the text content.\n *\n * Possible values are:\n *\n * - `'center'`\n * - `'left'`\n * - `'right'`\n *\n * @default 'center'\n */\n textAlignment?: ObjectValues<typeof TEXT_ALIGNMENT>;\n\n /**\n * Defines the look of the tooltip.\n * Possible values are: `default` and `onboarding`\n *\n * @default 'default'\n */\n tooltipStyle?: ObjectValues<typeof STYLE_MAP>;\n\n /**\n * Defines the width of 'the tooltip.\n * Possible values are:\n *\n * - `'auto'`\n * - `100`\n * - `150`\n * - `200`\n * - `250`\n * - `300`\n * - `350`\n * - `400`\n * - `450`\n * - `500`\n */\n width?: TooltipWidth;\n\n /**\n * Render Tooltips on mobile devices.\n *\n * @default false\n */\n allowOnTouch?: boolean;\n\n /**\n * Additional props assigned to the arrow element. Internally used.\n */\n arrowProps?: Record<string, unknown>;\n\n /**\n * Additional style properties assigned to the wrapper element.\n */\n style?: CSSProperties;\n\n /**\n * Additional classes to be set on the wrapper element.\n */\n className?: string;\n\n /**\n * Additional classes to be set on the inner element.\n */\n innerClassName?: string;\n} & Omit<HTMLAttributes<HTMLDivElement>, 'id' | 'style' | 'className'>;\n\nexport type TooltipType = RefComponent<PropsWithChildren<TooltipProps>> &\n typeof STYLE_MAP &\n typeof PLACEMENT &\n typeof TEXT_ALIGNMENT_MAP;\n\nconst Tooltip = forwardRef((props: PropsWithChildren<TooltipProps>, ref: ForwardedRef<HTMLDivElement>) => {\n const {\n allowOnTouch = false,\n arrowProps,\n children,\n className = '',\n innerClassName = '',\n placement = 'bottom',\n style,\n textAlignment = 'center',\n tooltipStyle = 'default',\n width = 'auto',\n ...remainingProps\n } = omit(props, ['popper', 'positionLeft', 'positionTop']);\n\n // Mount the component but don't show it yet via CSS.\n // After it is mounted, we set the visibility class to use CSS animation\n const [isMounted, setIsMounted] = useState(false);\n useEffect(() => setIsMounted(true), []);\n\n if (!isDesktop() && !allowOnTouch) {\n // Workaround: we have to return a DOM node as otherwise the\n // react-transition library would throw an error on mobile\n // when triggering a browser reflow and accessing the node directly.\n return <span className='display-none' />;\n }\n\n const wrapperClasses = classNames(\n 'tooltip',\n tooltipStyle && `tooltip-${tooltipStyle}`,\n placement,\n 'fade',\n isMounted && 'show',\n className\n );\n\n const innerClasses = classNames(\n 'tooltip-inner',\n textAlignment && `text-${textAlignment}`,\n width && `width-${width}`,\n innerClassName && innerClassName\n );\n\n /* eslint-disable react/no-unknown-property */\n return (\n <div\n {...remainingProps}\n role='tooltip'\n // x-placement is used by the css to define how to position the arrow.\n x-placement={placement}\n ref={ref}\n className={wrapperClasses}\n style={{ ...style }}\n data-offset={20}\n >\n <div className='tooltip-arrow' {...arrowProps} />\n <div className={innerClasses}>{children}</div>\n </div>\n );\n}) as TooltipType;\n\n// statics\nObject.assign(Tooltip, STYLE_MAP);\nObject.assign(Tooltip, PLACEMENT); // is keyed as-is\nObject.assign(Tooltip, TEXT_ALIGNMENT_MAP);\n\nexport default Tooltip;\n"],"names":["STYLE_MAP","TEXT_ALIGNMENT_MAP","TEXT_ALIGNMENT","Tooltip","forwardRef","props","ref","allowOnTouch","arrowProps","children","className","innerClassName","placement","style","textAlignment","tooltipStyle","width","remainingProps","omit","isMounted","setIsMounted","useState","useEffect","isDesktop","jsx","wrapperClasses","classNames","innerClasses","jsxs","PLACEMENT"],"mappings":";;;;;;;AAkBA,MAAMA,IAAY;AAAA,EACd,eAAe;AAAA,EACf,kBAAkB;AACtB,GAEMC,IAAqB;AAAA,EACvB,qBAAqBC,EAAe;AAAA,EACpC,uBAAuBA,EAAe;AAAA,EACtC,sBAAsBA,EAAe;AACzC,GAyFMC,IAAUC,EAAW,CAACC,GAAwCC,MAAsC;AACtG,QAAM;AAAA,IACF,cAAAC,IAAe;AAAA,IACf,YAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,gBAAAC,IAAiB;AAAA,IACjB,WAAAC,IAAY;AAAA,IACZ,OAAAC;AAAA,IACA,eAAAC,IAAgB;AAAA,IAChB,cAAAC,IAAe;AAAA,IACf,OAAAC,IAAQ;AAAA,IACR,GAAGC;AAAA,EAAA,IACHC,EAAKb,GAAO,CAAC,UAAU,gBAAgB,aAAa,CAAC,GAInD,CAACc,GAAWC,CAAY,IAAIC,EAAS,EAAK;AAGhD,MAFAC,EAAU,MAAMF,EAAa,EAAI,GAAG,CAAA,CAAE,GAElC,CAACG,OAAe,CAAChB;AAIjB,WAAO,gBAAAiB,EAAC,QAAA,EAAK,WAAU,eAAA,CAAe;AAG1C,QAAMC,IAAiBC;AAAA,IACnB;AAAA,IACAX,KAAgB,WAAWA,CAAY;AAAA,IACvCH;AAAA,IACA;AAAA,IACAO,KAAa;AAAA,IACbT;AAAA,EAAA,GAGEiB,IAAeD;AAAA,IACjB;AAAA,IACAZ,KAAiB,QAAQA,CAAa;AAAA,IACtCE,KAAS,SAASA,CAAK;AAAA,IACvBL,KAAkBA;AAAA,EAAA;AAItB,SACI,gBAAAiB;AAAA,IAAC;AAAA,IAAA;AAAA,MACI,GAAGX;AAAA,MACJ,MAAK;AAAA,MAEL,eAAaL;AAAA,MACb,KAAAN;AAAA,MACA,WAAWmB;AAAA,MACX,OAAO,EAAE,GAAGZ,EAAA;AAAA,MACZ,eAAa;AAAA,MAEb,UAAA;AAAA,QAAA,gBAAAW,EAAC,OAAA,EAAI,WAAU,iBAAiB,GAAGhB,EAAA,CAAY;AAAA,QAC/C,gBAAAgB,EAAC,OAAA,EAAI,WAAWG,GAAe,UAAAlB,EAAA,CAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGpD,CAAC;AAGD,OAAO,OAAON,GAASH,CAAS;AAChC,OAAO,OAAOG,GAAS0B,CAAS;AAChC,OAAO,OAAO1B,GAASF,CAAkB;"}
@@ -0,0 +1,85 @@
1
+ import { ReactNode } from 'react';
2
+ export type TrackerBlock = {
3
+ /**
4
+ * Unique identifier for a block.
5
+ */
6
+ id?: string;
7
+ /**
8
+ * Defines the block color by setting a UIKIT bg-<name> class.
9
+ */
10
+ color?: string;
11
+ /**
12
+ * Tooltip content shown on hover.
13
+ */
14
+ tooltip?: ReactNode;
15
+ /**
16
+ * Called when clicking the block.
17
+ */
18
+ onClick?: (id: string) => void;
19
+ /**
20
+ * Additional class names for the block.
21
+ */
22
+ className?: string;
23
+ };
24
+ export type TrackerProps = {
25
+ /**
26
+ * Array of block objects.
27
+ */
28
+ data: TrackerBlock[];
29
+ /**
30
+ * Background color of a block, when no color is provided in `data`.
31
+ *
32
+ * @default 'bg-success'
33
+ */
34
+ defaultBackgroundColor?: string;
35
+ /**
36
+ * Add a hover effect to the tracker blocks.
37
+ *
38
+ * @default false
39
+ */
40
+ hoverEffect?: boolean;
41
+ /**
42
+ * Minimum width per tracker block in pixels.
43
+ *
44
+ * The tracker compresses blocks automatically down to this value.
45
+ *
46
+ * @default 5
47
+ */
48
+ minBlockWidth?: number;
49
+ /**
50
+ * Maximum width per tracker block in pixels.
51
+ *
52
+ * @default 10
53
+ */
54
+ maxBlockWidth?: number;
55
+ /**
56
+ * Gap between tracker blocks in pixels.
57
+ *
58
+ * @default 2
59
+ */
60
+ blockGap?: number;
61
+ /**
62
+ * Height per tracker block in pixels.
63
+ *
64
+ * @default 30
65
+ */
66
+ blockHeight?: number;
67
+ /**
68
+ * When enabled, the tracker shows fewer blocks once `minBlockWidth` is reached.
69
+ *
70
+ * @default true
71
+ */
72
+ collapseOnMinBlockWidth?: boolean;
73
+ /**
74
+ * Show the last blocks instead of the first blocks when collapsing due to width.
75
+ *
76
+ * @default false
77
+ */
78
+ collapseShowLastBlocks?: boolean;
79
+ /**
80
+ * Additional class names on the wrapper element.
81
+ */
82
+ className?: string;
83
+ };
84
+ declare const Tracker: (props: TrackerProps) => import("react/jsx-runtime").JSX.Element;
85
+ export default Tracker;
@@ -0,0 +1,54 @@
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { useMemo as T } from "react";
3
+ import C from "../../utils/classNames.js";
4
+ import H from "../../hooks/useResizeObserver.js";
5
+ import A from "./TrackerBlock.js";
6
+ const E = 5, O = 10, F = 2, G = 30, R = (d) => {
7
+ const {
8
+ data: t,
9
+ defaultBackgroundColor: k = "bg-success",
10
+ hoverEffect: p = !1,
11
+ minBlockWidth: M = E,
12
+ maxBlockWidth: b = O,
13
+ blockGap: B = F,
14
+ blockHeight: W = G,
15
+ collapseOnMinBlockWidth: n = !0,
16
+ collapseShowLastBlocks: r = !1,
17
+ className: f
18
+ } = d, [g, I, { inlineSize: h }] = H(), c = Math.max(1, M), l = Math.max(c, b), a = Math.max(0, B), x = Math.max(1, W), { visibleData: u, blockWidth: _ } = T(() => {
19
+ if (t.length === 0)
20
+ return { visibleData: t, blockWidth: l };
21
+ const e = h ?? t.length * l + (t.length - 1) * a, s = Math.max(
22
+ 1,
23
+ Math.floor((e + a) / (c + a))
24
+ ), o = n ? Math.min(t.length, s) : t.length, i = r ? t.slice(-o) : t.slice(0, o), D = Math.max(0, e - (i.length - 1) * a) / i.length, L = Math.max(c, Math.min(l, D));
25
+ return { visibleData: i, blockWidth: L };
26
+ }, [
27
+ t,
28
+ h,
29
+ c,
30
+ l,
31
+ a,
32
+ n,
33
+ r
34
+ ]), v = C("tracker", f);
35
+ return /* @__PURE__ */ m("div", { ref: g, className: v, style: { gap: `${a}px` }, children: u.map((e, s) => {
36
+ const o = e.id ?? `${s}`;
37
+ return /* @__PURE__ */ m(
38
+ A,
39
+ {
40
+ id: o,
41
+ block: e,
42
+ defaultBackgroundColor: k,
43
+ hoverEffect: p,
44
+ blockWidth: _,
45
+ blockHeight: x
46
+ },
47
+ o
48
+ );
49
+ }) });
50
+ };
51
+ export {
52
+ R as default
53
+ };
54
+ //# sourceMappingURL=Tracker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tracker.js","sources":["../../../src/components/tracker/Tracker.tsx"],"sourcesContent":["import { useMemo, type ReactNode } from 'react';\n\nimport classNames from '../../utils/classNames';\nimport useResizeObserver from '../../hooks/useResizeObserver';\nimport TrackerBlockItem from './TrackerBlock';\n\nconst DEFAULT_MIN_BLOCK_WIDTH = 5;\nconst DEFAULT_MAX_BLOCK_WIDTH = 10;\nconst DEFAULT_BLOCK_GAP = 2;\nconst DEFAULT_BLOCK_HEIGHT = 30;\n\nexport type TrackerBlock = {\n /**\n * Unique identifier for a block.\n */\n id?: string;\n\n /**\n * Defines the block color by setting a UIKIT bg-<name> class.\n */\n color?: string;\n\n /**\n * Tooltip content shown on hover.\n */\n tooltip?: ReactNode;\n\n /**\n * Called when clicking the block.\n */\n onClick?: (id: string) => void;\n\n /**\n * Additional class names for the block.\n */\n className?: string;\n};\n\nexport type TrackerProps = {\n /**\n * Array of block objects.\n */\n data: TrackerBlock[];\n\n /**\n * Background color of a block, when no color is provided in `data`.\n *\n * @default 'bg-success'\n */\n defaultBackgroundColor?: string;\n\n /**\n * Add a hover effect to the tracker blocks.\n *\n * @default false\n */\n hoverEffect?: boolean;\n\n /**\n * Minimum width per tracker block in pixels.\n *\n * The tracker compresses blocks automatically down to this value.\n *\n * @default 5\n */\n minBlockWidth?: number;\n\n /**\n * Maximum width per tracker block in pixels.\n *\n * @default 10\n */\n maxBlockWidth?: number;\n\n /**\n * Gap between tracker blocks in pixels.\n *\n * @default 2\n */\n blockGap?: number;\n\n /**\n * Height per tracker block in pixels.\n *\n * @default 30\n */\n blockHeight?: number;\n\n /**\n * When enabled, the tracker shows fewer blocks once `minBlockWidth` is reached.\n *\n * @default true\n */\n collapseOnMinBlockWidth?: boolean;\n\n /**\n * Show the last blocks instead of the first blocks when collapsing due to width.\n *\n * @default false\n */\n collapseShowLastBlocks?: boolean;\n\n /**\n * Additional class names on the wrapper element.\n */\n className?: string;\n};\n\nconst Tracker = (props: TrackerProps) => {\n const {\n data,\n defaultBackgroundColor = 'bg-success',\n hoverEffect = false,\n minBlockWidth = DEFAULT_MIN_BLOCK_WIDTH,\n maxBlockWidth = DEFAULT_MAX_BLOCK_WIDTH,\n blockGap = DEFAULT_BLOCK_GAP,\n blockHeight = DEFAULT_BLOCK_HEIGHT,\n collapseOnMinBlockWidth = true,\n collapseShowLastBlocks = false,\n className,\n } = props;\n const [trackerRef, _, { inlineSize }] = useResizeObserver<HTMLDivElement>();\n\n const clampedMinBlockWidth = Math.max(1, minBlockWidth);\n const clampedMaxBlockWidth = Math.max(clampedMinBlockWidth, maxBlockWidth);\n const clampedBlockGap = Math.max(0, blockGap);\n const clampedBlockHeight = Math.max(1, blockHeight);\n\n const { visibleData, blockWidth } = useMemo(() => {\n if (data.length === 0) {\n return { visibleData: data, blockWidth: clampedMaxBlockWidth };\n }\n\n const containerWidth = inlineSize ?? data.length * clampedMaxBlockWidth + (data.length - 1) * clampedBlockGap;\n const maxVisibleWithMinWidth = Math.max(\n 1,\n Math.floor((containerWidth + clampedBlockGap) / (clampedMinBlockWidth + clampedBlockGap))\n );\n const visibleBlocksCount = collapseOnMinBlockWidth\n ? Math.min(data.length, maxVisibleWithMinWidth)\n : data.length;\n const visibleData = collapseShowLastBlocks\n ? data.slice(-visibleBlocksCount)\n : data.slice(0, visibleBlocksCount);\n\n const availableWidth = Math.max(0, containerWidth - (visibleData.length - 1) * clampedBlockGap);\n const widthPerBlock = availableWidth / visibleData.length;\n const blockWidth = Math.max(clampedMinBlockWidth, Math.min(clampedMaxBlockWidth, widthPerBlock));\n\n return { visibleData, blockWidth };\n }, [\n data,\n inlineSize,\n clampedMinBlockWidth,\n clampedMaxBlockWidth,\n clampedBlockGap,\n collapseOnMinBlockWidth,\n collapseShowLastBlocks,\n ]);\n\n const wrapperClasses = classNames('tracker', className);\n\n return (\n <div ref={trackerRef} className={wrapperClasses} style={{ gap: `${clampedBlockGap}px` }}>\n {visibleData.map((block, index) => {\n const id = block.id ?? `${index}`;\n return (\n <TrackerBlockItem\n key={id}\n id={id}\n block={block}\n defaultBackgroundColor={defaultBackgroundColor}\n hoverEffect={hoverEffect}\n blockWidth={blockWidth}\n blockHeight={clampedBlockHeight}\n />\n );\n })}\n </div>\n );\n};\n\nexport default Tracker;\n"],"names":["DEFAULT_MIN_BLOCK_WIDTH","DEFAULT_MAX_BLOCK_WIDTH","DEFAULT_BLOCK_GAP","DEFAULT_BLOCK_HEIGHT","Tracker","props","data","defaultBackgroundColor","hoverEffect","minBlockWidth","maxBlockWidth","blockGap","blockHeight","collapseOnMinBlockWidth","collapseShowLastBlocks","className","trackerRef","_","inlineSize","useResizeObserver","clampedMinBlockWidth","clampedMaxBlockWidth","clampedBlockGap","clampedBlockHeight","visibleData","blockWidth","useMemo","containerWidth","maxVisibleWithMinWidth","visibleBlocksCount","widthPerBlock","wrapperClasses","classNames","block","index","id","jsx","TrackerBlockItem"],"mappings":";;;;;AAMA,MAAMA,IAA0B,GAC1BC,IAA0B,IAC1BC,IAAoB,GACpBC,IAAuB,IAmGvBC,IAAU,CAACC,MAAwB;AACrC,QAAM;AAAA,IACF,MAAAC;AAAA,IACA,wBAAAC,IAAyB;AAAA,IACzB,aAAAC,IAAc;AAAA,IACd,eAAAC,IAAgBT;AAAA,IAChB,eAAAU,IAAgBT;AAAA,IAChB,UAAAU,IAAWT;AAAA,IACX,aAAAU,IAAcT;AAAA,IACd,yBAAAU,IAA0B;AAAA,IAC1B,wBAAAC,IAAyB;AAAA,IACzB,WAAAC;AAAA,EAAA,IACAV,GACE,CAACW,GAAYC,GAAG,EAAE,YAAAC,EAAA,CAAY,IAAIC,EAAA,GAElCC,IAAuB,KAAK,IAAI,GAAGX,CAAa,GAChDY,IAAuB,KAAK,IAAID,GAAsBV,CAAa,GACnEY,IAAkB,KAAK,IAAI,GAAGX,CAAQ,GACtCY,IAAqB,KAAK,IAAI,GAAGX,CAAW,GAE5C,EAAE,aAAAY,GAAa,YAAAC,EAAA,IAAeC,EAAQ,MAAM;AAC9C,QAAIpB,EAAK,WAAW;AAChB,aAAO,EAAE,aAAaA,GAAM,YAAYe,EAAA;AAG5C,UAAMM,IAAiBT,KAAcZ,EAAK,SAASe,KAAwBf,EAAK,SAAS,KAAKgB,GACxFM,IAAyB,KAAK;AAAA,MAChC;AAAA,MACA,KAAK,OAAOD,IAAiBL,MAAoBF,IAAuBE,EAAgB;AAAA,IAAA,GAEtFO,IAAqBhB,IACrB,KAAK,IAAIP,EAAK,QAAQsB,CAAsB,IAC5CtB,EAAK,QACLkB,IAAcV,IACdR,EAAK,MAAM,CAACuB,CAAkB,IAC9BvB,EAAK,MAAM,GAAGuB,CAAkB,GAGhCC,IADiB,KAAK,IAAI,GAAGH,KAAkBH,EAAY,SAAS,KAAKF,CAAe,IACvDE,EAAY,QAC7CC,IAAa,KAAK,IAAIL,GAAsB,KAAK,IAAIC,GAAsBS,CAAa,CAAC;AAE/F,WAAO,EAAE,aAAAN,GAAa,YAAAC,EAAAA;AAAAA,EAC1B,GAAG;AAAA,IACCnB;AAAA,IACAY;AAAA,IACAE;AAAA,IACAC;AAAA,IACAC;AAAA,IACAT;AAAA,IACAC;AAAA,EAAA,CACH,GAEKiB,IAAiBC,EAAW,WAAWjB,CAAS;AAEtD,2BACK,OAAA,EAAI,KAAKC,GAAY,WAAWe,GAAgB,OAAO,EAAE,KAAK,GAAGT,CAAe,QAC5E,YAAY,IAAI,CAACW,GAAOC,MAAU;AAC/B,UAAMC,IAAKF,EAAM,MAAM,GAAGC,CAAK;AAC/B,WACI,gBAAAE;AAAA,MAACC;AAAAA,MAAA;AAAA,QAEG,IAAAF;AAAA,QACA,OAAAF;AAAA,QACA,wBAAA1B;AAAA,QACA,aAAAC;AAAA,QACA,YAAAiB;AAAA,QACA,aAAaF;AAAA,MAAA;AAAA,MANRY;AAAA,IAAA;AAAA,EASjB,CAAC,EAAA,CACL;AAER;"}
@@ -0,0 +1,11 @@
1
+ import { TrackerBlock as TrackerBlockData } from './Tracker';
2
+ type TrackerBlockProps = {
3
+ id: string;
4
+ block: TrackerBlockData;
5
+ defaultBackgroundColor: string;
6
+ hoverEffect: boolean;
7
+ blockWidth: number;
8
+ blockHeight: number;
9
+ };
10
+ declare const TrackerBlock: (props: TrackerBlockProps) => import("react/jsx-runtime").JSX.Element;
11
+ export default TrackerBlock;
@@ -0,0 +1,34 @@
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import d from "../../utils/classNames.js";
3
+ import m from "../tooltip/SimpleTooltip.js";
4
+ const u = (n) => {
5
+ const { id: e, block: o, defaultBackgroundColor: a, hoverEffect: s, blockWidth: i, blockHeight: k } = n, t = !!o.onClick, p = d(
6
+ "tracker-block",
7
+ o.color || a,
8
+ s && "tracker-block-hover",
9
+ t && "cursor-pointer",
10
+ o.className
11
+ ), r = /* @__PURE__ */ c(
12
+ "div",
13
+ {
14
+ className: p,
15
+ onClick: () => o.onClick?.(e),
16
+ onKeyDown: (l) => {
17
+ t && (l.key === "Enter" || l.key === " ") && (l.preventDefault(), o.onClick?.(e));
18
+ },
19
+ role: t ? "button" : void 0,
20
+ tabIndex: t ? 0 : void 0,
21
+ "aria-label": typeof o.tooltip == "string" ? o.tooltip : void 0,
22
+ style: {
23
+ width: `${i}px`,
24
+ minWidth: `${i}px`,
25
+ height: `${k}px`
26
+ }
27
+ }
28
+ );
29
+ return o.tooltip ? /* @__PURE__ */ c(m, { content: o.tooltip, allowOnTouch: !0, placement: "top", delay: { show: 100, hide: 50 }, children: r }) : r;
30
+ };
31
+ export {
32
+ u as default
33
+ };
34
+ //# sourceMappingURL=TrackerBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TrackerBlock.js","sources":["../../../src/components/tracker/TrackerBlock.tsx"],"sourcesContent":["import classNames from '../../utils/classNames';\nimport SimpleTooltip from '../tooltip/SimpleTooltip';\nimport type { TrackerBlock as TrackerBlockData } from './Tracker';\n\ntype TrackerBlockProps = {\n id: string;\n block: TrackerBlockData;\n defaultBackgroundColor: string;\n hoverEffect: boolean;\n blockWidth: number;\n blockHeight: number;\n};\n\nconst TrackerBlock = (props: TrackerBlockProps) => {\n const { id, block, defaultBackgroundColor, hoverEffect, blockWidth, blockHeight } = props;\n\n const isClickable = Boolean(block.onClick);\n\n const blockClasses = classNames(\n 'tracker-block',\n block.color || defaultBackgroundColor,\n hoverEffect && 'tracker-block-hover',\n isClickable && 'cursor-pointer',\n block.className\n );\n\n const blockElement = (\n <div\n className={blockClasses}\n onClick={() => block.onClick?.(id)}\n onKeyDown={event => {\n if (!isClickable) {\n return;\n }\n\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n block.onClick?.(id);\n }\n }}\n role={isClickable ? 'button' : undefined}\n tabIndex={isClickable ? 0 : undefined}\n aria-label={typeof block.tooltip === 'string' ? block.tooltip : undefined}\n style={{\n width: `${blockWidth}px`,\n minWidth: `${blockWidth}px`,\n height: `${blockHeight}px`,\n }}\n />\n );\n\n if (!block.tooltip) {\n return blockElement;\n }\n\n return (\n <SimpleTooltip content={block.tooltip} allowOnTouch placement='top' delay={{ show: 100, hide: 50 }}>\n {blockElement}\n </SimpleTooltip>\n );\n};\n\nexport default TrackerBlock;\n"],"names":["TrackerBlock","props","id","block","defaultBackgroundColor","hoverEffect","blockWidth","blockHeight","isClickable","blockClasses","classNames","blockElement","jsx","event","SimpleTooltip"],"mappings":";;;AAaA,MAAMA,IAAe,CAACC,MAA6B;AAC/C,QAAM,EAAE,IAAAC,GAAI,OAAAC,GAAO,wBAAAC,GAAwB,aAAAC,GAAa,YAAAC,GAAY,aAAAC,MAAgBN,GAE9EO,IAAc,EAAQL,EAAM,SAE5BM,IAAeC;AAAA,IACjB;AAAA,IACAP,EAAM,SAASC;AAAA,IACfC,KAAe;AAAA,IACfG,KAAe;AAAA,IACfL,EAAM;AAAA,EAAA,GAGJQ,IACF,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAWH;AAAA,MACX,SAAS,MAAMN,EAAM,UAAUD,CAAE;AAAA,MACjC,WAAW,CAAAW,MAAS;AAChB,QAAKL,MAIDK,EAAM,QAAQ,WAAWA,EAAM,QAAQ,SACvCA,EAAM,eAAA,GACNV,EAAM,UAAUD,CAAE;AAAA,MAE1B;AAAA,MACA,MAAMM,IAAc,WAAW;AAAA,MAC/B,UAAUA,IAAc,IAAI;AAAA,MAC5B,cAAY,OAAOL,EAAM,WAAY,WAAWA,EAAM,UAAU;AAAA,MAChE,OAAO;AAAA,QACH,OAAO,GAAGG,CAAU;AAAA,QACpB,UAAU,GAAGA,CAAU;AAAA,QACvB,QAAQ,GAAGC,CAAW;AAAA,MAAA;AAAA,IAC1B;AAAA,EAAA;AAIR,SAAKJ,EAAM,4BAKNW,GAAA,EAAc,SAASX,EAAM,SAAS,cAAY,IAAC,WAAU,OAAM,OAAO,EAAE,MAAM,KAAK,MAAM,MACzF,UAAAQ,GACL,IANOA;AAQf;"}
@@ -8,15 +8,20 @@ export type ResponsiveVideoProps = {
8
8
  src: string;
9
9
  /**
10
10
  * Defined the aspect ratio of the video.
11
- * @default `16by9`
12
11
  *
13
12
  * Possible values are:
14
- * `ResponsiveVideo.ASPECT_RATIO_4_BY_3`, `ResponsiveVideo.ASPECT_RATIO_16_BY_9` or
15
- * `4by3`, `16by9`.
13
+ *
14
+ * - `ResponsiveVideo.ASPECT_RATIO_4_BY_3`
15
+ * - `ResponsiveVideo.ASPECT_RATIO_16_BY_9`
16
+ * - `'4by3'`
17
+ * - `'16by9'`
18
+ *
19
+ * @default '16by9'
16
20
  */
17
21
  aspectRatio: '4by3' | '16by9';
18
22
  /**
19
23
  * Allows the fullscreen feature of the underlying embedded iframe.
24
+ *
20
25
  * @default true
21
26
  */
22
27
  allowFullScreen?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
- import _ from "classnames";
2
+ import _ from "../../utils/classNames.js";
3
3
  const n = "4by3", l = "16by9", o = (r) => {
4
4
  const { src: a, className: s = "", allowFullScreen: t = !0, aspectRatio: c = "16by9" } = r, i = _("video-responsive", `video-responsive-${c}`, s && s);
5
5
  return /* @__PURE__ */ e("div", { className: i, children: /* @__PURE__ */ e("iframe", { src: a, allowFullScreen: t }) });
@@ -1 +1 @@
1
- {"version":3,"file":"ResponsiveVideo.js","sources":["../../../src/components/video/ResponsiveVideo.tsx"],"sourcesContent":["import classNames from 'classnames';\n\nconst FOUR_BY_THREE = '4by3';\nconst SIXTEEN_BY_NINE = '16by9';\n\nexport type AspectRatio = typeof FOUR_BY_THREE | typeof SIXTEEN_BY_NINE;\n\nexport type ResponsiveVideoProps = {\n /**\n * The link to the source of the video file.\n */\n src: string;\n\n /**\n * Defined the aspect ratio of the video.\n * @default `16by9`\n *\n * Possible values are:\n * `ResponsiveVideo.ASPECT_RATIO_4_BY_3`, `ResponsiveVideo.ASPECT_RATIO_16_BY_9` or\n * `4by3`, `16by9`.\n */\n aspectRatio: '4by3' | '16by9';\n\n /**\n * Allows the fullscreen feature of the underlying embedded iframe.\n * @default true\n */\n allowFullScreen?: boolean;\n\n /**\n * Additional classes added to the wrapping element.\n */\n className?: string;\n};\n\nconst ResponsiveVideo = (props: ResponsiveVideoProps) => {\n const { src, className = '', allowFullScreen = true, aspectRatio = '16by9' } = props;\n\n const wrapperClassName = classNames('video-responsive', `video-responsive-${aspectRatio}`, className && className);\n\n return (\n <div className={wrapperClassName}>\n <iframe src={src} allowFullScreen={allowFullScreen} />\n </div>\n );\n};\n\nResponsiveVideo.ASPECT_RATIO_4_BY_3 = FOUR_BY_THREE as typeof FOUR_BY_THREE;\nResponsiveVideo.ASPECT_RATIO_16_BY_9 = SIXTEEN_BY_NINE as typeof SIXTEEN_BY_NINE;\n\nexport default ResponsiveVideo;\n"],"names":["FOUR_BY_THREE","SIXTEEN_BY_NINE","ResponsiveVideo","props","src","className","allowFullScreen","aspectRatio","wrapperClassName","classNames","jsx"],"mappings":";;AAEA,MAAMA,IAAgB,QAChBC,IAAkB,SAgClBC,IAAkB,CAACC,MAAgC;AACrD,QAAM,EAAE,KAAAC,GAAK,WAAAC,IAAY,IAAI,iBAAAC,IAAkB,IAAM,aAAAC,IAAc,YAAYJ,GAEzEK,IAAmBC,EAAW,oBAAoB,oBAAoBF,CAAW,IAAIF,KAAaA,CAAS;AAEjH,SACI,gBAAAK,EAAC,SAAI,WAAWF,GACZ,4BAAC,UAAA,EAAO,KAAAJ,GAAU,iBAAAE,GAAkC,EAAA,CACxD;AAER;AAEAJ,EAAgB,sBAAsBF;AACtCE,EAAgB,uBAAuBD;"}
1
+ {"version":3,"file":"ResponsiveVideo.js","sources":["../../../src/components/video/ResponsiveVideo.tsx"],"sourcesContent":["import classNames from '../../utils/classNames';\n\nconst FOUR_BY_THREE = '4by3';\nconst SIXTEEN_BY_NINE = '16by9';\n\nexport type AspectRatio = typeof FOUR_BY_THREE | typeof SIXTEEN_BY_NINE;\n\nexport type ResponsiveVideoProps = {\n /**\n * The link to the source of the video file.\n */\n src: string;\n\n /**\n * Defined the aspect ratio of the video.\n *\n * Possible values are:\n *\n * - `ResponsiveVideo.ASPECT_RATIO_4_BY_3`\n * - `ResponsiveVideo.ASPECT_RATIO_16_BY_9`\n * - `'4by3'`\n * - `'16by9'`\n *\n * @default '16by9'\n */\n aspectRatio: '4by3' | '16by9';\n\n /**\n * Allows the fullscreen feature of the underlying embedded iframe.\n *\n * @default true\n */\n allowFullScreen?: boolean;\n\n /**\n * Additional classes added to the wrapping element.\n */\n className?: string;\n};\n\nconst ResponsiveVideo = (props: ResponsiveVideoProps) => {\n const { src, className = '', allowFullScreen = true, aspectRatio = '16by9' } = props;\n\n const wrapperClassName = classNames('video-responsive', `video-responsive-${aspectRatio}`, className && className);\n\n return (\n <div className={wrapperClassName}>\n <iframe src={src} allowFullScreen={allowFullScreen} />\n </div>\n );\n};\n\nResponsiveVideo.ASPECT_RATIO_4_BY_3 = FOUR_BY_THREE as typeof FOUR_BY_THREE;\nResponsiveVideo.ASPECT_RATIO_16_BY_9 = SIXTEEN_BY_NINE as typeof SIXTEEN_BY_NINE;\n\nexport default ResponsiveVideo;\n"],"names":["FOUR_BY_THREE","SIXTEEN_BY_NINE","ResponsiveVideo","props","src","className","allowFullScreen","aspectRatio","wrapperClassName","classNames","jsx"],"mappings":";;AAEA,MAAMA,IAAgB,QAChBC,IAAkB,SAqClBC,IAAkB,CAACC,MAAgC;AACrD,QAAM,EAAE,KAAAC,GAAK,WAAAC,IAAY,IAAI,iBAAAC,IAAkB,IAAM,aAAAC,IAAc,YAAYJ,GAEzEK,IAAmBC,EAAW,oBAAoB,oBAAoBF,CAAW,IAAIF,KAAaA,CAAS;AAEjH,SACI,gBAAAK,EAAC,SAAI,WAAWF,GACZ,4BAAC,UAAA,EAAO,KAAAJ,GAAU,iBAAAE,GAAkC,EAAA,CACxD;AAER;AAEAJ,EAAgB,sBAAsBF;AACtCE,EAAgB,uBAAuBD;"}
@@ -0,0 +1,79 @@
1
+ export type CookieSameSite = 'Strict' | 'Lax' | 'None';
2
+ export type CookieOptions = {
3
+ /**
4
+ * Cookie path scope.
5
+ *
6
+ * @default '/'
7
+ */
8
+ path?: string;
9
+ /**
10
+ * Cookie domain scope (for example `.rio.cloud`).
11
+ */
12
+ domain?: string;
13
+ /**
14
+ * Absolute expiration date for the cookie.
15
+ */
16
+ expires?: Date | string;
17
+ /**
18
+ * Cookie lifetime in seconds.
19
+ */
20
+ maxAge?: number;
21
+ /**
22
+ * Cross-site cookie behavior.
23
+ *
24
+ * Possible values are:
25
+ *
26
+ * - `Strict`
27
+ * - `Lax`
28
+ * - `None`
29
+ */
30
+ sameSite?: CookieSameSite;
31
+ /**
32
+ * Adds the `Secure` flag so the cookie is sent over HTTPS only.
33
+ */
34
+ secure?: boolean;
35
+ };
36
+ export type UseCookiesResult = {
37
+ /**
38
+ * Sets a cookie with optional metadata.
39
+ *
40
+ * @param name - Cookie name.
41
+ * @param value - Cookie value.
42
+ * @param options - Additional cookie options.
43
+ */
44
+ setCookie: (name: string, value: string, options?: CookieOptions) => void;
45
+ /**
46
+ * Deletes a cookie by name.
47
+ *
48
+ * @param name - Cookie name.
49
+ * @param options - Optional path/domain to target the correct cookie scope.
50
+ */
51
+ deleteCookie: (name: string, options?: Pick<CookieOptions, 'path' | 'domain'>) => void;
52
+ /**
53
+ * Returns true if the cookie exists.
54
+ *
55
+ * @param name - Cookie name.
56
+ */
57
+ hasCookie: (name: string) => boolean;
58
+ /**
59
+ * Reads a cookie value.
60
+ *
61
+ * @param name - Cookie name.
62
+ */
63
+ getCookie: (name: string) => string | undefined;
64
+ };
65
+ /**
66
+ * Returns helpers to set, delete, and read browser cookies.
67
+ *
68
+ * @returns {UseCookiesResult} Cookie helper functions.
69
+ *
70
+ * @example
71
+ * const { setCookie, deleteCookie, hasCookie, getCookie } = useCookies();
72
+ *
73
+ * setCookie('token', 'abc123', { path: '/', maxAge: 60 * 60 });
74
+ * const isLoggedIn = hasCookie('token');
75
+ * const token = getCookie('token');
76
+ * deleteCookie('token');
77
+ */
78
+ declare const useCookies: () => UseCookiesResult;
79
+ export default useCookies;
@@ -0,0 +1,33 @@
1
+ import { useCallback as a } from "react";
2
+ const u = () => typeof document > "u" ? {} : document.cookie.split(";").map((n) => n.trim()).filter(Boolean).reduce(
3
+ (n, o) => {
4
+ const s = o.indexOf("="), i = s >= 0 ? o.slice(0, s) : o, t = s >= 0 ? o.slice(s + 1) : "";
5
+ return n[decodeURIComponent(i)] = decodeURIComponent(t), n;
6
+ },
7
+ {}
8
+ ), f = () => {
9
+ const n = a((t, c, e = {}) => {
10
+ if (typeof document > "u")
11
+ return;
12
+ const r = [`${encodeURIComponent(t)}=${encodeURIComponent(c)}`, `path=${e.path ?? "/"}`];
13
+ if (e.domain && r.push(`domain=${e.domain}`), e.expires) {
14
+ const m = e.expires instanceof Date ? e.expires.toUTCString() : e.expires;
15
+ r.push(`expires=${m}`);
16
+ }
17
+ typeof e.maxAge == "number" && r.push(`max-age=${e.maxAge}`), e.sameSite && r.push(`samesite=${e.sameSite}`), e.secure && r.push("secure"), document.cookie = r.join("; ");
18
+ }, []), o = a(
19
+ (t, c = {}) => {
20
+ n(t, "", {
21
+ ...c,
22
+ expires: /* @__PURE__ */ new Date(0),
23
+ maxAge: 0
24
+ });
25
+ },
26
+ [n]
27
+ ), s = a((t) => Object.hasOwn(u(), t), []), i = a((t) => u()[t], []);
28
+ return { setCookie: n, deleteCookie: o, hasCookie: s, getCookie: i };
29
+ };
30
+ export {
31
+ f as default
32
+ };
33
+ //# sourceMappingURL=useCookies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCookies.js","sources":["../../src/hooks/useCookies.ts"],"sourcesContent":["import { useCallback } from 'react';\n\nexport type CookieSameSite = 'Strict' | 'Lax' | 'None';\n\nexport type CookieOptions = {\n /**\n * Cookie path scope.\n *\n * @default '/'\n */\n path?: string;\n\n /**\n * Cookie domain scope (for example `.rio.cloud`).\n */\n domain?: string;\n\n /**\n * Absolute expiration date for the cookie.\n */\n expires?: Date | string;\n\n /**\n * Cookie lifetime in seconds.\n */\n maxAge?: number;\n\n /**\n * Cross-site cookie behavior.\n *\n * Possible values are:\n *\n * - `Strict`\n * - `Lax`\n * - `None`\n */\n sameSite?: CookieSameSite;\n\n /**\n * Adds the `Secure` flag so the cookie is sent over HTTPS only.\n */\n secure?: boolean;\n};\n\nexport type UseCookiesResult = {\n /**\n * Sets a cookie with optional metadata.\n *\n * @param name - Cookie name.\n * @param value - Cookie value.\n * @param options - Additional cookie options.\n */\n setCookie: (name: string, value: string, options?: CookieOptions) => void;\n\n /**\n * Deletes a cookie by name.\n *\n * @param name - Cookie name.\n * @param options - Optional path/domain to target the correct cookie scope.\n */\n deleteCookie: (name: string, options?: Pick<CookieOptions, 'path' | 'domain'>) => void;\n\n /**\n * Returns true if the cookie exists.\n *\n * @param name - Cookie name.\n */\n hasCookie: (name: string) => boolean;\n\n /**\n * Reads a cookie value.\n *\n * @param name - Cookie name.\n */\n getCookie: (name: string) => string | undefined;\n};\n\nconst parseCookies = (): Record<string, string> => {\n if (typeof document === 'undefined') {\n return {};\n }\n\n return document.cookie\n .split(';')\n .map(entry => entry.trim())\n .filter(Boolean)\n .reduce(\n (acc, entry) => {\n const separatorIndex = entry.indexOf('=');\n const rawName = separatorIndex >= 0 ? entry.slice(0, separatorIndex) : entry;\n const rawValue = separatorIndex >= 0 ? entry.slice(separatorIndex + 1) : '';\n\n acc[decodeURIComponent(rawName)] = decodeURIComponent(rawValue);\n return acc;\n },\n {} as Record<string, string>\n );\n};\n\n/**\n * Returns helpers to set, delete, and read browser cookies.\n *\n * @returns {UseCookiesResult} Cookie helper functions.\n *\n * @example\n * const { setCookie, deleteCookie, hasCookie, getCookie } = useCookies();\n *\n * setCookie('token', 'abc123', { path: '/', maxAge: 60 * 60 });\n * const isLoggedIn = hasCookie('token');\n * const token = getCookie('token');\n * deleteCookie('token');\n */\nconst useCookies = (): UseCookiesResult => {\n const setCookie = useCallback((name: string, value: string, options: CookieOptions = {}) => {\n if (typeof document === 'undefined') {\n return;\n }\n\n const segments = [`${encodeURIComponent(name)}=${encodeURIComponent(value)}`, `path=${options.path ?? '/'}`];\n\n if (options.domain) {\n segments.push(`domain=${options.domain}`);\n }\n\n if (options.expires) {\n const expires = options.expires instanceof Date ? options.expires.toUTCString() : options.expires;\n segments.push(`expires=${expires}`);\n }\n\n if (typeof options.maxAge === 'number') {\n segments.push(`max-age=${options.maxAge}`);\n }\n\n if (options.sameSite) {\n segments.push(`samesite=${options.sameSite}`);\n }\n\n if (options.secure) {\n segments.push('secure');\n }\n\n // biome-ignore lint/suspicious/noDocumentCookie: this hook intentionally manages cookies through the browser cookie API.\n document.cookie = segments.join('; ');\n }, []);\n\n const deleteCookie = useCallback(\n (name: string, options: Pick<CookieOptions, 'path' | 'domain'> = {}) => {\n setCookie(name, '', {\n ...options,\n expires: new Date(0),\n maxAge: 0,\n });\n },\n [setCookie]\n );\n\n const hasCookie = useCallback((name: string) => {\n return Object.hasOwn(parseCookies(), name);\n }, []);\n\n const getCookie = useCallback((name: string) => {\n return parseCookies()[name];\n }, []);\n\n return { setCookie, deleteCookie, hasCookie, getCookie };\n};\n\nexport default useCookies;\n"],"names":["parseCookies","entry","acc","separatorIndex","rawName","rawValue","useCookies","setCookie","useCallback","name","value","options","segments","expires","deleteCookie","hasCookie","getCookie"],"mappings":";AA6EA,MAAMA,IAAe,MACb,OAAO,WAAa,MACb,CAAA,IAGJ,SAAS,OACX,MAAM,GAAG,EACT,IAAI,CAAAC,MAASA,EAAM,KAAA,CAAM,EACzB,OAAO,OAAO,EACd;AAAA,EACG,CAACC,GAAKD,MAAU;AACZ,UAAME,IAAiBF,EAAM,QAAQ,GAAG,GAClCG,IAAUD,KAAkB,IAAIF,EAAM,MAAM,GAAGE,CAAc,IAAIF,GACjEI,IAAWF,KAAkB,IAAIF,EAAM,MAAME,IAAiB,CAAC,IAAI;AAEzE,WAAAD,EAAI,mBAAmBE,CAAO,CAAC,IAAI,mBAAmBC,CAAQ,GACvDH;AAAA,EACX;AAAA,EACA,CAAA;AAAC,GAiBPI,IAAa,MAAwB;AACvC,QAAMC,IAAYC,EAAY,CAACC,GAAcC,GAAeC,IAAyB,OAAO;AACxF,QAAI,OAAO,WAAa;AACpB;AAGJ,UAAMC,IAAW,CAAC,GAAG,mBAAmBH,CAAI,CAAC,IAAI,mBAAmBC,CAAK,CAAC,IAAI,QAAQC,EAAQ,QAAQ,GAAG,EAAE;AAM3G,QAJIA,EAAQ,UACRC,EAAS,KAAK,UAAUD,EAAQ,MAAM,EAAE,GAGxCA,EAAQ,SAAS;AACjB,YAAME,IAAUF,EAAQ,mBAAmB,OAAOA,EAAQ,QAAQ,gBAAgBA,EAAQ;AAC1F,MAAAC,EAAS,KAAK,WAAWC,CAAO,EAAE;AAAA,IACtC;AAEA,IAAI,OAAOF,EAAQ,UAAW,YAC1BC,EAAS,KAAK,WAAWD,EAAQ,MAAM,EAAE,GAGzCA,EAAQ,YACRC,EAAS,KAAK,YAAYD,EAAQ,QAAQ,EAAE,GAG5CA,EAAQ,UACRC,EAAS,KAAK,QAAQ,GAI1B,SAAS,SAASA,EAAS,KAAK,IAAI;AAAA,EACxC,GAAG,CAAA,CAAE,GAECE,IAAeN;AAAA,IACjB,CAACC,GAAcE,IAAkD,OAAO;AACpE,MAAAJ,EAAUE,GAAM,IAAI;AAAA,QAChB,GAAGE;AAAA,QACH,SAAS,oBAAI,KAAK,CAAC;AAAA,QACnB,QAAQ;AAAA,MAAA,CACX;AAAA,IACL;AAAA,IACA,CAACJ,CAAS;AAAA,EAAA,GAGRQ,IAAYP,EAAY,CAACC,MACpB,OAAO,OAAOT,EAAA,GAAgBS,CAAI,GAC1C,CAAA,CAAE,GAECO,IAAYR,EAAY,CAACC,MACpBT,EAAA,EAAeS,CAAI,GAC3B,CAAA,CAAE;AAEL,SAAO,EAAE,WAAAF,GAAW,cAAAO,GAAc,WAAAC,GAAW,WAAAC,EAAA;AACjD;"}
@@ -1,12 +1,12 @@
1
- import { useRef as u, useEffect as o } from "react";
1
+ import { useRef as u, useEffect as s } from "react";
2
2
  const f = (e, r) => {
3
3
  const t = u(null), n = u(e);
4
- return o(() => {
4
+ return s(() => {
5
5
  n.current = e;
6
- }, [e]), o(() => {
7
- const s = () => n.current();
6
+ }, [e]), s(() => {
7
+ const o = () => n.current();
8
8
  if (typeof r == "number")
9
- return t.current = window.setInterval(s, r), () => window.clearInterval(t.current ?? void 0);
9
+ return t.current = setInterval(o, r), () => clearInterval(t.current ?? void 0);
10
10
  }, [r]), t;
11
11
  };
12
12
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"useInterval.js","sources":["../../src/hooks/useInterval.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\n// See https://overreacted.io/making-setinterval-declarative-with-react-hooks/\n\n/**\n * Custom hook to execute a callback function at specified intervals.\n *\n * @param callback - The callback function to be executed.\n * @param delay - The interval duration in milliseconds. Set to null to stop the interval.\n *\n * @returns A mutable ref object that holds the interval ID.\n */\nconst useInterval = (callback: () => void, delay: number | null): React.MutableRefObject<number | null> => {\n const intervalRef = useRef<number | null>(null);\n const savedCallback = useRef<() => void>(callback);\n\n useEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n\n useEffect(() => {\n const tick = () => savedCallback.current();\n\n if (typeof delay === 'number') {\n intervalRef.current = window.setInterval(tick, delay);\n return () => window.clearInterval(intervalRef.current ?? undefined);\n }\n }, [delay]);\n\n return intervalRef;\n};\n\nexport default useInterval;\n"],"names":["useInterval","callback","delay","intervalRef","useRef","savedCallback","useEffect","tick"],"mappings":";AAYA,MAAMA,IAAc,CAACC,GAAsBC,MAAgE;AACvG,QAAMC,IAAcC,EAAsB,IAAI,GACxCC,IAAgBD,EAAmBH,CAAQ;AAEjD,SAAAK,EAAU,MAAM;AACZ,IAAAD,EAAc,UAAUJ;AAAA,EAC5B,GAAG,CAACA,CAAQ,CAAC,GAEbK,EAAU,MAAM;AACZ,UAAMC,IAAO,MAAMF,EAAc,QAAA;AAEjC,QAAI,OAAOH,KAAU;AACjB,aAAAC,EAAY,UAAU,OAAO,YAAYI,GAAML,CAAK,GAC7C,MAAM,OAAO,cAAcC,EAAY,WAAW,MAAS;AAAA,EAE1E,GAAG,CAACD,CAAK,CAAC,GAEHC;AACX;"}
1
+ {"version":3,"file":"useInterval.js","sources":["../../src/hooks/useInterval.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\n// See https://overreacted.io/making-setinterval-declarative-with-react-hooks/\n\n/**\n * Custom hook to execute a callback function at specified intervals.\n *\n * @param callback - The callback function to be executed.\n * @param delay - The interval duration in milliseconds. Set to null to stop the interval.\n *\n * @returns A mutable ref object that holds the interval ID.\n */\nconst useInterval = (callback: () => void, delay: number | null): React.MutableRefObject<number | null> => {\n const intervalRef = useRef<number | null>(null);\n const savedCallback = useRef<() => void>(callback);\n\n useEffect(() => {\n savedCallback.current = callback;\n }, [callback]);\n\n useEffect(() => {\n const tick = () => savedCallback.current();\n\n if (typeof delay === 'number') {\n intervalRef.current = setInterval(tick, delay) as unknown as number;\n return () => clearInterval(intervalRef.current ?? undefined);\n }\n }, [delay]);\n\n return intervalRef;\n};\n\nexport default useInterval;\n"],"names":["useInterval","callback","delay","intervalRef","useRef","savedCallback","useEffect","tick"],"mappings":";AAYA,MAAMA,IAAc,CAACC,GAAsBC,MAAgE;AACvG,QAAMC,IAAcC,EAAsB,IAAI,GACxCC,IAAgBD,EAAmBH,CAAQ;AAEjD,SAAAK,EAAU,MAAM;AACZ,IAAAD,EAAc,UAAUJ;AAAA,EAC5B,GAAG,CAACA,CAAQ,CAAC,GAEbK,EAAU,MAAM;AACZ,UAAMC,IAAO,MAAMF,EAAc,QAAA;AAEjC,QAAI,OAAOH,KAAU;AACjB,aAAAC,EAAY,UAAU,YAAYI,GAAML,CAAK,GACtC,MAAM,cAAcC,EAAY,WAAW,MAAS;AAAA,EAEnE,GAAG,CAACD,CAAK,CAAC,GAEHC;AACX;"}
@@ -1,5 +1,5 @@
1
1
  import { useRef as a, useState as E, useEffect as I } from "react";
2
- const F = ({
2
+ const L = ({
3
3
  ref: d,
4
4
  onFocusWithin: u = () => {
5
5
  },
@@ -17,7 +17,7 @@ const F = ({
17
17
  const f = () => {
18
18
  s(), r || (i(!0), u());
19
19
  }, l = (v) => {
20
- s(), t.current = window.setTimeout(() => {
20
+ s(), t.current = setTimeout(() => {
21
21
  e.contains(v.relatedTarget) || (i(!1), o()), t.current = null;
22
22
  }, c);
23
23
  };
@@ -30,6 +30,6 @@ const F = ({
30
30
  };
31
31
  };
32
32
  export {
33
- F as default
33
+ L as default
34
34
  };
35
35
  //# sourceMappingURL=useIsFocusWithin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useIsFocusWithin.js","sources":["../../src/hooks/useIsFocusWithin.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\ntype UseIsFocusWithinOptions<T extends HTMLElement> = {\n /**\n * Optional external ref to the DOM element to track.\n * If not provided, the hook will return its own internal ref.\n */\n ref?: React.RefObject<T>;\n\n /**\n * Optional callback triggered when focus enters the element or its children.\n */\n onFocusWithin?: () => void;\n\n /**\n * Optional callback triggered when focus leaves the element and all its children.\n */\n onBlurWithin?: () => void;\n\n /**\n * Optional delay (in ms) before calling onBlurWithin.\n * Useful when focus might quickly shift between internal elements.\n * @default 0\n */\n delay?: number;\n};\n\n/**\n * React hook that tracks whether focus is currently within a given element or its children.\n * Provides a boolean state and a ref to attach to the tracked element.\n *\n * @param options Hook configuration including external ref, callbacks, and optional delay.\n * @returns An object containing the ref and whether focus is currently within the element.\n */\nconst useIsFocusWithin = <T extends HTMLElement>({\n ref: externalRef,\n onFocusWithin = () => {},\n onBlurWithin = () => {},\n delay = 0,\n}: UseIsFocusWithinOptions<T> = {}) => {\n const internalRef = useRef<T>(null);\n const targetRef = externalRef ?? internalRef;\n\n const [isFocusedWithin, setIsFocusedWithin] = useState(false);\n const timeoutId = useRef<number | null>(null);\n\n const clearTimeoutIfAny = () => {\n if (timeoutId.current !== null) {\n window.clearTimeout(timeoutId.current);\n timeoutId.current = null;\n }\n };\n\n useEffect(() => {\n const node = targetRef.current;\n if (!node) {\n return;\n }\n\n const handleFocusIn = () => {\n clearTimeoutIfAny();\n if (!isFocusedWithin) {\n setIsFocusedWithin(true);\n onFocusWithin();\n }\n };\n\n const handleFocusOut = (e: FocusEvent) => {\n clearTimeoutIfAny();\n timeoutId.current = window.setTimeout(() => {\n if (!node.contains(e.relatedTarget as Node)) {\n setIsFocusedWithin(false);\n onBlurWithin();\n }\n timeoutId.current = null;\n }, delay);\n };\n\n node.addEventListener('focusin', handleFocusIn);\n node.addEventListener('focusout', handleFocusOut);\n\n return () => {\n node.removeEventListener('focusin', handleFocusIn);\n node.removeEventListener('focusout', handleFocusOut);\n clearTimeoutIfAny();\n };\n }, [targetRef, delay, onFocusWithin, onBlurWithin, isFocusedWithin]);\n\n return {\n ref: targetRef,\n isFocusedWithin,\n };\n};\n\nexport default useIsFocusWithin;\n"],"names":["useIsFocusWithin","externalRef","onFocusWithin","onBlurWithin","delay","internalRef","useRef","targetRef","isFocusedWithin","setIsFocusedWithin","useState","timeoutId","clearTimeoutIfAny","useEffect","node","handleFocusIn","handleFocusOut","e"],"mappings":";AAkCA,MAAMA,IAAmB,CAAwB;AAAA,EAC7C,KAAKC;AAAA,EACL,eAAAC,IAAgB,MAAM;AAAA,EAAC;AAAA,EACvB,cAAAC,IAAe,MAAM;AAAA,EAAC;AAAA,EACtB,OAAAC,IAAQ;AACZ,IAAgC,OAAO;AACnC,QAAMC,IAAcC,EAAU,IAAI,GAC5BC,IAAYN,KAAeI,GAE3B,CAACG,GAAiBC,CAAkB,IAAIC,EAAS,EAAK,GACtDC,IAAYL,EAAsB,IAAI,GAEtCM,IAAoB,MAAM;AAC5B,IAAID,EAAU,YAAY,SACtB,OAAO,aAAaA,EAAU,OAAO,GACrCA,EAAU,UAAU;AAAA,EAE5B;AAEA,SAAAE,EAAU,MAAM;AACZ,UAAMC,IAAOP,EAAU;AACvB,QAAI,CAACO;AACD;AAGJ,UAAMC,IAAgB,MAAM;AACxB,MAAAH,EAAA,GACKJ,MACDC,EAAmB,EAAI,GACvBP,EAAA;AAAA,IAER,GAEMc,IAAiB,CAACC,MAAkB;AACtC,MAAAL,EAAA,GACAD,EAAU,UAAU,OAAO,WAAW,MAAM;AACxC,QAAKG,EAAK,SAASG,EAAE,aAAqB,MACtCR,EAAmB,EAAK,GACxBN,EAAA,IAEJQ,EAAU,UAAU;AAAA,MACxB,GAAGP,CAAK;AAAA,IACZ;AAEA,WAAAU,EAAK,iBAAiB,WAAWC,CAAa,GAC9CD,EAAK,iBAAiB,YAAYE,CAAc,GAEzC,MAAM;AACT,MAAAF,EAAK,oBAAoB,WAAWC,CAAa,GACjDD,EAAK,oBAAoB,YAAYE,CAAc,GACnDJ,EAAA;AAAA,IACJ;AAAA,EACJ,GAAG,CAACL,GAAWH,GAAOF,GAAeC,GAAcK,CAAe,CAAC,GAE5D;AAAA,IACH,KAAKD;AAAA,IACL,iBAAAC;AAAA,EAAA;AAER;"}
1
+ {"version":3,"file":"useIsFocusWithin.js","sources":["../../src/hooks/useIsFocusWithin.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\n\ntype UseIsFocusWithinOptions<T extends HTMLElement> = {\n /**\n * Optional external ref to the DOM element to track.\n * If not provided, the hook will return its own internal ref.\n */\n ref?: React.RefObject<T>;\n\n /**\n * Optional callback triggered when focus enters the element or its children.\n */\n onFocusWithin?: () => void;\n\n /**\n * Optional callback triggered when focus leaves the element and all its children.\n */\n onBlurWithin?: () => void;\n\n /**\n * Optional delay (in ms) before calling onBlurWithin.\n * Useful when focus might quickly shift between internal elements.\n * @default 0\n */\n delay?: number;\n};\n\n/**\n * React hook that tracks whether focus is currently within a given element or its children.\n * Provides a boolean state and a ref to attach to the tracked element.\n *\n * @param options Hook configuration including external ref, callbacks, and optional delay.\n * @returns An object containing the ref and whether focus is currently within the element.\n */\nconst useIsFocusWithin = <T extends HTMLElement>({\n ref: externalRef,\n onFocusWithin = () => {},\n onBlurWithin = () => {},\n delay = 0,\n}: UseIsFocusWithinOptions<T> = {}) => {\n const internalRef = useRef<T>(null);\n const targetRef = externalRef ?? internalRef;\n\n const [isFocusedWithin, setIsFocusedWithin] = useState(false);\n const timeoutId = useRef<number | null>(null);\n\n const clearTimeoutIfAny = () => {\n if (timeoutId.current !== null) {\n window.clearTimeout(timeoutId.current);\n timeoutId.current = null;\n }\n };\n\n useEffect(() => {\n const node = targetRef.current;\n if (!node) {\n return;\n }\n\n const handleFocusIn = () => {\n clearTimeoutIfAny();\n if (!isFocusedWithin) {\n setIsFocusedWithin(true);\n onFocusWithin();\n }\n };\n\n const handleFocusOut = (e: FocusEvent) => {\n clearTimeoutIfAny();\n timeoutId.current = setTimeout(() => {\n if (!node.contains(e.relatedTarget as Node)) {\n setIsFocusedWithin(false);\n onBlurWithin();\n }\n timeoutId.current = null;\n }, delay) as unknown as number;\n };\n\n node.addEventListener('focusin', handleFocusIn);\n node.addEventListener('focusout', handleFocusOut);\n\n return () => {\n node.removeEventListener('focusin', handleFocusIn);\n node.removeEventListener('focusout', handleFocusOut);\n clearTimeoutIfAny();\n };\n }, [targetRef, delay, onFocusWithin, onBlurWithin, isFocusedWithin]);\n\n return {\n ref: targetRef,\n isFocusedWithin,\n };\n};\n\nexport default useIsFocusWithin;\n"],"names":["useIsFocusWithin","externalRef","onFocusWithin","onBlurWithin","delay","internalRef","useRef","targetRef","isFocusedWithin","setIsFocusedWithin","useState","timeoutId","clearTimeoutIfAny","useEffect","node","handleFocusIn","handleFocusOut","e"],"mappings":";AAkCA,MAAMA,IAAmB,CAAwB;AAAA,EAC7C,KAAKC;AAAA,EACL,eAAAC,IAAgB,MAAM;AAAA,EAAC;AAAA,EACvB,cAAAC,IAAe,MAAM;AAAA,EAAC;AAAA,EACtB,OAAAC,IAAQ;AACZ,IAAgC,OAAO;AACnC,QAAMC,IAAcC,EAAU,IAAI,GAC5BC,IAAYN,KAAeI,GAE3B,CAACG,GAAiBC,CAAkB,IAAIC,EAAS,EAAK,GACtDC,IAAYL,EAAsB,IAAI,GAEtCM,IAAoB,MAAM;AAC5B,IAAID,EAAU,YAAY,SACtB,OAAO,aAAaA,EAAU,OAAO,GACrCA,EAAU,UAAU;AAAA,EAE5B;AAEA,SAAAE,EAAU,MAAM;AACZ,UAAMC,IAAOP,EAAU;AACvB,QAAI,CAACO;AACD;AAGJ,UAAMC,IAAgB,MAAM;AACxB,MAAAH,EAAA,GACKJ,MACDC,EAAmB,EAAI,GACvBP,EAAA;AAAA,IAER,GAEMc,IAAiB,CAACC,MAAkB;AACtC,MAAAL,EAAA,GACAD,EAAU,UAAU,WAAW,MAAM;AACjC,QAAKG,EAAK,SAASG,EAAE,aAAqB,MACtCR,EAAmB,EAAK,GACxBN,EAAA,IAEJQ,EAAU,UAAU;AAAA,MACxB,GAAGP,CAAK;AAAA,IACZ;AAEA,WAAAU,EAAK,iBAAiB,WAAWC,CAAa,GAC9CD,EAAK,iBAAiB,YAAYE,CAAc,GAEzC,MAAM;AACT,MAAAF,EAAK,oBAAoB,WAAWC,CAAa,GACjDD,EAAK,oBAAoB,YAAYE,CAAc,GACnDJ,EAAA;AAAA,IACJ;AAAA,EACJ,GAAG,CAACL,GAAWH,GAAOF,GAAeC,GAAcK,CAAe,CAAC,GAE5D;AAAA,IACH,KAAKD;AAAA,IACL,iBAAAC;AAAA,EAAA;AAER;"}
package/hooks/useKey.d.ts CHANGED
@@ -9,5 +9,5 @@ type KeyboardEventType = 'keyup' | 'keydown' | 'keypress';
9
9
  * If the first argument is a callback, this is the node (defaults to document).
10
10
  * @param [node=document] - Optional DOM node to attach the event listener to (defaults to document).
11
11
  */
12
- declare const useKey: (keyOrCallback: string | ((event: KeyboardEvent) => void), callbackOrEventTypes?: (event: KeyboardEvent) => void | KeyboardEventType[], eventTypesOrNode?: KeyboardEventType[] | Document, node?: Document | HTMLElement) => void;
12
+ declare const useKey: (keyOrCallback: string | ((event: KeyboardEvent) => void), callbackOrEventTypes?: ((event: KeyboardEvent) => void) | KeyboardEventType[], eventTypesOrNode?: KeyboardEventType[] | Document, node?: Document | HTMLElement) => void;
13
13
  export default useKey;
@@ -1 +1 @@
1
- {"version":3,"file":"useKey.js","sources":["../../src/hooks/useKey.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\ntype KeyboardEventType = 'keyup' | 'keydown' | 'keypress';\n\n/**\n * Custom hook to handle keyboard events.\n *\n * @param keyOrCallback - Either a key string (e.g., 'Enter') or a callback function.\n * @param callbackOrEventTypes - If the first argument is a key, this should be the callback function.\n * If the first argument is a callback, this is an optional array of event types.\n * @param [eventTypesOrNode=['keydown']] - If the first argument is a key, this should be an array of event types.\n * If the first argument is a callback, this is the node (defaults to document).\n * @param [node=document] - Optional DOM node to attach the event listener to (defaults to document).\n */\nconst useKey = (\n keyOrCallback: string | ((event: KeyboardEvent) => void),\n callbackOrEventTypes?: (event: KeyboardEvent) => void | KeyboardEventType[],\n eventTypesOrNode: KeyboardEventType[] | Document = ['keydown'],\n node: Document | HTMLElement = document\n) => {\n const callbacksRef = useRef<((event: KeyboardEvent) => void)[]>([]);\n\n useEffect(() => {\n const isKeyMode = typeof keyOrCallback === 'string';\n\n const callback = isKeyMode\n ? (callbackOrEventTypes as (event: KeyboardEvent) => void)\n : (keyOrCallback as (event: KeyboardEvent) => void);\n\n const keyHandler = (event: KeyboardEvent) => {\n if (isKeyMode) {\n if (event.key === keyOrCallback) {\n callback(event);\n }\n } else {\n callback(event);\n }\n };\n\n // Register the keyHandler\n callbacksRef.current.push(keyHandler);\n\n const genericHandler = (event: KeyboardEvent) => {\n for (const callBecky of callbacksRef.current) {\n callBecky(event);\n }\n };\n\n const eventTypes = Array.isArray(eventTypesOrNode) ? (eventTypesOrNode as KeyboardEventType[]) : ['keydown'];\n\n for (const eventType of eventTypes) {\n node.addEventListener(eventType, genericHandler as EventListener);\n }\n\n return () => {\n for (const eventType of eventTypes) {\n node.removeEventListener(eventType, genericHandler as EventListener);\n }\n // Clean up callback reference\n callbacksRef.current = callbacksRef.current.filter(singleCallback => singleCallback !== keyHandler);\n };\n }, [keyOrCallback, callbackOrEventTypes, eventTypesOrNode, node]);\n};\n\nexport default useKey;\n"],"names":["useKey","keyOrCallback","callbackOrEventTypes","eventTypesOrNode","node","callbacksRef","useRef","useEffect","isKeyMode","callback","keyHandler","event","genericHandler","callBecky","eventTypes","eventType","singleCallback"],"mappings":";AAcA,MAAMA,IAAS,CACXC,GACAC,GACAC,IAAmD,CAAC,SAAS,GAC7DC,IAA+B,aAC9B;AACD,QAAMC,IAAeC,EAA2C,EAAE;AAElE,EAAAC,EAAU,MAAM;AACZ,UAAMC,IAAY,OAAOP,KAAkB,UAErCQ,IAAWD,IACVN,IACAD,GAEDS,IAAa,CAACC,MAAyB;AACzC,MAAIH,IACIG,EAAM,QAAQV,KACdQ,EAASE,CAAK,IAGlBF,EAASE,CAAK;AAAA,IAEtB;AAGA,IAAAN,EAAa,QAAQ,KAAKK,CAAU;AAEpC,UAAME,IAAiB,CAACD,MAAyB;AAC7C,iBAAWE,KAAaR,EAAa;AACjC,QAAAQ,EAAUF,CAAK;AAAA,IAEvB,GAEMG,IAAa,MAAM,QAAQX,CAAgB,IAAKA,IAA2C,CAAC,SAAS;AAE3G,eAAWY,KAAaD;AACpB,MAAAV,EAAK,iBAAiBW,GAAWH,CAA+B;AAGpE,WAAO,MAAM;AACT,iBAAWG,KAAaD;AACpB,QAAAV,EAAK,oBAAoBW,GAAWH,CAA+B;AAGvE,MAAAP,EAAa,UAAUA,EAAa,QAAQ,OAAO,CAAAW,MAAkBA,MAAmBN,CAAU;AAAA,IACtG;AAAA,EACJ,GAAG,CAACT,GAAeC,GAAsBC,GAAkBC,CAAI,CAAC;AACpE;"}
1
+ {"version":3,"file":"useKey.js","sources":["../../src/hooks/useKey.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\ntype KeyboardEventType = 'keyup' | 'keydown' | 'keypress';\n\n/**\n * Custom hook to handle keyboard events.\n *\n * @param keyOrCallback - Either a key string (e.g., 'Enter') or a callback function.\n * @param callbackOrEventTypes - If the first argument is a key, this should be the callback function.\n * If the first argument is a callback, this is an optional array of event types.\n * @param [eventTypesOrNode=['keydown']] - If the first argument is a key, this should be an array of event types.\n * If the first argument is a callback, this is the node (defaults to document).\n * @param [node=document] - Optional DOM node to attach the event listener to (defaults to document).\n */\nconst useKey = (\n keyOrCallback: string | ((event: KeyboardEvent) => void),\n callbackOrEventTypes?: ((event: KeyboardEvent) => void) | KeyboardEventType[],\n eventTypesOrNode: KeyboardEventType[] | Document = ['keydown'],\n node: Document | HTMLElement = document\n) => {\n const callbacksRef = useRef<((event: KeyboardEvent) => void)[]>([]);\n\n useEffect(() => {\n const isKeyMode = typeof keyOrCallback === 'string';\n\n const callback = isKeyMode\n ? (callbackOrEventTypes as (event: KeyboardEvent) => void)\n : (keyOrCallback as (event: KeyboardEvent) => void);\n\n const keyHandler = (event: KeyboardEvent) => {\n if (isKeyMode) {\n if (event.key === keyOrCallback) {\n callback(event);\n }\n } else {\n callback(event);\n }\n };\n\n // Register the keyHandler\n callbacksRef.current.push(keyHandler);\n\n const genericHandler = (event: KeyboardEvent) => {\n for (const callBecky of callbacksRef.current) {\n callBecky(event);\n }\n };\n\n const eventTypes = Array.isArray(eventTypesOrNode) ? (eventTypesOrNode as KeyboardEventType[]) : ['keydown'];\n\n for (const eventType of eventTypes) {\n node.addEventListener(eventType, genericHandler as EventListener);\n }\n\n return () => {\n for (const eventType of eventTypes) {\n node.removeEventListener(eventType, genericHandler as EventListener);\n }\n // Clean up callback reference\n callbacksRef.current = callbacksRef.current.filter(singleCallback => singleCallback !== keyHandler);\n };\n }, [keyOrCallback, callbackOrEventTypes, eventTypesOrNode, node]);\n};\n\nexport default useKey;\n"],"names":["useKey","keyOrCallback","callbackOrEventTypes","eventTypesOrNode","node","callbacksRef","useRef","useEffect","isKeyMode","callback","keyHandler","event","genericHandler","callBecky","eventTypes","eventType","singleCallback"],"mappings":";AAcA,MAAMA,IAAS,CACXC,GACAC,GACAC,IAAmD,CAAC,SAAS,GAC7DC,IAA+B,aAC9B;AACD,QAAMC,IAAeC,EAA2C,EAAE;AAElE,EAAAC,EAAU,MAAM;AACZ,UAAMC,IAAY,OAAOP,KAAkB,UAErCQ,IAAWD,IACVN,IACAD,GAEDS,IAAa,CAACC,MAAyB;AACzC,MAAIH,IACIG,EAAM,QAAQV,KACdQ,EAASE,CAAK,IAGlBF,EAASE,CAAK;AAAA,IAEtB;AAGA,IAAAN,EAAa,QAAQ,KAAKK,CAAU;AAEpC,UAAME,IAAiB,CAACD,MAAyB;AAC7C,iBAAWE,KAAaR,EAAa;AACjC,QAAAQ,EAAUF,CAAK;AAAA,IAEvB,GAEMG,IAAa,MAAM,QAAQX,CAAgB,IAAKA,IAA2C,CAAC,SAAS;AAE3G,eAAWY,KAAaD;AACpB,MAAAV,EAAK,iBAAiBW,GAAWH,CAA+B;AAGpE,WAAO,MAAM;AACT,iBAAWG,KAAaD;AACpB,QAAAV,EAAK,oBAAoBW,GAAWH,CAA+B;AAGvE,MAAAP,EAAa,UAAUA,EAAa,QAAQ,OAAO,CAAAW,MAAkBA,MAAmBN,CAAU;AAAA,IACtG;AAAA,EACJ,GAAG,CAACT,GAAeC,GAAsBC,GAAkBC,CAAI,CAAC;AACpE;"}