@rio-cloud/rio-uikit 2.0.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (567) hide show
  1. package/CircularProgress.d.ts +2 -0
  2. package/CircularProgress.js +5 -0
  3. package/CircularProgress.js.map +1 -0
  4. package/RadioCardGroup.d.ts +2 -0
  5. package/RadioCardGroup.js +7 -0
  6. package/RadioCardGroup.js.map +1 -0
  7. package/SearchHighlightText.d.ts +2 -0
  8. package/SearchHighlightText.js +5 -0
  9. package/SearchHighlightText.js.map +1 -0
  10. package/TextTruncateMiddle.d.ts +2 -0
  11. package/TextTruncateMiddle.js +5 -0
  12. package/TextTruncateMiddle.js.map +1 -0
  13. package/Tracker.d.ts +2 -0
  14. package/Tracker.js +5 -0
  15. package/Tracker.js.map +1 -0
  16. package/classNames.d.ts +2 -0
  17. package/classNames.js +5 -0
  18. package/classNames.js.map +1 -0
  19. package/components/accentBar/AccentBar.js +1 -1
  20. package/components/accentBar/AccentBar.js.map +1 -1
  21. package/components/actionBarItem/ActionBarItem.d.ts +2 -2
  22. package/components/actionBarItem/ActionBarItem.js +7 -7
  23. package/components/actionBarItem/ActionBarItem.js.map +1 -1
  24. package/components/actionBarItem/ActionBarItemIcon.js +1 -1
  25. package/components/actionBarItem/ActionBarItemIcon.js.map +1 -1
  26. package/components/actionBarItem/ActionBarItemList.js +1 -1
  27. package/components/actionBarItem/ActionBarItemList.js.map +1 -1
  28. package/components/actionBarItem/ActionBarItemListItem.js +1 -1
  29. package/components/actionBarItem/ActionBarItemListItem.js.map +1 -1
  30. package/components/actionBarItem/ActionBarItemListSeparator.js +1 -1
  31. package/components/actionBarItem/ActionBarItemListSeparator.js.map +1 -1
  32. package/components/actionBarItem/ActionBarItemPopoverContent.js +3 -3
  33. package/components/actionBarItem/ActionBarItemPopoverContent.js.map +1 -1
  34. package/components/actionBarItem/ActionBarOverlay.js +1 -1
  35. package/components/actionBarItem/ActionBarOverlay.js.map +1 -1
  36. package/components/activity/Activity.js +1 -1
  37. package/components/activity/Activity.js.map +1 -1
  38. package/components/animatedTextReveal/AnimatedTextReveal.js +1 -1
  39. package/components/animatedTextReveal/AnimatedTextReveal.js.map +1 -1
  40. package/components/applicationHeader/AppMenu.js +2 -2
  41. package/components/applicationHeader/AppMenu.js.map +1 -1
  42. package/components/applicationHeader/AppMenuDropdown.js +13 -11
  43. package/components/applicationHeader/AppMenuDropdown.js.map +1 -1
  44. package/components/applicationHeader/ApplicationHeader.d.ts +6 -7
  45. package/components/applicationHeader/ApplicationHeader.js +1 -1
  46. package/components/applicationHeader/ApplicationHeader.js.map +1 -1
  47. package/components/applicationHeader/MobileHeaderModal.js +8 -8
  48. package/components/applicationHeader/MobileHeaderModal.js.map +1 -1
  49. package/components/applicationHeader/MobileSubmoduleNavigation.js +1 -1
  50. package/components/applicationHeader/MobileSubmoduleNavigation.js.map +1 -1
  51. package/components/applicationHeader/NavItems.js +4 -4
  52. package/components/applicationHeader/NavItems.js.map +1 -1
  53. package/components/applicationLayout/ApplicationLayout.js +10 -10
  54. package/components/applicationLayout/ApplicationLayout.js.map +1 -1
  55. package/components/applicationLayout/ApplicationLayoutBody.js +2 -2
  56. package/components/applicationLayout/ApplicationLayoutBody.js.map +1 -1
  57. package/components/applicationLayout/ApplicationLayoutBodyBanner.js +1 -1
  58. package/components/applicationLayout/ApplicationLayoutBodyBanner.js.map +1 -1
  59. package/components/applicationLayout/ApplicationLayoutBodyBottomBar.js +1 -1
  60. package/components/applicationLayout/ApplicationLayoutBodyBottomBar.js.map +1 -1
  61. package/components/applicationLayout/ApplicationLayoutBodyNavigation.js +1 -1
  62. package/components/applicationLayout/ApplicationLayoutBodyNavigation.js.map +1 -1
  63. package/components/applicationLayout/ApplicationLayoutHeader.js +1 -1
  64. package/components/applicationLayout/ApplicationLayoutHeader.js.map +1 -1
  65. package/components/applicationLayout/ApplicationLayoutSidebar.js +1 -1
  66. package/components/applicationLayout/ApplicationLayoutSidebar.js.map +1 -1
  67. package/components/applicationLayout/SubNavigation.d.ts +7 -0
  68. package/components/applicationLayout/SubNavigation.js +1 -1
  69. package/components/applicationLayout/SubNavigation.js.map +1 -1
  70. package/components/assetTree/AssetTree.d.ts +7 -0
  71. package/components/assetTree/AssetTree.js +1 -1
  72. package/components/assetTree/AssetTree.js.map +1 -1
  73. package/components/assetTree/Tree.d.ts +15 -0
  74. package/components/assetTree/Tree.js +1 -1
  75. package/components/assetTree/Tree.js.map +1 -1
  76. package/components/assetTree/TreeIcon.d.ts +30 -0
  77. package/components/assetTree/TreeIcon.js +16 -0
  78. package/components/assetTree/TreeIcon.js.map +1 -0
  79. package/components/assetTree/TreeLeaf.js +23 -23
  80. package/components/assetTree/TreeLeaf.js.map +1 -1
  81. package/components/assetTree/TreeNode.js +25 -25
  82. package/components/assetTree/TreeNode.js.map +1 -1
  83. package/components/assetTree/TreeNodeContainer.js +1 -1
  84. package/components/assetTree/TreeNodeContainer.js.map +1 -1
  85. package/components/assetTree/TreeOption.js +3 -3
  86. package/components/assetTree/TreeOption.js.map +1 -1
  87. package/components/assetTree/TreeOptions.js +4 -4
  88. package/components/assetTree/TreeOptions.js.map +1 -1
  89. package/components/assetTree/TreeRoot.js +3 -3
  90. package/components/assetTree/TreeRoot.js.map +1 -1
  91. package/components/assetTree/TreeSearch.d.ts +2 -0
  92. package/components/assetTree/TreeSearch.js +3 -3
  93. package/components/assetTree/TreeSearch.js.map +1 -1
  94. package/components/assetTree/TreeSidebar.js +1 -1
  95. package/components/assetTree/TreeSidebar.js.map +1 -1
  96. package/components/assetTree/TreeSidebarCategories.js +4 -4
  97. package/components/assetTree/TreeSidebarCategories.js.map +1 -1
  98. package/components/assetTree/TreeSummary.js +1 -1
  99. package/components/assetTree/TreeSummary.js.map +1 -1
  100. package/components/assetTree/TypeCounter.js +1 -1
  101. package/components/assetTree/TypeCounter.js.map +1 -1
  102. package/components/autosuggest/AutoSuggest.js +1 -1
  103. package/components/autosuggest/AutoSuggest.js.map +1 -1
  104. package/components/avatar/Avatar.js +1 -1
  105. package/components/avatar/Avatar.js.map +1 -1
  106. package/components/banner/Banner.js +1 -1
  107. package/components/banner/Banner.js.map +1 -1
  108. package/components/banner/BannerContent.js +1 -1
  109. package/components/banner/BannerContent.js.map +1 -1
  110. package/components/barList/BarList.d.ts +26 -0
  111. package/components/barList/BarList.js +1 -1
  112. package/components/barList/BarList.js.map +1 -1
  113. package/components/bottomSheet/BottomSheet.d.ts +17 -3
  114. package/components/bottomSheet/BottomSheet.js +1 -1
  115. package/components/bottomSheet/BottomSheet.js.map +1 -1
  116. package/components/bottomSheet/TimedBottomSheet.d.ts +10 -0
  117. package/components/bottomSheet/TimedBottomSheet.js.map +1 -1
  118. package/components/button/Button.d.ts +53 -7
  119. package/components/button/Button.js +87 -64
  120. package/components/button/Button.js.map +1 -1
  121. package/components/button/ButtonToolbar.js +1 -1
  122. package/components/button/ButtonToolbar.js.map +1 -1
  123. package/components/button/ToggleButton.d.ts +4 -1
  124. package/components/button/ToggleButton.js.map +1 -1
  125. package/components/calendarStripe/CalendarStripe.d.ts +1 -1
  126. package/components/calendarStripe/CalendarStripe.js +48 -50
  127. package/components/calendarStripe/CalendarStripe.js.map +1 -1
  128. package/components/card/Card.js +1 -1
  129. package/components/card/Card.js.map +1 -1
  130. package/components/charts/Area.d.ts +2 -2
  131. package/components/charts/Area.js.map +1 -1
  132. package/components/charts/Line.d.ts +2 -2
  133. package/components/charts/Line.js.map +1 -1
  134. package/components/charts/RadialBarChart.js +106 -103
  135. package/components/charts/RadialBarChart.js.map +1 -1
  136. package/components/checkbox/Checkbox.d.ts +0 -3
  137. package/components/checkbox/Checkbox.js +6 -6
  138. package/components/checkbox/Checkbox.js.map +1 -1
  139. package/components/circularProgress/CircularProgress.d.ts +139 -0
  140. package/components/circularProgress/CircularProgress.js +197 -0
  141. package/components/circularProgress/CircularProgress.js.map +1 -0
  142. package/components/clearableInput/ClearableInput.d.ts +21 -20
  143. package/components/clearableInput/ClearableInput.js +9 -9
  144. package/components/clearableInput/ClearableInput.js.map +1 -1
  145. package/components/collapse/Collapse.d.ts +3 -0
  146. package/components/collapse/Collapse.js +12 -12
  147. package/components/collapse/Collapse.js.map +1 -1
  148. package/components/contentLoader/ContentLoader.d.ts +10 -2
  149. package/components/contentLoader/ContentLoader.js.map +1 -1
  150. package/components/dataTabs/DataTabHeader.js +1 -1
  151. package/components/dataTabs/DataTabHeader.js.map +1 -1
  152. package/components/dataTabs/DataTabs.d.ts +6 -0
  153. package/components/dataTabs/DataTabs.js +4 -4
  154. package/components/dataTabs/DataTabs.js.map +1 -1
  155. package/components/datepicker/DatePicker.js +6 -6
  156. package/components/datepicker/DatePicker.js.map +1 -1
  157. package/components/datepicker/DateRangePicker.js +1 -1
  158. package/components/datepicker/DateRangePicker.js.map +1 -1
  159. package/components/datepicker/DayPicker.js +1 -1
  160. package/components/datepicker/DayPicker.js.map +1 -1
  161. package/components/dialog/ConfirmationDialog.d.ts +22 -0
  162. package/components/dialog/ConfirmationDialog.js.map +1 -1
  163. package/components/dialog/Dialog.d.ts +13 -1
  164. package/components/dialog/Dialog.js +55 -55
  165. package/components/dialog/Dialog.js.map +1 -1
  166. package/components/dialog/DialogBody.js +1 -1
  167. package/components/dialog/DialogBody.js.map +1 -1
  168. package/components/dialog/DialogFooter.js +1 -1
  169. package/components/dialog/DialogFooter.js.map +1 -1
  170. package/components/dialog/DialogHeader.js +1 -1
  171. package/components/dialog/DialogHeader.js.map +1 -1
  172. package/components/dialog/MediaDialog.js +1 -1
  173. package/components/dialog/MediaDialog.js.map +1 -1
  174. package/components/dialog/ReleaseNotesDialog.d.ts +3 -3
  175. package/components/dialog/ReleaseNotesDialog.js.map +1 -1
  176. package/components/dialog/SplitDialog.js +1 -1
  177. package/components/dialog/SplitDialog.js.map +1 -1
  178. package/components/divider/Divider.js +1 -1
  179. package/components/divider/Divider.js.map +1 -1
  180. package/components/dropdown/ButtonDropdown.d.ts +4 -0
  181. package/components/dropdown/ButtonDropdown.js +52 -52
  182. package/components/dropdown/ButtonDropdown.js.map +1 -1
  183. package/components/dropdown/DropdownSubmenu.d.ts +4 -0
  184. package/components/dropdown/DropdownSubmenu.js +3 -3
  185. package/components/dropdown/DropdownSubmenu.js.map +1 -1
  186. package/components/dropdown/DropdownToggleButton.d.ts +1 -1
  187. package/components/dropdown/DropdownToggleButton.js +4 -3
  188. package/components/dropdown/DropdownToggleButton.js.map +1 -1
  189. package/components/dropdown/SplitCaretButton.js +6 -6
  190. package/components/dropdown/SplitCaretButton.js.map +1 -1
  191. package/components/editableContent/EditableContent.d.ts +6 -0
  192. package/components/editableContent/EditableContent.js +1 -1
  193. package/components/editableContent/EditableContent.js.map +1 -1
  194. package/components/ellipsis/TextTruncateMiddle.d.ts +23 -0
  195. package/components/ellipsis/TextTruncateMiddle.js +21 -0
  196. package/components/ellipsis/TextTruncateMiddle.js.map +1 -0
  197. package/components/expander/ExpanderList.d.ts +3 -0
  198. package/components/expander/ExpanderList.js +5 -5
  199. package/components/expander/ExpanderList.js.map +1 -1
  200. package/components/expander/ExpanderPanel.d.ts +14 -4
  201. package/components/expander/ExpanderPanel.js +1 -1
  202. package/components/expander/ExpanderPanel.js.map +1 -1
  203. package/components/fade/Fade.d.ts +1 -1
  204. package/components/fade/Fade.js.map +1 -1
  205. package/components/feedback/FeedbackRating.js +1 -1
  206. package/components/feedback/FeedbackRating.js.map +1 -1
  207. package/components/feedback/FeedbackReactions.js +1 -1
  208. package/components/feedback/FeedbackReactions.js.map +1 -1
  209. package/components/filepicker/FilePicker.d.ts +0 -2
  210. package/components/filepicker/FilePicker.js.map +1 -1
  211. package/components/formLabel/FormLabel.js +6 -9
  212. package/components/formLabel/FormLabel.js.map +1 -1
  213. package/components/formLabel/LabeledElement.js +1 -1
  214. package/components/formLabel/LabeledElement.js.map +1 -1
  215. package/components/groupedItemList/GroupedItemList.d.ts +10 -7
  216. package/components/groupedItemList/GroupedItemList.js.map +1 -1
  217. package/components/listMenu/ListMenu.js +2 -5
  218. package/components/listMenu/ListMenu.js.map +1 -1
  219. package/components/listMenu/ListMenuGroup.d.ts +2 -1
  220. package/components/listMenu/ListMenuGroup.js +2 -2
  221. package/components/listMenu/ListMenuGroup.js.map +1 -1
  222. package/components/loadMore/LoadMoreButton.js +1 -1
  223. package/components/loadMore/LoadMoreButton.js.map +1 -1
  224. package/components/loadMore/LoadMoreProgress.js +1 -1
  225. package/components/loadMore/LoadMoreProgress.js.map +1 -1
  226. package/components/map/components/Map.js.map +1 -1
  227. package/components/map/components/constants.js.map +1 -1
  228. package/components/map/components/features/ContextMenuItem.d.ts +1 -1
  229. package/components/map/components/features/ContextMenuItem.js +2 -17
  230. package/components/map/components/features/ContextMenuItem.js.map +1 -1
  231. package/components/map/components/features/MapSettings.js +4 -4
  232. package/components/map/components/features/MapSettings.js.map +1 -1
  233. package/components/map/components/features/basics/Polyline.d.ts +4 -1
  234. package/components/map/components/features/basics/Polyline.js +1 -1
  235. package/components/map/components/features/basics/Polyline.js.map +1 -1
  236. package/components/map/components/features/layers/MarkerLayer.d.ts +3 -1
  237. package/components/map/components/features/layers/MarkerLayer.js.map +1 -1
  238. package/components/map/components/features/layers/clustering/ClusterLayer.js +1 -1
  239. package/components/map/components/features/layers/clustering/ClusterLayer.js.map +1 -1
  240. package/components/map/components/features/layers/clustering/SimpleClusterLayer.d.ts +3 -2
  241. package/components/map/components/features/layers/clustering/SimpleClusterLayer.js.map +1 -1
  242. package/components/map/components/features/layers/overlayLayers/RoadRestrictionLayer.js +7 -7
  243. package/components/map/components/features/layers/overlayLayers/RoadRestrictionLayer.js.map +1 -1
  244. package/components/map/components/features/layers/overlayLayers/TrafficLayer.js +4 -4
  245. package/components/map/components/features/layers/overlayLayers/TrafficLayer.js.map +1 -1
  246. package/components/map/components/features/settings/MapSettingsItem.js +1 -1
  247. package/components/map/components/features/settings/MapSettingsItem.js.map +1 -1
  248. package/components/map/components/features/settings/MapSettingsPanel.js +6 -20
  249. package/components/map/components/features/settings/MapSettingsPanel.js.map +1 -1
  250. package/components/map/components/features/settings/MapSettingsTile.js +87 -61
  251. package/components/map/components/features/settings/MapSettingsTile.js.map +1 -1
  252. package/components/map/components/features/settings/ZoomButtons.js +1 -1
  253. package/components/map/components/features/settings/ZoomButtons.js.map +1 -1
  254. package/components/map/components/features/settings/builtinSettings/MapTypeSettings.d.ts +38 -1
  255. package/components/map/components/features/settings/builtinSettings/MapTypeSettings.js +128 -92
  256. package/components/map/components/features/settings/builtinSettings/MapTypeSettings.js.map +1 -1
  257. package/components/map/utils/clustering.d.ts +6 -1
  258. package/components/map/utils/clustering.js +25 -19
  259. package/components/map/utils/clustering.js.map +1 -1
  260. package/components/map/utils/eventHandling.js +9 -9
  261. package/components/map/utils/eventHandling.js.map +1 -1
  262. package/components/map/utils/mapUtils.d.ts +6 -6
  263. package/components/map/utils/mapUtils.js +14 -19
  264. package/components/map/utils/mapUtils.js.map +1 -1
  265. package/components/map/utils/rendering.d.ts +1 -1
  266. package/components/map/utils/rendering.js +23 -23
  267. package/components/map/utils/rendering.js.map +1 -1
  268. package/components/mapMarker/ClusterMapMarker.js +1 -1
  269. package/components/mapMarker/ClusterMapMarker.js.map +1 -1
  270. package/components/mapMarker/SingleMapMarker.js +1 -1
  271. package/components/mapMarker/SingleMapMarker.js.map +1 -1
  272. package/components/menuItems/MenuItem.d.ts +23 -0
  273. package/components/menuItems/MenuItem.js +1 -1
  274. package/components/menuItems/MenuItem.js.map +1 -1
  275. package/components/menuItems/MenuItemList.js +1 -1
  276. package/components/menuItems/MenuItemList.js.map +1 -1
  277. package/components/navigation/AppNavigationBar.js +4 -4
  278. package/components/navigation/AppNavigationBar.js.map +1 -1
  279. package/components/noData/NoData.js +1 -1
  280. package/components/noData/NoData.js.map +1 -1
  281. package/components/notification/Notification.js +4 -4
  282. package/components/notification/Notification.js.map +1 -1
  283. package/components/numberControl/NumberControl.js +4 -4
  284. package/components/numberControl/NumberControl.js.map +1 -1
  285. package/components/numberInput/NumberInput.js +1 -1
  286. package/components/numberInput/NumberInput.js.map +1 -1
  287. package/components/onboarding/OnboardingTip.d.ts +18 -12
  288. package/components/onboarding/OnboardingTip.js +4 -4
  289. package/components/onboarding/OnboardingTip.js.map +1 -1
  290. package/components/overlay/OverlayTrigger.d.ts +43 -1
  291. package/components/overlay/OverlayTrigger.js.map +1 -1
  292. package/components/page/Page.js +1 -1
  293. package/components/page/Page.js.map +1 -1
  294. package/components/pager/Pager.d.ts +3 -0
  295. package/components/pager/Pager.js +1 -1
  296. package/components/pager/Pager.js.map +1 -1
  297. package/components/popover/Popover.d.ts +1 -0
  298. package/components/popover/Popover.js.map +1 -1
  299. package/components/preloader/ImagePreloader.d.ts +1 -1
  300. package/components/preloader/ImagePreloader.js.map +1 -1
  301. package/components/radiobutton/RadioButton.d.ts +10 -6
  302. package/components/radiobutton/RadioButton.js +5 -5
  303. package/components/radiobutton/RadioButton.js.map +1 -1
  304. package/components/radiobutton/RadioCardGroup.d.ts +86 -0
  305. package/components/radiobutton/RadioCardGroup.js +110 -0
  306. package/components/radiobutton/RadioCardGroup.js.map +1 -0
  307. package/components/releaseNotes/ReleaseNotes.d.ts +0 -3
  308. package/components/releaseNotes/ReleaseNotes.js.map +1 -1
  309. package/components/resizer/Resizer.d.ts +17 -3
  310. package/components/resizer/Resizer.js +1 -1
  311. package/components/resizer/Resizer.js.map +1 -1
  312. package/components/responsiveColumnStripe/ResponsiveColumnStripe.js +1 -1
  313. package/components/responsiveColumnStripe/ResponsiveColumnStripe.js.map +1 -1
  314. package/components/rioglyph/Rioglyph.d.ts +20 -8
  315. package/components/rioglyph/Rioglyph.js +1 -1
  316. package/components/rioglyph/Rioglyph.js.map +1 -1
  317. package/components/rioglyph/RioglyphIconType.d.ts +1 -1
  318. package/components/rules/RuleConnector.js +1 -1
  319. package/components/rules/RuleConnector.js.map +1 -1
  320. package/components/rules/RuleContainer.js +27 -27
  321. package/components/rules/RuleContainer.js.map +1 -1
  322. package/components/rules/RulesWrapper.js +1 -1
  323. package/components/rules/RulesWrapper.js.map +1 -1
  324. package/components/saveableInput/SaveableDateInput.d.ts +20 -2
  325. package/components/saveableInput/SaveableDateInput.js +1 -1
  326. package/components/saveableInput/SaveableDateInput.js.map +1 -1
  327. package/components/saveableInput/SaveableInput.d.ts +10 -2
  328. package/components/saveableInput/SaveableInput.js +49 -49
  329. package/components/saveableInput/SaveableInput.js.map +1 -1
  330. package/components/searchHighlight/SearchHighlightText.d.ts +28 -0
  331. package/components/searchHighlight/SearchHighlightText.js +15 -0
  332. package/components/searchHighlight/SearchHighlightText.js.map +1 -0
  333. package/components/selects/BaseSelectDropdown.js +90 -79
  334. package/components/selects/BaseSelectDropdown.js.map +1 -1
  335. package/components/selects/ClearButton.js +4 -4
  336. package/components/selects/ClearButton.js.map +1 -1
  337. package/components/selects/Multiselect.js +6 -6
  338. package/components/selects/Multiselect.js.map +1 -1
  339. package/components/selects/MultiselectToggleFilter.js +4 -4
  340. package/components/selects/MultiselectToggleFilter.js.map +1 -1
  341. package/components/selects/MultiselectToggleSelection.js +1 -1
  342. package/components/selects/MultiselectToggleSelection.js.map +1 -1
  343. package/components/selects/Select.d.ts +5 -0
  344. package/components/selects/Select.js +93 -93
  345. package/components/selects/Select.js.map +1 -1
  346. package/components/selects/SelectFilter.js +1 -1
  347. package/components/selects/SelectFilter.js.map +1 -1
  348. package/components/selects/WithFeedbackAndAddon.js +1 -1
  349. package/components/selects/WithFeedbackAndAddon.js.map +1 -1
  350. package/components/sidebars/Sidebar.d.ts +19 -3
  351. package/components/sidebars/Sidebar.js +54 -54
  352. package/components/sidebars/Sidebar.js.map +1 -1
  353. package/components/sidebars/SidebarBackdrop.js +4 -4
  354. package/components/sidebars/SidebarBackdrop.js.map +1 -1
  355. package/components/sidebars/SidebarFooter.js +1 -1
  356. package/components/sidebars/SidebarFooter.js.map +1 -1
  357. package/components/sidebars/SidebarFullscreenToggle.js +4 -4
  358. package/components/sidebars/SidebarFullscreenToggle.js.map +1 -1
  359. package/components/slider/RangeSlider.d.ts +15 -0
  360. package/components/slider/RangeSlider.js +1 -1
  361. package/components/slider/RangeSlider.js.map +1 -1
  362. package/components/slider/Slider.d.ts +9 -0
  363. package/components/slider/Slider.js +1 -1
  364. package/components/slider/Slider.js.map +1 -1
  365. package/components/smoothScrollbars/SmoothScrollbars.d.ts +44 -0
  366. package/components/smoothScrollbars/SmoothScrollbars.js +1 -1
  367. package/components/smoothScrollbars/SmoothScrollbars.js.map +1 -1
  368. package/components/spinner/Spinner.d.ts +3 -3
  369. package/components/spinner/Spinner.js +5 -4
  370. package/components/spinner/Spinner.js.map +1 -1
  371. package/components/states/CustomState.d.ts +69 -1
  372. package/components/states/CustomState.js +1 -1
  373. package/components/states/CustomState.js.map +1 -1
  374. package/components/states/EmptyState.d.ts +1 -1
  375. package/components/states/EmptyState.js.map +1 -1
  376. package/components/states/ErrorState.d.ts +1 -1
  377. package/components/states/ErrorState.js.map +1 -1
  378. package/components/states/ForbiddenState.d.ts +1 -1
  379. package/components/states/ForbiddenState.js.map +1 -1
  380. package/components/states/MaintenanceState.d.ts +1 -1
  381. package/components/states/MaintenanceState.js.map +1 -1
  382. package/components/states/NotBookedState.d.ts +1 -1
  383. package/components/states/NotBookedState.js.map +1 -1
  384. package/components/states/NotFoundState.d.ts +1 -1
  385. package/components/states/NotFoundState.js.map +1 -1
  386. package/components/states/StateButton.js +1 -1
  387. package/components/states/StateButton.js.map +1 -1
  388. package/components/states/StateIcon.d.ts +14 -1
  389. package/components/states/StateIcon.js.map +1 -1
  390. package/components/statsWidget/StatsWidget.d.ts +2 -0
  391. package/components/statsWidget/StatsWidget.js +1 -1
  392. package/components/statsWidget/StatsWidget.js.map +1 -1
  393. package/components/statsWidget/StatsWidgetBody.d.ts +1 -0
  394. package/components/statsWidget/StatsWidgetBody.js +1 -1
  395. package/components/statsWidget/StatsWidgetBody.js.map +1 -1
  396. package/components/statsWidget/StatsWidgetFooter.js +1 -1
  397. package/components/statsWidget/StatsWidgetFooter.js.map +1 -1
  398. package/components/statsWidget/StatsWidgetHeader.js +1 -1
  399. package/components/statsWidget/StatsWidgetHeader.js.map +1 -1
  400. package/components/statsWidget/StatsWidgetNumber.d.ts +2 -0
  401. package/components/statsWidget/StatsWidgetNumber.js +2 -2
  402. package/components/statsWidget/StatsWidgetNumber.js.map +1 -1
  403. package/components/statsWidget/StatsWidgetSpacer.js +1 -1
  404. package/components/statsWidget/StatsWidgetSpacer.js.map +1 -1
  405. package/components/statsWidget/StatsWidgets.js +1 -1
  406. package/components/statsWidget/StatsWidgets.js.map +1 -1
  407. package/components/statusBar/StatusBar.d.ts +98 -3
  408. package/components/statusBar/StatusBar.js +24 -17
  409. package/components/statusBar/StatusBar.js.map +1 -1
  410. package/components/statusBar/StatusBarIcon.d.ts +2 -2
  411. package/components/statusBar/StatusBarIcon.js +4 -4
  412. package/components/statusBar/StatusBarIcon.js.map +1 -1
  413. package/components/statusBar/StatusBarLabel.d.ts +2 -2
  414. package/components/statusBar/StatusBarLabel.js +5 -7
  415. package/components/statusBar/StatusBarLabel.js.map +1 -1
  416. package/components/statusBar/StatusBarProgressBar.d.ts +1 -1
  417. package/components/statusBar/StatusBarProgressBar.js +1 -1
  418. package/components/statusBar/StatusBarProgressBar.js.map +1 -1
  419. package/components/steppedProgressBar/SteppedProgressBar.d.ts +1 -1
  420. package/components/steppedProgressBar/SteppedProgressBar.js +1 -1
  421. package/components/steppedProgressBar/SteppedProgressBar.js.map +1 -1
  422. package/components/switch/Switch.d.ts +28 -1
  423. package/components/switch/Switch.js +77 -35
  424. package/components/switch/Switch.js.map +1 -1
  425. package/components/table/SortArrowDown.d.ts +1 -1
  426. package/components/table/SortArrowDown.js.map +1 -1
  427. package/components/table/SortArrowUp.d.ts +1 -1
  428. package/components/table/SortArrowUp.js.map +1 -1
  429. package/components/table/TableCardsSorting.js +4 -4
  430. package/components/table/TableCardsSorting.js.map +1 -1
  431. package/components/table/TableHead.js +1 -1
  432. package/components/table/TableHead.js.map +1 -1
  433. package/components/table/TableSearch.js +1 -1
  434. package/components/table/TableSearch.js.map +1 -1
  435. package/components/table/TableSettingsColumnButtons.d.ts +1 -1
  436. package/components/table/TableSettingsColumnButtons.js +1 -1
  437. package/components/table/TableSettingsColumnButtons.js.map +1 -1
  438. package/components/table/TableSettingsColumnDetails.d.ts +1 -1
  439. package/components/table/TableSettingsColumnDetails.js +1 -1
  440. package/components/table/TableSettingsColumnDetails.js.map +1 -1
  441. package/components/table/TableSettingsDialog.d.ts +56 -1
  442. package/components/table/TableSettingsDialog.js +170 -144
  443. package/components/table/TableSettingsDialog.js.map +1 -1
  444. package/components/table/TableSettingsDialogFooter.js +9 -9
  445. package/components/table/TableSettingsDialogFooter.js.map +1 -1
  446. package/components/table/TableSettingsListContainer.d.ts +1 -1
  447. package/components/table/TableSettingsListContainer.js.map +1 -1
  448. package/components/table/TableSettingsListItem.d.ts +1 -1
  449. package/components/table/TableSettingsListItem.js +8 -8
  450. package/components/table/TableSettingsListItem.js.map +1 -1
  451. package/components/table/TableToolbar.js +1 -1
  452. package/components/table/TableToolbar.js.map +1 -1
  453. package/components/table/TableViewToggles.d.ts +21 -1
  454. package/components/table/TableViewToggles.js +1 -1
  455. package/components/table/TableViewToggles.js.map +1 -1
  456. package/components/tag/Tag.d.ts +7 -2
  457. package/components/tag/Tag.js +1 -1
  458. package/components/tag/Tag.js.map +1 -1
  459. package/components/tag/TagList.js +1 -1
  460. package/components/tag/TagList.js.map +1 -1
  461. package/components/tagManager/CustomSuggestionItem.js +1 -1
  462. package/components/tagManager/CustomSuggestionItem.js.map +1 -1
  463. package/components/tagManager/TagManager.d.ts +29 -2
  464. package/components/tagManager/TagManager.js +6 -6
  465. package/components/tagManager/TagManager.js.map +1 -1
  466. package/components/tagManager/TagManagerItemList.d.ts +1 -1
  467. package/components/tagManager/TagManagerItemList.js +1 -1
  468. package/components/tagManager/TagManagerItemList.js.map +1 -1
  469. package/components/teaser/Teaser.d.ts +57 -55
  470. package/components/teaser/Teaser.js +1 -1
  471. package/components/teaser/Teaser.js.map +1 -1
  472. package/components/teaser/TeaserContainer.d.ts +1 -1
  473. package/components/teaser/TeaserContainer.js +1 -1
  474. package/components/teaser/TeaserContainer.js.map +1 -1
  475. package/components/timepicker/TimePicker.d.ts +20 -0
  476. package/components/timepicker/TimePicker.js +153 -99
  477. package/components/timepicker/TimePicker.js.map +1 -1
  478. package/components/tooltip/SimpleTooltip.d.ts +22 -4
  479. package/components/tooltip/SimpleTooltip.js.map +1 -1
  480. package/components/tooltip/Tooltip.d.ts +22 -2
  481. package/components/tooltip/Tooltip.js +1 -1
  482. package/components/tooltip/Tooltip.js.map +1 -1
  483. package/components/tracker/Tracker.d.ts +85 -0
  484. package/components/tracker/Tracker.js +54 -0
  485. package/components/tracker/Tracker.js.map +1 -0
  486. package/components/tracker/TrackerBlock.d.ts +11 -0
  487. package/components/tracker/TrackerBlock.js +34 -0
  488. package/components/tracker/TrackerBlock.js.map +1 -0
  489. package/components/video/ResponsiveVideo.d.ts +8 -3
  490. package/components/video/ResponsiveVideo.js +1 -1
  491. package/components/video/ResponsiveVideo.js.map +1 -1
  492. package/hooks/useCookies.d.ts +79 -0
  493. package/hooks/useCookies.js +33 -0
  494. package/hooks/useCookies.js.map +1 -0
  495. package/hooks/useInterval.js +5 -5
  496. package/hooks/useInterval.js.map +1 -1
  497. package/hooks/useIsFocusWithin.js +3 -3
  498. package/hooks/useIsFocusWithin.js.map +1 -1
  499. package/hooks/useKey.d.ts +1 -1
  500. package/hooks/useKey.js.map +1 -1
  501. package/hooks/useLatest.d.ts +16 -0
  502. package/hooks/useLatest.js +11 -0
  503. package/hooks/useLatest.js.map +1 -0
  504. package/hooks/useOnboarding.d.ts +86 -80
  505. package/hooks/useOnboarding.js.map +1 -1
  506. package/hooks/usePostMessage.d.ts +2 -1
  507. package/hooks/usePostMessage.js.map +1 -1
  508. package/hooks/useRioCookieConsent.d.ts +49 -0
  509. package/hooks/useRioCookieConsent.js +44 -0
  510. package/hooks/useRioCookieConsent.js.map +1 -0
  511. package/hooks/useSearch.d.ts +1 -1
  512. package/hooks/useSearch.js +28 -17
  513. package/hooks/useSearch.js.map +1 -1
  514. package/hooks/useSearchHighlight.d.ts +60 -0
  515. package/hooks/useSearchHighlight.js +54 -0
  516. package/hooks/useSearchHighlight.js.map +1 -0
  517. package/hooks/useTableExport.js.map +1 -1
  518. package/hooks/useTimeout.js +11 -11
  519. package/hooks/useTimeout.js.map +1 -1
  520. package/hooks/useUncontrollable.d.ts +1 -1
  521. package/hooks/useUncontrollable.js.map +1 -1
  522. package/hooks/useUrlState.d.ts +62 -0
  523. package/hooks/useUrlState.js +137 -0
  524. package/hooks/useUrlState.js.map +1 -0
  525. package/mergeClassNameOverrides.d.ts +1 -0
  526. package/mergeClassNameOverrides.js +5 -0
  527. package/mergeClassNameOverrides.js.map +1 -0
  528. package/package.json +18 -21
  529. package/routeUtils.js +11 -5
  530. package/routeUtils.js.map +1 -1
  531. package/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js +1 -1
  532. package/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js.map +1 -1
  533. package/useCookies.d.ts +2 -0
  534. package/useCookies.js +5 -0
  535. package/useCookies.js.map +1 -0
  536. package/useRioCookieConsent.d.ts +2 -0
  537. package/useRioCookieConsent.js +5 -0
  538. package/useRioCookieConsent.js.map +1 -0
  539. package/useSearchHighlight.d.ts +2 -0
  540. package/useSearchHighlight.js +6 -0
  541. package/useSearchHighlight.js.map +1 -0
  542. package/useUrlState.d.ts +2 -0
  543. package/useUrlState.js +5 -0
  544. package/useUrlState.js.map +1 -0
  545. package/utils/classNames.d.ts +3 -0
  546. package/utils/classNames.js +5 -0
  547. package/utils/classNames.js.map +1 -0
  548. package/utils/colorScheme.js +14 -13
  549. package/utils/colorScheme.js.map +1 -1
  550. package/utils/cssuseragent.js.map +1 -1
  551. package/utils/mergeClassNameOverrides.d.ts +1 -0
  552. package/utils/mergeClassNameOverrides.js +55 -0
  553. package/utils/mergeClassNameOverrides.js.map +1 -0
  554. package/utils/routeUtils.d.ts +122 -13
  555. package/utils/routeUtils.js +89 -31
  556. package/utils/routeUtils.js.map +1 -1
  557. package/utils/scrollItemIntoView.js +12 -11
  558. package/utils/scrollItemIntoView.js.map +1 -1
  559. package/utils/urlFeatureToggles.js +19 -20
  560. package/utils/urlFeatureToggles.js.map +1 -1
  561. package/version.d.ts +1 -1
  562. package/version.js +1 -1
  563. package/version.js.map +1 -1
  564. package/components/states/BaseStateProps.d.ts +0 -66
  565. package/components/statusBar/StatusBar.types.d.ts +0 -85
  566. package/components/table/TableSettingsDialog.types.d.ts +0 -39
  567. package/components/tagManager/TagManagerTag.d.ts +0 -5
@@ -1,17 +1,17 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
2
  import { forwardRef as p } from "react";
3
- import f from "classnames";
3
+ import f from "../../utils/classNames.js";
4
4
  import c from "./Caret.js";
5
5
  import d from "../button/Button.js";
6
- const N = p((o, r) => {
7
- const { disabled: s = !1, bsStyle: e, bsSize: a, onClick: m, className: i, ...l } = o, n = f("dropdown-toggle", i);
6
+ const S = p((o, s) => {
7
+ const { disabled: r = !1, bsStyle: e, bsSize: a, onClick: m, className: i, as: u, ...l } = o, n = f("dropdown-toggle", i);
8
8
  return /* @__PURE__ */ t(
9
9
  d,
10
10
  {
11
11
  ...l,
12
12
  type: "button",
13
- ref: r,
14
- disabled: s,
13
+ ref: s,
14
+ disabled: r,
15
15
  bsStyle: e,
16
16
  bsSize: a,
17
17
  onClick: m,
@@ -21,6 +21,6 @@ const N = p((o, r) => {
21
21
  );
22
22
  });
23
23
  export {
24
- N as default
24
+ S as default
25
25
  };
26
26
  //# sourceMappingURL=SplitCaretButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SplitCaretButton.js","sources":["../../../src/components/dropdown/SplitCaretButton.tsx"],"sourcesContent":["import React, { forwardRef, type HTMLProps, type PropsWithChildren } from 'react';\nimport classNames from 'classnames';\n\nimport Caret from './Caret';\nimport Button, { type BUTTON_STYLE, type BUTTON_SIZE } from '../button/Button';\n\nexport type SplitCaretButtonProps = HTMLProps<HTMLButtonElement> & {\n disabled?: boolean;\n iconOnly?: boolean;\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;\n bsSize: BUTTON_SIZE;\n bsStyle: BUTTON_STYLE;\n className?: string;\n};\n\nconst SplitCaretButton = forwardRef<HTMLButtonElement, PropsWithChildren<SplitCaretButtonProps>>((props, ref) => {\n const { disabled = false, bsStyle, bsSize, onClick, className, ...remainingProps } = props;\n\n const splitCaretButtonClasses = classNames('dropdown-toggle', className);\n\n return (\n <Button\n {...remainingProps}\n type='button'\n ref={ref}\n disabled={disabled}\n bsStyle={bsStyle}\n bsSize={bsSize}\n onClick={onClick}\n className={splitCaretButtonClasses}\n >\n <Caret />\n </Button>\n );\n});\n\nexport default SplitCaretButton;\n"],"names":["SplitCaretButton","forwardRef","props","ref","disabled","bsStyle","bsSize","onClick","className","remainingProps","splitCaretButtonClasses","classNames","jsx","Button","Caret"],"mappings":";;;;;AAeA,MAAMA,IAAmBC,EAAwE,CAACC,GAAOC,MAAQ;AAC7G,QAAM,EAAE,UAAAC,IAAW,IAAO,SAAAC,GAAS,QAAAC,GAAQ,SAAAC,GAAS,WAAAC,GAAW,GAAGC,EAAA,IAAmBP,GAE/EQ,IAA0BC,EAAW,mBAAmBH,CAAS;AAEvE,SACI,gBAAAI;AAAA,IAACC;AAAA,IAAA;AAAA,MACI,GAAGJ;AAAA,MACJ,MAAK;AAAA,MACL,KAAAN;AAAA,MACA,UAAAC;AAAA,MACA,SAAAC;AAAA,MACA,QAAAC;AAAA,MACA,SAAAC;AAAA,MACA,WAAWG;AAAA,MAEX,4BAACI,GAAA,CAAA,CAAM;AAAA,IAAA;AAAA,EAAA;AAGnB,CAAC;"}
1
+ {"version":3,"file":"SplitCaretButton.js","sources":["../../../src/components/dropdown/SplitCaretButton.tsx"],"sourcesContent":["import React, { forwardRef, type HTMLProps, type PropsWithChildren } from 'react';\n\nimport classNames from '../../utils/classNames';\nimport Caret from './Caret';\nimport Button, { type BUTTON_STYLE, type BUTTON_SIZE } from '../button/Button';\n\nexport type SplitCaretButtonProps = HTMLProps<HTMLButtonElement> & {\n disabled?: boolean;\n iconOnly?: boolean;\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;\n bsSize: BUTTON_SIZE;\n bsStyle: BUTTON_STYLE;\n className?: string;\n};\n\nconst SplitCaretButton = forwardRef<HTMLButtonElement, PropsWithChildren<SplitCaretButtonProps>>((props, ref) => {\n const { disabled = false, bsStyle, bsSize, onClick, className, as: _as, ...remainingProps } = props;\n\n const splitCaretButtonClasses = classNames('dropdown-toggle', className);\n\n return (\n <Button\n {...remainingProps}\n type='button'\n ref={ref}\n disabled={disabled}\n bsStyle={bsStyle}\n bsSize={bsSize}\n onClick={onClick}\n className={splitCaretButtonClasses}\n >\n <Caret />\n </Button>\n );\n});\n\nexport default SplitCaretButton;\n"],"names":["SplitCaretButton","forwardRef","props","ref","disabled","bsStyle","bsSize","onClick","className","_as","remainingProps","splitCaretButtonClasses","classNames","jsx","Button","Caret"],"mappings":";;;;;AAeA,MAAMA,IAAmBC,EAAwE,CAACC,GAAOC,MAAQ;AAC7G,QAAM,EAAE,UAAAC,IAAW,IAAO,SAAAC,GAAS,QAAAC,GAAQ,SAAAC,GAAS,WAAAC,GAAW,IAAIC,GAAK,GAAGC,EAAA,IAAmBR,GAExFS,IAA0BC,EAAW,mBAAmBJ,CAAS;AAEvE,SACI,gBAAAK;AAAA,IAACC;AAAA,IAAA;AAAA,MACI,GAAGJ;AAAA,MACJ,MAAK;AAAA,MACL,KAAAP;AAAA,MACA,UAAAC;AAAA,MACA,SAAAC;AAAA,MACA,QAAAC;AAAA,MACA,SAAAC;AAAA,MACA,WAAWI;AAAA,MAEX,4BAACI,GAAA,CAAA,CAAM;AAAA,IAAA;AAAA,EAAA;AAGnB,CAAC;"}
@@ -2,11 +2,13 @@ import { default as React, PropsWithChildren } from 'react';
2
2
  export type EditableContentProps = {
3
3
  /**
4
4
  * Visibility flag used to control edit mode from outside.
5
+ *
5
6
  * @default undefined
6
7
  */
7
8
  show?: boolean;
8
9
  /**
9
10
  * Callback function triggered when the save button is clicked.
11
+ *
10
12
  * @param value
11
13
  * @returns
12
14
  */
@@ -50,23 +52,27 @@ export type EditableContentProps = {
50
52
  /**
51
53
  * Offset value to control the vertical position for the editor in case the text element has
52
54
  * borders, spacings different text sizes.
55
+ *
53
56
  * @default 0
54
57
  */
55
58
  editorOffsetTop?: number;
56
59
  /**
57
60
  * Offset value to control the horizontal position for the editor in case the text element has
58
61
  * borders, spacings different text sizes.
62
+ *
59
63
  * @default 0
60
64
  */
61
65
  editorOffsetLeft?: number;
62
66
  /**
63
67
  * Defines the input and button size. Use 'lg' for headlines.
68
+ *
64
69
  * @default 'md'
65
70
  */
66
71
  size?: 'md' | 'lg';
67
72
  /**
68
73
  * Defines if the internal textarea is allowed to resize vertically.
69
74
  * This comes in handy for larger text and when using multiple input rows.
75
+ *
70
76
  * @default false
71
77
  */
72
78
  allowResize?: boolean;
@@ -1,9 +1,9 @@
1
1
  import { jsxs as c, Fragment as re, jsx as o } from "react/jsx-runtime";
2
2
  import { useState as s, useRef as ie, useEffect as le, useMemo as ce } from "react";
3
3
  import { noop as r } from "es-toolkit/function";
4
- import p from "classnames";
5
4
  import { usePopper as pe } from "react-popper";
6
5
  import { createPortal as de } from "react-dom";
6
+ import p from "../../utils/classNames.js";
7
7
  import { getOrCreatePortalRoot as fe } from "../../utils/portalRoot.js";
8
8
  import ue from "../../hooks/useEsc.js";
9
9
  import me from "../../hooks/useFocusTrap.js";
@@ -1 +1 @@
1
- {"version":3,"file":"EditableContent.js","sources":["../../../src/components/editableContent/EditableContent.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect, useMemo, type PropsWithChildren, type CSSProperties } from 'react';\nimport { noop } from 'es-toolkit/function';\nimport classNames from 'classnames';\nimport { usePopper } from 'react-popper';\nimport { createPortal } from 'react-dom';\nimport type { Options, Rect, StrictModifiers } from '@popperjs/core';\n\nimport { getOrCreatePortalRoot } from '../../utils/portalRoot';\nimport useEsc from '../../hooks/useEsc';\nimport useFocusTrap from '../../hooks/useFocusTrap';\n\n// Features\n// [x] Hide children with opacity 0\n// [x] Allow custom editor elements\n// [x] Use textarea for longer text\n// [x] Use focus trap\n// [x] Keyboard support mit esc and tab+enter to accept\n// [-] If space, get the width of the text to make the input larger - no nice solution\n// [x] Control edit mode from outside\n\n// This offset takes into account the padding of the overlay and the padding/border of the edit component (input).\n// This works best if the text is wrapped within a single <span> tag and has a dotted bottom border only.\n// External offset defined by the using component will be starting from 0 for easier understanding.\nconst POPOVER_OFFSET_TOP = -13;\nconst POPOVER_OFFSET_LEFT = -18;\n\nconst DEFAULT_TEXTAREA_ROWS = 1;\n\nexport type EditableContentProps = {\n /**\n * Visibility flag used to control edit mode from outside.\n * @default undefined\n */\n show?: boolean;\n\n /**\n * Callback function triggered when the save button is clicked.\n * @param value\n * @returns\n */\n onSave?: (value: string) => void;\n\n /**\n * Callback function triggered when the cancel button is clicked.\n */\n onCancel?: VoidFunction;\n\n /**\n * Callback function triggered when the input gets focused.\n */\n onFocus?: VoidFunction;\n\n /**\n * Callback function triggered when input looses it's focus.\n */\n onBlur?: VoidFunction;\n\n /**\n * Callback function triggered when entering the edit mode.\n */\n onEditMode?: VoidFunction;\n\n /**\n * Validation function to intercept saving and prevent save on error.\n */\n onSaveValidation?: (value: string) => boolean;\n\n /**\n * Controls the error message visibility from outside. This is useful when using a custom input\n * where the validation happens outside of this component.\n * @default true\n */\n isValid?: boolean;\n\n /**\n * The error message that shall be shown to the user in case the validation fails.\n */\n errorMessage?: React.ReactNode;\n\n /**\n * Use this prop to define a custom editor input component like Select, NumberInput, TimePicker or DatePicker.\n * Handling input state changes of a custom editor need to be handled outside of this component.\n * By default the EditableContent uses a built-in textarea to allow resizing for larger text.\n */\n customEditor?: React.ReactNode;\n\n /**\n * Offset value to control the vertical position for the editor in case the text element has\n * borders, spacings different text sizes.\n * @default 0\n */\n editorOffsetTop?: number;\n\n /**\n * Offset value to control the horizontal position for the editor in case the text element has\n * borders, spacings different text sizes.\n * @default 0\n */\n editorOffsetLeft?: number;\n\n /**\n * Defines the input and button size. Use 'lg' for headlines.\n * @default 'md'\n */\n size?: 'md' | 'lg';\n\n /**\n * Defines if the internal textarea is allowed to resize vertically.\n * This comes in handy for larger text and when using multiple input rows.\n * @default false\n */\n allowResize?: boolean;\n\n /**\n * Defines the number of rows to use by the internal textarea component.\n * When a single line is used, the input is saved on \"enter\" key.\n *\n * @default 1\n */\n inputRows?: number;\n\n /**\n * Additional classes to be set on the editor input itself.\n */\n inputClassName?: string;\n\n /**\n * Additional classes to be set on the editor wrapper element.\n */\n editorClassName?: string;\n\n /**\n * Additional classes to be set on the text wrapper element.\n */\n className?: string;\n};\n\nconst EditableContent = (props: PropsWithChildren<EditableContentProps>) => {\n const {\n show = undefined,\n onSave = noop,\n onCancel = noop,\n onFocus = noop,\n onBlur = noop,\n onEditMode = noop,\n onSaveValidation = () => true,\n isValid = true,\n errorMessage,\n allowResize = false,\n inputRows = DEFAULT_TEXTAREA_ROWS,\n editorOffsetTop = 0,\n editorOffsetLeft = 0,\n customEditor,\n size = 'md',\n className = '',\n inputClassName = '',\n editorClassName = '',\n children,\n ...remainingProps\n } = props;\n\n const [isEditMode, setIsEditMode] = useState(show);\n const [inputValue, setInputValue] = useState('');\n const [hasError, setHasError] = useState(!isValid);\n\n const [referenceElement, setReferenceElement] = useState<HTMLSpanElement | null>(null);\n const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);\n\n const hasCustomControl = !!customEditor;\n\n // Close edit mode on \"esc\"\n useEsc(() => handleCloseEditMode());\n\n // Trap focus on the popper element\n useFocusTrap(popperElement);\n\n // Input ref used to focus inside when entering edit mode\n const inputRef = useRef<HTMLTextAreaElement>(null);\n\n useEffect(() => {\n if (inputRef.current && isEditMode) {\n inputRef.current?.focus();\n inputRef.current?.select();\n }\n }, [isEditMode, inputRef.current]);\n\n const customModifier = useMemo(\n () => ({\n name: 'offset',\n options: {\n offset: ({ reference }: { reference: Rect }) => {\n const leftOffset = POPOVER_OFFSET_LEFT + editorOffsetLeft;\n const topOffset = -(reference.height - (POPOVER_OFFSET_TOP + editorOffsetTop));\n return [leftOffset, topOffset];\n },\n },\n }),\n []\n );\n\n const popperConfig: Options = {\n placement: 'bottom-start',\n modifiers: [customModifier],\n strategy: 'absolute',\n };\n\n const { styles, attributes } = usePopper<StrictModifiers>(referenceElement, popperElement, popperConfig);\n\n const handleEditMode = () => {\n // In a controlled usage, the \"show\" property is set from the outside\n // and the edit mode is handled there\n if (show === undefined) {\n enterEditMode();\n }\n onEditMode();\n };\n\n const enterEditMode = () => {\n setIsEditMode(true);\n setInputValue(referenceElement?.textContent?.trimEnd() ?? '');\n setHasError(false);\n };\n\n const handleInputChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n setInputValue(event.target.value);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n // Prevent line breaks when textarea is a single line\n if (event.key === 'Enter' && inputRows === DEFAULT_TEXTAREA_ROWS) {\n event.preventDefault();\n\n // Save on \"enter\" when textarea has a single line\n handleSaveChanges();\n }\n };\n\n const handleCloseEditMode = () => {\n setIsEditMode(false);\n onCancel();\n };\n\n const handleSaveChanges = () => {\n const isInputValid = onSaveValidation(inputValue);\n setHasError(!isInputValid);\n\n if (isInputValid) {\n setIsEditMode(false);\n onSave(inputValue.trimEnd());\n }\n };\n\n // Control edit mode from outside for instance if text element got focus\n // and user used \"Enter\" key to enter edit mode.\n const [previousShow, setPreviousShow] = useState(show);\n if (show !== previousShow) {\n if (show) {\n enterEditMode();\n }\n if (!show) {\n setIsEditMode(false);\n }\n setPreviousShow(show);\n }\n\n // Control error message visibility from outside. This is useful when using a custom input\n // where the validation happens outside of this component.\n const [previousIsValid, setPreviousIsValid] = useState(isValid);\n if (isValid !== previousIsValid) {\n setHasError(!isValid);\n setPreviousIsValid(isValid);\n }\n\n const textWrapperClasses = classNames(className, isEditMode && 'opacity-0');\n\n const overlayWrapperClasses = classNames(\n 'EditableContentEditor',\n 'display-flex gap-5',\n 'padding-5',\n 'rounded',\n 'shadow-accent',\n 'z-index-max',\n 'bg-white',\n editorClassName\n );\n\n const inputWrapperClasses = classNames(\n 'display-flex flex-column gap-5',\n 'margin-0',\n 'form-group',\n hasError && 'has-feedback has-error'\n );\n\n const inputClasses = classNames('form-control', size === 'lg' && 'input-lg', inputClassName);\n\n const inputStyle: CSSProperties = {\n minWidth: '100px',\n resize: allowResize ? 'vertical' : 'none',\n };\n\n return (\n <>\n <span ref={setReferenceElement} onClick={handleEditMode} className={textWrapperClasses}>\n {children}\n </span>\n {isEditMode &&\n createPortal(\n <div\n className={overlayWrapperClasses}\n onClick={event => event.stopPropagation()}\n ref={setPopperElement}\n style={styles.popper}\n {...attributes.popper}\n {...remainingProps}\n >\n <div className={inputWrapperClasses}>\n {hasCustomControl && customEditor}\n {!hasCustomControl && (\n <textarea\n ref={inputRef}\n className={inputClasses}\n value={inputValue}\n onChange={handleInputChange}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyDown={handleKeyDown}\n style={inputStyle}\n rows={inputRows}\n />\n )}\n {hasError && <div className='help-block position-relative'>{errorMessage}</div>}\n </div>\n <div className='display-flex gap-5'>\n <button\n type='button'\n onClick={handleCloseEditMode}\n className={`EditableContentCancel btn btn-default btn-icon-only btn-${size}`}\n aria-label='EditableContent cancel button'\n data-testid='EditableContentCancel'\n >\n <span className='rioglyph rioglyph-remove' />\n </button>\n <button\n type='button'\n onClick={handleSaveChanges}\n className={`EditableContentSave btn btn-primary btn-icon-only btn-${size}`}\n aria-label='EditableContent save button'\n data-testid='EditableContentSave'\n >\n <span className='rioglyph rioglyph-ok' />\n </button>\n </div>\n </div>,\n getOrCreatePortalRoot()\n )}\n </>\n );\n};\n\nexport default EditableContent;\n"],"names":["POPOVER_OFFSET_TOP","POPOVER_OFFSET_LEFT","DEFAULT_TEXTAREA_ROWS","EditableContent","props","show","onSave","noop","onCancel","onFocus","onBlur","onEditMode","onSaveValidation","isValid","errorMessage","allowResize","inputRows","editorOffsetTop","editorOffsetLeft","customEditor","size","className","inputClassName","editorClassName","children","remainingProps","isEditMode","setIsEditMode","useState","inputValue","setInputValue","hasError","setHasError","referenceElement","setReferenceElement","popperElement","setPopperElement","hasCustomControl","useEsc","handleCloseEditMode","useFocusTrap","inputRef","useRef","useEffect","popperConfig","useMemo","reference","leftOffset","topOffset","styles","attributes","usePopper","handleEditMode","enterEditMode","handleInputChange","event","handleKeyDown","handleSaveChanges","isInputValid","previousShow","setPreviousShow","previousIsValid","setPreviousIsValid","textWrapperClasses","classNames","overlayWrapperClasses","inputWrapperClasses","inputClasses","inputStyle","jsxs","Fragment","jsx","createPortal","getOrCreatePortalRoot"],"mappings":";;;;;;;;;AAuBA,MAAMA,KAAqB,KACrBC,KAAsB,KAEtBC,IAAwB,GA+GxBC,KAAkB,CAACC,MAAmD;AACxE,QAAM;AAAA,IACF,MAAAC,IAAO;AAAA,IACP,QAAAC,IAASC;AAAA,IACT,UAAAC,IAAWD;AAAA,IACX,SAAAE,IAAUF;AAAA,IACV,QAAAG,IAASH;AAAA,IACT,YAAAI,IAAaJ;AAAA,IACb,kBAAAK,IAAmB,MAAM;AAAA,IACzB,SAAAC,IAAU;AAAA,IACV,cAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,WAAAC,IAAYd;AAAA,IACZ,iBAAAe,IAAkB;AAAA,IAClB,kBAAAC,IAAmB;AAAA,IACnB,cAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,WAAAC,IAAY;AAAA,IACZ,gBAAAC,IAAiB;AAAA,IACjB,iBAAAC,IAAkB;AAAA,IAClB,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACHrB,GAEE,CAACsB,GAAYC,CAAa,IAAIC,EAASvB,CAAI,GAC3C,CAACwB,GAAYC,CAAa,IAAIF,EAAS,EAAE,GACzC,CAACG,GAAUC,CAAW,I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ources":["../../../src/components/editableContent/EditableContent.tsx"],"sourcesContent":["import React, { useState, useRef, useEffect, useMemo, type PropsWithChildren, type CSSProperties } from 'react';\nimport { noop } from 'es-toolkit/function';\nimport { usePopper } from 'react-popper';\nimport { createPortal } from 'react-dom';\nimport type { Options, Rect, StrictModifiers } from '@popperjs/core';\n\nimport classNames from '../../utils/classNames';\nimport { getOrCreatePortalRoot } from '../../utils/portalRoot';\nimport useEsc from '../../hooks/useEsc';\nimport useFocusTrap from '../../hooks/useFocusTrap';\n\n// Features\n// [x] Hide children with opacity 0\n// [x] Allow custom editor elements\n// [x] Use textarea for longer text\n// [x] Use focus trap\n// [x] Keyboard support mit esc and tab+enter to accept\n// [-] If space, get the width of the text to make the input larger - no nice solution\n// [x] Control edit mode from outside\n\n// This offset takes into account the padding of the overlay and the padding/border of the edit component (input).\n// This works best if the text is wrapped within a single <span> tag and has a dotted bottom border only.\n// External offset defined by the using component will be starting from 0 for easier understanding.\nconst POPOVER_OFFSET_TOP = -13;\nconst POPOVER_OFFSET_LEFT = -18;\n\nconst DEFAULT_TEXTAREA_ROWS = 1;\n\nexport type EditableContentProps = {\n /**\n * Visibility flag used to control edit mode from outside.\n *\n * @default undefined\n */\n show?: boolean;\n\n /**\n * Callback function triggered when the save button is clicked.\n *\n * @param value\n * @returns\n */\n onSave?: (value: string) => void;\n\n /**\n * Callback function triggered when the cancel button is clicked.\n */\n onCancel?: VoidFunction;\n\n /**\n * Callback function triggered when the input gets focused.\n */\n onFocus?: VoidFunction;\n\n /**\n * Callback function triggered when input looses it's focus.\n */\n onBlur?: VoidFunction;\n\n /**\n * Callback function triggered when entering the edit mode.\n */\n onEditMode?: VoidFunction;\n\n /**\n * Validation function to intercept saving and prevent save on error.\n */\n onSaveValidation?: (value: string) => boolean;\n\n /**\n * Controls the error message visibility from outside. This is useful when using a custom input\n * where the validation happens outside of this component.\n * @default true\n */\n isValid?: boolean;\n\n /**\n * The error message that shall be shown to the user in case the validation fails.\n */\n errorMessage?: React.ReactNode;\n\n /**\n * Use this prop to define a custom editor input component like Select, NumberInput, TimePicker or DatePicker.\n * Handling input state changes of a custom editor need to be handled outside of this component.\n * By default the EditableContent uses a built-in textarea to allow resizing for larger text.\n */\n customEditor?: React.ReactNode;\n\n /**\n * Offset value to control the vertical position for the editor in case the text element has\n * borders, spacings different text sizes.\n *\n * @default 0\n */\n editorOffsetTop?: number;\n\n /**\n * Offset value to control the horizontal position for the editor in case the text element has\n * borders, spacings different text sizes.\n *\n * @default 0\n */\n editorOffsetLeft?: number;\n\n /**\n * Defines the input and button size. Use 'lg' for headlines.\n *\n * @default 'md'\n */\n size?: 'md' | 'lg';\n\n /**\n * Defines if the internal textarea is allowed to resize vertically.\n * This comes in handy for larger text and when using multiple input rows.\n *\n * @default false\n */\n allowResize?: boolean;\n\n /**\n * Defines the number of rows to use by the internal textarea component.\n * When a single line is used, the input is saved on \"enter\" key.\n *\n * @default 1\n */\n inputRows?: number;\n\n /**\n * Additional classes to be set on the editor input itself.\n */\n inputClassName?: string;\n\n /**\n * Additional classes to be set on the editor wrapper element.\n */\n editorClassName?: string;\n\n /**\n * Additional classes to be set on the text wrapper element.\n */\n className?: string;\n};\n\nconst EditableContent = (props: PropsWithChildren<EditableContentProps>) => {\n const {\n show = undefined,\n onSave = noop,\n onCancel = noop,\n onFocus = noop,\n onBlur = noop,\n onEditMode = noop,\n onSaveValidation = () => true,\n isValid = true,\n errorMessage,\n allowResize = false,\n inputRows = DEFAULT_TEXTAREA_ROWS,\n editorOffsetTop = 0,\n editorOffsetLeft = 0,\n customEditor,\n size = 'md',\n className = '',\n inputClassName = '',\n editorClassName = '',\n children,\n ...remainingProps\n } = props;\n\n const [isEditMode, setIsEditMode] = useState(show);\n const [inputValue, setInputValue] = useState('');\n const [hasError, setHasError] = useState(!isValid);\n\n const [referenceElement, setReferenceElement] = useState<HTMLSpanElement | null>(null);\n const [popperElement, setPopperElement] = useState<HTMLDivElement | null>(null);\n\n const hasCustomControl = !!customEditor;\n\n // Close edit mode on \"esc\"\n useEsc(() => handleCloseEditMode());\n\n // Trap focus on the popper element\n useFocusTrap(popperElement);\n\n // Input ref used to focus inside when entering edit mode\n const inputRef = useRef<HTMLTextAreaElement>(null);\n\n useEffect(() => {\n if (inputRef.current && isEditMode) {\n inputRef.current?.focus();\n inputRef.current?.select();\n }\n }, [isEditMode, inputRef.current]);\n\n const customModifier = useMemo(\n () => ({\n name: 'offset',\n options: {\n offset: ({ reference }: { reference: Rect }) => {\n const leftOffset = POPOVER_OFFSET_LEFT + editorOffsetLeft;\n const topOffset = -(reference.height - (POPOVER_OFFSET_TOP + editorOffsetTop));\n return [leftOffset, topOffset];\n },\n },\n }),\n []\n );\n\n const popperConfig: Options = {\n placement: 'bottom-start',\n modifiers: [customModifier],\n strategy: 'absolute',\n };\n\n const { styles, attributes } = usePopper<StrictModifiers>(referenceElement, popperElement, popperConfig);\n\n const handleEditMode = () => {\n // In a controlled usage, the \"show\" property is set from the outside\n // and the edit mode is handled there\n if (show === undefined) {\n enterEditMode();\n }\n onEditMode();\n };\n\n const enterEditMode = () => {\n setIsEditMode(true);\n setInputValue(referenceElement?.textContent?.trimEnd() ?? '');\n setHasError(false);\n };\n\n const handleInputChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n setInputValue(event.target.value);\n };\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n // Prevent line breaks when textarea is a single line\n if (event.key === 'Enter' && inputRows === DEFAULT_TEXTAREA_ROWS) {\n event.preventDefault();\n\n // Save on \"enter\" when textarea has a single line\n handleSaveChanges();\n }\n };\n\n const handleCloseEditMode = () => {\n setIsEditMode(false);\n onCancel();\n };\n\n const handleSaveChanges = () => {\n const isInputValid = onSaveValidation(inputValue);\n setHasError(!isInputValid);\n\n if (isInputValid) {\n setIsEditMode(false);\n onSave(inputValue.trimEnd());\n }\n };\n\n // Control edit mode from outside for instance if text element got focus\n // and user used \"Enter\" key to enter edit mode.\n const [previousShow, setPreviousShow] = useState(show);\n if (show !== previousShow) {\n if (show) {\n enterEditMode();\n }\n if (!show) {\n setIsEditMode(false);\n }\n setPreviousShow(show);\n }\n\n // Control error message visibility from outside. This is useful when using a custom input\n // where the validation happens outside of this component.\n const [previousIsValid, setPreviousIsValid] = useState(isValid);\n if (isValid !== previousIsValid) {\n setHasError(!isValid);\n setPreviousIsValid(isValid);\n }\n\n const textWrapperClasses = classNames(className, isEditMode && 'opacity-0');\n\n const overlayWrapperClasses = classNames(\n 'EditableContentEditor',\n 'display-flex gap-5',\n 'padding-5',\n 'rounded',\n 'shadow-accent',\n 'z-index-max',\n 'bg-white',\n editorClassName\n );\n\n const inputWrapperClasses = classNames(\n 'display-flex flex-column gap-5',\n 'margin-0',\n 'form-group',\n hasError && 'has-feedback has-error'\n );\n\n const inputClasses = classNames('form-control', size === 'lg' && 'input-lg', inputClassName);\n\n const inputStyle: CSSProperties = {\n minWidth: '100px',\n resize: allowResize ? 'vertical' : 'none',\n };\n\n return (\n <>\n <span ref={setReferenceElement} onClick={handleEditMode} className={textWrapperClasses}>\n {children}\n </span>\n {isEditMode &&\n createPortal(\n <div\n className={overlayWrapperClasses}\n onClick={event => event.stopPropagation()}\n ref={setPopperElement}\n style={styles.popper}\n {...attributes.popper}\n {...remainingProps}\n >\n <div className={inputWrapperClasses}>\n {hasCustomControl && customEditor}\n {!hasCustomControl && (\n <textarea\n ref={inputRef}\n className={inputClasses}\n value={inputValue}\n onChange={handleInputChange}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyDown={handleKeyDown}\n style={inputStyle}\n rows={inputRows}\n />\n )}\n {hasError && <div className='help-block position-relative'>{errorMessage}</div>}\n </div>\n <div className='display-flex gap-5'>\n <button\n type='button'\n onClick={handleCloseEditMode}\n className={`EditableContentCancel btn btn-default btn-icon-only btn-${size}`}\n aria-label='EditableContent cancel button'\n data-testid='EditableContentCancel'\n >\n <span className='rioglyph rioglyph-remove' />\n </button>\n <button\n type='button'\n onClick={handleSaveChanges}\n className={`EditableContentSave btn btn-primary btn-icon-only btn-${size}`}\n aria-label='EditableContent save button'\n data-testid='EditableContentSave'\n >\n <span className='rioglyph rioglyph-ok' />\n </button>\n </div>\n </div>,\n getOrCreatePortalRoot()\n )}\n </>\n );\n};\n\nexport default EditableContent;\n"],"names":["POPOVER_OFFSET_TOP","POPOVER_OFFSET_LEFT","DEFAULT_TEXTAREA_ROWS","EditableContent","props","show","onSave","noop","onCancel","onFocus","onBlur","onEditMode","onSaveValidation","isValid","errorMessage","allowResize","inputRows","editorOffsetTop","editorOffsetLeft","customEditor","size","className","inputClassName","editorClassName","children","remainingProps","isEditMode","setIsEditMode","useState","inputValue","setInputValue","hasError","setHasError","referenceElement","setReferenceElement","popperElement","setPopperElement","hasCustomControl","useEsc","handleCloseEditMode","useFocusTrap","inputRef","useRef","useEffect","popperConfig","useMemo","reference","leftOffset","topOffset","styles","attributes","usePopper","handleEditMode","enterEditMode","handleInputChange","event","handleKeyDown","handleSaveChanges","isInputValid","previousShow","setPreviousShow","previousIsValid","setPreviousIsValid","textWrapperClasses","classNames","overlayWrapperClasses","inputWrapperClasses","inputClasses","inputStyle","jsxs","Fragment","jsx","createPortal","getOrCreatePortalRoot"],"mappings":";;;;;;;;;AAuBA,MAAMA,KAAqB,KACrBC,KAAsB,KAEtBC,IAAwB,GAqHxBC,KAAkB,CAACC,MAAmD;AACxE,QAAM;AAAA,IACF,MAAAC,IAAO;AAAA,IACP,QAAAC,IAASC;AAAA,IACT,UAAAC,IAAWD;AAAA,IACX,SAAAE,IAAUF;AAAA,IACV,QAAAG,IAASH;AAAA,IACT,YAAAI,IAAaJ;AAAA,IACb,kBAAAK,IAAmB,MAAM;AAAA,IACzB,SAAAC,IAAU;AAAA,IACV,cAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,WAAAC,IAAYd;AAAA,IACZ,iBAAAe,IAAkB;AAAA,IAClB,kBAAAC,IAAmB;AAAA,IACnB,cAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,WAAAC,IAAY;AAA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,UAAA,gBAAAmD,EAAC,QAAA,EAAK,WAAU,uBAAA,CAAuB;AAAA,gBAAA;AAAA,cAAA;AAAA,YAC3C,EAAA,CACJ;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,MAEJE,GAAA;AAAA,IAAsB;AAAA,EAC1B,GACR;AAER;"}
@@ -0,0 +1,23 @@
1
+ import { HTMLAttributes } from 'react';
2
+ export type TextTruncateMiddleProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children'> & {
3
+ /**
4
+ * Full text value to render.
5
+ */
6
+ text: string;
7
+ /**
8
+ * Number of characters preserved at the end.
9
+ *
10
+ * @default 6
11
+ */
12
+ suffixLength?: number;
13
+ /**
14
+ * Additional classes for the first text segment (start).
15
+ */
16
+ startClassName?: string;
17
+ /**
18
+ * Additional classes for the second text segment (end).
19
+ */
20
+ endClassName?: string;
21
+ };
22
+ declare const TextTruncateMiddle: (props: TextTruncateMiddleProps) => import("react/jsx-runtime").JSX.Element;
23
+ export default TextTruncateMiddle;
@@ -0,0 +1,21 @@
1
+ import { jsxs as h, jsx as n } from "react/jsx-runtime";
2
+ import x from "../../utils/classNames.js";
3
+ const u = (e) => Number.isFinite(e) ? Math.max(0, Math.floor(e)) : 0, g = (e) => {
4
+ const {
5
+ text: s,
6
+ suffixLength: i = 6,
7
+ className: r = "",
8
+ startClassName: l = "",
9
+ endClassName: c = "",
10
+ title: m,
11
+ ...o
12
+ } = e, t = u(i), a = t > 0 && s.length > t, f = a ? s.slice(0, -t) : s, d = a ? s.slice(-t) : "";
13
+ return /* @__PURE__ */ h("span", { ...o, className: x("ellipsis-middle", r), title: m ?? s, children: [
14
+ /* @__PURE__ */ n("span", { className: l, children: f }),
15
+ /* @__PURE__ */ n("span", { className: c, children: d })
16
+ ] });
17
+ };
18
+ export {
19
+ g as default
20
+ };
21
+ //# sourceMappingURL=TextTruncateMiddle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextTruncateMiddle.js","sources":["../../../src/components/ellipsis/TextTruncateMiddle.tsx"],"sourcesContent":["import type { HTMLAttributes } from 'react';\n\nimport classNames from '../../utils/classNames';\n\nconst normalizeSuffixLength = (value: number) => {\n if (!Number.isFinite(value)) {\n return 0;\n }\n return Math.max(0, Math.floor(value));\n};\n\nexport type TextTruncateMiddleProps = Omit<HTMLAttributes<HTMLSpanElement>, 'children'> & {\n /**\n * Full text value to render.\n */\n text: string;\n\n /**\n * Number of characters preserved at the end.\n *\n * @default 6\n */\n suffixLength?: number;\n\n /**\n * Additional classes for the first text segment (start).\n */\n startClassName?: string;\n\n /**\n * Additional classes for the second text segment (end).\n */\n endClassName?: string;\n};\n\nconst TextTruncateMiddle = (props: TextTruncateMiddleProps) => {\n const {\n text,\n suffixLength = 6,\n className = '',\n startClassName = '',\n endClassName = '',\n title,\n ...remainingProps\n } = props;\n\n const safeSuffixLength = normalizeSuffixLength(suffixLength);\n const hasSuffix = safeSuffixLength > 0 && text.length > safeSuffixLength;\n const start = hasSuffix ? text.slice(0, -safeSuffixLength) : text;\n const end = hasSuffix ? text.slice(-safeSuffixLength) : '';\n\n return (\n <span {...remainingProps} className={classNames('ellipsis-middle', className)} title={title ?? text}>\n <span className={startClassName}>{start}</span>\n <span className={endClassName}>{end}</span>\n </span>\n );\n};\n\nexport default TextTruncateMiddle;\n"],"names":["normalizeSuffixLength","value","TextTruncateMiddle","props","text","suffixLength","className","startClassName","endClassName","title","remainingProps","safeSuffixLength","hasSuffix","start","end","jsxs","classNames","jsx"],"mappings":";;AAIA,MAAMA,IAAwB,CAACC,MACtB,OAAO,SAASA,CAAK,IAGnB,KAAK,IAAI,GAAG,KAAK,MAAMA,CAAK,CAAC,IAFzB,GA6BTC,IAAqB,CAACC,MAAmC;AAC3D,QAAM;AAAA,IACF,MAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,IACf,WAAAC,IAAY;AAAA,IACZ,gBAAAC,IAAiB;AAAA,IACjB,cAAAC,IAAe;AAAA,IACf,OAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACHP,GAEEQ,IAAmBX,EAAsBK,CAAY,GACrDO,IAAYD,IAAmB,KAAKP,EAAK,SAASO,GAClDE,IAAQD,IAAYR,EAAK,MAAM,GAAG,CAACO,CAAgB,IAAIP,GACvDU,IAAMF,IAAYR,EAAK,MAAM,CAACO,CAAgB,IAAI;AAExD,SACI,gBAAAI,EAAC,QAAA,EAAM,GAAGL,GAAgB,WAAWM,EAAW,mBAAmBV,CAAS,GAAG,OAAOG,KAASL,GAC3F,UAAA;AAAA,IAAA,gBAAAa,EAAC,QAAA,EAAK,WAAWV,GAAiB,UAAAM,GAAM;AAAA,IACxC,gBAAAI,EAAC,QAAA,EAAK,WAAWT,GAAe,UAAAM,EAAA,CAAI;AAAA,EAAA,GACxC;AAER;"}
@@ -46,17 +46,20 @@ export type ExpanderListProps = {
46
46
  items: ExpanderListItem[];
47
47
  /**
48
48
  * Defines whether the "expander-list-body" is rounded or not.
49
+ *
49
50
  * @default true
50
51
  */
51
52
  rounded?: boolean;
52
53
  /**
53
54
  * Defines whether the "expander-list-body" has a border or not.
55
+ *
54
56
  * @default true
55
57
  */
56
58
  bordered?: boolean;
57
59
  /**
58
60
  * It unmounts the body component (remove it from the DOM) when it is collapsed.
59
61
  * Set it to false to avoid the unmount.
62
+ *
60
63
  * @default true
61
64
  */
62
65
  unmountOnExit?: boolean;
@@ -1,9 +1,9 @@
1
1
  import { jsx as o, jsxs as h } from "react/jsx-runtime";
2
2
  import { useState as m } from "react";
3
3
  import { isEqual as g } from "es-toolkit/predicate";
4
- import d from "classnames";
4
+ import d from "../../utils/classNames.js";
5
5
  import f from "../collapse/Collapse.js";
6
- import { hasRoundedClass as I, hasBorderClass as v } from "../../utils/hasUtilityClass.js";
6
+ import { hasBorderClass as I, hasRoundedClass as v } from "../../utils/hasUtilityClass.js";
7
7
  const L = () => (Math.random() + 1).toString(36).toUpperCase().substring(2), u = (r) => r.map((s) => (s.id || (s.id = L()), s)), q = (r) => {
8
8
  const { items: s = [], unmountOnExit: n = !0, rounded: t = !0, bordered: N = !0, className: p = "" } = r, [c, i] = m(u(s)), [b, x] = m(s);
9
9
  g(b, s) || (i(u(s)), x(s));
@@ -14,15 +14,15 @@ const L = () => (Math.random() + 1).toString(36).toUpperCase().substring(2), u =
14
14
  i(l);
15
15
  }, y = d(
16
16
  "expander-list list-group",
17
- t && !I(p) && "rounded",
18
- N && !v(p) && "border",
17
+ t && !v(p) && "rounded",
18
+ N && !I(p) && "border",
19
19
  p
20
20
  );
21
21
  return /* @__PURE__ */ o("ul", { className: y, children: c.map((e) => {
22
22
  const l = e.open, a = d(
23
23
  "list-group-item",
24
24
  e.className && e.className,
25
- e.body && "expandable",
25
+ e.body ? "expandable" : "",
26
26
  l && "open"
27
27
  );
28
28
  return /* @__PURE__ */ h("li", { className: a, children: [
@@ -1 +1 @@
1
- {"version":3,"file":"ExpanderList.js","sources":["../../../src/components/expander/ExpanderList.tsx"],"sourcesContent":["import type React from 'react';\nimport { type PropsWithChildren, useState } from 'react';\nimport { isEqual } from 'es-toolkit/predicate';\n\nimport classNames from 'classnames';\n\nimport Collapse from '../collapse/Collapse';\nimport { hasBorderClass, hasRoundedClass } from '../../utils/hasUtilityClass';\n\nexport type ExpanderListItem = {\n /**\n * The \"id\" property is used to know which item is expanded. It will also be used to control\n * the component from the outside. It can be a number or a string. If there is no \"id\" provided,\n * a unique id is internally generated which will be used internally for the uncontrolled case.'\n */\n id?: string | number;\n\n /**\n * The header content.\n */\n header: string | React.ReactNode;\n\n /**\n * The body content. If there is no \"body\" provided, the list item is not expandable.\n */\n body?: string | React.ReactNode;\n\n /**\n * Defines if the item will be expanded or closed by default.\n */\n open?: boolean;\n\n /**\n * Callback fired when item toggles to open after a click.\n */\n onOpen?: VoidFunction;\n\n /**\n * Callback fired when item toggles to close after a click.\n */\n onClose?: VoidFunction;\n\n /**\n * Additional classes to be set on \"expander-list-header\" node.\n */\n headerClassName?: string;\n\n /**\n * Additional classes to be set on \"expander-list-body\" node.\n */\n bodyClassName?: string;\n\n /**\n * Additional classes to be set on list item node.\n */\n className?: string;\n};\n\nexport type ExpanderListProps = {\n /**\n * List of items to be rendered. The expanded state can be defined via the items `open` prop.\n */\n items: ExpanderListItem[];\n\n /**\n * Defines whether the \"expander-list-body\" is rounded or not.\n * @default true\n */\n rounded?: boolean;\n\n /**\n * Defines whether the \"expander-list-body\" has a border or not.\n * @default true\n */\n bordered?: boolean;\n\n /**\n * It unmounts the body component (remove it from the DOM) when it is collapsed.\n * Set it to false to avoid the unmount.\n * @default true\n */\n unmountOnExit?: boolean;\n\n /**\n * Additional classes to be set on the unordered list itself.\n */\n className?: string;\n};\n\nconst getRandomString = () => (Math.random() + 1).toString(36).toUpperCase().substring(2);\n\n// Generate a unique id (if not present) instead of using the index for the key as it will create\n// side effects when removing items from the list and re-render the ExpanderList.\nconst parseItems = (items: ExpanderListItem[]) => {\n return items.map(item => {\n if (!item.id) {\n item.id = getRandomString();\n }\n return item;\n });\n};\n\nconst ExpanderList = (props: ExpanderListProps) => {\n const { items = [], unmountOnExit = true, rounded = true, bordered = true, className = '' } = props;\n\n const [listItems, setListItems] = useState(parseItems(items));\n\n // Update internal state from external prop change\n const [previousItems, setPreviousItems] = useState(items);\n if (!isEqual(previousItems, items)) {\n setListItems(parseItems(items));\n setPreviousItems(items);\n }\n\n const handleToggleItem = (itemToExpand: ExpanderListItem) => {\n if (!itemToExpand.body) {\n return;\n }\n\n // Toggle the open state for the selected item based on the provided or generated id\n const updatedListItems = [...listItems].map(item => {\n if (item.id === itemToExpand.id) {\n item.onOpen && !item.open && item.onOpen();\n item.onClose && item.open && item.onClose();\n item.open = !item.open;\n }\n return item;\n });\n\n setListItems(updatedListItems);\n };\n\n const listClassNames = classNames(\n 'expander-list list-group',\n rounded && !hasRoundedClass(className) && 'rounded',\n bordered && !hasBorderClass(className) && 'border',\n className\n );\n\n return (\n <ul className={listClassNames}>\n {listItems.map(item => {\n const isOpen = item.open;\n\n const itemClassNames = classNames(\n 'list-group-item',\n item.className && item.className,\n item.body && 'expandable',\n isOpen && 'open'\n );\n\n return (\n <li className={itemClassNames} key={item.id}>\n <ExpanderListItemHeader item={item} onToggle={handleToggleItem} />\n {item.body && (\n <Collapse open={isOpen} unmountOnExit={unmountOnExit}>\n <div className='expander-list-body-wrapper'>\n <ExpanderListItemBody className={item.bodyClassName}>\n {item.body}\n </ExpanderListItemBody>\n </div>\n </Collapse>\n )}\n </li>\n );\n })}\n </ul>\n );\n};\n\ntype ExpanderListItemHeaderProps = {\n item: ExpanderListItem;\n onToggle: (item: ExpanderListItem) => void;\n};\n\nconst ExpanderListItemHeader = ({ item, onToggle }: ExpanderListItemHeaderProps) => {\n const headerClassNames = classNames('expander-list-header', item.headerClassName);\n const iconClassNames = classNames('expander-icon', 'rioglyph', 'rioglyph-chevron-down');\n\n return (\n <div className={headerClassNames} onClick={() => onToggle(item)} aria-label='expander item header'>\n <span className='expander-list-header-content'>{item.header}</span>\n {item.body && <span className={iconClassNames} />}\n </div>\n );\n};\n\ntype ExpanderListItemBodyProps = {\n className?: string;\n};\n\nconst ExpanderListItemBody = ({ className, children }: PropsWithChildren<ExpanderListItemBodyProps>) => {\n const bodyClassNames = classNames('expander-list-body', className);\n return (\n <div className={bodyClassNames} aria-label='expander item body'>\n {children}\n </div>\n );\n};\n\nexport default ExpanderList;\n"],"names":["getRandomString","parseItems","items","item","ExpanderList","props","unmountOnExit","rounded","bordered","className","listItems","setListItems","useState","previousItems","setPreviousItems","isEqual","handleToggleItem","itemToExpand","updatedListItems","listClassNames","classNames","hasRoundedClass","hasBorderClass","isOpen","itemClassNames","jsxs","jsx","ExpanderListItemHeader","Collapse","ExpanderListItemBody","onToggle","headerClassNames","iconClassNames","children","bodyClassNames"],"mappings":";;;;;;AAyFA,MAAMA,IAAkB,OAAO,KAAK,OAAA,IAAW,GAAG,SAAS,EAAE,EAAE,cAAc,UAAU,CAAC,GAIlFC,IAAa,CAACC,MACTA,EAAM,IAAI,CAAAC,OACRA,EAAK,OACNA,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AAAuB,EAACE,KAAS,MAAML,GAAQ,eAAAjB,GACpB,UAAA,gBAAAoB,EAAC,OAAA,EAAI,WAAU,8BACX,UAAA,gBAAAA,EAACG,KAAqB,WAAW1B,EAAK,eACjC,UAAAA,EAAK,KAAA,CACV,GACJ,EAAA,CACJ;AAAA,IAAA,EAAA,GAT4BA,EAAK,EAWzC;AAAA,EAER,CAAC,EAAA,CACL;AAER,GAOMwB,IAAyB,CAAC,EAAE,MAAAxB,GAAM,UAAA2B,QAA4C;AAChF,QAAMC,IAAmBX,EAAW,wBAAwBjB,EAAK,eAAe,GAC1E6B,IAAiBZ,EAAW,iBAAiB,YAAY,uBAAuB;AAEtF,SACI,gBAAAK,EAAC,OAAA,EAAI,WAAWM,GAAkB,SAAS,MAAMD,EAAS3B,CAAI,GAAG,cAAW,wBACxE,UAAA;AAAA,IAAA,gBAAAuB,EAAC,QAAA,EAAK,WAAU,gCAAgC,UAAAvB,EAAK,QAAO;AAAA,IAC3DA,EAAK,QAAQ,gBAAAuB,EAAC,QAAA,EAAK,WAAWM,EAAA,CAAgB;AAAA,EAAA,GACnD;AAER,GAMMH,IAAuB,CAAC,EAAE,WAAApB,GAAW,UAAAwB,QAA6D;AACpG,QAAMC,IAAiBd,EAAW,sBAAsBX,CAAS;AACjE,2BACK,OAAA,EAAI,WAAWyB,GAAgB,cAAW,sBACtC,UAAAD,GACL;AAER;"}
1
+ {"version":3,"file":"ExpanderList.js","sources":["../../../src/components/expander/ExpanderList.tsx"],"sourcesContent":["import type React from 'react';\nimport { type PropsWithChildren, useState } from 'react';\nimport { isEqual } from 'es-toolkit/predicate';\n\nimport classNames from '../../utils/classNames';\nimport Collapse from '../collapse/Collapse';\nimport { hasBorderClass, hasRoundedClass } from '../../utils/hasUtilityClass';\n\nexport type ExpanderListItem = {\n /**\n * The \"id\" property is used to know which item is expanded. It will also be used to control\n * the component from the outside. It can be a number or a string. If there is no \"id\" provided,\n * a unique id is internally generated which will be used internally for the uncontrolled case.'\n */\n id?: string | number;\n\n /**\n * The header content.\n */\n header: string | React.ReactNode;\n\n /**\n * The body content. If there is no \"body\" provided, the list item is not expandable.\n */\n body?: string | React.ReactNode;\n\n /**\n * Defines if the item will be expanded or closed by default.\n */\n open?: boolean;\n\n /**\n * Callback fired when item toggles to open after a click.\n */\n onOpen?: VoidFunction;\n\n /**\n * Callback fired when item toggles to close after a click.\n */\n onClose?: VoidFunction;\n\n /**\n * Additional classes to be set on \"expander-list-header\" node.\n */\n headerClassName?: string;\n\n /**\n * Additional classes to be set on \"expander-list-body\" node.\n */\n bodyClassName?: string;\n\n /**\n * Additional classes to be set on list item node.\n */\n className?: string;\n};\n\nexport type ExpanderListProps = {\n /**\n * List of items to be rendered. The expanded state can be defined via the items `open` prop.\n */\n items: ExpanderListItem[];\n\n /**\n * Defines whether the \"expander-list-body\" is rounded or not.\n *\n * @default true\n */\n rounded?: boolean;\n\n /**\n * Defines whether the \"expander-list-body\" has a border or not.\n *\n * @default true\n */\n bordered?: boolean;\n\n /**\n * It unmounts the body component (remove it from the DOM) when it is collapsed.\n * Set it to false to avoid the unmount.\n *\n * @default true\n */\n unmountOnExit?: boolean;\n\n /**\n * Additional classes to be set on the unordered list itself.\n */\n className?: string;\n};\n\nconst getRandomString = () => (Math.random() + 1).toString(36).toUpperCase().substring(2);\n\n// Generate a unique id (if not present) instead of using the index for the key as it will create\n// side effects when removing items from the list and re-render the ExpanderList.\nconst parseItems = (items: ExpanderListItem[]) => {\n return items.map(item => {\n if (!item.id) {\n item.id = getRandomString();\n }\n return item;\n });\n};\n\nconst ExpanderList = (props: ExpanderListProps) => {\n const { items = [], unmountOnExit = true, rounded = true, bordered = true, className = '' } = props;\n\n const [listItems, setListItems] = useState(parseItems(items));\n\n // Update internal state from external prop change\n const [previousItems, setPreviousItems] = useState(items);\n if (!isEqual(previousItems, items)) {\n setListItems(parseItems(items));\n setPreviousItems(items);\n }\n\n const handleToggleItem = (itemToExpand: ExpanderListItem) => {\n if (!itemToExpand.body) {\n return;\n }\n\n // Toggle the open state for the selected item based on the provided or generated id\n const updatedListItems = [...listItems].map(item => {\n if (item.id === itemToExpand.id) {\n item.onOpen && !item.open && item.onOpen();\n item.onClose && item.open && item.onClose();\n item.open = !item.open;\n }\n return item;\n });\n\n setListItems(updatedListItems);\n };\n\n const listClassNames = classNames(\n 'expander-list list-group',\n rounded && !hasRoundedClass(className) && 'rounded',\n bordered && !hasBorderClass(className) && 'border',\n className\n );\n\n return (\n <ul className={listClassNames}>\n {listItems.map(item => {\n const isOpen = item.open;\n\n const itemClassNames = classNames(\n 'list-group-item',\n item.className && item.className,\n item.body ? 'expandable' : '',\n isOpen && 'open'\n );\n\n return (\n <li className={itemClassNames} key={item.id}>\n <ExpanderListItemHeader item={item} onToggle={handleToggleItem} />\n {item.body && (\n <Collapse open={isOpen} unmountOnExit={unmountOnExit}>\n <div className='expander-list-body-wrapper'>\n <ExpanderListItemBody className={item.bodyClassName}>\n {item.body}\n </ExpanderListItemBody>\n </div>\n </Collapse>\n )}\n </li>\n );\n })}\n </ul>\n );\n};\n\ntype ExpanderListItemHeaderProps = {\n item: ExpanderListItem;\n onToggle: (item: ExpanderListItem) => void;\n};\n\nconst ExpanderListItemHeader = ({ item, onToggle }: ExpanderListItemHeaderProps) => {\n const headerClassNames = classNames('expander-list-header', item.headerClassName);\n const iconClassNames = classNames('expander-icon', 'rioglyph', 'rioglyph-chevron-down');\n\n return (\n <div className={headerClassNames} onClick={() => onToggle(item)} aria-label='expander item header'>\n <span className='expander-list-header-content'>{item.header}</span>\n {item.body && <span className={iconClassNames} />}\n </div>\n );\n};\n\ntype ExpanderListItemBodyProps = {\n className?: string;\n};\n\nconst ExpanderListItemBody = ({ className, children }: PropsWithChildren<ExpanderListItemBodyProps>) => {\n const bodyClassNames = classNames('expander-list-body', className);\n return (\n <div className={bodyClassNames} aria-label='expander item body'>\n {children}\n </div>\n );\n};\n\nexport default ExpanderList;\n"],"names":["getRandomString","parseItems","items","item","ExpanderList","props","unmountOnExit","rounded","bordered","className","listItems","setListItems","useState","previousItems","setPreviousItems","isEqual","handleToggleItem","itemToExpand","updatedListItems","listClassNames","classNames","hasRoundedClass","hasBorderClass","isOpen","itemClassNames","jsxs","jsx","ExpanderListItemHeader","Collapse","ExpanderListItemBody","onToggle","headerClassNames","iconClassNames","children","bodyClassNames"],"mappings":";;;;;;AA2FA,MAAMA,IAAkB,OAAO,KAAK,OAAA,IAAW,GAAG,SAAS,EAAE,EAAE,cAAc,UAAU,CAAC,GAIlFC,IAAa,CAACC,MACTA,EAAM,IAAI,CAAAC,OACRA,EAAK,OACNA,EAAK,KAAKH,EAAA,IAEPG,EACV,GAGCC,IAAe,CAACC,MAA6B;AAC/C,QAAM,EAAE,OAAAH,IAAQ,IAAI,eAAAI,IAAgB,IAAM,SAAAC,IAAU,IAAM,UAAAC,IAAW,IAAM,WAAAC,IAAY,GAAA,IAAOJ,GAExF,CAACK,GAAWC,CAAY,IAAIC,EAASX,EAAWC,CAAK,CAAC,GAGtD,CAACW,GAAeC,CAAgB,IAAIF,EAASV,CAAK;AACxD,EAAKa,EAAQF,GAAeX,CAAK,MAC7BS,EAAaV,EAAWC,CAAK,CAAC,GAC9BY,EAAiBZ,CAAK;AAG1B,QAAMc,IAAmB,CAACC,MAAmC;AACzD,QAAI,CAACA,EAAa;AACd;AAIJ,UAAMC,IAAmB,CAAC,GAAGR,CAAS,EAAE,IAAI,CAAAP,OACpCA,EAAK,OAAOc,EAAa,OACzBd,EAAK,UAAU,CAACA,EAAK,QAAQA,EAAK,OAAA,GAClCA,EAAK,WAAWA,EAAK,QAAQA,EAAK,QAAA,GAClCA,EAAK,OAAO,CAACA,EAAK,OAEfA,EACV;AAED,IAAAQ,EAAaO,CAAgB;AAAA,EACjC,GAEMC,IAAiBC;AAAA,IACnB;AAAA,IACAb,KAAW,CAACc,EAAgBZ,CAAS,KAAK;AAAA,IAC1CD,KAAY,CAACc,EAAeb,CAAS,KAAK;AAAA,IAC1CA;AAAA,EAAA;AAGJ,2BAC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"}
@@ -1,5 +1,5 @@
1
- import { default as React, PropsWithChildren } from 'react';
2
- type ChildrenType = React.ReactNode | ((isOpen: boolean) => string | React.ReactNode | JSX.Element);
1
+ import { default as React } from 'react';
2
+ type ChildrenType = React.ReactNode | ((isOpen: boolean) => React.ReactNode | JSX.Element);
3
3
  export type ExpanderPanelProps = {
4
4
  /**
5
5
  * The title to be shown in the expander header.
@@ -7,27 +7,33 @@ export type ExpanderPanelProps = {
7
7
  title: string | React.ReactNode;
8
8
  /**
9
9
  * Component visual or contextual style variants.
10
+ *
11
+ * @default 'blank'
10
12
  */
11
13
  bsStyle?: 'blank' | 'default' | 'separator' | 'primary' | 'secondary' | 'info' | 'warning' | 'danger' | 'success';
12
14
  /**
13
15
  * Defines if the icon will be align left, otherwise it is aligned right.
16
+ *
14
17
  * @default false
15
18
  */
16
19
  iconLeft?: boolean;
17
20
  /**
18
21
  * Defines if the panel will be opened or closed by default.
19
22
  * The open/closed state will be handled internally.
23
+ *
20
24
  * @default false
21
25
  */
22
26
  open?: boolean;
23
27
  /**
24
28
  * It unmounts the body component (remove it from the DOM) when it is collapsed.
25
29
  * Set it to false to avoid the unmount.
30
+ *
26
31
  * @default true
27
32
  */
28
33
  unmountOnExit?: boolean;
29
34
  /**
30
35
  * Callback function for when the header is clicked and the expander toggles.
36
+ *
31
37
  * @param isOpen
32
38
  * @returns
33
39
  */
@@ -66,10 +72,14 @@ export type ExpanderPanelProps = {
66
72
  className?: string;
67
73
  /**
68
74
  * Any element to be rendered inside the panel body.
69
- * Providing a function enables the render prop approach. The function gets the
75
+ * Providing a function enables the render prop approach.
76
+ *
77
+ * See {@link https://reactjs.org/docs/render-props.html}
78
+ *
79
+ * The function gets the
70
80
  * `isOpen` state passed and is responsible for rendering the custom content.
71
81
  */
72
82
  children?: ChildrenType;
73
83
  };
74
- declare const ExpanderPanel: (props: PropsWithChildren<ExpanderPanelProps>) => import("react/jsx-runtime").JSX.Element;
84
+ declare const ExpanderPanel: (props: ExpanderPanelProps) => import("react/jsx-runtime").JSX.Element;
75
85
  export default ExpanderPanel;
@@ -1,7 +1,7 @@
1
1
  import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
2
  import { useState as h } from "react";
3
- import n from "classnames";
4
3
  import { noop as o } from "es-toolkit/function";
4
+ import n from "../../utils/classNames.js";
5
5
  import I from "../collapse/Collapse.js";
6
6
  const F = (N) => {
7
7
  const {
@@ -1 +1 @@
1
- {"version":3,"file":"ExpanderPanel.js","sources":["../../../src/components/expander/ExpanderPanel.tsx"],"sourcesContent":["import React, { useState, type PropsWithChildren } from 'react';\nimport classNames from 'classnames';\nimport { noop } from 'es-toolkit/function';\n\nimport Collapse from '../collapse/Collapse';\n\ntype ChildrenType = React.ReactNode | ((isOpen: boolean) => string | React.ReactNode | JSX.Element);\n\nexport type ExpanderPanelProps = {\n /**\n * The title to be shown in the expander header.\n */\n title: string | React.ReactNode;\n\n /**\n * Component visual or contextual style variants.\n */\n bsStyle?: 'blank' | 'default' | 'separator' | 'primary' | 'secondary' | 'info' | 'warning' | 'danger' | 'success';\n\n /**\n * Defines if the icon will be align left, otherwise it is aligned right.\n * @default false\n */\n iconLeft?: boolean;\n\n /**\n * Defines if the panel will be opened or closed by default.\n * The open/closed state will be handled internally.\n * @default false\n */\n open?: boolean;\n\n /**\n * It unmounts the body component (remove it from the DOM) when it is collapsed.\n * Set it to false to avoid the unmount.\n * @default true\n */\n unmountOnExit?: boolean;\n\n /**\n * Callback function for when the header is clicked and the expander toggles.\n * @param isOpen\n * @returns\n */\n onToggle?: (isOpen: boolean) => void;\n\n /**\n * Callback fired after the component has expanded.\n */\n onEntered?: VoidFunction;\n\n /**\n * Callback fired after the component has collapsed.\n */\n onExited?: VoidFunction;\n\n /**\n * Callback fired when the animation starts for either expand or collapse.\n */\n onAnimationStart?: VoidFunction;\n\n /**\n * Additional classes to be set on the panel header.\n */\n headerClassName?: string;\n\n /**\n * Additional classes to be set on the header title.\n */\n titleClassName?: string;\n\n /**\n * Additional classes to be set on the panel body.\n */\n bodyClassName?: string;\n\n /**\n * Additional classes added to the chevron icon\n */\n iconClassName?: string;\n\n /**\n * Additional classes to be set on the wrapper element.\n */\n className?: string;\n\n /**\n * Any element to be rendered inside the panel body.\n * Providing a function enables the render prop approach. The function gets the\n * `isOpen` state passed and is responsible for rendering the custom content.\n */\n children?: ChildrenType;\n};\n\nconst ExpanderPanel = (props: PropsWithChildren<ExpanderPanelProps>) => {\n const {\n open = false,\n iconLeft = false,\n bsStyle = 'blank',\n title,\n headerClassName,\n titleClassName,\n bodyClassName,\n iconClassName,\n unmountOnExit = true,\n onEntered = noop,\n onExited = noop,\n onAnimationStart = noop,\n onToggle = noop,\n className,\n children,\n ...remainingProps\n } = props;\n\n const [isOpen, setIsOpen] = useState(open);\n\n // Update internal state from external prop change\n const [previousOpen, setPreviousOpen] = useState(open);\n if (previousOpen !== open) {\n setIsOpen(open);\n setPreviousOpen(open);\n }\n\n const handleToggle = () => {\n const newState = !isOpen;\n setIsOpen(newState);\n onToggle(newState);\n };\n\n const wrapperClassNames = classNames('expander-panel panel', `panel-${bsStyle}`, className);\n\n const iconClassNames = classNames('expander-icon', iconClassName, 'rioglyph', 'rioglyph-chevron-down');\n\n const headerClassNames = classNames(\n 'panel-heading',\n isOpen && 'open',\n iconLeft && 'icon-left',\n headerClassName && headerClassName\n );\n\n const titleClassNames = classNames('title', titleClassName && titleClassName);\n\n const bodyClassNames = classNames('panel-body', bodyClassName && bodyClassName);\n\n const isRenderCallback = children && typeof children === 'function';\n\n return (\n <div {...remainingProps} className={wrapperClassNames} aria-label='expander panel'>\n <div className={headerClassNames} onClick={handleToggle} aria-label='panel heading'>\n <span className={titleClassNames}>{title}</span>\n <span className={iconClassNames} />\n {bsStyle === 'separator' && (\n <div className='separator'>\n <hr />\n </div>\n )}\n </div>\n <Collapse\n open={isOpen}\n unmountOnExit={unmountOnExit}\n onEntered={onEntered}\n onExited={onExited}\n onAnimationStart={() => onAnimationStart()}\n >\n <div>\n <div className={bodyClassNames}>{isRenderCallback ? children(isOpen) : children}</div>\n </div>\n </Collapse>\n </div>\n );\n};\n\nexport default ExpanderPanel;\n"],"names":["ExpanderPanel","props","open","iconLeft","bsStyle","title","headerClassName","titleClassName","bodyClassName","iconClassName","unmountOnExit","onEntered","noop","onExited","onAnimationStart","onToggle","className","children","remainingProps","isOpen","setIsOpen","useState","previousOpen","setPreviousOpen","handleToggle","newState","wrapperClassNames","classNames","iconClassNames","headerClassNames","titleClassNames","bodyClassNames","jsxs","jsx","Collapse"],"mappings":";;;;;AA8FA,MAAMA,IAAgB,CAACC,MAAiD;AACpE,QAAM;AAAA,IACF,MAAAC,IAAO;AAAA,IACP,UAAAC,IAAW;AAAA,IACX,SAAAC,IAAU;AAAA,IACV,OAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,eAAAC;AAAA,IACA,eAAAC,IAAgB;AAAA,IAChB,WAAAC,IAAYC;AAAA,IACZ,UAAAC,IAAWD;AAAA,IACX,kBAAAE,IAAmBF;AAAA,IACnB,UAAAG,IAAWH;AAAA,IACX,WAAAI;AAAA,IACA,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACHjB,GAEE,CAACkB,GAAQC,CAAS,IAAIC,EAASnB,CAAI,GAGnC,CAACoB,GAAcC,CAAe,IAAIF,EAASnB,CAAI;AACrD,EAAIoB,MAAiBpB,MACjBkB,EAAUlB,CAAI,GACdqB,EAAgBrB,CAAI;AAGxB,QAAMsB,IAAe,MAAM;AACvB,UAAMC,IAAW,CAACN;AAClB,IAAAC,EAAUK,CAAQ,GAClBV,EAASU,CAAQ;AAAA,EACrB,GAEMC,IAAoBC,EAAW,wBAAwB,SAASvB,CAAO,IAAIY,CAAS,GAEpFY,IAAiBD,EAAW,iBAAiBlB,GAAe,YAAY,uBAAuB,GAE/FoB,IAAmBF;AAAA,IACrB;AAAA,IACAR,KAAU;AAAA,IACVhB,KAAY;AAAA,IACZG,KAAmBA;AAAA,EAAA,GAGjBwB,IAAkBH,EAAW,SAASpB,KAAkBA,CAAc,GAEtEwB,IAAiBJ,EAAW,cAAcnB,KAAiBA,CAAa;AAI9E,2BACK,OAAA,EAAK,GAAGU,GAAgB,WAAWQ,GAAmB,cAAW,kBAC9D,UAAA;AAAA,IAAA,gBAAAM,EAAC,SAAI,WAAWH,GAAkB,SAASL,GAAc,cAAW,iBAChE,UAAA;AAAA,MAAA,gBAAAS,EAAC,QAAA,EAAK,WAAWH,GAAkB,UAAAzB,GAAM;AAAA,MACzC,gBAAA4B,EAAC,QAAA,EAAK,WAAWL,EAAA,CAAgB;AAAA,MAChCxB,MAAY,eACT,gBAAA6B,EAAC,OAAA,EAAI,WAAU,aACX,UAAA,gBAAAA,EAAC,QAAG,EAAA,CACR;AAAA,IAAA,GAER;AAAA,IACA,gBAAAA;AAAA,MAACC;AAAA,MAAA;AAAA,QACG,MAAMf;AAAA,QACN,eAAAT;AAAA,QACA,WAAAC;AAAA,QACA,UAAAE;AAAA,QACA,kBAAkB,MAAMC,EAAA;AAAA,QAExB,UAAA,gBAAAmB,EAAC,OAAA,EACG,UAAA,gBAAAA,EAAC,OAAA,EAAI,WAAWF,GAAiB,UArBxBd,KAAY,OAAOA,KAAa,aAqBWA,EAASE,CAAM,IAAIF,EAAA,CAAS,EAAA,CACpF;AAAA,MAAA;AAAA,IAAA;AAAA,EACJ,GACJ;AAER;"}
1
+ {"version":3,"file":"ExpanderPanel.js","sources":["../../../src/components/expander/ExpanderPanel.tsx"],"sourcesContent":["import type React from 'react';\nimport { useState } from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport classNames from '../../utils/classNames';\nimport Collapse from '../collapse/Collapse';\n\ntype ChildrenType = React.ReactNode | ((isOpen: boolean) => React.ReactNode | JSX.Element);\n\nexport type ExpanderPanelProps = {\n /**\n * The title to be shown in the expander header.\n */\n title: string | React.ReactNode;\n\n /**\n * Component visual or contextual style variants.\n *\n * @default 'blank'\n */\n bsStyle?: 'blank' | 'default' | 'separator' | 'primary' | 'secondary' | 'info' | 'warning' | 'danger' | 'success';\n\n /**\n * Defines if the icon will be align left, otherwise it is aligned right.\n *\n * @default false\n */\n iconLeft?: boolean;\n\n /**\n * Defines if the panel will be opened or closed by default.\n * The open/closed state will be handled internally.\n *\n * @default false\n */\n open?: boolean;\n\n /**\n * It unmounts the body component (remove it from the DOM) when it is collapsed.\n * Set it to false to avoid the unmount.\n *\n * @default true\n */\n unmountOnExit?: boolean;\n\n /**\n * Callback function for when the header is clicked and the expander toggles.\n *\n * @param isOpen\n * @returns\n */\n onToggle?: (isOpen: boolean) => void;\n\n /**\n * Callback fired after the component has expanded.\n */\n onEntered?: VoidFunction;\n\n /**\n * Callback fired after the component has collapsed.\n */\n onExited?: VoidFunction;\n\n /**\n * Callback fired when the animation starts for either expand or collapse.\n */\n onAnimationStart?: VoidFunction;\n\n /**\n * Additional classes to be set on the panel header.\n */\n headerClassName?: string;\n\n /**\n * Additional classes to be set on the header title.\n */\n titleClassName?: string;\n\n /**\n * Additional classes to be set on the panel body.\n */\n bodyClassName?: string;\n\n /**\n * Additional classes added to the chevron icon\n */\n iconClassName?: string;\n\n /**\n * Additional classes to be set on the wrapper element.\n */\n className?: string;\n\n /**\n * Any element to be rendered inside the panel body.\n * Providing a function enables the render prop approach.\n *\n * See {@link https://reactjs.org/docs/render-props.html}\n *\n * The function gets the\n * `isOpen` state passed and is responsible for rendering the custom content.\n */\n children?: ChildrenType;\n};\n\nconst ExpanderPanel = (props: ExpanderPanelProps) => {\n const {\n open = false,\n iconLeft = false,\n bsStyle = 'blank',\n title,\n headerClassName,\n titleClassName,\n bodyClassName,\n iconClassName,\n unmountOnExit = true,\n onEntered = noop,\n onExited = noop,\n onAnimationStart = noop,\n onToggle = noop,\n className,\n children,\n ...remainingProps\n } = props;\n\n const [isOpen, setIsOpen] = useState(open);\n\n // Update internal state from external prop change\n const [previousOpen, setPreviousOpen] = useState(open);\n if (previousOpen !== open) {\n setIsOpen(open);\n setPreviousOpen(open);\n }\n\n const handleToggle = () => {\n const newState = !isOpen;\n setIsOpen(newState);\n onToggle(newState);\n };\n\n const wrapperClassNames = classNames('expander-panel panel', `panel-${bsStyle}`, className);\n\n const iconClassNames = classNames('expander-icon', iconClassName, 'rioglyph', 'rioglyph-chevron-down');\n\n const headerClassNames = classNames(\n 'panel-heading',\n isOpen && 'open',\n iconLeft && 'icon-left',\n headerClassName && headerClassName\n );\n\n const titleClassNames = classNames('title', titleClassName && titleClassName);\n\n const bodyClassNames = classNames('panel-body', bodyClassName && bodyClassName);\n\n const isRenderCallback = children && typeof children === 'function';\n\n return (\n <div {...remainingProps} className={wrapperClassNames} aria-label='expander panel'>\n <div className={headerClassNames} onClick={handleToggle} aria-label='panel heading'>\n <span className={titleClassNames}>{title}</span>\n <span className={iconClassNames} />\n {bsStyle === 'separator' && (\n <div className='separator'>\n <hr />\n </div>\n )}\n </div>\n <Collapse\n open={isOpen}\n unmountOnExit={unmountOnExit}\n onEntered={onEntered}\n onExited={onExited}\n onAnimationStart={() => onAnimationStart()}\n >\n <div>\n <div className={bodyClassNames}>{isRenderCallback ? children(isOpen) : children}</div>\n </div>\n </Collapse>\n </div>\n );\n};\n\nexport default ExpanderPanel;\n"],"names":["ExpanderPanel","props","open","iconLeft","bsStyle","title","headerClassName","titleClassName","bodyClassName","iconClassName","unmountOnExit","onEntered","noop","onExited","onAnimationStart","onToggle","className","children","remainingProps","isOpen","setIsOpen","useState","previousOpen","setPreviousOpen","handleToggle","newState","wrapperClassNames","classNames","iconClassNames","headerClassNames","titleClassNames","bodyClassNames","jsxs","jsx","Collapse"],"mappings":";;;;;AAyGA,MAAMA,IAAgB,CAACC,MAA8B;AACjD,QAAM;AAAA,IACF,MAAAC,IAAO;AAAA,IACP,UAAAC,IAAW;AAAA,IACX,SAAAC,IAAU;AAAA,IACV,OAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,eAAAC;AAAA,IACA,eAAAC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AAAA,QACN,eAAAT;AAAA,QACA,WAAAC;AAAA,QACA,UAAAE;AAAA,QACA,kBAAkB,MAAMC,EAAA;AAAA,QAExB,UAAA,gBAAAmB,EAAC,OAAA,EACG,UAAA,gBAAAA,EAAC,OAAA,EAAI,WAAWF,GAAiB,UArBxBd,KAAY,OAAOA,KAAa,aAqBWA,EAASE,CAAM,IAAIF,EAAA,CAAS,EAAA,CACpF;AAAA,MAAA;AAAA,IAAA;AAAA,EACJ,GACJ;AAER;"}
@@ -46,7 +46,7 @@ export type FadeProps = {
46
46
  /**
47
47
  * Fires when all exiting nodes have completed animating out.
48
48
  *
49
- * @default noop
49
+ * @default () => {}
50
50
  */
51
51
  onExitComplete?: VoidFunction;
52
52
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"Fade.js","sources":["../../../src/components/fade/Fade.tsx"],"sourcesContent":["import { type PropsWithChildren, useState } from 'react';\nimport { AnimatePresence, motion } from 'motion/react';\nimport { noop } from 'es-toolkit/compat';\n\nimport useAfterMount from '../../useAfterMount';\n\ntype AnimationValue = { x: number; y: number; opacity: number };\n\ntype AnimationProp = {\n initial: 'pageEnter' | AnimationValue | false;\n animate: 'pageCenter' | AnimationValue;\n exit: 'pageExit' | AnimationValue;\n};\n\nexport type FadeAnimationStyle =\n | 'fade'\n | 'tabs'\n | 'page'\n | 'pageBack'\n | 'fromLeft'\n | 'fromRight'\n | 'fromTop'\n | 'fromBottom';\n\nconst animationPropsForStyle: Record<FadeAnimationStyle, AnimationProp> = {\n fromLeft: {\n initial: { x: -10, y: 0, opacity: 0 },\n animate: { x: 0, y: 0, opacity: 1 },\n exit: { x: -10, y: 0, opacity: 0 },\n },\n fromRight: {\n initial: { x: 10, y: 0, opacity: 0 },\n animate: { x: 0, y: 0, opacity: 1 },\n exit: { x: 10, y: 0, opacity: 0 },\n },\n fromTop: {\n initial: { y: -10, x: 0, opacity: 0 },\n animate: { y: 0, x: 0, opacity: 1 },\n exit: { y: -10, x: 0, opacity: 0 },\n },\n fromBottom: {\n initial: { y: 10, x: 0, opacity: 0 },\n animate: { y: 0, x: 0, opacity: 1 },\n exit: { y: 10, x: 0, opacity: 0 },\n },\n fade: {\n initial: { x: 0, y: 0, opacity: 0 },\n animate: { x: 0, y: 0, opacity: 1 },\n exit: { x: 0, y: 0, opacity: 0 },\n },\n tabs: {\n initial: { x: 2, y: 0, opacity: 0 },\n animate: { x: 0, y: 0, opacity: 1 },\n exit: { x: -2, y: 0, opacity: 0 },\n },\n page: {\n initial: 'pageEnter',\n animate: 'pageCenter',\n exit: 'pageExit',\n },\n pageBack: {\n initial: 'pageEnter',\n animate: 'pageCenter',\n exit: 'pageExit',\n },\n} as const;\n\ntype PageDirection = -1 | 1;\n\nconst getPageDirection = (animationStyle: FadeAnimationStyle): PageDirection =>\n animationStyle === 'pageBack' ? -1 : 1;\n\nconst pageTransitionVariants = {\n pageEnter: (pageDirection: PageDirection) => ({ x: `${pageDirection * 60}%`, opacity: 0 }),\n pageCenter: { x: 0, opacity: 1 },\n pageExit: (pageDirection: PageDirection) => ({ zIndex: 0, x: `${-pageDirection * 60}%`, opacity: 0 }),\n};\n\nexport type FadeProps = {\n /**\n * Defines whether to show the content.\n *\n * @default true\n */\n show?: boolean;\n\n /**\n * Duration of the fade animation in seconds.\n *\n * @default 0.2\n */\n duration?: number;\n\n /**\n * Defines whether the animation is triggered initially when showing the content.\n *\n * @default false\n */\n initial?: boolean;\n\n /**\n * Defines the desired animation style.\n *\n * Possible values are:\n * - `fade`\n * - `tabs`\n * - `page`\n * - `pageBack`\n * - `fromLeft`\n * - `fromRight`\n * - `fromTop`\n * - `fromBottom`\n *\n * @default 'fade'\n */\n animationStyle?: FadeAnimationStyle;\n\n /**\n * If set to true, only one component will be rendered at a time.\n *\n * The exiting component will finish its exit animation before the entering component is rendered.\n *\n * @default false\n */\n exitBeforeEnter?: boolean;\n\n /**\n * Fires when all exiting nodes have completed animating out.\n *\n * @default noop\n */\n onExitComplete?: VoidFunction;\n\n /**\n * Additional custom props for the underlying Framer motion AnimatePresence component.\n *\n * Use this for additional customizations.\n */\n animatePresenceProps?: object;\n\n /**\n * Additional custom props for the underlying Framer motion &lt;motion.div&gt; component.\n *\n * Use this for additional customizations.\n */\n motionProps?: object;\n};\n\nconst Fade = (props: PropsWithChildren<FadeProps>) => {\n const {\n show = true,\n initial = false,\n duration = 0.2,\n exitBeforeEnter = false,\n animationStyle = 'fade',\n animatePresenceProps,\n motionProps,\n onExitComplete = noop,\n children,\n } = props;\n\n const [allowInitialAnimation, setAllowInitialAnimation] = useState(initial);\n\n useAfterMount(() => {\n if (!allowInitialAnimation) {\n setAllowInitialAnimation(true);\n }\n });\n\n let motionDivKey = 'fade';\n\n // If there are multiple children that are conditionally rendered like\n // in case of a tabbed content - get the current visible child key\n // to update the motion.div key to animate different children\n if (Array.isArray(children)) {\n const [currentChild] = children.filter(Boolean);\n motionDivKey = `fade-${currentChild.key}`;\n }\n\n // In case the animation is a page transition, use custom variants and add a custom pageDirection variable\n // to animate in the right direction\n const isPageTransition = animationStyle === 'page' || animationStyle === 'pageBack';\n const pageDirection = getPageDirection(animationStyle);\n const custom = isPageTransition ? pageDirection : null;\n const pageTransitionProps = isPageTransition ? { variants: pageTransitionVariants } : null;\n\n const selectedAnimationProps = animationPropsForStyle[animationStyle];\n\n // Disable initial animation on mount. After mount the initial animation step is needed to enable\n // the \"fade-in\" animation, otherwise it just appears\n const selectedInitial = allowInitialAnimation ? selectedAnimationProps.initial : false;\n const animationProps = { ...selectedAnimationProps, initial: selectedInitial };\n\n return (\n <AnimatePresence\n initial={allowInitialAnimation}\n mode={exitBeforeEnter ? 'wait' : 'sync'}\n onExitComplete={onExitComplete}\n custom={custom}\n {...animatePresenceProps}\n >\n {show && (\n <motion.div\n key={motionDivKey}\n transition={{ duration }}\n custom={custom}\n {...animationProps}\n {...pageTransitionProps}\n {...motionProps}\n >\n {children}\n </motion.div>\n )}\n </AnimatePresence>\n );\n};\n\nFade.FADE = 'fade' as const;\nFade.FROM_LEFT = 'fromLeft' as const;\nFade.FROM_RIGHT = 'fromRight' as const;\nFade.FROM_TOP = 'fromTop' as const;\nFade.FROM_BOTTOM = 'fromBottom' as const;\nFade.TABS = 'tabs' as const;\nFade.PAGE = 'page' as const;\nFade.PAGE_BACK = 'pageBack' as const;\n\nexport default Fade;\n"],"names":["animationPropsForStyle","getPageDirection","animationStyle","pageTransitionVariants","pageDirection","Fade","props","show","initial","duration","exitBeforeEnter","animatePresenceProps","motionProps","onExitComplete","noop","children","allowInitialAnimation","setAllowInitialAnimation","useState","useAfterMount","motionDivKey","currentChild","isPageTransition","custom","pageTransitionProps","selectedAnimationProps","selectedInitial","animationProps","jsx","AnimatePresence","motion"],"mappings":";;;;;AAwBA,MAAMA,IAAoE;AAAA,EACtE,UAAU;AAAA,IACN,SAAS,EAAE,GAAG,KAAK,GAAG,GAAG,SAAS,EAAA;AAAA,IAClC,SAAS,EAAE,GAAG,GAAG,GAAG,GAAG,SAAS,EAAA;AAAA,IAChC,MAAM,EAAE,GAAG,KAAK,GAAG,GAAG,SAAS,EAAA;AAAA,EAAE;AAAA,EAErC,WAAW;AAAA,IACP,SAAS,EAAE,GAAG,IAAI,GAAG,GAAG,SAAS,EAAA;AAAA,IACjC,SAAS,EAAE,GAAG,GAAG,GAAG,GAAG,SAAS,EAAA;AAAA,IAChC,MAAM,EAAE,GAAG,IAAI,GAAG,GAAG,SAAS,EAAA;AAAA,EAAE;AAAA,EAEpC,SAAS;AAAA,IACL,SAAS,EAAE,GAAG,KAAK,GAAG,GAAG,SAAS,EAAA;AAAA,IAClC,SAAS,EAAE,GAAG,GAAG,GAAG,GAAG,SAAS,EAAA;AAAA,IAChC,MAAM,EAAE,GAAG,KAAK,GAAG,GAAG,SAAS,EAAA;AAAA,EAAE;AAAA,EAErC,YAAY;AAAA,IACR,SAAS,EAAE,GAAG,IAAI,GAAG,GAAG,SAAS,EAAA;AAAA,IACjC,SAAS,EAAE,GAAG,GAAG,GAAG,GAAG,SAAS,EAAA;AAA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E,CAACU,GAAuBC,CAAwB,IAAIC,EAASV,CAAO;AAE1E,EAAAW,EAAc,MAAM;AAChB,IAAKH,KACDC,EAAyB,EAAI;AAAA,EAErC,CAAC;AAED,MAAIG,IAAe;AAKnB,MAAI,MAAM,QAAQL,CAAQ,GAAG;AACzB,UAAM,CAACM,CAAY,IAAIN,EAAS,OAAO,OAAO;AAC9C,IAAAK,IAAe,QAAQC,EAAa,GAAG;AAAA,EAC3C;AAIA,QAAMC,IAAmBpB,MAAmB,UAAUA,MAAmB,YACnEE,IAAgBH,EAAiBC,CAAc,GAC/CqB,IAASD,IAAmBlB,IAAgB,MAC5CoB,IAAsBF,IAAmB,EAAE,UAAUnB,MAA2B,MAEhFsB,IAAyBzB,EAAuBE,CAAc,GAI9DwB,IAAkBV,IAAwBS,EAAuB,UAAU,IAC3EE,IAAiB,EAAE,GAAGF,GAAwB,SAASC,EAAA;AAE7D,SACI,gBAAAE;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,SAASb;AAAA,MACT,MAAMN,IAAkB,SAAS;AAAA,MACjC,gBAAAG;AAAA,MACA,QAAAU;AAAA,MACC,GAAGZ;AAAA,MAEH,UAAAJ,KACG,gBAAAqB;AAAA,QAACE,EAAO;AAAA,QAAP;AAAA,UAEG,YAAY,EAAE,UAAArB,EAAA;AAAA,UACd,QAAAc;AAAA,UACC,GAAGI;AAAA,UACH,GAAGH;AAAA,UACH,GAAGZ;AAAA,UAEH,UAAAG;AAAA,QAAA;AAAA,QAPIK;AAAA,MAAA;AAAA,IAQT;AAAA,EAAA;AAIhB;AAEAf,EAAK,OAAO;AACZA,EAAK,YAAY;AACjBA,EAAK,aAAa;AAClBA,EAAK,WAAW;AAChBA,EAAK,cAAc;AACnBA,EAAK,OAAO;AACZA,EAAK,OAAO;AACZA,EAAK,YAAY;"}
1
+ {"version":3,"file":"Fade.js","sources":["../../../src/components/fade/Fade.tsx"],"sourcesContent":["import { type PropsWithChildren, useState } from 'react';\nimport { AnimatePresence, motion } from 'motion/react';\nimport { noop } from 'es-toolkit/compat';\n\nimport useAfterMount from '../../useAfterMount';\n\ntype AnimationValue = { x: number; y: number; opacity: number };\n\ntype AnimationProp = {\n initial: 'pageEnter' | AnimationValue | false;\n animate: 'pageCenter' | AnimationValue;\n exit: 'pageExit' | AnimationValue;\n};\n\nexport type FadeAnimationStyle =\n | 'fade'\n | 'tabs'\n | 'page'\n | 'pageBack'\n | 'fromLeft'\n | 'fromRight'\n | 'fromTop'\n | 'fromBottom';\n\nconst animationPropsForStyle: Record<FadeAnimationStyle, AnimationProp> = {\n fromLeft: {\n initial: { x: -10, y: 0, opacity: 0 },\n animate: { x: 0, y: 0, opacity: 1 },\n exit: { x: -10, y: 0, opacity: 0 },\n },\n fromRight: {\n initial: { x: 10, y: 0, opacity: 0 },\n animate: { x: 0, y: 0, opacity: 1 },\n exit: { x: 10, y: 0, opacity: 0 },\n },\n fromTop: {\n initial: { y: -10, x: 0, opacity: 0 },\n animate: { y: 0, x: 0, opacity: 1 },\n exit: { y: -10, x: 0, opacity: 0 },\n },\n fromBottom: {\n initial: { y: 10, x: 0, opacity: 0 },\n animate: { y: 0, x: 0, opacity: 1 },\n exit: { y: 10, x: 0, opacity: 0 },\n },\n fade: {\n initial: { x: 0, y: 0, opacity: 0 },\n animate: { x: 0, y: 0, opacity: 1 },\n exit: { x: 0, y: 0, opacity: 0 },\n },\n tabs: {\n initial: { x: 2, y: 0, opacity: 0 },\n animate: { x: 0, y: 0, opacity: 1 },\n exit: { x: -2, y: 0, opacity: 0 },\n },\n page: {\n initial: 'pageEnter',\n animate: 'pageCenter',\n exit: 'pageExit',\n },\n pageBack: {\n initial: 'pageEnter',\n animate: 'pageCenter',\n exit: 'pageExit',\n },\n} as const;\n\ntype PageDirection = -1 | 1;\n\nconst getPageDirection = (animationStyle: FadeAnimationStyle): PageDirection =>\n animationStyle === 'pageBack' ? -1 : 1;\n\nconst pageTransitionVariants = {\n pageEnter: (pageDirection: PageDirection) => ({ x: `${pageDirection * 60}%`, opacity: 0 }),\n pageCenter: { x: 0, opacity: 1 },\n pageExit: (pageDirection: PageDirection) => ({ zIndex: 0, x: `${-pageDirection * 60}%`, opacity: 0 }),\n};\n\nexport type FadeProps = {\n /**\n * Defines whether to show the content.\n *\n * @default true\n */\n show?: boolean;\n\n /**\n * Duration of the fade animation in seconds.\n *\n * @default 0.2\n */\n duration?: number;\n\n /**\n * Defines whether the animation is triggered initially when showing the content.\n *\n * @default false\n */\n initial?: boolean;\n\n /**\n * Defines the desired animation style.\n *\n * Possible values are:\n * - `fade`\n * - `tabs`\n * - `page`\n * - `pageBack`\n * - `fromLeft`\n * - `fromRight`\n * - `fromTop`\n * - `fromBottom`\n *\n * @default 'fade'\n */\n animationStyle?: FadeAnimationStyle;\n\n /**\n * If set to true, only one component will be rendered at a time.\n *\n * The exiting component will finish its exit animation before the entering component is rendered.\n *\n * @default false\n */\n exitBeforeEnter?: boolean;\n\n /**\n * Fires when all exiting nodes have completed animating out.\n *\n * @default () => {}\n */\n onExitComplete?: VoidFunction;\n\n /**\n * Additional custom props for the underlying Framer motion AnimatePresence component.\n *\n * Use this for additional customizations.\n */\n animatePresenceProps?: object;\n\n /**\n * Additional custom props for the underlying Framer motion &lt;motion.div&gt; component.\n *\n * Use this for additional customizations.\n */\n motionProps?: object;\n};\n\nconst Fade = (props: PropsWithChildren<FadeProps>) => {\n const {\n show = true,\n initial = false,\n duration = 0.2,\n exitBeforeEnter = false,\n animationStyle = 'fade',\n animatePresenceProps,\n motionProps,\n onExitComplete = noop,\n children,\n } = props;\n\n const [allowInitialAnimation, setAllowInitialAnimation] = useState(initial);\n\n useAfterMount(() => {\n if (!allowInitialAnimation) {\n setAllowInitialAnimation(true);\n }\n });\n\n let motionDivKey = 'fade';\n\n // If there are multiple children that are conditionally rendered like\n // in case of a tabbed content - get the current visible child key\n // to update the motion.div key to animate different children\n if (Array.isArray(children)) {\n const [currentChild] = children.filter(Boolean);\n motionDivKey = `fade-${currentChild.key}`;\n }\n\n // In case the animation is a page transition, use custom variants and add a custom pageDirection variable\n // to animate in the right direction\n const isPageTransition = animationStyle === 'page' || animationStyle === 'pageBack';\n const pageDirection = getPageDirection(animationStyle);\n const custom = isPageTransition ? pageDirection : null;\n const pageTransitionProps = isPageTransition ? { variants: pageTransitionVariants } : null;\n\n const selectedAnimationProps = animationPropsForStyle[animationStyle];\n\n // Disable initial animation on mount. After mount the initial animation step is needed to enable\n // the \"fade-in\" animation, otherwise it just appears\n const selectedInitial = allowInitialAnimation ? selectedAnimationProps.initial : false;\n const animationProps = { ...selectedAnimationProps, initial: selectedInitial };\n\n return (\n <AnimatePresence\n initial={allowInitialAnimation}\n mode={exitBeforeEnter ? 'wait' : 'sync'}\n onExitComplete={onExitComplete}\n custom={custom}\n {...animatePresenceProps}\n >\n {show && (\n <motion.div\n key={motionDivKey}\n transition={{ duration }}\n custom={custom}\n {...animationProps}\n {...pageTransitionProps}\n {...motionProps}\n >\n {children}\n </motion.div>\n )}\n </AnimatePresence>\n );\n};\n\nFade.FADE = 'fade' as const;\nFade.FROM_LEFT = 'fromLeft' as const;\nFade.FROM_RIGHT = 'fromRight' as const;\nFade.FROM_TOP = 'fromTop' as const;\nFade.FROM_BOTTOM = 'fromBottom' as const;\nFade.TABS = 'tabs' as const;\nFade.PAGE = 'page' as const;\nFade.PAGE_BACK = 'pageBack' as const;\n\nexport default Fade;\n"],"names":["animationPropsForStyle","getPageDirection","animationStyle","pageTransitionVariants","pageDirection","Fade","props","show","initial","duration","exitBeforeEnter","animatePresenceProps","motionProps","onExitComplete","noop","children","allowInitialAnimation","setAllowInitialAnimation","useState","useAfterMount","motionDivKey","currentChild","isPageTransition","custom","pageTransitionProps","selectedAnimationProps","selectedInitial","animationProps","jsx","AnimatePresence","motion"],"mappings":";;;;;AAwBA,MAAMA,IAAoE;AAAA,EACtE,UAAU;AAAA,IACN,SAAS,EAAE,GAAG,KAAK,GAAG,GAAG,SAAS,EAAA;AAAA,IAClC,SAAS,EAAE,GAAG,GAAG,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;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,SAASb;AAAA,MACT,MAAMN,IAAkB,SAAS;AAAA,MACjC,gBAAAG;AAAA,MACA,QAAAU;AAAA,MACC,GAAGZ;AAAA,MAEH,UAAAJ,KACG,gBAAAqB;AAAA,QAACE,EAAO;AAAA,QAAP;AAAA,UAEG,YAAY,EAAE,UAAArB,EAAA;AAAA,UACd,QAAAc;AAAA,UACC,GAAGI;AAAA,UACH,GAAGH;AAAA,UACH,GAAGZ;AAAA,UAEH,UAAAG;AAAA,QAAA;AAAA,QAPIK;AAAA,MAAA;AAAA,IAQT;AAAA,EAAA;AAIhB;AAEAf,EAAK,OAAO;AACZA,EAAK,YAAY;AACjBA,EAAK,aAAa;AAClBA,EAAK,WAAW;AAChBA,EAAK,cAAc;AACnBA,EAAK,OAAO;AACZA,EAAK,OAAO;AACZA,EAAK,YAAY;"}
@@ -1,6 +1,6 @@
1
1
  import { jsxs as s, jsx as e } from "react/jsx-runtime";
2
2
  import { useState as L, createElement as j } from "react";
3
- import p from "classnames";
3
+ import p from "../../utils/classNames.js";
4
4
  import z from "../button/ToggleButton.js";
5
5
  const F = (b) => {
6
6
  const {
@@ -1 +1 @@
1
- {"version":3,"file":"FeedbackRating.js","sources":["../../../src/components/feedback/FeedbackRating.tsx"],"sourcesContent":["import React, { type ComponentProps, useState } from 'react';\nimport classNames from 'classnames';\n\nimport ToggleButton from '../button/ToggleButton';\nimport type { BUTTON_SIZE, BUTTON_STYLE, BUTTON_VARIANT } from '../button/Button';\n\ntype FeedbackRatingProps = ComponentProps<'div'> & {\n /**\n * Optional headline\n */\n headline?: React.ReactNode;\n\n /**\n * The amount of toggle buttons used to rate.\n *\n * @default 1\n */\n count: number;\n\n /**\n * Defines whether the buttons are round.\n *\n * @default false\n */\n circleButtons?: boolean;\n\n /**\n * Optional class names applied to all the buttons.\n * If you need more control on styling individual buttons, see `buttonStyles`.\n */\n buttonClassName?: string;\n\n /**\n * Array of button labels that will be used instead of the index.\n * There needs to be a label for each button defined.\n */\n buttonLabels?: React.ReactNode[];\n\n /**\n * Array of button styles to individually define the button size, style and variant.\n * There needs to be a item for each button defined.\n */\n buttonStyles?: { bsSize?: BUTTON_SIZE; bsStyle?: BUTTON_STYLE; variant?: BUTTON_VARIANT; className?: string }[];\n\n /**\n * Left aligned label to name the lowest rating option.\n */\n leftLabel?: React.ReactNode;\n\n /**\n * Right aligned label to name the highest rating option.\n */\n rightLabel?: React.ReactNode;\n\n /**\n * Additional icon placed in front of the rating buttons.\n */\n leadingIcon?: React.ReactNode;\n\n /**\n * Additional icon placed after the rating buttons.\n */\n trailingIcon?: React.ReactNode;\n\n /**\n * Callback triggered when the rating changes.\n *\n * @param rating The rating value. Undefined, when a toggle is unchecked.\n * @returns\n */\n onRatingChanged?: (rating: number | undefined) => void;\n};\n\nconst FeedbackRating = (props: FeedbackRatingProps) => {\n const {\n headline,\n count = 1,\n circleButtons = false,\n buttonLabels,\n buttonStyles,\n buttonClassName = '',\n leftLabel,\n rightLabel,\n leadingIcon,\n trailingIcon,\n onRatingChanged = () => {},\n ...remainingProps\n } = props;\n\n const [rating, setRating] = useState<number>();\n\n const handleRating = (value: number | undefined) => {\n setRating(value);\n onRatingChanged(value);\n };\n\n const hasSubLabels = !!leftLabel || !!rightLabel;\n\n const buttonWrapperClasses = classNames(\n 'display-flex gap-10',\n hasSubLabels ? 'align-items-start' : 'align-items-center',\n 'text-size-14',\n 'margin-bottom-25'\n );\n\n const leadingTrailingIconClasses = classNames(\n 'display-flex align-items-center',\n 'text-size-200pct',\n hasSubLabels && 'padding-top-3'\n );\n\n return (\n <div {...remainingProps} className='FeedbackRating'>\n {headline && <div className='text-medium text-size-16 margin-bottom-10'>{headline}</div>}\n <div className={buttonWrapperClasses}>\n {leadingIcon && <div className={leadingTrailingIconClasses}>{leadingIcon}</div>}\n <div>\n <div className='display-flex flex-wrap gap-10'>\n {Array.from({ length: count }, (_, index) => {\n const indexNumber = index + 1;\n return (\n <ToggleButton\n {...buttonStyles?.[index]}\n key={indexNumber}\n active={rating === indexNumber}\n onClick={(toggled: boolean) => handleRating(toggled ? indexNumber : undefined)}\n className={`${circleButtons ? 'rounded-circle aspect-ratio-1' : ''} ${buttonClassName} ${buttonStyles?.[index].className ?? ''}`}\n >\n {buttonLabels?.[index] ?? indexNumber}\n </ToggleButton>\n );\n })}\n </div>\n {hasSubLabels && (\n <div className='display-flex justify-content-between margin-top-5 gap-25'>\n {leftLabel ? <label className='word-wrap text-color-dark'>{leftLabel}</label> : <div />}\n {rightLabel ? <label className='word-wrap text-color-dark'>{rightLabel}</label> : <div />}\n </div>\n )}\n </div>\n {trailingIcon && <div className={leadingTrailingIconClasses}>{trailingIcon}</div>}\n </div>\n </div>\n );\n};\n\nexport default FeedbackRating;\n"],"names":["FeedbackRating","props","headline","count","circleButtons","buttonLabels","buttonStyles","buttonClassName","leftLabel","rightLabel","leadingIcon","trailingIcon","onRatingChanged","remainingProps","rating","setRating","useState","handleRating","value","hasSubLabels","buttonWrapperClasses","classNames","leadingTrailingIconClasses","jsxs","jsx","_","index","indexNumber","createElement","ToggleButton","toggled"],"mappings":";;;;AAyEA,MAAMA,IAAiB,CAACC,MAA+B;AACnD,QAAM;AAAA,IACF,UAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,eAAAC,IAAgB;AAAA,IAChB,cAAAC;AAAA,IACA,cAAAC;AAAA,IACA,iBAAAC,IAAkB;AAAA,IAClB,WAAAC;AAAA,IACA,YAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,iBAAAC,IAAkB,MAAM;AAAA,IAAC;AAAA,IACzB,GAAGC;AAAA,EAAA,IACHZ,GAEE,CAACa,GAAQC,CAAS,IAAIC,EAAA,GAEtBC,IAAe,CAACC,MAA8B;AAChD,IAAAH,EAAUG,CAAK,GACfN,EAAgBM,CAAK;AAAA,EACzB,GAEMC,IAAe,CAAC,CAACX,KAAa,CAAC,CAACC,GAEhCW,IAAuBC;AAAA,IACzB;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,MAAA,GAER;AAAA,MACCE,KAAgB,gBAAAa,EAAC,OAAA,EAAI,WAAWF,GAA6B,UAAAX,EAAA,CAAa;AAAA,IAAA,EAAA,CAC/E;AAAA,EAAA,GACJ;AAER;"}
1
+ {"version":3,"file":"FeedbackRating.js","sources":["../../../src/components/feedback/FeedbackRating.tsx"],"sourcesContent":["import React, { type ComponentProps, useState } from 'react';\n\nimport classNames from '../../utils/classNames';\nimport ToggleButton from '../button/ToggleButton';\nimport type { BUTTON_SIZE, BUTTON_STYLE, BUTTON_VARIANT } from '../button/Button';\n\ntype FeedbackRatingProps = ComponentProps<'div'> & {\n /**\n * Optional headline\n */\n headline?: React.ReactNode;\n\n /**\n * The amount of toggle buttons used to rate.\n *\n * @default 1\n */\n count: number;\n\n /**\n * Defines whether the buttons are round.\n *\n * @default false\n */\n circleButtons?: boolean;\n\n /**\n * Optional class names applied to all the buttons.\n * If you need more control on styling individual buttons, see `buttonStyles`.\n */\n buttonClassName?: string;\n\n /**\n * Array of button labels that will be used instead of the index.\n * There needs to be a label for each button defined.\n */\n buttonLabels?: React.ReactNode[];\n\n /**\n * Array of button styles to individually define the button size, style and variant.\n * There needs to be a item for each button defined.\n */\n buttonStyles?: { bsSize?: BUTTON_SIZE; bsStyle?: BUTTON_STYLE; variant?: BUTTON_VARIANT; className?: string }[];\n\n /**\n * Left aligned label to name the lowest rating option.\n */\n leftLabel?: React.ReactNode;\n\n /**\n * Right aligned label to name the highest rating option.\n */\n rightLabel?: React.ReactNode;\n\n /**\n * Additional icon placed in front of the rating buttons.\n */\n leadingIcon?: React.ReactNode;\n\n /**\n * Additional icon placed after the rating buttons.\n */\n trailingIcon?: React.ReactNode;\n\n /**\n * Callback triggered when the rating changes.\n *\n * @param rating The rating value. Undefined, when a toggle is unchecked.\n * @returns\n */\n onRatingChanged?: (rating: number | undefined) => void;\n};\n\nconst FeedbackRating = (props: FeedbackRatingProps) => {\n const {\n headline,\n count = 1,\n circleButtons = false,\n buttonLabels,\n buttonStyles,\n buttonClassName = '',\n leftLabel,\n rightLabel,\n leadingIcon,\n trailingIcon,\n onRatingChanged = () => {},\n ...remainingProps\n } = props;\n\n const [rating, setRating] = useState<number>();\n\n const handleRating = (value: number | undefined) => {\n setRating(value);\n onRatingChanged(value);\n };\n\n const hasSubLabels = !!leftLabel || !!rightLabel;\n\n const buttonWrapperClasses = classNames(\n 'display-flex gap-10',\n hasSubLabels ? 'align-items-start' : 'align-items-center',\n 'text-size-14',\n 'margin-bottom-25'\n );\n\n const leadingTrailingIconClasses = classNames(\n 'display-flex align-items-center',\n 'text-size-200pct',\n hasSubLabels && 'padding-top-3'\n );\n\n return (\n <div {...remainingProps} className='FeedbackRating'>\n {headline && <div className='text-medium text-size-16 margin-bottom-10'>{headline}</div>}\n <div className={buttonWrapperClasses}>\n {leadingIcon && <div className={leadingTrailingIconClasses}>{leadingIcon}</div>}\n <div>\n <div className='display-flex flex-wrap gap-10'>\n {Array.from({ length: count }, (_, index) => {\n const indexNumber = index + 1;\n return (\n <ToggleButton\n {...buttonStyles?.[index]}\n key={indexNumber}\n active={rating === indexNumber}\n onClick={(toggled: boolean) => handleRating(toggled ? indexNumber : undefined)}\n className={`${circleButtons ? 'rounded-circle aspect-ratio-1' : ''} ${buttonClassName} ${buttonStyles?.[index].className ?? ''}`}\n >\n {buttonLabels?.[index] ?? indexNumber}\n </ToggleButton>\n );\n })}\n </div>\n {hasSubLabels && (\n <div className='display-flex justify-content-between margin-top-5 gap-25'>\n {leftLabel ? <label className='word-wrap text-color-dark'>{leftLabel}</label> : <div />}\n {rightLabel ? <label className='word-wrap text-color-dark'>{rightLabel}</label> : <div />}\n </div>\n )}\n </div>\n {trailingIcon && <div className={leadingTrailingIconClasses}>{trailingIcon}</div>}\n </div>\n </div>\n );\n};\n\nexport default FeedbackRating;\n"],"names":["FeedbackRating","props","headline","count","circleButtons","buttonLabels","buttonStyles","buttonClassName","leftLabel","rightLabel","leadingIcon","trailingIcon","onRatingChanged","remainingProps","rating","setRating","useState","handleRating","value","hasSubLabels","buttonWrapperClasses","classNames","leadingTrailingIconClasses","jsxs","jsx","_","index","indexNumber","createElement","ToggleButton","toggled"],"mappings":";;;;AAyEA,MAAMA,IAAiB,CAACC,MAA+B;AACnD,QAAM;AAAA,IACF,UAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,eAAAC,IAAgB;AAAA,IAChB,cAAAC;AAAA,IACA,cAAAC;AAAA,IACA,iBAAAC,IAAkB;AAAA,IAClB,WAAAC;AAAA,IACA,YAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,iBAAAC,IAAkB,MAAM;AAAA,IAAC;AAAA,IACzB,GAAGC;AAAA,EAAA,IACHZ,GAEE,CAACa,GAAQC,CAAS,IAAIC,EAAA,GAEtBC,IAAe,CAACC,MAA8B;AAChD,IAAAH,EAAUG,CAAK,GACfN,EAAgBM,CAAK;AAAA,EACzB,GAEMC,IAAe,CAAC,CAACX,KAAa,CAAC,CAACC,GAEhCW,IAAuBC;AAAA,IACzB;AAAA,IACAF,IAAe,sBAAsB;AAAA,IACrC;AAAA,IACA;AAAA,EAAA,GAGEG,IAA6BD;AAAA,IAC/B;AAAA,IACA;AAAA,IACAF,KAAgB;AAAA,EAAA;AAGpB,SACI,gBAAAI,EAAC,OAAA,EAAK,GAAGV,GAAgB,WAAU,kBAC9B,UAAA;AAAA,IAAAX,KAAY,gBAAAsB,EAAC,OAAA,EAAI,WAAU,6CAA6C,UAAAtB,GAAS;AAAA,IAClF,gBAAAqB,EAAC,OAAA,EAAI,WAAWH,GACX,UAAA;AAAA,MAAAV,KAAe,gBAAAc,EAAC,OAAA,EAAI,WAAWF,GAA6B,UAAAZ,GAAY;AAAA,wBACxE,OAAA,EACG,UAAA;AAAA,QAAA,gBAAAc,EAAC,OAAA,EAAI,WAAU,iCACV,UAAA,MAAM,KAAK,EAAE,QAAQrB,EAAA,GAAS,CAACsB,GAAGC,MAAU;AACzC,gBAAMC,IAAcD,IAAQ;AAC5B,iBACI,gBAAAE;AAAA,YAACC;AAAA,YAAA;AAAA,cACI,GAAGvB,IAAeoB,CAAK;AAAA,cACxB,KAAKC;AAAA,cACL,QAAQb,MAAWa;AAAA,cACnB,SAAS,CAACG,MAAqBb,EAAaa,IAAUH,IAAc,MAAS;AAAA,cAC7E,WAAW,GAAGvB,IAAgB,kCAAkC,EAAE,IAAIG,CAAe,IAAID,IAAeoB,CAAK,EAAE,aAAa,EAAE;AAAA,YAAA;AAAA,YAE7HrB,IAAeqB,CAAK,KAAKC;AAAA,UAAA;AAAA,QAGtC,CAAC,EAAA,CACL;AAAA,QACCR,KACG,gBAAAI,EAAC,OAAA,EAAI,WAAU,4DACV,UAAA;AAAA,UAAAf,sBAAa,SAAA,EAAM,WAAU,6BAA6B,UAAAA,GAAU,sBAAY,OAAA,CAAA,CAAI;AAAA,UACpFC,sBAAc,SAAA,EAAM,WAAU,6BAA6B,UAAAA,EAAA,CAAW,sBAAY,OAAA,CAAA,CAAI;AAAA,QAAA,EAAA,CAC3F;AAAA,MAAA,GAER;AAAA,MACCE,KAAgB,gBAAAa,EAAC,OAAA,EAAI,WAAWF,GAA6B,UAAAX,EAAA,CAAa;AAAA,IAAA,EAAA,CAC/E;AAAA,EAAA,GACJ;AAER;"}
@@ -1,7 +1,7 @@
1
1
  import { jsxs as f, jsx as l } from "react/jsx-runtime";
2
2
  import { useRef as C } from "react";
3
- import u from "classnames";
4
3
  import { motion as y } from "motion/react";
4
+ import u from "../../utils/classNames.js";
5
5
  import v from "../../hooks/useHover.js";
6
6
  const z = (m) => {
7
7
  const {