@rio-cloud/rio-uikit 2.2.1 → 2.3.0-beta.2
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/AnalyticsAnalysisOverlay.d.ts +1 -0
- package/AnalyticsAnalysisOverlay.js +5 -0
- package/AnalyticsAnalysisOverlay.js.map +1 -0
- package/DayPicker.js +6 -2
- package/DayPicker.js.map +1 -1
- package/DayPickerCalendar.d.ts +2 -0
- package/DayPickerCalendar.js +5 -0
- package/DayPickerCalendar.js.map +1 -0
- package/DayPickerPrototype.d.ts +2 -0
- package/DayPickerPrototype.js +5 -0
- package/DayPickerPrototype.js.map +1 -0
- package/Table.d.ts +2 -0
- package/Table.js +23 -0
- package/Table.js.map +1 -0
- package/TableCol.d.ts +2 -2
- package/TableCol.js +1 -1
- package/TableHead.d.ts +2 -2
- package/TableHead.js +1 -1
- package/TableNext.d.ts +2 -0
- package/TableNext.js +23 -0
- package/TableNext.js.map +1 -0
- package/TableSettingsDialog.d.ts +2 -2
- package/TableSettingsDialog.js +1 -1
- package/TableToolbar.js +4 -2
- package/TableToolbar.js.map +1 -1
- package/analyticsAnalysisUtils.d.ts +1 -0
- package/analyticsAnalysisUtils.js +13 -0
- package/analyticsAnalysisUtils.js.map +1 -0
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.d.ts +18 -0
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.js +128 -0
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisBanner.js.map +1 -0
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.d.ts +9 -0
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.js +73 -0
- package/components/analyticsAnalysisOverlay/AnalyticsAnalysisOverlay.js.map +1 -0
- package/components/applicationHeader/AppMenuContent.js.map +1 -1
- package/components/applicationHeader/ApplicationActionBar.js +4 -4
- package/components/applicationHeader/ApplicationActionBar.js.map +1 -1
- package/components/applicationHeader/CollapsedNavItem.js +5 -14
- package/components/applicationHeader/CollapsedNavItem.js.map +1 -1
- package/components/applicationHeader/NavItems.js +10 -10
- package/components/applicationHeader/NavItems.js.map +1 -1
- package/components/assetTree/AssetTree.js +23 -23
- package/components/assetTree/AssetTree.js.map +1 -1
- package/components/assetTree/Tree.js +13 -13
- package/components/assetTree/TreeNothingFound.js +2 -2
- package/components/assetTree/TreeNothingFound.js.map +1 -1
- package/components/assetTree/treeUtils.js.map +1 -1
- package/components/autosuggest/AutoSuggest.js +31 -31
- package/components/autosuggest/AutoSuggest.js.map +1 -1
- package/components/autosuggest/AutoSuggestAddons.js +9 -9
- package/components/autosuggest/AutoSuggestAddons.js.map +1 -1
- package/components/banner/BannerActions.js +2 -2
- package/components/banner/BannerActions.js.map +1 -1
- package/components/banner/BannerIcon.js +3 -3
- package/components/banner/BannerIcon.js.map +1 -1
- package/components/banner/BannerPage.js +4 -4
- package/components/banner/BannerPage.js.map +1 -1
- package/components/button/Button.d.ts +7 -0
- package/components/button/Button.js +73 -65
- package/components/button/Button.js.map +1 -1
- package/components/charts/Area.d.ts +5 -3
- package/components/charts/Area.js +4 -3
- package/components/charts/Area.js.map +1 -1
- package/components/charts/AreaChart.js.map +1 -1
- package/components/charts/ComposedChart.js.map +1 -1
- package/components/checkbox/Checkbox.js +18 -17
- package/components/checkbox/Checkbox.js.map +1 -1
- package/components/clearableInput/ClearableInput.d.ts +30 -0
- package/components/clearableInput/ClearableInput.js +81 -78
- package/components/clearableInput/ClearableInput.js.map +1 -1
- package/components/datepicker/DateRangePicker.js +0 -2
- package/components/datepicker/DateRangePicker.js.map +1 -1
- package/components/datepicker/DayPicker.d.ts +4 -51
- package/components/datepicker/DayPicker.js +264 -256
- package/components/datepicker/DayPicker.js.map +1 -1
- package/components/datepicker/DayPickerCalendar.d.ts +4 -0
- package/components/datepicker/DayPickerCalendar.js +129 -0
- package/components/datepicker/DayPickerCalendar.js.map +1 -0
- package/components/datepicker/DayPickerDropdown.d.ts +18 -0
- package/components/datepicker/DayPickerDropdown.js +75 -0
- package/components/datepicker/DayPickerDropdown.js.map +1 -0
- package/components/datepicker/DayPickerDropdownFooter.d.ts +7 -0
- package/components/datepicker/DayPickerDropdownFooter.js +7 -0
- package/components/datepicker/DayPickerDropdownFooter.js.map +1 -0
- package/components/datepicker/DayPickerDropdownSidebar.d.ts +8 -0
- package/components/datepicker/DayPickerDropdownSidebar.js +7 -0
- package/components/datepicker/DayPickerDropdownSidebar.js.map +1 -0
- package/components/datepicker/DayPickerInput.d.ts +28 -0
- package/components/datepicker/DayPickerInput.js +65 -0
- package/components/datepicker/DayPickerInput.js.map +1 -0
- package/components/datepicker/DayPickerPrototype.d.ts +53 -0
- package/components/datepicker/DayPickerPrototype.js +285 -0
- package/components/datepicker/DayPickerPrototype.js.map +1 -0
- package/components/datepicker/dayPickerRangeSelectionUtils.d.ts +15 -0
- package/components/datepicker/dayPickerRangeSelectionUtils.js +31 -0
- package/components/datepicker/dayPickerRangeSelectionUtils.js.map +1 -0
- package/components/datepicker/dayPickerTypes.d.ts +517 -0
- package/components/datepicker/dayPickerTypes.js +7 -0
- package/components/datepicker/dayPickerTypes.js.map +1 -0
- package/components/datepicker/dayPickerUtils.d.ts +10 -0
- package/components/datepicker/dayPickerUtils.js +92 -0
- package/components/datepicker/dayPickerUtils.js.map +1 -0
- package/components/datepicker/useDayPickerInputState.d.ts +32 -0
- package/components/datepicker/useDayPickerInputState.js +85 -0
- package/components/datepicker/useDayPickerInputState.js.map +1 -0
- package/components/datepicker/useStackedDayPickerCalendars.d.ts +5 -0
- package/components/datepicker/useStackedDayPickerCalendars.js +39 -0
- package/components/datepicker/useStackedDayPickerCalendars.js.map +1 -0
- package/components/dialog/Dialog.js.map +1 -1
- package/components/dialog/DialogHeader.js +23 -20
- 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/divider/Divider.js +6 -6
- package/components/dropdown/ButtonDropdown.d.ts +4 -0
- package/components/dropdown/ButtonDropdown.js +70 -68
- package/components/dropdown/ButtonDropdown.js.map +1 -1
- package/components/dropdown/DropdownToggleButton.d.ts +1 -0
- package/components/dropdown/DropdownToggleButton.js +17 -15
- package/components/dropdown/DropdownToggleButton.js.map +1 -1
- package/components/editableContent/EditableContent.js +7 -7
- package/components/editableContent/EditableContent.js.map +1 -1
- package/components/expander/ExpanderList.d.ts +5 -0
- package/components/expander/ExpanderList.js +25 -16
- package/components/expander/ExpanderList.js.map +1 -1
- package/components/expander/ExpanderPanel.d.ts +5 -0
- package/components/expander/ExpanderPanel.js +29 -28
- package/components/expander/ExpanderPanel.js.map +1 -1
- package/components/fade/FadeExpander.js +17 -20
- package/components/fade/FadeExpander.js.map +1 -1
- package/components/filepicker/FilePicker.js.map +1 -1
- package/components/loadMore/LoadMoreButton.d.ts +5 -0
- package/components/loadMore/LoadMoreButton.js +33 -29
- package/components/loadMore/LoadMoreButton.js.map +1 -1
- package/components/loadMore/LoadMoreProgress.js +6 -7
- package/components/map/components/Map.js +3 -3
- package/components/map/components/features/ContextMenu.js +13 -13
- package/components/map/components/features/ContextMenu.js.map +1 -1
- package/components/map/components/features/basics/InfoBubble.js.map +1 -1
- package/components/map/components/features/settings/MapSettingsTile.js.map +1 -1
- package/components/map/components/features/settings/builtinSettings/MapTypeSettings.js +6 -6
- package/components/map/components/features/settings/builtinSettings/MapTypeSettings.js.map +1 -1
- package/components/map/utils/eventHandling.js +18 -18
- package/components/map/utils/eventHandling.js.map +1 -1
- package/components/map/utils/positions.d.ts +1 -1
- package/components/map/utils/positions.js +15 -12
- package/components/map/utils/positions.js.map +1 -1
- package/components/map/utils/rendering.d.ts +1 -1
- package/components/map/utils/rendering.js +5 -5
- package/components/menuItems/MenuItems.js +6 -6
- package/components/menuItems/MenuItems.js.map +1 -1
- package/components/notification/NotificationsContainer.js.map +1 -1
- package/components/numberInput/NumberInput.js +57 -56
- package/components/numberInput/NumberInput.js.map +1 -1
- package/components/popover/Popover.js +3 -3
- package/components/popover/Popover.js.map +1 -1
- package/components/radiobutton/RadioCardGroup.js +3 -3
- package/components/resizer/Resizer.js +6 -3
- package/components/resizer/Resizer.js.map +1 -1
- package/components/rioglyph/RioglyphIconType.d.ts +1 -1
- package/components/selects/BaseSelectDropdown.js +34 -32
- package/components/selects/BaseSelectDropdown.js.map +1 -1
- package/components/selects/Multiselect.d.ts +6 -0
- package/components/selects/Multiselect.js +164 -150
- package/components/selects/Multiselect.js.map +1 -1
- package/components/selects/MultiselectTogglePlaceholder.js.map +1 -1
- package/components/selects/MultiselectToggleSelection.js +11 -11
- package/components/selects/MultiselectToggleSelection.js.map +1 -1
- package/components/selects/Select.js +39 -37
- package/components/selects/Select.js.map +1 -1
- package/components/sidebars/Sidebar.js +12 -12
- package/components/sidebars/Sidebar.js.map +1 -1
- package/components/sidebars/SidebarCloseButton.js +2 -2
- package/components/sidebars/SidebarCloseButton.js.map +1 -1
- package/components/smoothScrollbars/SmoothScrollbars.d.ts +4 -3
- package/components/smoothScrollbars/SmoothScrollbars.js +11 -11
- package/components/smoothScrollbars/SmoothScrollbars.js.map +1 -1
- package/components/states/CustomState.js.map +1 -1
- package/components/svgImage/svgConverter.js.map +1 -1
- package/components/table/Table.d.ts +46 -0
- package/components/table/Table.js +256 -0
- package/components/table/Table.js.map +1 -0
- package/components/table/Table.types.d.ts +379 -0
- package/components/table/TableBody.d.ts +70 -0
- package/components/table/TableBody.js +135 -0
- package/components/table/TableBody.js.map +1 -0
- package/components/table/TableCardsSorting.js +25 -32
- package/components/table/TableCardsSorting.js.map +1 -1
- package/components/table/TableColumn.d.ts +55 -0
- package/components/table/TableColumn.js +115 -0
- package/components/table/TableColumn.js.map +1 -0
- package/components/table/TableExpandedContentRow.d.ts +22 -0
- package/components/table/TableExpandedContentRow.js +110 -0
- package/components/table/TableExpandedContentRow.js.map +1 -0
- package/components/table/TableExpandedRow.d.ts +22 -0
- package/components/table/TableExpandedRow.js +150 -0
- package/components/table/TableExpandedRow.js.map +1 -0
- package/components/table/TableExpanderButton.d.ts +25 -0
- package/components/table/TableExpanderButton.js +24 -0
- package/components/table/TableExpanderButton.js.map +1 -0
- package/components/table/TableFooter.d.ts +17 -0
- package/components/table/TableFooter.js +52 -0
- package/components/table/TableFooter.js.map +1 -0
- package/components/table/TableGroupFooterRow.d.ts +18 -0
- package/components/table/TableGroupFooterRow.js +30 -0
- package/components/table/TableGroupFooterRow.js.map +1 -0
- package/components/table/TableGroupRow.d.ts +24 -0
- package/components/table/TableGroupRow.js +36 -0
- package/components/table/TableGroupRow.js.map +1 -0
- package/components/table/TableHeader.d.ts +14 -0
- package/components/table/TableHeader.js +107 -0
- package/components/table/TableHeader.js.map +1 -0
- package/components/table/TableHeaderColumn.d.ts +76 -0
- package/components/table/TableHeaderColumn.js +81 -0
- package/components/table/TableHeaderColumn.js.map +1 -0
- package/components/table/TableHeaderRow.d.ts +9 -0
- package/components/table/TableHeaderRow.js +14 -0
- package/components/table/TableHeaderRow.js.map +1 -0
- package/components/table/TableRow.d.ts +24 -0
- package/components/table/TableRow.js +111 -0
- package/components/table/TableRow.js.map +1 -0
- package/components/table/TableSpacerRow.d.ts +13 -0
- package/components/table/TableSpacerRow.js +29 -0
- package/components/table/TableSpacerRow.js.map +1 -0
- package/components/table/TableToolbar.d.ts +3 -0
- package/components/table/TableToolbar.js +49 -4
- package/components/table/TableToolbar.js.map +1 -1
- package/components/table/TableToolbarColumn.d.ts +31 -0
- package/components/table/TableToolbarColumn.js +33 -0
- package/components/table/TableToolbarColumn.js.map +1 -0
- package/components/table/TableViewToggles.d.ts +21 -3
- package/components/table/TableViewToggles.js +59 -87
- package/components/table/TableViewToggles.js.map +1 -1
- package/components/table/context/TableInteractionContext.d.ts +26 -0
- package/components/table/context/TableInteractionContext.js +7 -0
- package/components/table/context/TableInteractionContext.js.map +1 -0
- package/components/table/context/TableLayoutContext.d.ts +25 -0
- package/components/table/context/TableLayoutContext.js +7 -0
- package/components/table/context/TableLayoutContext.js.map +1 -0
- package/components/table/context/TableRenderConfigContext.d.ts +27 -0
- package/components/table/context/TableRenderConfigContext.js +7 -0
- package/components/table/context/TableRenderConfigContext.js.map +1 -0
- package/components/table/context/TableRenderContext.d.ts +85 -0
- package/components/table/context/TableRenderContext.js +7 -0
- package/components/table/context/TableRenderContext.js.map +1 -0
- package/components/table/context/TableStructureContext.d.ts +31 -0
- package/components/table/context/TableStructureContext.js +17 -0
- package/components/table/context/TableStructureContext.js.map +1 -0
- package/components/table/layout/columnSizing.d.ts +3 -0
- package/components/table/layout/columnSizing.js +23 -0
- package/components/table/layout/columnSizing.js.map +1 -0
- package/components/table/layout/useDraggableColumns.d.ts +14 -0
- package/components/table/layout/useDraggableColumns.js +47 -0
- package/components/table/layout/useDraggableColumns.js.map +1 -0
- package/components/table/layout/useHorizontalSectionSync.d.ts +13 -0
- package/components/table/layout/useHorizontalSectionSync.js +43 -0
- package/components/table/layout/useHorizontalSectionSync.js.map +1 -0
- package/components/table/layout/useMeasuredColumnMaxWidths.d.ts +12 -0
- package/components/table/layout/useMeasuredColumnMaxWidths.js +85 -0
- package/components/table/layout/useMeasuredColumnMaxWidths.js.map +1 -0
- package/components/table/layout/useResizableColumns.d.ts +15 -0
- package/components/table/layout/useResizableColumns.js +132 -0
- package/components/table/layout/useResizableColumns.js.map +1 -0
- package/components/table/layout/useTableBodyScrollBottom.d.ts +12 -0
- package/components/table/layout/useTableBodyScrollBottom.js +37 -0
- package/components/table/layout/useTableBodyScrollBottom.js.map +1 -0
- package/components/table/layout/useTableLayout.d.ts +36 -0
- package/components/table/layout/useTableLayout.js +59 -0
- package/components/table/layout/useTableLayout.js.map +1 -0
- package/components/table/layout/useTableVirtualization.d.ts +22 -0
- package/components/table/layout/useTableVirtualization.js +125 -0
- package/components/table/layout/useTableVirtualization.js.map +1 -0
- package/components/table/model/resolveRowMeta.d.ts +3 -0
- package/components/table/model/resolveRowMeta.js +15 -0
- package/components/table/model/resolveRowMeta.js.map +1 -0
- package/components/table/model/resolveTableClassConfig.d.ts +47 -0
- package/components/table/model/resolveTableClassConfig.js +64 -0
- package/components/table/model/resolveTableClassConfig.js.map +1 -0
- package/components/table/model/tableView.types.d.ts +41 -0
- package/components/table/native/TableCol.js.map +1 -0
- package/components/table/{TableHead.js → native/TableHead.js} +2 -2
- package/components/table/native/TableHead.js.map +1 -0
- package/components/table/native/TableSettingsColumnButtons.js +59 -0
- package/components/table/native/TableSettingsColumnButtons.js.map +1 -0
- package/components/table/{TableSettingsColumnDetails.js → native/TableSettingsColumnDetails.js} +2 -2
- package/components/table/native/TableSettingsColumnDetails.js.map +1 -0
- package/components/table/{TableSettingsDialog.d.ts → native/TableSettingsDialog.d.ts} +2 -3
- package/components/table/native/TableSettingsDialog.js +216 -0
- package/components/table/native/TableSettingsDialog.js.map +1 -0
- package/components/table/{TableSettingsDialogFooter.js → native/TableSettingsDialogFooter.js} +2 -2
- package/components/table/native/TableSettingsDialogFooter.js.map +1 -0
- package/components/table/native/TableSettingsListContainer.js.map +1 -0
- package/components/table/native/TableSettingsListItem.js +100 -0
- package/components/table/native/TableSettingsListItem.js.map +1 -0
- package/components/table/render/body/TableBodyContent.d.ts +21 -0
- package/components/table/render/body/TableBodyContent.js +52 -0
- package/components/table/render/body/TableBodyContent.js.map +1 -0
- package/components/table/render/body/TableEmptyRow.d.ts +7 -0
- package/components/table/render/body/TableEmptyRow.js +6 -0
- package/components/table/render/body/TableEmptyRow.js.map +1 -0
- package/components/table/render/footer/TableFooterContent.d.ts +6 -0
- package/components/table/render/footer/TableFooterContent.js +6 -0
- package/components/table/render/footer/TableFooterContent.js.map +1 -0
- package/components/table/render/header/TableBatchDropdown.d.ts +13 -0
- package/components/table/render/header/TableBatchDropdown.js +30 -0
- package/components/table/render/header/TableBatchDropdown.js.map +1 -0
- package/components/table/render/header/TableColumnFilter.d.ts +66 -0
- package/components/table/render/header/TableColumnFilter.js +72 -0
- package/components/table/render/header/TableColumnFilter.js.map +1 -0
- package/components/table/render/header/TableDraggableHeaderCell.d.ts +4 -0
- package/components/table/render/header/TableDraggableHeaderCell.js +64 -0
- package/components/table/render/header/TableDraggableHeaderCell.js.map +1 -0
- package/components/table/render/header/TableHeader.types.d.ts +37 -0
- package/components/table/render/header/TableHeaderCellContent.d.ts +4 -0
- package/components/table/render/header/TableHeaderCellContent.js +57 -0
- package/components/table/render/header/TableHeaderCellContent.js.map +1 -0
- package/components/table/render/header/TableHeaderCellResizeHandle.d.ts +4 -0
- package/components/table/render/header/TableHeaderCellResizeHandle.js +22 -0
- package/components/table/render/header/TableHeaderCellResizeHandle.js.map +1 -0
- package/components/table/render/header/TableHeaderDragOverlay.d.ts +14 -0
- package/components/table/render/header/TableHeaderDragOverlay.js +35 -0
- package/components/table/render/header/TableHeaderDragOverlay.js.map +1 -0
- package/components/table/render/header/TableHeaderSelectionCell.d.ts +9 -0
- package/components/table/render/header/TableHeaderSelectionCell.js +41 -0
- package/components/table/render/header/TableHeaderSelectionCell.js.map +1 -0
- package/components/table/render/header/TableStaticHeaderCell.d.ts +4 -0
- package/components/table/render/header/TableStaticHeaderCell.js +48 -0
- package/components/table/render/header/TableStaticHeaderCell.js.map +1 -0
- package/components/table/render/header/resolveAriaSort.d.ts +3 -0
- package/components/table/render/header/resolveAriaSort.js +8 -0
- package/components/table/render/header/resolveAriaSort.js.map +1 -0
- package/components/table/render/header/resolveColumnCollisionDetection.d.ts +2 -0
- package/components/table/render/header/resolveColumnCollisionDetection.js +9 -0
- package/components/table/render/header/resolveColumnCollisionDetection.js.map +1 -0
- package/components/table/render/header/resolveHeaderCellClassName.d.ts +12 -0
- package/components/table/render/header/resolveHeaderCellClassName.js +23 -0
- package/components/table/render/header/resolveHeaderCellClassName.js.map +1 -0
- package/components/table/render/header/resolveHeaderCellStyle.d.ts +830 -0
- package/components/table/render/header/resolveHeaderCellStyle.js +9 -0
- package/components/table/render/header/resolveHeaderCellStyle.js.map +1 -0
- package/components/table/runtime/shouldAnimateBodyRows.d.ts +17 -0
- package/components/table/runtime/shouldAnimateBodyRows.js +5 -0
- package/components/table/runtime/shouldAnimateBodyRows.js.map +1 -0
- package/components/table/runtime/useRenderDraftState.d.ts +14 -0
- package/components/table/runtime/useRenderDraftState.js +80 -0
- package/components/table/runtime/useRenderDraftState.js.map +1 -0
- package/components/table/runtime/useResolvedRenderColumns.d.ts +43 -0
- package/components/table/runtime/useResolvedRenderColumns.js +113 -0
- package/components/table/runtime/useResolvedRenderColumns.js.map +1 -0
- package/components/table/runtime/useResolvedRenderHeader.d.ts +27 -0
- package/components/table/runtime/useResolvedRenderHeader.js +67 -0
- package/components/table/runtime/useResolvedRenderHeader.js.map +1 -0
- package/components/table/selection/useInternalTableSelectionState.d.ts +17 -0
- package/components/table/selection/useInternalTableSelectionState.js +28 -0
- package/components/table/selection/useInternalTableSelectionState.js.map +1 -0
- package/components/table/selection/useTableSelection.d.ts +82 -0
- package/components/table/selection/useTableSelection.js +35 -0
- package/components/table/selection/useTableSelection.js.map +1 -0
- package/components/table/settings/TableColumnsDropdown.d.ts +90 -0
- package/components/table/settings/TableColumnsDropdown.js +137 -0
- package/components/table/settings/TableColumnsDropdown.js.map +1 -0
- package/components/table/settings/TableColumnsDropdownItem.d.ts +8 -0
- package/components/table/settings/TableColumnsDropdownItem.js +66 -0
- package/components/table/settings/TableColumnsDropdownItem.js.map +1 -0
- package/components/table/shared/getAlignClassName.d.ts +3 -0
- package/components/table/shared/getAlignClassName.js +6 -0
- package/components/table/shared/getAlignClassName.js.map +1 -0
- package/components/table/shared/getCellContentOverflowClassName.d.ts +3 -0
- package/components/table/shared/getCellContentOverflowClassName.js +18 -0
- package/components/table/shared/getCellContentOverflowClassName.js.map +1 -0
- package/components/table/shared/getInteractiveRowProps.d.ts +15 -0
- package/components/table/shared/getInteractiveRowProps.js +15 -0
- package/components/table/shared/getInteractiveRowProps.js.map +1 -0
- package/components/table/shared/resolveTableAria.d.ts +2 -0
- package/components/table/shared/resolveTableAria.js +6 -0
- package/components/table/shared/resolveTableAria.js.map +1 -0
- package/components/table/tableSizing.constants.d.ts +4 -0
- package/components/table/tableSizing.constants.js +8 -0
- package/components/table/tableSizing.constants.js.map +1 -0
- package/components/teaser/TeaserContainer.js +3 -3
- package/components/teaser/TeaserContainer.js.map +1 -1
- package/components/virtualList/VirtualList.js +16 -13
- package/components/virtualList/VirtualList.js.map +1 -1
- package/googleAnalyticsUtils.d.ts +1 -0
- package/googleAnalyticsUtils.js +9 -0
- package/googleAnalyticsUtils.js.map +1 -0
- package/hooks/useCookies.js +17 -17
- package/hooks/useCookies.js.map +1 -1
- package/hooks/useDraggableElement.d.ts +35 -0
- package/hooks/useDraggableElement.js +49 -0
- package/hooks/useDraggableElement.js.map +1 -0
- package/hooks/useElapsedTime.js +4 -4
- package/hooks/useElapsedTime.js.map +1 -1
- package/hooks/useLocationSuggestions.js +13 -10
- package/hooks/useLocationSuggestions.js.map +1 -1
- package/hooks/useMergeRefs.js +12 -12
- package/hooks/useMergeRefs.js.map +1 -1
- package/hooks/usePrevious.d.ts +1 -1
- package/hooks/usePrevious.js.map +1 -1
- package/hooks/useResizeObserver.js +25 -10
- package/hooks/useResizeObserver.js.map +1 -1
- package/hooks/useRioCookieConsent.js +7 -4
- package/hooks/useRioCookieConsent.js.map +1 -1
- package/hooks/useSorting.js +10 -10
- package/hooks/useSorting.js.map +1 -1
- package/hooks/useStorage.js +12 -12
- package/hooks/useStorage.js.map +1 -1
- package/hooks/useSum.js +10 -7
- package/hooks/useSum.js.map +1 -1
- package/hooks/useTableSelection.js.map +1 -1
- package/hooks/useTimeout.js +6 -3
- package/hooks/useTimeout.js.map +1 -1
- package/hooks/useUrlState.js +3 -3
- package/package.json +17 -18
- package/routeUtils.js +12 -10
- package/utils/analytics/analyticsAnalysisUtils.d.ts +27 -0
- package/utils/analytics/analyticsAnalysisUtils.js +161 -0
- package/utils/analytics/analyticsAnalysisUtils.js.map +1 -0
- package/utils/analytics/autoTracking.d.ts +14 -0
- package/utils/analytics/autoTracking.js +19 -0
- package/utils/analytics/autoTracking.js.map +1 -0
- package/utils/analytics/createAnalyticsOverlayTooltip.d.ts +36 -0
- package/utils/analytics/createAnalyticsOverlayTooltip.js +203 -0
- package/utils/analytics/createAnalyticsOverlayTooltip.js.map +1 -0
- package/utils/analytics/googleAnalyticsUtils.d.ts +37 -0
- package/utils/analytics/googleAnalyticsUtils.js +37 -0
- package/utils/analytics/googleAnalyticsUtils.js.map +1 -0
- package/utils/analytics/logAnalyticsOverlayUnmatchedEntries.d.ts +8 -0
- package/utils/analytics/logAnalyticsOverlayUnmatchedEntries.js +61 -0
- package/utils/analytics/logAnalyticsOverlayUnmatchedEntries.js.map +1 -0
- package/utils/analytics/useAnalyticsOverlayDom.d.ts +11 -0
- package/utils/analytics/useAnalyticsOverlayDom.js +120 -0
- package/utils/analytics/useAnalyticsOverlayDom.js.map +1 -0
- package/utils/arrayMove.js +11 -0
- package/utils/arrayMove.js.map +1 -0
- package/utils/cssuseragent.js +2 -2
- package/utils/cssuseragent.js.map +1 -1
- package/utils/deviceUtils.js.map +1 -1
- package/utils/formatUtils.js.map +1 -1
- package/utils/hasUtilityClass.js +3 -3
- package/utils/hasUtilityClass.js.map +1 -1
- package/utils/hidePiiData.js.map +1 -1
- package/utils/init/checkForReleaseVersion.js +4 -4
- package/utils/init/checkForReleaseVersion.js.map +1 -1
- package/utils/init/styledLogs.js.map +1 -1
- package/utils/mergeRefs.js +3 -3
- package/utils/mergeRefs.js.map +1 -1
- package/utils/routeUtils.d.ts +37 -3
- package/utils/routeUtils.js +88 -70
- package/utils/routeUtils.js.map +1 -1
- package/utils/storageUtils.js +9 -9
- package/utils/storageUtils.js.map +1 -1
- package/version.d.ts +1 -1
- package/version.js +2 -2
- package/version.js.map +1 -1
- package/components/table/TableCol.js.map +0 -1
- package/components/table/TableHead.js.map +0 -1
- package/components/table/TableSettingsColumnButtons.js +0 -45
- package/components/table/TableSettingsColumnButtons.js.map +0 -1
- package/components/table/TableSettingsColumnDetails.js.map +0 -1
- package/components/table/TableSettingsDialog.js +0 -208
- package/components/table/TableSettingsDialog.js.map +0 -1
- package/components/table/TableSettingsDialogFooter.js.map +0 -1
- package/components/table/TableSettingsListContainer.js.map +0 -1
- package/components/table/TableSettingsListItem.js +0 -96
- package/components/table/TableSettingsListItem.js.map +0 -1
- /package/components/table/{TableCol.d.ts → native/TableCol.d.ts} +0 -0
- /package/components/table/{TableCol.js → native/TableCol.js} +0 -0
- /package/components/table/{TableHead.d.ts → native/TableHead.d.ts} +0 -0
- /package/components/table/{TableSettingsColumnButtons.d.ts → native/TableSettingsColumnButtons.d.ts} +0 -0
- /package/components/table/{TableSettingsColumnDetails.d.ts → native/TableSettingsColumnDetails.d.ts} +0 -0
- /package/components/table/{TableSettingsDialogFooter.d.ts → native/TableSettingsDialogFooter.d.ts} +0 -0
- /package/components/table/{TableSettingsListContainer.d.ts → native/TableSettingsListContainer.d.ts} +0 -0
- /package/components/table/{TableSettingsListContainer.js → native/TableSettingsListContainer.js} +0 -0
- /package/components/table/{TableSettingsListItem.d.ts → native/TableSettingsListItem.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
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;AAA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E7D,eACI,gBAAAH;AAAA,UAACe;AAAA,UAAA;AAAA,YAEG,QAAQJ,MAAU7D;AAAA,YAClB,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 [...optionNodesRef.current].find((item: HTMLLIElement) => item.className.includes('active'));\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 suggestion.label ?? (suggestion[customSuggestionKey ?? ''] as string) ?? '';\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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YAClB,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,16 +1,16 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
const
|
|
1
|
+
import { jsxs as t, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
const c = ({
|
|
3
3
|
icon: s,
|
|
4
4
|
leadingInputAddons: a,
|
|
5
|
-
trailingInputAddons:
|
|
6
|
-
children:
|
|
7
|
-
}) => /* @__PURE__ */
|
|
5
|
+
trailingInputAddons: e,
|
|
6
|
+
children: p
|
|
7
|
+
}) => /* @__PURE__ */ t("div", { className: "input-group width-100pct", children: [
|
|
8
8
|
a && a,
|
|
9
|
-
s && /* @__PURE__ */
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
s && /* @__PURE__ */ r("span", { className: "input-group-addon", children: /* @__PURE__ */ r("span", { className: `rioglyph ${s}`, "aria-hidden": "true" }) }),
|
|
10
|
+
p,
|
|
11
|
+
e && e
|
|
12
12
|
] });
|
|
13
13
|
export {
|
|
14
|
-
|
|
14
|
+
c as default
|
|
15
15
|
};
|
|
16
16
|
//# sourceMappingURL=AutoSuggestAddons.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoSuggestAddons.js","sources":["../../../src/components/autosuggest/AutoSuggestAddons.tsx"],"sourcesContent":["import type React from 'react';\nimport type { PropsWithChildren } from 'react';\n\nexport type AutoSuggestAddonsProps = {\n icon?: string;\n leadingInputAddons?: React.ReactNode[];\n trailingInputAddons?: React.ReactNode[];\n};\n\nconst AutoSuggestAddons = ({\n icon,\n leadingInputAddons,\n trailingInputAddons,\n children,\n}: PropsWithChildren<AutoSuggestAddonsProps>) =>
|
|
1
|
+
{"version":3,"file":"AutoSuggestAddons.js","sources":["../../../src/components/autosuggest/AutoSuggestAddons.tsx"],"sourcesContent":["import type React from 'react';\nimport type { PropsWithChildren } from 'react';\n\nexport type AutoSuggestAddonsProps = {\n icon?: string;\n leadingInputAddons?: React.ReactNode[];\n trailingInputAddons?: React.ReactNode[];\n};\n\nconst AutoSuggestAddons = ({\n icon,\n leadingInputAddons,\n trailingInputAddons,\n children,\n}: PropsWithChildren<AutoSuggestAddonsProps>) => (\n <div className='input-group width-100pct'>\n {leadingInputAddons && leadingInputAddons}\n {icon && (\n <span className='input-group-addon'>\n <span className={`rioglyph ${icon}`} aria-hidden='true' />\n </span>\n )}\n {children}\n {trailingInputAddons && trailingInputAddons}\n </div>\n);\n\nexport default AutoSuggestAddons;\n"],"names":["AutoSuggestAddons","icon","leadingInputAddons","trailingInputAddons","children","jsxs","jsx"],"mappings":";AASA,MAAMA,IAAoB,CAAC;AAAA,EACvB,MAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,UAAAC;AACJ,MACI,gBAAAC,EAAC,OAAA,EAAI,WAAU,4BACV,UAAA;AAAA,EAAAH,KAAsBA;AAAA,EACtBD,KACG,gBAAAK,EAAC,QAAA,EAAK,WAAU,qBACZ,UAAA,gBAAAA,EAAC,QAAA,EAAK,WAAW,YAAYL,CAAI,IAAI,eAAY,QAAO,GAC5D;AAAA,EAEHG;AAAA,EACAD,KAAuBA;AAAA,EAAA,CAC5B;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
const e = ({ className: n = "", children:
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
const e = ({ className: n = "", children: o, ...t }) => /* @__PURE__ */ a("div", { className: `BannerActions flex-0 btn-toolbar ${n}`, ...t, children: o });
|
|
3
3
|
export {
|
|
4
4
|
e as default
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerActions.js","sources":["../../../src/components/banner/BannerActions.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react';\n\nexport type BannerActionsProps = {\n /**\n * Additional classname added to the wrapper element.\n */\n className?: string;\n};\n\nconst BannerActions = ({ className = '', children, ...remainingProps }: PropsWithChildren<BannerActionsProps>) =>
|
|
1
|
+
{"version":3,"file":"BannerActions.js","sources":["../../../src/components/banner/BannerActions.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react';\n\nexport type BannerActionsProps = {\n /**\n * Additional classname added to the wrapper element.\n */\n className?: string;\n};\n\nconst BannerActions = ({ className = '', children, ...remainingProps }: PropsWithChildren<BannerActionsProps>) => (\n <div className={`BannerActions flex-0 btn-toolbar ${className}`} {...remainingProps}>\n {children}\n </div>\n);\n\nexport default BannerActions;\n"],"names":["BannerActions","className","children","remainingProps","jsx"],"mappings":";AASA,MAAMA,IAAgB,CAAC,EAAE,WAAAC,IAAY,IAAI,UAAAC,GAAU,GAAGC,EAAA,MAClD,gBAAAC,EAAC,SAAI,WAAW,oCAAoCH,CAAS,IAAK,GAAGE,GAChE,UAAAD,EAAA,CACL;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
const
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
const i = ({ className: n = "", children: a, ...e }) => /* @__PURE__ */ o("div", { className: `BannerIcon flex-0 margin-x-5 min-width-25 ${n}`, ...e, children: a });
|
|
3
3
|
export {
|
|
4
|
-
|
|
4
|
+
i as default
|
|
5
5
|
};
|
|
6
6
|
//# sourceMappingURL=BannerIcon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerIcon.js","sources":["../../../src/components/banner/BannerIcon.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react';\n\nexport type BannerIconProps = {\n /**\n * Additional classname added to the wrapper element.\n */\n className?: string;\n};\n\nconst BannerIcon = ({ className = '', children, ...remainingProps }: PropsWithChildren<BannerIconProps>) =>
|
|
1
|
+
{"version":3,"file":"BannerIcon.js","sources":["../../../src/components/banner/BannerIcon.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react';\n\nexport type BannerIconProps = {\n /**\n * Additional classname added to the wrapper element.\n */\n className?: string;\n};\n\nconst BannerIcon = ({ className = '', children, ...remainingProps }: PropsWithChildren<BannerIconProps>) => (\n <div className={`BannerIcon flex-0 margin-x-5 min-width-25 ${className}`} {...remainingProps}>\n {children}\n </div>\n);\n\nexport default BannerIcon;\n"],"names":["BannerIcon","className","children","remainingProps","jsx"],"mappings":";AASA,MAAMA,IAAa,CAAC,EAAE,WAAAC,IAAY,IAAI,UAAAC,GAAU,GAAGC,EAAA,MAC/C,gBAAAC,EAAC,SAAI,WAAW,6CAA6CH,CAAS,IAAK,GAAGE,GACzE,UAAAD,EAAA,CACL;"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
-
const
|
|
2
|
+
const l = ({ className: a = "", children: t, ...e }) => /* @__PURE__ */ s(
|
|
3
3
|
"div",
|
|
4
4
|
{
|
|
5
|
-
className: `display-flex align-items-start align-items-center-ls width-100pct gap-15 ${
|
|
5
|
+
className: `display-flex align-items-start align-items-center-ls width-100pct gap-15 ${a}`,
|
|
6
6
|
...e,
|
|
7
|
-
children:
|
|
7
|
+
children: t
|
|
8
8
|
}
|
|
9
9
|
);
|
|
10
10
|
export {
|
|
11
|
-
|
|
11
|
+
l as default
|
|
12
12
|
};
|
|
13
13
|
//# sourceMappingURL=BannerPage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BannerPage.js","sources":["../../../src/components/banner/BannerPage.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react';\n\ntype BannerPageProps = {\n /**\n * Additional classname added to the wrapper element.\n */\n className?: string;\n};\n\nconst BannerPage = ({ className = '', children, ...remainingProps }: PropsWithChildren<BannerPageProps>) =>
|
|
1
|
+
{"version":3,"file":"BannerPage.js","sources":["../../../src/components/banner/BannerPage.tsx"],"sourcesContent":["import type { PropsWithChildren } from 'react';\n\ntype BannerPageProps = {\n /**\n * Additional classname added to the wrapper element.\n */\n className?: string;\n};\n\nconst BannerPage = ({ className = '', children, ...remainingProps }: PropsWithChildren<BannerPageProps>) => (\n <div\n className={`display-flex align-items-start align-items-center-ls width-100pct gap-15 ${className}`}\n {...remainingProps}\n >\n {children}\n </div>\n);\n\nexport default BannerPage;\n"],"names":["BannerPage","className","children","remainingProps","jsx"],"mappings":";AASA,MAAMA,IAAa,CAAC,EAAE,WAAAC,IAAY,IAAI,UAAAC,GAAU,GAAGC,QAC/C,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,WAAW,4EAA4EH,CAAS;AAAA,IAC/F,GAAGE;AAAA,IAEH,UAAAD;AAAA,EAAA;AACL;"}
|
|
@@ -117,6 +117,13 @@ type BaseButtonProps = {
|
|
|
117
117
|
* Whether the "ripple" effect should be suppressed on this button.
|
|
118
118
|
*/
|
|
119
119
|
noRippleEffect?: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Optional key used to generate automatic GA tracking attributes when no explicit
|
|
122
|
+
* tracking attributes are provided.
|
|
123
|
+
*
|
|
124
|
+
* Resulting label format: `button::<autoTrackingKey>`.
|
|
125
|
+
*/
|
|
126
|
+
autoTrackingKey?: string;
|
|
120
127
|
/**
|
|
121
128
|
* Number of the index used for keyboard support.
|
|
122
129
|
*
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { noop as
|
|
4
|
-
import
|
|
1
|
+
import { jsxs as E, jsx as k } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Y, useState as L, useRef as $ } from "react";
|
|
3
|
+
import { noop as w } from "es-toolkit/function";
|
|
4
|
+
import B from "../../utils/classNames.js";
|
|
5
5
|
import { createButtonRipple as S } from "../../utils/buttonEffect.js";
|
|
6
|
-
import
|
|
7
|
-
|
|
6
|
+
import F from "../../hooks/useMergeRefs.js";
|
|
7
|
+
import { getAutoTrackingAttributes as G } from "../../utils/analytics/autoTracking.js";
|
|
8
|
+
const z = {
|
|
8
9
|
DEFAULT: "default",
|
|
9
10
|
UNSTYLED: "unstyled",
|
|
10
11
|
PRIMARY: "primary",
|
|
@@ -15,108 +16,115 @@ const B = {
|
|
|
15
16
|
SUCCESS: "success",
|
|
16
17
|
MUTED: "muted",
|
|
17
18
|
MUTED_FILLED: "muted-filled"
|
|
18
|
-
},
|
|
19
|
+
}, i = {
|
|
19
20
|
VARIANT_LINK: "link",
|
|
20
21
|
VARIANT_LINK_INLINE: "link-inline",
|
|
21
22
|
VARIANT_OUTLINE: "outline",
|
|
22
23
|
VARIANT_ACTION: "action"
|
|
23
|
-
},
|
|
24
|
+
}, W = {
|
|
24
25
|
XS: "xs",
|
|
25
26
|
SM: "sm",
|
|
26
27
|
MD: "md",
|
|
27
28
|
LG: "lg"
|
|
28
|
-
},
|
|
29
|
+
}, u = Y((_, C) => {
|
|
29
30
|
const {
|
|
30
31
|
as: a = "button",
|
|
31
|
-
active:
|
|
32
|
+
active: n = !1,
|
|
32
33
|
disabled: e = !1,
|
|
33
34
|
asToggle: f = !1,
|
|
34
|
-
onClick: l =
|
|
35
|
-
bsStyle:
|
|
36
|
-
bsSize:
|
|
37
|
-
variant:
|
|
35
|
+
onClick: l = w,
|
|
36
|
+
bsStyle: y = "default",
|
|
37
|
+
bsSize: b,
|
|
38
|
+
variant: s,
|
|
38
39
|
iconOnly: O = !1,
|
|
39
40
|
iconName: o,
|
|
40
41
|
iconRight: h = !1,
|
|
41
|
-
multiline:
|
|
42
|
-
block:
|
|
43
|
-
className:
|
|
44
|
-
noRippleEffect:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
42
|
+
multiline: D = !1,
|
|
43
|
+
block: M = !1,
|
|
44
|
+
className: V = "",
|
|
45
|
+
noRippleEffect: N = !1,
|
|
46
|
+
autoTrackingKey: v,
|
|
47
|
+
type: U = "button",
|
|
48
|
+
tabIndex: A = 0,
|
|
49
|
+
children: m,
|
|
50
|
+
...r
|
|
51
|
+
} = _, I = G({
|
|
52
|
+
autoTrackingKey: v,
|
|
53
|
+
props: r,
|
|
54
|
+
source: "button"
|
|
55
|
+
}), [g, d] = L(n), T = $(null), p = F(T, C), [x, P] = L(n);
|
|
56
|
+
n !== x && (d(n), P(n));
|
|
57
|
+
const j = (t) => {
|
|
58
|
+
if (N || S(t.nativeEvent, t.currentTarget), f) {
|
|
59
|
+
const c = !g;
|
|
60
|
+
d(c), c && T.current?.blur(), l(c);
|
|
55
61
|
} else
|
|
56
|
-
l(
|
|
57
|
-
},
|
|
62
|
+
l(t);
|
|
63
|
+
}, K = (t) => {
|
|
58
64
|
if (e) {
|
|
59
|
-
|
|
65
|
+
t.preventDefault();
|
|
60
66
|
return;
|
|
61
67
|
}
|
|
62
|
-
|
|
63
|
-
},
|
|
68
|
+
N || S(t.nativeEvent, t.currentTarget), l(t);
|
|
69
|
+
}, R = B(
|
|
64
70
|
"btn",
|
|
65
|
-
`btn-${
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
`btn-${y}`,
|
|
72
|
+
s === i.VARIANT_LINK && "btn-link",
|
|
73
|
+
s === i.VARIANT_LINK_INLINE && "btn-link btn-link-inline",
|
|
74
|
+
s === i.VARIANT_OUTLINE && "btn-outline",
|
|
75
|
+
s === i.VARIANT_ACTION && "btn-action",
|
|
76
|
+
b && `btn-${b}`,
|
|
71
77
|
f && "btn-toggle",
|
|
72
|
-
|
|
78
|
+
g && "active",
|
|
73
79
|
O && "btn-icon-only",
|
|
74
80
|
h && "btn-icon-right",
|
|
75
|
-
|
|
76
|
-
|
|
81
|
+
D && "btn-multiline",
|
|
82
|
+
M && "btn-block",
|
|
77
83
|
a === "a" && "gap-0",
|
|
78
84
|
a === "a" && e && "disabled",
|
|
79
85
|
"btn-component",
|
|
80
|
-
|
|
86
|
+
V
|
|
81
87
|
);
|
|
82
|
-
return a === "a" ? /* @__PURE__ */
|
|
88
|
+
return a === "a" ? /* @__PURE__ */ E(
|
|
83
89
|
"a",
|
|
84
90
|
{
|
|
85
|
-
ref:
|
|
91
|
+
ref: p,
|
|
92
|
+
...r,
|
|
86
93
|
...I,
|
|
87
|
-
className:
|
|
88
|
-
onClick:
|
|
94
|
+
className: R,
|
|
95
|
+
onClick: K,
|
|
89
96
|
"aria-disabled": e || void 0,
|
|
90
|
-
tabIndex: e ? -1 :
|
|
97
|
+
tabIndex: e ? -1 : A,
|
|
91
98
|
children: [
|
|
92
|
-
o && /* @__PURE__ */
|
|
93
|
-
|
|
99
|
+
o && /* @__PURE__ */ k("span", { className: `rioglyph ${o}` }),
|
|
100
|
+
m
|
|
94
101
|
]
|
|
95
102
|
}
|
|
96
|
-
) : /* @__PURE__ */
|
|
103
|
+
) : /* @__PURE__ */ E(
|
|
97
104
|
"button",
|
|
98
105
|
{
|
|
99
|
-
ref:
|
|
100
|
-
type:
|
|
106
|
+
ref: p,
|
|
107
|
+
type: U,
|
|
108
|
+
...r,
|
|
101
109
|
...I,
|
|
102
|
-
className:
|
|
103
|
-
onClick:
|
|
110
|
+
className: R,
|
|
111
|
+
onClick: j,
|
|
104
112
|
disabled: e,
|
|
105
|
-
tabIndex:
|
|
113
|
+
tabIndex: A,
|
|
106
114
|
children: [
|
|
107
|
-
o && /* @__PURE__ */
|
|
108
|
-
|
|
115
|
+
o && /* @__PURE__ */ k("span", { className: `rioglyph ${o}` }),
|
|
116
|
+
m
|
|
109
117
|
]
|
|
110
118
|
}
|
|
111
119
|
);
|
|
112
120
|
});
|
|
113
|
-
Object.assign(
|
|
114
|
-
Object.assign(
|
|
115
|
-
Object.assign(
|
|
121
|
+
Object.assign(u, z);
|
|
122
|
+
Object.assign(u, i);
|
|
123
|
+
Object.assign(u, W);
|
|
116
124
|
export {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
125
|
+
W as SIZES_MAP,
|
|
126
|
+
z as STYLES_MAP,
|
|
127
|
+
i as VARIANTS_MAP,
|
|
128
|
+
u as default
|
|
121
129
|
};
|
|
122
130
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../src/components/button/Button.tsx"],"sourcesContent":["import React, {\n forwardRef,\n type ForwardRefExoticComponent,\n type HTMLProps,\n type PropsWithChildren,\n type RefAttributes,\n useRef,\n useState,\n} from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport classNames from '../../utils/classNames';\nimport { createButtonRipple } from '../../utils/buttonEffect';\nimport useMergeRefs from '../../hooks/useMergeRefs';\nimport type { ObjectValues } from '../../utils/ObjectValues';\n\nexport const STYLES_MAP = {\n DEFAULT: 'default',\n UNSTYLED: 'unstyled',\n PRIMARY: 'primary',\n SECONDARY: 'secondary',\n INFO: 'info',\n WARNING: 'warning',\n DANGER: 'danger',\n SUCCESS: 'success',\n MUTED: 'muted',\n MUTED_FILLED: 'muted-filled',\n} as const;\n\n// export for convenient usage on client side\nexport type BUTTON_STYLE = ObjectValues<typeof STYLES_MAP>;\n\nexport const VARIANTS_MAP = {\n VARIANT_LINK: 'link',\n VARIANT_LINK_INLINE: 'link-inline',\n VARIANT_OUTLINE: 'outline',\n VARIANT_ACTION: 'action',\n} as const;\n\nexport type BUTTON_VARIANT = ObjectValues<typeof VARIANTS_MAP>;\n\nexport const SIZES_MAP = {\n XS: 'xs',\n SM: 'sm',\n MD: 'md',\n LG: 'lg',\n} as const;\n\nexport type BUTTON_SIZE = ObjectValues<typeof SIZES_MAP>;\n\n/*\n * ATTENTION: We're typing the onClick handler based on the value of `asToggle`.\n *\n * It does not fully work here inside of this file, though. Therefore, we have to apply some explicit casts below.\n * In code _using_ the Button component, however, the parameter type of the onClick handler must either be a boolean or\n * a React.MouseEvent, respectively.\n */\n\ntype RegularButton = {\n /**\n * Use the button as a toggle button. The toggle state can be controlled via the `active` prop.\n *\n * @default false\n */\n asToggle?: false;\n\n /**\n * Callback function triggered when clicking the button.\n *\n * @param event The MouseEvent that triggered the click.\n */\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n};\n\ntype ToggleButton = {\n /**\n * Use the button as a toggle button. The toggle state can be controlled via the `active` prop.\n *\n * @default false\n */\n asToggle: true;\n\n /**\n * Callback function triggered when clicking the button.\n *\n * @param value The new value of the toggle button.\n */\n onClick?: (value: boolean) => void;\n};\n\ntype BaseButtonProps = {\n /**\n * Whether the button should be disabled.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Set the button toggled. Should be used in combination with \"asToggle\" prop.\n *\n * @default false\n */\n active?: boolean;\n\n /**\n * Use when the content of the button is an icon only to adapt the button spacing accordingly.\n *\n * @default false\n */\n iconOnly?: boolean;\n\n /**\n * Adds right side spacing for an icon. This should be used when having navigation buttons\n * that use an icon on the right side.\n *\n * @default false\n */\n iconRight?: boolean;\n\n /**\n * Optional rio-glyph icon name that comes in handy for icon only buttons for not adding\n * a span tag for the icon which reduces boilerplate code.\n */\n iconName?: string;\n\n /**\n * Defines whether the button text break into multiple lines when the button space exceeds.\n *\n * Multiline buttons should be used as exception only.\n *\n * @default false\n */\n multiline?: boolean;\n\n /**\n * Defines whether the button takes up the full width of the parent element.\n *\n * @default false\n */\n block?: boolean;\n\n /**\n * Sets the button style.\n * @default 'default'\n */\n bsStyle?: BUTTON_STYLE;\n\n /**\n * Sets the button size.\n */\n bsSize?: BUTTON_SIZE;\n\n /**\n * Sets the button variant.\n */\n variant?: BUTTON_VARIANT;\n\n /**\n * Whether the \"ripple\" effect should be suppressed on this button.\n */\n noRippleEffect?: boolean;\n\n /**\n * Number of the index used for keyboard support.\n *\n * @default 0\n */\n tabIndex?: number;\n\n /**\n * Additional classes to be set on the button element.\n */\n className?: string;\n};\n\ntype NativeButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'as' | 'type' | 'onClick' | 'ref'> &\n BaseButtonProps & {\n /**\n * Defines this component as a native button element.\n *\n * @default 'button'\n */\n as?: 'button';\n\n /**\n * Defines the type of the button. This may be used for form submit buttons.\n *\n * @default 'button'\n */\n type?: 'button' | 'submit';\n } & (RegularButton | ToggleButton);\n\ntype LinkButtonProps = Omit<HTMLProps<HTMLAnchorElement>, 'as' | 'type' | 'onClick' | 'ref'> &\n BaseButtonProps & {\n /**\n * Defines this component as a link element.\n */\n as: 'a';\n\n /**\n * Native button type is not supported when using `as=\"a\"`.\n */\n type?: never;\n\n /**\n * Defines the destination URL for the link button.\n */\n href: string;\n\n /**\n * Toggle behavior is not supported when using `as=\"a\"`.\n *\n * @default false\n */\n asToggle?: false;\n\n /**\n * Callback function triggered when clicking the link.\n *\n * @param event The MouseEvent that triggered the click.\n */\n onClick?: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void;\n };\n\nexport type ButtonProps = NativeButtonProps | LinkButtonProps;\n\ntype Props = PropsWithChildren<ButtonProps>;\n\n// Define statics to be used as \"Button.PRIMARY\"\ntype ButtonType = ForwardRefExoticComponent<Props & RefAttributes<HTMLButtonElement>> & {\n DEFAULT: 'default';\n UNSTYLED: 'unstyled';\n PRIMARY: 'primary';\n SECONDARY: 'secondary';\n INFO: 'info';\n WARNING: 'warning';\n DANGER: 'danger';\n SUCCESS: 'success';\n MUTED: 'muted';\n MUTED_FILLED: 'muted-filled';\n\n VARIANT_LINK: 'link';\n VARIANT_LINK_INLINE: 'link-inline';\n VARIANT_OUTLINE: 'outline';\n VARIANT_ACTION: 'action';\n\n XS: 'xs';\n SM: 'sm';\n MD: 'md';\n LG: 'lg';\n};\n\nconst Button = forwardRef<HTMLButtonElement, Props>((props, ref) => {\n const {\n as = 'button',\n active = false,\n disabled = false,\n asToggle = false,\n onClick = noop,\n bsStyle = 'default',\n bsSize,\n variant,\n iconOnly = false,\n iconName,\n iconRight = false,\n multiline = false,\n block = false,\n className = '',\n noRippleEffect = false,\n type = 'button',\n tabIndex = 0,\n children,\n ...remainingProps\n } = props;\n\n const [isToggled, setIsToggled] = useState(active);\n\n const btnRef = useRef<HTMLButtonElement>(null);\n\n const buttonRef = useMergeRefs(btnRef, ref);\n\n // Update internal toggle state when used as controlled component and outside toggle state changes\n // Note, using the usePrevious hook resulted in an endless loop, hence the useState here\n const [previousActive, setPreviousActive] = useState(active);\n if (active !== previousActive) {\n setIsToggled(active);\n setPreviousActive(active);\n }\n\n const handleButtonClick = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n if (!noRippleEffect) {\n createButtonRipple(event.nativeEvent, event.currentTarget);\n }\n\n if (asToggle) {\n // Intercept click handler only for toggle button to update internal state and blur after click\n const newIsToggled = !isToggled;\n setIsToggled(newIsToggled);\n\n if (newIsToggled) {\n btnRef.current?.blur();\n }\n\n (onClick as (x: boolean) => void)(newIsToggled);\n } else {\n (onClick as (x: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void)(event);\n }\n };\n\n const handleLinkClick = (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n\n if (!noRippleEffect) {\n createButtonRipple(event.nativeEvent, event.currentTarget);\n }\n\n (onClick as (x: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void)(event);\n };\n\n const buttonClassNames = classNames(\n 'btn',\n `btn-${bsStyle}`,\n variant === VARIANTS_MAP.VARIANT_LINK && 'btn-link',\n variant === VARIANTS_MAP.VARIANT_LINK_INLINE && 'btn-link btn-link-inline',\n variant === VARIANTS_MAP.VARIANT_OUTLINE && 'btn-outline',\n variant === VARIANTS_MAP.VARIANT_ACTION && 'btn-action',\n bsSize && `btn-${bsSize}`,\n asToggle && 'btn-toggle',\n isToggled && 'active',\n iconOnly && 'btn-icon-only',\n iconRight && 'btn-icon-right',\n multiline && 'btn-multiline',\n block && 'btn-block',\n as === 'a' && 'gap-0',\n as === 'a' && disabled && 'disabled',\n 'btn-component',\n className\n );\n\n if (as === 'a') {\n return (\n <a\n ref={buttonRef as React.Ref<HTMLAnchorElement>}\n {...(remainingProps as Omit<HTMLProps<HTMLAnchorElement>, 'as' | 'type' | 'onClick' | 'ref'>)}\n className={buttonClassNames}\n onClick={handleLinkClick}\n aria-disabled={disabled || undefined}\n tabIndex={disabled ? -1 : tabIndex}\n >\n {iconName && <span className={`rioglyph ${iconName}`} />}\n {children}\n </a>\n );\n }\n\n return (\n <button\n ref={buttonRef}\n type={type}\n {...(remainingProps as Omit<HTMLProps<HTMLButtonElement>, 'as' | 'type' | 'onClick' | 'ref'>)}\n className={buttonClassNames}\n onClick={handleButtonClick}\n disabled={disabled}\n tabIndex={tabIndex}\n >\n {iconName && <span className={`rioglyph ${iconName}`} />}\n {children}\n </button>\n );\n}) as ButtonType;\n\nObject.assign(Button, STYLES_MAP);\nObject.assign(Button, VARIANTS_MAP);\nObject.assign(Button, SIZES_MAP);\n\nexport default Button;\n"],"names":["STYLES_MAP","VARIANTS_MAP","SIZES_MAP","Button","forwardRef","props","ref","as","active","disabled","asToggle","onClick","noop","bsStyle","bsSize","variant","iconOnly","iconName","iconRight","multiline","block","className","noRippleEffect","type","tabIndex","children","remainingProps","isToggled","setIsToggled","useState","btnRef","useRef","buttonRef","useMergeRefs","previousActive","setPreviousActive","handleButtonClick","event","createButtonRipple","newIsToggled","handleLinkClick","buttonClassNames","classNames","jsxs","jsx"],"mappings":";;;;;;A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,MACX,SAASL;AAAA,MACT,UAAA3B;AAAA,MACA,UAAAe;AAAA,MAEC,UAAA;AAAA,QAAAP,KAAY,gBAAA2B,EAAC,QAAA,EAAK,WAAW,YAAY3B,CAAQ,IAAI;AAAA,QACrDQ;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGb,CAAC;AAED,OAAO,OAAOtB,GAAQH,CAAU;AAChC,OAAO,OAAOG,GAAQF,CAAY;AAClC,OAAO,OAAOE,GAAQD,CAAS;"}
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../src/components/button/Button.tsx"],"sourcesContent":["import React, {\n forwardRef,\n type ForwardRefExoticComponent,\n type HTMLProps,\n type PropsWithChildren,\n type RefAttributes,\n useRef,\n useState,\n} from 'react';\nimport { noop } from 'es-toolkit/function';\n\nimport classNames from '../../utils/classNames';\nimport { createButtonRipple } from '../../utils/buttonEffect';\nimport useMergeRefs from '../../hooks/useMergeRefs';\nimport type { ObjectValues } from '../../utils/ObjectValues';\nimport { getAutoTrackingAttributes } from '../../utils/analytics/autoTracking';\n\nexport const STYLES_MAP = {\n DEFAULT: 'default',\n UNSTYLED: 'unstyled',\n PRIMARY: 'primary',\n SECONDARY: 'secondary',\n INFO: 'info',\n WARNING: 'warning',\n DANGER: 'danger',\n SUCCESS: 'success',\n MUTED: 'muted',\n MUTED_FILLED: 'muted-filled',\n} as const;\n\n// export for convenient usage on client side\nexport type BUTTON_STYLE = ObjectValues<typeof STYLES_MAP>;\n\nexport const VARIANTS_MAP = {\n VARIANT_LINK: 'link',\n VARIANT_LINK_INLINE: 'link-inline',\n VARIANT_OUTLINE: 'outline',\n VARIANT_ACTION: 'action',\n} as const;\n\nexport type BUTTON_VARIANT = ObjectValues<typeof VARIANTS_MAP>;\n\nexport const SIZES_MAP = {\n XS: 'xs',\n SM: 'sm',\n MD: 'md',\n LG: 'lg',\n} as const;\n\nexport type BUTTON_SIZE = ObjectValues<typeof SIZES_MAP>;\n\n/*\n * ATTENTION: We're typing the onClick handler based on the value of `asToggle`.\n *\n * It does not fully work here inside of this file, though. Therefore, we have to apply some explicit casts below.\n * In code _using_ the Button component, however, the parameter type of the onClick handler must either be a boolean or\n * a React.MouseEvent, respectively.\n */\n\ntype RegularButton = {\n /**\n * Use the button as a toggle button. The toggle state can be controlled via the `active` prop.\n *\n * @default false\n */\n asToggle?: false;\n\n /**\n * Callback function triggered when clicking the button.\n *\n * @param event The MouseEvent that triggered the click.\n */\n onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;\n};\n\ntype ToggleButton = {\n /**\n * Use the button as a toggle button. The toggle state can be controlled via the `active` prop.\n *\n * @default false\n */\n asToggle: true;\n\n /**\n * Callback function triggered when clicking the button.\n *\n * @param value The new value of the toggle button.\n */\n onClick?: (value: boolean) => void;\n};\n\ntype BaseButtonProps = {\n /**\n * Whether the button should be disabled.\n *\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Set the button toggled. Should be used in combination with \"asToggle\" prop.\n *\n * @default false\n */\n active?: boolean;\n\n /**\n * Use when the content of the button is an icon only to adapt the button spacing accordingly.\n *\n * @default false\n */\n iconOnly?: boolean;\n\n /**\n * Adds right side spacing for an icon. This should be used when having navigation buttons\n * that use an icon on the right side.\n *\n * @default false\n */\n iconRight?: boolean;\n\n /**\n * Optional rio-glyph icon name that comes in handy for icon only buttons for not adding\n * a span tag for the icon which reduces boilerplate code.\n */\n iconName?: string;\n\n /**\n * Defines whether the button text break into multiple lines when the button space exceeds.\n *\n * Multiline buttons should be used as exception only.\n *\n * @default false\n */\n multiline?: boolean;\n\n /**\n * Defines whether the button takes up the full width of the parent element.\n *\n * @default false\n */\n block?: boolean;\n\n /**\n * Sets the button style.\n * @default 'default'\n */\n bsStyle?: BUTTON_STYLE;\n\n /**\n * Sets the button size.\n */\n bsSize?: BUTTON_SIZE;\n\n /**\n * Sets the button variant.\n */\n variant?: BUTTON_VARIANT;\n\n /**\n * Whether the \"ripple\" effect should be suppressed on this button.\n */\n noRippleEffect?: boolean;\n\n /**\n * Optional key used to generate automatic GA tracking attributes when no explicit\n * tracking attributes are provided.\n *\n * Resulting label format: `button::<autoTrackingKey>`.\n */\n autoTrackingKey?: string;\n\n /**\n * Number of the index used for keyboard support.\n *\n * @default 0\n */\n tabIndex?: number;\n\n /**\n * Additional classes to be set on the button element.\n */\n className?: string;\n};\n\ntype NativeButtonProps = Omit<HTMLProps<HTMLButtonElement>, 'as' | 'type' | 'onClick' | 'ref'> &\n BaseButtonProps & {\n /**\n * Defines this component as a native button element.\n *\n * @default 'button'\n */\n as?: 'button';\n\n /**\n * Defines the type of the button. This may be used for form submit buttons.\n *\n * @default 'button'\n */\n type?: 'button' | 'submit';\n } & (RegularButton | ToggleButton);\n\ntype LinkButtonProps = Omit<HTMLProps<HTMLAnchorElement>, 'as' | 'type' | 'onClick' | 'ref'> &\n BaseButtonProps & {\n /**\n * Defines this component as a link element.\n */\n as: 'a';\n\n /**\n * Native button type is not supported when using `as=\"a\"`.\n */\n type?: never;\n\n /**\n * Defines the destination URL for the link button.\n */\n href: string;\n\n /**\n * Toggle behavior is not supported when using `as=\"a\"`.\n *\n * @default false\n */\n asToggle?: false;\n\n /**\n * Callback function triggered when clicking the link.\n *\n * @param event The MouseEvent that triggered the click.\n */\n onClick?: (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void;\n };\n\nexport type ButtonProps = NativeButtonProps | LinkButtonProps;\n\ntype Props = PropsWithChildren<ButtonProps>;\n\n// Define statics to be used as \"Button.PRIMARY\"\ntype ButtonType = ForwardRefExoticComponent<Props & RefAttributes<HTMLButtonElement>> & {\n DEFAULT: 'default';\n UNSTYLED: 'unstyled';\n PRIMARY: 'primary';\n SECONDARY: 'secondary';\n INFO: 'info';\n WARNING: 'warning';\n DANGER: 'danger';\n SUCCESS: 'success';\n MUTED: 'muted';\n MUTED_FILLED: 'muted-filled';\n\n VARIANT_LINK: 'link';\n VARIANT_LINK_INLINE: 'link-inline';\n VARIANT_OUTLINE: 'outline';\n VARIANT_ACTION: 'action';\n\n XS: 'xs';\n SM: 'sm';\n MD: 'md';\n LG: 'lg';\n};\n\nconst Button = forwardRef<HTMLButtonElement, Props>((props, ref) => {\n const {\n as = 'button',\n active = false,\n disabled = false,\n asToggle = false,\n onClick = noop,\n bsStyle = 'default',\n bsSize,\n variant,\n iconOnly = false,\n iconName,\n iconRight = false,\n multiline = false,\n block = false,\n className = '',\n noRippleEffect = false,\n autoTrackingKey,\n type = 'button',\n tabIndex = 0,\n children,\n ...remainingProps\n } = props;\n\n const autoTrackingAttributes = getAutoTrackingAttributes({\n autoTrackingKey,\n props: remainingProps as Record<string, unknown>,\n source: 'button',\n });\n\n const [isToggled, setIsToggled] = useState(active);\n\n const btnRef = useRef<HTMLButtonElement>(null);\n\n const buttonRef = useMergeRefs(btnRef, ref);\n\n // Update internal toggle state when used as controlled component and outside toggle state changes\n // Note, using the usePrevious hook resulted in an endless loop, hence the useState here\n const [previousActive, setPreviousActive] = useState(active);\n if (active !== previousActive) {\n setIsToggled(active);\n setPreviousActive(active);\n }\n\n const handleButtonClick = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n if (!noRippleEffect) {\n createButtonRipple(event.nativeEvent, event.currentTarget);\n }\n\n if (asToggle) {\n // Intercept click handler only for toggle button to update internal state and blur after click\n const newIsToggled = !isToggled;\n setIsToggled(newIsToggled);\n\n if (newIsToggled) {\n btnRef.current?.blur();\n }\n\n (onClick as (x: boolean) => void)(newIsToggled);\n } else {\n (onClick as (x: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void)(event);\n }\n };\n\n const handleLinkClick = (event: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n\n if (!noRippleEffect) {\n createButtonRipple(event.nativeEvent, event.currentTarget);\n }\n\n (onClick as (x: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => void)(event);\n };\n\n const buttonClassNames = classNames(\n 'btn',\n `btn-${bsStyle}`,\n variant === VARIANTS_MAP.VARIANT_LINK && 'btn-link',\n variant === VARIANTS_MAP.VARIANT_LINK_INLINE && 'btn-link btn-link-inline',\n variant === VARIANTS_MAP.VARIANT_OUTLINE && 'btn-outline',\n variant === VARIANTS_MAP.VARIANT_ACTION && 'btn-action',\n bsSize && `btn-${bsSize}`,\n asToggle && 'btn-toggle',\n isToggled && 'active',\n iconOnly && 'btn-icon-only',\n iconRight && 'btn-icon-right',\n multiline && 'btn-multiline',\n block && 'btn-block',\n as === 'a' && 'gap-0',\n as === 'a' && disabled && 'disabled',\n 'btn-component',\n className\n );\n\n if (as === 'a') {\n return (\n <a\n ref={buttonRef as React.Ref<HTMLAnchorElement>}\n {...(remainingProps as Omit<HTMLProps<HTMLAnchorElement>, 'as' | 'type' | 'onClick' | 'ref'>)}\n {...autoTrackingAttributes}\n className={buttonClassNames}\n onClick={handleLinkClick}\n aria-disabled={disabled || undefined}\n tabIndex={disabled ? -1 : tabIndex}\n >\n {iconName && <span className={`rioglyph ${iconName}`} />}\n {children}\n </a>\n );\n }\n\n return (\n <button\n ref={buttonRef}\n type={type}\n {...(remainingProps as Omit<HTMLProps<HTMLButtonElement>, 'as' | 'type' | 'onClick' | 'ref'>)}\n {...autoTrackingAttributes}\n className={buttonClassNames}\n onClick={handleButtonClick}\n disabled={disabled}\n tabIndex={tabIndex}\n >\n {iconName && <span className={`rioglyph ${iconName}`} />}\n {children}\n </button>\n );\n}) as ButtonType;\n\nObject.assign(Button, STYLES_MAP);\nObject.assign(Button, VARIANTS_MAP);\nObject.assign(Button, SIZES_MAP);\n\nexport default Button;\n"],"names":["STYLES_MAP","VARIANTS_MAP","SIZES_MAP","Button","forwardRef","props","ref","as","active","disabled","asToggle","onClick","noop","bsStyle","bsSize","variant","iconOnly","iconName","iconRight","multiline","block","className","noRippleEffect","autoTrackingKey","type","tabIndex","children","remainingProps","autoTrackingAttributes","getAutoTrackingAttributes","isToggled","setIsToggled","useState","btnRef","useRef","buttonRef","useMergeRefs","previousActive","setPreviousActive","handleButtonClick","event","createButtonRipple","newIsToggled","handleLinkClick","buttonClassNames","classNames","jsxs","jsx"],"mappings":";;;;;;;AAiBO,MAAMA,IAAa;AAAA,EACtB,SAAS;AAAA,EACT,UAAU;AAAA,EACV,SAAS;AAAA,EACT,WAAW;AAAA,EACX,MAAM;AAAA,EACN,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,OAAO;AAAA,EACP,cAAc;AAClB,GAKaC,IAAe;AAAA,EACxB,cAAc;AAAA,EACd,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,gBAAgB;AACpB,GAIaC,IAAY;AAAA,EACrB,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACR,GAuNMC,IAASC,EAAqC,CAACC,GAAOC,MAAQ;AAChE,QAAM;AAAA,IACF,IAAAC,IAAK;AAAA,IACL,QAAAC,IAAS;AAAA,IACT,UAAAC,IAAW;AAAA,IACX,UAAAC,IAAW;AAAA,IACX,SAAAC,IAAUC;AAAA,IACV,SAAAC,IAAU;AAAA,IACV,QAAAC;AAAA,IACA,SAAAC;AAAA,IACA,UAAAC,IAAW;AAAA,IACX,UAAAC;AAAA,IACA,WAAAC,IAAY;AAAA,IACZ,WAAAC,IAAY;AAAA,IACZ,OAAAC,IAAQ;AAAA,IACR,WAAAC,IAAY;AAAA,IACZ,gBAAAC,IAAiB;AAAA,IACjB,iBAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,UAAAC,IAAW;AAAA,IACX,UAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACHtB,GAEEuB,IAAyBC,EAA0B;AAAA,IACrD,iBAAAN;AAAA,IACA,OAAOI;AAAA,IACP,QAAQ;AAAA,EAAA,CACX,GAEK,CAACG,GAAWC,CAAY,IAAIC,EAASxB,CAAM,GAE3CyB,IAASC,EAA0B,IAAI,GAEvCC,IAAYC,EAAaH,GAAQ3B,CAAG,GAIpC,CAAC+B,GAAgBC,CAAiB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AA8B,EAAC,QAAA,EAAK,WAAW,YAAY9B,CAAQ,IAAI;AAAA,QACrDS;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,IAMT,gBAAAoB;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,KAAKX;AAAA,MACL,MAAAX;AAAA,MACC,GAAIG;AAAA,MACJ,GAAGC;AAAA,MACJ,WAAWgB;AAAA,MACX,SAASL;AAAA,MACT,UAAA9B;AAAA,MACA,UAAAgB;AAAA,MAEC,UAAA;AAAA,QAAAR,KAAY,gBAAA8B,EAAC,QAAA,EAAK,WAAW,YAAY9B,CAAQ,IAAI;AAAA,QACrDS;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGb,CAAC;AAED,OAAO,OAAOvB,GAAQH,CAAU;AAChC,OAAO,OAAOG,GAAQF,CAAY;AAClC,OAAO,OAAOE,GAAQD,CAAS;"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { AreaProps as RechartsAreaProps } from 'recharts';
|
|
2
2
|
import { CurveType } from 'recharts/types/shape/Curve';
|
|
3
|
-
export type AreaProps<T =
|
|
3
|
+
export type AreaProps<T = unknown> = Omit<RechartsAreaProps<T, unknown>, 'ref' | 'dataKey'> & {
|
|
4
4
|
strokeColor?: string;
|
|
5
|
-
|
|
5
|
+
fill?: string;
|
|
6
|
+
dataKey?: string | number | ((obj: T) => unknown);
|
|
6
7
|
unit?: string;
|
|
7
8
|
legendType?: string;
|
|
8
9
|
type?: CurveType;
|
|
@@ -12,9 +13,10 @@ export declare const getAreaDefaultProps: () => {
|
|
|
12
13
|
dataKey: string;
|
|
13
14
|
unit: string;
|
|
14
15
|
strokeColor: string;
|
|
16
|
+
fill: string;
|
|
15
17
|
legendType: string;
|
|
16
18
|
type: string;
|
|
17
19
|
isAnimationActive: boolean;
|
|
18
20
|
};
|
|
19
|
-
declare const Area: (
|
|
21
|
+
declare const Area: (_props: AreaProps) => null;
|
|
20
22
|
export default Area;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
const
|
|
1
|
+
const e = () => ({
|
|
2
2
|
dataKey: "value",
|
|
3
3
|
unit: "",
|
|
4
4
|
strokeColor: "color-coldplay-fountain",
|
|
5
|
+
fill: "color-coldplay-fountain",
|
|
5
6
|
legendType: "square",
|
|
6
7
|
type: "monotone",
|
|
7
8
|
isAnimationActive: !0
|
|
8
|
-
}), t = (
|
|
9
|
+
}), t = (o) => null;
|
|
9
10
|
export {
|
|
10
11
|
t as default,
|
|
11
|
-
|
|
12
|
+
e as getAreaDefaultProps
|
|
12
13
|
};
|
|
13
14
|
//# sourceMappingURL=Area.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Area.js","sources":["../../../src/components/charts/Area.tsx"],"sourcesContent":["import type { AreaProps as RechartsAreaProps } from 'recharts';\nimport type { CurveType } from 'recharts/types/shape/Curve';\n\
|
|
1
|
+
{"version":3,"file":"Area.js","sources":["../../../src/components/charts/Area.tsx"],"sourcesContent":["import type { AreaProps as RechartsAreaProps } from 'recharts';\nimport type { CurveType } from 'recharts/types/shape/Curve';\n\nexport type AreaProps<T = unknown> = Omit<RechartsAreaProps<T, unknown>, 'ref' | 'dataKey'> & {\n strokeColor?: string;\n fill?: string;\n dataKey?: string | number | ((obj: T) => unknown);\n unit?: string;\n legendType?: string;\n type?: CurveType;\n isAnimationActive?: boolean;\n};\n\nexport const getAreaDefaultProps = () => ({\n dataKey: 'value',\n unit: '',\n strokeColor: 'color-coldplay-fountain',\n fill: 'color-coldplay-fountain',\n legendType: 'square',\n type: 'monotone',\n isAnimationActive: true,\n});\n\nconst Area = (_props: AreaProps) => null;\n\nexport default Area;\n"],"names":["getAreaDefaultProps","Area","_props"],"mappings":"AAaO,MAAMA,IAAsB,OAAO;AAAA,EACtC,SAAS;AAAA,EACT,MAAM;AAAA,EACN,aAAa;AAAA,EACb,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,MAAM;AAAA,EACN,mBAAmB;AACvB,IAEMC,IAAO,CAACC,MAAsB;"}
|