@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.
- package/CircularProgress.d.ts +2 -0
- package/CircularProgress.js +5 -0
- package/CircularProgress.js.map +1 -0
- package/RadioCardGroup.d.ts +2 -0
- package/RadioCardGroup.js +7 -0
- package/RadioCardGroup.js.map +1 -0
- package/SearchHighlightText.d.ts +2 -0
- package/SearchHighlightText.js +5 -0
- package/SearchHighlightText.js.map +1 -0
- package/TextTruncateMiddle.d.ts +2 -0
- package/TextTruncateMiddle.js +5 -0
- package/TextTruncateMiddle.js.map +1 -0
- package/Tracker.d.ts +2 -0
- package/Tracker.js +5 -0
- package/Tracker.js.map +1 -0
- package/classNames.d.ts +2 -0
- package/classNames.js +5 -0
- package/classNames.js.map +1 -0
- package/components/accentBar/AccentBar.js +1 -1
- package/components/accentBar/AccentBar.js.map +1 -1
- package/components/actionBarItem/ActionBarItem.d.ts +2 -2
- package/components/actionBarItem/ActionBarItem.js +7 -7
- package/components/actionBarItem/ActionBarItem.js.map +1 -1
- package/components/actionBarItem/ActionBarItemIcon.js +1 -1
- package/components/actionBarItem/ActionBarItemIcon.js.map +1 -1
- package/components/actionBarItem/ActionBarItemList.js +1 -1
- package/components/actionBarItem/ActionBarItemList.js.map +1 -1
- package/components/actionBarItem/ActionBarItemListItem.js +1 -1
- package/components/actionBarItem/ActionBarItemListItem.js.map +1 -1
- package/components/actionBarItem/ActionBarItemListSeparator.js +1 -1
- package/components/actionBarItem/ActionBarItemListSeparator.js.map +1 -1
- package/components/actionBarItem/ActionBarItemPopoverContent.js +3 -3
- package/components/actionBarItem/ActionBarItemPopoverContent.js.map +1 -1
- package/components/actionBarItem/ActionBarOverlay.js +1 -1
- package/components/actionBarItem/ActionBarOverlay.js.map +1 -1
- package/components/activity/Activity.js +1 -1
- package/components/activity/Activity.js.map +1 -1
- package/components/animatedTextReveal/AnimatedTextReveal.js +1 -1
- package/components/animatedTextReveal/AnimatedTextReveal.js.map +1 -1
- package/components/applicationHeader/AppMenu.js +2 -2
- package/components/applicationHeader/AppMenu.js.map +1 -1
- package/components/applicationHeader/AppMenuDropdown.js +13 -11
- package/components/applicationHeader/AppMenuDropdown.js.map +1 -1
- package/components/applicationHeader/ApplicationHeader.d.ts +6 -7
- package/components/applicationHeader/ApplicationHeader.js +1 -1
- package/components/applicationHeader/ApplicationHeader.js.map +1 -1
- package/components/applicationHeader/MobileHeaderModal.js +8 -8
- package/components/applicationHeader/MobileHeaderModal.js.map +1 -1
- package/components/applicationHeader/MobileSubmoduleNavigation.js +1 -1
- package/components/applicationHeader/MobileSubmoduleNavigation.js.map +1 -1
- package/components/applicationHeader/NavItems.js +4 -4
- package/components/applicationHeader/NavItems.js.map +1 -1
- package/components/applicationLayout/ApplicationLayout.js +10 -10
- package/components/applicationLayout/ApplicationLayout.js.map +1 -1
- package/components/applicationLayout/ApplicationLayoutBody.js +2 -2
- package/components/applicationLayout/ApplicationLayoutBody.js.map +1 -1
- package/components/applicationLayout/ApplicationLayoutBodyBanner.js +1 -1
- package/components/applicationLayout/ApplicationLayoutBodyBanner.js.map +1 -1
- package/components/applicationLayout/ApplicationLayoutBodyBottomBar.js +1 -1
- package/components/applicationLayout/ApplicationLayoutBodyBottomBar.js.map +1 -1
- package/components/applicationLayout/ApplicationLayoutBodyNavigation.js +1 -1
- package/components/applicationLayout/ApplicationLayoutBodyNavigation.js.map +1 -1
- package/components/applicationLayout/ApplicationLayoutHeader.js +1 -1
- package/components/applicationLayout/ApplicationLayoutHeader.js.map +1 -1
- package/components/applicationLayout/ApplicationLayoutSidebar.js +1 -1
- package/components/applicationLayout/ApplicationLayoutSidebar.js.map +1 -1
- package/components/applicationLayout/SubNavigation.d.ts +7 -0
- package/components/applicationLayout/SubNavigation.js +1 -1
- package/components/applicationLayout/SubNavigation.js.map +1 -1
- package/components/assetTree/AssetTree.d.ts +7 -0
- package/components/assetTree/AssetTree.js +1 -1
- package/components/assetTree/AssetTree.js.map +1 -1
- package/components/assetTree/Tree.d.ts +15 -0
- package/components/assetTree/Tree.js +1 -1
- package/components/assetTree/Tree.js.map +1 -1
- package/components/assetTree/TreeIcon.d.ts +30 -0
- package/components/assetTree/TreeIcon.js +16 -0
- package/components/assetTree/TreeIcon.js.map +1 -0
- package/components/assetTree/TreeLeaf.js +23 -23
- package/components/assetTree/TreeLeaf.js.map +1 -1
- package/components/assetTree/TreeNode.js +25 -25
- package/components/assetTree/TreeNode.js.map +1 -1
- package/components/assetTree/TreeNodeContainer.js +1 -1
- package/components/assetTree/TreeNodeContainer.js.map +1 -1
- package/components/assetTree/TreeOption.js +3 -3
- package/components/assetTree/TreeOption.js.map +1 -1
- package/components/assetTree/TreeOptions.js +4 -4
- package/components/assetTree/TreeOptions.js.map +1 -1
- package/components/assetTree/TreeRoot.js +3 -3
- package/components/assetTree/TreeRoot.js.map +1 -1
- package/components/assetTree/TreeSearch.d.ts +2 -0
- package/components/assetTree/TreeSearch.js +3 -3
- package/components/assetTree/TreeSearch.js.map +1 -1
- package/components/assetTree/TreeSidebar.js +1 -1
- package/components/assetTree/TreeSidebar.js.map +1 -1
- package/components/assetTree/TreeSidebarCategories.js +4 -4
- package/components/assetTree/TreeSidebarCategories.js.map +1 -1
- package/components/assetTree/TreeSummary.js +1 -1
- package/components/assetTree/TreeSummary.js.map +1 -1
- package/components/assetTree/TypeCounter.js +1 -1
- package/components/assetTree/TypeCounter.js.map +1 -1
- package/components/autosuggest/AutoSuggest.js +1 -1
- package/components/autosuggest/AutoSuggest.js.map +1 -1
- package/components/avatar/Avatar.js +1 -1
- package/components/avatar/Avatar.js.map +1 -1
- package/components/banner/Banner.js +1 -1
- package/components/banner/Banner.js.map +1 -1
- package/components/banner/BannerContent.js +1 -1
- package/components/banner/BannerContent.js.map +1 -1
- package/components/barList/BarList.d.ts +26 -0
- package/components/barList/BarList.js +1 -1
- package/components/barList/BarList.js.map +1 -1
- package/components/bottomSheet/BottomSheet.d.ts +17 -3
- package/components/bottomSheet/BottomSheet.js +1 -1
- package/components/bottomSheet/BottomSheet.js.map +1 -1
- package/components/bottomSheet/TimedBottomSheet.d.ts +10 -0
- package/components/bottomSheet/TimedBottomSheet.js.map +1 -1
- package/components/button/Button.d.ts +53 -7
- package/components/button/Button.js +87 -64
- package/components/button/Button.js.map +1 -1
- package/components/button/ButtonToolbar.js +1 -1
- package/components/button/ButtonToolbar.js.map +1 -1
- package/components/button/ToggleButton.d.ts +4 -1
- package/components/button/ToggleButton.js.map +1 -1
- package/components/calendarStripe/CalendarStripe.d.ts +1 -1
- package/components/calendarStripe/CalendarStripe.js +48 -50
- package/components/calendarStripe/CalendarStripe.js.map +1 -1
- package/components/card/Card.js +1 -1
- package/components/card/Card.js.map +1 -1
- package/components/charts/Area.d.ts +2 -2
- package/components/charts/Area.js.map +1 -1
- package/components/charts/Line.d.ts +2 -2
- package/components/charts/Line.js.map +1 -1
- package/components/charts/RadialBarChart.js +106 -103
- package/components/charts/RadialBarChart.js.map +1 -1
- package/components/checkbox/Checkbox.d.ts +0 -3
- package/components/checkbox/Checkbox.js +6 -6
- package/components/checkbox/Checkbox.js.map +1 -1
- package/components/circularProgress/CircularProgress.d.ts +139 -0
- package/components/circularProgress/CircularProgress.js +197 -0
- package/components/circularProgress/CircularProgress.js.map +1 -0
- package/components/clearableInput/ClearableInput.d.ts +21 -20
- package/components/clearableInput/ClearableInput.js +9 -9
- package/components/clearableInput/ClearableInput.js.map +1 -1
- package/components/collapse/Collapse.d.ts +3 -0
- package/components/collapse/Collapse.js +12 -12
- package/components/collapse/Collapse.js.map +1 -1
- package/components/contentLoader/ContentLoader.d.ts +10 -2
- package/components/contentLoader/ContentLoader.js.map +1 -1
- package/components/dataTabs/DataTabHeader.js +1 -1
- package/components/dataTabs/DataTabHeader.js.map +1 -1
- package/components/dataTabs/DataTabs.d.ts +6 -0
- package/components/dataTabs/DataTabs.js +4 -4
- package/components/dataTabs/DataTabs.js.map +1 -1
- package/components/datepicker/DatePicker.js +6 -6
- package/components/datepicker/DatePicker.js.map +1 -1
- package/components/datepicker/DateRangePicker.js +1 -1
- package/components/datepicker/DateRangePicker.js.map +1 -1
- package/components/datepicker/DayPicker.js +1 -1
- package/components/datepicker/DayPicker.js.map +1 -1
- package/components/dialog/ConfirmationDialog.d.ts +22 -0
- package/components/dialog/ConfirmationDialog.js.map +1 -1
- package/components/dialog/Dialog.d.ts +13 -1
- package/components/dialog/Dialog.js +55 -55
- package/components/dialog/Dialog.js.map +1 -1
- package/components/dialog/DialogBody.js +1 -1
- package/components/dialog/DialogBody.js.map +1 -1
- package/components/dialog/DialogFooter.js +1 -1
- package/components/dialog/DialogFooter.js.map +1 -1
- package/components/dialog/DialogHeader.js +1 -1
- package/components/dialog/DialogHeader.js.map +1 -1
- package/components/dialog/MediaDialog.js +1 -1
- package/components/dialog/MediaDialog.js.map +1 -1
- package/components/dialog/ReleaseNotesDialog.d.ts +3 -3
- package/components/dialog/ReleaseNotesDialog.js.map +1 -1
- package/components/dialog/SplitDialog.js +1 -1
- package/components/dialog/SplitDialog.js.map +1 -1
- package/components/divider/Divider.js +1 -1
- package/components/divider/Divider.js.map +1 -1
- package/components/dropdown/ButtonDropdown.d.ts +4 -0
- package/components/dropdown/ButtonDropdown.js +52 -52
- package/components/dropdown/ButtonDropdown.js.map +1 -1
- package/components/dropdown/DropdownSubmenu.d.ts +4 -0
- package/components/dropdown/DropdownSubmenu.js +3 -3
- package/components/dropdown/DropdownSubmenu.js.map +1 -1
- package/components/dropdown/DropdownToggleButton.d.ts +1 -1
- package/components/dropdown/DropdownToggleButton.js +4 -3
- package/components/dropdown/DropdownToggleButton.js.map +1 -1
- package/components/dropdown/SplitCaretButton.js +6 -6
- package/components/dropdown/SplitCaretButton.js.map +1 -1
- package/components/editableContent/EditableContent.d.ts +6 -0
- package/components/editableContent/EditableContent.js +1 -1
- package/components/editableContent/EditableContent.js.map +1 -1
- package/components/ellipsis/TextTruncateMiddle.d.ts +23 -0
- package/components/ellipsis/TextTruncateMiddle.js +21 -0
- package/components/ellipsis/TextTruncateMiddle.js.map +1 -0
- package/components/expander/ExpanderList.d.ts +3 -0
- package/components/expander/ExpanderList.js +5 -5
- package/components/expander/ExpanderList.js.map +1 -1
- package/components/expander/ExpanderPanel.d.ts +14 -4
- package/components/expander/ExpanderPanel.js +1 -1
- package/components/expander/ExpanderPanel.js.map +1 -1
- package/components/fade/Fade.d.ts +1 -1
- package/components/fade/Fade.js.map +1 -1
- package/components/feedback/FeedbackRating.js +1 -1
- package/components/feedback/FeedbackRating.js.map +1 -1
- package/components/feedback/FeedbackReactions.js +1 -1
- package/components/feedback/FeedbackReactions.js.map +1 -1
- package/components/filepicker/FilePicker.d.ts +0 -2
- package/components/filepicker/FilePicker.js.map +1 -1
- package/components/formLabel/FormLabel.js +6 -9
- package/components/formLabel/FormLabel.js.map +1 -1
- package/components/formLabel/LabeledElement.js +1 -1
- package/components/formLabel/LabeledElement.js.map +1 -1
- package/components/groupedItemList/GroupedItemList.d.ts +10 -7
- package/components/groupedItemList/GroupedItemList.js.map +1 -1
- package/components/listMenu/ListMenu.js +2 -5
- package/components/listMenu/ListMenu.js.map +1 -1
- package/components/listMenu/ListMenuGroup.d.ts +2 -1
- package/components/listMenu/ListMenuGroup.js +2 -2
- package/components/listMenu/ListMenuGroup.js.map +1 -1
- package/components/loadMore/LoadMoreButton.js +1 -1
- package/components/loadMore/LoadMoreButton.js.map +1 -1
- package/components/loadMore/LoadMoreProgress.js +1 -1
- package/components/loadMore/LoadMoreProgress.js.map +1 -1
- package/components/map/components/Map.js.map +1 -1
- package/components/map/components/constants.js.map +1 -1
- package/components/map/components/features/ContextMenuItem.d.ts +1 -1
- package/components/map/components/features/ContextMenuItem.js +2 -17
- package/components/map/components/features/ContextMenuItem.js.map +1 -1
- package/components/map/components/features/MapSettings.js +4 -4
- package/components/map/components/features/MapSettings.js.map +1 -1
- package/components/map/components/features/basics/Polyline.d.ts +4 -1
- package/components/map/components/features/basics/Polyline.js +1 -1
- package/components/map/components/features/basics/Polyline.js.map +1 -1
- package/components/map/components/features/layers/MarkerLayer.d.ts +3 -1
- package/components/map/components/features/layers/MarkerLayer.js.map +1 -1
- package/components/map/components/features/layers/clustering/ClusterLayer.js +1 -1
- package/components/map/components/features/layers/clustering/ClusterLayer.js.map +1 -1
- package/components/map/components/features/layers/clustering/SimpleClusterLayer.d.ts +3 -2
- package/components/map/components/features/layers/clustering/SimpleClusterLayer.js.map +1 -1
- package/components/map/components/features/layers/overlayLayers/RoadRestrictionLayer.js +7 -7
- package/components/map/components/features/layers/overlayLayers/RoadRestrictionLayer.js.map +1 -1
- package/components/map/components/features/layers/overlayLayers/TrafficLayer.js +4 -4
- package/components/map/components/features/layers/overlayLayers/TrafficLayer.js.map +1 -1
- package/components/map/components/features/settings/MapSettingsItem.js +1 -1
- package/components/map/components/features/settings/MapSettingsItem.js.map +1 -1
- package/components/map/components/features/settings/MapSettingsPanel.js +6 -20
- package/components/map/components/features/settings/MapSettingsPanel.js.map +1 -1
- package/components/map/components/features/settings/MapSettingsTile.js +87 -61
- package/components/map/components/features/settings/MapSettingsTile.js.map +1 -1
- package/components/map/components/features/settings/ZoomButtons.js +1 -1
- package/components/map/components/features/settings/ZoomButtons.js.map +1 -1
- package/components/map/components/features/settings/builtinSettings/MapTypeSettings.d.ts +38 -1
- package/components/map/components/features/settings/builtinSettings/MapTypeSettings.js +128 -92
- package/components/map/components/features/settings/builtinSettings/MapTypeSettings.js.map +1 -1
- package/components/map/utils/clustering.d.ts +6 -1
- package/components/map/utils/clustering.js +25 -19
- package/components/map/utils/clustering.js.map +1 -1
- package/components/map/utils/eventHandling.js +9 -9
- package/components/map/utils/eventHandling.js.map +1 -1
- package/components/map/utils/mapUtils.d.ts +6 -6
- package/components/map/utils/mapUtils.js +14 -19
- package/components/map/utils/mapUtils.js.map +1 -1
- package/components/map/utils/rendering.d.ts +1 -1
- package/components/map/utils/rendering.js +23 -23
- package/components/map/utils/rendering.js.map +1 -1
- package/components/mapMarker/ClusterMapMarker.js +1 -1
- package/components/mapMarker/ClusterMapMarker.js.map +1 -1
- package/components/mapMarker/SingleMapMarker.js +1 -1
- package/components/mapMarker/SingleMapMarker.js.map +1 -1
- package/components/menuItems/MenuItem.d.ts +23 -0
- package/components/menuItems/MenuItem.js +1 -1
- package/components/menuItems/MenuItem.js.map +1 -1
- package/components/menuItems/MenuItemList.js +1 -1
- package/components/menuItems/MenuItemList.js.map +1 -1
- package/components/navigation/AppNavigationBar.js +4 -4
- package/components/navigation/AppNavigationBar.js.map +1 -1
- package/components/noData/NoData.js +1 -1
- package/components/noData/NoData.js.map +1 -1
- package/components/notification/Notification.js +4 -4
- package/components/notification/Notification.js.map +1 -1
- package/components/numberControl/NumberControl.js +4 -4
- package/components/numberControl/NumberControl.js.map +1 -1
- package/components/numberInput/NumberInput.js +1 -1
- package/components/numberInput/NumberInput.js.map +1 -1
- package/components/onboarding/OnboardingTip.d.ts +18 -12
- package/components/onboarding/OnboardingTip.js +4 -4
- package/components/onboarding/OnboardingTip.js.map +1 -1
- package/components/overlay/OverlayTrigger.d.ts +43 -1
- package/components/overlay/OverlayTrigger.js.map +1 -1
- package/components/page/Page.js +1 -1
- package/components/page/Page.js.map +1 -1
- package/components/pager/Pager.d.ts +3 -0
- package/components/pager/Pager.js +1 -1
- package/components/pager/Pager.js.map +1 -1
- package/components/popover/Popover.d.ts +1 -0
- package/components/popover/Popover.js.map +1 -1
- package/components/preloader/ImagePreloader.d.ts +1 -1
- package/components/preloader/ImagePreloader.js.map +1 -1
- package/components/radiobutton/RadioButton.d.ts +10 -6
- package/components/radiobutton/RadioButton.js +5 -5
- package/components/radiobutton/RadioButton.js.map +1 -1
- package/components/radiobutton/RadioCardGroup.d.ts +86 -0
- package/components/radiobutton/RadioCardGroup.js +110 -0
- package/components/radiobutton/RadioCardGroup.js.map +1 -0
- package/components/releaseNotes/ReleaseNotes.d.ts +0 -3
- package/components/releaseNotes/ReleaseNotes.js.map +1 -1
- package/components/resizer/Resizer.d.ts +17 -3
- package/components/resizer/Resizer.js +1 -1
- package/components/resizer/Resizer.js.map +1 -1
- package/components/responsiveColumnStripe/ResponsiveColumnStripe.js +1 -1
- package/components/responsiveColumnStripe/ResponsiveColumnStripe.js.map +1 -1
- package/components/rioglyph/Rioglyph.d.ts +20 -8
- package/components/rioglyph/Rioglyph.js +1 -1
- package/components/rioglyph/Rioglyph.js.map +1 -1
- package/components/rioglyph/RioglyphIconType.d.ts +1 -1
- package/components/rules/RuleConnector.js +1 -1
- package/components/rules/RuleConnector.js.map +1 -1
- package/components/rules/RuleContainer.js +27 -27
- package/components/rules/RuleContainer.js.map +1 -1
- package/components/rules/RulesWrapper.js +1 -1
- package/components/rules/RulesWrapper.js.map +1 -1
- package/components/saveableInput/SaveableDateInput.d.ts +20 -2
- package/components/saveableInput/SaveableDateInput.js +1 -1
- package/components/saveableInput/SaveableDateInput.js.map +1 -1
- package/components/saveableInput/SaveableInput.d.ts +10 -2
- package/components/saveableInput/SaveableInput.js +49 -49
- package/components/saveableInput/SaveableInput.js.map +1 -1
- package/components/searchHighlight/SearchHighlightText.d.ts +28 -0
- package/components/searchHighlight/SearchHighlightText.js +15 -0
- package/components/searchHighlight/SearchHighlightText.js.map +1 -0
- package/components/selects/BaseSelectDropdown.js +90 -79
- package/components/selects/BaseSelectDropdown.js.map +1 -1
- package/components/selects/ClearButton.js +4 -4
- package/components/selects/ClearButton.js.map +1 -1
- package/components/selects/Multiselect.js +6 -6
- package/components/selects/Multiselect.js.map +1 -1
- package/components/selects/MultiselectToggleFilter.js +4 -4
- package/components/selects/MultiselectToggleFilter.js.map +1 -1
- package/components/selects/MultiselectToggleSelection.js +1 -1
- package/components/selects/MultiselectToggleSelection.js.map +1 -1
- package/components/selects/Select.d.ts +5 -0
- package/components/selects/Select.js +93 -93
- package/components/selects/Select.js.map +1 -1
- package/components/selects/SelectFilter.js +1 -1
- package/components/selects/SelectFilter.js.map +1 -1
- package/components/selects/WithFeedbackAndAddon.js +1 -1
- package/components/selects/WithFeedbackAndAddon.js.map +1 -1
- package/components/sidebars/Sidebar.d.ts +19 -3
- package/components/sidebars/Sidebar.js +54 -54
- package/components/sidebars/Sidebar.js.map +1 -1
- package/components/sidebars/SidebarBackdrop.js +4 -4
- package/components/sidebars/SidebarBackdrop.js.map +1 -1
- package/components/sidebars/SidebarFooter.js +1 -1
- package/components/sidebars/SidebarFooter.js.map +1 -1
- package/components/sidebars/SidebarFullscreenToggle.js +4 -4
- package/components/sidebars/SidebarFullscreenToggle.js.map +1 -1
- package/components/slider/RangeSlider.d.ts +15 -0
- package/components/slider/RangeSlider.js +1 -1
- package/components/slider/RangeSlider.js.map +1 -1
- package/components/slider/Slider.d.ts +9 -0
- package/components/slider/Slider.js +1 -1
- package/components/slider/Slider.js.map +1 -1
- package/components/smoothScrollbars/SmoothScrollbars.d.ts +44 -0
- package/components/smoothScrollbars/SmoothScrollbars.js +1 -1
- package/components/smoothScrollbars/SmoothScrollbars.js.map +1 -1
- package/components/spinner/Spinner.d.ts +3 -3
- package/components/spinner/Spinner.js +5 -4
- package/components/spinner/Spinner.js.map +1 -1
- package/components/states/CustomState.d.ts +69 -1
- package/components/states/CustomState.js +1 -1
- package/components/states/CustomState.js.map +1 -1
- package/components/states/EmptyState.d.ts +1 -1
- package/components/states/EmptyState.js.map +1 -1
- package/components/states/ErrorState.d.ts +1 -1
- package/components/states/ErrorState.js.map +1 -1
- package/components/states/ForbiddenState.d.ts +1 -1
- package/components/states/ForbiddenState.js.map +1 -1
- package/components/states/MaintenanceState.d.ts +1 -1
- package/components/states/MaintenanceState.js.map +1 -1
- package/components/states/NotBookedState.d.ts +1 -1
- package/components/states/NotBookedState.js.map +1 -1
- package/components/states/NotFoundState.d.ts +1 -1
- package/components/states/NotFoundState.js.map +1 -1
- package/components/states/StateButton.js +1 -1
- package/components/states/StateButton.js.map +1 -1
- package/components/states/StateIcon.d.ts +14 -1
- package/components/states/StateIcon.js.map +1 -1
- package/components/statsWidget/StatsWidget.d.ts +2 -0
- package/components/statsWidget/StatsWidget.js +1 -1
- package/components/statsWidget/StatsWidget.js.map +1 -1
- package/components/statsWidget/StatsWidgetBody.d.ts +1 -0
- package/components/statsWidget/StatsWidgetBody.js +1 -1
- package/components/statsWidget/StatsWidgetBody.js.map +1 -1
- package/components/statsWidget/StatsWidgetFooter.js +1 -1
- package/components/statsWidget/StatsWidgetFooter.js.map +1 -1
- package/components/statsWidget/StatsWidgetHeader.js +1 -1
- package/components/statsWidget/StatsWidgetHeader.js.map +1 -1
- package/components/statsWidget/StatsWidgetNumber.d.ts +2 -0
- package/components/statsWidget/StatsWidgetNumber.js +2 -2
- package/components/statsWidget/StatsWidgetNumber.js.map +1 -1
- package/components/statsWidget/StatsWidgetSpacer.js +1 -1
- package/components/statsWidget/StatsWidgetSpacer.js.map +1 -1
- package/components/statsWidget/StatsWidgets.js +1 -1
- package/components/statsWidget/StatsWidgets.js.map +1 -1
- package/components/statusBar/StatusBar.d.ts +98 -3
- package/components/statusBar/StatusBar.js +24 -17
- package/components/statusBar/StatusBar.js.map +1 -1
- package/components/statusBar/StatusBarIcon.d.ts +2 -2
- package/components/statusBar/StatusBarIcon.js +4 -4
- package/components/statusBar/StatusBarIcon.js.map +1 -1
- package/components/statusBar/StatusBarLabel.d.ts +2 -2
- package/components/statusBar/StatusBarLabel.js +5 -7
- package/components/statusBar/StatusBarLabel.js.map +1 -1
- package/components/statusBar/StatusBarProgressBar.d.ts +1 -1
- package/components/statusBar/StatusBarProgressBar.js +1 -1
- package/components/statusBar/StatusBarProgressBar.js.map +1 -1
- package/components/steppedProgressBar/SteppedProgressBar.d.ts +1 -1
- package/components/steppedProgressBar/SteppedProgressBar.js +1 -1
- package/components/steppedProgressBar/SteppedProgressBar.js.map +1 -1
- package/components/switch/Switch.d.ts +28 -1
- package/components/switch/Switch.js +77 -35
- package/components/switch/Switch.js.map +1 -1
- package/components/table/SortArrowDown.d.ts +1 -1
- package/components/table/SortArrowDown.js.map +1 -1
- package/components/table/SortArrowUp.d.ts +1 -1
- package/components/table/SortArrowUp.js.map +1 -1
- package/components/table/TableCardsSorting.js +4 -4
- package/components/table/TableCardsSorting.js.map +1 -1
- package/components/table/TableHead.js +1 -1
- package/components/table/TableHead.js.map +1 -1
- package/components/table/TableSearch.js +1 -1
- package/components/table/TableSearch.js.map +1 -1
- package/components/table/TableSettingsColumnButtons.d.ts +1 -1
- package/components/table/TableSettingsColumnButtons.js +1 -1
- package/components/table/TableSettingsColumnButtons.js.map +1 -1
- package/components/table/TableSettingsColumnDetails.d.ts +1 -1
- package/components/table/TableSettingsColumnDetails.js +1 -1
- package/components/table/TableSettingsColumnDetails.js.map +1 -1
- package/components/table/TableSettingsDialog.d.ts +56 -1
- package/components/table/TableSettingsDialog.js +170 -144
- package/components/table/TableSettingsDialog.js.map +1 -1
- package/components/table/TableSettingsDialogFooter.js +9 -9
- package/components/table/TableSettingsDialogFooter.js.map +1 -1
- package/components/table/TableSettingsListContainer.d.ts +1 -1
- package/components/table/TableSettingsListContainer.js.map +1 -1
- package/components/table/TableSettingsListItem.d.ts +1 -1
- package/components/table/TableSettingsListItem.js +8 -8
- package/components/table/TableSettingsListItem.js.map +1 -1
- package/components/table/TableToolbar.js +1 -1
- package/components/table/TableToolbar.js.map +1 -1
- package/components/table/TableViewToggles.d.ts +21 -1
- package/components/table/TableViewToggles.js +1 -1
- package/components/table/TableViewToggles.js.map +1 -1
- package/components/tag/Tag.d.ts +7 -2
- package/components/tag/Tag.js +1 -1
- package/components/tag/Tag.js.map +1 -1
- package/components/tag/TagList.js +1 -1
- package/components/tag/TagList.js.map +1 -1
- package/components/tagManager/CustomSuggestionItem.js +1 -1
- package/components/tagManager/CustomSuggestionItem.js.map +1 -1
- package/components/tagManager/TagManager.d.ts +29 -2
- package/components/tagManager/TagManager.js +6 -6
- package/components/tagManager/TagManager.js.map +1 -1
- package/components/tagManager/TagManagerItemList.d.ts +1 -1
- package/components/tagManager/TagManagerItemList.js +1 -1
- package/components/tagManager/TagManagerItemList.js.map +1 -1
- package/components/teaser/Teaser.d.ts +57 -55
- package/components/teaser/Teaser.js +1 -1
- package/components/teaser/Teaser.js.map +1 -1
- package/components/teaser/TeaserContainer.d.ts +1 -1
- package/components/teaser/TeaserContainer.js +1 -1
- package/components/teaser/TeaserContainer.js.map +1 -1
- package/components/timepicker/TimePicker.d.ts +20 -0
- package/components/timepicker/TimePicker.js +153 -99
- package/components/timepicker/TimePicker.js.map +1 -1
- package/components/tooltip/SimpleTooltip.d.ts +22 -4
- package/components/tooltip/SimpleTooltip.js.map +1 -1
- package/components/tooltip/Tooltip.d.ts +22 -2
- package/components/tooltip/Tooltip.js +1 -1
- package/components/tooltip/Tooltip.js.map +1 -1
- package/components/tracker/Tracker.d.ts +85 -0
- package/components/tracker/Tracker.js +54 -0
- package/components/tracker/Tracker.js.map +1 -0
- package/components/tracker/TrackerBlock.d.ts +11 -0
- package/components/tracker/TrackerBlock.js +34 -0
- package/components/tracker/TrackerBlock.js.map +1 -0
- package/components/video/ResponsiveVideo.d.ts +8 -3
- package/components/video/ResponsiveVideo.js +1 -1
- package/components/video/ResponsiveVideo.js.map +1 -1
- package/hooks/useCookies.d.ts +79 -0
- package/hooks/useCookies.js +33 -0
- package/hooks/useCookies.js.map +1 -0
- package/hooks/useInterval.js +5 -5
- package/hooks/useInterval.js.map +1 -1
- package/hooks/useIsFocusWithin.js +3 -3
- package/hooks/useIsFocusWithin.js.map +1 -1
- package/hooks/useKey.d.ts +1 -1
- package/hooks/useKey.js.map +1 -1
- package/hooks/useLatest.d.ts +16 -0
- package/hooks/useLatest.js +11 -0
- package/hooks/useLatest.js.map +1 -0
- package/hooks/useOnboarding.d.ts +86 -80
- package/hooks/useOnboarding.js.map +1 -1
- package/hooks/usePostMessage.d.ts +2 -1
- package/hooks/usePostMessage.js.map +1 -1
- package/hooks/useRioCookieConsent.d.ts +49 -0
- package/hooks/useRioCookieConsent.js +44 -0
- package/hooks/useRioCookieConsent.js.map +1 -0
- package/hooks/useSearch.d.ts +1 -1
- package/hooks/useSearch.js +28 -17
- package/hooks/useSearch.js.map +1 -1
- package/hooks/useSearchHighlight.d.ts +60 -0
- package/hooks/useSearchHighlight.js +54 -0
- package/hooks/useSearchHighlight.js.map +1 -0
- package/hooks/useTableExport.js.map +1 -1
- package/hooks/useTimeout.js +11 -11
- package/hooks/useTimeout.js.map +1 -1
- package/hooks/useUncontrollable.d.ts +1 -1
- package/hooks/useUncontrollable.js.map +1 -1
- package/hooks/useUrlState.d.ts +62 -0
- package/hooks/useUrlState.js +137 -0
- package/hooks/useUrlState.js.map +1 -0
- package/mergeClassNameOverrides.d.ts +1 -0
- package/mergeClassNameOverrides.js +5 -0
- package/mergeClassNameOverrides.js.map +1 -0
- package/package.json +18 -21
- package/routeUtils.js +11 -5
- package/routeUtils.js.map +1 -1
- package/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js +1 -1
- package/themes/Volkswagen/components/applicationHeader/VolkswagenApplicationHeader.js.map +1 -1
- package/useCookies.d.ts +2 -0
- package/useCookies.js +5 -0
- package/useCookies.js.map +1 -0
- package/useRioCookieConsent.d.ts +2 -0
- package/useRioCookieConsent.js +5 -0
- package/useRioCookieConsent.js.map +1 -0
- package/useSearchHighlight.d.ts +2 -0
- package/useSearchHighlight.js +6 -0
- package/useSearchHighlight.js.map +1 -0
- package/useUrlState.d.ts +2 -0
- package/useUrlState.js +5 -0
- package/useUrlState.js.map +1 -0
- package/utils/classNames.d.ts +3 -0
- package/utils/classNames.js +5 -0
- package/utils/classNames.js.map +1 -0
- package/utils/colorScheme.js +14 -13
- package/utils/colorScheme.js.map +1 -1
- package/utils/cssuseragent.js.map +1 -1
- package/utils/mergeClassNameOverrides.d.ts +1 -0
- package/utils/mergeClassNameOverrides.js +55 -0
- package/utils/mergeClassNameOverrides.js.map +1 -0
- package/utils/routeUtils.d.ts +122 -13
- package/utils/routeUtils.js +89 -31
- package/utils/routeUtils.js.map +1 -1
- package/utils/scrollItemIntoView.js +12 -11
- package/utils/scrollItemIntoView.js.map +1 -1
- package/utils/urlFeatureToggles.js +19 -20
- package/utils/urlFeatureToggles.js.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/components/states/BaseStateProps.d.ts +0 -66
- package/components/statusBar/StatusBar.types.d.ts +0 -85
- package/components/table/TableSettingsDialog.types.d.ts +0 -39
- package/components/tagManager/TagManagerTag.d.ts +0 -5
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { jsxs as x, jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { useId as _, useMemo as L } from "react";
|
|
3
|
+
import q from "../../utils/classNames.js";
|
|
4
|
+
import { useReducedMotion as G } from "../../node_modules/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion.js";
|
|
5
|
+
import { motion as z } from "../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
|
|
6
|
+
const k = (e, r, n) => Math.min(n, Math.max(r, e)), H = (e) => {
|
|
7
|
+
switch (e) {
|
|
8
|
+
case "xs":
|
|
9
|
+
return 32;
|
|
10
|
+
case "sm":
|
|
11
|
+
return 48;
|
|
12
|
+
case "lg":
|
|
13
|
+
return 80;
|
|
14
|
+
case "xl":
|
|
15
|
+
return 120;
|
|
16
|
+
default:
|
|
17
|
+
return 64;
|
|
18
|
+
}
|
|
19
|
+
}, J = (e) => {
|
|
20
|
+
switch (e) {
|
|
21
|
+
case "success":
|
|
22
|
+
return "var(--brand-success)";
|
|
23
|
+
case "info":
|
|
24
|
+
return "var(--brand-info)";
|
|
25
|
+
case "warning":
|
|
26
|
+
return "var(--brand-warning)";
|
|
27
|
+
case "danger":
|
|
28
|
+
return "var(--brand-danger)";
|
|
29
|
+
case "secondary":
|
|
30
|
+
return "var(--brand-secondary)";
|
|
31
|
+
case "default":
|
|
32
|
+
return "var(--gray)";
|
|
33
|
+
case "white":
|
|
34
|
+
return "var(--color-white)";
|
|
35
|
+
default:
|
|
36
|
+
return "var(--brand-primary)";
|
|
37
|
+
}
|
|
38
|
+
}, K = (e) => {
|
|
39
|
+
switch (e) {
|
|
40
|
+
case "decent":
|
|
41
|
+
return "var(--gray-decent)";
|
|
42
|
+
case "lightest":
|
|
43
|
+
return "var(--gray-lightest)";
|
|
44
|
+
case "lighter":
|
|
45
|
+
return "var(--gray-lighter)";
|
|
46
|
+
case "light":
|
|
47
|
+
return "var(--gray-light)";
|
|
48
|
+
case "gray":
|
|
49
|
+
return "var(--gray)";
|
|
50
|
+
case "dark":
|
|
51
|
+
return "var(--gray-dark)";
|
|
52
|
+
case "darker":
|
|
53
|
+
return "var(--gray-darker)";
|
|
54
|
+
case "darkest":
|
|
55
|
+
return "var(--gray-darkest)";
|
|
56
|
+
case "white":
|
|
57
|
+
return "var(--color-white)";
|
|
58
|
+
}
|
|
59
|
+
}, Q = (e, r, n, h) => {
|
|
60
|
+
const u = {
|
|
61
|
+
maximumFractionDigits: 0,
|
|
62
|
+
...h
|
|
63
|
+
}, t = new Intl.NumberFormat(void 0, u);
|
|
64
|
+
if (u.style === "percent") {
|
|
65
|
+
const i = n - r, m = i === 0 ? 0 : (e - r) / i;
|
|
66
|
+
return t.format(k(m, 0, 1));
|
|
67
|
+
}
|
|
68
|
+
return t.format(e);
|
|
69
|
+
}, oe = (e) => {
|
|
70
|
+
const {
|
|
71
|
+
label: r,
|
|
72
|
+
size: n = "md",
|
|
73
|
+
color: h = "primary",
|
|
74
|
+
value: u = 0,
|
|
75
|
+
valueLabel: t,
|
|
76
|
+
minValue: i = 0,
|
|
77
|
+
maxValue: m = 100,
|
|
78
|
+
formatOptions: b,
|
|
79
|
+
isIndeterminate: s = !1,
|
|
80
|
+
showValueLabel: w = !0,
|
|
81
|
+
strokeWidth: c = 8,
|
|
82
|
+
trackColor: O = "lighter",
|
|
83
|
+
trackClassName: R,
|
|
84
|
+
disableAnimation: S = !1,
|
|
85
|
+
animationDelay: N = 0,
|
|
86
|
+
className: B,
|
|
87
|
+
ringWrapClassName: F,
|
|
88
|
+
valueLabelClassName: T,
|
|
89
|
+
labelClassName: j
|
|
90
|
+
} = e, I = `circular-progress-label-${_()}`, A = G(), f = !(S || A), g = H(n), C = J(h), W = K(O), a = Math.min(i, m), o = Math.max(i, m), l = k(u, a, o), { radius: p, circumference: M, strokeDasharray: $, strokeDashoffset: E, ratio: X } = L(() => {
|
|
91
|
+
const D = (100 - c) / 2, y = 2 * Math.PI * D, P = o - a, Y = P === 0 ? 0 : (l - a) / P, V = k(Y, 0, 1);
|
|
92
|
+
return {
|
|
93
|
+
radius: D,
|
|
94
|
+
circumference: y,
|
|
95
|
+
strokeDasharray: y,
|
|
96
|
+
strokeDashoffset: y * (1 - V),
|
|
97
|
+
ratio: V
|
|
98
|
+
};
|
|
99
|
+
}, [o, a, l, c]), v = L(() => w ? t || Q(l, a, o, b) : null, [b, o, a, l, w, t]);
|
|
100
|
+
return /* @__PURE__ */ x(
|
|
101
|
+
"div",
|
|
102
|
+
{
|
|
103
|
+
className: `display-flex flex-column align-items-center text-center gap-10 ${B ?? ""}`,
|
|
104
|
+
"aria-labelledby": r ? I : void 0,
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ x(
|
|
107
|
+
"div",
|
|
108
|
+
{
|
|
109
|
+
className: F ?? "",
|
|
110
|
+
role: "progressbar",
|
|
111
|
+
"aria-busy": s || void 0,
|
|
112
|
+
"aria-valuemin": s ? void 0 : a,
|
|
113
|
+
"aria-valuemax": s ? void 0 : o,
|
|
114
|
+
"aria-valuenow": s ? void 0 : l,
|
|
115
|
+
"aria-valuetext": !s && typeof v == "string" ? v : void 0,
|
|
116
|
+
style: {
|
|
117
|
+
width: g,
|
|
118
|
+
height: g,
|
|
119
|
+
position: "relative",
|
|
120
|
+
display: "grid",
|
|
121
|
+
placeItems: "center"
|
|
122
|
+
},
|
|
123
|
+
children: [
|
|
124
|
+
/* @__PURE__ */ x("svg", { width: g, height: g, viewBox: "0 0 100 100", style: { transform: "rotate(-90deg)" }, children: [
|
|
125
|
+
/* @__PURE__ */ d(
|
|
126
|
+
"circle",
|
|
127
|
+
{
|
|
128
|
+
cx: "50",
|
|
129
|
+
cy: "50",
|
|
130
|
+
r: p,
|
|
131
|
+
fill: "none",
|
|
132
|
+
stroke: W,
|
|
133
|
+
strokeWidth: c,
|
|
134
|
+
className: R ?? ""
|
|
135
|
+
}
|
|
136
|
+
),
|
|
137
|
+
s ? /* @__PURE__ */ d(
|
|
138
|
+
z.circle,
|
|
139
|
+
{
|
|
140
|
+
cx: "50",
|
|
141
|
+
cy: "50",
|
|
142
|
+
r: p,
|
|
143
|
+
fill: "none",
|
|
144
|
+
stroke: C,
|
|
145
|
+
strokeWidth: c,
|
|
146
|
+
strokeLinecap: "round",
|
|
147
|
+
strokeDasharray: M * 0.35,
|
|
148
|
+
strokeDashoffset: 0,
|
|
149
|
+
animate: f ? { rotate: 360 } : void 0,
|
|
150
|
+
transition: f ? {
|
|
151
|
+
repeat: Number.POSITIVE_INFINITY,
|
|
152
|
+
ease: "linear",
|
|
153
|
+
duration: 1,
|
|
154
|
+
delay: N
|
|
155
|
+
} : void 0,
|
|
156
|
+
style: { transformOrigin: "50px 50px" }
|
|
157
|
+
}
|
|
158
|
+
) : /* @__PURE__ */ d(
|
|
159
|
+
z.circle,
|
|
160
|
+
{
|
|
161
|
+
cx: "50",
|
|
162
|
+
cy: "50",
|
|
163
|
+
r: p,
|
|
164
|
+
fill: "none",
|
|
165
|
+
stroke: C,
|
|
166
|
+
strokeWidth: c,
|
|
167
|
+
strokeLinecap: "round",
|
|
168
|
+
strokeDasharray: $,
|
|
169
|
+
initial: f ? { strokeDashoffset: M } : !1,
|
|
170
|
+
animate: { strokeDashoffset: E },
|
|
171
|
+
transition: f ? { duration: 0.6, ease: "easeOut", delay: N } : void 0
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
] }),
|
|
175
|
+
v != null && /* @__PURE__ */ d(
|
|
176
|
+
"div",
|
|
177
|
+
{
|
|
178
|
+
className: q(
|
|
179
|
+
"position-absolute",
|
|
180
|
+
"display-grid place-items-center",
|
|
181
|
+
T
|
|
182
|
+
),
|
|
183
|
+
children: v
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
),
|
|
189
|
+
r != null && /* @__PURE__ */ d("div", { id: I, className: j ?? "", children: r })
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
);
|
|
193
|
+
};
|
|
194
|
+
export {
|
|
195
|
+
oe as default
|
|
196
|
+
};
|
|
197
|
+
//# sourceMappingURL=CircularProgress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CircularProgress.js","sources":["../../../src/components/circularProgress/CircularProgress.tsx"],"sourcesContent":["import { useId, useMemo } from 'react';\nimport { motion, useReducedMotion } from 'framer-motion';\n\nimport classNames from '../../utils/classNames';\n\nexport type CircularProgressColor =\n | 'default'\n | 'primary'\n | 'secondary'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger'\n | 'white';\n\nexport type CircularProgressSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\nexport type CircularProgressTrackColor =\n | 'decent'\n | 'lightest'\n | 'lighter'\n | 'light'\n | 'gray'\n | 'dark'\n | 'darker'\n | 'darkest'\n | 'white';\n\nexport type CircularProgressProps = {\n /**\n * Optional text or node shown below the ring.\n */\n label?: React.ReactNode;\n\n /**\n * Preset size for the component.\n *\n * Possible values are:\n *\n * - `'xs'`\n * - `'sm'`\n * - `'md'`\n * - `'lg'`\n * - `'xl'`\n *\n * @default 'md'\n */\n size?: CircularProgressSize;\n\n /**\n * Color preset for the progress ring.\n *\n * Possible values are:\n *\n * - `'default'`\n * - `'primary'`\n * - `'secondary'`\n * - `'info'`\n * - `'success'`\n * - `'warning'`\n * - `'danger'`\n * - `'white'`\n *\n * @default 'primary'\n */\n color?: CircularProgressColor;\n\n /**\n * Defaults to 0 to avoid indeterminate/spinner visuals.\n *\n * @default 0\n */\n value?: number;\n\n /**\n * Override the rendered value label content.\n */\n valueLabel?: React.ReactNode;\n\n /**\n * Minimum value for the range.\n *\n * @default 0\n */\n minValue?: number;\n\n /**\n * Maximum value for the range.\n *\n * @default 100\n */\n maxValue?: number;\n\n /**\n * Formatting for the visible value label.\n * - If style === \"percent\": formats ratio (value-min)/(max-min)\n * - Otherwise: formats the raw value (e.g. unit)\n */\n formatOptions?: Intl.NumberFormatOptions;\n\n /**\n * Indeterminate mode is opt-in. Animates the progress indefinitely.\n * May come in handy when the value still loads to prevent layout shifting.\n *\n * @default false\n */\n isIndeterminate?: boolean;\n\n /**\n * Toggles the value label in the center of the ring.\n *\n * @default true\n */\n showValueLabel?: boolean;\n\n /**\n * Stroke width used for the ring and track.\n *\n * @default 8\n */\n strokeWidth?: number;\n\n /**\n * Track color preset for the background ring.\n *\n * Possible values are:\n *\n * - `'decent'`\n * - `'lightest'`\n * - `'lighter'`\n * - `'light'`\n * - `'gray'`\n * - `'dark'`\n * - `'darker'`\n * - `'darkest'`\n * - `'white'`\n *\n * @default 'lighter'\n */\n trackColor?: CircularProgressTrackColor;\n\n /**\n * Class name for the track (background ring).\n */\n trackClassName?: string;\n\n /**\n * Disable motion even if the user allows animations.\n *\n * @default false\n */\n disableAnimation?: boolean;\n\n /**\n * Delay before the progress animation starts (in seconds).\n *\n * @default 0\n */\n animationDelay?: number;\n\n /**\n * Class name for the outer wrapper.\n */\n className?: string;\n\n /**\n * Class name for the ring wrapper.\n */\n ringWrapClassName?: string;\n\n /**\n * Class name for the center value label.\n */\n valueLabelClassName?: string;\n\n /**\n * Class name for the label under the ring.\n */\n labelClassName?: string;\n};\n\nconst clamp = (value: number, min: number, max: number) => Math.min(max, Math.max(min, value));\n\nconst getSizePx = (size: CircularProgressSize) => {\n switch (size) {\n case 'xs':\n return 32;\n case 'sm':\n return 48;\n case 'lg':\n return 80;\n case 'xl':\n return 120;\n default:\n return 64;\n }\n};\n\nconst getProgressColor = (color: CircularProgressColor) => {\n switch (color) {\n case 'success':\n return 'var(--brand-success)';\n case 'info':\n return 'var(--brand-info)';\n case 'warning':\n return 'var(--brand-warning)';\n case 'danger':\n return 'var(--brand-danger)';\n case 'secondary':\n return 'var(--brand-secondary)';\n case 'default':\n return 'var(--gray)';\n case 'white':\n return 'var(--color-white)';\n default:\n return 'var(--brand-primary)';\n }\n};\n\nconst getTrackColor = (trackColor: CircularProgressTrackColor) => {\n switch (trackColor) {\n case 'decent':\n return 'var(--gray-decent)';\n case 'lightest':\n return 'var(--gray-lightest)';\n case 'lighter':\n return 'var(--gray-lighter)';\n case 'light':\n return 'var(--gray-light)';\n case 'gray':\n return 'var(--gray)';\n case 'dark':\n return 'var(--gray-dark)';\n case 'darker':\n return 'var(--gray-darker)';\n case 'darkest':\n return 'var(--gray-darkest)';\n case 'white':\n return 'var(--color-white)';\n }\n};\n\nconst formatValue = (value: number, minValue: number, maxValue: number, formatOptions?: Intl.NumberFormatOptions) => {\n const options: Intl.NumberFormatOptions = {\n maximumFractionDigits: 0,\n ...formatOptions,\n };\n\n const formatter = new Intl.NumberFormat(undefined, options);\n\n if (options.style === 'percent') {\n const denom = maxValue - minValue;\n const ratio = denom === 0 ? 0 : (value - minValue) / denom;\n return formatter.format(clamp(ratio, 0, 1));\n }\n\n return formatter.format(value);\n};\n\nconst CircularProgress = (props: CircularProgressProps) => {\n const {\n label,\n size = 'md',\n color = 'primary',\n\n value: valueProp = 0,\n valueLabel,\n\n minValue = 0,\n maxValue = 100,\n\n formatOptions,\n isIndeterminate = false,\n showValueLabel = true,\n\n strokeWidth = 8,\n trackColor = 'lighter',\n trackClassName,\n\n disableAnimation = false,\n animationDelay = 0,\n\n className,\n ringWrapClassName,\n valueLabelClassName,\n labelClassName,\n } = props;\n\n const reactId = useId();\n const labelId = `circular-progress-label-${reactId}`;\n\n const prefersReducedMotion = useReducedMotion();\n const shouldAnimate = !(disableAnimation || prefersReducedMotion);\n\n const sizePx = getSizePx(size);\n const progressColor = getProgressColor(color);\n const trackColorValue = getTrackColor(trackColor);\n\n const safeMin = Math.min(minValue, maxValue);\n const safeMax = Math.max(minValue, maxValue);\n const safeValue = clamp(valueProp, safeMin, safeMax);\n\n const { radius, circumference, strokeDasharray, strokeDashoffset, ratio } = useMemo(() => {\n const viewBoxSize = 100;\n const r = (viewBoxSize - strokeWidth) / 2;\n const c = 2 * Math.PI * r;\n\n const denom = safeMax - safeMin;\n const progressRatio = denom === 0 ? 0 : (safeValue - safeMin) / denom;\n const clampedRatio = clamp(progressRatio, 0, 1);\n\n return {\n radius: r,\n circumference: c,\n strokeDasharray: c,\n strokeDashoffset: c * (1 - clampedRatio),\n ratio: clampedRatio,\n };\n }, [safeMax, safeMin, safeValue, strokeWidth]);\n\n const computedValueLabel = useMemo(() => {\n if (!showValueLabel) {\n return null;\n }\n if (valueLabel) {\n return valueLabel;\n }\n return formatValue(safeValue, safeMin, safeMax, formatOptions);\n }, [formatOptions, safeMax, safeMin, safeValue, showValueLabel, valueLabel]);\n\n return (\n <div\n className={`display-flex flex-column align-items-center text-center gap-10 ${className ?? ''}`}\n aria-labelledby={label ? labelId : undefined}\n >\n <div\n className={ringWrapClassName ?? ''}\n role='progressbar'\n aria-busy={isIndeterminate || undefined}\n aria-valuemin={!isIndeterminate ? safeMin : undefined}\n aria-valuemax={!isIndeterminate ? safeMax : undefined}\n aria-valuenow={!isIndeterminate ? safeValue : undefined}\n aria-valuetext={\n !isIndeterminate && typeof computedValueLabel === 'string' ? computedValueLabel : undefined\n }\n style={{\n width: sizePx,\n height: sizePx,\n position: 'relative',\n display: 'grid',\n placeItems: 'center',\n }}\n >\n <svg width={sizePx} height={sizePx} viewBox='0 0 100 100' style={{ transform: 'rotate(-90deg)' }}>\n <circle\n cx='50'\n cy='50'\n r={radius}\n fill='none'\n stroke={trackColorValue}\n strokeWidth={strokeWidth}\n className={trackClassName ?? ''}\n />\n\n {isIndeterminate ? (\n <motion.circle\n cx='50'\n cy='50'\n r={radius}\n fill='none'\n stroke={progressColor}\n strokeWidth={strokeWidth}\n strokeLinecap='round'\n strokeDasharray={circumference * 0.35}\n strokeDashoffset={0}\n animate={shouldAnimate ? { rotate: 360 } : undefined}\n transition={\n shouldAnimate\n ? {\n repeat: Number.POSITIVE_INFINITY,\n ease: 'linear',\n duration: 1,\n delay: animationDelay,\n }\n : undefined\n }\n style={{ transformOrigin: '50px 50px' }}\n />\n ) : (\n <motion.circle\n cx='50'\n cy='50'\n r={radius}\n fill='none'\n stroke={progressColor}\n strokeWidth={strokeWidth}\n strokeLinecap='round'\n strokeDasharray={strokeDasharray}\n initial={shouldAnimate ? { strokeDashoffset: circumference } : false}\n animate={{ strokeDashoffset }}\n transition={\n shouldAnimate ? { duration: 0.6, ease: 'easeOut', delay: animationDelay } : undefined\n }\n />\n )}\n </svg>\n\n {computedValueLabel != null && (\n <div\n className={classNames(\n 'position-absolute',\n 'display-grid place-items-center',\n valueLabelClassName\n )}\n >\n {computedValueLabel}\n </div>\n )}\n </div>\n\n {label != null && (\n <div id={labelId} className={labelClassName ?? ''}>\n {label}\n </div>\n )}\n </div>\n );\n};\n\nexport default CircularProgress;\n"],"names":["clamp","value","min","max","getSizePx","size","getProgressColor","color","getTrackColor","trackColor","formatValue","minValue","maxValue","formatOptions","options","formatter","denom","ratio","CircularProgress","props","label","valueProp","valueLabel","isIndeterminate","showValueLabel","strokeWidth","trackClassName","disableAnimation","animationDelay","className","ringWrapClassName","valueLabelClassName","labelClassName","labelId","useId","prefersReducedMotion","useReducedMotion","shouldAnimate","sizePx","progressColor","trackColorValue","safeMin","safeMax","safeValue","radius","circumference","strokeDasharray","strokeDashoffset","useMemo","r","c","progressRatio","clampedRatio","computedValueLabel","jsxs","jsx","motion","classNames"],"mappings":";;;;;AAqLA,MAAMA,IAAQ,CAACC,GAAeC,GAAaC,MAAgB,KAAK,IAAIA,GAAK,KAAK,IAAID,GAAKD,CAAK,CAAC,GAEvFG,IAAY,CAACC,MAA+B;AAC9C,UAAQA,GAAA;AAAA,IACJ,KAAK;AACD,aAAO;AAAA,IACX,KAAK;AACD,aAAO;AAAA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A,oBAClB,SAASR,IAAgB,EAAE,QAAQ,QAAQ;AAAA,oBAC3C,YACIA,IACM;AAAA,sBACI,QAAQ,OAAO;AAAA,sBACf,MAAM;AAAA,sBACN,UAAU;AAAA,sBACV,OAAOT;AAAA,oBAAA,IAEX;AAAA,oBAEV,OAAO,EAAE,iBAAiB,YAAA;AAAA,kBAAY;AAAA,gBAAA,IAG1C,gBAAA2B;AAAA,kBAACC,EAAO;AAAA,kBAAP;AAAA,oBACG,IAAG;AAAA,oBACH,IAAG;AAAA,oBACH,GAAGZ;AAAA,oBACH,MAAK;AAAA,oBACL,QAAQL;AAAA,oBACR,aAAAd;AAAA,oBACA,eAAc;AAAA,oBACd,iBAAAqB;AAAA,oBACA,SAAST,IAAgB,EAAE,kBAAkBQ,MAAkB;AAAA,oBAC/D,SAAS,EAAE,kBAAAE,EAAA;AAAA,oBACX,YACIV,IAAgB,EAAE,UAAU,KAAK,MAAM,WAAW,OAAOT,MAAmB;AAAA,kBAAA;AAAA,gBAAA;AAAA,cAEpF,GAER;AAAA,cAECyB,KAAsB,QACnB,gBAAAE;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACG,WAAWE;AAAA,oBACP;AAAA,oBACA;AAAA,oBACA1B;AAAA,kBAAA;AAAA,kBAGH,UAAAsB;AAAA,gBAAA;AAAA,cAAA;AAAA,YACL;AAAA,UAAA;AAAA,QAAA;AAAA,QAIPjC,KAAS,QACN,gBAAAmC,EAAC,OAAA,EAAI,IAAItB,GAAS,WAAWD,KAAkB,IAC1C,UAAAZ,EAAA,CACL;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIhB;"}
|
|
@@ -26,6 +26,8 @@ export type ClearableInputProps = {
|
|
|
26
26
|
*
|
|
27
27
|
* There are three types supported:
|
|
28
28
|
* `text`, `email`, `password`.
|
|
29
|
+
*
|
|
30
|
+
* @default 'text'
|
|
29
31
|
*/
|
|
30
32
|
type?: 'text' | 'password' | 'email';
|
|
31
33
|
/**
|
|
@@ -44,10 +46,14 @@ export type ClearableInputProps = {
|
|
|
44
46
|
maxLength?: number;
|
|
45
47
|
/**
|
|
46
48
|
* Defines the tab index to be added to the input element.
|
|
49
|
+
*
|
|
50
|
+
* @default 0
|
|
47
51
|
*/
|
|
48
52
|
tabIndex?: number;
|
|
49
53
|
/**
|
|
50
54
|
* Defined whether or not the input has the error styling.
|
|
55
|
+
*
|
|
56
|
+
* @default false
|
|
51
57
|
*/
|
|
52
58
|
hasError?: boolean;
|
|
53
59
|
/**
|
|
@@ -106,21 +112,16 @@ export type ClearableInputProps = {
|
|
|
106
112
|
*
|
|
107
113
|
* The following characters will define mask format:
|
|
108
114
|
*
|
|
109
|
-
* "0" = allowed input: "0-9" (digit)
|
|
110
|
-
*
|
|
111
|
-
* "
|
|
112
|
-
*
|
|
113
|
-
* "*" = allowed input: any character
|
|
114
|
-
*
|
|
115
|
-
* "#" = allowed input: "0-9, a-z, A-Z" (digit or letter)
|
|
115
|
+
* - "0" = allowed input: "0-9" (digit)
|
|
116
|
+
* - "a" = allowed input: "a-z, A-Z" (letter)
|
|
117
|
+
* - "*" = allowed input: any character
|
|
118
|
+
* - "#" = allowed input: "0-9, a-z, A-Z" (digit or letter)
|
|
116
119
|
*
|
|
117
120
|
* Other chars which is not in custom definitions supposed to be fixed:
|
|
118
121
|
*
|
|
119
|
-
* [] - make input optional
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
* ` - prevent symbols shift back
|
|
122
|
+
* - [] - make input optional
|
|
123
|
+
* - {} - include fixed part in unmasked value
|
|
124
|
+
* - ` - prevent symbols shift back
|
|
124
125
|
*
|
|
125
126
|
* If definition character should be treated as fixed it should be escaped by \\ (E.g. \\0).
|
|
126
127
|
*
|
|
@@ -149,8 +150,9 @@ export type ClearableInputProps = {
|
|
|
149
150
|
maskDispatch?: (appended: string, dynamicMasked: any) => any;
|
|
150
151
|
/**
|
|
151
152
|
* Controls when the mask pattern is visible.
|
|
153
|
+
*
|
|
152
154
|
* - 'always': Mask is always visible
|
|
153
|
-
* - 'onFocus': Mask is hidden but shown when input is focused
|
|
155
|
+
* - 'onFocus': Mask is hidden but shown when input is focused
|
|
154
156
|
* - 'never': Mask is never shown
|
|
155
157
|
*
|
|
156
158
|
* @default 'always'
|
|
@@ -188,15 +190,14 @@ export type ClearableInputProps = {
|
|
|
188
190
|
* Additional classes to be set on the wrapper element.
|
|
189
191
|
*/
|
|
190
192
|
className?: string;
|
|
191
|
-
};
|
|
192
|
-
type ChildrenProp = {
|
|
193
193
|
/**
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
194
|
+
* Render-prop to customize the rendered input.
|
|
195
|
+
*
|
|
196
|
+
* The function gets the `inputProps` passed and is responsible for rendering the custom `<input>` component.
|
|
197
|
+
*
|
|
198
|
+
* Receives the computed `input` props so you can render your own field. See: {@link https://reactjs.org/docs/render-props.html}
|
|
198
199
|
*/
|
|
199
200
|
children?: (props: React.InputHTMLAttributes<HTMLInputElement>) => React.ReactNode;
|
|
200
201
|
};
|
|
201
|
-
declare const ClearableInput: React.ForwardRefExoticComponent<ClearableInputProps &
|
|
202
|
+
declare const ClearableInput: React.ForwardRefExoticComponent<ClearableInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
202
203
|
export default ClearableInput;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs as ue, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as ce, useState as d, useRef as pe } from "react";
|
|
3
|
-
import h from "classnames";
|
|
4
3
|
import { omit as me, isEmpty as fe } from "es-toolkit/compat";
|
|
5
4
|
import { isNil as de, isFunction as he } from "es-toolkit/predicate";
|
|
6
5
|
import { noop as t } from "es-toolkit/function";
|
|
7
6
|
import { IMaskInput as ge } from "react-imask";
|
|
7
|
+
import h from "../../utils/classNames.js";
|
|
8
8
|
import ve from "../../hooks/usePrevious.js";
|
|
9
9
|
import Ce from "../../hooks/useMergeRefs.js";
|
|
10
10
|
const R = "text", ke = ["text", "password", "email"], T = (u) => !fe(`${u}`), Te = ce((u, g) => {
|
|
@@ -18,11 +18,11 @@ const R = "text", ke = ["text", "password", "email"], T = (u) => !fe(`${u}`), Te
|
|
|
18
18
|
inputRef: v,
|
|
19
19
|
autoComplete: O,
|
|
20
20
|
onChange: n = t,
|
|
21
|
-
onBlur:
|
|
22
|
-
onFocus:
|
|
21
|
+
onBlur: _ = t,
|
|
22
|
+
onFocus: j = t,
|
|
23
23
|
onClear: C = t,
|
|
24
|
-
onKeyPress:
|
|
25
|
-
onClick:
|
|
24
|
+
onKeyPress: A = t,
|
|
25
|
+
onClick: K = t,
|
|
26
26
|
mask: k,
|
|
27
27
|
maskPlaceholder: U = "_",
|
|
28
28
|
maskVisibility: Y = "always",
|
|
@@ -75,11 +75,11 @@ const R = "text", ke = ["text", "password", "email"], T = (u) => !fe(`${u}`), Te
|
|
|
75
75
|
};
|
|
76
76
|
f.target.unmaskedValue = a.unmaskedValue, x || l(e), n(e, f);
|
|
77
77
|
}, ee = (e) => {
|
|
78
|
-
V(!0),
|
|
78
|
+
V(!0), j(e);
|
|
79
79
|
}, te = (e) => {
|
|
80
|
-
V(!1),
|
|
80
|
+
V(!1), _(e);
|
|
81
81
|
}, se = (e) => {
|
|
82
|
-
|
|
82
|
+
A(e);
|
|
83
83
|
}, ne = (e) => {
|
|
84
84
|
l(""), n("", e), C && C(e);
|
|
85
85
|
}, ae = h(
|
|
@@ -105,7 +105,7 @@ const R = "text", ke = ["text", "password", "email"], T = (u) => !fe(`${u}`), Te
|
|
|
105
105
|
onFocus: ee,
|
|
106
106
|
onChange: r ? void 0 : X,
|
|
107
107
|
// In case of masked input, the onAccept callback is used
|
|
108
|
-
onClick:
|
|
108
|
+
onClick: K,
|
|
109
109
|
disabled: c,
|
|
110
110
|
maxLength: r ? void 0 : M,
|
|
111
111
|
tabIndex: S
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClearableInput.js","sources":["../../../src/components/clearableInput/ClearableInput.tsx"],"sourcesContent":["/** biome-ignore-all lint/complexity/noBannedTypes: <explanation> */\nimport React, { useState, forwardRef, type ForwardedRef, useRef } from 'react';\nimport classNames from 'classnames';\nimport { isEmpty, omit } from 'es-toolkit/compat';\nimport { isFunction, isNil } from 'es-toolkit/predicate';\nimport { noop } from 'es-toolkit/function';\nimport { IMaskInput } from 'react-imask';\n\nimport usePrevious from '../../hooks/usePrevious';\nimport useMergeRefs from '../../hooks/useMergeRefs';\n\nexport const DEFAULT_TYPE = 'text';\nexport const SUPPORTED_TYPES = ['text', 'password', 'email'];\n\nexport type MaskVisibility = 'always' | 'onFocus' | 'never';\nexport type MaskDefinition = {\n mask: string;\n definitions?: Record<string, string | RegExp>;\n startsWith?: string;\n [key: string]: any;\n};\n\nexport type ClearableInputProps = {\n /**\n * Gives the input element the id.\n */\n id?: string;\n\n /**\n * Gives the input element a name.\n */\n name?: string;\n\n /**\n * The translated text that shall be shown when the input is empty.\n */\n placeholder?: string | React.ReactNode;\n\n /**\n * Defines the type of the input itself.\n *\n * There are three types supported:\n * `text`, `email`, `password`.\n */\n type?: 'text' | 'password' | 'email';\n\n /**\n * Initial value of the ClearableInput. Pass this prop if you want to use this\n * component as an uncontrolled component.\n */\n defaultValue?: string;\n\n /**\n * Value of the ClearableInput. Pass this prop if you want to use this\n * component as a controlled component.\n */\n value?: string;\n\n /**\n * Defines the maximum amount of characters that can be entered.\n */\n maxLength?: number;\n\n /**\n * Defines the tab index to be added to the input element.\n */\n tabIndex?: number;\n\n /**\n * Defined whether or not the input has the error styling.\n */\n hasError?: boolean;\n\n /**\n * The callback ref for the underlying input. Alternatively, use can use a forward ref.\n */\n inputRef?: React.RefObject<HTMLInputElement>;\n\n /**\n * Sets autocomplete value for autosuggest forms.\n */\n autoComplete?: string;\n\n /**\n * Callback function for when the value changes. Receives new value as an argument.\n * @param newValue\n * @param event\n * @returns\n */\n onChange?: (\n newValue: string,\n event: React.ChangeEvent<HTMLInputElement> | React.MouseEvent<HTMLSpanElement>\n ) => void;\n\n /**\n * Callback function which gets triggered when the input looses the focus.\n * @param event\n * @returns\n */\n onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;\n\n /**\n * Callback function which gets triggered when the input gains the focus.\n * @param event\n * @returns\n */\n onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;\n\n /**\n * Callback function for when the value is cleared via the clear button.\n * @param event\n * @returns\n */\n onClear?: (event: React.MouseEvent<HTMLSpanElement>) => void;\n\n /**\n * Callback function for every key pressed including `Enter` key.\n * @param event\n * @returns\n */\n onKeyPress?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n\n /**\n * Callback triggered when clicked into the input to react on it like when using an auto suggest dropdown\n * @param event\n * @returns\n */\n onClick?: (event: React.MouseEvent<HTMLInputElement>) => void;\n\n /**\n * The mask prop will allow to use the component with an input mask.\n * It defines the pattern that should be followed.\n *\n * For more details on masking, checkout the third party documentation for the\n * input mask here: {@link https://imask.js.org/guide.html}\n *\n * Simple masks can be defined as strings.\n *\n * The following characters will define mask format:\n *\n * \"0\" = allowed input: \"0-9\" (digit)\n *\n * \"a\" = allowed input: \"a-z, A-Z\" (letter)\n *\n * \"*\" = allowed input: any character\n *\n * \"#\" = allowed input: \"0-9, a-z, A-Z\" (digit or letter)\n *\n * Other chars which is not in custom definitions supposed to be fixed:\n *\n * [] - make input optional\n *\n * {} - include fixed part in unmasked value\n *\n * ` - prevent symbols shift back\n *\n * If definition character should be treated as fixed it should be escaped by \\\\ (E.g. \\\\0).\n *\n * Additionally you can provide custom definitions.\n *\n * @example\n * '-- ### ### ###' or '+49 00 000 00'\n */\n mask?: string | (string | RegExp)[] | RegExp | DateConstructor | number | Function | MaskDefinition[];\n\n /**\n * Placeholder to cover unfilled parts of the mask.\n *\n * @default '_'\n */\n maskPlaceholder?: string | null;\n\n /**\n * Enable characters overwriting\n *\n * @default true\n */\n maskOverwrite?: boolean | 'shift' | undefined;\n\n /**\n * Chooses the mask for dynamic masking depending on input value.\n * Note, this function may not be an empty function, otherwise the mask selection won't work\n */\n maskDispatch?: (appended: string, dynamicMasked: any) => any;\n\n /**\n * Controls when the mask pattern is visible.\n * - 'always': Mask is always visible\n * - 'onFocus': Mask is hidden but shown when input is focused (default)\n * - 'never': Mask is never shown\n *\n * @default 'always'\n */\n maskVisibility?: MaskVisibility;\n\n /**\n * Custom definitions to have more control over your mask. The defined character will be replaced in your mask.\n *\n * @example\n * mask='AAA AAA.AA'\n * maskDefinitions={{ A: /[A-Z0-9]/ }}\n */\n maskDefinitions?: Record<string, string | RegExp>;\n\n /**\n * Minimum value to be entered. This prop is extended to accept a Date\n * when used with an input mask.\n */\n min?: string | number | undefined | Date;\n\n /**\n * Maximum value to be entered. This prop is extended to accept a Date\n * when used with an input mask.\n */\n max?: string | number | undefined | Date;\n\n /**\n * Disabled the input component.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Additional classes to be set on the input element.\n */\n inputClassName?: string;\n\n /**\n * Additional classes to be set on the wrapper element.\n */\n className?: string;\n};\n\ntype ChildrenProp = {\n /**\n * Providing a function enables the render props approach. The function gets the input props\n * passed and is responsible for rendering the custom `input` component.\n * @param props\n * @returns\n */\n children?: (props: React.InputHTMLAttributes<HTMLInputElement>) => React.ReactNode;\n};\n\nconst hasValue = (value: unknown) => !isEmpty(`${value}`);\n\nconst ClearableInput = forwardRef((props: ClearableInputProps & ChildrenProp, ref: ForwardedRef<HTMLInputElement>) => {\n const {\n type = DEFAULT_TYPE,\n defaultValue,\n value,\n maxLength,\n tabIndex = 0,\n hasError = false,\n inputRef,\n autoComplete,\n onChange = noop,\n onBlur = noop,\n onFocus = noop,\n onClear = noop,\n onKeyPress = noop,\n onClick = noop,\n mask,\n maskPlaceholder = '_',\n maskVisibility = 'always',\n maskOverwrite = true,\n maskDefinitions,\n maskDispatch,\n inputClassName = '',\n disabled = false,\n className = '',\n children,\n ...remainingProps\n } = props;\n\n const initialValue = value || defaultValue || '';\n\n const [inputValue, setInputValue] = useState(initialValue);\n const [showClear, setShowClear] = useState(hasValue(initialValue));\n const [isFocused, setIsFocused] = useState(false);\n\n const isControlled = !isNil(value);\n\n const internalMaskRef = useRef<HTMLInputElement>(null);\n const mergedInternalMaskRef = useMergeRefs(internalMaskRef, inputRef, ref);\n\n const hasMask = !!mask;\n\n // Calculate if mask should be visible (lazy=false means visible, lazy=true means hidden)\n const shouldShowMask = () => {\n switch (maskVisibility) {\n case 'always':\n return true;\n case 'onFocus':\n return isFocused;\n case 'never':\n return false;\n default:\n return isFocused;\n }\n };\n\n // Handles new input value and saves it in the local state.\n // The value stored in the state is used for rendering.\n const changeInternalValue = (newValue = '') => {\n // this is there to prevent that onChange and UNSAFE_componentWillReceiveProps set state at the same time\n if (inputValue === newValue) {\n return;\n }\n\n setInputValue(newValue);\n setShowClear(hasValue(newValue));\n };\n\n // important for when used as a controlled component and value changes from the outside.\n const previousValue = usePrevious(value);\n if (previousValue !== value) {\n changeInternalValue(value);\n }\n\n // only gets triggered on user interaction.\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = event.target.value;\n\n if (isControlled) {\n onChange(newValue, event);\n } else {\n changeInternalValue(newValue);\n onChange(newValue, event);\n }\n };\n\n const handleAccept = (newValue: string, maskRef: any, event?: InputEvent) => {\n if (!internalMaskRef.current) {\n return;\n }\n\n // Simulate a ChangeEvent for backwards compatibility since react-imask does not return a change event itself\n const syntheticEvent = {\n target: internalMaskRef.current,\n currentTarget: internalMaskRef.current,\n // Standard synthetic event props\n bubbles: true,\n cancelable: true,\n defaultPrevented: false,\n isTrusted: true,\n preventDefault: () => {},\n stopPropagation: () => {},\n persist: () => {},\n nativeEvent: {} as any,\n type: 'change',\n timeStamp: Date.now(),\n } as unknown as React.ChangeEvent<HTMLInputElement>;\n\n // Set unmasked value manually if needed\n // (you can use data-attributes or attach it directly)\n (syntheticEvent.target as any).unmaskedValue = maskRef.unmaskedValue;\n\n if (isControlled) {\n onChange(newValue, syntheticEvent);\n } else {\n changeInternalValue(newValue);\n onChange(newValue, syntheticEvent);\n }\n };\n\n const handleInputFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(true);\n onFocus(event);\n };\n\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(false);\n onBlur(event);\n };\n\n // Will be triggered on every key press but also when pressing 'Enter' for example\n const handleKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyPress(event);\n };\n\n const clearInputValue = (event: React.MouseEvent<HTMLSpanElement>) => {\n changeInternalValue('');\n onChange('', event);\n\n if (onClear) {\n onClear(event);\n }\n };\n\n const classes = classNames(\n 'ClearableInput',\n 'input-group',\n hasError && 'has-error',\n disabled && 'pointer-events-none',\n className && className\n );\n\n const inputClassNames = classNames(\n 'form-control',\n inputClassName,\n showClear && 'withClearButton',\n hasMask && 'withInputMask',\n disabled && 'disabled'\n );\n\n const clearButtonClassNames = classNames('clearButton', !showClear && 'hide');\n\n const convertedType = type?.toLowerCase();\n const inputType = SUPPORTED_TYPES.indexOf(convertedType) !== -1 ? convertedType : DEFAULT_TYPE;\n\n const inputProps = {\n ...omit(remainingProps, ['value', 'defaultValue', 'onClear']),\n className: inputClassNames,\n autoComplete,\n type: inputType,\n value: inputValue,\n onKeyPress: handleKeyPress,\n onBlur: handleInputBlur,\n onFocus: handleInputFocus,\n onChange: hasMask ? undefined : handleChange, // In case of masked input, the onAccept callback is used\n onClick,\n disabled,\n maxLength: hasMask ? undefined : maxLength,\n tabIndex,\n } as any;\n\n // The dispatch function may not be an empty function. Specify it when\n // using dynamic masking and need more control over which mask gets selected\n const maskDispatchObj: any = {};\n if (maskDispatch) {\n maskDispatchObj.dispatch = maskDispatch;\n }\n\n const input = hasMask ? (\n <IMaskInput\n {...inputProps}\n inputRef={mergedInternalMaskRef}\n mask={mask}\n definitions={maskDefinitions}\n {...maskDispatchObj}\n placeholderChar={maskPlaceholder}\n onAccept={handleAccept}\n lazy={!shouldShowMask()}\n overwrite={maskOverwrite}\n />\n ) : (\n <input {...inputProps} ref={inputRef || ref} />\n );\n\n return (\n <div className={classes}>\n {children && isFunction(children) ? children(inputProps) : input}\n <span className={clearButtonClassNames} onClick={clearInputValue}>\n <span className='clearButtonIcon rioglyph rioglyph-remove-sign' />\n </span>\n </div>\n );\n});\n\nexport default ClearableInput;\n"],"names":["DEFAULT_TYPE","SUPPORTED_TYPES","hasValue","value","isEmpty","ClearableInput","forwardRef","props","ref","type","defaultValue","maxLength","tabIndex","hasError","inputRef","autoComplete","onChange","noop","onBlur","onFocus","onClear","onKeyPress","onClick","mask","maskPlaceholder","maskVisibility","maskOverwrite","maskDefinitions","maskDispatch","inputClassName","disabled","className","children","remainingProps","initialValue","inputValue","setInputValue","useState","showClear","setShowClear","isFocused","setIsFocused","isControlled","isNil","internalMaskRef","useRef","mergedInternalMaskRef","useMergeRefs","hasMask","shouldShowMask","changeInternalValue","newValue","usePrevious","handleChange","event","handleAccept","maskRef","syntheticEvent","handleInputFocus","handleInputBlur","handleKeyPress","clearInputValue","classes","classNames","inputClassNames","clearButtonClassNames","convertedType","inputType","inputProps","omit","maskDispatchObj","input","jsx","IMaskInput","jsxs","isFunction"],"mappings":";;;;;;;;;AAWO,MAAMA,IAAe,QACfC,KAAkB,CAAC,QAAQ,YAAY,OAAO,GAwOrDC,IAAW,CAACC,MAAmB,CAACC,GAAQ,GAAGD,CAAK,EAAE,GAElDE,KAAiBC,GAAW,CAACC,GAA2CC,MAAwC;AAClH,QAAM;AAAA,IACF,MAAAC,IAAOT;AAAA,IACP,cAAAU;AAAA,IACA,OAAAP;AAAA,IACA,WAAAQ;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,UAAAC,IAAW;AAAA,IACX,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC,IAAWC;AAAA,IACX,QAAAC,IAASD;AAAA,IACT,SAAAE,IAAUF;AAAA,IACV,SAAAG,IAAUH;AAAA,IACV,YAAAI,IAAaJ;AAAA,IACb,SAAAK,IAA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A,IAC5D,WAAW+B;AAAA,IACX,cAAAjD;AAAA,IACA,MAAMoD;AAAA,IACN,OAAOhC;AAAA,IACP,YAAYyB;AAAA,IACZ,QAAQD;AAAA,IACR,SAASD;AAAA,IACT,UAAUV,IAAU,SAAYK;AAAA;AAAA,IAChC,SAAA/B;AAAA,IACA,UAAAQ;AAAA,IACA,WAAWkB,IAAU,SAAYrC;AAAA,IACjC,UAAAC;AAAA,EAAA,GAKE0D,IAAuB,CAAA;AAC7B,EAAI1C,MACA0C,EAAgB,WAAW1C;AAG/B,QAAM2C,KAAQvB,IACV,gBAAAwB;AAAA,IAACC;AAAA,IAAA;AAAA,MACI,GAAGL;AAAA,MACJ,UAAUtB;AAAA,MACV,MAAAvB;AAAA,MACA,aAAaI;AAAA,MACZ,GAAG2C;AAAA,MACJ,iBAAiB9C;AAAA,MACjB,UAAU+B;AAAA,MACV,MAAM,CAACN,EAAA;AAAA,MACP,WAAWvB;AAAA,IAAA;AAAA,EAAA,IAGf,gBAAA8C,EAAC,SAAA,EAAO,GAAGJ,GAAY,KAAKtD,KAAYN,GAAK;AAGjD,SACI,gBAAAkE,GAAC,OAAA,EAAI,WAAWZ,IACX,UAAA;AAAA,IAAA9B,KAAY2C,GAAW3C,CAAQ,IAAIA,EAASoC,CAAU,IAAIG;AAAA,IAC3D,gBAAAC,EAAC,QAAA,EAAK,WAAWP,IAAuB,SAASJ,IAC7C,UAAA,gBAAAW,EAAC,QAAA,EAAK,WAAU,gDAAA,CAAgD,EAAA,CACpE;AAAA,EAAA,GACJ;AAER,CAAC;"}
|
|
1
|
+
{"version":3,"file":"ClearableInput.js","sources":["../../../src/components/clearableInput/ClearableInput.tsx"],"sourcesContent":["/** biome-ignore-all lint/complexity/noBannedTypes: <explanation> */\nimport React, { useState, forwardRef, type ForwardedRef, useRef } from 'react';\nimport { isEmpty, omit } from 'es-toolkit/compat';\nimport { isFunction, isNil } from 'es-toolkit/predicate';\nimport { noop } from 'es-toolkit/function';\nimport { IMaskInput } from 'react-imask';\n\nimport classNames from '../../utils/classNames';\nimport usePrevious from '../../hooks/usePrevious';\nimport useMergeRefs from '../../hooks/useMergeRefs';\n\nexport const DEFAULT_TYPE = 'text';\nexport const SUPPORTED_TYPES = ['text', 'password', 'email'];\n\nexport type MaskVisibility = 'always' | 'onFocus' | 'never';\nexport type MaskDefinition = {\n mask: string;\n definitions?: Record<string, string | RegExp>;\n startsWith?: string;\n [key: string]: any;\n};\n\nexport type ClearableInputProps = {\n /**\n * Gives the input element the id.\n */\n id?: string;\n\n /**\n * Gives the input element a name.\n */\n name?: string;\n\n /**\n * The translated text that shall be shown when the input is empty.\n */\n placeholder?: string | React.ReactNode;\n\n /**\n * Defines the type of the input itself.\n *\n * There are three types supported:\n * `text`, `email`, `password`.\n *\n * @default 'text'\n */\n type?: 'text' | 'password' | 'email';\n\n /**\n * Initial value of the ClearableInput. Pass this prop if you want to use this\n * component as an uncontrolled component.\n */\n defaultValue?: string;\n\n /**\n * Value of the ClearableInput. Pass this prop if you want to use this\n * component as a controlled component.\n */\n value?: string;\n\n /**\n * Defines the maximum amount of characters that can be entered.\n */\n maxLength?: number;\n\n /**\n * Defines the tab index to be added to the input element.\n *\n * @default 0\n */\n tabIndex?: number;\n\n /**\n * Defined whether or not the input has the error styling.\n *\n * @default false\n */\n hasError?: boolean;\n\n /**\n * The callback ref for the underlying input. Alternatively, use can use a forward ref.\n */\n inputRef?: React.RefObject<HTMLInputElement>;\n\n /**\n * Sets autocomplete value for autosuggest forms.\n */\n autoComplete?: string;\n\n /**\n * Callback function for when the value changes. Receives new value as an argument.\n * @param newValue\n * @param event\n * @returns\n */\n onChange?: (\n newValue: string,\n event: React.ChangeEvent<HTMLInputElement> | React.MouseEvent<HTMLSpanElement>\n ) => void;\n\n /**\n * Callback function which gets triggered when the input looses the focus.\n * @param event\n * @returns\n */\n onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;\n\n /**\n * Callback function which gets triggered when the input gains the focus.\n * @param event\n * @returns\n */\n onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;\n\n /**\n * Callback function for when the value is cleared via the clear button.\n * @param event\n * @returns\n */\n onClear?: (event: React.MouseEvent<HTMLSpanElement>) => void;\n\n /**\n * Callback function for every key pressed including `Enter` key.\n * @param event\n * @returns\n */\n onKeyPress?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n\n /**\n * Callback triggered when clicked into the input to react on it like when using an auto suggest dropdown\n * @param event\n * @returns\n */\n onClick?: (event: React.MouseEvent<HTMLInputElement>) => void;\n\n /**\n * The mask prop will allow to use the component with an input mask.\n * It defines the pattern that should be followed.\n *\n * For more details on masking, checkout the third party documentation for the\n * input mask here: {@link https://imask.js.org/guide.html}\n *\n * Simple masks can be defined as strings.\n *\n * The following characters will define mask format:\n *\n * - \"0\" = allowed input: \"0-9\" (digit)\n * - \"a\" = allowed input: \"a-z, A-Z\" (letter)\n * - \"*\" = allowed input: any character\n * - \"#\" = allowed input: \"0-9, a-z, A-Z\" (digit or letter)\n *\n * Other chars which is not in custom definitions supposed to be fixed:\n *\n * - [] - make input optional\n * - {} - include fixed part in unmasked value\n * - ` - prevent symbols shift back\n *\n * If definition character should be treated as fixed it should be escaped by \\\\ (E.g. \\\\0).\n *\n * Additionally you can provide custom definitions.\n *\n * @example\n * '-- ### ### ###' or '+49 00 000 00'\n */\n mask?: string | (string | RegExp)[] | RegExp | DateConstructor | number | Function | MaskDefinition[];\n\n /**\n * Placeholder to cover unfilled parts of the mask.\n *\n * @default '_'\n */\n maskPlaceholder?: string | null;\n\n /**\n * Enable characters overwriting\n *\n * @default true\n */\n maskOverwrite?: boolean | 'shift' | undefined;\n\n /**\n * Chooses the mask for dynamic masking depending on input value.\n * Note, this function may not be an empty function, otherwise the mask selection won't work\n */\n maskDispatch?: (appended: string, dynamicMasked: any) => any;\n\n /**\n * Controls when the mask pattern is visible.\n *\n * - 'always': Mask is always visible\n * - 'onFocus': Mask is hidden but shown when input is focused\n * - 'never': Mask is never shown\n *\n * @default 'always'\n */\n maskVisibility?: MaskVisibility;\n\n /**\n * Custom definitions to have more control over your mask. The defined character will be replaced in your mask.\n *\n * @example\n * mask='AAA AAA.AA'\n * maskDefinitions={{ A: /[A-Z0-9]/ }}\n */\n maskDefinitions?: Record<string, string | RegExp>;\n\n /**\n * Minimum value to be entered. This prop is extended to accept a Date\n * when used with an input mask.\n */\n min?: string | number | undefined | Date;\n\n /**\n * Maximum value to be entered. This prop is extended to accept a Date\n * when used with an input mask.\n */\n max?: string | number | undefined | Date;\n\n /**\n * Disabled the input component.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Additional classes to be set on the input element.\n */\n inputClassName?: string;\n\n /**\n * Additional classes to be set on the wrapper element.\n */\n className?: string;\n\n /**\n * Render-prop to customize the rendered input.\n *\n * The function gets the `inputProps` passed and is responsible for rendering the custom `<input>` component.\n *\n * Receives the computed `input` props so you can render your own field. See: {@link https://reactjs.org/docs/render-props.html}\n */\n children?: (props: React.InputHTMLAttributes<HTMLInputElement>) => React.ReactNode;\n};\n\nconst hasValue = (value: unknown) => !isEmpty(`${value}`);\n\nconst ClearableInput = forwardRef((props: ClearableInputProps, ref: ForwardedRef<HTMLInputElement>) => {\n const {\n type = DEFAULT_TYPE,\n defaultValue,\n value,\n maxLength,\n tabIndex = 0,\n hasError = false,\n inputRef,\n autoComplete,\n onChange = noop,\n onBlur = noop,\n onFocus = noop,\n onClear = noop,\n onKeyPress = noop,\n onClick = noop,\n mask,\n maskPlaceholder = '_',\n maskVisibility = 'always',\n maskOverwrite = true,\n maskDefinitions,\n maskDispatch,\n inputClassName = '',\n disabled = false,\n className = '',\n children,\n ...remainingProps\n } = props;\n\n const initialValue = value || defaultValue || '';\n\n const [inputValue, setInputValue] = useState(initialValue);\n const [showClear, setShowClear] = useState(hasValue(initialValue));\n const [isFocused, setIsFocused] = useState(false);\n\n const isControlled = !isNil(value);\n\n const internalMaskRef = useRef<HTMLInputElement>(null);\n const mergedInternalMaskRef = useMergeRefs(internalMaskRef, inputRef, ref);\n\n const hasMask = !!mask;\n\n // Calculate if mask should be visible (lazy=false means visible, lazy=true means hidden)\n const shouldShowMask = () => {\n switch (maskVisibility) {\n case 'always':\n return true;\n case 'onFocus':\n return isFocused;\n case 'never':\n return false;\n default:\n return isFocused;\n }\n };\n\n // Handles new input value and saves it in the local state.\n // The value stored in the state is used for rendering.\n const changeInternalValue = (newValue = '') => {\n // this is there to prevent that onChange and UNSAFE_componentWillReceiveProps set state at the same time\n if (inputValue === newValue) {\n return;\n }\n\n setInputValue(newValue);\n setShowClear(hasValue(newValue));\n };\n\n // important for when used as a controlled component and value changes from the outside.\n const previousValue = usePrevious(value);\n if (previousValue !== value) {\n changeInternalValue(value);\n }\n\n // only gets triggered on user interaction.\n const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const newValue = event.target.value;\n\n if (isControlled) {\n onChange(newValue, event);\n } else {\n changeInternalValue(newValue);\n onChange(newValue, event);\n }\n };\n\n const handleAccept = (newValue: string, maskRef: any, _event?: InputEvent) => {\n if (!internalMaskRef.current) {\n return;\n }\n\n // Simulate a ChangeEvent for backwards compatibility since react-imask does not return a change event itself\n const syntheticEvent = {\n target: internalMaskRef.current,\n currentTarget: internalMaskRef.current,\n // Standard synthetic event props\n bubbles: true,\n cancelable: true,\n defaultPrevented: false,\n isTrusted: true,\n preventDefault: () => {},\n stopPropagation: () => {},\n persist: () => {},\n nativeEvent: {} as any,\n type: 'change',\n timeStamp: Date.now(),\n } as unknown as React.ChangeEvent<HTMLInputElement>;\n\n // Set unmasked value manually if needed\n // (you can use data-attributes or attach it directly)\n (syntheticEvent.target as any).unmaskedValue = maskRef.unmaskedValue;\n\n if (isControlled) {\n onChange(newValue, syntheticEvent);\n } else {\n changeInternalValue(newValue);\n onChange(newValue, syntheticEvent);\n }\n };\n\n const handleInputFocus = (event: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(true);\n onFocus(event);\n };\n\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(false);\n onBlur(event);\n };\n\n // Will be triggered on every key press but also when pressing 'Enter' for example\n const handleKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {\n onKeyPress(event);\n };\n\n const clearInputValue = (event: React.MouseEvent<HTMLSpanElement>) => {\n changeInternalValue('');\n onChange('', event);\n\n if (onClear) {\n onClear(event);\n }\n };\n\n const classes = classNames(\n 'ClearableInput',\n 'input-group',\n hasError && 'has-error',\n disabled && 'pointer-events-none',\n className && className\n );\n\n const inputClassNames = classNames(\n 'form-control',\n inputClassName,\n showClear && 'withClearButton',\n hasMask && 'withInputMask',\n disabled && 'disabled'\n );\n\n const clearButtonClassNames = classNames('clearButton', !showClear && 'hide');\n\n const convertedType = type?.toLowerCase();\n const inputType = SUPPORTED_TYPES.indexOf(convertedType) !== -1 ? convertedType : DEFAULT_TYPE;\n\n const inputProps = {\n ...omit(remainingProps, ['value', 'defaultValue', 'onClear']),\n className: inputClassNames,\n autoComplete,\n type: inputType,\n value: inputValue,\n onKeyPress: handleKeyPress,\n onBlur: handleInputBlur,\n onFocus: handleInputFocus,\n onChange: hasMask ? undefined : handleChange, // In case of masked input, the onAccept callback is used\n onClick,\n disabled,\n maxLength: hasMask ? undefined : maxLength,\n tabIndex,\n } as any;\n\n // The dispatch function may not be an empty function. Specify it when\n // using dynamic masking and need more control over which mask gets selected\n const maskDispatchObj: any = {};\n if (maskDispatch) {\n maskDispatchObj.dispatch = maskDispatch;\n }\n\n const input = hasMask ? (\n <IMaskInput\n {...inputProps}\n inputRef={mergedInternalMaskRef}\n mask={mask}\n definitions={maskDefinitions}\n {...maskDispatchObj}\n placeholderChar={maskPlaceholder}\n onAccept={handleAccept}\n lazy={!shouldShowMask()}\n overwrite={maskOverwrite}\n />\n ) : (\n <input {...inputProps} ref={inputRef || ref} />\n );\n\n return (\n <div className={classes}>\n {children && isFunction(children) ? children(inputProps) : input}\n <span className={clearButtonClassNames} onClick={clearInputValue}>\n <span className='clearButtonIcon rioglyph rioglyph-remove-sign' />\n </span>\n </div>\n );\n});\n\nexport default ClearableInput;\n"],"names":["DEFAULT_TYPE","SUPPORTED_TYPES","hasValue","value","isEmpty","ClearableInput","forwardRef","props","ref","type","defaultValue","maxLength","tabIndex","hasError","inputRef","autoComplete","onChange","noop","onBlur","onFocus","onClear","onKeyPress","onClick","mask","maskPlaceholder","maskVisibility","maskOverwrite","maskDefinitions","maskDispatch","inputClassName","disabled","className","children","remainingProps","initialValue","inputValue","setInputValue","useState","showClear","setShowClear","isFocused","setIsFocused","isControlled","isNil","internalMaskRef","useRef","mergedInternalMaskRef","useMergeRefs","hasMask","shouldShowMask","changeInternalValue","newValue","usePrevious","handleChange","event","handleAccept","maskRef","_event","syntheticEvent","handleInputFocus","handleInputBlur","handleKeyPress","clearInputValue","classes","classNames","inputClassNames","clearButtonClassNames","convertedType","inputType","inputProps","omit","maskDispatchObj","input","jsx","IMaskInput","jsxs","isFunction"],"mappings":";;;;;;;;;AAWO,MAAMA,IAAe,QACfC,KAAkB,CAAC,QAAQ,YAAY,OAAO,GAyOrDC,IAAW,CAACC,MAAmB,CAACC,GAAQ,GAAGD,CAAK,EAAE,GAElDE,KAAiBC,GAAW,CAACC,GAA4BC,MAAwC;AACnG,QAAM;AAAA,IACF,MAAAC,IAAOT;AAAA,IACP,cAAAU;AAAA,IACA,OAAAP;AAAA,IACA,WAAAQ;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,UAAAC,IAAW;AAAA,IACX,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,UAAAC,IAAWC;AAAA,IACX,QAAAC,IAASD;AAAA,IACT,SAAAE,IAAUF;AAAA,IACV,SAAAG,IAAUH;AAAA,IACV,YAAAI,IAAaJ;AAAA,IACb,SAAAK,IAAUL;AAAA,IACV,MAAAM;AAAA,IACA,iBAAAC,IAAkB;AAAA,IAClB,gBAAAC,IAAiB;AAAA,IACjB,eAAAC,IAAgB;AAAA,IAChB,iBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,gBAAAC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AYK;AAAA;AAAA,IAChC,SAAA/B;AAAA,IACA,UAAAQ;AAAA,IACA,WAAWkB,IAAU,SAAYrC;AAAA,IACjC,UAAAC;AAAA,EAAA,GAKE2D,IAAuB,CAAA;AAC7B,EAAI3C,MACA2C,EAAgB,WAAW3C;AAG/B,QAAM4C,KAAQxB,IACV,gBAAAyB;AAAA,IAACC;AAAA,IAAA;AAAA,MACI,GAAGL;AAAA,MACJ,UAAUvB;AAAA,MACV,MAAAvB;AAAA,MACA,aAAaI;AAAA,MACZ,GAAG4C;AAAA,MACJ,iBAAiB/C;AAAA,MACjB,UAAU+B;AAAA,MACV,MAAM,CAACN,EAAA;AAAA,MACP,WAAWvB;AAAA,IAAA;AAAA,EAAA,IAGf,gBAAA+C,EAAC,SAAA,EAAO,GAAGJ,GAAY,KAAKvD,KAAYN,GAAK;AAGjD,SACI,gBAAAmE,GAAC,OAAA,EAAI,WAAWZ,IACX,UAAA;AAAA,IAAA/B,KAAY4C,GAAW5C,CAAQ,IAAIA,EAASqC,CAAU,IAAIG;AAAA,IAC3D,gBAAAC,EAAC,QAAA,EAAK,WAAWP,IAAuB,SAASJ,IAC7C,UAAA,gBAAAW,EAAC,QAAA,EAAK,WAAU,gDAAA,CAAgD,EAAA,CACpE;AAAA,EAAA,GACJ;AAER,CAAC;"}
|
|
@@ -2,6 +2,7 @@ import { PropsWithChildren } from 'react';
|
|
|
2
2
|
type CollapseProps = {
|
|
3
3
|
/**
|
|
4
4
|
* Show the component and triggers the expand or collapse animation.
|
|
5
|
+
*
|
|
5
6
|
* @default false
|
|
6
7
|
*/
|
|
7
8
|
open: boolean | undefined;
|
|
@@ -11,11 +12,13 @@ type CollapseProps = {
|
|
|
11
12
|
unmountOnExit?: boolean;
|
|
12
13
|
/**
|
|
13
14
|
* Run the expand animation when the component mounts, if it is initially shown.
|
|
15
|
+
*
|
|
14
16
|
* @default false
|
|
15
17
|
*/
|
|
16
18
|
appear?: boolean;
|
|
17
19
|
/**
|
|
18
20
|
* Duration of the collapse animation in milliseconds.
|
|
21
|
+
*
|
|
19
22
|
* @default 270
|
|
20
23
|
*/
|
|
21
24
|
timeout?: number;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { AnimatePresence as
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { AnimatePresence as u, motion as I } from "motion/react";
|
|
3
3
|
import { noop as o } from "es-toolkit/function";
|
|
4
|
-
const
|
|
4
|
+
const x = 200, S = (a) => {
|
|
5
5
|
const {
|
|
6
|
-
open:
|
|
6
|
+
open: t = !1,
|
|
7
7
|
unmountOnExit: i = !1,
|
|
8
8
|
appear: l = !1,
|
|
9
|
-
timeout: s =
|
|
9
|
+
timeout: s = x,
|
|
10
10
|
onEntered: p = o,
|
|
11
11
|
onExited: c = o,
|
|
12
12
|
onAnimationStart: m = o,
|
|
13
13
|
children: r
|
|
14
|
-
} = a, d = !i, h = () => m(), A = (
|
|
15
|
-
|
|
14
|
+
} = a, d = !i, h = () => m(), A = (n) => {
|
|
15
|
+
n === "open" && p(), n === "collapsed" && c();
|
|
16
16
|
}, f = {
|
|
17
17
|
open: { opacity: 1, height: "auto" },
|
|
18
18
|
collapsed: { opacity: 0, height: 0 }
|
|
19
19
|
};
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
|
|
20
|
+
return /* @__PURE__ */ e(u, { initial: l, mode: "wait", children: (t || d) && /* @__PURE__ */ e(
|
|
21
|
+
I.div,
|
|
22
22
|
{
|
|
23
23
|
initial: "collapsed",
|
|
24
|
-
animate:
|
|
24
|
+
animate: t ? "open" : "collapsed",
|
|
25
25
|
exit: "collapsed",
|
|
26
26
|
className: "collapse display-block width-100pct",
|
|
27
27
|
variants: f,
|
|
@@ -31,9 +31,9 @@ const E = 200, _ = (a) => {
|
|
|
31
31
|
children: r
|
|
32
32
|
},
|
|
33
33
|
"content"
|
|
34
|
-
) })
|
|
34
|
+
) });
|
|
35
35
|
};
|
|
36
36
|
export {
|
|
37
|
-
|
|
37
|
+
S as default
|
|
38
38
|
};
|
|
39
39
|
//# sourceMappingURL=Collapse.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collapse.js","sources":["../../../src/components/collapse/Collapse.tsx"],"sourcesContent":["// biome-ignore lint/style/useImportType: required for JSX runtime compatibility with older toolchains\nimport { type PropsWithChildren } from 'react';\nimport { motion, AnimatePresence, type AnimationDefinition } from 'motion/react';\nimport { noop } from 'es-toolkit/function';\n\nconst DEFAULT_ANIMATION_TIME_IN_MS = 200;\n\ntype CollapseProps = {\n /**\n * Show the component and triggers the expand or collapse animation.\n * @default false\n */\n open: boolean | undefined;\n\n /**\n * Unmount the component (remove it from the DOM) when it is collapsed.\n */\n unmountOnExit?: boolean;\n\n /**\n * Run the expand animation when the component mounts, if it is initially shown.\n * @default false\n */\n appear?: boolean;\n\n /**\n * Duration of the collapse animation in milliseconds.\n * @default 270\n */\n timeout?: number;\n\n /**\n * Callback fired after the component has expanded.\n * @returns\n */\n onEntered?: () => void;\n\n /**\n * Callback fired after the component has collapsed.\n * @returns\n */\n onExited?: () => void;\n\n /**\n * Callback fired when the animation starts for either expand or collapse.\n */\n onAnimationStart?: () => void;\n};\n\nconst Collapse = (props: PropsWithChildren<CollapseProps>) => {\n const {\n open = false,\n unmountOnExit = false,\n appear = false,\n timeout = DEFAULT_ANIMATION_TIME_IN_MS,\n onEntered = noop,\n onExited = noop,\n onAnimationStart = noop,\n children,\n } = props;\n\n const shouldKeepContentInDom = !unmountOnExit;\n\n const handleAnimationStart = () => onAnimationStart();\n const handleAnimationComplete = (definition: AnimationDefinition) => {\n if (definition === 'open') {\n onEntered();\n }\n if (definition === 'collapsed') {\n onExited();\n }\n };\n\n const variants = {\n open: { opacity: 1, height: 'auto' },\n collapsed: { opacity: 0, height: 0 },\n };\n\n return (\n
|
|
1
|
+
{"version":3,"file":"Collapse.js","sources":["../../../src/components/collapse/Collapse.tsx"],"sourcesContent":["// biome-ignore lint/style/useImportType: required for JSX runtime compatibility with older toolchains\nimport { type PropsWithChildren } from 'react';\nimport { motion, AnimatePresence, type AnimationDefinition } from 'motion/react';\nimport { noop } from 'es-toolkit/function';\n\nconst DEFAULT_ANIMATION_TIME_IN_MS = 200;\n\ntype CollapseProps = {\n /**\n * Show the component and triggers the expand or collapse animation.\n *\n * @default false\n */\n open: boolean | undefined;\n\n /**\n * Unmount the component (remove it from the DOM) when it is collapsed.\n */\n unmountOnExit?: boolean;\n\n /**\n * Run the expand animation when the component mounts, if it is initially shown.\n *\n * @default false\n */\n appear?: boolean;\n\n /**\n * Duration of the collapse animation in milliseconds.\n *\n * @default 270\n */\n timeout?: number;\n\n /**\n * Callback fired after the component has expanded.\n * @returns\n */\n onEntered?: () => void;\n\n /**\n * Callback fired after the component has collapsed.\n * @returns\n */\n onExited?: () => void;\n\n /**\n * Callback fired when the animation starts for either expand or collapse.\n */\n onAnimationStart?: () => void;\n};\n\nconst Collapse = (props: PropsWithChildren<CollapseProps>) => {\n const {\n open = false,\n unmountOnExit = false,\n appear = false,\n timeout = DEFAULT_ANIMATION_TIME_IN_MS,\n onEntered = noop,\n onExited = noop,\n onAnimationStart = noop,\n children,\n } = props;\n\n const shouldKeepContentInDom = !unmountOnExit;\n\n const handleAnimationStart = () => onAnimationStart();\n const handleAnimationComplete = (definition: AnimationDefinition) => {\n if (definition === 'open') {\n onEntered();\n }\n if (definition === 'collapsed') {\n onExited();\n }\n };\n\n const variants = {\n open: { opacity: 1, height: 'auto' },\n collapsed: { opacity: 0, height: 0 },\n };\n\n return (\n <AnimatePresence initial={appear} mode='wait'>\n {(open || shouldKeepContentInDom) && (\n <motion.div\n key='content'\n initial='collapsed'\n animate={open ? 'open' : 'collapsed'}\n exit='collapsed'\n className='collapse display-block width-100pct'\n variants={variants}\n transition={{ duration: timeout / 1000, ease: 'easeIn' }}\n onAnimationComplete={handleAnimationComplete}\n onAnimationStart={handleAnimationStart}\n >\n {children}\n </motion.div>\n )}\n </AnimatePresence>\n );\n};\n//\n\nexport default Collapse;\n"],"names":["DEFAULT_ANIMATION_TIME_IN_MS","Collapse","props","open","unmountOnExit","appear","timeout","onEntered","noop","onExited","onAnimationStart","children","shouldKeepContentInDom","handleAnimationStart","handleAnimationComplete","definition","variants","AnimatePresence","jsx","motion"],"mappings":";;;AAKA,MAAMA,IAA+B,KA+C/BC,IAAW,CAACC,MAA4C;AAC1D,QAAM;AAAA,IACF,MAAAC,IAAO;AAAA,IACP,eAAAC,IAAgB;AAAA,IAChB,QAAAC,IAAS;AAAA,IACT,SAAAC,IAAUN;AAAA,IACV,WAAAO,IAAYC;AAAA,IACZ,UAAAC,IAAWD;AAAA,IACX,kBAAAE,IAAmBF;AAAA,IACnB,UAAAG;AAAA,EAAA,IACAT,GAEEU,IAAyB,CAACR,GAE1BS,IAAuB,MAAMH,EAAA,GAC7BI,IAA0B,CAACC,MAAoC;AACjE,IAAIA,MAAe,UACfR,EAAA,GAEAQ,MAAe,eACfN,EAAA;AAAA,EAER,GAEMO,IAAW;AAAA,IACb,MAAM,EAAE,SAAS,GAAG,QAAQ,OAAA;AAAA,IAC5B,WAAW,EAAE,SAAS,GAAG,QAAQ,EAAA;AAAA,EAAE;AAGvC,2BACKC,GAAA,EAAgB,SAASZ,GAAQ,MAAK,QACjC,gBAAQO,MACN,gBAAAM;AAAA,IAACC,EAAO;AAAA,IAAP;AAAA,MAEG,SAAQ;AAAA,MACR,SAAShB,IAAO,SAAS;AAAA,MACzB,MAAK;AAAA,MACL,WAAU;AAAA,MACV,UAAAa;AAAA,MACA,YAAY,EAAE,UAAUV,IAAU,KAAM,MAAM,SAAA;AAAA,MAC9C,qBAAqBQ;AAAA,MACrB,kBAAkBD;AAAA,MAEjB,UAAAF;AAAA,IAAA;AAAA,IAVG;AAAA,EAAA,GAahB;AAER;"}
|
|
@@ -4,21 +4,25 @@ declare const CIRCLE = "circle";
|
|
|
4
4
|
export type ContentLoaderProps = {
|
|
5
5
|
/**
|
|
6
6
|
* Sets the animation speed.
|
|
7
|
+
*
|
|
7
8
|
* @default 2
|
|
8
9
|
*/
|
|
9
10
|
speed?: number;
|
|
10
11
|
/**
|
|
11
12
|
* Sets the height of the svg element.
|
|
13
|
+
*
|
|
12
14
|
* @default 14
|
|
13
15
|
*/
|
|
14
16
|
height?: string | number;
|
|
15
17
|
/**
|
|
16
18
|
* Sets the width of the svg element.
|
|
19
|
+
*
|
|
17
20
|
* @default 100%
|
|
18
21
|
*/
|
|
19
22
|
width?: string | number;
|
|
20
23
|
/**
|
|
21
24
|
* Sets the radius of the svg element. Only relevant for circle elements.
|
|
25
|
+
*
|
|
22
26
|
* @default 16
|
|
23
27
|
*/
|
|
24
28
|
radius?: number;
|
|
@@ -33,9 +37,13 @@ export type ContentLoaderProps = {
|
|
|
33
37
|
* Additional class names to ab added to the wrapping svg element.
|
|
34
38
|
*/
|
|
35
39
|
className?: string;
|
|
36
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Rect object prop. Used internally.
|
|
42
|
+
*/
|
|
37
43
|
rx?: number;
|
|
38
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Rect object prop. Used internally.
|
|
46
|
+
*/
|
|
39
47
|
ry?: number;
|
|
40
48
|
};
|
|
41
49
|
type ContentLoaderPropsWithChildren = PropsWithChildren<ContentLoaderProps>;
|