@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,40 +1,40 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
const
|
|
1
|
+
import { jsxs as n, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import b from "react";
|
|
3
|
+
import f from "../../utils/classNames.js";
|
|
4
|
+
import x from "../checkbox/Checkbox.js";
|
|
5
|
+
import T from "./TreeIcon.js";
|
|
6
|
+
const y = b.memo((c) => {
|
|
7
7
|
const {
|
|
8
8
|
node: e,
|
|
9
9
|
hasMultiselect: r = !1,
|
|
10
|
-
isSelected:
|
|
11
|
-
isOpen:
|
|
12
|
-
isIndeterminate:
|
|
13
|
-
onToggleNode:
|
|
14
|
-
onSelect:
|
|
15
|
-
} =
|
|
10
|
+
isSelected: l = !1,
|
|
11
|
+
isOpen: t = !1,
|
|
12
|
+
isIndeterminate: s = !1,
|
|
13
|
+
onToggleNode: i,
|
|
14
|
+
onSelect: d
|
|
15
|
+
} = c, m = f(
|
|
16
16
|
"TreeNode",
|
|
17
17
|
"from-group",
|
|
18
|
-
|
|
18
|
+
l && "checked",
|
|
19
19
|
e.className && e.className
|
|
20
|
-
), o = !!e.items.length,
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
|
|
20
|
+
), o = !!e.items.length, h = () => {
|
|
21
|
+
d(e, s);
|
|
22
|
+
}, N = (p) => {
|
|
23
|
+
p.target.closest(".TreeCheckbox") || o && i(e.id);
|
|
24
24
|
};
|
|
25
|
-
return /* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ n("div", { className: m, "data-key": e.id, onClick: N, children: [
|
|
26
26
|
r && /* @__PURE__ */ a(
|
|
27
|
-
|
|
27
|
+
x,
|
|
28
28
|
{
|
|
29
29
|
className: "TreeCheckbox",
|
|
30
|
-
checked:
|
|
30
|
+
checked: l,
|
|
31
31
|
disabled: e.disabled,
|
|
32
|
-
indeterminate:
|
|
33
|
-
onClick:
|
|
32
|
+
indeterminate: s,
|
|
33
|
+
onClick: h
|
|
34
34
|
}
|
|
35
35
|
),
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
|
|
36
|
+
/* @__PURE__ */ n("span", { className: "TreeLabel TreeLabelName", children: [
|
|
37
|
+
/* @__PURE__ */ a(T, { icon: e.icon, expandedIcon: e.expandedIcon, isOpen: t }),
|
|
38
38
|
/* @__PURE__ */ a("span", { className: "TreeLabelNameText", children: /* @__PURE__ */ a("span", { className: "TreeLabelNameTextHeadline", children: e.name }) }),
|
|
39
39
|
/* @__PURE__ */ a("span", { className: "TreeLabelCount label label-muted label-filled label-condensed", children: e.items.length }),
|
|
40
40
|
/* @__PURE__ */ a(
|
|
@@ -47,6 +47,6 @@ const j = T.memo((t) => {
|
|
|
47
47
|
] });
|
|
48
48
|
});
|
|
49
49
|
export {
|
|
50
|
-
|
|
50
|
+
y as default
|
|
51
51
|
};
|
|
52
52
|
//# sourceMappingURL=TreeNode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNode.js","sources":["../../../src/components/assetTree/TreeNode.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from '
|
|
1
|
+
{"version":3,"file":"TreeNode.js","sources":["../../../src/components/assetTree/TreeNode.tsx"],"sourcesContent":["import React from 'react';\n\nimport classNames from '../../utils/classNames';\nimport Checkbox from '../checkbox/Checkbox';\nimport type { GroupedItem } from './Tree';\nimport TreeIcon from './TreeIcon';\n\nexport type TreeNodeProps = {\n node: GroupedItem;\n hasMultiselect?: boolean;\n isSelected?: boolean;\n isOpen?: boolean;\n isIndeterminate?: boolean;\n onToggleNode: (nodeId: string) => void;\n onSelect: (node: GroupedItem, isIndeterminate: boolean) => void;\n className?: string;\n};\n\nconst TreeNode = React.memo((props: TreeNodeProps) => {\n const {\n node,\n hasMultiselect = false,\n isSelected = false,\n isOpen = false,\n isIndeterminate = false,\n onToggleNode,\n onSelect,\n } = props;\n\n const treeNodeClassNames = classNames(\n 'TreeNode',\n 'from-group',\n isSelected && 'checked',\n node.className && node.className\n );\n\n const hasChildren = !!node.items.length;\n\n const handleNodeSelection = () => {\n onSelect(node, isIndeterminate);\n };\n\n const handleContainerClick = (event: React.MouseEvent<HTMLDivElement>) => {\n // Ignore clicks on checkboxes and don't expand or collapse on checkbox clicks\n const isCheckbox = (event.target as HTMLElement).closest('.TreeCheckbox');\n if (isCheckbox) {\n return;\n }\n\n if (hasChildren) {\n onToggleNode(node.id);\n }\n };\n\n return (\n <div className={treeNodeClassNames} data-key={node.id} onClick={handleContainerClick}>\n {hasMultiselect && (\n <Checkbox\n className='TreeCheckbox'\n checked={isSelected}\n disabled={node.disabled}\n indeterminate={isIndeterminate}\n onClick={handleNodeSelection}\n />\n )}\n <span className='TreeLabel TreeLabelName'>\n <TreeIcon icon={node.icon} expandedIcon={node.expandedIcon} isOpen={isOpen} />\n <span className='TreeLabelNameText'>\n <span className='TreeLabelNameTextHeadline'>{node.name}</span>\n </span>\n <span className='TreeLabelCount label label-muted label-filled label-condensed'>\n {node.items.length}\n </span>\n <span\n className={`TreeLabelExpander rioglyph rioglyph-chevron-down ${\n hasChildren ? '' : 'text-color-light'\n }`}\n />\n </span>\n </div>\n );\n});\n\nexport default TreeNode;\n"],"names":["TreeNode","React","props","node","hasMultiselect","isSelected","isOpen","isIndeterminate","onToggleNode","onSelect","treeNodeClassNames","classNames","hasChildren","handleNodeSelection","handleContainerClick","event","jsxs","jsx","Checkbox","TreeIcon"],"mappings":";;;;;AAkBA,MAAMA,IAAWC,EAAM,KAAK,CAACC,MAAyB;AAClD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;AAAA,EAAA,GACJ;AAER,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeContainer.js","sources":["../../../src/components/assetTree/TreeNodeContainer.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react';\nimport classNames from '
|
|
1
|
+
{"version":3,"file":"TreeNodeContainer.js","sources":["../../../src/components/assetTree/TreeNodeContainer.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react';\nimport classNames from '../../utils/classNames';\n\nexport type TreeNodeContainerProps = {\n isOpen: boolean;\n groupId?: string;\n disableAnimation: boolean;\n};\n\nconst TreeNodeContainer = (props: PropsWithChildren<TreeNodeContainerProps>) => {\n const { isOpen, groupId, disableAnimation, children } = props;\n\n const treeNodeContainerClasses = classNames(\n 'TreeNodeContainer',\n 'user-select-none overflow-hidden',\n isOpen && 'open'\n );\n\n return (\n <div className={treeNodeContainerClasses} data-id={groupId}>\n {children}\n </div>\n );\n};\n\nexport default TreeNodeContainer;\n"],"names":["TreeNodeContainer","props","isOpen","groupId","disableAnimation","children","treeNodeContainerClasses","classNames"],"mappings":";;AASA,MAAMA,IAAoB,CAACC,MAAqD;AAC5E,QAAM,EAAE,QAAAC,GAAQ,SAAAC,GAAS,kBAAAC,GAAkB,UAAAC,MAAaJ,GAElDK,IAA2BC;AAAA,IAC7B;AAAA,IACA;AAAA,IACAL,KAAU;AAAA,EAAA;AAGd,2BACK,OAAA,EAAI,WAAWI,GAA0B,WAASH,GAC9C,UAAAE,GACL;AAER;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import l from "
|
|
3
|
-
import
|
|
2
|
+
import { noop as l } from "es-toolkit/function";
|
|
3
|
+
import p from "../../utils/classNames.js";
|
|
4
4
|
import m from "../switch/Switch.js";
|
|
5
5
|
const x = (s) => {
|
|
6
|
-
const { isChecked: n = !1, className: o, label: t, onChange: a =
|
|
6
|
+
const { isChecked: n = !1, className: o, label: t, onChange: a = l, ...r } = s, i = p(
|
|
7
7
|
"TreeOption",
|
|
8
8
|
"display-flex",
|
|
9
9
|
"justify-content-start",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeOption.js","sources":["../../../src/components/assetTree/TreeOption.tsx"],"sourcesContent":["import type React from 'react';\nimport
|
|
1
|
+
{"version":3,"file":"TreeOption.js","sources":["../../../src/components/assetTree/TreeOption.tsx"],"sourcesContent":["import type React from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport classNames from '../../utils/classNames';\nimport Switch from '../switch/Switch';\n\nexport type TreeOptionProps = {\n /**\n * Defines whether the option is set.\n *\n * @default false\n */\n isChecked?: boolean;\n\n /**\n * Callback triggered when option is selected.\n * @param event\n * @returns\n */\n onChange?: (event: React.MouseEvent<HTMLDivElement>) => void;\n\n /**\n * The label for the option.\n */\n label: string | React.ReactNode;\n\n /**\n * Additional classes added to the wrapping element.\n */\n className?: string;\n};\n\nconst TreeOption = (props: TreeOptionProps) => {\n const { isChecked = false, className, label, onChange = noop, ...remainingProps } = props;\n\n const optionClasses = classNames(\n 'TreeOption',\n 'display-flex',\n 'justify-content-start',\n 'align-items-center',\n 'gap-10',\n 'cursor-pointer',\n className\n );\n\n return (\n <div {...remainingProps} className={optionClasses} onClick={onChange}>\n <span className='flex-1-1'>{label}</span>\n <span className='pointer-events-none scale-80'>\n <Switch keyName='TreeOption-switch' checked={isChecked} />\n </span>\n </div>\n );\n};\n\nexport default TreeOption;\n"],"names":["TreeOption","props","isChecked","className","label","onChange","noop","remainingProps","optionClasses","classNames","jsx","Switch"],"mappings":";;;;AAgCA,MAAMA,IAAa,CAACC,MAA2B;AAC3C,QAAM,EAAE,WAAAC,IAAY,IAAO,WAAAC,GAAW,OAAAC,GAAO,UAAAC,IAAWC,GAAM,GAAGC,EAAA,IAAmBN,GAE9EO,IAAgBC;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACAN;AAAA,EAAA;AAGJ,2BACK,OAAA,EAAK,GAAGI,GAAgB,WAAWC,GAAe,SAASH,GACxD,UAAA;AAAA,IAAA,gBAAAK,EAAC,QAAA,EAAK,WAAU,YAAY,UAAAN,GAAM;AAAA,IAClC,gBAAAM,EAAC,QAAA,EAAK,WAAU,gCACZ,UAAA,gBAAAA,EAACC,KAAO,SAAQ,qBAAoB,SAAST,EAAA,CAAW,EAAA,CAC5D;AAAA,EAAA,GACJ;AAER;"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import l from "
|
|
3
|
-
import
|
|
2
|
+
import { isEmpty as l } from "es-toolkit/compat";
|
|
3
|
+
import p from "../../utils/classNames.js";
|
|
4
4
|
import a from "../dropdown/ButtonDropdown.js";
|
|
5
5
|
import d from "../tooltip/SimpleTooltip.js";
|
|
6
6
|
const w = (i) => {
|
|
7
7
|
const { treeOptions: e = [], treeOptionsTooltip: t, className: s } = i;
|
|
8
|
-
if (
|
|
8
|
+
if (l(e))
|
|
9
9
|
return null;
|
|
10
|
-
const n =
|
|
10
|
+
const n = p("display-flex flex-column gap-10", "width-250", "padding-15", s), r = /* @__PURE__ */ o(
|
|
11
11
|
a,
|
|
12
12
|
{
|
|
13
13
|
title: /* @__PURE__ */ o("span", { className: "rioglyph rioglyph-option-vertical", "aria-hidden": "true" }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeOptions.js","sources":["../../../src/components/assetTree/TreeOptions.tsx"],"sourcesContent":["import type React from 'react';\nimport
|
|
1
|
+
{"version":3,"file":"TreeOptions.js","sources":["../../../src/components/assetTree/TreeOptions.tsx"],"sourcesContent":["import type React from 'react';\nimport { isEmpty } from 'es-toolkit/compat';\n\nimport classNames from '../../utils/classNames';\nimport ButtonDropdown from '../dropdown/ButtonDropdown';\nimport SimpleTooltip from '../tooltip/SimpleTooltip';\n\nexport type TreeOptionsProps = {\n treeOptions?: React.ReactNode[];\n treeOptionsTooltip?: React.ReactNode;\n className?: string;\n};\n\nconst TreeOptions = (props: TreeOptionsProps) => {\n const { treeOptions = [], treeOptionsTooltip, className } = props;\n\n if (isEmpty(treeOptions)) {\n return null;\n }\n\n const dropdownClasses = classNames('display-flex flex-column gap-10', 'width-250', 'padding-15', className);\n\n const customDropdown = <div className={dropdownClasses}>{treeOptions}</div>;\n\n const dropdown = (\n <ButtonDropdown\n title={<span className='rioglyph rioglyph-option-vertical' aria-hidden='true' />}\n bsStyle='default'\n bsSize='sm'\n customDropdown={customDropdown}\n toggleClassName='hover-bg-white border-none text-color-gray hover-text-color-dark'\n className='TreeHeaderOptions height-20'\n pullRight\n iconOnly\n />\n );\n\n if (treeOptionsTooltip) {\n return (\n <SimpleTooltip\n content={treeOptionsTooltip}\n placement='bottom-end'\n delay={{ show: 1000, hide: 0 }}\n popperConfig={{\n modifiers: [\n {\n name: 'offset',\n options: {\n offset: [10, 5],\n },\n },\n {\n name: 'arrow',\n options: {},\n },\n ],\n }}\n >\n <div>{dropdown}</div>\n </SimpleTooltip>\n );\n }\n\n return dropdown;\n};\n\nexport default TreeOptions;\n"],"names":["TreeOptions","props","treeOptions","treeOptionsTooltip","className","isEmpty","dropdownClasses","classNames","dropdown","jsx","ButtonDropdown","SimpleTooltip"],"mappings":";;;;;AAaA,MAAMA,IAAc,CAACC,MAA4B;AAC7C,QAAM,EAAE,aAAAC,IAAc,CAAA,GAAI,oBAAAC,GAAoB,WAAAC,MAAcH;AAE5D,MAAII,EAAQH,CAAW;AACnB,WAAO;AAGX,QAAMI,IAAkBC,EAAW,mCAAmC,aAAa,cAAcH,CAAS,GAIpGI,IACF,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,OAAO,gBAAAD,EAAC,QAAA,EAAK,WAAU,qCAAoC,eAAY,QAAO;AAAA,MAC9E,SAAQ;AAAA,MACR,QAAO;AAAA,MACP,gBAPe,gBAAAA,EAAC,OAAA,EAAI,WAAWH,GAAkB,UAAAJ,GAAY;AAAA,MAQ7D,iBAAgB;AAAA,MAChB,WAAU;AAAA,MACV,WAAS;AAAA,MACT,UAAQ;AAAA,IAAA;AAAA,EAAA;AAIhB,SAAIC,IAEI,gBAAAM;AAAA,IAACE;AAAA,IAAA;AAAA,MACG,SAASR;AAAA,MACT,WAAU;AAAA,MACV,OAAO,EAAE,MAAM,KAAM,MAAM,EAAA;AAAA,MAC3B,cAAc;AAAA,QACV,WAAW;AAAA,UACP;AAAA,YACI,MAAM;AAAA,YACN,SAAS;AAAA,cACL,QAAQ,CAAC,IAAI,CAAC;AAAA,YAAA;AAAA,UAClB;AAAA,UAEJ;AAAA,YACI,MAAM;AAAA,YACN,SAAS,CAAA;AAAA,UAAC;AAAA,QACd;AAAA,MACJ;AAAA,MAGJ,UAAA,gBAAAM,EAAC,SAAK,UAAAD,EAAA,CAAS;AAAA,IAAA;AAAA,EAAA,IAKpBA;AACX;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import l from "
|
|
3
|
-
import
|
|
2
|
+
import { useAutoAnimate as l } from "@formkit/auto-animate/react";
|
|
3
|
+
import m from "../../utils/classNames.js";
|
|
4
4
|
const u = ({ maxHeight: e, disableAnimation: o, children: t }) => {
|
|
5
|
-
const s =
|
|
5
|
+
const s = m("TreeRoot", "user-select-none", e ? "overflow-auto" : "overflow-hidden"), [r, n] = l();
|
|
6
6
|
return n(!o), /* @__PURE__ */ a("div", { ref: r, className: s, style: { maxHeight: e }, children: t });
|
|
7
7
|
};
|
|
8
8
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeRoot.js","sources":["../../../src/components/assetTree/TreeRoot.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react';\nimport
|
|
1
|
+
{"version":3,"file":"TreeRoot.js","sources":["../../../src/components/assetTree/TreeRoot.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react';\nimport { useAutoAnimate } from '@formkit/auto-animate/react';\n\nimport classNames from '../../utils/classNames';\n\nexport type TreeRootProps = {\n disableAnimation: boolean;\n maxHeight?: number;\n};\n\nconst TreeRoot = ({ maxHeight, disableAnimation, children }: PropsWithChildren<TreeRootProps>) => {\n const treeRootClasses = classNames('TreeRoot', 'user-select-none', maxHeight ? 'overflow-auto' : 'overflow-hidden');\n\n const [parent, enableAnimations] = useAutoAnimate();\n enableAnimations(!disableAnimation);\n\n return (\n <div ref={parent} className={treeRootClasses} style={{ maxHeight }}>\n {children}\n </div>\n );\n};\n\nexport default TreeRoot;\n"],"names":["TreeRoot","maxHeight","disableAnimation","children","treeRootClasses","classNames","parent","enableAnimations","useAutoAnimate","jsx"],"mappings":";;;AAUA,MAAMA,IAAW,CAAC,EAAE,WAAAC,GAAW,kBAAAC,GAAkB,UAAAC,QAAiD;AAC9F,QAAMC,IAAkBC,EAAW,YAAY,oBAAoBJ,IAAY,kBAAkB,iBAAiB,GAE5G,CAACK,GAAQC,CAAgB,IAAIC,EAAA;AACnC,SAAAD,EAAiB,CAACL,CAAgB,GAG9B,gBAAAO,EAAC,OAAA,EAAI,KAAKH,GAAQ,WAAWF,GAAiB,OAAO,EAAE,WAAAH,EAAA,GAClD,UAAAE,EAAA,CACL;AAER;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as e, jsxs as m } from "react/jsx-runtime";
|
|
2
2
|
import n from "react";
|
|
3
|
-
import p from "
|
|
4
|
-
import
|
|
3
|
+
import { noop as p } from "es-toolkit/function";
|
|
4
|
+
import i from "../../utils/classNames.js";
|
|
5
5
|
import t from "../clearableInput/ClearableInput.js";
|
|
6
6
|
const g = n.memo((a) => {
|
|
7
|
-
const { value: r, className: s, placeholder: o, onChange: l =
|
|
7
|
+
const { value: r, className: s, placeholder: o, onChange: l = p } = a, c = i("TreeSearch", s);
|
|
8
8
|
return /* @__PURE__ */ e("div", { className: c, children: /* @__PURE__ */ m("div", { className: "input-group flex-1-0", children: [
|
|
9
9
|
/* @__PURE__ */ e("span", { className: "input-group-addon", children: /* @__PURE__ */ e("span", { className: "rioglyph rioglyph-search", "aria-hidden": "true" }) }),
|
|
10
10
|
/* @__PURE__ */ e(t, { value: r, onChange: l, placeholder: o })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeSearch.js","sources":["../../../src/components/assetTree/TreeSearch.tsx"],"sourcesContent":["import React from 'react';\nimport
|
|
1
|
+
{"version":3,"file":"TreeSearch.js","sources":["../../../src/components/assetTree/TreeSearch.tsx"],"sourcesContent":["import React from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport classNames from '../../utils/classNames';\nimport ClearableInput from '../clearableInput/ClearableInput';\n\nexport type TreeSearchProps = {\n /**\n * The search value to be shown and used for the search.\n */\n value?: string;\n\n /**\n * Callback for when the search value changes.\n *\n * @default () => {}\n * @param newValue\n * @param event\n * @returns\n */\n onChange?: (newValue: string, event: React.ChangeEvent | React.MouseEvent) => void;\n\n /**\n * The placeholder text used for the input field.\n */\n placeholder?: string;\n\n /**\n * Additional classes added to the wrapping element.\n */\n className?: string;\n};\n\nconst TreeSearch = React.memo((props: TreeSearchProps) => {\n const { value, className, placeholder, onChange = noop } = props;\n\n const classes = classNames('TreeSearch', className);\n\n return (\n <div className={classes}>\n <div className='input-group flex-1-0'>\n <span className='input-group-addon'>\n <span className='rioglyph rioglyph-search' aria-hidden='true' />\n </span>\n <ClearableInput value={value} onChange={onChange} placeholder={placeholder} />\n </div>\n </div>\n );\n});\n\nexport default TreeSearch;\n"],"names":["TreeSearch","React","props","value","className","placeholder","onChange","noop","classes","classNames","jsxs","jsx","ClearableInput"],"mappings":";;;;;AAiCA,MAAMA,IAAaC,EAAM,KAAK,CAACC,MAA2B;AACtD,QAAM,EAAE,OAAAC,GAAO,WAAAC,GAAW,aAAAC,GAAa,UAAAC,IAAWC,MAASL,GAErDM,IAAUC,EAAW,cAAcL,CAAS;AAElD,2BACK,OAAA,EAAI,WAAWI,GACZ,UAAA,gBAAAE,EAAC,OAAA,EAAI,WAAU,wBACX,UAAA;AAAA,IAAA,gBAAAC,EAAC,QAAA,EAAK,WAAU,qBACZ,UAAA,gBAAAA,EAAC,UAAK,WAAU,4BAA2B,eAAY,OAAA,CAAO,EAAA,CAClE;AAAA,IACA,gBAAAA,EAACC,GAAA,EAAe,OAAAT,GAAc,UAAAG,GAAoB,aAAAD,EAAA,CAA0B;AAAA,EAAA,EAAA,CAChF,EAAA,CACJ;AAER,CAAC;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as m, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import l from "react";
|
|
3
3
|
import { noop as c } from "es-toolkit/function";
|
|
4
|
-
import t from "
|
|
4
|
+
import t from "../../utils/classNames.js";
|
|
5
5
|
import n from "./TreeSidebarCategories.js";
|
|
6
6
|
const h = l.memo((a) => {
|
|
7
7
|
const { className: s, onClick: r = c, ...o } = a, i = t("TreeSidebar", s);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeSidebar.js","sources":["../../../src/components/assetTree/TreeSidebar.tsx"],"sourcesContent":["import React from 'react';\nimport { noop } from 'es-toolkit/function';\nimport classNames from '
|
|
1
|
+
{"version":3,"file":"TreeSidebar.js","sources":["../../../src/components/assetTree/TreeSidebar.tsx"],"sourcesContent":["import React from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport classNames from '../../utils/classNames';\nimport TreeSidebarCategories from './TreeSidebarCategories';\nimport type { TreeCategoryNode } from './TreeCategory';\n\nexport type TreeSidebarProps = {\n currentCategoryId?: string;\n onSelectCategory?: (selectedCategory: string) => void;\n onClick?: VoidFunction;\n className?: string;\n children?: TreeCategoryNode[];\n};\n\nconst TreeSidebar = React.memo((props: TreeSidebarProps) => {\n const { className, onClick = noop, ...remainingProps } = props;\n\n const classes = classNames('TreeSidebar', className);\n\n return (\n <div className={classes}>\n <ul className='TreeSidebarNavigation' onClick={onClick}>\n <TreeSidebarCategories {...remainingProps} />\n </ul>\n <div className='TreeSidebarToggle' onClick={onClick}>\n <span className='rioglyph rioglyph-chevron-left' />\n </div>\n </div>\n );\n});\n\nexport default TreeSidebar;\n"],"names":["TreeSidebar","React","props","className","onClick","noop","remainingProps","classes","classNames","jsxs","jsx","TreeSidebarCategories"],"mappings":";;;;;AAeA,MAAMA,IAAcC,EAAM,KAAK,CAACC,MAA4B;AACxD,QAAM,EAAE,WAAAC,GAAW,SAAAC,IAAUC,GAAM,GAAGC,MAAmBJ,GAEnDK,IAAUC,EAAW,eAAeL,CAAS;AAEnD,SACI,gBAAAM,EAAC,OAAA,EAAI,WAAWF,GACZ,UAAA;AAAA,IAAA,gBAAAG,EAAC,MAAA,EAAG,WAAU,yBAAwB,SAAAN,GAClC,4BAACO,GAAA,EAAuB,GAAGL,GAAgB,EAAA,CAC/C;AAAA,IACA,gBAAAI,EAAC,SAAI,WAAU,qBAAoB,SAAAN,GAC/B,UAAA,gBAAAM,EAAC,QAAA,EAAK,WAAU,iCAAA,CAAiC,EAAA,CACrD;AAAA,EAAA,GACJ;AAER,CAAC;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as e, Fragment as g } from "react/jsx-runtime";
|
|
2
|
-
import h from "
|
|
3
|
-
import
|
|
2
|
+
import { noop as h } from "es-toolkit/function";
|
|
3
|
+
import C from "../../utils/classNames.js";
|
|
4
4
|
import u from "../overlay/OverlayTrigger.js";
|
|
5
5
|
import s from "../tooltip/Tooltip.js";
|
|
6
6
|
const y = "active", S = "selected", f = 1500, _ = (l) => {
|
|
7
|
-
const { children: r, currentCategoryId: c, onSelectCategory: i =
|
|
7
|
+
const { children: r, currentCategoryId: c, onSelectCategory: i = h } = l;
|
|
8
8
|
return r ? /* @__PURE__ */ e(g, { children: r.map((o) => {
|
|
9
|
-
const t = o.props.id, p = o.props.icon || "", a = o.props.label, m =
|
|
9
|
+
const t = o.props.id, p = o.props.icon || "", a = o.props.label, m = C(
|
|
10
10
|
c === t ? y : "",
|
|
11
11
|
o.props.hasSelection && S
|
|
12
12
|
), n = /* @__PURE__ */ e("li", { onClick: (d) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeSidebarCategories.js","sources":["../../../src/components/assetTree/TreeSidebarCategories.tsx"],"sourcesContent":["import type React from 'react';\nimport
|
|
1
|
+
{"version":3,"file":"TreeSidebarCategories.js","sources":["../../../src/components/assetTree/TreeSidebarCategories.tsx"],"sourcesContent":["import type React from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport classNames from '../../utils/classNames';\nimport OverlayTrigger from '../overlay/OverlayTrigger';\nimport Tooltip from '../tooltip/Tooltip';\nimport type { TreeCategoryNode } from './TreeCategory';\n\nconst ACTIVE_CLASS_NAME = 'active';\nconst SELECTED_CLASS_NAME = 'selected';\n\nconst TOOLTIP_DELAY = 1500;\n\nexport type TreeSidebarCategoriesProps = {\n currentCategoryId?: string;\n onSelectCategory?: (selectedCategory: string) => void;\n children?: TreeCategoryNode[];\n};\n\nconst TreeSidebarCategories = (props: TreeSidebarCategoriesProps) => {\n const { children, currentCategoryId, onSelectCategory = noop } = props;\n\n if (!children) {\n return null;\n }\n\n return (\n <>\n {children.map(child => {\n const id = child.props.id;\n const icon = child.props.icon || '';\n const label = child.props.label;\n\n const statusClassName = classNames(\n currentCategoryId === id ? ACTIVE_CLASS_NAME : '',\n child.props.hasSelection && SELECTED_CLASS_NAME\n );\n\n const handleSelectCategory = (event: React.MouseEvent<HTMLLIElement>) => {\n event.stopPropagation();\n onSelectCategory(id);\n };\n\n const category = (\n <li key={id} onClick={handleSelectCategory} className={statusClassName}>\n <div className='selection-bubble'>\n <span className={`rioglyph ${icon}`} />\n </div>\n </li>\n );\n\n if (label) {\n return (\n <OverlayTrigger\n key={`category-tooltip-${id}`}\n placement={Tooltip.RIGHT}\n delay={{ show: TOOLTIP_DELAY, hide: 0 }}\n overlay={\n <Tooltip id='tooltip' width='auto'>\n <span>{label}</span>\n </Tooltip>\n }\n >\n {category}\n </OverlayTrigger>\n );\n }\n\n return category;\n })}\n </>\n );\n};\n\nexport default TreeSidebarCategories;\n"],"names":["ACTIVE_CLASS_NAME","SELECTED_CLASS_NAME","TOOLTIP_DELAY","TreeSidebarCategories","props","children","currentCategoryId","onSelectCategory","noop","jsx","Fragment","child","id","icon","label","statusClassName","classNames","category","event","OverlayTrigger","Tooltip"],"mappings":";;;;;AAQA,MAAMA,IAAoB,UACpBC,IAAsB,YAEtBC,IAAgB,MAQhBC,IAAwB,CAACC,MAAsC;AACjE,QAAM,EAAE,UAAAC,GAAU,mBAAAC,GAAmB,kBAAAC,IAAmBC,MAASJ;AAEjE,SAAKC,IAKD,gBAAAI,EAAAC,GAAA,EACK,UAAAL,EAAS,IAAI,CAAAM,MAAS;AACnB,UAAMC,IAAKD,EAAM,MAAM,IACjBE,IAAOF,EAAM,MAAM,QAAQ,IAC3BG,IAAQH,EAAM,MAAM,OAEpBI,IAAkBC;AAAA,MACpBV,MAAsBM,IAAKZ,IAAoB;AAAA,MAC/CW,EAAM,MAAM,gBAAgBV;AAAA,IAAA,GAQ1BgB,IACF,gBAAAR,EAAC,MAAA,EAAY,SANY,CAACS,MAA2C;AACrE,MAAAA,EAAM,gBAAA,GACNX,EAAiBK,CAAE;AAAA,IACvB,GAGgD,WAAWG,GACnD,UAAA,gBAAAN,EAAC,OAAA,EAAI,WAAU,oBACX,UAAA,gBAAAA,EAAC,UAAK,WAAW,YAAYI,CAAI,GAAA,CAAI,GACzC,KAHKD,CAIT;AAGJ,WAAIE,IAEI,gBAAAL;AAAA,MAACU;AAAA,MAAA;AAAA,QAEG,WAAWC,EAAQ;AAAA,QACnB,OAAO,EAAE,MAAMlB,GAAe,MAAM,EAAA;AAAA,QACpC,SACI,gBAAAO,EAACW,GAAA,EAAQ,IAAG,WAAU,OAAM,QACxB,UAAA,gBAAAX,EAAC,QAAA,EAAM,UAAAK,EAAA,CAAM,EAAA,CACjB;AAAA,QAGH,UAAAG;AAAA,MAAA;AAAA,MATI,oBAAoBL,CAAE;AAAA,IAAA,IAchCK;AAAA,EACX,CAAC,EAAA,CACL,IA/CO;AAiDf;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as e, jsxs as u, Fragment as c } from "react/jsx-runtime";
|
|
2
2
|
import m from "react";
|
|
3
|
-
import d from "
|
|
3
|
+
import d from "../../utils/classNames.js";
|
|
4
4
|
import r from "./TypeCounter.js";
|
|
5
5
|
import { TreeSummaryRow as p } from "./TreeSummaryRow.js";
|
|
6
6
|
const v = ({ assetCounts: a }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeSummary.js","sources":["../../../src/components/assetTree/TreeSummary.tsx"],"sourcesContent":["import React, { type PropsWithChildren } from 'react';\nimport classNames from '
|
|
1
|
+
{"version":3,"file":"TreeSummary.js","sources":["../../../src/components/assetTree/TreeSummary.tsx"],"sourcesContent":["import React, { type PropsWithChildren } from 'react';\n\nimport classNames from '../../utils/classNames';\nimport TypeCounter from './TypeCounter';\nimport TreeSummaryRow from './TreeSummaryRow';\n\nexport type AssetType = 'truck' | 'trailer' | 'bus' | 'van' | 'driver' | 'car';\n\nexport type TreeSummaryCounts = {\n /**\n * The amount of trucks\n */\n truck?: number;\n\n /**\n * The amount of trailers\n */\n trailer?: number;\n\n /**\n * The amount of buses\n */\n bus?: number;\n\n /**\n * The amount of vans\n */\n van?: number;\n\n /**\n * The amount of cars\n */\n car?: number;\n\n /**\n * The amount of drivers\n */\n driver?: number;\n};\n\nexport type DefaultAssetCountsProps = {\n assetCounts: TreeSummaryCounts;\n};\n\nconst DefaultAssetCounts = ({ assetCounts }: DefaultAssetCountsProps) => {\n const { truck, bus, van, trailer, car, driver } = assetCounts;\n return (\n <>\n <TypeCounter hideOnZero icon='truck-baseline' value={truck} />\n <TypeCounter hideOnZero icon='trailer-baseline' value={trailer} />\n <TypeCounter hideOnZero icon='bus-baseline' value={bus} />\n <TypeCounter hideOnZero icon='van-baseline' value={van} />\n <TypeCounter hideOnZero icon='car-baseline' value={car} />\n <TypeCounter hideOnZero icon='driver' value={driver} />\n </>\n );\n};\n\nexport type TreeSummaryProps = {\n /**\n * The object containing various asset type counter.\n */\n assetCounts?: TreeSummaryCounts;\n\n /**\n * The number of grid columns used for the built-in `TreeSummaryRow`.\n *\n * @default 4\n */\n gridCols?: number;\n\n /**\n * Additional classes added to the wrapping element.\n */\n className?: string;\n};\n\nconst TreeSummary = React.memo((props: PropsWithChildren<TreeSummaryProps>) => {\n const { className = '', assetCounts = {}, gridCols, children } = props;\n\n const classes = classNames(\n 'TreeSummary',\n 'display-flex flex-wrap',\n 'align-items-center',\n 'gap-10',\n 'padding-left-3',\n className\n );\n\n return (\n <div className={classes}>\n {children || (\n <TreeSummaryRow gridCols={gridCols}>\n <DefaultAssetCounts assetCounts={assetCounts} />\n </TreeSummaryRow>\n )}\n </div>\n );\n});\n\nexport default TreeSummary;\n"],"names":["DefaultAssetCounts","assetCounts","truck","bus","van","trailer","car","driver","jsxs","Fragment","jsx","TypeCounter","TreeSummary","React","props","className","gridCols","children","classes","classNames","TreeSummaryRow"],"mappings":";;;;;AA4CA,MAAMA,IAAqB,CAAC,EAAE,aAAAC,QAA2C;AACrE,QAAM,EAAE,OAAAC,GAAO,KAAAC,GAAK,KAAAC,GAAK,SAAAC,GAAS,KAAAC,GAAK,QAAAC,MAAWN;AAClD,SACI,gBAAAO,EAAAC,GAAA,EACI,UAAA;AAAA,IAAA,gBAAAC,EAACC,KAAY,YAAU,IAAC,MAAK,kBAAiB,OAAOT,GAAO;AAAA,sBAC3DS,GAAA,EAAY,YAAU,IAAC,MAAK,oBAAmB,OAAON,GAAS;AAAA,sBAC/DM,GAAA,EAAY,YAAU,IAAC,MAAK,gBAAe,OAAOR,GAAK;AAAA,sBACvDQ,GAAA,EAAY,YAAU,IAAC,MAAK,gBAAe,OAAOP,GAAK;AAAA,sBACvDO,GAAA,EAAY,YAAU,IAAC,MAAK,gBAAe,OAAOL,GAAK;AAAA,sBACvDK,GAAA,EAAY,YAAU,IAAC,MAAK,UAAS,OAAOJ,EAAA,CAAQ;AAAA,EAAA,GACzD;AAER,GAqBMK,IAAcC,EAAM,KAAK,CAACC,MAA+C;AAC3E,QAAM,EAAE,WAAAC,IAAY,IAAI,aAAAd,IAAc,CAAA,GAAI,UAAAe,GAAU,UAAAC,MAAaH,GAE3DI,IAAUC;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACAJ;AAAA,EAAA;AAGJ,SACI,gBAAAL,EAAC,OAAA,EAAI,WAAWQ,GACX,UAAAD,KACG,gBAAAP,EAACU,GAAA,EAAe,UAAAJ,GACZ,UAAA,gBAAAN,EAACV,GAAA,EAAmB,aAAAC,EAAA,CAA0B,EAAA,CAClD,GAER;AAER,CAAC;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as v, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as x, useRef as N } from "react";
|
|
3
|
-
import i from "classnames";
|
|
4
3
|
import { noop as R } from "es-toolkit/function";
|
|
4
|
+
import i from "../../utils/classNames.js";
|
|
5
5
|
import k from "../../hooks/useHover.js";
|
|
6
6
|
import w from "../../utils/mergeRefs.js";
|
|
7
7
|
import { withRioglyphPrefix as T } from "./treeUtils.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeCounter.js","sources":["../../../src/components/assetTree/TypeCounter.tsx"],"sourcesContent":["import type React from 'react';\nimport { forwardRef, useRef } from 'react';\nimport
|
|
1
|
+
{"version":3,"file":"TypeCounter.js","sources":["../../../src/components/assetTree/TypeCounter.tsx"],"sourcesContent":["import type React from 'react';\nimport { forwardRef, useRef } from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport classNames from '../../utils/classNames';\nimport useHover from '../../hooks/useHover';\nimport mergeRefs from '../../utils/mergeRefs';\nimport { withRioglyphPrefix } from './treeUtils';\n\nexport type TypeCounterProps = {\n /**\n * The item type for that counter. This will be used as a return value for the onClick callback.\n */\n type?: string;\n\n /**\n * The icon name. Note, when using the built-in generic type counter, the icon name will the\n * same as the item type. So make sure there is a corresponding icon for the defined type.\n */\n icon?: string;\n\n /**\n * Sets the active styling if active\n */\n isActive?: boolean;\n\n /**\n * Should be set when there is a type filter set in the tree to style the counter accordingly.\n *\n * @default false\n */\n hasFilter?: boolean;\n\n /**\n * Allows for interactivity. Use this prop when you allow clicking on the counter.\n *\n * @default false\n */\n enableActivity?: boolean;\n\n /**\n * Defines if the counter is rendered at all when the value is not defined ot 0.\n *\n * @default false\n */\n hideOnZero?: boolean;\n\n /**\n * Callback function when the counter is clicked. It returns the type value.\n * Make sure the \"type\" prop is defined to receive the value in the callback.\n *\n * @param type\n * @returns\n */\n onClick?: (type: string) => void;\n\n /**\n * A custom value to be shown in the counter.\n */\n value?: string | React.ReactNode | number;\n};\n\nconst TypeCounter = forwardRef<HTMLDivElement, TypeCounterProps>((props, ref) => {\n const {\n icon,\n value,\n isActive,\n hasFilter = false,\n enableActivity = false,\n onClick = noop,\n type,\n hideOnZero = false,\n ...remainingProps\n } = props;\n\n const internalRef = useRef<HTMLDivElement>(null);\n const mergedRef = mergeRefs([ref, internalRef]);\n\n const isHover = useHover(internalRef);\n\n const wrapperClassName = classNames(\n 'TypeCounter',\n 'display-flex align-items-center',\n 'user-select-none',\n 'margin-right-2',\n enableActivity ? 'cursor-pointer' : 'pointer-events-none',\n enableActivity && hasFilter && !isActive && !isHover && 'opacity-50'\n );\n\n const counterClassNames = classNames(\n 'TreeLabelCount',\n 'label label-condensed',\n isHover && !isActive && 'bg-white text-color-darker',\n isHover && !isActive && 'border-color-gray',\n isHover && isActive && 'border-color-primary',\n isActive ? 'label-primary' : 'label-muted label-filled'\n );\n\n const handleClick = () => type && onClick(type);\n\n if (hideOnZero && !value) {\n return null;\n }\n\n const iconName = withRioglyphPrefix(icon);\n\n return (\n <div ref={mergedRef} {...remainingProps} className={wrapperClassName} onClick={handleClick}>\n <span className={`rioglyph ${iconName} text-size-16 margin-right-2`} />\n <span className={counterClassNames}>{value || 0}</span>\n </div>\n );\n});\n\nexport default TypeCounter;\n"],"names":["TypeCounter","forwardRef","props","ref","icon","value","isActive","hasFilter","enableActivity","onClick","noop","type","hideOnZero","remainingProps","internalRef","useRef","mergedRef","mergeRefs","isHover","useHover","wrapperClassName","classNames","counterClassNames","handleClick","iconName","withRioglyphPrefix","jsxs","jsx"],"mappings":";;;;;;;AA8DA,MAAMA,IAAcC,EAA6C,CAACC,GAAOC,MAAQ;AAC7E,QAAM;AAAA,IACF,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,gBAAAC,IAAiB;AAAA,IACjB,SAAAC,IAAUC;AAAA,IACV,MAAAC;AAAA,IACA,YAAAC,IAAa;AAAA,IACb,GAAGC;AAAA,EAAA,IACHX,GAEEY,IAAcC,EAAuB,IAAI,GACzCC,IAAYC,EAAU,CAACd,GAAKW,CAAW,CAAC,GAExCI,IAAUC,EAASL,CAAW,GAE9BM,IAAmBC;AAAA,IACrB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACAb,IAAiB,mBAAmB;AAAA,IACpCA,KAAkBD,KAAa,CAACD,KAAY,CAACY,KAAW;AAAA,EAAA,GAGtDI,IAAoBD;AAAA,IACtB;AAAA,IACA;AAAA,IACAH,KAAW,CAACZ,KAAY;AAAA,IACxBY,KAAW,CAACZ,KAAY;AAAA,IACxBY,KAAWZ,KAAY;AAAA,IACvBA,IAAW,kBAAkB;AAAA,EAAA,GAG3BiB,IAAc,MAAMZ,KAAQF,EAAQE,CAAI;AAE9C,MAAIC,KAAc,CAACP;AACf,WAAO;AAGX,QAAMmB,IAAWC,EAAmBrB,CAAI;AAExC,SACI,gBAAAsB,EAAC,SAAI,KAAKV,GAAY,GAAGH,GAAgB,WAAWO,GAAkB,SAASG,GAC3E,UAAA;AAAA,IAAA,gBAAAI,EAAC,QAAA,EAAK,WAAW,YAAYH,CAAQ,gCAAgC;AAAA,IACrE,gBAAAG,EAAC,QAAA,EAAK,WAAWL,GAAoB,eAAS,EAAA,CAAE;AAAA,EAAA,GACpD;AAER,CAAC;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as _, jsx as d } from "react/jsx-runtime";
|
|
2
2
|
import { useState as h, useRef as E, useEffect as F } from "react";
|
|
3
|
-
import j from "classnames";
|
|
4
3
|
import { isEmpty as ge } from "es-toolkit/compat";
|
|
5
4
|
import { noop as a } from "es-toolkit/function";
|
|
6
5
|
import { isNil as fe } from "es-toolkit/predicate";
|
|
6
|
+
import j from "../../utils/classNames.js";
|
|
7
7
|
import he from "../clearableInput/ClearableInput.js";
|
|
8
8
|
import { DOWN as B, scrollItemIntoView as Se, UP as Ie } from "../../utils/scrollItemIntoView.js";
|
|
9
9
|
import { useDropDirection as be } from "../../utils/useDropDirection.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoSuggest.js","sources":["../../../src/components/autosuggest/AutoSuggest.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport classNames from 'classnames';\nimport { isEmpty } from 'es-toolkit/compat';\nimport { noop } from 'es-toolkit/function';\nimport { isNil } from 'es-toolkit/predicate';\n\nimport ClearableInput from '../clearableInput/ClearableInput';\nimport { scrollItemIntoView, UP, DOWN } from '../../utils/scrollItemIntoView';\nimport { useDropDirection } from '../../utils/useDropDirection';\nimport DropdownHeader from '../selects/DropdownHeader';\nimport MenuItem from '../menuItems/MenuItem';\nimport useClickOutside from '../../hooks/useClickOutside';\nimport AutoSuggestAddons from './AutoSuggestAddons';\nimport DropdownSpinner from './DropdownSpinner';\nimport NoItemMessage from './NoItemMessage';\n\nexport type AutoSuggestSuggestion = {\n /**\n * The text label for a suggestion item. If present, this will be returned when selecting the suggestion.\n */\n label?: string;\n\n /**\n * Set to disable the suggestion and disallow selecting it.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Optional custom suggestion node that will be rendered as given. Example, this is used by the TagManager\n * to render a placeholder with an icon next to it.\n */\n customSuggestion?: React.ReactNode;\n\n /**\n * Additional key-value pairs that are not relevant for rendering but may be handled on your side.\n */\n [name: string]: string | React.ReactNode;\n};\n\nexport type SelectedSuggestion = {\n suggestionValue: string | React.ReactElement;\n suggestion: AutoSuggestSuggestion;\n};\n\nexport type AutoSuggestInputProps = {\n /**\n * A native input id attribute. Passed through as HTML attribute to the input element.\n */\n id?: string;\n\n /**\n * The value to be set for the input. Using this prop the input can be controlled from the outside.\n */\n value?: string;\n\n /**\n * String that will be displayed inside the input when nothing is typed in.\n * @default `Start typing ...`\n */\n placeholder?: string | React.ReactNode;\n\n /**\n * Icon class name that shall be used. If defined, the input element is wrapped in an input-group\n * and the icon will be set in an input-addon. Example: `rioglyph-search`.\n */\n icon?: string;\n\n /**\n * Callback function which will be called when the input changes. __This is usually not needed__ as\n * the \"onSuggestionsFetchRequested\" callback takes care of any input change. It is listed here\n * for completeness and for certain edge cases.\n *\n * __Note:__ It might be removed in the future when not needed.'\n * @deprecated please use `onSuggestionsFetchRequested` instead\n * @param changeEvent\n * @param changeProps\n * @returns\n */\n onChange?: (changeEvent: React.SyntheticEvent, changeProps: { newValue: string }) => void;\n\n /**\n * Callback function which gets triggered when the input gaines focus.\n */\n onFocus?: VoidFunction;\n\n /**\n * Callback function which gets triggered when the input looses the focus.\n */\n onBlur?: VoidFunction;\n\n /**\n * Callback function which will be called when the input is cleared. __This is usually not needed__ as\n * the \"onSuggestionsFetchRequested\" callback takes care of any input change. It is listed here\n * for completeness and for certain edge cases.\n *\n * __Note:__ It might be removed in the future when not needed.\n */\n onClear?: VoidFunction;\n\n /**\n * Boolean value that adds the class `has-error` to the input\n * component. Use this for validation use cases. The Autosuggest component\n * should be wrapped in a `form-group` element with the class `has-feedback`.\n * @default false\n */\n hasError?: boolean;\n\n /**\n * Defines the tab index to be added to the input element.\n * @default 0\n */\n tabIndex?: number;\n\n /**\n * Boolean value that disabled the input component.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * The React ref for the underlying input.\n */\n inputRef?: React.MutableRefObject<HTMLInputElement>;\n\n /**\n * Additional class names that are added to the input component.\n */\n className?: string;\n};\n\nexport type AutoSuggestProps<T = AutoSuggestSuggestion> = {\n /**\n * A native input id attribute on the component root. Passed through as HTML attribute to the input element.\n */\n id?: string;\n\n /**\n * Object to define properties for the input component. For the input, the ClearableInput\n * component is used.\n */\n inputProps?: AutoSuggestInputProps;\n\n /**\n * Array of items which will be displayed. Items can be arbitrary objects as long as they\n * have a label defined.\n *\n * __Important__: in case you specify your own custom renderer via `renderSuggestion` prop, you\n * can pass our own object that does not need to have a label. In this case you may want to\n * specify the `customSuggestionKey` to avoid react throwing an error of rendering menu items with the same key.\n */\n suggestions?: AutoSuggestSuggestion[];\n\n /**\n * Text that will be shown when there is not match found. If nothing is defined the dropdown-menu\n * will not be rendered.\n */\n noItemMessage?: string | React.ReactNode;\n\n /**\n * Callback function which will be called every time you need to recalculate suggestions e.i.\n * when the filter is updates after each input. It will also be called when the input is\n * cleared. The value would be an empty string in this case.\n * @param result\n * @returns\n */\n onSuggestionsFetchRequested?: (result: { value: string }) => void;\n\n /**\n * Callback function which will be called when a suggestion is selected from the dropdown menu.\n * @param event\n * @param selectedSuggestion\n * @returns\n */\n onSuggestionSelected?: (\n event: React.MouseEvent<HTMLLIElement> | React.KeyboardEvent<HTMLDivElement>,\n selectedSuggestion: SelectedSuggestion\n ) => void;\n\n /**\n * Callback function which will be called every time the highlighted selection changes.\n * @param suggestion\n * @returns\n */\n onSuggestionHighlighted?: (suggestion: AutoSuggestSuggestion | null) => void;\n\n /**\n * Function that returns a string which will be displayed inside the input.\n * This is required when a custom render function for suggestions is provided.\n * Overwrite this function to provide the value to be used for a suggestion.\n * Default implementation is: `suggestion => suggestion.label`\n *\n * @param suggestion\n * @returns\n */\n getSuggestionValue?: (suggestion: AutoSuggestSuggestion) => string;\n\n /**\n * Function that defines how suggestions are rendered on the dropdown-menu.\n * Use this to customize the appearance for instance when you want to show an icon\n * for a suggestion.\n * Default implementation is: `suggestion => suggestion.label`\n *\n * @param suggestion\n * @returns\n */\n renderSuggestion?: (suggestion: AutoSuggestSuggestion) => React.ReactNode;\n\n /**\n * When rendering your own custom suggestions that do not have the `label` attribute, use this prop to specify\n * a unique value for each suggestion which will be used as a react key for the individual menu items.\n */\n customSuggestionKey?: string;\n\n /**\n * Boolean that disabled autoDropDirection and opens the dropdown-menu be above the toggle.\n * @default false\n */\n dropup?: boolean;\n\n /**\n * Defines whether the dropdown opens right aligned or not.\n * Set to true additionally disables autoDrop feature.\n * @default false\n */\n pullRight?: boolean;\n\n /**\n * Boolean that enables autoDrop feature.\n * @default true\n */\n autoDropDirection?: boolean;\n\n /**\n * Shows a loading spinner instead of the items if set to true.\n * @default false\n */\n isLoading?: boolean;\n\n /**\n * Boolean that enables opening the dropdown menu when gaining focus.\n * @default false\n */\n openOnFocus?: boolean;\n\n /**\n * Boolean that enables the selection of an item to close the dropdown or not.\n * @default true\n */\n closeOnSelect?: boolean;\n\n /**\n * Defines whether or not a selected item is shown in the input after it was selected.\n * @default true\n */\n showSelectedItemsInInput?: boolean;\n\n /**\n * Sets autocomplete value for autosuggest forms.\n */\n autoComplete?: string;\n\n /**\n * Adds a list of input-addons elements in front of the input.\n */\n leadingInputAddons?: React.ReactNode[];\n\n /**\n * Adds a list of input-addons elements after the input.\n */\n trailingInputAddons?: React.ReactNode[];\n\n /**\n * Additional class names that are added to the dropdown element.\n */\n dropdownClassName?: string;\n\n /**\n * Additional class names that are added to the wrapping element.\n */\n className?: string;\n};\n\nexport const AutoSuggest = (props: AutoSuggestProps) => {\n const {\n id,\n onSuggestionSelected = noop,\n onSuggestionsFetchRequested = noop,\n onSuggestionHighlighted = noop,\n renderSuggestion,\n customSuggestionKey,\n getSuggestionValue,\n suggestions = [],\n autoDropDirection = true,\n pullRight = false,\n dropup = false,\n isLoading = false,\n openOnFocus = false,\n closeOnSelect = true,\n showSelectedItemsInInput = true,\n autoComplete = 'off',\n inputProps = {\n id,\n disabled: false,\n onChange: noop,\n onClear: noop,\n onBlur: noop,\n onFocus: noop,\n placeholder: 'Start typing',\n hasError: false,\n tabIndex: 0,\n value: undefined,\n icon: undefined,\n },\n leadingInputAddons,\n trailingInputAddons,\n noItemMessage,\n dropdownClassName = '',\n className = '',\n ...remainingProps\n } = props;\n\n const [isOpen, setIsOpen] = useState(false);\n const [value, setValue] = useState(inputProps.value || '');\n const [highlightedItemIndex, setHighlightedItemIndex] = useState(-1);\n const [direction, setDirection] = useState(DOWN);\n\n const componentRef = useClickOutside(() => closeMenu());\n const dropdownMenuRef = useRef<HTMLUListElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const optionNodesRef = useRef<HTMLLIElement[]>([]);\n\n // Update internal value state from outside when external input value is given.\n // This is important for when this component is used as a controlled component\n const externalValue = inputProps.value;\n if (!isNil(externalValue) && value !== externalValue) {\n setValue(externalValue ?? '');\n }\n\n // Fetch suggestions on mounting the component by using the external\n // fetch callback\n useEffect(() => onSuggestionsFetchRequested({ value }), []);\n\n // When a new suggestion is highlighted it may be not in view as the dropdown menu\n // has an overflow and can scroll. In this case, we need to scroll to the highlighted suggestion\n // so the user can see it\n useEffect(() => {\n const focusedItem = getFocusedOptionNode();\n scrollItemIntoView(direction, dropdownMenuRef.current, focusedItem);\n }, [highlightedItemIndex, direction]);\n\n // Used to store the list item reference to allow highlighting a single node.\n // Update that list of nodes again when the suggestions change from the outside.\n useEffect(() => {\n const optionNodes = Array.from(dropdownMenuRef.current?.getElementsByTagName('li') || []);\n optionNodesRef.current = optionNodes;\n }, [suggestions]);\n\n // Overwrite position of dropdown menu in case auto drop is enabled\n const dropDirection = useDropDirection({ pullRight, dropup, autoDropDirection, dropdownMenuRef }, [suggestions]);\n\n const openMenu = () => {\n if (isOpen) {\n return;\n }\n setIsOpen(true);\n };\n\n const closeMenu = () => {\n setIsOpen(false);\n };\n\n const handleFocus = (_event: React.FocusEvent<HTMLInputElement>) => {\n if (openOnFocus) {\n openMenu();\n }\n if (inputProps.onFocus) {\n inputProps.onFocus();\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n switch (event.key) {\n case 'ArrowDown': {\n // select below on arrow down key\n const newHighlightedIndex = highlightedItemIndex + 1;\n if (isOpen && suggestions.length > newHighlightedIndex) {\n setHighlightedItemIndex(newHighlightedIndex);\n handleHighlightedSuggestionChanged(Number(newHighlightedIndex));\n setDirection(DOWN);\n }\n return;\n }\n case 'ArrowUp':\n // select above on arrow up key\n if (isOpen && highlightedItemIndex > 0) {\n const newHighlightedIndex = highlightedItemIndex - 1;\n setHighlightedItemIndex(newHighlightedIndex);\n handleHighlightedSuggestionChanged(Number(newHighlightedIndex));\n setDirection(UP);\n }\n return;\n case 'Enter':\n // select on enter\n if (isOpen && suggestions[highlightedItemIndex]) {\n onSuggestionClicked(event, suggestions[highlightedItemIndex]);\n } else {\n openMenu();\n }\n break;\n case 'Escape':\n case 'Tab':\n // close on esc key or on tab\n closeMenu();\n break;\n default:\n break;\n }\n };\n\n const getFocusedOptionNode = () => {\n return [...optionNodesRef.current].find((item: HTMLLIElement) => item.className.includes('active'));\n };\n\n const handleInputChange = (\n newValue: string,\n event: React.MouseEvent<HTMLSpanElement, MouseEvent> | React.ChangeEvent<HTMLInputElement>\n ) => {\n if (value !== newValue) {\n updateInputValue(newValue, event);\n }\n };\n\n const updateInputValue = (\n newValue: string,\n event:\n | React.MouseEvent<HTMLSpanElement, MouseEvent>\n | React.ChangeEvent<HTMLInputElement>\n | React.KeyboardEvent<HTMLDivElement>,\n shouldCloseMenu = false\n ) => {\n const closeMenuEventually = shouldCloseMenu ? false : isOpen;\n\n setIsOpen(!isOpen ? true : closeMenuEventually);\n setValue(newValue);\n setHighlightedItemIndex(-1);\n\n // Fire callback so the parent component can filter the suggestions accordingly\n onSuggestionsFetchRequested({ value: newValue });\n\n handleHighlightedSuggestionChanged(-1);\n\n // Trigger onChange callback to notify usage component only when value has actually changed\n const { value: newExternalValue, onChange = () => {} } = inputProps;\n if (newValue !== newExternalValue) {\n onChange(event, { newValue });\n }\n };\n\n const handleHighlightedSuggestionChanged = (currentHighlightedItemIndex: number) => {\n const currentHighlightedSuggestion =\n currentHighlightedItemIndex === -1 ? null : suggestions[currentHighlightedItemIndex];\n onSuggestionHighlighted(currentHighlightedSuggestion);\n };\n\n const clearInputValue = (_event: React.MouseEvent<HTMLSpanElement, MouseEvent>) => {\n setValue('');\n setHighlightedItemIndex(-1);\n\n // Focus the input field after clearing it's value in order to allow\n // entering new values right away\n if (inputRef.current) {\n inputRef.current.focus();\n }\n\n // Reset filter value so all suggestions are shown again\n onSuggestionsFetchRequested({ value: '' });\n\n handleHighlightedSuggestionChanged(-1);\n\n // Additionally, fire the onClear callback as the service may react on it\n if (inputProps.onClear) {\n inputProps.onClear();\n }\n };\n\n const getDefaultSuggestionValue = (suggestion: AutoSuggestSuggestion): string => {\n return suggestion.label ?? (suggestion[customSuggestionKey ?? ''] as string) ?? '';\n };\n\n const onSuggestionClicked = (\n event: React.MouseEvent<HTMLLIElement> | React.KeyboardEvent<HTMLDivElement>,\n suggestion: AutoSuggestSuggestion\n ) => {\n const getSuggestionValueFunction = getSuggestionValue ? getSuggestionValue : getDefaultSuggestionValue;\n\n const suggestionValue = getSuggestionValueFunction(suggestion);\n\n updateInputValue(suggestionValue, event, closeOnSelect);\n\n // fire callback with the selected item\n onSuggestionSelected(event, {\n suggestion,\n suggestionValue,\n });\n };\n\n const renderInput = () => {\n const { id: inputPropId, icon, value: ignoredExternalValue, ...remainingInputProps } = inputProps;\n const clearableProps = { id: id ?? inputPropId, ...remainingInputProps };\n\n const input = (\n <ClearableInput\n {...clearableProps}\n ref={inputRef}\n autoComplete={autoComplete}\n onChange={handleInputChange}\n onClear={clearInputValue}\n onFocus={handleFocus}\n onClick={openMenu}\n value={showSelectedItemsInInput ? value : ''}\n />\n );\n\n if (icon || leadingInputAddons || trailingInputAddons) {\n return (\n <AutoSuggestAddons\n icon={icon}\n leadingInputAddons={leadingInputAddons}\n trailingInputAddons={trailingInputAddons}\n >\n {input}\n </AutoSuggestAddons>\n );\n }\n\n return input;\n };\n\n const renderDefaultSuggestion = (suggestion: AutoSuggestSuggestion): React.ReactNode => suggestion.label;\n\n const renderDropdownMenu = () => {\n const dropdownMenuClasses = classNames(\n 'dropdown-menu',\n dropDirection.pullRight && 'pull-right',\n dropdownClassName\n );\n\n if (isLoading) {\n return <DropdownSpinner className={dropdownMenuClasses} />;\n }\n\n const hasNoSuggestions = isEmpty(suggestions);\n\n if (hasNoSuggestions && !noItemMessage) {\n return null;\n }\n\n return (\n <ul role='menu' className={dropdownMenuClasses} ref={dropdownMenuRef}>\n {hasNoSuggestions && noItemMessage && <NoItemMessage key='NoItemMessage' message={noItemMessage} />}\n {suggestions.map((suggestion, index) => {\n // In case a custom renderer is used but the customSuggestionKey is not set, throw an error\n if (renderSuggestion && !suggestion.label && !customSuggestionKey) {\n throw new Error(\n 'The \"customSuggestionKey\" need to be set when using a custom renderer ' +\n 'and not using the \"label\" prop for suggestions'\n );\n }\n\n const key = `index-${suggestion.label ?? suggestion[customSuggestionKey ?? '']}`;\n\n if (suggestion.header && suggestion.label) {\n return <DropdownHeader key={key} label={(suggestion as AutoSuggestSuggestion).label} />;\n }\n\n const renderFunction = renderSuggestion ? renderSuggestion : renderDefaultSuggestion;\n\n return (\n <MenuItem\n key={key}\n active={index === highlightedItemIndex}\n disabled={suggestion.disabled}\n value={\n suggestion.customSuggestion ? suggestion.customSuggestion : renderFunction(suggestion)\n }\n onSelect={(_: number | undefined, event: React.MouseEvent<HTMLLIElement>) =>\n onSuggestionClicked(event, suggestion)\n }\n index={index}\n />\n );\n })}\n </ul>\n );\n };\n\n const classes = classNames(\n 'AutoSuggest',\n 'dropdown',\n isOpen && 'open',\n dropDirection.dropup && 'dropup',\n className\n );\n\n return (\n <div {...remainingProps} className={classes} onKeyDown={handleKeyDown} ref={componentRef}>\n {renderInput()}\n {renderDropdownMenu()}\n </div>\n );\n};\n\nexport default AutoSuggest;\n"],"names":["AutoSuggest","props","id","onSuggestionSelected","noop","onSuggestionsFetchRequested","onSuggestionHighlighted","renderSuggestion","customSuggestionKey","getSuggestionValue","suggestions","autoDropDirection","pullRight","dropup","isLoading","openOnFocus","closeOnSelect","showSelectedItemsInInput","autoComplete","inputProps","leadingInputAddons","trailingInputAddons","noItemMessage","dropdownClassName","className","remainingProps","isOpen","setIsOpen","useState","value","setValue","highlightedItemIndex","setHighlightedItemIndex","direction","setDirection","DOWN","componentRef","useClickOutside","closeMenu","dropdownMenuRef","useRef","inputRef","optionNodesRef","externalValue","isNil","useEffect","focusedItem","getFocusedOptionNode","scrollItemIntoView","optionNodes","dropDirection","useDropDirection","openMenu","handleFocus","_event","handleKeyDown","event","newHighlightedIndex","handleHighlightedSuggestionChanged","UP","onSuggestionClicked","item","handleInputChange","newValue","updateInputValue","shouldCloseMenu","newExternalValue","onChange","currentHighlightedItemIndex","currentHighlightedSuggestion","clearInputValue","getDefaultSuggestionValue","suggestion","suggestionValue","renderInput","inputPropId","icon","ignoredExternalValue","remainingInputProps","clearableProps","input","jsx","ClearableInput","AutoSuggestAddons","renderDefaultSuggestion","renderDropdownMenu","dropdownMenuClasses","classNames","DropdownSpinner","hasNoSuggestions","isEmpty","NoItemMessage","index","key","DropdownHeader","renderFunction","MenuItem","_","classes","jsxs"],"mappings":";;;;;;;;;;;;;;;AA4RO,MAAMA,KAAc,CAACC,MAA4B;AACpD,QAAM;AAAA,IACF,IAAAC;AAAA,IACA,sBAAAC,IAAuBC;AAAA,IACvB,6BAAAC,IAA8BD;AAAA,IAC9B,yBAAAE,IAA0BF;AAAA,IAC1B,kBAAAG;AAAA,IACA,qBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,aAAAC,IAAc,CAAA;AAAA,IACd,mBAAAC,IAAoB;AAAA,IACpB,WAAAC,IAAY;AAAA,IACZ,QAAAC,IAAS;AAAA,IACT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UAAUyC,EAAW;AAAA,YACrB,OACIA,EAAW,mBAAmBA,EAAW,mBAAmBuB,EAAevB,CAAU;AAAA,YAEzF,UAAU,CAACyB,IAAuBzC,OAC9BI,EAAoBJ,IAAOgB,CAAU;AAAA,YAEzC,OAAAoB;AAAA,UAAA;AAAA,UATKC;AAAA,QAAA;AAAA,MAYjB,CAAC;AAAA,IAAA,GACL;AAAA,EAER,GAEMK,KAAUX;AAAA,IACZ;AAAA,IACA;AAAA,IACA7D,KAAU;AAAA,IACVwB,EAAc,UAAU;AAAA,IACxB1B;AAAA,EAAA;AAGJ,SACI,gBAAA2E,EAAC,SAAK,GAAG1E,IAAgB,WAAWyE,IAAS,WAAW3C,IAAe,KAAKnB,IACvE,UAAA;AAAA,IAAAsC,GAAA;AAAA,IACAW,GAAA;AAAA,EAAmB,GACxB;AAER;"}
|
|
1
|
+
{"version":3,"file":"AutoSuggest.js","sources":["../../../src/components/autosuggest/AutoSuggest.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { isEmpty } from 'es-toolkit/compat';\nimport { noop } from 'es-toolkit/function';\nimport { isNil } from 'es-toolkit/predicate';\n\nimport classNames from '../../utils/classNames';\nimport ClearableInput from '../clearableInput/ClearableInput';\nimport { scrollItemIntoView, UP, DOWN } from '../../utils/scrollItemIntoView';\nimport { useDropDirection } from '../../utils/useDropDirection';\nimport DropdownHeader from '../selects/DropdownHeader';\nimport MenuItem from '../menuItems/MenuItem';\nimport useClickOutside from '../../hooks/useClickOutside';\nimport AutoSuggestAddons from './AutoSuggestAddons';\nimport DropdownSpinner from './DropdownSpinner';\nimport NoItemMessage from './NoItemMessage';\n\nexport type AutoSuggestSuggestion = {\n /**\n * The text label for a suggestion item. If present, this will be returned when selecting the suggestion.\n */\n label?: string;\n\n /**\n * Set to disable the suggestion and disallow selecting it.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Optional custom suggestion node that will be rendered as given. Example, this is used by the TagManager\n * to render a placeholder with an icon next to it.\n */\n customSuggestion?: React.ReactNode;\n\n /**\n * Additional key-value pairs that are not relevant for rendering but may be handled on your side.\n */\n [name: string]: string | React.ReactNode;\n};\n\nexport type SelectedSuggestion = {\n suggestionValue: string | React.ReactElement;\n suggestion: AutoSuggestSuggestion;\n};\n\nexport type AutoSuggestInputProps = {\n /**\n * A native input id attribute. Passed through as HTML attribute to the input element.\n */\n id?: string;\n\n /**\n * The value to be set for the input. Using this prop the input can be controlled from the outside.\n */\n value?: string;\n\n /**\n * String that will be displayed inside the input when nothing is typed in.\n * @default `Start typing ...`\n */\n placeholder?: string | React.ReactNode;\n\n /**\n * Icon class name that shall be used. If defined, the input element is wrapped in an input-group\n * and the icon will be set in an input-addon. Example: `rioglyph-search`.\n */\n icon?: string;\n\n /**\n * Callback function which will be called when the input changes. __This is usually not needed__ as\n * the \"onSuggestionsFetchRequested\" callback takes care of any input change. It is listed here\n * for completeness and for certain edge cases.\n *\n * __Note:__ It might be removed in the future when not needed.'\n * @deprecated please use `onSuggestionsFetchRequested` instead\n * @param changeEvent\n * @param changeProps\n * @returns\n */\n onChange?: (changeEvent: React.SyntheticEvent, changeProps: { newValue: string }) => void;\n\n /**\n * Callback function which gets triggered when the input gaines focus.\n */\n onFocus?: VoidFunction;\n\n /**\n * Callback function which gets triggered when the input looses the focus.\n */\n onBlur?: VoidFunction;\n\n /**\n * Callback function which will be called when the input is cleared. __This is usually not needed__ as\n * the \"onSuggestionsFetchRequested\" callback takes care of any input change. It is listed here\n * for completeness and for certain edge cases.\n *\n * __Note:__ It might be removed in the future when not needed.\n */\n onClear?: VoidFunction;\n\n /**\n * Boolean value that adds the class `has-error` to the input\n * component. Use this for validation use cases. The Autosuggest component\n * should be wrapped in a `form-group` element with the class `has-feedback`.\n * @default false\n */\n hasError?: boolean;\n\n /**\n * Defines the tab index to be added to the input element.\n * @default 0\n */\n tabIndex?: number;\n\n /**\n * Boolean value that disabled the input component.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * The React ref for the underlying input.\n */\n inputRef?: React.MutableRefObject<HTMLInputElement>;\n\n /**\n * Additional class names that are added to the input component.\n */\n className?: string;\n};\n\nexport type AutoSuggestProps<T = AutoSuggestSuggestion> = {\n /**\n * A native input id attribute on the component root. Passed through as HTML attribute to the input element.\n */\n id?: string;\n\n /**\n * Object to define properties for the input component. For the input, the ClearableInput\n * component is used.\n */\n inputProps?: AutoSuggestInputProps;\n\n /**\n * Array of items which will be displayed. Items can be arbitrary objects as long as they\n * have a label defined.\n *\n * __Important__: in case you specify your own custom renderer via `renderSuggestion` prop, you\n * can pass our own object that does not need to have a label. In this case you may want to\n * specify the `customSuggestionKey` to avoid react throwing an error of rendering menu items with the same key.\n */\n suggestions?: AutoSuggestSuggestion[];\n\n /**\n * Text that will be shown when there is not match found. If nothing is defined the dropdown-menu\n * will not be rendered.\n */\n noItemMessage?: string | React.ReactNode;\n\n /**\n * Callback function which will be called every time you need to recalculate suggestions e.i.\n * when the filter is updates after each input. It will also be called when the input is\n * cleared. The value would be an empty string in this case.\n * @param result\n * @returns\n */\n onSuggestionsFetchRequested?: (result: { value: string }) => void;\n\n /**\n * Callback function which will be called when a suggestion is selected from the dropdown menu.\n * @param event\n * @param selectedSuggestion\n * @returns\n */\n onSuggestionSelected?: (\n event: React.MouseEvent<HTMLLIElement> | React.KeyboardEvent<HTMLDivElement>,\n selectedSuggestion: SelectedSuggestion\n ) => void;\n\n /**\n * Callback function which will be called every time the highlighted selection changes.\n * @param suggestion\n * @returns\n */\n onSuggestionHighlighted?: (suggestion: AutoSuggestSuggestion | null) => void;\n\n /**\n * Function that returns a string which will be displayed inside the input.\n * This is required when a custom render function for suggestions is provided.\n * Overwrite this function to provide the value to be used for a suggestion.\n * Default implementation is: `suggestion => suggestion.label`\n *\n * @param suggestion\n * @returns\n */\n getSuggestionValue?: (suggestion: AutoSuggestSuggestion) => string;\n\n /**\n * Function that defines how suggestions are rendered on the dropdown-menu.\n * Use this to customize the appearance for instance when you want to show an icon\n * for a suggestion.\n * Default implementation is: `suggestion => suggestion.label`\n *\n * @param suggestion\n * @returns\n */\n renderSuggestion?: (suggestion: AutoSuggestSuggestion) => React.ReactNode;\n\n /**\n * When rendering your own custom suggestions that do not have the `label` attribute, use this prop to specify\n * a unique value for each suggestion which will be used as a react key for the individual menu items.\n */\n customSuggestionKey?: string;\n\n /**\n * Boolean that disabled autoDropDirection and opens the dropdown-menu be above the toggle.\n * @default false\n */\n dropup?: boolean;\n\n /**\n * Defines whether the dropdown opens right aligned or not.\n * Set to true additionally disables autoDrop feature.\n * @default false\n */\n pullRight?: boolean;\n\n /**\n * Boolean that enables autoDrop feature.\n * @default true\n */\n autoDropDirection?: boolean;\n\n /**\n * Shows a loading spinner instead of the items if set to true.\n * @default false\n */\n isLoading?: boolean;\n\n /**\n * Boolean that enables opening the dropdown menu when gaining focus.\n * @default false\n */\n openOnFocus?: boolean;\n\n /**\n * Boolean that enables the selection of an item to close the dropdown or not.\n * @default true\n */\n closeOnSelect?: boolean;\n\n /**\n * Defines whether or not a selected item is shown in the input after it was selected.\n * @default true\n */\n showSelectedItemsInInput?: boolean;\n\n /**\n * Sets autocomplete value for autosuggest forms.\n */\n autoComplete?: string;\n\n /**\n * Adds a list of input-addons elements in front of the input.\n */\n leadingInputAddons?: React.ReactNode[];\n\n /**\n * Adds a list of input-addons elements after the input.\n */\n trailingInputAddons?: React.ReactNode[];\n\n /**\n * Additional class names that are added to the dropdown element.\n */\n dropdownClassName?: string;\n\n /**\n * Additional class names that are added to the wrapping element.\n */\n className?: string;\n};\n\nexport const AutoSuggest = (props: AutoSuggestProps) => {\n const {\n id,\n onSuggestionSelected = noop,\n onSuggestionsFetchRequested = noop,\n onSuggestionHighlighted = noop,\n renderSuggestion,\n customSuggestionKey,\n getSuggestionValue,\n suggestions = [],\n autoDropDirection = true,\n pullRight = false,\n dropup = false,\n isLoading = false,\n openOnFocus = false,\n closeOnSelect = true,\n showSelectedItemsInInput = true,\n autoComplete = 'off',\n inputProps = {\n id,\n disabled: false,\n onChange: noop,\n onClear: noop,\n onBlur: noop,\n onFocus: noop,\n placeholder: 'Start typing',\n hasError: false,\n tabIndex: 0,\n value: undefined,\n icon: undefined,\n },\n leadingInputAddons,\n trailingInputAddons,\n noItemMessage,\n dropdownClassName = '',\n className = '',\n ...remainingProps\n } = props;\n\n const [isOpen, setIsOpen] = useState(false);\n const [value, setValue] = useState(inputProps.value || '');\n const [highlightedItemIndex, setHighlightedItemIndex] = useState(-1);\n const [direction, setDirection] = useState(DOWN);\n\n const componentRef = useClickOutside(() => closeMenu());\n const dropdownMenuRef = useRef<HTMLUListElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const optionNodesRef = useRef<HTMLLIElement[]>([]);\n\n // Update internal value state from outside when external input value is given.\n // This is important for when this component is used as a controlled component\n const externalValue = inputProps.value;\n if (!isNil(externalValue) && value !== externalValue) {\n setValue(externalValue ?? '');\n }\n\n // Fetch suggestions on mounting the component by using the external\n // fetch callback\n useEffect(() => onSuggestionsFetchRequested({ value }), []);\n\n // When a new suggestion is highlighted it may be not in view as the dropdown menu\n // has an overflow and can scroll. In this case, we need to scroll to the highlighted suggestion\n // so the user can see it\n useEffect(() => {\n const focusedItem = getFocusedOptionNode();\n scrollItemIntoView(direction, dropdownMenuRef.current, focusedItem);\n }, [highlightedItemIndex, direction]);\n\n // Used to store the list item reference to allow highlighting a single node.\n // Update that list of nodes again when the suggestions change from the outside.\n useEffect(() => {\n const optionNodes = Array.from(dropdownMenuRef.current?.getElementsByTagName('li') || []);\n optionNodesRef.current = optionNodes;\n }, [suggestions]);\n\n // Overwrite position of dropdown menu in case auto drop is enabled\n const dropDirection = useDropDirection({ pullRight, dropup, autoDropDirection, dropdownMenuRef }, [suggestions]);\n\n const openMenu = () => {\n if (isOpen) {\n return;\n }\n setIsOpen(true);\n };\n\n const closeMenu = () => {\n setIsOpen(false);\n };\n\n const handleFocus = (_event: React.FocusEvent<HTMLInputElement>) => {\n if (openOnFocus) {\n openMenu();\n }\n if (inputProps.onFocus) {\n inputProps.onFocus();\n }\n };\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n switch (event.key) {\n case 'ArrowDown': {\n // select below on arrow down key\n const newHighlightedIndex = highlightedItemIndex + 1;\n if (isOpen && suggestions.length > newHighlightedIndex) {\n setHighlightedItemIndex(newHighlightedIndex);\n handleHighlightedSuggestionChanged(Number(newHighlightedIndex));\n setDirection(DOWN);\n }\n return;\n }\n case 'ArrowUp':\n // select above on arrow up key\n if (isOpen && highlightedItemIndex > 0) {\n const newHighlightedIndex = highlightedItemIndex - 1;\n setHighlightedItemIndex(newHighlightedIndex);\n handleHighlightedSuggestionChanged(Number(newHighlightedIndex));\n setDirection(UP);\n }\n return;\n case 'Enter':\n // select on enter\n if (isOpen && suggestions[highlightedItemIndex]) {\n onSuggestionClicked(event, suggestions[highlightedItemIndex]);\n } else {\n openMenu();\n }\n break;\n case 'Escape':\n case 'Tab':\n // close on esc key or on tab\n closeMenu();\n break;\n default:\n break;\n }\n };\n\n const getFocusedOptionNode = () => {\n return [...optionNodesRef.current].find((item: HTMLLIElement) => item.className.includes('active'));\n };\n\n const handleInputChange = (\n newValue: string,\n event: React.MouseEvent<HTMLSpanElement, MouseEvent> | React.ChangeEvent<HTMLInputElement>\n ) => {\n if (value !== newValue) {\n updateInputValue(newValue, event);\n }\n };\n\n const updateInputValue = (\n newValue: string,\n event:\n | React.MouseEvent<HTMLSpanElement, MouseEvent>\n | React.ChangeEvent<HTMLInputElement>\n | React.KeyboardEvent<HTMLDivElement>,\n shouldCloseMenu = false\n ) => {\n const closeMenuEventually = shouldCloseMenu ? false : isOpen;\n\n setIsOpen(!isOpen ? true : closeMenuEventually);\n setValue(newValue);\n setHighlightedItemIndex(-1);\n\n // Fire callback so the parent component can filter the suggestions accordingly\n onSuggestionsFetchRequested({ value: newValue });\n\n handleHighlightedSuggestionChanged(-1);\n\n // Trigger onChange callback to notify usage component only when value has actually changed\n const { value: newExternalValue, onChange = () => {} } = inputProps;\n if (newValue !== newExternalValue) {\n onChange(event, { newValue });\n }\n };\n\n const handleHighlightedSuggestionChanged = (currentHighlightedItemIndex: number) => {\n const currentHighlightedSuggestion =\n currentHighlightedItemIndex === -1 ? null : suggestions[currentHighlightedItemIndex];\n onSuggestionHighlighted(currentHighlightedSuggestion);\n };\n\n const clearInputValue = (_event: React.MouseEvent<HTMLSpanElement, MouseEvent>) => {\n setValue('');\n setHighlightedItemIndex(-1);\n\n // Focus the input field after clearing it's value in order to allow\n // entering new values right away\n if (inputRef.current) {\n inputRef.current.focus();\n }\n\n // Reset filter value so all suggestions are shown again\n onSuggestionsFetchRequested({ value: '' });\n\n handleHighlightedSuggestionChanged(-1);\n\n // Additionally, fire the onClear callback as the service may react on it\n if (inputProps.onClear) {\n inputProps.onClear();\n }\n };\n\n const getDefaultSuggestionValue = (suggestion: AutoSuggestSuggestion): string => {\n return suggestion.label ?? (suggestion[customSuggestionKey ?? ''] as string) ?? '';\n };\n\n const onSuggestionClicked = (\n event: React.MouseEvent<HTMLLIElement> | React.KeyboardEvent<HTMLDivElement>,\n suggestion: AutoSuggestSuggestion\n ) => {\n const getSuggestionValueFunction = getSuggestionValue ? getSuggestionValue : getDefaultSuggestionValue;\n\n const suggestionValue = getSuggestionValueFunction(suggestion);\n\n updateInputValue(suggestionValue, event, closeOnSelect);\n\n // fire callback with the selected item\n onSuggestionSelected(event, {\n suggestion,\n suggestionValue,\n });\n };\n\n const renderInput = () => {\n const { id: inputPropId, icon, value: ignoredExternalValue, ...remainingInputProps } = inputProps;\n const clearableProps = { id: id ?? inputPropId, ...remainingInputProps };\n\n const input = (\n <ClearableInput\n {...clearableProps}\n ref={inputRef}\n autoComplete={autoComplete}\n onChange={handleInputChange}\n onClear={clearInputValue}\n onFocus={handleFocus}\n onClick={openMenu}\n value={showSelectedItemsInInput ? value : ''}\n />\n );\n\n if (icon || leadingInputAddons || trailingInputAddons) {\n return (\n <AutoSuggestAddons\n icon={icon}\n leadingInputAddons={leadingInputAddons}\n trailingInputAddons={trailingInputAddons}\n >\n {input}\n </AutoSuggestAddons>\n );\n }\n\n return input;\n };\n\n const renderDefaultSuggestion = (suggestion: AutoSuggestSuggestion): React.ReactNode => suggestion.label;\n\n const renderDropdownMenu = () => {\n const dropdownMenuClasses = classNames(\n 'dropdown-menu',\n dropDirection.pullRight && 'pull-right',\n dropdownClassName\n );\n\n if (isLoading) {\n return <DropdownSpinner className={dropdownMenuClasses} />;\n }\n\n const hasNoSuggestions = isEmpty(suggestions);\n\n if (hasNoSuggestions && !noItemMessage) {\n return null;\n }\n\n return (\n <ul role='menu' className={dropdownMenuClasses} ref={dropdownMenuRef}>\n {hasNoSuggestions && noItemMessage && <NoItemMessage key='NoItemMessage' message={noItemMessage} />}\n {suggestions.map((suggestion, index) => {\n // In case a custom renderer is used but the customSuggestionKey is not set, throw an error\n if (renderSuggestion && !suggestion.label && !customSuggestionKey) {\n throw new Error(\n 'The \"customSuggestionKey\" need to be set when using a custom renderer ' +\n 'and not using the \"label\" prop for suggestions'\n );\n }\n\n const key = `index-${suggestion.label ?? suggestion[customSuggestionKey ?? '']}`;\n\n if (suggestion.header && suggestion.label) {\n return <DropdownHeader key={key} label={(suggestion as AutoSuggestSuggestion).label} />;\n }\n\n const renderFunction = renderSuggestion ? renderSuggestion : renderDefaultSuggestion;\n\n return (\n <MenuItem\n key={key}\n active={index === highlightedItemIndex}\n disabled={suggestion.disabled}\n value={\n suggestion.customSuggestion ? suggestion.customSuggestion : renderFunction(suggestion)\n }\n onSelect={(_: number | undefined, event: React.MouseEvent<HTMLLIElement>) =>\n onSuggestionClicked(event, suggestion)\n }\n index={index}\n />\n );\n })}\n </ul>\n );\n };\n\n const classes = classNames(\n 'AutoSuggest',\n 'dropdown',\n isOpen && 'open',\n dropDirection.dropup && 'dropup',\n className\n );\n\n return (\n <div {...remainingProps} className={classes} onKeyDown={handleKeyDown} ref={componentRef}>\n {renderInput()}\n {renderDropdownMenu()}\n </div>\n );\n};\n\nexport default AutoSuggest;\n"],"names":["AutoSuggest","props","id","onSuggestionSelected","noop","onSuggestionsFetchRequested","onSuggestionHighlighted","renderSuggestion","customSuggestionKey","getSuggestionValue","suggestions","autoDropDirection","pullRight","dropup","isLoading","openOnFocus","closeOnSelect","showSelectedItemsInInput","autoComplete","inputProps","leadingInputAddons","trailingInputAddons","noItemMessage","dropdownClassName","className","remainingProps","isOpen","setIsOpen","useState","value","setValue","highlightedItemIndex","setHighlightedItemIndex","direction","setDirection","DOWN","componentRef","useClickOutside","closeMenu","dropdownMenuRef","useRef","inputRef","optionNodesRef","externalValue","isNil","useEffect","focusedItem","getFocusedOptionNode","scrollItemIntoView","optionNodes","dropDirection","useDropDirection","openMenu","handleFocus","_event","handleKeyDown","event","newHighlightedIndex","handleHighlightedSuggestionChanged","UP","onSuggestionClicked","item","handleInputChange","newValue","updateInputValue","shouldCloseMenu","newExternalValue","onChange","currentHighlightedItemIndex","currentHighlightedSuggestion","clearInputValue","getDefaultSuggestionValue","suggestion","suggestionValue","renderInput","inputPropId","icon","ignoredExternalValue","remainingInputProps","clearableProps","input","jsx","ClearableInput","AutoSuggestAddons","renderDefaultSuggestion","renderDropdownMenu","dropdownMenuClasses","classNames","DropdownSpinner","hasNoSuggestions","isEmpty","NoItemMessage","index","key","DropdownHeader","renderFunction","MenuItem","_","classes","jsxs"],"mappings":";;;;;;;;;;;;;;;AA4RO,MAAMA,KAAc,CAACC,MAA4B;AACpD,QAAM;AAAA,IACF,IAAAC;AAAA,IACA,sBAAAC,IAAuBC;AAAA,IACvB,6BAAAC,IAA8BD;AAAA,IAC9B,yBAAAE,IAA0BF;AAAA,IAC1B,kBAAAG;AAAA,IACA,qBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,aAAAC,IAAc,CAAA;AAAA,IACd,mBAAAC,IAAoB;AAAA,IACpB,WAAAC,IAAY;AAAA,IACZ,QAAAC,IAAS;AAAA,IACT,WAAAC,IAAY;AAAA,IACZ,aAAAC,IAAc;AAAA,IACd,eAAAC,IAAgB;AAA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evB,CAAU;AAAA,YAEzF,UAAU,CAACyB,IAAuBzC,OAC9BI,EAAoBJ,IAAOgB,CAAU;AAAA,YAEzC,OAAAoB;AAAA,UAAA;AAAA,UATKC;AAAA,QAAA;AAAA,MAYjB,CAAC;AAAA,IAAA,GACL;AAAA,EAER,GAEMK,KAAUX;AAAA,IACZ;AAAA,IACA;AAAA,IACA7D,KAAU;AAAA,IACVwB,EAAc,UAAU;AAAA,IACxB1B;AAAA,EAAA;AAGJ,SACI,gBAAA2E,EAAC,SAAK,GAAG1E,IAAgB,WAAWyE,IAAS,WAAW3C,IAAe,KAAKnB,IACvE,UAAA;AAAA,IAAAsC,GAAA;AAAA,IACAW,GAAA;AAAA,EAAmB,GACxB;AAER;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.js","sources":["../../../src/components/avatar/Avatar.tsx"],"sourcesContent":["import type { ComponentProps } from 'react';\nimport classNames from '
|
|
1
|
+
{"version":3,"file":"Avatar.js","sources":["../../../src/components/avatar/Avatar.tsx"],"sourcesContent":["import type { ComponentProps } from 'react';\n\nimport classNames from '../../utils/classNames';\nimport SimpleTooltip from '../tooltip/SimpleTooltip';\nimport AvatarContent from './AvatarContent';\n\nconst TOOLTIP_SHOW_TIMEOUT_IN_MS = 100;\nconst TOOLTIP_HIDE_TIMEOUT_IN_MS = 0;\n\nexport type AvatarProps = ComponentProps<'div'> & {\n /**\n * When a name is provided, the Avatar automatically generates and displays the initials of that name.\n * The name also appears in a tooltip when hovered over.\n */\n name?: string;\n\n /**\n * The abbreviation can also be defined manually. It is recommended to limit abbreviations\n * to a maximum of 2 to 3 characters.\n */\n abbr?: string;\n\n /**\n * The image to be shown. When an image is displayed, the abbreviation is not shown.\n */\n image?: string;\n\n /**\n * The image alt text. If not given, the name will be used.\n */\n alt?: string;\n\n /**\n * The name of an icon that should be shown instead of initials. If nothing is provided,\n * a default icon will be shown.\n *\n * @default 'user'\n */\n iconName?: string;\n\n /**\n * The height and width of the component.\n *\n * @default 40\n */\n size?: number;\n\n /**\n * The background color for the component. By default, the text and icon color is derived from the background color.\n *\n * @default 'bg-lighter'\n */\n backgroundColor?: string;\n\n /**\n * The content of the Avatars tooltip. if nothing is provided, the name is used.\n */\n tooltip?: string | JSX.Element;\n\n /**\n * Additional classes set to the icon element.\n */\n iconClassName?: string;\n\n /**\n * Additional classes set to the wrapper element.\n */\n className?: string;\n};\n\nconst Avatar = (props: AvatarProps) => {\n const {\n name,\n abbr,\n image,\n alt,\n iconName = 'user',\n size = 40,\n backgroundColor = 'bg-lighter',\n tooltip,\n iconClassName,\n className = '',\n ...remainingProps\n } = props;\n\n const classes = classNames('Avatar', backgroundColor, className);\n\n const tooltipContent = tooltip || name;\n\n const wrapWithTooltip = (content: JSX.Element) =>\n tooltipContent ? (\n <SimpleTooltip\n content={tooltipContent}\n placement='bottom'\n delay={{ show: TOOLTIP_SHOW_TIMEOUT_IN_MS, hide: TOOLTIP_HIDE_TIMEOUT_IN_MS }}\n popperConfig={{\n modifiers: [\n {\n name: 'offset',\n options: {\n offset: [0, 5],\n },\n },\n {\n name: 'arrow',\n options: {},\n },\n ],\n }}\n >\n {content}\n </SimpleTooltip>\n ) : (\n content\n );\n\n return wrapWithTooltip(\n <div {...remainingProps} className={classes} style={{ height: `${size}px` }}>\n <AvatarContent\n name={name}\n abbr={abbr}\n image={image}\n alt={alt}\n iconName={iconName}\n iconClassName={iconClassName}\n />\n </div>\n );\n};\n\nexport default Avatar;\n"],"names":["TOOLTIP_SHOW_TIMEOUT_IN_MS","TOOLTIP_HIDE_TIMEOUT_IN_MS","Avatar","props","name","abbr","image","alt","iconName","size","backgroundColor","tooltip","iconClassName","className","remainingProps","classes","classNames","tooltipContent","content","jsx","SimpleTooltip","AvatarContent"],"mappings":";;;;AAMA,MAAMA,IAA6B,KAC7BC,IAA6B,GA+D7BC,IAAS,CAACC,MAAuB;AACnC,QAAM;AAAA,IACF,MAAAC;AAAA,IACA,MAAAC;AAAA,IACA,OAAAC;AAAA,IACA,KAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,MAAAC,IAAO;AAAA,IACP,iBAAAC,IAAkB;AAAA,IAClB,SAAAC;AAAA,IACA,eAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,GAAGC;AAAA,EAAA,IACHX,GAEEY,IAAUC,EAAW,UAAUN,GAAiBG,CAAS,GAEzDI,IAAiBN,KAAWP;AA6BlC,UA3BwB,CAACc,MACrBD,IACI,gBAAAE;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,SAASH;AAAA,MACT,WAAU;AAAA,MACV,OAAO,EAAE,MAAMjB,GAA4B,MAAMC,EAAA;AAAA,MACjD,cAAc;AAAA,QACV,WAAW;AAAA,UACP;AAAA,YACI,MAAM;AAAA,YACN,SAAS;AAAA,cACL,QAAQ,CAAC,GAAG,CAAC;AAAA,YAAA;AAAA,UACjB;AAAA,UAEJ;AAAA,YACI,MAAM;AAAA,YACN,SAAS,CAAA;AAAA,UAAC;AAAA,QACd;AAAA,MACJ;AAAA,MAGH,UAAAiB;AAAA,IAAA;AAAA,EAAA,IAGLA;AAAA,IAIJ,gBAAAC,EAAC,OAAA,EAAK,GAAGL,GAAgB,WAAWC,GAAS,OAAO,EAAE,QAAQ,GAAGN,CAAI,KAAA,GACjE,UAAA,gBAAAU;AAAA,MAACE;AAAA,MAAA;AAAA,QACG,MAAAjB;AAAA,QACA,MAAAC;AAAA,QACA,OAAAC;AAAA,QACA,KAAAC;AAAA,QACA,UAAAC;AAAA,QACA,eAAAI;AAAA,MAAA;AAAA,IAAA,EACJ,CACJ;AAAA,EAAA;AAER;"}
|