@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
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Keeps a mutable ref in sync with the latest value from the current render.
3
+ *
4
+ * Useful when an effect or callback must always access the newest value
5
+ * without adding that value to a dependency array and re-triggering logic.
6
+ *
7
+ * Common use cases:
8
+ * - Access latest callback props inside long-lived effects/listeners
9
+ * - Avoid stale closures in timers, subscriptions, and event handlers
10
+ *
11
+ * @typeParam TValue - The value type to keep up to date.
12
+ * @param value - Current value from render scope.
13
+ * @returns A ref whose `.current` always points to the latest value.
14
+ */
15
+ declare const useLatest: <TValue>(value: TValue) => React.MutableRefObject<TValue>;
16
+ export default useLatest;
@@ -0,0 +1,11 @@
1
+ import { useRef as r, useEffect as s } from "react";
2
+ const o = (t) => {
3
+ const e = r(t);
4
+ return s(() => {
5
+ e.current = t;
6
+ }, [t]), e;
7
+ };
8
+ export {
9
+ o as default
10
+ };
11
+ //# sourceMappingURL=useLatest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLatest.js","sources":["../../src/hooks/useLatest.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\n\n/**\n * Keeps a mutable ref in sync with the latest value from the current render.\n *\n * Useful when an effect or callback must always access the newest value\n * without adding that value to a dependency array and re-triggering logic.\n *\n * Common use cases:\n * - Access latest callback props inside long-lived effects/listeners\n * - Avoid stale closures in timers, subscriptions, and event handlers\n *\n * @typeParam TValue - The value type to keep up to date.\n * @param value - Current value from render scope.\n * @returns A ref whose `.current` always points to the latest value.\n */\nconst useLatest = <TValue>(value: TValue): React.MutableRefObject<TValue> => {\n const ref = useRef(value);\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref;\n};\n\nexport default useLatest;\n"],"names":["useLatest","value","ref","useRef","useEffect"],"mappings":";AAgBA,MAAMA,IAAY,CAASC,MAAkD;AACzE,QAAMC,IAAMC,EAAOF,CAAK;AAExB,SAAAG,EAAU,MAAM;AACZ,IAAAF,EAAI,UAAUD;AAAA,EAClB,GAAG,CAACA,CAAK,CAAC,GAEHC;AACX;"}
@@ -2,6 +2,83 @@ import { PopoverDOM as DriverPopoverDOM, State as DriverState, AllowedButtons, D
2
2
  export type PopoverDOM = DriverPopoverDOM;
3
3
  export type OnboardingState = DriverState;
4
4
  type DriverCallbackOptions = Parameters<DriverHook>[2];
5
+ type OnboardingPopoverContent = {
6
+ /**
7
+ * Title text to be shown.
8
+ *
9
+ * You can use HTML here, but maybe you shouldn't.
10
+ */
11
+ title?: string;
12
+ /**
13
+ * Description text to be shown.
14
+ *
15
+ * You can use HTML here, but maybe you shouldn't.
16
+ */
17
+ description?: string;
18
+ /**
19
+ * The position of the popover relative to the target element.
20
+ *
21
+ * @default 'left'
22
+ */
23
+ side?: 'top' | 'right' | 'bottom' | 'left' | 'over';
24
+ /**
25
+ * Where the popover is anchored to the target element.
26
+ *
27
+ * @default 'start'
28
+ */
29
+ align?: 'start' | 'center' | 'end';
30
+ /**
31
+ * The buttons that should be shown in the popover - for this step only.
32
+ *
33
+ * When highlighting a single element (there is just a single step), there are no buttons by default. When
34
+ * showing a step of a multi-step tour, all buttons are shown by default.
35
+ *
36
+ * The "close" button is a simple "X" in the popover.
37
+ * The "previous" and "next" buttons are actual text buttons. can define the text contents of those buttons via
38
+ * the {@link prevBtnText}, {@link nextBtnText} and {@link doneBtnText} properties.
39
+ *
40
+ * This overrides the showButtons array on the {@link OnboardingOptions}.
41
+ */
42
+ showButtons?: AllowedButtons[];
43
+ /**
44
+ * The buttons that should be disabled in the popover - for this step only.
45
+ *
46
+ * This is useful when you want to show some of the buttons, but disable them anyway.
47
+ *
48
+ * This overrides the disableButtons array on the {@link OnboardingOptions}.
49
+ */
50
+ disableButtons?: AllowedButtons[];
51
+ /**
52
+ * Whether to disable interaction with the highlighted element.
53
+ *
54
+ * @default false
55
+ */
56
+ disableActiveInteraction?: boolean;
57
+ /**
58
+ * Custom class to add to the popover element.
59
+ *
60
+ * This can be used to style the popover.
61
+ */
62
+ popoverClass?: string;
63
+ /**
64
+ * Text to use for the "previous" button - specific for this step only.
65
+ *
66
+ * This overrides the prevBtnText on the {@link OnboardingOptions}.
67
+ */
68
+ prevBtnText?: string;
69
+ /**
70
+ * Text to use for the "next" button - specific for this step only.
71
+ *
72
+ * This overrides the nextBtnText on the {@link OnboardingOptions}.
73
+ */
74
+ nextBtnText?: string;
75
+ /**
76
+ * Text to use for the "done" (a.k.a. the final "next") button - specific for this step only.
77
+ *
78
+ * This overrides the doneBtnText on the {@link OnboardingOptions}.
79
+ */
80
+ doneBtnText?: string;
81
+ };
5
82
  /**
6
83
  * Describes a single step in an Onboarding Tour.
7
84
  *
@@ -26,83 +103,7 @@ export type OnboardingStep = DriveStep & {
26
103
  /**
27
104
  * Defines the content and appearance of the popover.
28
105
  */
29
- popover: {
30
- /**
31
- * Title text to be shown.
32
- *
33
- * You can use HTML here, but maybe you shouldn't.
34
- */
35
- title?: string;
36
- /**
37
- * Description text to be shown.
38
- *
39
- * You can use HTML here, but maybe you shouldn't.
40
- */
41
- description?: string;
42
- /**
43
- * The position of the popover relative to the target element.
44
- *
45
- * @default 'left'
46
- */
47
- side?: 'top' | 'right' | 'bottom' | 'left' | 'over';
48
- /**
49
- * Where the popover is anchored to the target element.
50
- *
51
- * @default 'start'
52
- */
53
- align?: 'start' | 'center' | 'end';
54
- /**
55
- * The buttons that should be shown in the popover - for this step only.
56
- *
57
- * When highlighting a single element (there is just a single step), there are no buttons by default. When
58
- * showing a step of a multi-step tour, all buttons are shown by default.
59
- *
60
- * The "close" button is a simple "X" in the popover.
61
- * The "previous" and "next" buttons are actual text buttons. can define the text contents of those buttons via
62
- * the {@link prevBtnText}, {@link nextBtnText} and {@link doneBtnText} properties.
63
- *
64
- * This overrides the showButtons array on the {@link OnboardingOptions}.
65
- */
66
- showButtons?: AllowedButtons[];
67
- /**
68
- * The buttons that should be disabled in the popover - for this step only.
69
- *
70
- * This is useful when you want to show some of the buttons, but disable them anyway.
71
- *
72
- * This overrides the disableButtons array on the {@link OnboardingOptions}.
73
- */
74
- disableButtons?: AllowedButtons[];
75
- /**
76
- * Whether to disable interaction with the highlighted element.
77
- *
78
- * @default false
79
- */
80
- disableActiveInteraction?: boolean;
81
- /**
82
- * Custom class to add to the popover element.
83
- *
84
- * This can be used to style the popover.
85
- */
86
- popoverClass?: string;
87
- /**
88
- * Text to use for the "previous" button - specific for this step only.
89
- *
90
- * This overrides the prevBtnText on the {@link OnboardingOptions}.
91
- */
92
- prevBtnText?: string;
93
- /**
94
- * Text to use for the "next" button - specific for this step only.
95
- *
96
- * This overrides the nextBtnText on the {@link OnboardingOptions}.
97
- */
98
- nextBtnText?: string;
99
- /**
100
- * Text to use for the "done" (a.k.a. the final "next") button - specific for this step only.
101
- *
102
- * This overrides the doneBtnText on the {@link OnboardingOptions}.
103
- */
104
- doneBtnText?: string;
105
- };
106
+ popover: OnboardingPopoverContent;
106
107
  /**
107
108
  * Callback triggered when the highlighting is about to become visible.
108
109
  *
@@ -136,14 +137,19 @@ type OnboardingOptions = {
136
137
  */
137
138
  steps?: OnboardingStep[];
138
139
  /**
139
- * The buttons that should be shown in popovers.
140
+ * Array of buttons to show in the popover.
140
141
  *
141
142
  * When highlighting a single element (there is just a single step), there are no buttons by default. When showing
142
143
  * a step of a multi-step tour, all buttons are shown by default.
143
144
  *
144
- * The "close" button is a simple "X" in the popover.
145
- * The "previous" and "next" buttons are actual text buttons. can define the text contents of those buttons via
145
+ * The `close` button is a simple "X" in the popover.
146
+ *
147
+ * The `previous` and `next` buttons are actual text buttons. You can define the text contents of those buttons via
146
148
  * the {@link prevBtnText}, {@link nextBtnText} and {@link doneBtnText} properties.
149
+ *
150
+ * Defaults to ["next", "previous", "close"] for product tours and [] for single element highlighting.
151
+ *
152
+ * @default '["next", "previous", "close"]'
147
153
  */
148
154
  showButtons?: AllowedButtons[];
149
155
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"useOnboarding.js","sources":["../../src/hooks/useOnboarding.ts"],"sourcesContent":["import {\n driver,\n type PopoverDOM as DriverPopoverDOM,\n type State as DriverState,\n type AllowedButtons,\n type DriveStep,\n type DriverHook,\n} from 'driver.js';\nimport 'driver.js/dist/driver.css';\n\n// Features:\n// [x] - Close on click outside\n// [x] - Multiple steps with backdrop\n// [x] - drive vs. highlight\n// [x] - allow for controlling state (setStep, etc)\n// [-] - Single step to replace OnboardingTip (no buttons except close), no backdrop\n// [-] - Styling - as driver.js is using a singleton, setting styles for another onboarding step will override the global styles\n\nexport type PopoverDOM = DriverPopoverDOM;\nexport type OnboardingState = DriverState;\n\ntype DriverCallbackOptions = Parameters<DriverHook>[2];\n\n/**\n * Describes a single step in an Onboarding Tour.\n *\n * Is based on the underlying {@link DriveStep driver.js step configuration object}.\n *\n * @see https://driverjs.com/docs/configuration\n */\nexport type OnboardingStep = DriveStep & {\n /**\n * The target element to highlight.\n *\n * This can be a DOM element (ref), a function that returns a DOM element, or a CSS selector (most likely, you want\n * to go with a selector as it's the easiest one to implement).\n *\n * If this is a selector, the first matching element will be highlighted.\n *\n * If no element is given, the popover will simply be centered on the screen.\n *\n * @example '[data-onboarding-walkthrough-step=\"2\"]'\n */\n element?: string | Element;\n\n /**\n * Defines the content and appearance of the popover.\n */\n popover: {\n /**\n * Title text to be shown.\n *\n * You can use HTML here, but maybe you shouldn't.\n */\n title?: string;\n\n /**\n * Description text to be shown.\n *\n * You can use HTML here, but maybe you shouldn't.\n */\n description?: string;\n\n /**\n * The position of the popover relative to the target element.\n *\n * @default 'left'\n */\n side?: 'top' | 'right' | 'bottom' | 'left' | 'over';\n\n /**\n * Where the popover is anchored to the target element.\n *\n * @default 'start'\n */\n align?: 'start' | 'center' | 'end';\n\n /**\n * The buttons that should be shown in the popover - for this step only.\n *\n * When highlighting a single element (there is just a single step), there are no buttons by default. When\n * showing a step of a multi-step tour, all buttons are shown by default.\n *\n * The \"close\" button is a simple \"X\" in the popover.\n * The \"previous\" and \"next\" buttons are actual text buttons. can define the text contents of those buttons via\n * the {@link prevBtnText}, {@link nextBtnText} and {@link doneBtnText} properties.\n *\n * This overrides the showButtons array on the {@link OnboardingOptions}.\n */\n showButtons?: AllowedButtons[];\n\n /**\n * The buttons that should be disabled in the popover - for this step only.\n *\n * This is useful when you want to show some of the buttons, but disable them anyway.\n *\n * This overrides the disableButtons array on the {@link OnboardingOptions}.\n */\n disableButtons?: AllowedButtons[];\n\n /**\n * Whether to disable interaction with the highlighted element.\n *\n * @default false\n */\n disableActiveInteraction?: boolean;\n\n /**\n * Custom class to add to the popover element.\n *\n * This can be used to style the popover.\n */\n popoverClass?: string;\n\n /**\n * Text to use for the \"previous\" button - specific for this step only.\n *\n * This overrides the prevBtnText on the {@link OnboardingOptions}.\n */\n prevBtnText?: string;\n\n /**\n * Text to use for the \"next\" button - specific for this step only.\n *\n * This overrides the nextBtnText on the {@link OnboardingOptions}.\n */\n nextBtnText?: string;\n\n /**\n * Text to use for the \"done\" (a.k.a. the final \"next\") button - specific for this step only.\n *\n * This overrides the doneBtnText on the {@link OnboardingOptions}.\n */\n doneBtnText?: string;\n };\n\n /**\n * Callback triggered when the highlighting is about to become visible.\n *\n * @param element The target DOM element of the step.\n * @param step The {@link DriveStep driver.js step object} configured for the step.\n * @param opts The configuration options and current state of the driver object as well as the driver object itself.\n */\n onHighlightStarted?: (element: Element | undefined, step: OnboardingStep, opts: DriverCallbackOptions) => void;\n\n /**\n * Callback triggered when the highlight is visible.\n *\n * @param element The target DOM element of the step.\n * @param step The {@link DriveStep driver.js step object} configured for the step.\n * @param opts The configuration options and current state of the driver object as well as the driver object itself.\n */\n onHighlighted?: (element: Element | undefined, step: OnboardingStep, opts: DriverCallbackOptions) => void;\n\n /**\n * Callback triggered when the highlight is about to become invisible.\n *\n * @param element The target DOM element of the step.\n * @param step The {@link DriveStep driver.js step object} configured for the step.\n * @param opts The configuration options and current state of the driver object as well as the driver object itself.\n */\n onDeselected?: (element: Element | undefined, step: OnboardingStep, opts: DriverCallbackOptions) => void;\n};\n\ntype OnboardingOptions = {\n /**\n * Array of steps to highlight.\n *\n * You should pass this when you want to set up a tour.\n */\n steps?: OnboardingStep[];\n\n /**\n * The buttons that should be shown in popovers.\n *\n * When highlighting a single element (there is just a single step), there are no buttons by default. When showing\n * a step of a multi-step tour, all buttons are shown by default.\n *\n * The \"close\" button is a simple \"X\" in the popover.\n * The \"previous\" and \"next\" buttons are actual text buttons. can define the text contents of those buttons via\n * the {@link prevBtnText}, {@link nextBtnText} and {@link doneBtnText} properties.\n */\n showButtons?: AllowedButtons[];\n\n /**\n * The buttons that should be disabled in popovers.\n *\n * This is useful when you want to show some of the buttons, but disable them anyway.\n */\n disableButtons?: AllowedButtons[];\n\n /**\n * Text to use for the \"previous\" button.\n *\n * @default 'Previous'\n */\n prevBtnText?: string;\n\n /**\n * Text to use for the \"next\" button.\n *\n * @default 'Next'\n */\n nextBtnText?: string;\n\n /**\n * Text to use for the \"done\" (a.k.a. the final \"next\") button.\n *\n * When given, this overrides the {@link nextBtnText} in the final popover of a tour.\n *\n * @default 'Done'\n */\n doneBtnText?: string;\n\n /**\n * Indicates whether to show progress in the onboarding popover.\n *\n * @default true\n */\n showProgress?: boolean;\n\n /**\n * Whether to allow closing the popover by clicking on the backdrop.\n *\n * This should be disabled during a tour to ensure the user completes the tour, but can be enabled on the last step.\n *\n * @default false\n */\n allowClose?: boolean;\n\n /**\n * Distance between the highlighted element and the cutout.\n *\n * @default 10\n */\n stagePadding?: number;\n\n /**\n * Radius of the cutout around the highlighted element.\n *\n * @default 5\n */\n stageRadius?: number;\n\n /**\n * Whether to allow keyboard navigation.\n *\n * @default true\n */\n allowKeyboardControl?: boolean;\n\n /**\n * Whether to disable interaction with the highlighted element.\n * Can be configured at the step level as well.\n *\n * @default false\n */\n disableActiveInteraction?: boolean;\n\n /**\n * Option to disable the backdrop. Note, the backdrop element is still there but with 100% opacity\n * and the close on the backdrop is disabled.\n *\n * @default false\n */\n noBackdrop?: boolean;\n\n /**\n * Additional classes set on the popover itself.\n */\n popoverClass?: string;\n\n /**\n * Callback triggered when an onboarding popover renders.\n *\n * @param element The target DOM element of the step.\n * @param opts The configuration options and current state of the driver object as well as the driver object itself.\n */\n onPopoverRender?: (popover: PopoverDOM, opts: OnboardingState) => void;\n\n /**\n * Callback triggered when the onboarding tour is destroyed.\n */\n onDestroyed?: () => void;\n};\n\nexport const useOnboardingTour = (params: OnboardingOptions) => {\n const {\n steps,\n prevBtnText = 'Previous',\n nextBtnText = 'Next',\n doneBtnText = 'Done',\n showProgress = true,\n allowClose = false,\n stagePadding = 10,\n stageRadius = 5,\n allowKeyboardControl = true,\n showButtons,\n disableButtons,\n popoverClass,\n noBackdrop = false,\n onPopoverRender = () => {},\n onDestroyed = () => {},\n ...driverProps\n } = params;\n\n const handlePopoverRender = (popover: DriverPopoverDOM, options: DriverCallbackOptions) => {\n onPopoverRender(popover, options.state);\n };\n\n const handleDestroyed = () => {\n onDestroyed();\n };\n\n const isSingleStep = !steps || steps.length === 1;\n\n // This configuration is applied to all steps.\n // Driver.js allows also for individual customization for single steps too.\n const driverInstance = driver({\n steps,\n prevBtnText,\n nextBtnText,\n doneBtnText,\n showProgress: isSingleStep ? false : showProgress,\n showButtons: isSingleStep ? (['close'] as AllowedButtons[]) : showButtons,\n allowClose,\n overlayOpacity: noBackdrop ? 0 : 0.5,\n disableButtons,\n progressText: '{{current}} / {{total}}',\n overlayColor: 'var(--color-black)',\n stagePadding,\n stageRadius,\n allowKeyboardControl,\n popoverClass,\n onPopoverRender: handlePopoverRender,\n onDestroyed: handleDestroyed,\n ...driverProps,\n });\n\n return {\n // Use for onboarding tours. Pass in all steps as \"steps\" parameter for initial configuration.\n run: () => driverInstance.drive(),\n\n // Use for single element highlights -> see useOnboardingTip\n // highlight: (step: OnboardingStep) => driverInstance.highlight(step),\n\n // Cleanup the onboarding\n destroy: () => driverInstance.destroy(),\n\n // Gets the current state of the onboarding with the current step\n onboardingState: () => driverInstance.getState(),\n\n // Recalculate and redraw the highlight\n refresh: () => driverInstance.refresh(),\n\n // Is the tour or highlight currently active\n isActive: () => driverInstance.isActive(),\n\n // Move to the next step\n moveNext: () => driverInstance.moveNext(),\n\n // Move to the previous step\n movePrevious: () => driverInstance.movePrevious(),\n\n // Move to the step 4\n moveTo: (stepNumber: number) => driverInstance.moveTo(stepNumber),\n\n // Is there a next step\n hasNextStep: () => driverInstance.hasNextStep(),\n\n // Is there a previous step\n hasPreviousStep: () => driverInstance.hasPreviousStep(),\n\n // Is the current step the first step\n isFirstStep: () => driverInstance.isFirstStep(),\n\n // Is the current step the last step\n isLastStep: () => driverInstance.isLastStep(),\n\n // Gets the active step index\n getActiveIndex: () => driverInstance.getActiveIndex(),\n };\n};\n\ntype OnboardingTipOptions = {\n allowClose?: boolean;\n stagePadding?: number;\n stageRadius?: number;\n noBackdrop?: boolean;\n};\n\n/**\n * Note: please use the {@link import('../components/onboarding/OnboardingTip')#default OnboardingTip} instead of this\n * hook!\n *\n * This is kept only for future development of driver.js with the hope to solve the global driver styling issue and to\n * eventually replace the OnboardingTooltip also with driver.js.\n *\n * @experimental\n */\nexport const useOnboardingTip = (options?: OnboardingTipOptions) => {\n const { allowClose = true, stagePadding = 0, stageRadius = 5, noBackdrop = true } = options || {};\n\n const driverInstance = driver({\n allowClose,\n stagePadding,\n stageRadius,\n overlayOpacity: noBackdrop ? 0 : 0.5,\n overlayColor: undefined,\n });\n\n return {\n highlight: (step: OnboardingStep) => driverInstance.highlight(step),\n destroy: () => driverInstance.destroy(),\n refresh: () => driverInstance.refresh(),\n isActive: () => driverInstance.isActive(),\n };\n};\n"],"names":["useOnboardingTour","params","steps","prevBtnText","nextBtnText","doneBtnText","showProgress","allowClose","stagePadding","stageRadius","allowKeyboardControl","showButtons","disableButtons","popoverClass","noBackdrop","onPopoverRender","onDestroyed","driverProps","handlePopoverRender","popover","options","handleDestroyed","isSingleStep","driverInstance","driver","stepNumber","useOnboardingTip","step"],"mappings":";;AA8RO,MAAMA,IAAoB,CAACC,MAA8B;AAC5D,QAAM;AAAA,IACF,OAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,aAAAC,IAAc;AAAA,IACd,aAAAC,IAAc;AAAA,IACd,cAAAC,IAAe;AAAA,IACf,YAAAC,IAAa;AAAA,IACb,cAAAC,IAAe;AAAA,IACf,aAAAC,IAAc;AAAA,IACd,sBAAAC,IAAuB;AAAA,IACvB,aAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,YAAAC,IAAa;AAAA,IACb,iBAAAC,IAAkB,MAAM;AAAA,IAAC;AAAA,IACzB,aAAAC,IAAc,MAAM;AAAA,IAAC;AAAA,IACrB,GAAGC;AAAA,EAAA,IACHhB,GAEEiB,IAAsB,CAACC,GAA2BC,MAAmC;AACvF,IAAAL,EAAgBI,GAASC,EAAQ,KAAK;AAAA,EAC1C,GAEMC,IAAkB,MAAM;AAC1B,IAAAL,EAAA;AAAA,EACJ,GAEMM,IAAe,CAACpB,KAASA,EAAM,WAAW,GAI1CqB,IAAiBC,EAAO;AAAA,IAC1B,OAAAtB;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAciB,IAAe,KAAQhB;AAAA,IACrC,aAAagB,IAAgB,CAAC,OAAO,IAAyBX;AAAA,IAC9D,YAAAJ;AAAA,IACA,gBAAgBO,IAAa,IAAI;AAAA,IACjC,gBAAAF;AAAA,IACA,cAAc;AAAA,IACd,cAAc;AAAA,IACd,cAAAJ;AAAA,IACA,aAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,cAAAG;AAAA,IACA,iBAAiBK;AAAA,IACjB,aAAaG;AAAA,IACb,GAAGJ;AAAA,EAAA,CACN;AAED,SAAO;AAAA;AAAA,IAEH,KAAK,MAAMM,EAAe,MAAA;AAAA;AAAA;AAAA;AAAA,IAM1B,SAAS,MAAMA,EAAe,QAAA;AAAA;AAAA,IAG9B,iBAAiB,MAAMA,EAAe,SAAA;AAAA;AAAA,IAGtC,SAAS,MAAMA,EAAe,QAAA;AAAA;AAAA,IAG9B,UAAU,MAAMA,EAAe,SAAA;AAAA;AAAA,IAG/B,UAAU,MAAMA,EAAe,SAAA;AAAA;AAAA,IAG/B,cAAc,MAAMA,EAAe,aAAA;AAAA;AAAA,IAGnC,QAAQ,CAACE,MAAuBF,EAAe,OAAOE,CAAU;AAAA;AAAA,IAGhE,aAAa,MAAMF,EAAe,YAAA;AAAA;AAAA,IAGlC,iBAAiB,MAAMA,EAAe,gBAAA;AAAA;AAAA,IAGtC,aAAa,MAAMA,EAAe,YAAA;AAAA;AAAA,IAGlC,YAAY,MAAMA,EAAe,WAAA;AAAA;AAAA,IAGjC,gBAAgB,MAAMA,EAAe,eAAA;AAAA,EAAe;AAE5D,GAkBaG,IAAmB,CAACN,MAAmC;AAChE,QAAM,EAAE,YAAAb,IAAa,IAAM,cAAAC,IAAe,GAAG,aAAAC,IAAc,GAAG,YAAAK,IAAa,GAAA,IAASM,KAAW,CAAA,GAEzFG,IAAiBC,EAAO;AAAA,IAC1B,YAAAjB;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,gBAAgBK,IAAa,IAAI;AAAA,IACjC,cAAc;AAAA,EAAA,CACjB;AAED,SAAO;AAAA,IACH,WAAW,CAACa,MAAyBJ,EAAe,UAAUI,CAAI;AAAA,IAClE,SAAS,MAAMJ,EAAe,QAAA;AAAA,IAC9B,SAAS,MAAMA,EAAe,QAAA;AAAA,IAC9B,UAAU,MAAMA,EAAe,SAAA;AAAA,EAAS;AAEhD;"}
1
+ {"version":3,"file":"useOnboarding.js","sources":["../../src/hooks/useOnboarding.ts"],"sourcesContent":["import {\n driver,\n type PopoverDOM as DriverPopoverDOM,\n type State as DriverState,\n type AllowedButtons,\n type DriveStep,\n type DriverHook,\n} from 'driver.js';\nimport 'driver.js/dist/driver.css';\n\n// Features:\n// [x] - Close on click outside\n// [x] - Multiple steps with backdrop\n// [x] - drive vs. highlight\n// [x] - allow for controlling state (setStep, etc)\n// [-] - Single step to replace OnboardingTip (no buttons except close), no backdrop\n// [-] - Styling - as driver.js is using a singleton, setting styles for another onboarding step will override the global styles\n\nexport type PopoverDOM = DriverPopoverDOM;\nexport type OnboardingState = DriverState;\n\ntype DriverCallbackOptions = Parameters<DriverHook>[2];\n\ntype OnboardingPopoverContent = {\n /**\n * Title text to be shown.\n *\n * You can use HTML here, but maybe you shouldn't.\n */\n title?: string;\n\n /**\n * Description text to be shown.\n *\n * You can use HTML here, but maybe you shouldn't.\n */\n description?: string;\n\n /**\n * The position of the popover relative to the target element.\n *\n * @default 'left'\n */\n side?: 'top' | 'right' | 'bottom' | 'left' | 'over';\n\n /**\n * Where the popover is anchored to the target element.\n *\n * @default 'start'\n */\n align?: 'start' | 'center' | 'end';\n\n /**\n * The buttons that should be shown in the popover - for this step only.\n *\n * When highlighting a single element (there is just a single step), there are no buttons by default. When\n * showing a step of a multi-step tour, all buttons are shown by default.\n *\n * The \"close\" button is a simple \"X\" in the popover.\n * The \"previous\" and \"next\" buttons are actual text buttons. can define the text contents of those buttons via\n * the {@link prevBtnText}, {@link nextBtnText} and {@link doneBtnText} properties.\n *\n * This overrides the showButtons array on the {@link OnboardingOptions}.\n */\n showButtons?: AllowedButtons[];\n\n /**\n * The buttons that should be disabled in the popover - for this step only.\n *\n * This is useful when you want to show some of the buttons, but disable them anyway.\n *\n * This overrides the disableButtons array on the {@link OnboardingOptions}.\n */\n disableButtons?: AllowedButtons[];\n\n /**\n * Whether to disable interaction with the highlighted element.\n *\n * @default false\n */\n disableActiveInteraction?: boolean;\n\n /**\n * Custom class to add to the popover element.\n *\n * This can be used to style the popover.\n */\n popoverClass?: string;\n\n /**\n * Text to use for the \"previous\" button - specific for this step only.\n *\n * This overrides the prevBtnText on the {@link OnboardingOptions}.\n */\n prevBtnText?: string;\n\n /**\n * Text to use for the \"next\" button - specific for this step only.\n *\n * This overrides the nextBtnText on the {@link OnboardingOptions}.\n */\n nextBtnText?: string;\n\n /**\n * Text to use for the \"done\" (a.k.a. the final \"next\") button - specific for this step only.\n *\n * This overrides the doneBtnText on the {@link OnboardingOptions}.\n */\n doneBtnText?: string;\n};\n\n/**\n * Describes a single step in an Onboarding Tour.\n *\n * Is based on the underlying {@link DriveStep driver.js step configuration object}.\n *\n * @see https://driverjs.com/docs/configuration\n */\nexport type OnboardingStep = DriveStep & {\n /**\n * The target element to highlight.\n *\n * This can be a DOM element (ref), a function that returns a DOM element, or a CSS selector (most likely, you want\n * to go with a selector as it's the easiest one to implement).\n *\n * If this is a selector, the first matching element will be highlighted.\n *\n * If no element is given, the popover will simply be centered on the screen.\n *\n * @example '[data-onboarding-walkthrough-step=\"2\"]'\n */\n element?: string | Element;\n\n /**\n * Defines the content and appearance of the popover.\n */\n popover: OnboardingPopoverContent;\n\n /**\n * Callback triggered when the highlighting is about to become visible.\n *\n * @param element The target DOM element of the step.\n * @param step The {@link DriveStep driver.js step object} configured for the step.\n * @param opts The configuration options and current state of the driver object as well as the driver object itself.\n */\n onHighlightStarted?: (element: Element | undefined, step: OnboardingStep, opts: DriverCallbackOptions) => void;\n\n /**\n * Callback triggered when the highlight is visible.\n *\n * @param element The target DOM element of the step.\n * @param step The {@link DriveStep driver.js step object} configured for the step.\n * @param opts The configuration options and current state of the driver object as well as the driver object itself.\n */\n onHighlighted?: (element: Element | undefined, step: OnboardingStep, opts: DriverCallbackOptions) => void;\n\n /**\n * Callback triggered when the highlight is about to become invisible.\n *\n * @param element The target DOM element of the step.\n * @param step The {@link DriveStep driver.js step object} configured for the step.\n * @param opts The configuration options and current state of the driver object as well as the driver object itself.\n */\n onDeselected?: (element: Element | undefined, step: OnboardingStep, opts: DriverCallbackOptions) => void;\n};\n\ntype OnboardingOptions = {\n /**\n * Array of steps to highlight.\n *\n * You should pass this when you want to set up a tour.\n */\n steps?: OnboardingStep[];\n\n /**\n * Array of buttons to show in the popover.\n *\n * When highlighting a single element (there is just a single step), there are no buttons by default. When showing\n * a step of a multi-step tour, all buttons are shown by default.\n *\n * The `close` button is a simple \"X\" in the popover.\n *\n * The `previous` and `next` buttons are actual text buttons. You can define the text contents of those buttons via\n * the {@link prevBtnText}, {@link nextBtnText} and {@link doneBtnText} properties.\n *\n * Defaults to [\"next\", \"previous\", \"close\"] for product tours and [] for single element highlighting.\n *\n * @default '[\"next\", \"previous\", \"close\"]'\n */\n showButtons?: AllowedButtons[];\n\n /**\n * The buttons that should be disabled in popovers.\n *\n * This is useful when you want to show some of the buttons, but disable them anyway.\n */\n disableButtons?: AllowedButtons[];\n\n /**\n * Text to use for the \"previous\" button.\n *\n * @default 'Previous'\n */\n prevBtnText?: string;\n\n /**\n * Text to use for the \"next\" button.\n *\n * @default 'Next'\n */\n nextBtnText?: string;\n\n /**\n * Text to use for the \"done\" (a.k.a. the final \"next\") button.\n *\n * When given, this overrides the {@link nextBtnText} in the final popover of a tour.\n *\n * @default 'Done'\n */\n doneBtnText?: string;\n\n /**\n * Indicates whether to show progress in the onboarding popover.\n *\n * @default true\n */\n showProgress?: boolean;\n\n /**\n * Whether to allow closing the popover by clicking on the backdrop.\n *\n * This should be disabled during a tour to ensure the user completes the tour, but can be enabled on the last step.\n *\n * @default false\n */\n allowClose?: boolean;\n\n /**\n * Distance between the highlighted element and the cutout.\n *\n * @default 10\n */\n stagePadding?: number;\n\n /**\n * Radius of the cutout around the highlighted element.\n *\n * @default 5\n */\n stageRadius?: number;\n\n /**\n * Whether to allow keyboard navigation.\n *\n * @default true\n */\n allowKeyboardControl?: boolean;\n\n /**\n * Whether to disable interaction with the highlighted element.\n * Can be configured at the step level as well.\n *\n * @default false\n */\n disableActiveInteraction?: boolean;\n\n /**\n * Option to disable the backdrop. Note, the backdrop element is still there but with 100% opacity\n * and the close on the backdrop is disabled.\n *\n * @default false\n */\n noBackdrop?: boolean;\n\n /**\n * Additional classes set on the popover itself.\n */\n popoverClass?: string;\n\n /**\n * Callback triggered when an onboarding popover renders.\n *\n * @param element The target DOM element of the step.\n * @param opts The configuration options and current state of the driver object as well as the driver object itself.\n */\n onPopoverRender?: (popover: PopoverDOM, opts: OnboardingState) => void;\n\n /**\n * Callback triggered when the onboarding tour is destroyed.\n */\n onDestroyed?: () => void;\n};\n\nexport const useOnboardingTour = (params: OnboardingOptions) => {\n const {\n steps,\n prevBtnText = 'Previous',\n nextBtnText = 'Next',\n doneBtnText = 'Done',\n showProgress = true,\n allowClose = false,\n stagePadding = 10,\n stageRadius = 5,\n allowKeyboardControl = true,\n showButtons,\n disableButtons,\n popoverClass,\n noBackdrop = false,\n onPopoverRender = () => {},\n onDestroyed = () => {},\n ...driverProps\n } = params;\n\n const handlePopoverRender = (popover: DriverPopoverDOM, options: DriverCallbackOptions) => {\n onPopoverRender(popover, options.state);\n };\n\n const handleDestroyed = () => {\n onDestroyed();\n };\n\n const isSingleStep = !steps || steps.length === 1;\n\n // This configuration is applied to all steps.\n // Driver.js allows also for individual customization for single steps too.\n const driverInstance = driver({\n steps,\n prevBtnText,\n nextBtnText,\n doneBtnText,\n showProgress: isSingleStep ? false : showProgress,\n showButtons: isSingleStep ? (['close'] as AllowedButtons[]) : showButtons,\n allowClose,\n overlayOpacity: noBackdrop ? 0 : 0.5,\n disableButtons,\n progressText: '{{current}} / {{total}}',\n overlayColor: 'var(--color-black)',\n stagePadding,\n stageRadius,\n allowKeyboardControl,\n popoverClass,\n onPopoverRender: handlePopoverRender,\n onDestroyed: handleDestroyed,\n ...driverProps,\n });\n\n return {\n // Use for onboarding tours. Pass in all steps as \"steps\" parameter for initial configuration.\n run: () => driverInstance.drive(),\n\n // Use for single element highlights -> see useOnboardingTip\n // highlight: (step: OnboardingStep) => driverInstance.highlight(step),\n\n // Cleanup the onboarding\n destroy: () => driverInstance.destroy(),\n\n // Gets the current state of the onboarding with the current step\n onboardingState: () => driverInstance.getState(),\n\n // Recalculate and redraw the highlight\n refresh: () => driverInstance.refresh(),\n\n // Is the tour or highlight currently active\n isActive: () => driverInstance.isActive(),\n\n // Move to the next step\n moveNext: () => driverInstance.moveNext(),\n\n // Move to the previous step\n movePrevious: () => driverInstance.movePrevious(),\n\n // Move to the step 4\n moveTo: (stepNumber: number) => driverInstance.moveTo(stepNumber),\n\n // Is there a next step\n hasNextStep: () => driverInstance.hasNextStep(),\n\n // Is there a previous step\n hasPreviousStep: () => driverInstance.hasPreviousStep(),\n\n // Is the current step the first step\n isFirstStep: () => driverInstance.isFirstStep(),\n\n // Is the current step the last step\n isLastStep: () => driverInstance.isLastStep(),\n\n // Gets the active step index\n getActiveIndex: () => driverInstance.getActiveIndex(),\n };\n};\n\ntype OnboardingTipOptions = {\n allowClose?: boolean;\n stagePadding?: number;\n stageRadius?: number;\n noBackdrop?: boolean;\n};\n\n/**\n * Note: please use the {@link import('../components/onboarding/OnboardingTip')#default OnboardingTip} instead of this\n * hook!\n *\n * This is kept only for future development of driver.js with the hope to solve the global driver styling issue and to\n * eventually replace the OnboardingTooltip also with driver.js.\n *\n * @experimental\n */\nexport const useOnboardingTip = (options?: OnboardingTipOptions) => {\n const { allowClose = true, stagePadding = 0, stageRadius = 5, noBackdrop = true } = options || {};\n\n const driverInstance = driver({\n allowClose,\n stagePadding,\n stageRadius,\n overlayOpacity: noBackdrop ? 0 : 0.5,\n overlayColor: undefined,\n });\n\n return {\n highlight: (step: OnboardingStep) => driverInstance.highlight(step),\n destroy: () => driverInstance.destroy(),\n refresh: () => driverInstance.refresh(),\n isActive: () => driverInstance.isActive(),\n };\n};\n"],"names":["useOnboardingTour","params","steps","prevBtnText","nextBtnText","doneBtnText","showProgress","allowClose","stagePadding","stageRadius","allowKeyboardControl","showButtons","disableButtons","popoverClass","noBackdrop","onPopoverRender","onDestroyed","driverProps","handlePopoverRender","popover","options","handleDestroyed","isSingleStep","driverInstance","driver","stepNumber","useOnboardingTip","step"],"mappings":";;AAqSO,MAAMA,IAAoB,CAACC,MAA8B;AAC5D,QAAM;AAAA,IACF,OAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,aAAAC,IAAc;AAAA,IACd,aAAAC,IAAc;AAAA,IACd,cAAAC,IAAe;AAAA,IACf,YAAAC,IAAa;AAAA,IACb,cAAAC,IAAe;AAAA,IACf,aAAAC,IAAc;AAAA,IACd,sBAAAC,IAAuB;AAAA,IACvB,aAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,YAAAC,IAAa;AAAA,IACb,iBAAAC,IAAkB,MAAM;AAAA,IAAC;AAAA,IACzB,aAAAC,IAAc,MAAM;AAAA,IAAC;AAAA,IACrB,GAAGC;AAAA,EAAA,IACHhB,GAEEiB,IAAsB,CAACC,GAA2BC,MAAmC;AACvF,IAAAL,EAAgBI,GAASC,EAAQ,KAAK;AAAA,EAC1C,GAEMC,IAAkB,MAAM;AAC1B,IAAAL,EAAA;AAAA,EACJ,GAEMM,IAAe,CAACpB,KAASA,EAAM,WAAW,GAI1CqB,IAAiBC,EAAO;AAAA,IAC1B,OAAAtB;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAciB,IAAe,KAAQhB;AAAA,IACrC,aAAagB,IAAgB,CAAC,OAAO,IAAyBX;AAAA,IAC9D,YAAAJ;AAAA,IACA,gBAAgBO,IAAa,IAAI;AAAA,IACjC,gBAAAF;AAAA,IACA,cAAc;AAAA,IACd,cAAc;AAAA,IACd,cAAAJ;AAAA,IACA,aAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,cAAAG;AAAA,IACA,iBAAiBK;AAAA,IACjB,aAAaG;AAAA,IACb,GAAGJ;AAAA,EAAA,CACN;AAED,SAAO;AAAA;AAAA,IAEH,KAAK,MAAMM,EAAe,MAAA;AAAA;AAAA;AAAA;AAAA,IAM1B,SAAS,MAAMA,EAAe,QAAA;AAAA;AAAA,IAG9B,iBAAiB,MAAMA,EAAe,SAAA;AAAA;AAAA,IAGtC,SAAS,MAAMA,EAAe,QAAA;AAAA;AAAA,IAG9B,UAAU,MAAMA,EAAe,SAAA;AAAA;AAAA,IAG/B,UAAU,MAAMA,EAAe,SAAA;AAAA;AAAA,IAG/B,cAAc,MAAMA,EAAe,aAAA;AAAA;AAAA,IAGnC,QAAQ,CAACE,MAAuBF,EAAe,OAAOE,CAAU;AAAA;AAAA,IAGhE,aAAa,MAAMF,EAAe,YAAA;AAAA;AAAA,IAGlC,iBAAiB,MAAMA,EAAe,gBAAA;AAAA;AAAA,IAGtC,aAAa,MAAMA,EAAe,YAAA;AAAA;AAAA,IAGlC,YAAY,MAAMA,EAAe,WAAA;AAAA;AAAA,IAGjC,gBAAgB,MAAMA,EAAe,eAAA;AAAA,EAAe;AAE5D,GAkBaG,IAAmB,CAACN,MAAmC;AAChE,QAAM,EAAE,YAAAb,IAAa,IAAM,cAAAC,IAAe,GAAG,aAAAC,IAAc,GAAG,YAAAK,IAAa,GAAA,IAASM,KAAW,CAAA,GAEzFG,IAAiBC,EAAO;AAAA,IAC1B,YAAAjB;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,gBAAgBK,IAAa,IAAI;AAAA,IACjC,cAAc;AAAA,EAAA,CACjB;AAED,SAAO;AAAA,IACH,WAAW,CAACa,MAAyBJ,EAAe,UAAUI,CAAI;AAAA,IAClE,SAAS,MAAMJ,EAAe,QAAA;AAAA,IAC9B,SAAS,MAAMA,EAAe,QAAA;AAAA,IAC9B,UAAU,MAAMA,EAAe,SAAA;AAAA,EAAS;AAEhD;"}
@@ -23,7 +23,8 @@ export type RemoteAction = {
23
23
  *
24
24
  * @param messagePrefix a custom prefix to limit the event listener for these events
25
25
  * @param onReceiveMessage a callback function triggered when a message is received
26
- * @returns
26
+ * @deprecated Please use the {@link import('./useIncomingPostMessages')#default useIncomingPostMessages} and/or
27
+ * {@link import('./usePostMessageSender')#default usePostMessageSender} hooks instead.
27
28
  */
28
29
  declare const usePostMessage: (messagePrefix: string, onReceiveMessage?: (eventData: any) => void) => {
29
30
  sendMessageToParent: (message: RemoteAction) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"usePostMessage.js","sources":["../../src/hooks/usePostMessage.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { isEmpty, noop } from 'es-toolkit/compat';\n\nexport type RemoteAction = {\n /**\n * The RemoteAction is inspired by a plain redux action where the type is the\n * action identifier.\n *\n * @example\n *\n * ```json\n * {\n * \"type\": \"EVENT_SET_VISIBLE_WIDGETS\",\n * \"payload\": [\"foo\", \"bar\"],\n * }\n * ```\n */\n type: string;\n\n /**\n * The action payload itself.\n */\n payload: any;\n};\n\n/**\n * A custom hook to ease the exchange of postMessage events between iframes and the parent window.\n *\n * @param messagePrefix a custom prefix to limit the event listener for these events\n * @param onReceiveMessage a callback function triggered when a message is received\n * @returns\n */\nconst usePostMessage = (messagePrefix: string, onReceiveMessage?: (eventData: any) => void) => {\n const sendMessageToParent = (message: RemoteAction) => {\n const referrer = document.referrer;\n if (referrer) {\n window.parent.postMessage(message, referrer);\n }\n };\n\n const sendMessageToWidget = (message: RemoteAction, targetFrames: HTMLIFrameElement | HTMLIFrameElement[]) => {\n if (!targetFrames || isEmpty(targetFrames)) {\n return;\n }\n\n const frames = Array.isArray(targetFrames) ? [...targetFrames] : [targetFrames];\n\n [...frames].forEach(target => {\n const contentWindow = target.contentWindow;\n if (contentWindow) {\n contentWindow.postMessage(message, '*');\n }\n });\n };\n\n const receiveMessage = (event: MessageEvent, callback: (eventData: any) => void) => {\n const actionType = event.data.type;\n if (!actionType) {\n return;\n }\n\n if (actionType.startsWith(messagePrefix)) {\n callback(event.data);\n }\n };\n\n useEffect(() => {\n const listenerCallback = (event: MessageEvent) => receiveMessage(event, onReceiveMessage || noop);\n window.addEventListener('message', listenerCallback, false);\n return () => window.removeEventListener('message', listenerCallback, false);\n }, []);\n\n return {\n sendMessageToParent,\n sendMessageToWidget,\n };\n};\n\nexport default usePostMessage;\n"],"names":["usePostMessage","messagePrefix","onReceiveMessage","sendMessageToParent","message","referrer","sendMessageToWidget","targetFrames","isEmpty","target","contentWindow","receiveMessage","event","callback","actionType","useEffect","listenerCallback","noop"],"mappings":";;AAgCA,MAAMA,IAAiB,CAACC,GAAuBC,MAAgD;AAC3F,QAAMC,IAAsB,CAACC,MAA0B;AACnD,UAAMC,IAAW,SAAS;AAC1B,IAAIA,KACA,OAAO,OAAO,YAAYD,GAASC,CAAQ;AAAA,EAEnD,GAEMC,IAAsB,CAACF,GAAuBG,MAA0D;AAC1G,QAAI,CAACA,KAAgBC,EAAQD,CAAY;AACrC;AAKJ,KAAC,GAFc,MAAM,QAAQA,CAAY,IAAI,CAAC,GAAGA,CAAY,IAAI,CAACA,CAAY,CAEpE,EAAE,QAAQ,CAAAE,MAAU;AAC1B,YAAMC,IAAgBD,EAAO;AAC7B,MAAIC,KACAA,EAAc,YAAYN,GAAS,GAAG;AAAA,IAE9C,CAAC;AAAA,EACL,GAEMO,IAAiB,CAACC,GAAqBC,MAAuC;AAChF,UAAMC,IAAaF,EAAM,KAAK;AAC9B,IAAKE,KAIDA,EAAW,WAAWb,CAAa,KACnCY,EAASD,EAAM,IAAI;AAAA,EAE3B;AAEA,SAAAG,EAAU,MAAM;AACZ,UAAMC,IAAmB,CAACJ,MAAwBD,EAAeC,GAAOV,KAAoBe,CAAI;AAChG,kBAAO,iBAAiB,WAAWD,GAAkB,EAAK,GACnD,MAAM,OAAO,oBAAoB,WAAWA,GAAkB,EAAK;AAAA,EAC9E,GAAG,CAAA,CAAE,GAEE;AAAA,IACH,qBAAAb;AAAA,IACA,qBAAAG;AAAA,EAAA;AAER;"}
1
+ {"version":3,"file":"usePostMessage.js","sources":["../../src/hooks/usePostMessage.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { isEmpty, noop } from 'es-toolkit/compat';\n\nexport type RemoteAction = {\n /**\n * The RemoteAction is inspired by a plain redux action where the type is the\n * action identifier.\n *\n * @example\n *\n * ```json\n * {\n * \"type\": \"EVENT_SET_VISIBLE_WIDGETS\",\n * \"payload\": [\"foo\", \"bar\"],\n * }\n * ```\n */\n type: string;\n\n /**\n * The action payload itself.\n */\n payload: any;\n};\n\n/**\n * A custom hook to ease the exchange of postMessage events between iframes and the parent window.\n *\n * @param messagePrefix a custom prefix to limit the event listener for these events\n * @param onReceiveMessage a callback function triggered when a message is received\n * @deprecated Please use the {@link import('./useIncomingPostMessages')#default useIncomingPostMessages} and/or\n * {@link import('./usePostMessageSender')#default usePostMessageSender} hooks instead.\n */\nconst usePostMessage = (messagePrefix: string, onReceiveMessage?: (eventData: any) => void) => {\n const sendMessageToParent = (message: RemoteAction) => {\n const referrer = document.referrer;\n if (referrer) {\n window.parent.postMessage(message, referrer);\n }\n };\n\n const sendMessageToWidget = (message: RemoteAction, targetFrames: HTMLIFrameElement | HTMLIFrameElement[]) => {\n if (!targetFrames || isEmpty(targetFrames)) {\n return;\n }\n\n const frames = Array.isArray(targetFrames) ? [...targetFrames] : [targetFrames];\n\n [...frames].forEach(target => {\n const contentWindow = target.contentWindow;\n if (contentWindow) {\n contentWindow.postMessage(message, '*');\n }\n });\n };\n\n const receiveMessage = (event: MessageEvent, callback: (eventData: any) => void) => {\n const actionType = event.data.type;\n if (!actionType) {\n return;\n }\n\n if (actionType.startsWith(messagePrefix)) {\n callback(event.data);\n }\n };\n\n useEffect(() => {\n const listenerCallback = (event: MessageEvent) => receiveMessage(event, onReceiveMessage || noop);\n window.addEventListener('message', listenerCallback, false);\n return () => window.removeEventListener('message', listenerCallback, false);\n }, []);\n\n return {\n sendMessageToParent,\n sendMessageToWidget,\n };\n};\n\nexport default usePostMessage;\n"],"names":["usePostMessage","messagePrefix","onReceiveMessage","sendMessageToParent","message","referrer","sendMessageToWidget","targetFrames","isEmpty","target","contentWindow","receiveMessage","event","callback","actionType","useEffect","listenerCallback","noop"],"mappings":";;AAiCA,MAAMA,IAAiB,CAACC,GAAuBC,MAAgD;AAC3F,QAAMC,IAAsB,CAACC,MAA0B;AACnD,UAAMC,IAAW,SAAS;AAC1B,IAAIA,KACA,OAAO,OAAO,YAAYD,GAASC,CAAQ;AAAA,EAEnD,GAEMC,IAAsB,CAACF,GAAuBG,MAA0D;AAC1G,QAAI,CAACA,KAAgBC,EAAQD,CAAY;AACrC;AAKJ,KAAC,GAFc,MAAM,QAAQA,CAAY,IAAI,CAAC,GAAGA,CAAY,IAAI,CAACA,CAAY,CAEpE,EAAE,QAAQ,CAAAE,MAAU;AAC1B,YAAMC,IAAgBD,EAAO;AAC7B,MAAIC,KACAA,EAAc,YAAYN,GAAS,GAAG;AAAA,IAE9C,CAAC;AAAA,EACL,GAEMO,IAAiB,CAACC,GAAqBC,MAAuC;AAChF,UAAMC,IAAaF,EAAM,KAAK;AAC9B,IAAKE,KAIDA,EAAW,WAAWb,CAAa,KACnCY,EAASD,EAAM,IAAI;AAAA,EAE3B;AAEA,SAAAG,EAAU,MAAM;AACZ,UAAMC,IAAmB,CAACJ,MAAwBD,EAAeC,GAAOV,KAAoBe,CAAI;AAChG,kBAAO,iBAAiB,WAAWD,GAAkB,EAAK,GACnD,MAAM,OAAO,oBAAoB,WAAWA,GAAkB,EAAK;AAAA,EAC9E,GAAG,CAAA,CAAE,GAEE;AAAA,IACH,qBAAAb;AAAA,IACA,qBAAAG;AAAA,EAAA;AAER;"}
@@ -0,0 +1,49 @@
1
+ export type RioCookieConsentStatus = 'missing' | 'invalid' | 'ux-cookies-accepted' | 'marketing-cookies-accepted' | 'custom';
2
+ export type RioCookieConsentInfo = {
3
+ /**
4
+ * Name of the RIO consent cookie.
5
+ */
6
+ cookieName: 'cookie_settings';
7
+ /**
8
+ * Indicates whether the consent cookie exists.
9
+ */
10
+ isSet: boolean;
11
+ /**
12
+ * Raw cookie value as read from `document.cookie`.
13
+ */
14
+ rawValue?: string;
15
+ /**
16
+ * Parsed and normalized cookie switches when JSON parsing succeeds.
17
+ */
18
+ parsedValue?: Record<string, number>;
19
+ /**
20
+ * True when UX cookies are accepted (`switch-49 === 1`).
21
+ */
22
+ uxCookiesAccepted: boolean;
23
+ /**
24
+ * True when marketing cookies are accepted (`switch-2 === 1`).
25
+ */
26
+ marketingCookiesAccepted: boolean;
27
+ /**
28
+ * Computed consent status derived from parsed cookie values.
29
+ */
30
+ status: RioCookieConsentStatus;
31
+ };
32
+ export type UseRioCookieConsentResult = {
33
+ /**
34
+ * Reads and parses the RIO cookie consent settings.
35
+ */
36
+ getRioCookieConsentInfo: () => RioCookieConsentInfo;
37
+ };
38
+ /**
39
+ * Returns helpers for reading RIO's cookie consent state from `cookie_settings`.
40
+ *
41
+ * @returns {UseRioCookieConsentResult} Cookie consent helper functions.
42
+ *
43
+ * @example
44
+ * const { getRioCookieConsentInfo } = useRioCookieConsent();
45
+ * const consent = getRioCookieConsentInfo();
46
+ * const uxAccepted = consent.uxCookiesAccepted;
47
+ */
48
+ declare const useRioCookieConsent: () => UseRioCookieConsentResult;
49
+ export default useRioCookieConsent;
@@ -0,0 +1,44 @@
1
+ import { useCallback as c } from "react";
2
+ import n from "./useCookies.js";
3
+ const a = (e) => {
4
+ if (!e)
5
+ return {
6
+ cookieName: "cookie_settings",
7
+ isSet: !1,
8
+ uxCookiesAccepted: !1,
9
+ marketingCookiesAccepted: !1,
10
+ status: "missing"
11
+ };
12
+ try {
13
+ const t = JSON.parse(e), s = t["switch-49"] === 1, o = t["switch-2"] === 1;
14
+ let i = "custom";
15
+ return s && !o ? i = "ux-cookies-accepted" : !s && o && (i = "marketing-cookies-accepted"), {
16
+ cookieName: "cookie_settings",
17
+ isSet: !0,
18
+ rawValue: e,
19
+ parsedValue: {
20
+ "switch-2": Number(t["switch-2"]),
21
+ "switch-49": Number(t["switch-49"])
22
+ },
23
+ uxCookiesAccepted: s,
24
+ marketingCookiesAccepted: o,
25
+ status: i
26
+ };
27
+ } catch {
28
+ return {
29
+ cookieName: "cookie_settings",
30
+ isSet: !0,
31
+ rawValue: e,
32
+ uxCookiesAccepted: !1,
33
+ marketingCookiesAccepted: !1,
34
+ status: "invalid"
35
+ };
36
+ }
37
+ }, u = () => {
38
+ const { getCookie: e } = n();
39
+ return { getRioCookieConsentInfo: c(() => a(e("cookie_settings")), [e]) };
40
+ };
41
+ export {
42
+ u as default
43
+ };
44
+ //# sourceMappingURL=useRioCookieConsent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRioCookieConsent.js","sources":["../../src/hooks/useRioCookieConsent.ts"],"sourcesContent":["import { useCallback } from 'react';\n\nimport useCookies from './useCookies';\n\nexport type RioCookieConsentStatus =\n | 'missing'\n | 'invalid'\n | 'ux-cookies-accepted'\n | 'marketing-cookies-accepted'\n | 'custom';\n\nexport type RioCookieConsentInfo = {\n /**\n * Name of the RIO consent cookie.\n */\n cookieName: 'cookie_settings';\n\n /**\n * Indicates whether the consent cookie exists.\n */\n isSet: boolean;\n\n /**\n * Raw cookie value as read from `document.cookie`.\n */\n rawValue?: string;\n\n /**\n * Parsed and normalized cookie switches when JSON parsing succeeds.\n */\n parsedValue?: Record<string, number>;\n\n /**\n * True when UX cookies are accepted (`switch-49 === 1`).\n */\n uxCookiesAccepted: boolean;\n\n /**\n * True when marketing cookies are accepted (`switch-2 === 1`).\n */\n marketingCookiesAccepted: boolean;\n\n /**\n * Computed consent status derived from parsed cookie values.\n */\n status: RioCookieConsentStatus;\n};\n\nexport type UseRioCookieConsentResult = {\n /**\n * Reads and parses the RIO cookie consent settings.\n */\n getRioCookieConsentInfo: () => RioCookieConsentInfo;\n};\n\nconst evaluateRioCookieSettings = (cookieValue?: string): RioCookieConsentInfo => {\n if (!cookieValue) {\n return {\n cookieName: 'cookie_settings',\n isSet: false,\n uxCookiesAccepted: false,\n marketingCookiesAccepted: false,\n status: 'missing',\n };\n }\n\n try {\n const parsed = JSON.parse(cookieValue) as Record<string, unknown>;\n const uxCookiesAccepted = parsed['switch-49'] === 1;\n const marketingCookiesAccepted = parsed['switch-2'] === 1;\n\n let status: RioCookieConsentStatus = 'custom';\n if (uxCookiesAccepted && !marketingCookiesAccepted) {\n status = 'ux-cookies-accepted';\n } else if (!uxCookiesAccepted && marketingCookiesAccepted) {\n status = 'marketing-cookies-accepted';\n }\n\n return {\n cookieName: 'cookie_settings',\n isSet: true,\n rawValue: cookieValue,\n parsedValue: {\n 'switch-2': Number(parsed['switch-2']),\n 'switch-49': Number(parsed['switch-49']),\n },\n uxCookiesAccepted,\n marketingCookiesAccepted,\n status,\n };\n } catch {\n return {\n cookieName: 'cookie_settings',\n isSet: true,\n rawValue: cookieValue,\n uxCookiesAccepted: false,\n marketingCookiesAccepted: false,\n status: 'invalid',\n };\n }\n};\n\n/**\n * Returns helpers for reading RIO's cookie consent state from `cookie_settings`.\n *\n * @returns {UseRioCookieConsentResult} Cookie consent helper functions.\n *\n * @example\n * const { getRioCookieConsentInfo } = useRioCookieConsent();\n * const consent = getRioCookieConsentInfo();\n * const uxAccepted = consent.uxCookiesAccepted;\n */\nconst useRioCookieConsent = (): UseRioCookieConsentResult => {\n const { getCookie } = useCookies();\n\n const getRioCookieConsentInfo = useCallback(() => {\n return evaluateRioCookieSettings(getCookie('cookie_settings'));\n }, [getCookie]);\n\n return { getRioCookieConsentInfo };\n};\n\nexport default useRioCookieConsent;\n"],"names":["evaluateRioCookieSettings","cookieValue","parsed","uxCookiesAccepted","marketingCookiesAccepted","status","useRioCookieConsent","getCookie","useCookies","useCallback"],"mappings":";;AAuDA,MAAMA,IAA4B,CAACC,MAA+C;AAC9E,MAAI,CAACA;AACD,WAAO;AAAA,MACH,YAAY;AAAA,MACZ,OAAO;AAAA,MACP,mBAAmB;AAAA,MACnB,0BAA0B;AAAA,MAC1B,QAAQ;AAAA,IAAA;AAIhB,MAAI;AACA,UAAMC,IAAS,KAAK,MAAMD,CAAW,GAC/BE,IAAoBD,EAAO,WAAW,MAAM,GAC5CE,IAA2BF,EAAO,UAAU,MAAM;AAExD,QAAIG,IAAiC;AACrC,WAAIF,KAAqB,CAACC,IACtBC,IAAS,wBACF,CAACF,KAAqBC,MAC7BC,IAAS,+BAGN;AAAA,MACH,YAAY;AAAA,MACZ,OAAO;AAAA,MACP,UAAUJ;AAAA,MACV,aAAa;AAAA,QACT,YAAY,OAAOC,EAAO,UAAU,CAAC;AAAA,QACrC,aAAa,OAAOA,EAAO,WAAW,CAAC;AAAA,MAAA;AAAA,MAE3C,mBAAAC;AAAA,MACA,0BAAAC;AAAA,MACA,QAAAC;AAAA,IAAA;AAAA,EAER,QAAQ;AACJ,WAAO;AAAA,MACH,YAAY;AAAA,MACZ,OAAO;AAAA,MACP,UAAUJ;AAAA,MACV,mBAAmB;AAAA,MACnB,0BAA0B;AAAA,MAC1B,QAAQ;AAAA,IAAA;AAAA,EAEhB;AACJ,GAYMK,IAAsB,MAAiC;AACzD,QAAM,EAAE,WAAAC,EAAA,IAAcC,EAAA;AAMtB,SAAO,EAAE,yBAJuBC,EAAY,MACjCT,EAA0BO,EAAU,iBAAiB,CAAC,GAC9D,CAACA,CAAS,CAAC,EAEL;AACb;"}
@@ -57,7 +57,7 @@ type UseSearchOptions<T> = {
57
57
  */
58
58
  declare const useSearch: <T extends object>(list: T[], options?: UseSearchOptions<T>) => {
59
59
  searchValue: string;
60
- setSearchValue: import('react').Dispatch<import('react').SetStateAction<string>> | import('es-toolkit/function').DebouncedFunction<(q: string) => void>;
60
+ setSearchValue: (query: string) => void;
61
61
  filteredList: T[];
62
62
  };
63
63
  export default useSearch;
@@ -1,31 +1,42 @@
1
- import { useState as d, useCallback as b, useMemo as m } from "react";
2
- import { debounce as S } from "es-toolkit/function";
3
- const g = (r, e) => e.split(".").reduce((t, u) => t ? t[u] : void 0, r), h = (r) => Object.keys(r).filter((e) => {
1
+ import { useState as i, useMemo as b, useCallback as V, useEffect as h } from "react";
2
+ import { debounce as v } from "es-toolkit/function";
3
+ const y = (r, e) => e.split(".").reduce((t, s) => t ? t[s] : void 0, r), C = (r) => Object.keys(r).filter((e) => {
4
4
  const t = r[e];
5
5
  return typeof t == "string" || typeof t == "number";
6
- }), M = (r, e = {}) => {
7
- const [t, u] = d(""), o = b(
8
- e.debounceMs ? S((n) => u(n), e.debounceMs) : u,
9
- [e.debounceMs]
10
- ), f = m(() => {
6
+ }), w = (r, e = {}) => {
7
+ const [t, s] = i(""), [l, a] = i(""), f = b(() => e.debounceMs ? v((c) => a(c), e.debounceMs) : null, [e.debounceMs]), m = V(
8
+ (u) => {
9
+ if (s(u), !f) {
10
+ a(u);
11
+ return;
12
+ }
13
+ f(u);
14
+ },
15
+ [f]
16
+ );
17
+ h(() => {
18
+ e.debounceMs || a(t);
19
+ }, [e.debounceMs, t]);
20
+ const S = b(() => {
21
+ const u = e.debounceMs ? l : t;
11
22
  if (!t)
12
23
  return r;
13
24
  if (r.length === 0)
14
25
  return [];
15
- const n = e.caseSensitive ?? !1, a = n ? t : t.toLowerCase();
26
+ const c = e.caseSensitive ?? !1, d = c ? u : u.toLowerCase();
16
27
  if (e.customFilter)
17
- return r.filter((c) => e.customFilter?.(c, t));
18
- const l = e.fields ?? h(r[0]);
28
+ return r.filter((o) => e.customFilter?.(o, u));
29
+ const g = e.fields ?? C(r[0]);
19
30
  return r.filter(
20
- (c) => l.some((i) => {
21
- const s = g(c, i.toString());
22
- return typeof s == "string" ? (n ? s : s.toLowerCase()).includes(a) : typeof s == "number" ? s.toString().includes(a) : !1;
31
+ (o) => g.some((M) => {
32
+ const n = y(o, M.toString());
33
+ return typeof n == "string" ? (c ? n : n.toLowerCase()).includes(d) : typeof n == "number" ? n.toString().includes(d) : !1;
23
34
  })
24
35
  );
25
- }, [r, e, t]);
26
- return { searchValue: t, setSearchValue: o, filteredList: f };
36
+ }, [l, r, e, t]);
37
+ return { searchValue: t, setSearchValue: m, filteredList: S };
27
38
  };
28
39
  export {
29
- M as default
40
+ w as default
30
41
  };
31
42
  //# sourceMappingURL=useSearch.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSearch.js","sources":["../../src/hooks/useSearch.ts"],"sourcesContent":["import { useMemo, useState, useCallback } from 'react';\nimport { debounce } from 'es-toolkit/function';\n\n/**\n * Options for configuring the `useSearch` hook.\n */\ntype UseSearchOptions<T> = {\n /**\n * List of object fields to search within. Dot notation (e.g. `'address.city'`) is supported for nested properties.\n * If omitted, all top-level string and number fields will be used.\n */\n fields?: (keyof T | string)[]; // `string` to allow dot notation\n\n /**\n * Optional custom filtering function.\n * If provided, this takes precedence over field-based filtering.\n *\n * @param item - The current item in the list.\n * @param query - The current search query string.\n * @returns `true` if the item should be included in the filtered list.\n */\n customFilter?: (item: T, query: string) => boolean;\n\n /**\n * Number of milliseconds to debounce the search input.\n * If omitted, debounce is disabled.\n */\n debounceMs?: number;\n\n /**\n * Whether to perform a case-sensitive match.\n * Default is `false` (case-insensitive).\n *\n * @default false\n */\n caseSensitive?: boolean;\n};\n\n/**\n * Gets the value of a nested field from an object using dot notation.\n *\n * @param obj - The object to traverse.\n * @param path - The dot-notated path string.\n * @returns The value at the specified path, or undefined.\n */\nconst getNestedValue = (obj: any, path: string): unknown =>\n path.split('.').reduce((val, key) => (val ? val[key] : undefined), obj);\n\nconst inferSearchableFields = <T extends object>(item: T): string[] =>\n Object.keys(item).filter(key => {\n const value = (item as any)[key];\n return typeof value === 'string' || typeof value === 'number';\n });\n\n/**\n * A hook to filter a list of objects by a search value.\n * Supports field-based filtering, custom filtering logic, debounce, and case sensitivity.\n *\n * @template T - The type of items in the list (must be an object).\n *\n * @param list - The array of objects to search through.\n * @param options - Configuration options for the search behavior.\n * @param options.fields - Fields to search through. If omitted, all top-level string/number fields are used.\n * @param options.customFilter - Optional custom filter function overriding field-based filtering.\n * @param options.debounceMs - Debounce time in milliseconds.\n * @param options.caseSensitive - Whether the search should be case-sensitive.\n *\n * @returns An object containing:\n * - `searchValue`: The current search input string.\n * - `setSearchValue`: A setter function to update the search query.\n * - `filteredList`: The list of items matching the current search query.\n *\n * @example\n * ```ts\n * const { searchValue, setSearchValue, filteredList } = useSearch(users, {\n * fields: ['name', 'email'],\n * debounceMs: 300,\n * });\n * ```\n */\nconst useSearch = <T extends object>(list: T[], options: UseSearchOptions<T> = {}) => {\n const [searchValue, _setSearchValue] = useState('');\n\n // Debounced setter\n const setSearchValue = useCallback(\n options.debounceMs ? debounce((q: string) => _setSearchValue(q), options.debounceMs) : _setSearchValue,\n [options.debounceMs]\n );\n\n const filteredList = useMemo(() => {\n if (!searchValue) {\n return list;\n }\n if (list.length === 0) {\n return [];\n }\n\n const isCaseSensitive = options.caseSensitive ?? false;\n const query = isCaseSensitive ? searchValue : searchValue.toLowerCase();\n\n // Custom filter takes precedence\n if (options.customFilter) {\n return list.filter(item => options.customFilter?.(item, searchValue));\n }\n\n const fields = options.fields ?? inferSearchableFields(list[0]);\n\n return list.filter(item =>\n fields.some(field => {\n const value = getNestedValue(item, field.toString());\n\n if (typeof value === 'string') {\n const target = isCaseSensitive ? value : value.toLowerCase();\n return target.includes(query);\n }\n\n if (typeof value === 'number') {\n return value.toString().includes(query);\n }\n\n return false;\n })\n );\n }, [list, options, searchValue]);\n\n return { searchValue, setSearchValue, filteredList };\n};\n\nexport default useSearch;\n"],"names":["getNestedValue","obj","path","val","key","inferSearchableFields","item","value","useSearch","list","options","searchValue","_setSearchValue","useState","setSearchValue","useCallback","debounce","q","filteredList","useMemo","isCaseSensitive","query","fields","field"],"mappings":";;AA6CA,MAAMA,IAAiB,CAACC,GAAUC,MAC9BA,EAAK,MAAM,GAAG,EAAE,OAAO,CAACC,GAAKC,MAASD,IAAMA,EAAIC,CAAG,IAAI,QAAYH,CAAG,GAEpEI,IAAwB,CAAmBC,MAC7C,OAAO,KAAKA,CAAI,EAAE,OAAO,CAAAF,MAAO;AAC5B,QAAMG,IAASD,EAAaF,CAAG;AAC/B,SAAO,OAAOG,KAAU,YAAY,OAAOA,KAAU;AACzD,CAAC,GA4BCC,IAAY,CAAmBC,GAAWC,IAA+B,OAAO;AAClF,QAAM,CAACC,GAAaC,CAAe,IAAIC,EAAS,EAAE,GAG5CC,IAAiBC;AAAA,IACnBL,EAAQ,aAAaM,EAAS,CAACC,MAAcL,EAAgBK,CAAC,GAAGP,EAAQ,UAAU,IAAIE;AAAA,IACvF,CAACF,EAAQ,UAAU;AAAA,EAAA,GAGjBQ,IAAeC,EAAQ,MAAM;AAC/B,QAAI,CAACR;AACD,aAAOF;AAEX,QAAIA,EAAK,WAAW;AAChB,aAAO,CAAA;AAGX,UAAMW,IAAkBV,EAAQ,iBAAiB,IAC3CW,IAAQD,IAAkBT,IAAcA,EAAY,YAAA;AAG1D,QAAID,EAAQ;AACR,aAAOD,EAAK,OAAO,CAAAH,MAAQI,EAAQ,eAAeJ,GAAMK,CAAW,CAAC;AAGxE,UAAMW,IAASZ,EAAQ,UAAUL,EAAsBI,EAAK,CAAC,CAAC;AAE9D,WAAOA,EAAK;AAAA,MAAO,CAAAH,MACfgB,EAAO,KAAK,CAAAC,MAAS;AACjB,cAAMhB,IAAQP,EAAeM,GAAMiB,EAAM,UAAU;AAEnD,eAAI,OAAOhB,KAAU,YACFa,IAAkBb,IAAQA,EAAM,YAAA,GACjC,SAASc,CAAK,IAG5B,OAAOd,KAAU,WACVA,EAAM,WAAW,SAASc,CAAK,IAGnC;AAAA,MACX,CAAC;AAAA,IAAA;AAAA,EAET,GAAG,CAACZ,GAAMC,GAASC,CAAW,CAAC;AAE/B,SAAO,EAAE,aAAAA,GAAa,gBAAAG,GAAgB,cAAAI,EAAA;AAC1C;"}
1
+ {"version":3,"file":"useSearch.js","sources":["../../src/hooks/useSearch.ts"],"sourcesContent":["import { useMemo, useState, useCallback, useEffect } from 'react';\nimport { debounce } from 'es-toolkit/function';\n\n/**\n * Options for configuring the `useSearch` hook.\n */\ntype UseSearchOptions<T> = {\n /**\n * List of object fields to search within. Dot notation (e.g. `'address.city'`) is supported for nested properties.\n * If omitted, all top-level string and number fields will be used.\n */\n fields?: (keyof T | string)[]; // `string` to allow dot notation\n\n /**\n * Optional custom filtering function.\n * If provided, this takes precedence over field-based filtering.\n *\n * @param item - The current item in the list.\n * @param query - The current search query string.\n * @returns `true` if the item should be included in the filtered list.\n */\n customFilter?: (item: T, query: string) => boolean;\n\n /**\n * Number of milliseconds to debounce the search input.\n * If omitted, debounce is disabled.\n */\n debounceMs?: number;\n\n /**\n * Whether to perform a case-sensitive match.\n * Default is `false` (case-insensitive).\n *\n * @default false\n */\n caseSensitive?: boolean;\n};\n\n/**\n * Gets the value of a nested field from an object using dot notation.\n *\n * @param obj - The object to traverse.\n * @param path - The dot-notated path string.\n * @returns The value at the specified path, or undefined.\n */\nconst getNestedValue = (obj: any, path: string): unknown =>\n path.split('.').reduce((val, key) => (val ? val[key] : undefined), obj);\n\nconst inferSearchableFields = <T extends object>(item: T): string[] =>\n Object.keys(item).filter(key => {\n const value = (item as any)[key];\n return typeof value === 'string' || typeof value === 'number';\n });\n\n/**\n * A hook to filter a list of objects by a search value.\n * Supports field-based filtering, custom filtering logic, debounce, and case sensitivity.\n *\n * @template T - The type of items in the list (must be an object).\n *\n * @param list - The array of objects to search through.\n * @param options - Configuration options for the search behavior.\n * @param options.fields - Fields to search through. If omitted, all top-level string/number fields are used.\n * @param options.customFilter - Optional custom filter function overriding field-based filtering.\n * @param options.debounceMs - Debounce time in milliseconds.\n * @param options.caseSensitive - Whether the search should be case-sensitive.\n *\n * @returns An object containing:\n * - `searchValue`: The current search input string.\n * - `setSearchValue`: A setter function to update the search query.\n * - `filteredList`: The list of items matching the current search query.\n *\n * @example\n * ```ts\n * const { searchValue, setSearchValue, filteredList } = useSearch(users, {\n * fields: ['name', 'email'],\n * debounceMs: 300,\n * });\n * ```\n */\nconst useSearch = <T extends object>(list: T[], options: UseSearchOptions<T> = {}) => {\n // what the input renders (must update immediately)\n const [searchValue, _setSearchValue] = useState('');\n\n // what filtering uses (debounced if configured)\n const [debouncedValue, setDebouncedValue] = useState('');\n\n // stable debounced updater\n const debouncedUpdate = useMemo(() => {\n if (!options.debounceMs) {\n return null;\n }\n\n const fn = debounce((query: string) => setDebouncedValue(query), options.debounceMs);\n return fn;\n }, [options.debounceMs]);\n\n // setter exposed to consumers\n const setSearchValue = useCallback(\n (query: string) => {\n _setSearchValue(query);\n\n if (!debouncedUpdate) {\n setDebouncedValue(query);\n return;\n }\n\n debouncedUpdate(query);\n },\n [debouncedUpdate]\n );\n\n // keep debouncedValue in sync for the \"no debounce\" case and initial render\n useEffect(() => {\n if (!options.debounceMs) {\n setDebouncedValue(searchValue);\n }\n }, [options.debounceMs, searchValue]);\n\n const filteredList = useMemo(() => {\n const activeQueryValue = options.debounceMs ? debouncedValue : searchValue;\n\n if (!searchValue) {\n return list;\n }\n if (list.length === 0) {\n return [];\n }\n\n const isCaseSensitive = options.caseSensitive ?? false;\n const query = isCaseSensitive ? activeQueryValue : activeQueryValue.toLowerCase();\n\n // Custom filter takes precedence\n if (options.customFilter) {\n return list.filter(item => options.customFilter?.(item, activeQueryValue));\n }\n\n const fields = options.fields ?? inferSearchableFields(list[0]);\n\n return list.filter(item =>\n fields.some(field => {\n const value = getNestedValue(item, field.toString());\n\n if (typeof value === 'string') {\n const target = isCaseSensitive ? value : value.toLowerCase();\n return target.includes(query);\n }\n\n if (typeof value === 'number') {\n return value.toString().includes(query);\n }\n\n return false;\n })\n );\n }, [debouncedValue, list, options, searchValue]);\n\n return { searchValue, setSearchValue, filteredList };\n};\n\nexport default useSearch;\n"],"names":["getNestedValue","obj","path","val","key","inferSearchableFields","item","value","useSearch","list","options","searchValue","_setSearchValue","useState","debouncedValue","setDebouncedValue","debouncedUpdate","useMemo","debounce","query","setSearchValue","useCallback","useEffect","filteredList","activeQueryValue","isCaseSensitive","fields","field"],"mappings":";;AA6CA,MAAMA,IAAiB,CAACC,GAAUC,MAC9BA,EAAK,MAAM,GAAG,EAAE,OAAO,CAACC,GAAKC,MAASD,IAAMA,EAAIC,CAAG,IAAI,QAAYH,CAAG,GAEpEI,IAAwB,CAAmBC,MAC7C,OAAO,KAAKA,CAAI,EAAE,OAAO,CAAAF,MAAO;AAC5B,QAAMG,IAASD,EAAaF,CAAG;AAC/B,SAAO,OAAOG,KAAU,YAAY,OAAOA,KAAU;AACzD,CAAC,GA4BCC,IAAY,CAAmBC,GAAWC,IAA+B,OAAO;AAElF,QAAM,CAACC,GAAaC,CAAe,IAAIC,EAAS,EAAE,GAG5C,CAACC,GAAgBC,CAAiB,IAAIF,EAAS,EAAE,GAGjDG,IAAkBC,EAAQ,MACvBP,EAAQ,aAIFQ,EAAS,CAACC,MAAkBJ,EAAkBI,CAAK,GAAGT,EAAQ,UAAU,IAHxE,MAKZ,CAACA,EAAQ,UAAU,CAAC,GAGjBU,IAAiBC;AAAA,IACnB,CAACF,MAAkB;AAGf,UAFAP,EAAgBO,CAAK,GAEjB,CAACH,GAAiB;AAClB,QAAAD,EAAkBI,CAAK;AACvB;AAAA,MACJ;AAEA,MAAAH,EAAgBG,CAAK;AAAA,IACzB;AAAA,IACA,CAACH,CAAe;AAAA,EAAA;AAIpB,EAAAM,EAAU,MAAM;AACZ,IAAKZ,EAAQ,cACTK,EAAkBJ,CAAW;AAAA,EAErC,GAAG,CAACD,EAAQ,YAAYC,CAAW,CAAC;AAEpC,QAAMY,IAAeN,EAAQ,MAAM;AAC/B,UAAMO,IAAmBd,EAAQ,aAAaI,IAAiBH;AAE/D,QAAI,CAACA;AACD,aAAOF;AAEX,QAAIA,EAAK,WAAW;AAChB,aAAO,CAAA;AAGX,UAAMgB,IAAkBf,EAAQ,iBAAiB,IAC3CS,IAAQM,IAAkBD,IAAmBA,EAAiB,YAAA;AAGpE,QAAId,EAAQ;AACR,aAAOD,EAAK,OAAO,CAAAH,MAAQI,EAAQ,eAAeJ,GAAMkB,CAAgB,CAAC;AAG7E,UAAME,IAAShB,EAAQ,UAAUL,EAAsBI,EAAK,CAAC,CAAC;AAE9D,WAAOA,EAAK;AAAA,MAAO,CAAAH,MACfoB,EAAO,KAAK,CAAAC,MAAS;AACjB,cAAMpB,IAAQP,EAAeM,GAAMqB,EAAM,UAAU;AAEnD,eAAI,OAAOpB,KAAU,YACFkB,IAAkBlB,IAAQA,EAAM,YAAA,GACjC,SAASY,CAAK,IAG5B,OAAOZ,KAAU,WACVA,EAAM,WAAW,SAASY,CAAK,IAGnC;AAAA,MACX,CAAC;AAAA,IAAA;AAAA,EAET,GAAG,CAACL,GAAgBL,GAAMC,GAASC,CAAW,CAAC;AAE/C,SAAO,EAAE,aAAAA,GAAa,gBAAAS,GAAgB,cAAAG,EAAA;AAC1C;"}
@@ -0,0 +1,60 @@
1
+ export declare const SEARCH_HIGHLIGHT_CLASS = "search-result-highlight";
2
+ export type UseSearchHighlightParams = {
3
+ /**
4
+ * Ref to the element whose text content should be searched.
5
+ */
6
+ ref: React.RefObject<HTMLElement>;
7
+ /**
8
+ * Search query used for highlighting.
9
+ */
10
+ query: string;
11
+ /**
12
+ * Name of the CSS highlight.
13
+ *
14
+ * @default 'search-result-highlight'
15
+ */
16
+ highlightClassName?: string;
17
+ /**
18
+ * Optional selector to limit the search scope
19
+ * (e.g. '.ListMenuGroup' or '.OptionLabel').
20
+ */
21
+ scopeSelector?: string;
22
+ /**
23
+ * Whether to perform a case-sensitive match.
24
+ *
25
+ * @default false
26
+ */
27
+ caseSensitive?: boolean;
28
+ /**
29
+ * Optional dependencies that should trigger re-collecting and applying ranges.
30
+ * Useful when the DOM changes after the query changes (e.g. debounced filtering).
31
+ */
32
+ deps?: unknown[];
33
+ };
34
+ /**
35
+ * React hook for visually highlighting search query matches
36
+ * using the native CSS Highlight API.
37
+ *
38
+ * The hook scans the text content of the referenced element
39
+ * and applies a named CSS highlight to all matching substrings.
40
+ *
41
+ * Key characteristics:
42
+ * - Progressive enhancement: safely no-ops in unsupported browsers
43
+ * - Does not modify or re-render DOM markup
44
+ * - Designed for search UIs (Autocomplete, ListMenu, Dropdown, etc.)
45
+ *
46
+ * Usage notes:
47
+ * - The hook must always be called unconditionally
48
+ * - Use `useSearchHighlight.supported()` only for render-time
49
+ * fallback decisions (e.g. `<mark>` rendering)
50
+ *
51
+ * @param ref Ref to the element whose text should be searched
52
+ * @param query Search query to highlight
53
+ * @param highlightName Optional CSS highlight name
54
+ * @param scopeSelector Optional selector to limit the search scope
55
+ */
56
+ declare const useSearchHighlight: {
57
+ (params: UseSearchHighlightParams): void;
58
+ supported(): boolean;
59
+ };
60
+ export default useSearchHighlight;