@rio-cloud/rio-uikit 2.2.1 → 2.3.0-beta.1
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/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/TableSettingsDialog.d.ts +2 -2
- package/TableSettingsDialog.js +1 -1
- package/TableToolbar.js +3 -2
- 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/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/checkbox/Checkbox.js +18 -17
- package/components/checkbox/Checkbox.js.map +1 -1
- package/components/datepicker/DateRangePicker.js +0 -2
- package/components/datepicker/DateRangePicker.js.map +1 -1
- package/components/datepicker/DayPicker.js +16 -16
- package/components/datepicker/DayPicker.js.map +1 -1
- 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/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 +1 -1
- 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/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/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 +4 -4
- package/components/popover/Popover.js.map +1 -1
- package/components/resizer/Resizer.js +6 -3
- package/components/resizer/Resizer.js.map +1 -1
- package/components/selects/BaseSelectDropdown.js +34 -32
- package/components/selects/BaseSelectDropdown.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/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 +267 -0
- package/components/table/Table.js +233 -0
- package/components/table/Table.js.map +1 -0
- package/components/table/Table.types.d.ts +207 -0
- package/components/table/TableBody.d.ts +10 -0
- package/components/table/TableBody.js +5 -0
- package/components/table/TableBody.js.map +1 -0
- package/components/table/TableCard.d.ts +63 -0
- package/components/table/TableCard.js +150 -0
- package/components/table/TableCard.js.map +1 -0
- package/components/table/TableColumn.d.ts +47 -0
- package/components/table/TableColumn.js +5 -0
- package/components/table/TableColumn.js.map +1 -0
- package/components/table/TableExpandedContentRow.d.ts +22 -0
- package/components/table/TableExpandedContentRow.js +5 -0
- package/components/table/TableExpandedContentRow.js.map +1 -0
- package/components/table/TableExpandedRow.d.ts +17 -0
- package/components/table/TableExpandedRow.js +5 -0
- package/components/table/TableExpandedRow.js.map +1 -0
- package/components/table/TableExpanderButton.d.ts +25 -0
- package/components/table/TableExpanderButton.js +22 -0
- package/components/table/TableExpanderButton.js.map +1 -0
- package/components/table/TableFooter.d.ts +13 -0
- package/components/table/TableFooter.js +5 -0
- package/components/table/TableFooter.js.map +1 -0
- package/components/table/TableGroupFooterRow.d.ts +18 -0
- package/components/table/TableGroupFooterRow.js +5 -0
- package/components/table/TableGroupFooterRow.js.map +1 -0
- package/components/table/TableGroupRow.d.ts +24 -0
- package/components/table/TableGroupRow.js +5 -0
- package/components/table/TableGroupRow.js.map +1 -0
- package/components/table/TableHeader.d.ts +9 -0
- package/components/table/TableHeader.js +5 -0
- package/components/table/TableHeader.js.map +1 -0
- package/components/table/TableHeaderColumn.d.ts +70 -0
- package/components/table/TableHeaderColumn.js +5 -0
- package/components/table/TableHeaderColumn.js.map +1 -0
- package/components/table/TableHeaderRow.d.ts +9 -0
- package/components/table/TableHeaderRow.js +5 -0
- package/components/table/TableHeaderRow.js.map +1 -0
- package/components/table/TableRow.d.ts +19 -0
- package/components/table/TableRow.js +5 -0
- package/components/table/TableRow.js.map +1 -0
- package/components/table/TableSpacerRow.d.ts +12 -0
- package/components/table/TableSpacerRow.js +5 -0
- package/components/table/TableSpacerRow.js.map +1 -0
- package/components/table/TableToolbar.d.ts +23 -1
- package/components/table/TableToolbar.js +38 -4
- package/components/table/TableToolbar.js.map +1 -1
- package/components/table/TableViewToggles.d.ts +18 -0
- package/components/table/TableViewToggles.js +59 -87
- package/components/table/TableViewToggles.js.map +1 -1
- 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 +11 -0
- package/components/table/layout/useHorizontalSectionSync.js +39 -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 +14 -0
- package/components/table/layout/useResizableColumns.js +91 -0
- package/components/table/layout/useResizableColumns.js.map +1 -0
- package/components/table/layout/useTableLayout.d.ts +25 -0
- package/components/table/layout/useTableLayout.js +56 -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/buildTableViewModel.d.ts +28 -0
- package/components/table/model/buildTableViewModel.js +221 -0
- package/components/table/model/buildTableViewModel.js.map +1 -0
- package/components/table/model/resolveCellContent.d.ts +2 -0
- package/components/table/model/resolveCellContent.js +5 -0
- package/components/table/model/resolveCellContent.js.map +1 -0
- package/components/table/model/resolveRowMeta.d.ts +2 -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 +48 -0
- package/components/table/model/resolveTableClassConfig.js +64 -0
- package/components/table/model/resolveTableClassConfig.js.map +1 -0
- package/components/table/model/tableViewModel.types.d.ts +153 -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/parse/parseBody.d.ts +3 -0
- package/components/table/parse/parseBody.js +13 -0
- package/components/table/parse/parseBody.js.map +1 -0
- package/components/table/parse/parseColumns.d.ts +3 -0
- package/components/table/parse/parseColumns.js +81 -0
- package/components/table/parse/parseColumns.js.map +1 -0
- package/components/table/parse/parseFooter.d.ts +3 -0
- package/components/table/parse/parseFooter.js +39 -0
- package/components/table/parse/parseFooter.js.map +1 -0
- package/components/table/parse/parseHeaders.d.ts +4 -0
- package/components/table/parse/parseHeaders.js +89 -0
- package/components/table/parse/parseHeaders.js.map +1 -0
- package/components/table/parse/parseRows.d.ts +3 -0
- package/components/table/parse/parseRows.js +93 -0
- package/components/table/parse/parseRows.js.map +1 -0
- package/components/table/parse/tableChildGuards.d.ts +25 -0
- package/components/table/parse/tableChildGuards.js +29 -0
- package/components/table/parse/tableChildGuards.js.map +1 -0
- package/components/table/render/body/TableBodyRow.d.ts +16 -0
- package/components/table/render/body/TableBodyRow.js +84 -0
- package/components/table/render/body/TableBodyRow.js.map +1 -0
- package/components/table/render/body/TableBodySection.d.ts +20 -0
- package/components/table/render/body/TableBodySection.js +68 -0
- package/components/table/render/body/TableBodySection.js.map +1 -0
- package/components/table/render/body/TableDataRow.d.ts +15 -0
- package/components/table/render/body/TableDataRow.js +143 -0
- package/components/table/render/body/TableDataRow.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/body/TableExpandedRow.d.ts +8 -0
- package/components/table/render/body/TableExpandedRow.js +84 -0
- package/components/table/render/body/TableExpandedRow.js.map +1 -0
- package/components/table/render/body/TableGroupRow.d.ts +8 -0
- package/components/table/render/body/TableGroupRow.js +21 -0
- package/components/table/render/body/TableGroupRow.js.map +1 -0
- package/components/table/render/body/TableSpacerRow.d.ts +7 -0
- package/components/table/render/body/TableSpacerRow.js +15 -0
- package/components/table/render/body/TableSpacerRow.js.map +1 -0
- package/components/table/render/footer/TableFooterCell.d.ts +8 -0
- package/components/table/render/footer/TableFooterCell.js +31 -0
- package/components/table/render/footer/TableFooterCell.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/footer/TableFooterSection.d.ts +10 -0
- package/components/table/render/footer/TableFooterSection.js +28 -0
- package/components/table/render/footer/TableFooterSection.js.map +1 -0
- package/components/table/render/header/TableBatchDropdown.d.ts +9 -0
- package/components/table/render/header/TableBatchDropdown.js +28 -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 +70 -0
- package/components/table/render/header/TableColumnFilter.js.map +1 -0
- package/components/table/render/header/TableDraggableHeaderCell.d.ts +3 -0
- package/components/table/render/header/TableDraggableHeaderCell.js +54 -0
- package/components/table/render/header/TableDraggableHeaderCell.js.map +1 -0
- package/components/table/render/header/TableHeader.types.d.ts +35 -0
- package/components/table/render/header/TableHeaderCellContent.d.ts +3 -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 +3 -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 +13 -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/TableHeaderSection.d.ts +3 -0
- package/components/table/render/header/TableHeaderSection.js +104 -0
- package/components/table/render/header/TableHeaderSection.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 +3 -0
- package/components/table/render/header/TableStaticHeaderCell.js +36 -0
- package/components/table/render/header/TableStaticHeaderCell.js.map +1 -0
- package/components/table/render/header/resolveAriaSort.d.ts +2 -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 +10 -0
- package/components/table/render/header/resolveHeaderCellClassName.js +22 -0
- package/components/table/render/header/resolveHeaderCellClassName.js.map +1 -0
- package/components/table/render/header/resolveHeaderCellStyle.d.ts +829 -0
- package/components/table/render/header/resolveHeaderCellStyle.js +9 -0
- package/components/table/render/header/resolveHeaderCellStyle.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/getInteractiveRowProps.d.ts +14 -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/package.json +3 -3
- 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 +32 -1
- package/utils/routeUtils.js +85 -67
- 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,44 +1,44 @@
|
|
|
1
1
|
import { jsxs as A, jsx as d } from "react/jsx-runtime";
|
|
2
|
-
import R, { memo as
|
|
3
|
-
import { noop as
|
|
2
|
+
import R, { memo as oe, forwardRef as re, useState as f, useRef as ne } from "react";
|
|
3
|
+
import { noop as T, head as E, isArray as L } from "es-toolkit/compat";
|
|
4
4
|
import ie from "tiny-invariant";
|
|
5
5
|
import g from "../../utils/classNames.js";
|
|
6
6
|
import de from "./TreeCategory.js";
|
|
7
|
-
import
|
|
7
|
+
import u from "../resizer/Resizer.js";
|
|
8
8
|
import ae from "./TreeSidebar.js";
|
|
9
9
|
import ce from "../../utils/getWidthInBoundaries.js";
|
|
10
10
|
import le from "../../utils/mergeRefs.js";
|
|
11
11
|
import fe from "../../hooks/usePrevious.js";
|
|
12
12
|
import me from "../smoothScrollbars/SmoothScrollbars.js";
|
|
13
|
-
const pe = 350, he = 100,
|
|
13
|
+
const pe = 350, he = 100, ye = 0, m = {
|
|
14
14
|
MODE_FLY: "fly",
|
|
15
15
|
MODE_FLUID: "fluid"
|
|
16
|
-
}, b = (e) => E(e?.current?.getElementsByClassName("AssetTreeBody")),
|
|
16
|
+
}, b = (e) => E(e?.current?.getElementsByClassName("AssetTreeBody")), Te = (e, o) => L(e) ? e.find((t) => t && t.props.id === o) : e, ue = (e, o) => R.Children.map(e, (t) => {
|
|
17
17
|
const p = g(
|
|
18
18
|
"TreeOffscreenWrapper",
|
|
19
|
-
t && t.props.id !==
|
|
19
|
+
t && t.props.id !== o && "position-offscreen pointer-events-none"
|
|
20
20
|
);
|
|
21
21
|
return /* @__PURE__ */ d("div", { className: p, children: t });
|
|
22
|
-
}), ge = (e) => R.isValidElement(e) && e.type === de, Re =
|
|
23
|
-
|
|
22
|
+
}), ge = (e) => R.isValidElement(e) && e.type === de, Re = oe(
|
|
23
|
+
re((e, o) => {
|
|
24
24
|
const {
|
|
25
25
|
className: t,
|
|
26
26
|
resizable: p = !0,
|
|
27
27
|
width: a = pe,
|
|
28
28
|
minWidth: M = he,
|
|
29
|
-
maxWidth: C =
|
|
29
|
+
maxWidth: C = ye,
|
|
30
30
|
height: D,
|
|
31
31
|
bordered: I = !1,
|
|
32
|
-
currentCategoryId:
|
|
32
|
+
currentCategoryId: r,
|
|
33
33
|
isOpen: n = !0,
|
|
34
34
|
useOffscreen: O = !1,
|
|
35
35
|
fly: i = !1,
|
|
36
|
-
onCategoryChange: S =
|
|
37
|
-
onToggleTree: N =
|
|
38
|
-
onResizeEnd: _ =
|
|
36
|
+
onCategoryChange: S = T,
|
|
37
|
+
onToggleTree: N = T,
|
|
38
|
+
onResizeEnd: _ = T,
|
|
39
39
|
children: c = [],
|
|
40
40
|
...w
|
|
41
|
-
} = e, W = (s) => s ? m.MODE_FLY : m.MODE_FLUID, [F, z] = f(a), [x, v] = f(!1), [B, H] = f(W(i)), h = ne(null), P = le([
|
|
41
|
+
} = e, W = (s) => s ? m.MODE_FLY : m.MODE_FLUID, [F, z] = f(a), [x, v] = f(!1), [B, H] = f(W(i)), h = ne(null), P = le([o, h]);
|
|
42
42
|
fe(a) !== a && z(a);
|
|
43
43
|
const [U, j] = f(i);
|
|
44
44
|
U !== i && (H(W(i)), j(i));
|
|
@@ -50,11 +50,11 @@ const pe = 350, he = 100, ue = 0, m = {
|
|
|
50
50
|
!n && "closed",
|
|
51
51
|
I && "border",
|
|
52
52
|
B === m.MODE_FLY ? "fly" : "fluid"
|
|
53
|
-
), k = g("AssetTreeResizeLimit", x && "display-block"), G = { left: C || window.innerWidth * 0.5 }, V = E(l), X =
|
|
53
|
+
), k = g("AssetTreeResizeLimit", x && "display-block"), G = { left: C || window.innerWidth * 0.5 }, V = E(l), X = r ? Te(l, r) : V, Z = {
|
|
54
54
|
width: F,
|
|
55
55
|
height: D
|
|
56
|
-
},
|
|
57
|
-
S(s), n ? n &&
|
|
56
|
+
}, y = () => N(!n), q = (s) => {
|
|
57
|
+
S(s), n ? n && r === s && y() : y();
|
|
58
58
|
}, J = (s) => {
|
|
59
59
|
const $ = window.innerWidth * 0.5, ee = C || $;
|
|
60
60
|
z((se) => {
|
|
@@ -75,21 +75,21 @@ const pe = 350, he = 100, ue = 0, m = {
|
|
|
75
75
|
ae,
|
|
76
76
|
{
|
|
77
77
|
onSelectCategory: q,
|
|
78
|
-
currentCategoryId:
|
|
79
|
-
onClick:
|
|
78
|
+
currentCategoryId: r,
|
|
79
|
+
onClick: y,
|
|
80
80
|
children: L(c) ? c : [c]
|
|
81
81
|
}
|
|
82
82
|
),
|
|
83
|
-
/* @__PURE__ */ d(me, { slideIn: !0, className: "AssetTreeBody", children: O ?
|
|
83
|
+
/* @__PURE__ */ d(me, { slideIn: !0, className: "AssetTreeBody", children: O ? ue(l, r) : X })
|
|
84
84
|
] }),
|
|
85
85
|
p && n && /* @__PURE__ */ d(
|
|
86
|
-
|
|
86
|
+
u,
|
|
87
87
|
{
|
|
88
88
|
onResizeStart: K,
|
|
89
89
|
onResize: J,
|
|
90
90
|
onResizeEnd: Q,
|
|
91
|
-
direction:
|
|
92
|
-
position:
|
|
91
|
+
direction: u.HORIZONTAL,
|
|
92
|
+
position: u.RIGHT
|
|
93
93
|
}
|
|
94
94
|
)
|
|
95
95
|
] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssetTree.js","sources":["../../../src/components/assetTree/AssetTree.tsx"],"sourcesContent":["import React, { memo, useState, useRef, forwardRef, type PropsWithChildren } from 'react';\nimport { head, isArray, noop } from 'es-toolkit/compat';\nimport invariant from 'tiny-invariant';\n\nimport classNames from '../../utils/classNames';\nimport TreeCategory, { type TreeCategoryProps } from './TreeCategory';\nimport Resizer from '../resizer/Resizer';\nimport TreeSidebar from './TreeSidebar';\nimport getWidthInBoundaries from '../../utils/getWidthInBoundaries';\nimport mergeRefs from '../../utils/mergeRefs';\nimport usePrevious from '../../usePrevious';\nimport SmoothScrollbars from '../smoothScrollbars/SmoothScrollbars';\n\nconst DEFAULT_WIDTH = 350;\nconst DEFAULT_MIN_WIDTH = 100;\nconst DEFAULT_MAX_WIDTH = 0;\n\nconst TreeMode = {\n MODE_FLY: 'fly',\n MODE_FLUID: 'fluid',\n} as const;\n\nconst getSidebarBodyRef = (sidebarRef: React.MutableRefObject<HTMLDivElement | null>) =>\n head(sidebarRef?.current?.getElementsByClassName('AssetTreeBody'));\n\nconst getCurrentCategoryElement = (children: React.ReactElement[], currentCategoryId: string) => {\n return isArray(children) ? children.find(child => child && child.props.id === currentCategoryId) : children;\n};\n\nconst renderTreesOffscreen = (children: React.ReactElement[], categoryId: string | undefined) => {\n return React.Children.map(children, child => {\n const offscreenClasses = classNames(\n 'TreeOffscreenWrapper',\n child && child.props.id !== categoryId && 'position-offscreen pointer-events-none'\n );\n return <div className={offscreenClasses}>{child}</div>;\n });\n};\n\nexport type AssetTreeProps = {\n /**\n * Defines if the component will overlap the body content.\n *\n * @default false\n */\n fly?: boolean;\n\n /**\n * Defines whether or not the sidebar is resizable.\n *\n * @default true\n */\n resizable?: boolean;\n\n /**\n * Defines whether the component has a border or not.\n *\n * @default false\n */\n bordered?: boolean;\n\n /**\n * Defines the width of the component. The value is set as inline style.\n *\n * Note: when component is resizable it will take the provided\n * width in px only and convert it to number in case.\n *\n * @default 350\n */\n width?: number;\n\n /**\n * Defines the minimum width of the component in px that will take effect when resizing.\n *\n * @default 100\n */\n minWidth?: number;\n\n /**\n * Defines the maximum width of the component in px that will take effect when resizing.\n *\n * @default 0\n */\n maxWidth?: number;\n\n /**\n * Defines the height of the component in px.\n */\n height?: number;\n\n /**\n * Defines whether the component is open or not.\n *\n * @default true\n */\n isOpen?: boolean;\n\n /**\n * Callback for when the tree visibility is toggled.\n *\n * @default () => {}\n * @param isOpen\n * @returns\n */\n onToggleTree?: (isOpen: boolean) => void;\n\n /**\n * The id of the category which is currently active and shall be shown.\n */\n currentCategoryId?: string;\n\n /**\n * Callback for handling change of category.\n *\n * @default () => {}\n * @param selectedCategoryId\n * @returns\n */\n onCategoryChange?: (selectedCategoryId: string) => void;\n\n /**\n * Callback for when the resize is done.\n *\n * @default () => {}\n */\n onResizeEnd?: VoidFunction;\n\n /**\n * Defines whether the tree components are rendered offscreen and kept mounted in the DOM.\n *\n * @default false\n */\n useOffscreen?: boolean;\n\n /**\n * Additional classes added on the wrapper element.\n */\n className?: string;\n};\n\n// Check if the child is a React element and if it has the type TreeCategory\nconst isTreeCategory = (child: React.ReactNode): child is React.ReactElement<TreeCategoryProps> => {\n return React.isValidElement(child) && child.type === TreeCategory;\n};\n\nconst AssetTree = memo(\n forwardRef<HTMLDivElement, PropsWithChildren<AssetTreeProps>>((props, ref) => {\n const {\n className,\n resizable = true,\n width = DEFAULT_WIDTH,\n minWidth = DEFAULT_MIN_WIDTH,\n maxWidth = DEFAULT_MAX_WIDTH,\n height,\n bordered = false,\n currentCategoryId,\n isOpen = true,\n useOffscreen = false,\n fly = false,\n onCategoryChange = noop,\n onToggleTree = noop,\n onResizeEnd = noop,\n children = [],\n ...remainingProps\n } = props;\n\n const getSidebarMode = (isFly: boolean) => (isFly ? TreeMode.MODE_FLY : TreeMode.MODE_FLUID);\n\n const [treeWidth, setTreeWidth] = useState(width);\n const [isResize, setIsResize] = useState(false);\n const [sidebarMode, setSidebarMode] = useState(getSidebarMode(fly));\n\n const sidebarRef = useRef<HTMLDivElement>(null);\n\n const mergedRefs = mergeRefs([ref, sidebarRef]);\n\n // Update internal state when props change\n const previousWidth = usePrevious(width);\n if (previousWidth !== width) {\n setTreeWidth(width);\n }\n\n const [previousMode, setPreviousMode] = useState(fly);\n if (previousMode !== fly) {\n setSidebarMode(getSidebarMode(fly));\n setPreviousMode(fly);\n }\n\n const childrenArray = React.Children.toArray(children);\n\n // check for children type of TreeCategory and throw error in case\n invariant(childrenArray.every(isTreeCategory), 'AssetTree only excepts children of type \"TreeCategory\"');\n\n const classes = classNames(\n 'AssetTree',\n className,\n !isOpen && 'closed',\n bordered && 'border',\n sidebarMode === TreeMode.MODE_FLY ? 'fly' : 'fluid'\n );\n\n const resizeLimitClasses = classNames('AssetTreeResizeLimit', isResize && 'display-block');\n\n const resizeIndicatorPosition = maxWidth || window.innerWidth * 0.5;\n const resizeLimitStyle = { left: resizeIndicatorPosition };\n\n const firstChild = head(childrenArray);\n\n const category = currentCategoryId ? getCurrentCategoryElement(childrenArray, currentCategoryId) : firstChild;\n\n const style = {\n width: treeWidth,\n height,\n };\n\n const handleToggleTreeContent = () => onToggleTree(!isOpen);\n\n const handleSelectCategory = (selectedCategoryId: string) => {\n onCategoryChange(selectedCategoryId);\n\n if (!isOpen) {\n handleToggleTreeContent();\n } else if (isOpen && currentCategoryId === selectedCategoryId) {\n handleToggleTreeContent();\n }\n };\n\n const handleResize = (diff: number) => {\n const halfWindowWidth = window.innerWidth * 0.5;\n const usedMaxWidth = maxWidth || halfWindowWidth;\n\n // Check for sidebar width if it is half window size. If it was before but the sidebar was resized so it is\n // no longer half window size, set the sidebar width to half the window size to avoid jumping sidebar\n // to old width\n setTreeWidth(oldWidth => {\n const updatedWidth = oldWidth - diff;\n return getWidthInBoundaries(minWidth, usedMaxWidth, updatedWidth);\n });\n };\n\n const handleResizeStart = () => {\n const body = getSidebarBodyRef(sidebarRef);\n if (body) {\n body.classList.add('pointer-events-none');\n }\n setIsResize(true);\n };\n\n const handleResizeEnd = () => {\n const body = getSidebarBodyRef(sidebarRef);\n if (body) {\n body.classList.remove('pointer-events-none');\n }\n setIsResize(false);\n onResizeEnd();\n };\n\n return (\n <div {...remainingProps} className={classes} style={style} ref={mergedRefs}>\n <div className={resizeLimitClasses} style={resizeLimitStyle} />\n <div className='AssetTreeContent'>\n <TreeSidebar\n onSelectCategory={handleSelectCategory}\n currentCategoryId={currentCategoryId}\n onClick={handleToggleTreeContent}\n >\n {isArray(children) ? children : [children]}\n </TreeSidebar>\n <SmoothScrollbars slideIn className='AssetTreeBody'>\n {useOffscreen ? renderTreesOffscreen(childrenArray, currentCategoryId) : category}\n </SmoothScrollbars>\n </div>\n {resizable && isOpen && (\n <Resizer\n onResizeStart={handleResizeStart}\n onResize={handleResize}\n onResizeEnd={handleResizeEnd}\n direction={Resizer.HORIZONTAL}\n position={Resizer.RIGHT}\n />\n )}\n </div>\n );\n })\n);\n\nObject.assign(AssetTree, TreeMode);\n\nexport default AssetTree;\n"],"names":["DEFAULT_WIDTH","DEFAULT_MIN_WIDTH","DEFAULT_MAX_WIDTH","TreeMode","getSidebarBodyRef","sidebarRef","head","getCurrentCategoryElement","children","currentCategoryId","isArray","child","renderTreesOffscreen","categoryId","React","offscreenClasses","classNames","jsx","isTreeCategory","TreeCategory","AssetTree","memo","forwardRef","props","ref","className","resizable","width","minWidth","maxWidth","height","bordered","isOpen","useOffscreen","fly","onCategoryChange","noop","onToggleTree","onResizeEnd","remainingProps","getSidebarMode","isFly","treeWidth","setTreeWidth","useState","isResize","setIsResize","sidebarMode","setSidebarMode","useRef","mergedRefs","mergeRefs","usePrevious","previousMode","setPreviousMode","childrenArray","invariant","classes","resizeLimitClasses","resizeLimitStyle","firstChild","category","style","handleToggleTreeContent","handleSelectCategory","selectedCategoryId","handleResize","diff","halfWindowWidth","usedMaxWidth","oldWidth","updatedWidth","getWidthInBoundaries","handleResizeStart","body","handleResizeEnd","jsxs","TreeSidebar","SmoothScrollbars","Resizer"],"mappings":";;;;;;;;;;;;AAaA,MAAMA,KAAgB,KAChBC,KAAoB,KACpBC,KAAoB,GAEpBC,IAAW;AAAA,EACb,UAAU;AAAA,EACV,YAAY;AAChB,GAEMC,IAAoB,CAACC,MACvBC,EAAKD,GAAY,SAAS,uBAAuB,eAAe,CAAC,GAE/DE,KAA4B,CAACC,GAAgCC,MACxDC,EAAQF,CAAQ,IAAIA,EAAS,KAAK,CAAAG,MAASA,KAASA,EAAM,MAAM,OAAOF,CAAiB,IAAID,GAGjGI,KAAuB,CAACJ,GAAgCK,MACnDC,EAAM,SAAS,IAAIN,GAAU,CAAAG,MAAS;AACzC,QAAMI,IAAmBC;AAAA,IACrB;AAAA,IACAL,KAASA,EAAM,MAAM,OAAOE,KAAc;AAAA,EAAA;AAE9C,SAAO,gBAAAI,EAAC,OAAA,EAAI,WAAWF,GAAmB,UAAAJ,GAAM;AACpD,CAAC,GAyGCO,KAAiB,CAACP,MACbG,EAAM,eAAeH,CAAK,KAAKA,EAAM,SAASQ,IAGnDC,KAAYC;AAAA,EACdC,GA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ASsD;AAAA,YAER,UAAArD,EAAQF,CAAQ,IAAIA,IAAW,CAACA,CAAQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAE7C,gBAAAS,EAAC6D,IAAA,EAAiB,SAAO,IAAC,WAAU,iBAC/B,UAAA7C,IAAerB,GAAqB2C,GAAe9C,CAAiB,IAAIoD,EAAA,CAC7E;AAAA,MAAA,GACJ;AAAA,MACCnC,KAAaM,KACV,gBAAAf;AAAA,QAAC8D;AAAA,QAAA;AAAA,UACG,eAAeN;AAAA,UACf,UAAUP;AAAA,UACV,aAAaS;AAAA,UACb,WAAWI,EAAQ;AAAA,UACnB,UAAUA,EAAQ;AAAA,QAAA;AAAA,MAAA;AAAA,IACtB,GAER;AAAA,EAER,CAAC;AACL;AAEA,OAAO,OAAO3D,IAAWjB,CAAQ;"}
|
|
1
|
+
{"version":3,"file":"AssetTree.js","sources":["../../../src/components/assetTree/AssetTree.tsx"],"sourcesContent":["import React, { memo, useState, useRef, forwardRef, type PropsWithChildren } from 'react';\nimport { head, isArray, noop } from 'es-toolkit/compat';\nimport invariant from 'tiny-invariant';\n\nimport classNames from '../../utils/classNames';\nimport TreeCategory, { type TreeCategoryProps } from './TreeCategory';\nimport Resizer from '../resizer/Resizer';\nimport TreeSidebar from './TreeSidebar';\nimport getWidthInBoundaries from '../../utils/getWidthInBoundaries';\nimport mergeRefs from '../../utils/mergeRefs';\nimport usePrevious from '../../usePrevious';\nimport SmoothScrollbars from '../smoothScrollbars/SmoothScrollbars';\n\nconst DEFAULT_WIDTH = 350;\nconst DEFAULT_MIN_WIDTH = 100;\nconst DEFAULT_MAX_WIDTH = 0;\n\nconst TreeMode = {\n MODE_FLY: 'fly',\n MODE_FLUID: 'fluid',\n} as const;\n\nconst getSidebarBodyRef = (sidebarRef: React.MutableRefObject<HTMLDivElement | null>) =>\n head(sidebarRef?.current?.getElementsByClassName('AssetTreeBody'));\n\nconst getCurrentCategoryElement = (children: React.ReactElement[], currentCategoryId: string) =>\n isArray(children) ? children.find(child => child && child.props.id === currentCategoryId) : children;\n\nconst renderTreesOffscreen = (children: React.ReactElement[], categoryId: string | undefined) =>\n React.Children.map(children, child => {\n const offscreenClasses = classNames(\n 'TreeOffscreenWrapper',\n child && child.props.id !== categoryId && 'position-offscreen pointer-events-none'\n );\n return <div className={offscreenClasses}>{child}</div>;\n });\n\nexport type AssetTreeProps = {\n /**\n * Defines if the component will overlap the body content.\n *\n * @default false\n */\n fly?: boolean;\n\n /**\n * Defines whether or not the sidebar is resizable.\n *\n * @default true\n */\n resizable?: boolean;\n\n /**\n * Defines whether the component has a border or not.\n *\n * @default false\n */\n bordered?: boolean;\n\n /**\n * Defines the width of the component. The value is set as inline style.\n *\n * Note: when component is resizable it will take the provided\n * width in px only and convert it to number in case.\n *\n * @default 350\n */\n width?: number;\n\n /**\n * Defines the minimum width of the component in px that will take effect when resizing.\n *\n * @default 100\n */\n minWidth?: number;\n\n /**\n * Defines the maximum width of the component in px that will take effect when resizing.\n *\n * @default 0\n */\n maxWidth?: number;\n\n /**\n * Defines the height of the component in px.\n */\n height?: number;\n\n /**\n * Defines whether the component is open or not.\n *\n * @default true\n */\n isOpen?: boolean;\n\n /**\n * Callback for when the tree visibility is toggled.\n *\n * @default () => {}\n * @param isOpen\n * @returns\n */\n onToggleTree?: (isOpen: boolean) => void;\n\n /**\n * The id of the category which is currently active and shall be shown.\n */\n currentCategoryId?: string;\n\n /**\n * Callback for handling change of category.\n *\n * @default () => {}\n * @param selectedCategoryId\n * @returns\n */\n onCategoryChange?: (selectedCategoryId: string) => void;\n\n /**\n * Callback for when the resize is done.\n *\n * @default () => {}\n */\n onResizeEnd?: VoidFunction;\n\n /**\n * Defines whether the tree components are rendered offscreen and kept mounted in the DOM.\n *\n * @default false\n */\n useOffscreen?: boolean;\n\n /**\n * Additional classes added on the wrapper element.\n */\n className?: string;\n};\n\n// Check if the child is a React element and if it has the type TreeCategory\nconst isTreeCategory = (child: React.ReactNode): child is React.ReactElement<TreeCategoryProps> =>\n React.isValidElement(child) && child.type === TreeCategory;\n\nconst AssetTree = memo(\n forwardRef<HTMLDivElement, PropsWithChildren<AssetTreeProps>>((props, ref) => {\n const {\n className,\n resizable = true,\n width = DEFAULT_WIDTH,\n minWidth = DEFAULT_MIN_WIDTH,\n maxWidth = DEFAULT_MAX_WIDTH,\n height,\n bordered = false,\n currentCategoryId,\n isOpen = true,\n useOffscreen = false,\n fly = false,\n onCategoryChange = noop,\n onToggleTree = noop,\n onResizeEnd = noop,\n children = [],\n ...remainingProps\n } = props;\n\n const getSidebarMode = (isFly: boolean) => (isFly ? TreeMode.MODE_FLY : TreeMode.MODE_FLUID);\n\n const [treeWidth, setTreeWidth] = useState(width);\n const [isResize, setIsResize] = useState(false);\n const [sidebarMode, setSidebarMode] = useState(getSidebarMode(fly));\n\n const sidebarRef = useRef<HTMLDivElement>(null);\n\n const mergedRefs = mergeRefs([ref, sidebarRef]);\n\n // Update internal state when props change\n const previousWidth = usePrevious(width);\n if (previousWidth !== width) {\n setTreeWidth(width);\n }\n\n const [previousMode, setPreviousMode] = useState(fly);\n if (previousMode !== fly) {\n setSidebarMode(getSidebarMode(fly));\n setPreviousMode(fly);\n }\n\n const childrenArray = React.Children.toArray(children);\n\n // check for children type of TreeCategory and throw error in case\n invariant(childrenArray.every(isTreeCategory), 'AssetTree only excepts children of type \"TreeCategory\"');\n\n const classes = classNames(\n 'AssetTree',\n className,\n !isOpen && 'closed',\n bordered && 'border',\n sidebarMode === TreeMode.MODE_FLY ? 'fly' : 'fluid'\n );\n\n const resizeLimitClasses = classNames('AssetTreeResizeLimit', isResize && 'display-block');\n\n const resizeIndicatorPosition = maxWidth || window.innerWidth * 0.5;\n const resizeLimitStyle = { left: resizeIndicatorPosition };\n\n const firstChild = head(childrenArray);\n\n const category = currentCategoryId ? getCurrentCategoryElement(childrenArray, currentCategoryId) : firstChild;\n\n const style = {\n width: treeWidth,\n height,\n };\n\n const handleToggleTreeContent = () => onToggleTree(!isOpen);\n\n const handleSelectCategory = (selectedCategoryId: string) => {\n onCategoryChange(selectedCategoryId);\n\n if (!isOpen) {\n handleToggleTreeContent();\n } else if (isOpen && currentCategoryId === selectedCategoryId) {\n handleToggleTreeContent();\n }\n };\n\n const handleResize = (diff: number) => {\n const halfWindowWidth = window.innerWidth * 0.5;\n const usedMaxWidth = maxWidth || halfWindowWidth;\n\n // Check for sidebar width if it is half window size. If it was before but the sidebar was resized so it is\n // no longer half window size, set the sidebar width to half the window size to avoid jumping sidebar\n // to old width\n setTreeWidth(oldWidth => {\n const updatedWidth = oldWidth - diff;\n return getWidthInBoundaries(minWidth, usedMaxWidth, updatedWidth);\n });\n };\n\n const handleResizeStart = () => {\n const body = getSidebarBodyRef(sidebarRef);\n if (body) {\n body.classList.add('pointer-events-none');\n }\n setIsResize(true);\n };\n\n const handleResizeEnd = () => {\n const body = getSidebarBodyRef(sidebarRef);\n if (body) {\n body.classList.remove('pointer-events-none');\n }\n setIsResize(false);\n onResizeEnd();\n };\n\n return (\n <div {...remainingProps} className={classes} style={style} ref={mergedRefs}>\n <div className={resizeLimitClasses} style={resizeLimitStyle} />\n <div className='AssetTreeContent'>\n <TreeSidebar\n onSelectCategory={handleSelectCategory}\n currentCategoryId={currentCategoryId}\n onClick={handleToggleTreeContent}\n >\n {isArray(children) ? children : [children]}\n </TreeSidebar>\n <SmoothScrollbars slideIn className='AssetTreeBody'>\n {useOffscreen ? renderTreesOffscreen(childrenArray, currentCategoryId) : category}\n </SmoothScrollbars>\n </div>\n {resizable && isOpen && (\n <Resizer\n onResizeStart={handleResizeStart}\n onResize={handleResize}\n onResizeEnd={handleResizeEnd}\n direction={Resizer.HORIZONTAL}\n position={Resizer.RIGHT}\n />\n )}\n </div>\n );\n })\n);\n\nObject.assign(AssetTree, TreeMode);\n\nexport default AssetTree;\n"],"names":["DEFAULT_WIDTH","DEFAULT_MIN_WIDTH","DEFAULT_MAX_WIDTH","TreeMode","getSidebarBodyRef","sidebarRef","head","getCurrentCategoryElement","children","currentCategoryId","isArray","child","renderTreesOffscreen","categoryId","React","offscreenClasses","classNames","jsx","isTreeCategory","TreeCategory","AssetTree","memo","forwardRef","props","ref","className","resizable","width","minWidth","maxWidth","height","bordered","isOpen","useOffscreen","fly","onCategoryChange","noop","onToggleTree","onResizeEnd","remainingProps","getSidebarMode","isFly","treeWidth","setTreeWidth","useState","isResize","setIsResize","sidebarMode","setSidebarMode","useRef","mergedRefs","mergeRefs","usePrevious","previousMode","setPreviousMode","childrenArray","invariant","classes","resizeLimitClasses","resizeLimitStyle","firstChild","category","style","handleToggleTreeContent","handleSelectCategory","selectedCategoryId","handleResize","diff","halfWindowWidth","usedMaxWidth","oldWidth","updatedWidth","getWidthInBoundaries","handleResizeStart","body","handleResizeEnd","jsxs","TreeSidebar","SmoothScrollbars","Resizer"],"mappings":";;;;;;;;;;;;AAaA,MAAMA,KAAgB,KAChBC,KAAoB,KACpBC,KAAoB,GAEpBC,IAAW;AAAA,EACb,UAAU;AAAA,EACV,YAAY;AAChB,GAEMC,IAAoB,CAACC,MACvBC,EAAKD,GAAY,SAAS,uBAAuB,eAAe,CAAC,GAE/DE,KAA4B,CAACC,GAAgCC,MAC/DC,EAAQF,CAAQ,IAAIA,EAAS,KAAK,OAASG,KAASA,EAAM,MAAM,OAAOF,CAAiB,IAAID,GAE1FI,KAAuB,CAACJ,GAAgCK,MAC1DC,EAAM,SAAS,IAAIN,GAAU,CAAAG,MAAS;AAClC,QAAMI,IAAmBC;AAAA,IACrB;AAAA,IACAL,KAASA,EAAM,MAAM,OAAOE,KAAc;AAAA,EAAA;AAE9C,SAAO,gBAAAI,EAAC,OAAA,EAAI,WAAWF,GAAmB,UAAAJ,GAAM;AACpD,CAAC,GAwGCO,KAAiB,CAACP,MACpBG,EAAM,eAAeH,CAAK,KAAKA,EAAM,SAASQ,IAE5CC,KAAYC;AAAA,EACdC,GAA8D,CAACC,GAAOC,MAAQ;AAC1E,UAAM;AAAA,MACF,WAAAC;AAAA,MACA,WAAAC,IAAY;AAAA,MACZ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A,QAE7C,gBAAAS,EAAC6D,IAAA,EAAiB,SAAO,IAAC,WAAU,iBAC/B,UAAA7C,IAAerB,GAAqB2C,GAAe9C,CAAiB,IAAIoD,EAAA,CAC7E;AAAA,MAAA,GACJ;AAAA,MACCnC,KAAaM,KACV,gBAAAf;AAAA,QAAC8D;AAAA,QAAA;AAAA,UACG,eAAeN;AAAA,UACf,UAAUP;AAAA,UACV,aAAaS;AAAA,UACb,WAAWI,EAAQ;AAAA,UACnB,UAAUA,EAAQ;AAAA,QAAA;AAAA,MAAA;AAAA,IACtB,GAER;AAAA,EAER,CAAC;AACL;AAEA,OAAO,OAAO3D,IAAWjB,CAAQ;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import e from "react";
|
|
3
|
-
const
|
|
3
|
+
const n = e.memo(() => /* @__PURE__ */ t(
|
|
4
4
|
"div",
|
|
5
5
|
{
|
|
6
6
|
className: `TreeTreeNothingFound display-flex justify-content-center text-size-20
|
|
@@ -9,6 +9,6 @@ const r = e.memo(() => /* @__PURE__ */ t(
|
|
|
9
9
|
}
|
|
10
10
|
));
|
|
11
11
|
export {
|
|
12
|
-
|
|
12
|
+
n as default
|
|
13
13
|
};
|
|
14
14
|
//# sourceMappingURL=TreeNothingFound.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNothingFound.js","sources":["../../../src/components/assetTree/TreeNothingFound.tsx"],"sourcesContent":["import React from 'react';\n\nconst TreeNothingFound = React.memo(() =>
|
|
1
|
+
{"version":3,"file":"TreeNothingFound.js","sources":["../../../src/components/assetTree/TreeNothingFound.tsx"],"sourcesContent":["import React from 'react';\n\nconst TreeNothingFound = React.memo(() => (\n <div\n className={`TreeTreeNothingFound display-flex justify-content-center text-size-20\n padding-top-25 margin-top-25 margin-bottom-25`}\n >\n <span className='rioglyph rioglyph-looking-glass-man text-size-400pct text-color-light' />\n </div>\n));\n\nexport default TreeNothingFound;\n"],"names":["TreeNothingFound","React","jsx"],"mappings":";;AAEA,MAAMA,IAAmBC,EAAM,KAAK,MAChC,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,WAAW;AAAA;AAAA,IAGX,UAAA,gBAAAA,EAAC,QAAA,EAAK,WAAU,wEAAA,CAAwE;AAAA,EAAA;AAC5F,CACH;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeUtils.js","sources":["../../../src/components/assetTree/treeUtils.ts"],"sourcesContent":["import { countBy, debounce, filter, isEmpty, isObject, mapValues, negate } from 'es-toolkit/compat';\nimport { isEqual } from 'es-toolkit/predicate';\nimport { orderBy } from 'es-toolkit/array';\n\nimport { searchNormalized } from '../../utils/searchNormalized';\nimport type { TreeItem, TreeGroup, TreeItemName, GroupedItems, GroupedItem } from './Tree';\n\nconst SEARCH_DEBOUNCE = 100;\n\nexport const notEqual = negate(isEqual);\nexport const notEmpty = negate(isEmpty);\n\nexport const filterOutByItemId = (list: string[]) => (item: TreeItem | TreeGroup) => !list.includes(item.id);\n\nexport const containsItemById = (list: string[]) => (item: TreeGroup) => list.includes(item.id);\n\nexport const getListIds = (list: TreeItem[] | TreeGroup[]) => list.map(listItem => listItem.id);\n\nexport const getTypeCounts = (items: TreeItem[]) => countBy(items, item => item.type);\nexport const getSubTypeCounts = (items: TreeItem[]) => countBy(items, item => item.subType);\n\n// biome-ignore lint/suspicious/noExplicitAny: we don't know the type\nexport const debounceFn = <T extends (...args: any[]) => any>(fn: T) => debounce(fn, SEARCH_DEBOUNCE);\n\nconst isNameObject = (item: TreeItem) => isObject(item.name);\n\nexport const getFullName = (item: TreeItem) =>\n `${(item.name as TreeItemName).firstName} ${(item.name as TreeItemName).lastName}`;\n\nconst getName = (item: TreeItem) => (isNameObject(item) ? getFullName(item) : (item.name as string));\n\nconst orderTreeItemsByName = (items: TreeItem[]) =>\n orderBy(\n items,\n [\n (item: TreeItem) =>\n isNameObject(item)\n ? (item.name as TreeItemName).lastName.toLowerCase()\n : ((item.name as string)?.toLowerCase() ?? ''),\n ],\n ['asc']\n ) as TreeItem[];\n\nconst orderGroupedItemsByName = (groups: GroupedItems) => {\n const groupArray = Object.values(groups);\n const sortedArray = orderBy(\n groupArray,\n [\n (group: GroupedItem) =>\n (typeof group.name === 'string' ? group.name.toLowerCase() : String(group.name)) ?? '',\n ],\n ['asc']\n ) as GroupedItem[];\n const sortedGroups: GroupedItems = {};\n for (const group of sortedArray) {\n sortedGroups[group.id] = group;\n }\n return sortedGroups;\n};\n\n// TODO: extend to use provided external search function instead?\nconst filterByName =\n (searchValue: string) =>\n (item: TreeItem): boolean => {\n if (searchValue) {\n return searchNormalized(getName(item), searchValue);\n }\n return true;\n };\n\nexport const getFlatItems = (items: TreeItem[], searchValue: string): TreeItem[] =>\n filter(orderTreeItemsByName(items), filterByName(searchValue));\n\nexport const filterEmptyGroups = (groups: GroupedItems): GroupedItems => {\n const result: GroupedItems = {};\n Object.values(groups).forEach(group => {\n if (notEmpty(group.items)) {\n result[group.id] = group;\n }\n });\n return result;\n};\n\nexport const filterAssetByType = (items: TreeItem[], types: string[] = []) =>\n filter(items, (asset: TreeItem) => types.includes(asset.type));\n\nexport const excludeFromList = <T>(list: T[], itemId: T): T[] => list.filter(item => item !== itemId);\n\nexport const sortGroupsByName = (groups: GroupedItems) => {\n const fixedGroups: GroupedItems = {};\n const sortableGroups: GroupedItems = {};\n\n mapValues(groups, (group: GroupedItem) => {\n if (group.position === 'last') {\n fixedGroups[group.id] = { ...group };\n } else {\n sortableGroups[group.id] = { ...group };\n }\n });\n\n const sortedGroups = orderGroupedItemsByName(sortableGroups);\n\n return isEmpty(fixedGroups) ? sortedGroups : { ...sortedGroups, ...fixedGroups };\n};\n\nexport const sortGroupItemsByName = (groups: GroupedItems): GroupedItems
|
|
1
|
+
{"version":3,"file":"treeUtils.js","sources":["../../../src/components/assetTree/treeUtils.ts"],"sourcesContent":["import { countBy, debounce, filter, isEmpty, isObject, mapValues, negate } from 'es-toolkit/compat';\nimport { isEqual } from 'es-toolkit/predicate';\nimport { orderBy } from 'es-toolkit/array';\n\nimport { searchNormalized } from '../../utils/searchNormalized';\nimport type { TreeItem, TreeGroup, TreeItemName, GroupedItems, GroupedItem } from './Tree';\n\nconst SEARCH_DEBOUNCE = 100;\n\nexport const notEqual = negate(isEqual);\nexport const notEmpty = negate(isEmpty);\n\nexport const filterOutByItemId = (list: string[]) => (item: TreeItem | TreeGroup) => !list.includes(item.id);\n\nexport const containsItemById = (list: string[]) => (item: TreeGroup) => list.includes(item.id);\n\nexport const getListIds = (list: TreeItem[] | TreeGroup[]) => list.map(listItem => listItem.id);\n\nexport const getTypeCounts = (items: TreeItem[]) => countBy(items, item => item.type);\nexport const getSubTypeCounts = (items: TreeItem[]) => countBy(items, item => item.subType);\n\n// biome-ignore lint/suspicious/noExplicitAny: we don't know the type\nexport const debounceFn = <T extends (...args: any[]) => any>(fn: T) => debounce(fn, SEARCH_DEBOUNCE);\n\nconst isNameObject = (item: TreeItem) => isObject(item.name);\n\nexport const getFullName = (item: TreeItem) =>\n `${(item.name as TreeItemName).firstName} ${(item.name as TreeItemName).lastName}`;\n\nconst getName = (item: TreeItem) => (isNameObject(item) ? getFullName(item) : (item.name as string));\n\nconst orderTreeItemsByName = (items: TreeItem[]) =>\n orderBy(\n items,\n [\n (item: TreeItem) =>\n isNameObject(item)\n ? (item.name as TreeItemName).lastName.toLowerCase()\n : ((item.name as string)?.toLowerCase() ?? ''),\n ],\n ['asc']\n ) as TreeItem[];\n\nconst orderGroupedItemsByName = (groups: GroupedItems) => {\n const groupArray = Object.values(groups);\n const sortedArray = orderBy(\n groupArray,\n [\n (group: GroupedItem) =>\n (typeof group.name === 'string' ? group.name.toLowerCase() : String(group.name)) ?? '',\n ],\n ['asc']\n ) as GroupedItem[];\n const sortedGroups: GroupedItems = {};\n for (const group of sortedArray) {\n sortedGroups[group.id] = group;\n }\n return sortedGroups;\n};\n\n// TODO: extend to use provided external search function instead?\nconst filterByName =\n (searchValue: string) =>\n (item: TreeItem): boolean => {\n if (searchValue) {\n return searchNormalized(getName(item), searchValue);\n }\n return true;\n };\n\nexport const getFlatItems = (items: TreeItem[], searchValue: string): TreeItem[] =>\n filter(orderTreeItemsByName(items), filterByName(searchValue));\n\nexport const filterEmptyGroups = (groups: GroupedItems): GroupedItems => {\n const result: GroupedItems = {};\n Object.values(groups).forEach(group => {\n if (notEmpty(group.items)) {\n result[group.id] = group;\n }\n });\n return result;\n};\n\nexport const filterAssetByType = (items: TreeItem[], types: string[] = []) =>\n filter(items, (asset: TreeItem) => types.includes(asset.type));\n\nexport const excludeFromList = <T>(list: T[], itemId: T): T[] => list.filter(item => item !== itemId);\n\nexport const sortGroupsByName = (groups: GroupedItems) => {\n const fixedGroups: GroupedItems = {};\n const sortableGroups: GroupedItems = {};\n\n mapValues(groups, (group: GroupedItem) => {\n if (group.position === 'last') {\n fixedGroups[group.id] = { ...group };\n } else {\n sortableGroups[group.id] = { ...group };\n }\n });\n\n const sortedGroups = orderGroupedItemsByName(sortableGroups);\n\n return isEmpty(fixedGroups) ? sortedGroups : { ...sortedGroups, ...fixedGroups };\n};\n\nexport const sortGroupItemsByName = (groups: GroupedItems): GroupedItems =>\n mapValues(groups, (group: GroupedItem) => ({\n ...group,\n items: orderTreeItemsByName(group.items) as TreeItem[],\n }));\n\nexport const getMappedItemsToGroups = (groups: TreeGroup[], items: TreeItem[]): GroupedItems => {\n const mappedGroups: GroupedItems = {};\n\n // build an object for listing the groups by id\n groups.forEach(group => {\n mappedGroups[group.id] = {\n ...group,\n items: [],\n };\n });\n\n items.forEach(item => {\n // add items to the respective group\n const groupIds = item.groupIds || [];\n groupIds.forEach(groupId => {\n const mappedGroup = mappedGroups[groupId];\n if (mappedGroup) {\n mappedGroup.items.push(item);\n }\n });\n });\n\n return mappedGroups;\n};\n\nexport const addOrRemoveFromList = <T>(list: T[], item: T): T[] => {\n const listSet = new Set(list);\n if (listSet.has(item)) {\n listSet.delete(item);\n } else {\n listSet.add(item);\n }\n return [...listSet];\n};\n\n// Add prefix `rioglyph-` if icon is given and does not start with the prefix\nexport const withRioglyphPrefix = (name?: string | null): string | null => {\n if (!name) {\n return null;\n }\n return name.startsWith('rioglyph-') ? name : `rioglyph-${name}`;\n};\n"],"names":["SEARCH_DEBOUNCE","notEqual","negate","isEqual","notEmpty","isEmpty","filterOutByItemId","list","item","containsItemById","getListIds","listItem","getTypeCounts","items","countBy","getSubTypeCounts","debounceFn","fn","debounce","isNameObject","isObject","getFullName","getName","orderTreeItemsByName","orderBy","orderGroupedItemsByName","groups","groupArray","sortedArray","group","sortedGroups","filterByName","searchValue","searchNormalized","getFlatItems","filter","filterEmptyGroups","result","filterAssetByType","types","asset","excludeFromList","itemId","sortGroupsByName","fixedGroups","sortableGroups","mapValues","sortGroupItemsByName","getMappedItemsToGroups","mappedGroups","groupId","mappedGroup","addOrRemoveFromList","listSet","withRioglyphPrefix","name"],"mappings":";;;;AAOA,MAAMA,IAAkB,KAEXC,IAAWC,EAAOC,CAAO,GACzBC,IAAWF,EAAOG,CAAO,GAEzBC,IAAoB,CAACC,MAAmB,CAACC,MAA+B,CAACD,EAAK,SAASC,EAAK,EAAE,GAE9FC,IAAmB,CAACF,MAAmB,CAACC,MAAoBD,EAAK,SAASC,EAAK,EAAE,GAEjFE,IAAa,CAACH,MAAmCA,EAAK,IAAI,CAAAI,MAAYA,EAAS,EAAE,GAEjFC,IAAgB,CAACC,MAAsBC,EAAQD,GAAO,CAAAL,MAAQA,EAAK,IAAI,GACvEO,IAAmB,CAACF,MAAsBC,EAAQD,GAAO,CAAAL,MAAQA,EAAK,OAAO,GAG7EQ,IAAa,CAAoCC,MAAUC,EAASD,GAAIjB,CAAe,GAE9FmB,IAAe,CAACX,MAAmBY,EAASZ,EAAK,IAAI,GAE9Ca,IAAc,CAACb,MACxB,GAAIA,EAAK,KAAsB,SAAS,IAAKA,EAAK,KAAsB,QAAQ,IAE9Ec,IAAU,CAACd,MAAoBW,EAAaX,CA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{
|
|
|
49
49
|
noItemMessage: w,
|
|
50
50
|
dropdownClassName: Z = "",
|
|
51
51
|
className: ee = "",
|
|
52
|
-
...
|
|
53
|
-
} = U, [l, N] = h(!1), [p, v] = h(r.value || ""), [u, m] = h(-1), [V, k] = h(B),
|
|
52
|
+
...oe
|
|
53
|
+
} = U, [l, N] = h(!1), [p, v] = h(r.value || ""), [u, m] = h(-1), [V, k] = h(B), ne = ve(() => P()), g = E(null), C = E(null), O = E([]), D = r.value;
|
|
54
54
|
!fe(D) && p !== D && v(D ?? ""), F(() => S({ value: p }), []), F(() => {
|
|
55
55
|
const e = se();
|
|
56
56
|
Se(V, g.current, e);
|
|
@@ -67,14 +67,14 @@ const Ue = (U) => {
|
|
|
67
67
|
}, re = (e) => {
|
|
68
68
|
switch (e.key) {
|
|
69
69
|
case "ArrowDown": {
|
|
70
|
-
const
|
|
71
|
-
l && t.length >
|
|
70
|
+
const o = u + 1;
|
|
71
|
+
l && t.length > o && (m(o), f(Number(o)), k(B));
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
74
|
case "ArrowUp":
|
|
75
75
|
if (l && u > 0) {
|
|
76
|
-
const
|
|
77
|
-
m(
|
|
76
|
+
const o = u - 1;
|
|
77
|
+
m(o), f(Number(o)), k(Ie);
|
|
78
78
|
}
|
|
79
79
|
return;
|
|
80
80
|
case "Enter":
|
|
@@ -85,26 +85,26 @@ const Ue = (U) => {
|
|
|
85
85
|
P();
|
|
86
86
|
break;
|
|
87
87
|
}
|
|
88
|
-
}, se = () => [...O.current].find((e) => e.className.includes("active")), le = (e,
|
|
89
|
-
p !== e && K(e,
|
|
90
|
-
}, K = (e,
|
|
91
|
-
N(l ?
|
|
88
|
+
}, se = () => [...O.current].find((e) => e.className.includes("active")), le = (e, o) => {
|
|
89
|
+
p !== e && K(e, o);
|
|
90
|
+
}, K = (e, o, n = !1) => {
|
|
91
|
+
N(l ? n ? !1 : l : !0), v(e), m(-1), S({ value: e }), f(-1);
|
|
92
92
|
const { value: i, onChange: c = () => {
|
|
93
93
|
} } = r;
|
|
94
|
-
e !== i && c(
|
|
94
|
+
e !== i && c(o, { newValue: e });
|
|
95
95
|
}, f = (e) => {
|
|
96
|
-
const
|
|
97
|
-
L(
|
|
96
|
+
const o = e === -1 ? null : t[e];
|
|
97
|
+
L(o);
|
|
98
98
|
}, ue = (e) => {
|
|
99
99
|
v(""), m(-1), C.current && C.current.focus(), S({ value: "" }), f(-1), r.onClear && r.onClear();
|
|
100
|
-
}, ae = (e) => e.label ?? e[b ?? ""] ?? "", T = (e,
|
|
101
|
-
const s = (x || ae)(
|
|
100
|
+
}, ae = (e) => e.label ?? e[b ?? ""] ?? "", T = (e, o) => {
|
|
101
|
+
const s = (x || ae)(o);
|
|
102
102
|
K(s, e, Q), q(e, {
|
|
103
|
-
suggestion:
|
|
103
|
+
suggestion: o,
|
|
104
104
|
suggestionValue: s
|
|
105
105
|
});
|
|
106
106
|
}, ie = () => {
|
|
107
|
-
const { id: e, icon:
|
|
107
|
+
const { id: e, icon: o, value: n, ...s } = r, i = { id: M ?? e, ...s }, c = /* @__PURE__ */ d(
|
|
108
108
|
he,
|
|
109
109
|
{
|
|
110
110
|
...i,
|
|
@@ -117,10 +117,10 @@ const Ue = (U) => {
|
|
|
117
117
|
value: X ? p : ""
|
|
118
118
|
}
|
|
119
119
|
);
|
|
120
|
-
return
|
|
120
|
+
return o || A || R ? /* @__PURE__ */ d(
|
|
121
121
|
Ce,
|
|
122
122
|
{
|
|
123
|
-
icon:
|
|
123
|
+
icon: o,
|
|
124
124
|
leadingInputAddons: A,
|
|
125
125
|
trailingInputAddons: R,
|
|
126
126
|
children: c
|
|
@@ -134,25 +134,25 @@ const Ue = (U) => {
|
|
|
134
134
|
);
|
|
135
135
|
if (G)
|
|
136
136
|
return /* @__PURE__ */ d(De, { className: e });
|
|
137
|
-
const
|
|
138
|
-
return
|
|
139
|
-
|
|
140
|
-
t.map((
|
|
141
|
-
if (I && !
|
|
137
|
+
const o = ge(t);
|
|
138
|
+
return o && !w ? null : /* @__PURE__ */ _("ul", { role: "menu", className: e, ref: g, children: [
|
|
139
|
+
o && w && /* @__PURE__ */ d(ye, { message: w }, "NoItemMessage"),
|
|
140
|
+
t.map((n, s) => {
|
|
141
|
+
if (I && !n.label && !b)
|
|
142
142
|
throw new Error(
|
|
143
143
|
'The "customSuggestionKey" need to be set when using a custom renderer and not using the "label" prop for suggestions'
|
|
144
144
|
);
|
|
145
|
-
const i = `index-${
|
|
146
|
-
if (
|
|
147
|
-
return /* @__PURE__ */ d(we, { label:
|
|
145
|
+
const i = `index-${n.label ?? n[b ?? ""]}`;
|
|
146
|
+
if (n.header && n.label)
|
|
147
|
+
return /* @__PURE__ */ d(we, { label: n.label }, i);
|
|
148
148
|
const c = I || ce;
|
|
149
149
|
return /* @__PURE__ */ d(
|
|
150
150
|
Ne,
|
|
151
151
|
{
|
|
152
152
|
active: s === u,
|
|
153
|
-
disabled:
|
|
154
|
-
value:
|
|
155
|
-
onSelect: (Ee, me) => T(me,
|
|
153
|
+
disabled: n.disabled,
|
|
154
|
+
value: n.customSuggestion ? n.customSuggestion : c(n),
|
|
155
|
+
onSelect: (Ee, me) => T(me, n),
|
|
156
156
|
index: s
|
|
157
157
|
},
|
|
158
158
|
i
|
|
@@ -166,7 +166,7 @@ const Ue = (U) => {
|
|
|
166
166
|
H.dropup && "dropup",
|
|
167
167
|
ee
|
|
168
168
|
);
|
|
169
|
-
return /* @__PURE__ */ _("div", { ...
|
|
169
|
+
return /* @__PURE__ */ _("div", { ...oe, className: pe, onKeyDown: re, ref: ne, children: [
|
|
170
170
|
ie(),
|
|
171
171
|
de()
|
|
172
172
|
] });
|
|
@@ -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;AAAA,IACd,mBAAAC,IAAoB;AAAA,IACpB,WAAAC,IAAY;AAAA,IACZ,QAAAC,IAAS;AAAA,IACT,WAAAC,IAAY;AAAA,IACZ,aAAAC,IAAc;AAAA,IACd,eAAAC,IAAgB;AAAA,IAChB,0BAAAC,IAA2B;AAAA,IAC3B,cAAAC,IAAe;AAAA,IACf,YAAAC,IAAa;AAAA,MACT,IAAAjB;AAAA,MACA,UAAU;AAAA,MACV,UAAUE;AAAA,MACV,SAASA;AAAA,MACT,QAAQA;AAAA,MACR,SAASA;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,MACV,UAAU;AAAA,MACV,OAAO;AAAA,MACP,MAAM;AAAA,IAAA;AAAA,IAEV,oBAAAgB;AAAA,IACA,qBAAAC;AAAA,IACA,eAAAC;AAAA,IACA,mBAAAC,IAAoB;AAAA,IACpB,WAAAC,KAAY;AAAA,IACZ,GAAGC;AAAA,EAAA,IACHxB,GAEE,CAACyB,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpC,CAACC,GAAOC,CAAQ,IAAIF,EAAST,EAAW,SAAS,EAAE,GACnD,CAACY,GAAsBC,CAAuB,IAAIJ,EAAS,EAAE,GAC7D,CAACK,GAAWC,CAAY,IAAIN,EAASO,CAAI,GAEzCC,KAAeC,GAAgB,MAAMC,GAAW,GAChDC,IAAkBC,EAAyB,IAAI,GAC/CC,IAAWD,EA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SAASrE,KAAzB,eAAwC;AAAA,MAChGZ,EAAY,IAAI,CAAC8D,GAAYoB,MAAU;AAEpC,YAAIrF,KAAoB,CAACiE,EAAW,SAAS,CAAChE;AAC1C,gBAAM,IAAI;AAAA,YACN;AAAA,UAAA;AAKR,cAAMqF,IAAM,SAASrB,EAAW,SAASA,EAAWhE,KAAuB,EAAE,CAAC;AAE9E,YAAIgE,EAAW,UAAUA,EAAW;AAChC,iBAAO,gBAAAS,EAACa,IAAA,EAAyB,OAAQtB,EAAqC,SAAlDqB,CAAyD;AAGzF,cAAME,IAAiBxF,KAAsC6E;AAE7D,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","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,YAAIrF,KAAoB,CAACiE,EAAW,SAAS,CAAChE;AAC1C,gBAAM,IAAI;AAAA,YACN;AAAA,UAAA;AAKR,cAAMqF,IAAM,SAASrB,EAAW,SAASA,EAAWhE,KAAuB,EAAE,CAAC;AAE9E,YAAIgE,EAAW,UAAUA,EAAW;AAChC,iBAAO,gBAAAS,EAACa,IAAA,EAAyB,OAAQtB,EAAqC,SAAlDqB,CAAyD;AAGzF,cAAME,IAAiBxF,KAAsC6E;AAE7D,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,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;"}
|