@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DayPicker.js","sources":["../../../src/components/datepicker/DayPicker.tsx"],"sourcesContent":["import { useEffect, useState, useRef } from 'react';\nimport { DayPicker as ReactDayPicker } from 'react-day-picker';\nimport { format, isValid, parse, type Locale } from 'date-fns';\nimport * as locales from 'date-fns/locale';\nimport { debounce } from 'es-toolkit/function';\n\nimport 'react-day-picker/dist/style.css';\n\nimport useClickOutside from '../../hooks/useClickOutside';\nimport usePopperDropdown from '../../hooks/usePopperDropdown';\nimport useKey from '../../hooks/useKey';\nimport ClearableInput from '../clearableInput/ClearableInput';\nimport classNames from 'classnames';\n\n// Features\n// [ ] input parsing and error handling\n// [-] time picker -> use a dedicated time picker input next to the day picker\n// [-] time range callback + validation\n// [ ] wrap all react-day-picker callbacks to avoid exposing internals and types\n// [x] start/end month\n// [ ] reserved days / unselectable days\n// [ ] disable editable input - use selected date only\n// [x] disallow editing input for mode: \"multi\" and \"range\" since input contains custom value\n// [ ] modifier and modifiersStyles\n// [x] closeOnSelect\n// [x] enter confirms the manual input and closes the dropdown\n// [x] esc closed the dropdown\n// [ ] support different sizes\n// [ ] mandatory value\n// [x] avoid opening dropdown again when clicking inside the input\n// [x] clear inputs\n// [ ] tab should select elements inside the dropdown, select should close but keep focus on input\n\nexport type DateRange = {\n from?: Date | undefined;\n to?: Date | undefined;\n};\n\nexport type Modifiers = Record<string, boolean>;\n\nexport type OnSelectHandler<T> = (\n selected: T,\n triggerDate: Date,\n modifiers: Modifiers,\n event: React.MouseEvent | React.KeyboardEvent\n) => void;\n\n// - By default, don't show a time picker\n// - Handle given formats like \"2020-04-04\" or ISO dates \"2020-03-12T16:20:44.193Z\" as initialValue - really?\n\ntype CommonProps = Omit<React.HTMLProps<HTMLInputElement>, 'onChange' | 'value' | 'selected'> & {\n id?: string;\n locale?: string;\n closeOnSelect?: boolean;\n initialValue?: Date;\n inputProps?: Omit<React.HTMLProps<HTMLInputElement>, 'type' | 'defaultValue' | 'children'>;\n\n /**\n * Custom format string (e.g., 'yyyy-MM-dd') to override locale-based formatting.\n * If omitted, locale-based display is used for the input.\n */\n dateFormat?: string;\n\n alignRight?: boolean;\n isClearable?: boolean;\n minWidth?: number;\n mandatory?: boolean;\n bsSize?: 'sm' | 'md' | 'lg' | 'xl';\n footer?: React.ReactNode;\n inline?: boolean;\n placeholder?: string | React.ReactElement;\n\n inputClassName?: string;\n className?: string;\n\n // react-day-picker props\n showOutsideDays?: boolean;\n fixedWeeks?: boolean;\n defaultMonth?: Date;\n startMonth?: Date;\n endMonth?: Date;\n};\n\ntype SingleModeProps = CommonProps & {\n mode?: 'single';\n selected?: Date;\n onInputChange?: (rawValue: string, parsedDate: Date | undefined, isValid: boolean) => void;\n onSelectChange?: (value: Date | undefined, modifiers: Modifiers) => void;\n};\n\ntype MultipleModeProps = CommonProps & {\n mode: 'multiple';\n selected?: Date[];\n onSelectChange?: (value: Date[] | undefined, modifiers: Modifiers) => void;\n};\n\ntype RangeModeProps = CommonProps & {\n mode: 'range';\n selected?: DateRange;\n onChange?: (value: DateRange | undefined) => void;\n onSelectChange?: (value: DateRange | undefined, modifiers: Modifiers) => void;\n};\n\ntype DayPickerProps = SingleModeProps | MultipleModeProps | RangeModeProps;\n\nconst isSingleProps = (props: DayPickerProps): props is SingleModeProps => !props.mode || props.mode === 'single';\nconst isMultipleProps = (props: DayPickerProps): props is MultipleModeProps => props.mode === 'multiple';\nconst isRangeProps = (props: DayPickerProps): props is RangeModeProps => props.mode === 'range';\n\nconst DayPicker = (props: DayPickerProps) => {\n const {\n id,\n selected,\n inputProps = {},\n alignRight,\n bsSize = '',\n locale = 'en-GB',\n footer,\n inline,\n showOutsideDays = true,\n fixedWeeks = true,\n mode = 'single',\n dateFormat,\n placeholder,\n isClearable = false,\n closeOnSelect = true,\n defaultMonth,\n startMonth,\n endMonth,\n inputClassName,\n className,\n } = props;\n\n const isSingleMode = mode === 'single';\n const isMultipleMode = mode === 'multiple';\n const isRangeMode = mode === 'range';\n\n const isControlled = selected !== undefined;\n const [internalSelected, setInternalSelected] = useState<typeof selected>();\n\n const selectedValue = isControlled ? selected : internalSelected;\n\n const narrowedSelected = (() => {\n if (isSingleMode) {\n return selectedValue instanceof Date ? selectedValue : undefined;\n }\n if (isMultipleMode) {\n return Array.isArray(selectedValue) ? selectedValue : undefined;\n }\n return isDateRange(selectedValue) ? selectedValue : undefined;\n })();\n\n const selectionProps = { selected: narrowedSelected };\n\n const resolvedLocale = resolveLocale(locale);\n\n const [internalInputValue, setInternalInputValue] = useState<string>('');\n\n const inputValue =\n isControlled && !isSingleMode\n ? formatSelectedForInput(narrowedSelected, locale, mode, dateFormat)\n : internalInputValue;\n\n // const inputValue = isSingleMode\n // ? internalInputValue\n // : formatSelectedForInput(narrowedSelected, locale, mode, dateFormat);\n\n // const inputValue = internalInputValue;\n\n // This ensures that whenever the external selected prop changes, the input field gets updated accordingly\n useEffect(() => {\n if (isSingleMode && isControlled && selected instanceof Date) {\n setInternalInputValue(formatDate(selected, locale, dateFormat));\n }\n }, [selected, isSingleMode, isControlled, locale, dateFormat]);\n\n const notifySelectChange = (value: typeof selected, modifiers: Modifiers) => {\n if (isSingleProps(props) && props.onSelectChange) {\n props.onSelectChange(value as SingleModeProps['selected'], modifiers);\n return;\n }\n\n if (isMultipleProps(props) && props.onSelectChange) {\n props.onSelectChange(value as MultipleModeProps['selected'], modifiers);\n return;\n }\n\n if (isRangeProps(props) && props.onSelectChange) {\n props.onSelectChange(value as RangeModeProps['selected'], modifiers);\n }\n };\n\n const handleInputChange = (newValue: string) => doHandleInputValue(newValue);\n const handleInputChangeNative = (event: any) => doHandleInputValue(event.currentTarget.value);\n\n const debouncedParseInput = useRef(\n debounce((rawValue: string) => {\n const parsed = parseDateString(rawValue, locale);\n console.log(parsed);\n const isValid = !!parsed;\n\n setInternalSelected(parsed as typeof props.selected);\n\n if (isSingleMode && 'onInputChange' in props && props.onInputChange) {\n props.onInputChange(rawValue, parsed, isValid);\n }\n\n const shouldNotify = parsed !== undefined || rawValue === '';\n if (shouldNotify) {\n // parse to desired dateFormat for use on outside\n const formattedSelected = dateFormat ? parseDateString(rawValue, locale, dateFormat) : parsed;\n notifySelectChange(formattedSelected as typeof selected, {});\n }\n }, 300)\n ).current;\n\n const doHandleInputValue = (rawValue: string) => {\n // const parsed = parseDateString(rawValue, locale, dateFormat);\n\n // const isValid = !!parsed;\n\n // if (!isControlled) {\n // // && isValidDate(parsed); // TODO: optional second validation\n\n // setInternalInputValue(rawValue);\n // setInternalSelected(parsed as typeof props.selected);\n // } else if (isSingleMode) {\n // setInternalInputValue(rawValue);\n // }\n\n // if (isSingleMode && 'onInputChange' in props && props.onInputChange) {\n // props.onInputChange(rawValue, parsed, isValid);\n // }\n\n // const shouldNotify = parsed !== undefined || rawValue === '';\n // if (shouldNotify) {\n // onSelectChange(parsed as typeof selected, {});\n // }\n\n setInternalInputValue(rawValue); // always update input state\n debouncedParseInput(rawValue); // defer parsing & callback execution\n };\n\n const keyboardRef = useRef(false);\n\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n // Do not close the dropdown on input blur when the user selects something inside the dropdown itself\n const nextFocused = event.relatedTarget as Node | null;\n const focusInsideDropdown = nextFocused && popperElementRef.current?.contains(nextFocused);\n if (isDropdownOpen && !focusInsideDropdown) {\n closePopper();\n }\n\n if (!isSingleMode) {\n return;\n }\n\n const parsed = parseDateString(internalInputValue, locale, dateFormat);\n\n if (parsed && isValid(parsed)) {\n setInternalSelected(parsed as typeof selected);\n notifySelectChange(parsed as typeof selected, {});\n setInternalInputValue(formatDate(parsed, locale, dateFormat));\n }\n };\n\n const handleOnInputFocus = () => {\n if (!isDropdownOpen) {\n openPopper();\n }\n };\n\n const handleInputKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {\n // Workaround to figure out if the user navigates via keyboard\n if (event.key === 'Tab') {\n keyboardRef.current = true;\n }\n\n if (event.key !== 'Enter') {\n return;\n }\n // In case the dropdown is not open but the input is focused, open the dropdown on enter\n if (!isDropdownOpen) {\n handleInputClick();\n return;\n }\n // In case the dropdown is open, the input is focused and the prop allows it, close the dropdown\n if (isDropdownOpen && closeOnSelect) {\n notifySelectChange(narrowedSelected as typeof selected, {});\n closePopper();\n }\n };\n\n const handleSelectedChange = (newValue: typeof selected) => {\n if (!isControlled) {\n setInternalSelected(newValue);\n }\n };\n\n const handleClearSelection = () => {\n handleInputChange('');\n handleSelectedChange(undefined as typeof selected);\n setInternalInputValue('');\n\n if (isControlled) {\n setInternalSelected(undefined);\n }\n\n if (isRangeMode && 'onChange' in props && props.onChange) {\n props.onChange(undefined);\n }\n\n notifySelectChange(undefined as typeof selected, {});\n };\n\n const handleDaySelect: OnSelectHandler<typeof selected> = (selected, triggerDate, modifiers, event) => {\n // safe because of discriminated union\n handleSelectedChange(selected as typeof selected);\n\n // trigger callback\n notifySelectChange(selected, modifiers);\n\n if (isSingleMode && !isControlled) {\n // should be the only place formatting is applied to the input\n setInternalInputValue(formatDate(selected as Date, locale, dateFormat));\n }\n\n if (keyboardRef.current) {\n // Note: When the date is selected via enter key, assume the user uses keyboard navigation.\n // In this case the input should be focused to allow to tab to another element in his form.\n // However, it is not possible to detect according to the event since the event.type is alway \"click\".\n // Instead we check if the user used the tab key to focus the day picker.\n inputRef?.current?.focus();\n }\n\n if (closeOnSelect) {\n closePopper();\n keyboardRef.current = false;\n }\n };\n\n const {\n isOpen: isDropdownOpen,\n open: openPopper,\n close: closePopper,\n referenceRef: popperRef,\n popperElementRef: setPopperElement,\n popperStyles,\n popperAttributes,\n } = usePopperDropdown({ placement: alignRight ? 'bottom-end' : 'bottom-start' });\n\n const inputRef = useRef<HTMLInputElement>(null);\n const popperElementRef = useRef<HTMLElement | null>(null);\n\n const assignPopperElement = (element: HTMLElement | null) => {\n popperElementRef.current = element;\n setPopperElement(element);\n };\n\n // Close the dropdown when clicking outside the dropdown wrapper.\n // It also checks if the click happened into the input, in which case the\n // dropdown will remain open.\n const outsideRef = useClickOutside(\n event => {\n const target = event.target as Node | null;\n if (!target) {\n closePopper();\n return;\n }\n\n const clickedWithinTrigger = popperRef.current?.contains(target);\n const clickedWithinInput = inputRef.current?.contains(target);\n\n if (clickedWithinTrigger || clickedWithinInput) {\n return;\n }\n\n closePopper();\n },\n undefined,\n isDropdownOpen\n );\n\n const handleInputClick = () => {\n openPopper();\n inputRef.current?.focus();\n };\n\n // Needed to select all tabbable elements inside the dropdown calendar and to disable the\n // focus on tab for all of these. This allows the user to tab between multiple inputs on the page\n // or when having two day pickers side by side. Tabbing from one day picker input to the other will\n // open and close the dropdown respectively and achieving the same usability as the old DatePicker.\n // useEffect(() => {\n // if (isDropdownOpen && outsideRef.current) {\n // // get all buttons to disable the tab on them\n // const tabbableElements = (outsideRef.current as HTMLElement).querySelectorAll<HTMLElement>(\n // 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n // );\n\n // tabbableElements.forEach((element: Element) => {\n // element.setAttribute('tabindex', '-1');\n // });\n // }\n // }, [isDropdownOpen, outsideRef]);\n\n // Close the dropdown when it is open and when the user presses the \"escape\" key\n useKey('Escape', event => {\n const target = event.target;\n const isInput = inputRef.current && inputRef.current === target;\n\n if (isInput && isDropdownOpen) {\n closePopper();\n }\n });\n\n useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (!isDropdownOpen || !outsideRef.current) {\n return;\n }\n\n if (event.key === 'Tab') {\n const focusedInside = outsideRef.current.contains(document.activeElement);\n if (focusedInside) {\n keyboardRef.current = true;\n console.log('User tabbed into dropdown');\n // Optional: closePopper(); or focus inputRef.current\n }\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n }, [isDropdownOpen]);\n\n const dayPickerClassName = `DayPicker ${bsSize === 'sm' ? 'margin-10' : 'margin-15'} ${bsSize}`;\n\n if (inline) {\n // Render day picker inline without a dropdown and an input\n return (\n <div className={`display-flex flex-column justify-content-between ${className}`}>\n <ReactDayPicker\n {...selectionProps}\n mode={mode as any}\n defaultMonth={defaultMonth}\n locale={resolvedLocale}\n onSelect={handleDaySelect}\n captionLayout='dropdown'\n animate\n navLayout='around'\n startMonth={startMonth}\n endMonth={endMonth}\n showOutsideDays={showOutsideDays}\n fixedWeeks={fixedWeeks}\n className={dayPickerClassName}\n />\n {footer ? <div className='padding-15'>{footer}</div> : <div />}\n </div>\n );\n }\n\n const clearableInputProps = {\n ...inputProps,\n readOnly: !isSingleMode,\n style: {\n background: 'var(--color-white)',\n ...(inputProps?.style ?? {}),\n },\n };\n\n return (\n <>\n <div ref={popperRef} className={`form-group ${className}`}>\n <div className='input-group'>\n <span className='input-group-addon' onClick={handleInputClick}>\n <span className='rioglyph rioglyph-calendar' aria-hidden='true' />\n </span>\n {isClearable && (\n <ClearableInput\n id={id}\n autoComplete='off'\n placeholder={placeholder}\n {...clearableInputProps}\n type='text'\n value={inputValue}\n onChange={handleInputChange}\n onClick={handleInputClick}\n onClear={handleClearSelection}\n onBlur={handleInputBlur}\n onFocus={handleOnInputFocus}\n onKeyPress={handleInputKeyPress}\n // hasError={hasError}\n ref={inputRef}\n inputClassName={inputClassName}\n />\n )}\n {!isClearable && (\n <input\n id={id}\n size={12}\n type='text'\n autoComplete='off'\n placeholder={placeholder}\n {...inputProps}\n value={inputValue}\n onChange={handleInputChangeNative}\n onClick={handleInputClick}\n onBlur={handleInputBlur}\n onFocus={handleOnInputFocus}\n onKeyDown={handleInputKeyPress}\n ref={inputRef}\n readOnly={!isSingleMode}\n className={classNames('ClearableInput form-control bg-white', inputClassName)}\n />\n )}\n </div>\n </div>\n {isDropdownOpen && (\n <div\n style={popperStyles}\n className='DayPickerPopover z-index-max bg-white shadow-default rounded margin-y-3 border'\n {...popperAttributes}\n ref={assignPopperElement}\n role='dialog'\n aria-label='DayPicker calendar'\n >\n <div ref={outsideRef} className='display-flex flex-column justify-content-between'>\n <ReactDayPicker\n {...selectionProps}\n mode={mode as any}\n defaultMonth={defaultMonth}\n locale={resolvedLocale}\n onSelect={handleDaySelect}\n captionLayout='dropdown'\n animate\n navLayout='around'\n startMonth={startMonth}\n endMonth={endMonth}\n showOutsideDays={showOutsideDays}\n fixedWeeks={fixedWeeks}\n className={dayPickerClassName}\n />\n {footer ? <div className='padding-15'>{footer}</div> : <div />}\n </div>\n </div>\n )}\n </>\n );\n};\n\nconst isDateRange = (value: unknown): value is DateRange => {\n if (!value || typeof value !== 'object') {\n return false;\n }\n\n const range = value as DateRange;\n\n const fromIsValid = range.from === undefined || range.from instanceof Date;\n const toIsValid = range.to === undefined || range.to instanceof Date;\n\n return fromIsValid && toIsValid;\n};\n\nconst resolveLocale = (localeCode: string): Locale => {\n const baseCode = localeCode.split('-')[0]; // 'de-DE' → 'de'\n return (\n (locales as Record<string, Locale>)[baseCode] || (locales as Record<string, Locale>)[localeCode] || locales.enGB\n );\n};\n\nconst formatDate = (date: Date | undefined, localeCode: string, dateFormat?: string): string => {\n if (!date) {\n return '';\n }\n\n if (dateFormat) {\n return format(date, dateFormat); // use override\n }\n\n // fallback to locale-based formatting\n return new Intl.DateTimeFormat(localeCode).format(date);\n};\n\nconst formatSelectedForInput = (\n selected: unknown,\n localeCode: string,\n mode: 'single' | 'multiple' | 'range',\n dateFormat?: string\n): string => {\n if (!selected) {\n return '';\n }\n\n const formatFn = (date: Date) =>\n dateFormat ? format(date, dateFormat) : new Intl.DateTimeFormat(localeCode).format(date);\n\n if (mode === 'single' && selected instanceof Date) {\n return formatFn(selected);\n }\n\n if (mode === 'multiple' && Array.isArray(selected)) {\n return selected.map(formatFn).join(', ');\n }\n\n if (mode === 'range' && typeof selected === 'object' && 'from' in selected) {\n const { from, to } = selected as { from?: Date; to?: Date };\n if (!from || !to) {\n return '';\n }\n return [from, to].filter(Boolean).map(formatFn).join(' – ');\n }\n\n return '';\n};\n\nconst localeFormatMap: Record<string, string> = {\n 'bg-BG': 'dd.MM.yyyy',\n 'cs-CZ': 'dd.MM.yyyy',\n 'da-DK': 'dd-MM-yyyy',\n 'de-DE': 'dd.MM.yyyy',\n 'el-GR': 'dd/MM/yyyy',\n 'en-GB': 'dd/MM/yyyy',\n 'es-ES': 'dd/MM/yyyy',\n 'et-EE': 'dd.MM.yyyy',\n 'fi-FI': 'dd.MM.yyyy',\n 'fr-FR': 'dd/MM/yyyy',\n 'hr-HR': 'dd.MM.yyyy',\n 'hu-HU': 'yyyy. MM. dd.',\n 'it-IT': 'dd/MM/yyyy',\n 'lt-LT': 'dd-MM-yyyy',\n 'lv-LV': 'dd.MM.yyyy',\n 'nb-NO': 'dd.MM.yyyy',\n 'nl-NL': 'dd-MM-yyyy',\n 'pl-PL': 'dd.MM.yyyy',\n 'pt-BR': 'dd/MM/yyyy',\n 'pt-PT': 'dd/MM/yyyy',\n 'ro-RO': 'dd.MM.yyyy',\n 'sk-SK': 'dd.MM.yyyy',\n 'sl-SI': 'dd.MM.yyyy',\n 'sv-SE': 'yyyy-MM-dd',\n};\n\nconst getFormatForLocale = (localeCode: string, fallback = 'yyyy-MM-dd'): string => {\n return localeFormatMap[localeCode] || fallback;\n};\n\nconst parseDateString = (value: string | undefined, localeCode: string, dateFormat?: string): Date | undefined => {\n if (!value) {\n return undefined;\n }\n\n const formatToUse = dateFormat || getFormatForLocale(localeCode, dateFormat);\n const parsed = parse(value, formatToUse, new Date());\n\n return isValid(parsed) ? parsed : undefined;\n};\n\nexport default DayPicker;\n"],"names":["isSingleProps","props","isMultipleProps","isRangeProps","DayPicker","id","selected","inputProps","alignRight","bsSize","locale","footer","inline","showOutsideDays","fixedWeeks","mode","dateFormat","placeholder","isClearable","closeOnSelect","defaultMonth","startMonth","endMonth","inputClassName","className","isSingleMode","isMultipleMode","isRangeMode","isControlled","internalSelected","setInternalSelected","useState","selectedValue","narrowedSelected","isDateRange","selectionProps","resolvedLocale","resolveLocale","internalInputValue","setInternalInputValue","inputValue","formatSelectedForInput","useEffect","formatDate","notifySelectChange","value","modifiers","handleInputChange","newValue","doHandleInputValue","handleInputChangeNative","event","debouncedParseInput","useRef","debounce","rawValue","parsed","parseDateString","isValid","formattedSelected","keyboardRef","handleInputBlur","nextFocused","focusInsideDropdown","popperElementRef","isDropdownOpen","closePopper","handleOnInputFocus","openPopper","handleInputKeyPress","handleInputClick","handleSelectedChange","handleClearSelection","handleDaySelect","triggerDate","inputRef","popperRef","setPopperElement","popperStyles","popperAttributes","usePopperDropdown","assignPopperElement","element","outsideRef","useClickOutside","target","clickedWithinTrigger","clickedWithinInput","useKey","handleKeyDown","dayPickerClassName","jsxs","jsx","ReactDayPicker","clearableInputProps","Fragment","ClearableInput","classNames","range","fromIsValid","toIsValid","localeCode","baseCode","locales","date","format","formatFn","from","to","localeFormatMap","getFormatForLocale","fallback","formatToUse","parse"],"mappings":";;;;;;;;;;;;AAyGA,MAAMA,KAAgB,CAACC,MAAoD,CAACA,EAAM,QAAQA,EAAM,SAAS,UACnGC,KAAkB,CAACD,MAAsDA,EAAM,SAAS,YACxFE,KAAe,CAACF,MAAmDA,EAAM,SAAS,SAElFG,KAAY,CAACH,MAA0B;AACzC,QAAM;AAAA,IACF,IAAAI;AAAA,IACA,UAAAC;AAAA,IACA,YAAAC,IAAa,CAAA;AAAA,IACb,YAAAC;AAAA,IACA,QAAAC,IAAS;AAAA,IACT,QAAAC,IAAS;AAAA,IACT,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,iBAAAC,IAAkB;AAAA,IAClB,YAAAC,IAAa;AAAA,IACb,MAAAC,IAAO;AAAA,IACP,YAAAC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,eAAAC,IA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MpE,GAAOmE,GAAa,oBAAI,MAAM;AAEnD,SAAOtD,GAAQF,CAAM,IAAIA,IAAS;AACtC;"}
|
|
1
|
+
{"version":3,"file":"DayPicker.js","sources":["../../../src/components/datepicker/DayPicker.tsx"],"sourcesContent":["import { useEffect, useState, useRef } from 'react';\nimport { DayPicker as ReactDayPicker } from 'react-day-picker';\nimport { format, isValid, parse, type Locale } from 'date-fns';\nimport * as locales from 'date-fns/locale';\nimport { debounce } from 'es-toolkit/function';\n\nimport 'react-day-picker/dist/style.css';\n\nimport useClickOutside from '../../hooks/useClickOutside';\nimport usePopperDropdown from '../../hooks/usePopperDropdown';\nimport useKey from '../../hooks/useKey';\nimport ClearableInput from '../clearableInput/ClearableInput';\nimport classNames from '../../utils/classNames';\n\n// Features\n// [ ] input parsing and error handling\n// [-] time picker -> use a dedicated time picker input next to the day picker\n// [-] time range callback + validation\n// [ ] wrap all react-day-picker callbacks to avoid exposing internals and types\n// [x] start/end month\n// [ ] reserved days / unselectable days\n// [ ] disable editable input - use selected date only\n// [x] disallow editing input for mode: \"multi\" and \"range\" since input contains custom value\n// [ ] modifier and modifiersStyles\n// [x] closeOnSelect\n// [x] enter confirms the manual input and closes the dropdown\n// [x] esc closed the dropdown\n// [ ] support different sizes\n// [ ] mandatory value\n// [x] avoid opening dropdown again when clicking inside the input\n// [x] clear inputs\n// [ ] tab should select elements inside the dropdown, select should close but keep focus on input\n\nexport type DateRange = {\n from?: Date | undefined;\n to?: Date | undefined;\n};\n\nexport type Modifiers = Record<string, boolean>;\n\nexport type OnSelectHandler<T> = (\n selected: T,\n triggerDate: Date,\n modifiers: Modifiers,\n event: React.MouseEvent | React.KeyboardEvent\n) => void;\n\n// - By default, don't show a time picker\n// - Handle given formats like \"2020-04-04\" or ISO dates \"2020-03-12T16:20:44.193Z\" as initialValue - really?\n\ntype CommonProps = Omit<React.HTMLProps<HTMLInputElement>, 'onChange' | 'value' | 'selected'> & {\n id?: string;\n locale?: string;\n closeOnSelect?: boolean;\n initialValue?: Date;\n inputProps?: Omit<React.HTMLProps<HTMLInputElement>, 'type' | 'defaultValue' | 'children'>;\n\n /**\n * Custom format string (e.g., 'yyyy-MM-dd') to override locale-based formatting.\n * If omitted, locale-based display is used for the input.\n */\n dateFormat?: string;\n\n alignRight?: boolean;\n isClearable?: boolean;\n minWidth?: number;\n mandatory?: boolean;\n bsSize?: 'sm' | 'md' | 'lg' | 'xl';\n footer?: React.ReactNode;\n inline?: boolean;\n placeholder?: string | React.ReactElement;\n\n inputClassName?: string;\n className?: string;\n\n // react-day-picker props\n showOutsideDays?: boolean;\n fixedWeeks?: boolean;\n defaultMonth?: Date;\n startMonth?: Date;\n endMonth?: Date;\n};\n\ntype SingleModeProps = CommonProps & {\n mode?: 'single';\n selected?: Date;\n onInputChange?: (rawValue: string, parsedDate: Date | undefined, isValid: boolean) => void;\n onSelectChange?: (value: Date | undefined, modifiers: Modifiers) => void;\n};\n\ntype MultipleModeProps = CommonProps & {\n mode: 'multiple';\n selected?: Date[];\n onSelectChange?: (value: Date[] | undefined, modifiers: Modifiers) => void;\n};\n\ntype RangeModeProps = CommonProps & {\n mode: 'range';\n selected?: DateRange;\n onChange?: (value: DateRange | undefined) => void;\n onSelectChange?: (value: DateRange | undefined, modifiers: Modifiers) => void;\n};\n\ntype DayPickerProps = SingleModeProps | MultipleModeProps | RangeModeProps;\n\nconst isSingleProps = (props: DayPickerProps): props is SingleModeProps => !props.mode || props.mode === 'single';\nconst isMultipleProps = (props: DayPickerProps): props is MultipleModeProps => props.mode === 'multiple';\nconst isRangeProps = (props: DayPickerProps): props is RangeModeProps => props.mode === 'range';\n\nconst DayPicker = (props: DayPickerProps) => {\n const {\n id,\n selected,\n inputProps = {},\n alignRight,\n bsSize = '',\n locale = 'en-GB',\n footer,\n inline,\n showOutsideDays = true,\n fixedWeeks = true,\n mode = 'single',\n dateFormat,\n placeholder,\n isClearable = false,\n closeOnSelect = true,\n defaultMonth,\n startMonth,\n endMonth,\n inputClassName,\n className,\n } = props;\n\n const isSingleMode = mode === 'single';\n const isMultipleMode = mode === 'multiple';\n const isRangeMode = mode === 'range';\n\n const isControlled = selected !== undefined;\n const [internalSelected, setInternalSelected] = useState<typeof selected>();\n\n const selectedValue = isControlled ? selected : internalSelected;\n\n const narrowedSelected = (() => {\n if (isSingleMode) {\n return selectedValue instanceof Date ? selectedValue : undefined;\n }\n if (isMultipleMode) {\n return Array.isArray(selectedValue) ? selectedValue : undefined;\n }\n return isDateRange(selectedValue) ? selectedValue : undefined;\n })();\n\n const selectionProps = { selected: narrowedSelected };\n\n const resolvedLocale = resolveLocale(locale);\n\n const [internalInputValue, setInternalInputValue] = useState<string>('');\n\n const inputValue =\n isControlled && !isSingleMode\n ? formatSelectedForInput(narrowedSelected, locale, mode, dateFormat)\n : internalInputValue;\n\n // const inputValue = isSingleMode\n // ? internalInputValue\n // : formatSelectedForInput(narrowedSelected, locale, mode, dateFormat);\n\n // const inputValue = internalInputValue;\n\n // This ensures that whenever the external selected prop changes, the input field gets updated accordingly\n useEffect(() => {\n if (isSingleMode && isControlled && selected instanceof Date) {\n setInternalInputValue(formatDate(selected, locale, dateFormat));\n }\n }, [selected, isSingleMode, isControlled, locale, dateFormat]);\n\n const notifySelectChange = (value: typeof selected, modifiers: Modifiers) => {\n if (isSingleProps(props) && props.onSelectChange) {\n props.onSelectChange(value as SingleModeProps['selected'], modifiers);\n return;\n }\n\n if (isMultipleProps(props) && props.onSelectChange) {\n props.onSelectChange(value as MultipleModeProps['selected'], modifiers);\n return;\n }\n\n if (isRangeProps(props) && props.onSelectChange) {\n props.onSelectChange(value as RangeModeProps['selected'], modifiers);\n }\n };\n\n const handleInputChange = (newValue: string) => doHandleInputValue(newValue);\n const handleInputChangeNative = (event: any) => doHandleInputValue(event.currentTarget.value);\n\n const debouncedParseInput = useRef(\n debounce((rawValue: string) => {\n const parsed = parseDateString(rawValue, locale);\n console.log(parsed);\n const isValid = !!parsed;\n\n setInternalSelected(parsed as typeof props.selected);\n\n if (isSingleMode && 'onInputChange' in props && props.onInputChange) {\n props.onInputChange(rawValue, parsed, isValid);\n }\n\n const shouldNotify = parsed !== undefined || rawValue === '';\n if (shouldNotify) {\n // parse to desired dateFormat for use on outside\n const formattedSelected = dateFormat ? parseDateString(rawValue, locale, dateFormat) : parsed;\n notifySelectChange(formattedSelected as typeof selected, {});\n }\n }, 300)\n ).current;\n\n const doHandleInputValue = (rawValue: string) => {\n // const parsed = parseDateString(rawValue, locale, dateFormat);\n\n // const isValid = !!parsed;\n\n // if (!isControlled) {\n // // && isValidDate(parsed); // TODO: optional second validation\n\n // setInternalInputValue(rawValue);\n // setInternalSelected(parsed as typeof props.selected);\n // } else if (isSingleMode) {\n // setInternalInputValue(rawValue);\n // }\n\n // if (isSingleMode && 'onInputChange' in props && props.onInputChange) {\n // props.onInputChange(rawValue, parsed, isValid);\n // }\n\n // const shouldNotify = parsed !== undefined || rawValue === '';\n // if (shouldNotify) {\n // onSelectChange(parsed as typeof selected, {});\n // }\n\n setInternalInputValue(rawValue); // always update input state\n debouncedParseInput(rawValue); // defer parsing & callback execution\n };\n\n const keyboardRef = useRef(false);\n\n const handleInputBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n // Do not close the dropdown on input blur when the user selects something inside the dropdown itself\n const nextFocused = event.relatedTarget as Node | null;\n const focusInsideDropdown = nextFocused && popperElementRef.current?.contains(nextFocused);\n if (isDropdownOpen && !focusInsideDropdown) {\n closePopper();\n }\n\n if (!isSingleMode) {\n return;\n }\n\n const parsed = parseDateString(internalInputValue, locale, dateFormat);\n\n if (parsed && isValid(parsed)) {\n setInternalSelected(parsed as typeof selected);\n notifySelectChange(parsed as typeof selected, {});\n setInternalInputValue(formatDate(parsed, locale, dateFormat));\n }\n };\n\n const handleOnInputFocus = () => {\n if (!isDropdownOpen) {\n openPopper();\n }\n };\n\n const handleInputKeyPress = (event: React.KeyboardEvent<HTMLInputElement>) => {\n // Workaround to figure out if the user navigates via keyboard\n if (event.key === 'Tab') {\n keyboardRef.current = true;\n }\n\n if (event.key !== 'Enter') {\n return;\n }\n // In case the dropdown is not open but the input is focused, open the dropdown on enter\n if (!isDropdownOpen) {\n handleInputClick();\n return;\n }\n // In case the dropdown is open, the input is focused and the prop allows it, close the dropdown\n if (isDropdownOpen && closeOnSelect) {\n notifySelectChange(narrowedSelected as typeof selected, {});\n closePopper();\n }\n };\n\n const handleSelectedChange = (newValue: typeof selected) => {\n if (!isControlled) {\n setInternalSelected(newValue);\n }\n };\n\n const handleClearSelection = () => {\n handleInputChange('');\n handleSelectedChange(undefined as typeof selected);\n setInternalInputValue('');\n\n if (isControlled) {\n setInternalSelected(undefined);\n }\n\n if (isRangeMode && 'onChange' in props && props.onChange) {\n props.onChange(undefined);\n }\n\n notifySelectChange(undefined as typeof selected, {});\n };\n\n const handleDaySelect: OnSelectHandler<typeof selected> = (selected, triggerDate, modifiers, event) => {\n // safe because of discriminated union\n handleSelectedChange(selected as typeof selected);\n\n // trigger callback\n notifySelectChange(selected, modifiers);\n\n if (isSingleMode && !isControlled) {\n // should be the only place formatting is applied to the input\n setInternalInputValue(formatDate(selected as Date, locale, dateFormat));\n }\n\n if (keyboardRef.current) {\n // Note: When the date is selected via enter key, assume the user uses keyboard navigation.\n // In this case the input should be focused to allow to tab to another element in his form.\n // However, it is not possible to detect according to the event since the event.type is alway \"click\".\n // Instead we check if the user used the tab key to focus the day picker.\n inputRef?.current?.focus();\n }\n\n if (closeOnSelect) {\n closePopper();\n keyboardRef.current = false;\n }\n };\n\n const {\n isOpen: isDropdownOpen,\n open: openPopper,\n close: closePopper,\n referenceRef: popperRef,\n popperElementRef: setPopperElement,\n popperStyles,\n popperAttributes,\n } = usePopperDropdown({ placement: alignRight ? 'bottom-end' : 'bottom-start' });\n\n const inputRef = useRef<HTMLInputElement>(null);\n const popperElementRef = useRef<HTMLElement | null>(null);\n\n const assignPopperElement = (element: HTMLElement | null) => {\n popperElementRef.current = element;\n setPopperElement(element);\n };\n\n // Close the dropdown when clicking outside the dropdown wrapper.\n // It also checks if the click happened into the input, in which case the\n // dropdown will remain open.\n const outsideRef = useClickOutside(\n event => {\n const target = event.target as Node | null;\n if (!target) {\n closePopper();\n return;\n }\n\n const clickedWithinTrigger = popperRef.current?.contains(target);\n const clickedWithinInput = inputRef.current?.contains(target);\n\n if (clickedWithinTrigger || clickedWithinInput) {\n return;\n }\n\n closePopper();\n },\n undefined,\n isDropdownOpen\n );\n\n const handleInputClick = () => {\n openPopper();\n inputRef.current?.focus();\n };\n\n // Needed to select all tabbable elements inside the dropdown calendar and to disable the\n // focus on tab for all of these. This allows the user to tab between multiple inputs on the page\n // or when having two day pickers side by side. Tabbing from one day picker input to the other will\n // open and close the dropdown respectively and achieving the same usability as the old DatePicker.\n // useEffect(() => {\n // if (isDropdownOpen && outsideRef.current) {\n // // get all buttons to disable the tab on them\n // const tabbableElements = (outsideRef.current as HTMLElement).querySelectorAll<HTMLElement>(\n // 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])'\n // );\n\n // tabbableElements.forEach((element: Element) => {\n // element.setAttribute('tabindex', '-1');\n // });\n // }\n // }, [isDropdownOpen, outsideRef]);\n\n // Close the dropdown when it is open and when the user presses the \"escape\" key\n useKey('Escape', event => {\n const target = event.target;\n const isInput = inputRef.current && inputRef.current === target;\n\n if (isInput && isDropdownOpen) {\n closePopper();\n }\n });\n\n useEffect(() => {\n const handleKeyDown = (event: KeyboardEvent) => {\n if (!isDropdownOpen || !outsideRef.current) {\n return;\n }\n\n if (event.key === 'Tab') {\n const focusedInside = outsideRef.current.contains(document.activeElement);\n if (focusedInside) {\n keyboardRef.current = true;\n console.log('User tabbed into dropdown');\n // Optional: closePopper(); or focus inputRef.current\n }\n }\n };\n\n document.addEventListener('keydown', handleKeyDown);\n return () => {\n document.removeEventListener('keydown', handleKeyDown);\n };\n }, [isDropdownOpen]);\n\n const dayPickerClassName = `DayPicker ${bsSize === 'sm' ? 'margin-10' : 'margin-15'} ${bsSize}`;\n\n if (inline) {\n // Render day picker inline without a dropdown and an input\n return (\n <div className={`display-flex flex-column justify-content-between ${className}`}>\n <ReactDayPicker\n {...selectionProps}\n mode={mode as any}\n defaultMonth={defaultMonth}\n locale={resolvedLocale}\n onSelect={handleDaySelect}\n captionLayout='dropdown'\n animate\n navLayout='around'\n startMonth={startMonth}\n endMonth={endMonth}\n showOutsideDays={showOutsideDays}\n fixedWeeks={fixedWeeks}\n className={dayPickerClassName}\n />\n {footer ? <div className='padding-15'>{footer}</div> : <div />}\n </div>\n );\n }\n\n const clearableInputProps = {\n ...inputProps,\n readOnly: !isSingleMode,\n style: {\n background: 'var(--color-white)',\n ...(inputProps?.style ?? {}),\n },\n };\n\n return (\n <>\n <div ref={popperRef} className={`form-group ${className}`}>\n <div className='input-group'>\n <span className='input-group-addon' onClick={handleInputClick}>\n <span className='rioglyph rioglyph-calendar' aria-hidden='true' />\n </span>\n {isClearable && (\n <ClearableInput\n id={id}\n autoComplete='off'\n placeholder={placeholder}\n {...clearableInputProps}\n type='text'\n value={inputValue}\n onChange={handleInputChange}\n onClick={handleInputClick}\n onClear={handleClearSelection}\n onBlur={handleInputBlur}\n onFocus={handleOnInputFocus}\n onKeyPress={handleInputKeyPress}\n // hasError={hasError}\n ref={inputRef}\n inputClassName={inputClassName}\n />\n )}\n {!isClearable && (\n <input\n id={id}\n size={12}\n type='text'\n autoComplete='off'\n placeholder={placeholder}\n {...inputProps}\n value={inputValue}\n onChange={handleInputChangeNative}\n onClick={handleInputClick}\n onBlur={handleInputBlur}\n onFocus={handleOnInputFocus}\n onKeyDown={handleInputKeyPress}\n ref={inputRef}\n readOnly={!isSingleMode}\n className={classNames('ClearableInput form-control bg-white', inputClassName)}\n />\n )}\n </div>\n </div>\n {isDropdownOpen && (\n <div\n style={popperStyles}\n className='DayPickerPopover z-index-max bg-white shadow-default rounded margin-y-3 border'\n {...popperAttributes}\n ref={assignPopperElement}\n role='dialog'\n aria-label='DayPicker calendar'\n >\n <div ref={outsideRef} className='display-flex flex-column justify-content-between'>\n <ReactDayPicker\n {...selectionProps}\n mode={mode as any}\n defaultMonth={defaultMonth}\n locale={resolvedLocale}\n onSelect={handleDaySelect}\n captionLayout='dropdown'\n animate\n navLayout='around'\n startMonth={startMonth}\n endMonth={endMonth}\n showOutsideDays={showOutsideDays}\n fixedWeeks={fixedWeeks}\n className={dayPickerClassName}\n />\n {footer ? <div className='padding-15'>{footer}</div> : <div />}\n </div>\n </div>\n )}\n </>\n );\n};\n\nconst isDateRange = (value: unknown): value is DateRange => {\n if (!value || typeof value !== 'object') {\n return false;\n }\n\n const range = value as DateRange;\n\n const fromIsValid = range.from === undefined || range.from instanceof Date;\n const toIsValid = range.to === undefined || range.to instanceof Date;\n\n return fromIsValid && toIsValid;\n};\n\nconst resolveLocale = (localeCode: string): Locale => {\n const baseCode = localeCode.split('-')[0]; // 'de-DE' → 'de'\n return (\n (locales as Record<string, Locale>)[baseCode] || (locales as Record<string, Locale>)[localeCode] || locales.enGB\n );\n};\n\nconst formatDate = (date: Date | undefined, localeCode: string, dateFormat?: string): string => {\n if (!date) {\n return '';\n }\n\n if (dateFormat) {\n return format(date, dateFormat); // use override\n }\n\n // fallback to locale-based formatting\n return new Intl.DateTimeFormat(localeCode).format(date);\n};\n\nconst formatSelectedForInput = (\n selected: unknown,\n localeCode: string,\n mode: 'single' | 'multiple' | 'range',\n dateFormat?: string\n): string => {\n if (!selected) {\n return '';\n }\n\n const formatFn = (date: Date) =>\n dateFormat ? format(date, dateFormat) : new Intl.DateTimeFormat(localeCode).format(date);\n\n if (mode === 'single' && selected instanceof Date) {\n return formatFn(selected);\n }\n\n if (mode === 'multiple' && Array.isArray(selected)) {\n return selected.map(formatFn).join(', ');\n }\n\n if (mode === 'range' && typeof selected === 'object' && 'from' in selected) {\n const { from, to } = selected as { from?: Date; to?: Date };\n if (!from || !to) {\n return '';\n }\n return [from, to].filter(Boolean).map(formatFn).join(' – ');\n }\n\n return '';\n};\n\nconst localeFormatMap: Record<string, string> = {\n 'bg-BG': 'dd.MM.yyyy',\n 'cs-CZ': 'dd.MM.yyyy',\n 'da-DK': 'dd-MM-yyyy',\n 'de-DE': 'dd.MM.yyyy',\n 'el-GR': 'dd/MM/yyyy',\n 'en-GB': 'dd/MM/yyyy',\n 'es-ES': 'dd/MM/yyyy',\n 'et-EE': 'dd.MM.yyyy',\n 'fi-FI': 'dd.MM.yyyy',\n 'fr-FR': 'dd/MM/yyyy',\n 'hr-HR': 'dd.MM.yyyy',\n 'hu-HU': 'yyyy. MM. dd.',\n 'it-IT': 'dd/MM/yyyy',\n 'lt-LT': 'dd-MM-yyyy',\n 'lv-LV': 'dd.MM.yyyy',\n 'nb-NO': 'dd.MM.yyyy',\n 'nl-NL': 'dd-MM-yyyy',\n 'pl-PL': 'dd.MM.yyyy',\n 'pt-BR': 'dd/MM/yyyy',\n 'pt-PT': 'dd/MM/yyyy',\n 'ro-RO': 'dd.MM.yyyy',\n 'sk-SK': 'dd.MM.yyyy',\n 'sl-SI': 'dd.MM.yyyy',\n 'sv-SE': 'yyyy-MM-dd',\n};\n\nconst getFormatForLocale = (localeCode: string, fallback = 'yyyy-MM-dd'): string => {\n return localeFormatMap[localeCode] || fallback;\n};\n\nconst parseDateString = (value: string | undefined, localeCode: string, dateFormat?: string): Date | undefined => {\n if (!value) {\n return undefined;\n }\n\n const formatToUse = dateFormat || getFormatForLocale(localeCode, dateFormat);\n const parsed = parse(value, formatToUse, new Date());\n\n return isValid(parsed) ? parsed : undefined;\n};\n\nexport default DayPicker;\n"],"names":["isSingleProps","props","isMultipleProps","isRangeProps","DayPicker","id","selected","inputProps","alignRight","bsSize","locale","footer","inline","showOutsideDays","fixedWeeks","mode","dateFormat","placeholder","isClearable","closeOnSelect","defaultMonth","startMonth","endMonth","inputClassName","className","isSingleMode","isMultipleMode","isRangeMode","isControlled","internalSelected","setInternalSelected","useState","selectedValue","narrowedSelected","isDateRange","selectionProps","resolvedLocale","resolveLocale","internalInputValue","setInternalInputValue","inputValue","formatSelectedForInput","useEffect","formatDate","notifySelectChange","value","modifiers","handleInputChange","newValue","doHandleInputValue","handleInputChangeNative","event","debouncedParseInput","useRef","debounce","rawValue","parsed","parseDateString","isValid","formattedSelected","keyboardRef","handleInputBlur","nextFocused","focusInsideDropdown","popperElementRef","isDropdownOpen","closePopper","handleOnInputFocus","openPopper","handleInputKeyPress","handleInputClick","handleSelectedChange","handleClearSelection","handleDaySelect","triggerDate","inputRef","popperRef","setPopperElement","popperStyles","popperAttributes","usePopperDropdown","assignPopperElement","element","outsideRef","useClickOutside","target","clickedWithinTrigger","clickedWithinInput","useKey","handleKeyDown","dayPickerClassName","jsxs","jsx","ReactDayPicker","clearableInputProps","Fragment","ClearableInput","classNames","range","fromIsValid","toIsValid","localeCode","baseCode","locales","date","format","formatFn","from","to","localeFormatMap","getFormatForLocale","fallback","formatToUse","parse"],"mappings":";;;;;;;;;;;;AAyGA,MAAMA,KAAgB,CAACC,MAAoD,CAACA,EAAM,QAAQA,EAAM,SAAS,UACnGC,KAAkB,CAACD,MAAsDA,EAAM,SAAS,YACxFE,KAAe,CAACF,MAAmDA,EAAM,SAAS,SAElFG,KAAY,CAACH,MAA0B;AACzC,QAAM;AAAA,IACF,IAAAI;AAAA,IACA,UAAAC;AAAA,IACA,YAAAC,IAAa,CAAA;AAAA,IACb,YAAAC;AAAA,IACA,QAAAC,IAAS;AAAA,IACT,QAAAC,IAAS;AAAA,IACT,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,iBAAAC,IAAkB;AAAA,IAClB,YAAAC,IAAa;AAAA,IACb,MAAAC,IAAO;AAAA,IACP,YAAAC;AAAA,IACA,aAAAC;AAAA,IACA,aAAAC,IAAc;AAAA,IACd,eAAAC,IAAgB;AAAA,IAChB,cAAAC;AAAA,IACA,YAAAC;AAAA,IACA,UAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,WAAAC;AAAA,EAAA,IACAvB,GAEEwB,IAAeV,MAAS,UACxBW,KAAiBX,MAAS,YAC1BY,KAAcZ,MAAS,SAEvBa,IA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B;AACzC,WAAOoG,EAASpG,CAAQ;AAG5B,MAAIS,MAAS,cAAc,MAAM,QAAQT,CAAQ;AAC7C,WAAOA,EAAS,IAAIoG,CAAQ,EAAE,KAAK,IAAI;AAG3C,MAAI3F,MAAS,WAAW,OAAOT,KAAa,YAAY,UAAUA,GAAU;AACxE,UAAM,EAAE,MAAAqG,GAAM,IAAAC,EAAA,IAAOtG;AACrB,WAAI,CAACqG,KAAQ,CAACC,IACH,KAEJ,CAACD,GAAMC,CAAE,EAAE,OAAO,OAAO,EAAE,IAAIF,CAAQ,EAAE,KAAK,KAAK;AAAA,EAC9D;AAEA,SAAO;AACX,GAEMG,KAA0C;AAAA,EAC5C,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AACb,GAEMC,KAAqB,CAACT,GAAoBU,IAAW,iBAChDF,GAAgBR,CAAU,KAAKU,GAGpCtD,IAAkB,CAACZ,GAA2BwD,GAAoBrF,MAA0C;AAC9G,MAAI,CAAC6B;AACD;AAGJ,QAAMmE,IAAchG,KAAc8F,GAAmBT,GAAYrF,CAAU,GACrEwC,IAASyD,GAAMpE,GAAOmE,GAAa,oBAAI,MAAM;AAEnD,SAAOtD,GAAQF,CAAM,IAAIA,IAAS;AACtC;"}
|
|
@@ -1,11 +1,33 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { BaseDialogProps } from './Dialog';
|
|
3
3
|
export type ConfirmationDialogProps = BaseDialogProps & {
|
|
4
|
+
/**
|
|
5
|
+
* The content of the dialog body itself
|
|
6
|
+
*/
|
|
4
7
|
content?: string | React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* A callback fired when the confirmation button is clicked.
|
|
10
|
+
*
|
|
11
|
+
* @default () => {}
|
|
12
|
+
*/
|
|
5
13
|
onClickConfirm?: VoidFunction;
|
|
14
|
+
/**
|
|
15
|
+
* A callback fired when the cancel button is clicked or the dialog is closed.
|
|
16
|
+
*
|
|
17
|
+
* @default () => {}
|
|
18
|
+
*/
|
|
6
19
|
onClickCancel?: VoidFunction;
|
|
20
|
+
/**
|
|
21
|
+
* The content of the cancel button. (Usually a text, can also be a FormattedMessage component).
|
|
22
|
+
*/
|
|
7
23
|
cancelButtonText?: string | React.ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* The content of the confirmation button. Since it is a node, it can be a simple text or any JSX node like a div element with an icon and a text.
|
|
26
|
+
*/
|
|
8
27
|
confirmButtonText?: string | React.ReactNode;
|
|
28
|
+
/**
|
|
29
|
+
* When set to `true` the confirmation button will be disabled.
|
|
30
|
+
*/
|
|
9
31
|
disableConfirm?: boolean;
|
|
10
32
|
};
|
|
11
33
|
declare const ConfirmationDialog: (props: ConfirmationDialogProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmationDialog.js","sources":["../../../src/components/dialog/ConfirmationDialog.tsx"],"sourcesContent":["import type React from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport Button from '../button/Button';\nimport Dialog, { type BaseDialogProps } from './Dialog';\n\nexport type ConfirmationDialogProps = BaseDialogProps & {\n content?: string | React.ReactNode;\n onClickConfirm?: VoidFunction;\n onClickCancel?: VoidFunction;\n cancelButtonText?: string | React.ReactNode;\n confirmButtonText?: string | React.ReactNode;\n disableConfirm?: boolean;\n};\n\nconst ConfirmationDialog = (props: ConfirmationDialogProps) => {\n const {\n content,\n onClickCancel = noop,\n cancelButtonText,\n onClickConfirm = noop,\n confirmButtonText,\n disableConfirm,\n ...remainingProps\n } = props;\n\n const footer = (\n <div className='btn-toolbar'>\n <Button className='CancelButton' onClick={onClickCancel}>\n {cancelButtonText}\n </Button>\n <Button bsStyle='primary' className='ConfirmationButton' onClick={onClickConfirm} disabled={disableConfirm}>\n {confirmButtonText}\n </Button>\n </div>\n );\n\n return (\n <Dialog\n {...remainingProps}\n body={content}\n footer={footer}\n onClose={onClickCancel}\n showCloseButton={false}\n className='confirmation-dialog'\n disableEsc\n />\n );\n};\n\nexport default ConfirmationDialog;\n"],"names":["ConfirmationDialog","props","content","onClickCancel","noop","cancelButtonText","onClickConfirm","confirmButtonText","disableConfirm","remainingProps","jsx","Dialog","jsxs","Button"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"ConfirmationDialog.js","sources":["../../../src/components/dialog/ConfirmationDialog.tsx"],"sourcesContent":["import type React from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport Button from '../button/Button';\nimport Dialog, { type BaseDialogProps } from './Dialog';\n\nexport type ConfirmationDialogProps = BaseDialogProps & {\n /**\n * The content of the dialog body itself\n */\n content?: string | React.ReactNode;\n\n /**\n * A callback fired when the confirmation button is clicked.\n *\n * @default () => {}\n */\n onClickConfirm?: VoidFunction;\n\n /**\n * A callback fired when the cancel button is clicked or the dialog is closed.\n *\n * @default () => {}\n */\n onClickCancel?: VoidFunction;\n\n /**\n * The content of the cancel button. (Usually a text, can also be a FormattedMessage component).\n */\n cancelButtonText?: string | React.ReactNode;\n\n /**\n * The content of the confirmation button. Since it is a node, it can be a simple text or any JSX node like a div element with an icon and a text.\n */\n confirmButtonText?: string | React.ReactNode;\n\n /**\n * When set to `true` the confirmation button will be disabled.\n */\n disableConfirm?: boolean;\n};\n\nconst ConfirmationDialog = (props: ConfirmationDialogProps) => {\n const {\n content,\n onClickCancel = noop,\n cancelButtonText,\n onClickConfirm = noop,\n confirmButtonText,\n disableConfirm,\n ...remainingProps\n } = props;\n\n const footer = (\n <div className='btn-toolbar'>\n <Button className='CancelButton' onClick={onClickCancel}>\n {cancelButtonText}\n </Button>\n <Button bsStyle='primary' className='ConfirmationButton' onClick={onClickConfirm} disabled={disableConfirm}>\n {confirmButtonText}\n </Button>\n </div>\n );\n\n return (\n <Dialog\n {...remainingProps}\n body={content}\n footer={footer}\n onClose={onClickCancel}\n showCloseButton={false}\n className='confirmation-dialog'\n disableEsc\n />\n );\n};\n\nexport default ConfirmationDialog;\n"],"names":["ConfirmationDialog","props","content","onClickCancel","noop","cancelButtonText","onClickConfirm","confirmButtonText","disableConfirm","remainingProps","jsx","Dialog","jsxs","Button"],"mappings":";;;;AA0CA,MAAMA,IAAqB,CAACC,MAAmC;AAC3D,QAAM;AAAA,IACF,SAAAC;AAAA,IACA,eAAAC,IAAgBC;AAAA,IAChB,kBAAAC;AAAA,IACA,gBAAAC,IAAiBF;AAAA,IACjB,mBAAAG;AAAA,IACA,gBAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACHR;AAaJ,SACI,gBAAAS;AAAA,IAACC;AAAA,IAAA;AAAA,MACI,GAAGF;AAAA,MACJ,MAAMP;AAAA,MACN,QAdJ,gBAAAU,EAAC,OAAA,EAAI,WAAU,eACX,UAAA;AAAA,QAAA,gBAAAF,EAACG,GAAA,EAAO,WAAU,gBAAe,SAASV,GACrC,UAAAE,GACL;AAAA,QACA,gBAAAK,EAACG,GAAA,EAAO,SAAQ,WAAU,WAAU,sBAAqB,SAASP,GAAgB,UAAUE,GACvF,UAAAD,EAAA,CACL;AAAA,MAAA,GACJ;AAAA,MAQI,SAASJ;AAAA,MACT,iBAAiB;AAAA,MACjB,WAAU;AAAA,MACV,YAAU;AAAA,IAAA;AAAA,EAAA;AAGtB;"}
|
|
@@ -30,7 +30,17 @@ export type BaseDialogProps = {
|
|
|
30
30
|
*
|
|
31
31
|
* By default, the dialog has a medium size, and thus it can be omitted.
|
|
32
32
|
*
|
|
33
|
-
* Possible values are:
|
|
33
|
+
* Possible values are:
|
|
34
|
+
*
|
|
35
|
+
* - `'xs'`
|
|
36
|
+
* - `'sm'`
|
|
37
|
+
* - `'lg'`
|
|
38
|
+
* - `'xl'`
|
|
39
|
+
* - `'fullwidth'`
|
|
40
|
+
* - `'fullheight'`
|
|
41
|
+
* - `'fullheight-lg'`
|
|
42
|
+
* - `'fullheight-xl'`
|
|
43
|
+
* - `'fullscreen'`
|
|
34
44
|
*
|
|
35
45
|
* @default 'md'
|
|
36
46
|
*/
|
|
@@ -87,6 +97,8 @@ export type DialogProps = BaseDialogProps & {
|
|
|
87
97
|
* A callback function to be executed before closing the dialog.
|
|
88
98
|
*
|
|
89
99
|
* If the function returns `false`, the dialog will not be closed
|
|
100
|
+
*
|
|
101
|
+
* @default () => true
|
|
90
102
|
*/
|
|
91
103
|
onCloseValidation?: () => boolean;
|
|
92
104
|
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { jsx as s, jsxs as r, Fragment as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import L from "
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import { getOrCreatePortalRoot as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
1
|
+
import { jsx as s, jsxs as r, Fragment as $ } from "react/jsx-runtime";
|
|
2
|
+
import { useState as m } from "react";
|
|
3
|
+
import oo from "react-dom";
|
|
4
|
+
import { noop as L } from "es-toolkit/function";
|
|
5
|
+
import { useReducedMotion as eo, AnimatePresence as lo, motion as S } from "motion/react";
|
|
6
|
+
import _ from "../../utils/classNames.js";
|
|
7
|
+
import { getOrCreatePortalRoot as to } from "../../utils/portalRoot.js";
|
|
8
|
+
import so from "../../hooks/useEsc.js";
|
|
9
|
+
import I from "./DialogHeader.js";
|
|
10
|
+
import v from "./DialogBody.js";
|
|
11
11
|
import D from "./DialogFooter.js";
|
|
12
|
-
import
|
|
13
|
-
import { DialogContextProvider as
|
|
14
|
-
const C = "modal-dialog",
|
|
12
|
+
import ao from "../../hooks/useFocusTrap.js";
|
|
13
|
+
import { DialogContextProvider as io } from "./dialogContext.js";
|
|
14
|
+
const C = "modal-dialog", x = "modal-open", o = (w) => {
|
|
15
15
|
const {
|
|
16
|
-
title:
|
|
16
|
+
title: c,
|
|
17
17
|
subtitle: N,
|
|
18
18
|
body: d,
|
|
19
19
|
footer: f,
|
|
@@ -21,39 +21,39 @@ const C = "modal-dialog", v = "modal-open", o = (w) => {
|
|
|
21
21
|
className: F = "",
|
|
22
22
|
bodyClassName: Z,
|
|
23
23
|
footerClassName: A,
|
|
24
|
-
showXsDialogBorders:
|
|
25
|
-
showCloseButton:
|
|
26
|
-
useOverflow:
|
|
24
|
+
showXsDialogBorders: O = !1,
|
|
25
|
+
showCloseButton: B = !0,
|
|
26
|
+
useOverflow: H = !1,
|
|
27
27
|
bsSize: e,
|
|
28
28
|
show: a = !1,
|
|
29
|
-
onClose:
|
|
29
|
+
onClose: R = L,
|
|
30
30
|
disableEsc: T = !1,
|
|
31
|
-
onEsc: M =
|
|
31
|
+
onEsc: M = L,
|
|
32
32
|
onCloseValidation: P = () => !0,
|
|
33
33
|
children: u,
|
|
34
34
|
...G
|
|
35
|
-
} = w, [U, h] =
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
t ? document.body.classList.add(
|
|
40
|
-
},
|
|
41
|
-
P() && (h(!1),
|
|
42
|
-
}, [z, K] =
|
|
43
|
-
a !== z && (h(a),
|
|
44
|
-
if (!
|
|
35
|
+
} = w, [U, h] = m(a), p = to(), l = eo(), [n, X] = m(null);
|
|
36
|
+
ao(n);
|
|
37
|
+
const j = (t) => {
|
|
38
|
+
const i = p.getElementsByClassName(C).length > 1;
|
|
39
|
+
t ? document.body.classList.add(x) : !t && !i && document.body.classList.remove(x);
|
|
40
|
+
}, k = () => g(), g = (t) => {
|
|
41
|
+
P() && (h(!1), R(), M());
|
|
42
|
+
}, [z, K] = m(a);
|
|
43
|
+
a !== z && (h(a), j(a), K(a)), so(() => {
|
|
44
|
+
if (!n)
|
|
45
45
|
return;
|
|
46
|
-
const t =
|
|
47
|
-
!T && t.contains(
|
|
46
|
+
const t = n, i = document.activeElement;
|
|
47
|
+
!T && t.contains(i) && g();
|
|
48
48
|
});
|
|
49
49
|
const V = (t) => {
|
|
50
50
|
if (t.opacity === 0)
|
|
51
51
|
return;
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
},
|
|
52
|
+
const i = n, Y = document.activeElement;
|
|
53
|
+
i?.contains(Y) || i?.focus();
|
|
54
|
+
}, W = _("modal", "show", F), E = e === "xs", y = !!u, q = _(
|
|
55
55
|
C,
|
|
56
|
-
|
|
56
|
+
H && "modal-overflow",
|
|
57
57
|
e === "xs" && "modal-xs",
|
|
58
58
|
e === "sm" && "modal-sm",
|
|
59
59
|
e === "lg" && "modal-lg",
|
|
@@ -64,22 +64,22 @@ const C = "modal-dialog", v = "modal-open", o = (w) => {
|
|
|
64
64
|
e === "fullheight-lg" && "modal-full-height modal-lg",
|
|
65
65
|
e === "fullheight-xl" && "modal-full-height modal-xl",
|
|
66
66
|
e === "fullscreen" && "modal-fullscreen"
|
|
67
|
-
),
|
|
67
|
+
), J = {
|
|
68
68
|
type: "spring",
|
|
69
69
|
damping: 33,
|
|
70
70
|
stiffness: 500
|
|
71
|
-
},
|
|
71
|
+
}, Q = {
|
|
72
72
|
type: "spring",
|
|
73
73
|
damping: 25,
|
|
74
74
|
stiffness: 400
|
|
75
75
|
};
|
|
76
|
-
return
|
|
76
|
+
return oo.createPortal(
|
|
77
77
|
/* @__PURE__ */ s(
|
|
78
|
-
|
|
78
|
+
io,
|
|
79
79
|
{
|
|
80
|
-
value: { onClose:
|
|
80
|
+
value: { onClose: k, isSmallestDialog: E, showXsDialogBorders: O, showCloseButton: B },
|
|
81
81
|
children: /* @__PURE__ */ s(
|
|
82
|
-
|
|
82
|
+
lo,
|
|
83
83
|
{
|
|
84
84
|
initial: !1,
|
|
85
85
|
mode: "wait",
|
|
@@ -87,45 +87,45 @@ const C = "modal-dialog", v = "modal-open", o = (w) => {
|
|
|
87
87
|
"div",
|
|
88
88
|
{
|
|
89
89
|
...G,
|
|
90
|
-
className:
|
|
90
|
+
className: W,
|
|
91
91
|
role: "dialog",
|
|
92
|
-
ref: i,
|
|
93
92
|
"aria-label": "dialog",
|
|
94
93
|
tabIndex: 0,
|
|
95
94
|
children: [
|
|
96
95
|
/* @__PURE__ */ s(
|
|
97
|
-
|
|
96
|
+
S.div,
|
|
98
97
|
{
|
|
99
98
|
initial: l ? !1 : { opacity: 0, y: "-50%" },
|
|
100
|
-
animate: l ? { opacity: 1 } : { opacity: 1, y: 0, transition: E ?
|
|
99
|
+
animate: l ? { opacity: 1 } : { opacity: 1, y: 0, transition: E ? Q : J },
|
|
101
100
|
exit: l ? void 0 : { opacity: 0, y: "-150%" },
|
|
102
101
|
transition: l ? { duration: 0 } : {
|
|
103
102
|
opacity: { duration: 0.2 },
|
|
104
103
|
y: { duration: 0.3 }
|
|
105
104
|
},
|
|
106
105
|
onAnimationComplete: V,
|
|
107
|
-
ref:
|
|
108
|
-
className:
|
|
106
|
+
ref: X,
|
|
107
|
+
className: q,
|
|
109
108
|
role: "document",
|
|
109
|
+
tabIndex: -1,
|
|
110
110
|
children: /* @__PURE__ */ r("div", { className: "modal-content", children: [
|
|
111
111
|
y && u,
|
|
112
|
-
!y && /* @__PURE__ */ r(
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
!y && /* @__PURE__ */ r($, { children: [
|
|
113
|
+
c && /* @__PURE__ */ s(
|
|
114
|
+
I,
|
|
115
115
|
{
|
|
116
|
-
title:
|
|
116
|
+
title: c,
|
|
117
117
|
subtitle: N,
|
|
118
118
|
headerButtons: b
|
|
119
119
|
}
|
|
120
120
|
),
|
|
121
|
-
d && /* @__PURE__ */ s(
|
|
121
|
+
d && /* @__PURE__ */ s(v, { className: Z, children: d }),
|
|
122
122
|
f && /* @__PURE__ */ s(D, { className: A, children: f })
|
|
123
123
|
] })
|
|
124
124
|
] })
|
|
125
125
|
}
|
|
126
126
|
),
|
|
127
127
|
/* @__PURE__ */ s(
|
|
128
|
-
|
|
128
|
+
S.div,
|
|
129
129
|
{
|
|
130
130
|
initial: l ? !1 : { opacity: 0 },
|
|
131
131
|
animate: { opacity: 1 },
|
|
@@ -144,8 +144,8 @@ const C = "modal-dialog", v = "modal-open", o = (w) => {
|
|
|
144
144
|
p
|
|
145
145
|
);
|
|
146
146
|
};
|
|
147
|
-
o.Title =
|
|
148
|
-
o.Body =
|
|
147
|
+
o.Title = I;
|
|
148
|
+
o.Body = v;
|
|
149
149
|
o.Footer = D;
|
|
150
150
|
o.SIZE_XS = "xs";
|
|
151
151
|
o.SIZE_SM = "sm";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","sources":["../../../src/components/dialog/Dialog.tsx"],"sourcesContent":["import React, { useState, useRef, type PropsWithChildren } from 'react';\nimport ReactDOM from 'react-dom';\nimport classNames from 'classnames';\nimport { noop } from 'es-toolkit/function';\nimport { AnimatePresence, type AnimationDefinition, motion, type Transition, useReducedMotion } from 'motion/react';\n\nimport { getOrCreatePortalRoot } from '../../utils/portalRoot';\nimport useEsc from '../../hooks/useEsc';\nimport DialogHeader from './DialogHeader';\nimport DialogBody from './DialogBody';\nimport DialogFooter from './DialogFooter';\nimport useFocusTrap from '../../hooks/useFocusTrap';\nimport { DialogContextProvider } from './dialogContext';\n\nconst MODAL_DIALOG_CLASS = 'modal-dialog';\nconst MODAL_OPEN_CLASS = 'modal-open';\n\nexport type DialogSize =\n | 'xs'\n | 'sm'\n | 'md'\n | 'lg'\n | 'xl'\n | 'full'\n | 'fullwidth'\n | 'fullheight'\n | 'fullheight-lg'\n | 'fullheight-xl'\n | 'fullscreen';\n\nexport type BaseDialogProps = {\n /**\n * Opens the dialog when set to `true`.\n *\n * @default false\n */\n show: boolean;\n\n /**\n * The dialog title (can also be a FormattedMessage component).\n */\n title?: React.ReactNode;\n\n /**\n * The dialog header subtitle content.\n */\n subtitle?: React.ReactNode;\n\n /**\n * Shows a close button when set to `true`.\n *\n * @default true\n */\n showCloseButton?: boolean;\n\n /**\n * A callback function invoked when the dialog closes.\n */\n onClose?: () => void;\n\n /**\n * Defined how large the dialog will be rendered.\n *\n * By default, the dialog has a medium size, and thus it can be omitted.\n *\n * Possible values are: `xs`, `sm`, `lg` `xl` `fullwidth` `fullheight` 'fullheight-lg' 'fullheight-xl' `fullscreen`\n *\n * @default 'md'\n */\n bsSize?: DialogSize;\n\n /**\n * Enables or disabled closing the dialog via esc key.\n *\n * @default false\n */\n disableEsc?: boolean;\n\n /**\n * Enables the modal body to overflow and use inline scrolling if needed.\n *\n * @default false\n */\n useOverflow?: boolean;\n\n /**\n * Show Header and Footer Borders for the \"xs\" dialog\n *\n * @default false\n */\n showXsDialogBorders?: boolean;\n\n /**\n * Additional classes for the modal element.\n */\n className?: string;\n};\n\nexport type DialogProps = BaseDialogProps & {\n /**\n * The dialog body content.\n */\n body?: React.ReactNode;\n\n /**\n * The dialog body content.\n */\n footer?: React.ReactNode;\n\n /**\n * Additional classes for the modal-body element.\n */\n bodyClassName?: string;\n\n /**\n * Additional classes for the modal-footer element.\n */\n footerClassName?: string;\n\n /**\n * Allows to add additional buttons to the dialog header.\n */\n headerButtons?: React.ReactNode;\n\n /**\n * A callback fired when esc key is pressed and the dialog is about to close.\n */\n onEsc?: VoidFunction;\n\n /**\n * A callback function to be executed before closing the dialog.\n *\n * If the function returns `false`, the dialog will not be closed\n */\n onCloseValidation?: () => boolean;\n};\n\nconst Dialog = (props: PropsWithChildren<DialogProps>) => {\n const {\n title,\n subtitle,\n body,\n footer,\n headerButtons,\n className = '',\n bodyClassName,\n footerClassName,\n showXsDialogBorders = false,\n showCloseButton = true,\n useOverflow = false,\n bsSize,\n show = false,\n onClose: onCloseCallback = noop,\n disableEsc = false,\n onEsc = noop,\n onCloseValidation = () => true,\n children,\n ...remainingProps\n } = props;\n\n const [open, setOpen] = useState(show);\n const dialogWrapperRef = useRef<HTMLDivElement>(null);\n\n const modalRoot = getOrCreatePortalRoot();\n\n const shouldReduceMotion = useReducedMotion();\n\n // Use a setter function for the focus trap as it would not re-render\n // and fails to set the focus listener\n const [focusTrapRef, setFocusTrapRef] = useState<HTMLDivElement>();\n useFocusTrap(focusTrapRef);\n\n const toggleBodyClass = (add: boolean) => {\n // We need to set a body class to fix the -webkit-overflow-scrolling on safari and iOS\n\n // Remove \"modal-open\" from body only when there is no other dialog in the DOM\n // in order to support multiple dialogs\n const hasOtherDialogs = modalRoot.getElementsByClassName(MODAL_DIALOG_CLASS).length > 1;\n\n if (add) {\n document.body.classList.add(MODAL_OPEN_CLASS);\n } else if (!add && !hasOtherDialogs) {\n document.body.classList.remove(MODAL_OPEN_CLASS);\n }\n };\n\n const handleCloseButton = () => closeDialog(true);\n\n const closeDialog = (usedEscapeKey: boolean) => {\n if (onCloseValidation()) {\n setOpen(false);\n onCloseCallback();\n\n usedEscapeKey && onEsc();\n }\n };\n\n const [previousShow, setPreviousShow] = useState(show);\n if (show !== previousShow) {\n setOpen(show);\n toggleBodyClass(show);\n setPreviousShow(show);\n }\n\n useEsc(() => {\n if (!dialogWrapperRef || !dialogWrapperRef.current) {\n return;\n }\n\n const dialogElement = dialogWrapperRef.current;\n const currentActiveElement = document.activeElement;\n\n // Only allow to close the dialog when the focus is inside the dialog\n if (!disableEsc && dialogElement.contains(currentActiveElement)) {\n closeDialog(true);\n }\n });\n\n const handleAnimationComplete = (definition: AnimationDefinition) => {\n // The animation complete callback is invoked too when closing the dialog.\n // For that we check the animation props like the \"opacity\" to skip focusing\n // on the way out when closing the dialog.\n // @ts-ignore\n if (definition.opacity === 0) {\n return;\n }\n\n const dialogElement = dialogWrapperRef.current;\n const currentActiveElement = document.activeElement;\n\n // Set the focus to the dialog if no element inside has focus already. Otherwise, focused\n // elements like inputs would lose their focus to the dialog.\n // Note that in order to focus the dialog itself, the tabindex has to be set on that element\n // IMPORTANT: make sure the dialog has a tabIndex prop\n if (!dialogElement?.contains(currentActiveElement)) {\n dialogWrapperRef?.current?.focus();\n }\n };\n\n const modalClasses = classNames('modal', 'show', className);\n\n const isSmallestDialog = bsSize === 'xs';\n\n const hasChildren = !!children;\n\n const modalDialogClasses = classNames(\n MODAL_DIALOG_CLASS,\n useOverflow && 'modal-overflow',\n bsSize === 'xs' && 'modal-xs',\n bsSize === 'sm' && 'modal-sm',\n bsSize === 'lg' && 'modal-lg',\n bsSize === 'xl' && 'modal-xl',\n bsSize === 'full' && 'modal-full-width',\n bsSize === 'fullwidth' && 'modal-full-width',\n bsSize === 'fullheight' && 'modal-full-height',\n bsSize === 'fullheight-lg' && 'modal-full-height modal-lg',\n bsSize === 'fullheight-xl' && 'modal-full-height modal-xl',\n bsSize === 'fullscreen' && 'modal-fullscreen'\n );\n\n const spring: Transition = {\n type: 'spring',\n damping: 33,\n stiffness: 500,\n };\n\n const springXs: Transition = {\n type: 'spring',\n damping: 25,\n stiffness: 400,\n };\n\n return ReactDOM.createPortal(\n <DialogContextProvider\n value={{ onClose: handleCloseButton, isSmallestDialog, showXsDialogBorders, showCloseButton }}\n >\n {/* @ts-ignore-next-line */}\n <AnimatePresence\n // Disable any initial animations on children that\n // are present when the component is first rendered\n initial={false}\n // Only render one component at a time.\n // The exiting component will finish its exit\n // animation before entering component is rendered\n mode='wait'\n >\n {open && (\n <div\n {...remainingProps}\n className={modalClasses}\n role='dialog'\n ref={dialogWrapperRef}\n aria-label='dialog'\n // Make sure it has a tabIndex to focus the dialog so the close on esc works.\n // biome-ignore lint/a11y/noNoninteractiveTabindex: <explanation>\n tabIndex={0}\n >\n <motion.div\n initial={shouldReduceMotion ? false : { opacity: 0, y: '-50%' }}\n animate={\n shouldReduceMotion\n ? { opacity: 1 }\n : { opacity: 1, y: 0, transition: isSmallestDialog ? springXs : spring }\n }\n exit={shouldReduceMotion ? undefined : { opacity: 0, y: '-150%' }}\n transition={\n shouldReduceMotion\n ? { duration: 0 }\n : {\n opacity: { duration: 0.2 },\n y: { duration: 0.3 },\n }\n }\n onAnimationComplete={handleAnimationComplete}\n // @ts-ignore\n ref={setFocusTrapRef}\n className={modalDialogClasses}\n role='document'\n >\n <div className='modal-content'>\n {hasChildren && children}\n {!hasChildren && (\n <>\n {title && (\n <DialogHeader\n title={title}\n subtitle={subtitle}\n headerButtons={headerButtons}\n />\n )}\n {body && <DialogBody className={bodyClassName}>{body}</DialogBody>}\n {footer && <DialogFooter className={footerClassName}>{footer}</DialogFooter>}\n </>\n )}\n </div>\n </motion.div>\n <motion.div\n initial={shouldReduceMotion ? false : { opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={shouldReduceMotion ? undefined : { opacity: 0 }}\n transition={shouldReduceMotion ? { duration: 0 } : { duration: 0.1 }}\n className='modal-backdrop'\n />\n </div>\n )}\n </AnimatePresence>\n </DialogContextProvider>,\n modalRoot\n );\n};\n\nDialog.Title = DialogHeader;\nDialog.Body = DialogBody;\nDialog.Footer = DialogFooter;\n\nDialog.SIZE_XS = 'xs' as const;\nDialog.SIZE_SM = 'sm' as const;\nDialog.SIZE_MD = 'md' as const; // default\nDialog.SIZE_LG = 'lg' as const;\nDialog.SIZE_XL = 'xl' as const;\nDialog.SIZE_FULL = 'full' as const;\nDialog.SIZE_FULL_WIDTH = 'fullwidth' as const;\nDialog.SIZE_FULL_HEIGHT = 'fullheight' as const;\nDialog.SIZE_FULL_HEIGHT_LG = 'fullheight-lg' as const;\nDialog.SIZE_FULL_HEIGHT_XL = 'fullheight-xl' as const;\nDialog.SIZE_FULL_SCREEN = 'fullscreen' as const;\n\nexport default Dialog;\n"],"names":["MODAL_DIALOG_CLASS","MODAL_OPEN_CLASS","Dialog","props","title","subtitle","body","footer","headerButtons","className","bodyClassName","footerClassName","showXsDialogBorders","showCloseButton","useOverflow","bsSize","show","onCloseCallback","noop","disableEsc","onEsc","onCloseValidation","children","remainingProps","open","setOpen","useState","dialogWrapperRef","useRef","modalRoot","getOrCreatePortalRoot","shouldReduceMotion","useReducedMotion","focusTrapRef","setFocusTrapRef","useFocusTrap","toggleBodyClass","add","hasOtherDialogs","handleCloseButton","closeDialog","usedEscapeKey","previousShow","setPreviousShow","useEsc","dialogElement","currentActiveElement","handleAnimationComplete","definition","modalClasses","classNames","isSmallestDialog","hasChildren","modalDialogClasses","spring","springXs","ReactDOM","jsx","DialogContextProvider","AnimatePresence","jsxs","motion","Fragment","DialogHeader","DialogBody","DialogFooter"],"mappings":";;;;;;;;;;;;;AAcA,MAAMA,IAAqB,gBACrBC,IAAmB,cA0HnBC,IAAS,CAACC,MAA0C;AACtD,QAAM;AAAA,IACF,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,MAAAC;AAAA,IACA,QAAAC;AAAA,IACA,eAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,eAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,qBAAAC,IAAsB;AAAA,IACtB,iBAAAC,IAAkB;AAAA,IAClB,aAAAC,IAAc;AAAA,IACd,QAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,SAASC,IAAkBC;AAAA,IAC3B,YAAAC,IAAa;AAAA,IACb,OAAAC,IAAQF;AAAA,IACR,mBAAAG,IAAoB,MAAM;AAAA,IAC1B,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACHpB,GAEE,CAACqB,GAAMC,CAAO,IAAIC,EAASV,CAAI,GAC/BW,IAAmBC,GAAuB,IAAI,GAE9CC,IAAYC,GAAA,GAEZC,IAAqBC,GAAA,GAIrB,CAACC,GAAcC,CAAe,IAAIR,EAAA;AACxC,EAAAS,GAAaF,CAAY;AAEzB,QAAMG,IAAkB,CAACC,MAAiB;AAKtC,UAAMC,IAAkBT,EAAU,uBAAuB7B,CAAkB,EAAE,SAAS;AAEtF,IAAIqC,IACA,SAAS,KAAK,UAAU,IAAIpC,CAAgB,IACrC,CAACoC,KAAO,CAACC,KAChB,SAAS,KAAK,UAAU,OAAOrC,CAAgB;AAAA,EAEvD,GAEMsC,IA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;AAAA,0BAGPF,KAAQ,gBAAAmD,EAACO,GAAA,EAAW,WAAWtD,GAAgB,UAAAJ,GAAK;AAAA,0BACpDC,KAAU,gBAAAkD,EAACQ,GAAA,EAAa,WAAWtD,GAAkB,UAAAJ,EAAA,CAAO;AAAA,wBAAA,EAAA,CACjE;AAAA,sBAAA,EAAA,CAER;AAAA,oBAAA;AAAA,kBAAA;AAAA,kBAEJ,gBAAAkD;AAAA,oBAACI,EAAO;AAAA,oBAAP;AAAA,sBACG,SAAS9B,IAAqB,KAAQ,EAAE,SAAS,EAAA;AAAA,sBACjD,SAAS,EAAE,SAAS,EAAA;AAAA,sBACpB,MAAMA,IAAqB,SAAY,EAAE,SAAS,EAAA;AAAA,sBAClD,YAAYA,IAAqB,EAAE,UAAU,MAAM,EAAE,UAAU,IAAA;AAAA,sBAC/D,WAAU;AAAA,oBAAA;AAAA,kBAAA;AAAA,gBACd;AAAA,cAAA;AAAA,YAAA;AAAA,UACJ;AAAA,QAAA;AAAA,MAER;AAAA,IAAA;AAAA,IAEJF;AAAA,EAAA;AAER;AAEA3B,EAAO,QAAQ6D;AACf7D,EAAO,OAAO8D;AACd9D,EAAO,SAAS+D;AAEhB/D,EAAO,UAAU;AACjBA,EAAO,UAAU;AACjBA,EAAO,UAAU;AACjBA,EAAO,UAAU;AACjBA,EAAO,UAAU;AACjBA,EAAO,YAAY;AACnBA,EAAO,kBAAkB;AACzBA,EAAO,mBAAmB;AAC1BA,EAAO,sBAAsB;AAC7BA,EAAO,sBAAsB;AAC7BA,EAAO,mBAAmB;"}
|
|
1
|
+
{"version":3,"file":"Dialog.js","sources":["../../../src/components/dialog/Dialog.tsx"],"sourcesContent":["import React, { useState, type PropsWithChildren } from 'react';\nimport ReactDOM from 'react-dom';\nimport { noop } from 'es-toolkit/function';\nimport { AnimatePresence, type AnimationDefinition, motion, type Transition, useReducedMotion } from 'motion/react';\n\nimport classNames from '../../utils/classNames';\nimport { getOrCreatePortalRoot } from '../../utils/portalRoot';\nimport useEsc from '../../hooks/useEsc';\nimport DialogHeader from './DialogHeader';\nimport DialogBody from './DialogBody';\nimport DialogFooter from './DialogFooter';\nimport useFocusTrap from '../../hooks/useFocusTrap';\nimport { DialogContextProvider } from './dialogContext';\n\nconst MODAL_DIALOG_CLASS = 'modal-dialog';\nconst MODAL_OPEN_CLASS = 'modal-open';\n\nexport type DialogSize =\n | 'xs'\n | 'sm'\n | 'md'\n | 'lg'\n | 'xl'\n | 'full'\n | 'fullwidth'\n | 'fullheight'\n | 'fullheight-lg'\n | 'fullheight-xl'\n | 'fullscreen';\n\nexport type BaseDialogProps = {\n /**\n * Opens the dialog when set to `true`.\n *\n * @default false\n */\n show: boolean;\n\n /**\n * The dialog title (can also be a FormattedMessage component).\n */\n title?: React.ReactNode;\n\n /**\n * The dialog header subtitle content.\n */\n subtitle?: React.ReactNode;\n\n /**\n * Shows a close button when set to `true`.\n *\n * @default true\n */\n showCloseButton?: boolean;\n\n /**\n * A callback function invoked when the dialog closes.\n */\n onClose?: () => void;\n\n /**\n * Defined how large the dialog will be rendered.\n *\n * By default, the dialog has a medium size, and thus it can be omitted.\n *\n * Possible values are:\n *\n * - `'xs'`\n * - `'sm'`\n * - `'lg'`\n * - `'xl'`\n * - `'fullwidth'`\n * - `'fullheight'`\n * - `'fullheight-lg'`\n * - `'fullheight-xl'`\n * - `'fullscreen'`\n *\n * @default 'md'\n */\n bsSize?: DialogSize;\n\n /**\n * Enables or disabled closing the dialog via esc key.\n *\n * @default false\n */\n disableEsc?: boolean;\n\n /**\n * Enables the modal body to overflow and use inline scrolling if needed.\n *\n * @default false\n */\n useOverflow?: boolean;\n\n /**\n * Show Header and Footer Borders for the \"xs\" dialog\n *\n * @default false\n */\n showXsDialogBorders?: boolean;\n\n /**\n * Additional classes for the modal element.\n */\n className?: string;\n};\n\nexport type DialogProps = BaseDialogProps & {\n /**\n * The dialog body content.\n */\n body?: React.ReactNode;\n\n /**\n * The dialog body content.\n */\n footer?: React.ReactNode;\n\n /**\n * Additional classes for the modal-body element.\n */\n bodyClassName?: string;\n\n /**\n * Additional classes for the modal-footer element.\n */\n footerClassName?: string;\n\n /**\n * Allows to add additional buttons to the dialog header.\n */\n headerButtons?: React.ReactNode;\n\n /**\n * A callback fired when esc key is pressed and the dialog is about to close.\n */\n onEsc?: VoidFunction;\n\n /**\n * A callback function to be executed before closing the dialog.\n *\n * If the function returns `false`, the dialog will not be closed\n *\n * @default () => true\n */\n onCloseValidation?: () => boolean;\n};\n\nconst Dialog = (props: PropsWithChildren<DialogProps>) => {\n const {\n title,\n subtitle,\n body,\n footer,\n headerButtons,\n className = '',\n bodyClassName,\n footerClassName,\n showXsDialogBorders = false,\n showCloseButton = true,\n useOverflow = false,\n bsSize,\n show = false,\n onClose: onCloseCallback = noop,\n disableEsc = false,\n onEsc = noop,\n onCloseValidation = () => true,\n children,\n ...remainingProps\n } = props;\n\n const [open, setOpen] = useState(show);\n\n const modalRoot = getOrCreatePortalRoot();\n\n const shouldReduceMotion = useReducedMotion();\n\n // Use a setter function for the focus trap as it would not re-render\n // and fails to set the focus listener\n const [focusTrapRef, setFocusTrapRef] = useState<HTMLDivElement | null>(null);\n useFocusTrap(focusTrapRef);\n\n const toggleBodyClass = (add: boolean) => {\n // We need to set a body class to fix the -webkit-overflow-scrolling on safari and iOS\n\n // Remove \"modal-open\" from body only when there is no other dialog in the DOM\n // in order to support multiple dialogs\n const hasOtherDialogs = modalRoot.getElementsByClassName(MODAL_DIALOG_CLASS).length > 1;\n\n if (add) {\n document.body.classList.add(MODAL_OPEN_CLASS);\n } else if (!add && !hasOtherDialogs) {\n document.body.classList.remove(MODAL_OPEN_CLASS);\n }\n };\n\n const handleCloseButton = () => closeDialog(true);\n\n const closeDialog = (usedEscapeKey: boolean) => {\n if (onCloseValidation()) {\n setOpen(false);\n onCloseCallback();\n\n usedEscapeKey && onEsc();\n }\n };\n\n const [previousShow, setPreviousShow] = useState(show);\n if (show !== previousShow) {\n setOpen(show);\n toggleBodyClass(show);\n setPreviousShow(show);\n }\n\n useEsc(() => {\n if (!focusTrapRef) {\n return;\n }\n\n const dialogElement = focusTrapRef;\n const currentActiveElement = document.activeElement;\n\n // Only allow to close the dialog when the focus is inside the dialog\n if (!disableEsc && dialogElement.contains(currentActiveElement)) {\n closeDialog(true);\n }\n });\n\n const handleAnimationComplete = (definition: AnimationDefinition) => {\n // The animation complete callback is invoked too when closing the dialog.\n // For that we check the animation props like the \"opacity\" to skip focusing\n // on the way out when closing the dialog.\n // @ts-expect-error\n if (definition.opacity === 0) {\n return;\n }\n\n const dialogElement = focusTrapRef;\n const currentActiveElement = document.activeElement;\n\n // Set the focus to the dialog if no element inside has focus already. Otherwise, focused\n // elements like inputs would lose their focus to the dialog.\n // Note that in order to focus the dialog itself, the tabindex has to be set on that element\n // IMPORTANT: make sure the dialog has a tabIndex prop\n if (!dialogElement?.contains(currentActiveElement)) {\n dialogElement?.focus();\n }\n };\n\n const modalClasses = classNames('modal', 'show', className);\n\n const isSmallestDialog = bsSize === 'xs';\n\n const hasChildren = !!children;\n\n const modalDialogClasses = classNames(\n MODAL_DIALOG_CLASS,\n useOverflow && 'modal-overflow',\n bsSize === 'xs' && 'modal-xs',\n bsSize === 'sm' && 'modal-sm',\n bsSize === 'lg' && 'modal-lg',\n bsSize === 'xl' && 'modal-xl',\n bsSize === 'full' && 'modal-full-width',\n bsSize === 'fullwidth' && 'modal-full-width',\n bsSize === 'fullheight' && 'modal-full-height',\n bsSize === 'fullheight-lg' && 'modal-full-height modal-lg',\n bsSize === 'fullheight-xl' && 'modal-full-height modal-xl',\n bsSize === 'fullscreen' && 'modal-fullscreen'\n );\n\n const spring: Transition = {\n type: 'spring',\n damping: 33,\n stiffness: 500,\n };\n\n const springXs: Transition = {\n type: 'spring',\n damping: 25,\n stiffness: 400,\n };\n\n return ReactDOM.createPortal(\n <DialogContextProvider\n value={{ onClose: handleCloseButton, isSmallestDialog, showXsDialogBorders, showCloseButton }}\n >\n <AnimatePresence\n // Disable any initial animations on children that\n // are present when the component is first rendered\n initial={false}\n // Only render one component at a time.\n // The exiting component will finish its exit\n // animation before entering component is rendered\n mode='wait'\n >\n {open && (\n <div\n {...remainingProps}\n className={modalClasses}\n role='dialog'\n aria-label='dialog'\n // Make sure it has a tabIndex to focus the dialog so the close on esc works.\n // biome-ignore lint/a11y/noNoninteractiveTabindex: <explanation>\n tabIndex={0}\n >\n <motion.div\n initial={shouldReduceMotion ? false : { opacity: 0, y: '-50%' }}\n animate={\n shouldReduceMotion\n ? { opacity: 1 }\n : { opacity: 1, y: 0, transition: isSmallestDialog ? springXs : spring }\n }\n exit={shouldReduceMotion ? undefined : { opacity: 0, y: '-150%' }}\n transition={\n shouldReduceMotion\n ? { duration: 0 }\n : {\n opacity: { duration: 0.2 },\n y: { duration: 0.3 },\n }\n }\n onAnimationComplete={handleAnimationComplete}\n ref={setFocusTrapRef}\n className={modalDialogClasses}\n role='document'\n // Focus target for keyboard handling after open.\n // biome-ignore lint/a11y/noNoninteractiveTabindex: focusable container\n tabIndex={-1}\n >\n <div className='modal-content'>\n {hasChildren && children}\n {!hasChildren && (\n <>\n {title && (\n <DialogHeader\n title={title}\n subtitle={subtitle}\n headerButtons={headerButtons}\n />\n )}\n {body && <DialogBody className={bodyClassName}>{body}</DialogBody>}\n {footer && <DialogFooter className={footerClassName}>{footer}</DialogFooter>}\n </>\n )}\n </div>\n </motion.div>\n <motion.div\n initial={shouldReduceMotion ? false : { opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={shouldReduceMotion ? undefined : { opacity: 0 }}\n transition={shouldReduceMotion ? { duration: 0 } : { duration: 0.1 }}\n className='modal-backdrop'\n />\n </div>\n )}\n </AnimatePresence>\n </DialogContextProvider>,\n modalRoot\n );\n};\n\nDialog.Title = DialogHeader;\nDialog.Body = DialogBody;\nDialog.Footer = DialogFooter;\n\nDialog.SIZE_XS = 'xs' as const;\nDialog.SIZE_SM = 'sm' as const;\nDialog.SIZE_MD = 'md' as const; // default\nDialog.SIZE_LG = 'lg' as const;\nDialog.SIZE_XL = 'xl' as const;\nDialog.SIZE_FULL = 'full' as const;\nDialog.SIZE_FULL_WIDTH = 'fullwidth' as const;\nDialog.SIZE_FULL_HEIGHT = 'fullheight' as const;\nDialog.SIZE_FULL_HEIGHT_LG = 'fullheight-lg' as const;\nDialog.SIZE_FULL_HEIGHT_XL = 'fullheight-xl' as const;\nDialog.SIZE_FULL_SCREEN = 'fullscreen' as const;\n\nexport default Dialog;\n"],"names":["MODAL_DIALOG_CLASS","MODAL_OPEN_CLASS","Dialog","props","title","subtitle","body","footer","headerButtons","className","bodyClassName","footerClassName","showXsDialogBorders","showCloseButton","useOverflow","bsSize","show","onCloseCallback","noop","disableEsc","onEsc","onCloseValidation","children","remainingProps","open","setOpen","useState","modalRoot","getOrCreatePortalRoot","shouldReduceMotion","useReducedMotion","focusTrapRef","setFocusTrapRef","useFocusTrap","toggleBodyClass","add","hasOtherDialogs","handleCloseButton","closeDialog","usedEscapeKey","previousShow","setPreviousShow","useEsc","dialogElement","currentActiveElement","handleAnimationComplete","definition","modalClasses","classNames","isSmallestDialog","hasChildren","modalDialogClasses","spring","springXs","ReactDOM","jsx","DialogContextProvider","AnimatePresence","jsxs","motion","Fragment","DialogHeader","DialogBody","DialogFooter"],"mappings":";;;;;;;;;;;;;AAcA,MAAMA,IAAqB,gBACrBC,IAAmB,cAsInBC,IAAS,CAACC,MAA0C;AACtD,QAAM;AAAA,IACF,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,MAAAC;AAAA,IACA,QAAAC;AAAA,IACA,eAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,eAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,qBAAAC,IAAsB;AAAA,IACtB,iBAAAC,IAAkB;AAAA,IAClB,aAAAC,IAAc;AAAA,IACd,QAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,SAASC,IAAkBC;AAAA,IAC3B,YAAAC,IAAa;AAAA,IACb,OAAAC,IAAQF;AAAA,IACR,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ACjBA,EAAO,UAAU;AACjBA,EAAO,YAAY;AACnBA,EAAO,kBAAkB;AACzBA,EAAO,mBAAmB;AAC1BA,EAAO,sBAAsB;AAC7BA,EAAO,sBAAsB;AAC7BA,EAAO,mBAAmB;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import d from "
|
|
2
|
+
import d from "../../utils/classNames.js";
|
|
3
3
|
const t = ({ className: a = "", children: o, ...s }) => {
|
|
4
4
|
const l = d("modal-body", a);
|
|
5
5
|
return /* @__PURE__ */ r("div", { ...s, className: l, "aria-label": "dialog body", children: o });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogBody.js","sources":["../../../src/components/dialog/DialogBody.tsx"],"sourcesContent":["import type { ComponentProps, PropsWithChildren } from 'react';\nimport classNames from '
|
|
1
|
+
{"version":3,"file":"DialogBody.js","sources":["../../../src/components/dialog/DialogBody.tsx"],"sourcesContent":["import type { ComponentProps, PropsWithChildren } from 'react';\n\nimport classNames from '../../utils/classNames';\n\nexport type DialogBodyProps = ComponentProps<'div'> & {\n /**\n * Additional classes for the modal-body element.\n */\n className?: string;\n};\n\nconst DialogBody = ({ className = '', children, ...remainingProps }: PropsWithChildren<DialogBodyProps>) => {\n const classes = classNames('modal-body', className);\n return (\n <div {...remainingProps} className={classes} aria-label='dialog body'>\n {children}\n </div>\n );\n};\n\nexport default DialogBody;\n"],"names":["DialogBody","className","children","remainingProps","classes","classNames","jsx"],"mappings":";;AAWA,MAAMA,IAAa,CAAC,EAAE,WAAAC,IAAY,IAAI,UAAAC,GAAU,GAAGC,QAAyD;AACxG,QAAMC,IAAUC,EAAW,cAAcJ,CAAS;AAClD,SACI,gBAAAK,EAAC,SAAK,GAAGH,GAAgB,WAAWC,GAAS,cAAW,eACnD,UAAAF,GACL;AAER;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import d from "
|
|
2
|
+
import d from "../../utils/classNames.js";
|
|
3
3
|
import { useDialogContext as m } from "./dialogContext.js";
|
|
4
4
|
const f = (o) => {
|
|
5
5
|
const { className: s = "", children: r, ...a } = o, { isSmallestDialog: e, showXsDialogBorders: t } = m(), l = d(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogFooter.js","sources":["../../../src/components/dialog/DialogFooter.tsx"],"sourcesContent":["import type { ComponentProps, PropsWithChildren } from 'react';\nimport classNames from '
|
|
1
|
+
{"version":3,"file":"DialogFooter.js","sources":["../../../src/components/dialog/DialogFooter.tsx"],"sourcesContent":["import type { ComponentProps, PropsWithChildren } from 'react';\n\nimport classNames from '../../utils/classNames';\n\nimport { useDialogContext } from './dialogContext';\n\nexport type DialogFooterProps = ComponentProps<'div'> & {\n /**\n * Additional classes for the modal-footer element.\n */\n className?: string;\n};\n\nconst DialogFooter = (props: PropsWithChildren<DialogFooterProps>) => {\n const { className = '', children, ...remainingProps } = props;\n\n const { isSmallestDialog, showXsDialogBorders } = useDialogContext();\n\n const doShowXsDialogBorders = isSmallestDialog ? showXsDialogBorders : true;\n\n const footerClassNames = classNames(\n 'modal-footer',\n !doShowXsDialogBorders && 'border-top-none padding-top-0',\n className\n );\n\n return (\n <div {...remainingProps} className={footerClassNames} aria-label='dialog footer'>\n {children}\n </div>\n );\n};\n\nexport default DialogFooter;\n"],"names":["DialogFooter","props","className","children","remainingProps","isSmallestDialog","showXsDialogBorders","useDialogContext","footerClassNames","classNames","jsx"],"mappings":";;;AAaA,MAAMA,IAAe,CAACC,MAAgD;AAClE,QAAM,EAAE,WAAAC,IAAY,IAAI,UAAAC,GAAU,GAAGC,MAAmBH,GAElD,EAAE,kBAAAI,GAAkB,qBAAAC,EAAA,IAAwBC,EAAA,GAI5CC,IAAmBC;AAAA,IACrB;AAAA,IACA,EAJ0BJ,IAAmBC,IAAsB,OAIzC;AAAA,IAC1BJ;AAAA,EAAA;AAGJ,SACI,gBAAAQ,EAAC,SAAK,GAAGN,GAAgB,WAAWI,GAAkB,cAAW,iBAC5D,UAAAL,GACL;AAER;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import f from "react";
|
|
3
3
|
import { noop as v } from "es-toolkit/function";
|
|
4
|
-
import r from "
|
|
4
|
+
import r from "../../utils/classNames.js";
|
|
5
5
|
import { useDialogContext as x } from "./dialogContext.js";
|
|
6
6
|
const j = (d) => {
|
|
7
7
|
const { title: i, subtitle: t, headerButtons: s, onCloseButtonClick: n = v, ...c } = d, { onClose: m, isSmallestDialog: a, showXsDialogBorders: h, showCloseButton: u } = x(), l = a ? h : !0, b = a ? !1 : u, p = r("modal-header", !l && "border-bottom-none"), g = r(
|