@12-apps/ui 1.0.0 → 1.3.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/components-catalog.md +14 -0
- package/package.json +42 -27
- package/src/__tests__/data-grid.test.tsx +125 -0
- package/src/__tests__/package-wiring.test.ts +12 -8
- package/src/__tests__/social-login-button.test.tsx +5 -5
- package/src/__tests__/viewport.test.ts +50 -0
- package/src/charts/index.ts +8 -0
- package/src/components/data-display/Alert/Alert.md +1 -1
- package/src/components/data-display/Alert/Alert.stories.tsx +5 -7
- package/src/components/data-display/Alert/Alert.styles.tsx +255 -0
- package/src/components/data-display/Alert/Alert.test.stories.tsx +11 -13
- package/src/components/data-display/Alert/Alert.tsx +135 -328
- package/src/components/data-display/AlertDialog/AlertDialog.stories.tsx +3 -1
- package/src/components/data-display/AlertDialog/AlertDialog.tsx +191 -78
- package/src/components/data-display/AlertDialog/AlertDialog.types.ts +8 -1
- package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.test.stories.tsx +5 -5
- package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.tsx +44 -35
- package/src/components/data-display/Avatar/Avatar.stories.tsx +4 -1
- package/src/components/data-display/Avatar/Avatar.test.stories.tsx +5 -3
- package/src/components/data-display/Avatar/Avatar.tsx +154 -450
- package/src/components/data-display/Avatar/Avatar.view.tsx +396 -0
- package/src/components/data-display/Badge/Badge.animations.ts +67 -0
- package/src/components/data-display/Badge/Badge.helpers.ts +74 -0
- package/src/components/data-display/Badge/Badge.stories.tsx +14 -16
- package/src/components/data-display/Badge/Badge.styles.ts +261 -0
- package/src/components/data-display/Badge/Badge.test.stories.tsx +32 -31
- package/src/components/data-display/Badge/Badge.tsx +151 -557
- package/src/components/data-display/Badge/Badge.variants.ts +106 -0
- package/src/components/data-display/Badge/BadgeContent.tsx +107 -0
- package/src/components/data-display/Banner/Banner.stories.tsx +5 -1
- package/src/components/data-display/Banner/Banner.styles.ts +120 -0
- package/src/components/data-display/Banner/Banner.tsx +179 -224
- package/src/components/data-display/Chart/Chart.md +48 -1
- package/src/components/data-display/Chart/Chart.tsx +82 -500
- package/src/components/data-display/Chart/Chart.types.ts +2 -0
- package/src/components/data-display/Chart/ChartComposables.tsx +121 -0
- package/src/components/data-display/Chart/ChartSpec.types.ts +70 -0
- package/src/components/data-display/Chart/SpecChart.stories.tsx +150 -0
- package/src/components/data-display/Chart/SpecChart.test.stories.tsx +56 -0
- package/src/components/data-display/Chart/SpecChart.tsx +53 -0
- package/src/components/data-display/Chart/__tests__/SpecChart.test.tsx +60 -0
- package/src/components/data-display/Chart/__tests__/chart-format.test.ts +43 -0
- package/src/components/data-display/Chart/__tests__/chart-spec.test.ts +119 -0
- package/src/components/data-display/Chart/chart-format.ts +26 -0
- package/src/components/data-display/Chart/chart-internals.ts +148 -0
- package/src/components/data-display/Chart/chart-renderers.tsx +338 -0
- package/src/components/data-display/Chart/chart-spec-registry.ts +74 -0
- package/src/components/data-display/Chart/chart-spec.ts +171 -0
- package/src/components/data-display/Chart/index.ts +30 -0
- package/src/components/data-display/Chip/Chip.helpers.tsx +131 -0
- package/src/components/data-display/Chip/Chip.stories.tsx +2 -1
- package/src/components/data-display/Chip/Chip.test.stories.tsx +11 -8
- package/src/components/data-display/Chip/Chip.tsx +31 -94
- package/src/components/data-display/DataGrid/DataGrid.body.tsx +141 -0
- package/src/components/data-display/DataGrid/DataGrid.cells.tsx +238 -0
- package/src/components/data-display/DataGrid/DataGrid.model.ts +315 -0
- package/src/components/data-display/DataGrid/DataGrid.rows.ts +112 -0
- package/src/components/data-display/DataGrid/DataGrid.states.tsx +102 -0
- package/src/components/data-display/DataGrid/DataGrid.test.stories.tsx +6 -12
- package/src/components/data-display/DataGrid/DataGrid.tsx +129 -725
- package/src/components/data-display/DataViews/DataViewsGrid.tsx +187 -0
- package/src/components/data-display/DataViews/DataViewsTableBase.tsx +400 -0
- package/src/components/data-display/DataViews/ManageViewsDialog.tsx +140 -0
- package/src/components/data-display/DataViews/SaveViewModal.tsx +289 -0
- package/src/components/data-display/DataViews/__tests__/DataViewsGrid.test.tsx +271 -0
- package/src/components/data-display/DataViews/__tests__/DataViewsTableBase.test.tsx +134 -0
- package/src/components/data-display/DataViews/__tests__/SaveViewModal.test.tsx +83 -0
- package/src/components/data-display/DataViews/__tests__/data-views-filter.test.ts +115 -0
- package/src/components/data-display/DataViews/__tests__/data-views-preview.test.ts +53 -0
- package/src/components/data-display/DataViews/__tests__/range-pill.test.tsx +114 -0
- package/src/components/data-display/DataViews/base-card.stories.tsx +136 -0
- package/src/components/data-display/DataViews/base-card.tsx +278 -0
- package/src/components/data-display/DataViews/data-views-filter-panel.tsx +184 -0
- package/src/components/data-display/DataViews/data-views-filter.ts +138 -0
- package/src/components/data-display/DataViews/data-views-grid-helpers.tsx +248 -0
- package/src/components/data-display/DataViews/data-views-grid-parts.tsx +400 -0
- package/src/components/data-display/DataViews/data-views-inline-bar.tsx +257 -0
- package/src/components/data-display/DataViews/data-views-layout-context.tsx +176 -0
- package/src/components/data-display/DataViews/data-views-pagination.tsx +31 -0
- package/src/components/data-display/DataViews/data-views-preview.ts +53 -0
- package/src/components/data-display/DataViews/data-views-range-pill.tsx +277 -0
- package/src/components/data-display/DataViews/data-views-table-parts.tsx +150 -0
- package/src/components/data-display/DataViews/data-views-toolbar.tsx +149 -0
- package/src/components/data-display/DataViews/data-views-types.ts +312 -0
- package/src/components/data-display/DataViews/data-views-view-mutations.ts +68 -0
- package/src/components/data-display/DataViews/index.ts +33 -0
- package/src/components/data-display/DataViews/use-data-views-state.ts +349 -0
- package/src/components/data-display/DateTimeDisplay/DateTimeDisplay.hooks.ts +104 -0
- package/src/components/data-display/DateTimeDisplay/DateTimeDisplay.tsx +68 -118
- package/src/components/data-display/DescriptionItem/DescriptionItem.stories.tsx +1 -1
- package/src/components/data-display/DescriptionItem/DescriptionItem.tsx +52 -34
- package/src/components/data-display/EmptyState/EmptyState.test.stories.tsx +6 -6
- package/src/components/data-display/EmptyState/EmptyState.tsx +218 -135
- package/src/components/data-display/ErrorState/ErrorState.test.stories.tsx +2 -2
- package/src/components/data-display/ErrorState/ErrorState.tsx +83 -55
- package/src/components/data-display/HoverCard/HoverCard.stories.tsx +3 -1
- package/src/components/data-display/HoverCard/HoverCard.test.stories.tsx +5 -5
- package/src/components/data-display/InteractiveTooltip/InteractiveTooltip.hooks.ts +99 -0
- package/src/components/data-display/InteractiveTooltip/InteractiveTooltip.styles.ts +87 -0
- package/src/components/data-display/InteractiveTooltip/InteractiveTooltip.tsx +28 -155
- package/src/components/data-display/LazyImage/LazyImage.hooks.ts +203 -0
- package/src/components/data-display/LazyImage/LazyImage.md +1 -1
- package/src/components/data-display/LazyImage/LazyImage.stories.tsx +3 -3
- package/src/components/data-display/LazyImage/LazyImage.tsx +144 -243
- package/src/components/data-display/Lightbox/Lightbox.constants.ts +53 -0
- package/src/components/data-display/Lightbox/Lightbox.helpers.ts +39 -0
- package/src/components/data-display/Lightbox/Lightbox.hooks.ts +259 -0
- package/src/components/data-display/Lightbox/Lightbox.test.stories.tsx +28 -35
- package/src/components/data-display/Lightbox/Lightbox.tsx +98 -658
- package/src/components/data-display/Lightbox/LightboxControls.tsx +152 -0
- package/src/components/data-display/Lightbox/LightboxCurrentMedia.tsx +50 -0
- package/src/components/data-display/Lightbox/LightboxMedia.tsx +76 -0
- package/src/components/data-display/Lightbox/LightboxOverlay.tsx +83 -0
- package/src/components/data-display/Lightbox/LightboxStage.tsx +97 -0
- package/src/components/data-display/Lightbox/LightboxThumbnails.tsx +83 -0
- package/src/components/data-display/Lightbox/useLightbox.ts +80 -0
- package/src/components/data-display/LoadingState/LoadingState.helpers.ts +52 -0
- package/src/components/data-display/LoadingState/LoadingState.tsx +117 -87
- package/src/components/data-display/MapPreview/MapControlBar.tsx +116 -0
- package/src/components/data-display/MapPreview/MapDecorations.tsx +155 -0
- package/src/components/data-display/MapPreview/MapLayers.tsx +70 -0
- package/src/components/data-display/MapPreview/MapMarkers.tsx +84 -0
- package/src/components/data-display/MapPreview/MapOverlays.tsx +68 -0
- package/src/components/data-display/MapPreview/MapPreview.constants.ts +19 -0
- package/src/components/data-display/MapPreview/MapPreview.helpers.ts +63 -0
- package/src/components/data-display/MapPreview/MapPreview.hooks.ts +265 -0
- package/src/components/data-display/MapPreview/MapPreview.test.stories.tsx +14 -10
- package/src/components/data-display/MapPreview/MapPreview.tsx +52 -882
- package/src/components/data-display/MapPreview/MapPreview.types.ts +8 -1
- package/src/components/data-display/MapPreview/MapSearchBar.tsx +64 -0
- package/src/components/data-display/MapPreview/MapTiles.tsx +70 -0
- package/src/components/data-display/MapPreview/StaticMapView.tsx +63 -0
- package/src/components/data-display/MapPreview/mapProjection.ts +52 -0
- package/src/components/data-display/MapPreview/mapSurface.ts +37 -0
- package/src/components/data-display/MapPreview/useMapPreview.ts +62 -0
- package/src/components/data-display/Popover/Popover.test.stories.tsx +13 -19
- package/src/components/data-display/Progress/Progress.helpers.ts +37 -0
- package/src/components/data-display/Progress/Progress.styles.ts +101 -0
- package/src/components/data-display/Progress/Progress.tsx +185 -213
- package/src/components/data-display/SectionOnboarding/SectionOnboarding.stories.tsx +1 -1
- package/src/components/data-display/SectionOnboarding/SectionOnboarding.tsx +1 -1
- package/src/components/data-display/StatCard/StatCard.md +117 -0
- package/src/components/data-display/StatCard/StatCard.stories.tsx +167 -0
- package/src/components/data-display/StatCard/StatCard.test.stories.tsx +240 -0
- package/src/components/data-display/StatCard/StatCard.tsx +236 -0
- package/src/components/data-display/StatCard/StatCard.types.ts +62 -0
- package/src/components/data-display/StatCard/index.ts +7 -0
- package/src/components/data-display/Stepper/Stepper.test.stories.tsx +12 -19
- package/src/components/data-display/Stepper/Stepper.tsx +1 -1
- package/src/components/data-display/Table/Table.helpers.ts +31 -0
- package/src/components/data-display/Table/Table.hooks.ts +161 -0
- package/src/components/data-display/Table/Table.stories.tsx +3 -1
- package/src/components/data-display/Table/Table.styles.ts +223 -0
- package/src/components/data-display/Table/Table.test.stories.tsx +4 -4
- package/src/components/data-display/Table/Table.tsx +291 -748
- package/src/components/data-display/Table/TableParts.hooks.tsx +112 -0
- package/src/components/data-display/Table/TableParts.tsx +298 -0
- package/src/components/data-display/Table/TableStates.tsx +21 -0
- package/src/components/data-display/Timeline/Timeline.stories.tsx +10 -12
- package/src/components/data-display/Timeline/Timeline.test.stories.tsx +30 -44
- package/src/components/data-display/Timeline/Timeline.tsx +23 -284
- package/src/components/data-display/Timeline/TimelineRow.tsx +346 -0
- package/src/components/data-display/TimingDiagram/TimingDiagram.tsx +38 -311
- package/src/components/data-display/TimingDiagram/TimingDiagram.views.tsx +346 -0
- package/src/components/data-display/Tooltip/Tooltip.stories.tsx +4 -1
- package/src/components/data-display/Tooltip/Tooltip.test.stories.tsx +44 -58
- package/src/components/data-display/Tooltip/Tooltip.tsx +67 -62
- package/src/components/data-display/index.ts +1 -0
- package/src/components/feedback/ConfirmAction/ConfirmAction.hooks.ts +96 -0
- package/src/components/feedback/ConfirmAction/ConfirmAction.md +140 -0
- package/src/components/feedback/ConfirmAction/ConfirmAction.parts.tsx +154 -0
- package/src/components/feedback/ConfirmAction/ConfirmAction.stories.tsx +146 -0
- package/src/components/feedback/ConfirmAction/ConfirmAction.test.stories.tsx +114 -0
- package/src/components/feedback/ConfirmAction/ConfirmAction.tsx +46 -0
- package/src/components/feedback/ConfirmAction/ConfirmAction.types.ts +111 -0
- package/src/components/feedback/ConfirmAction/ConfirmButton.tsx +18 -0
- package/src/components/feedback/ConfirmAction/__tests__/confirm-action.test.tsx +288 -0
- package/src/components/feedback/ConfirmAction/index.ts +16 -0
- package/src/components/feedback/ConfirmAction/with-confirmation.tsx +112 -0
- package/src/components/feedback/Dialog/Dialog.styles.ts +4 -2
- package/src/components/feedback/Dialog/Dialog.tsx +26 -1
- package/src/components/feedback/Dialog/__tests__/dialog-content-spacing.test.tsx +66 -0
- package/src/components/feedback/Modal/Modal.md +1 -1
- package/src/components/feedback/Modal/Modal.stories.tsx +2 -2
- package/src/components/feedback/Sonner/Sonner.tsx +104 -288
- package/src/components/feedback/Sonner/Sonner.types.ts +7 -0
- package/src/components/feedback/Sonner/SonnerToast.tsx +216 -0
- package/src/components/feedback/StackedModal/StackedModal.hooks.ts +226 -0
- package/src/components/feedback/StackedModal/StackedModal.parts.tsx +311 -0
- package/src/components/feedback/StackedModal/StackedModal.stories.tsx +13 -15
- package/src/components/feedback/StackedModal/StackedModal.styles.ts +193 -0
- package/src/components/feedback/StackedModal/StackedModal.tsx +100 -619
- package/src/components/feedback/StackedModal/StackedModal.types.ts +17 -3
- package/src/components/feedback/StackedModal/__tests__/stacked-modal-viewport.test.tsx +104 -0
- package/src/components/feedback/StackedModal/modal-stack.tsx +119 -0
- package/src/components/feedback/Toast/Toast.tsx +92 -81
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.geometry.ts +65 -0
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.hooks.ts +185 -0
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.test.stories.tsx +2 -2
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.tsx +156 -414
- package/src/components/feedback/TutorialOverlay/TutorialStepBody.tsx +255 -0
- package/src/components/feedback/index.ts +1 -0
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.helpers.ts +58 -0
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.hooks.ts +93 -0
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.mapper.ts +57 -0
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.stories.tsx +4 -2
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.test.stories.tsx +20 -16
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.tsx +26 -829
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.types.ts +11 -0
- package/src/components/form/AddressAutocomplete/AddressAutocompleteField.tsx +86 -0
- package/src/components/form/AddressAutocomplete/AddressFallbackField.tsx +64 -0
- package/src/components/form/AddressAutocomplete/AddressInputField.tsx +80 -0
- package/src/components/form/AddressAutocomplete/AddressOption.tsx +83 -0
- package/src/components/form/AddressAutocomplete/AddressSuggestionsPaper.tsx +24 -0
- package/src/components/form/AddressAutocomplete/AddressTextField.tsx +43 -0
- package/src/components/form/AddressAutocomplete/mockPlaces.ts +208 -0
- package/src/components/form/AddressAutocomplete/useAddressPredictions.ts +136 -0
- package/src/components/form/AddressAutocomplete/useAddressSelection.ts +113 -0
- package/src/components/form/AddressAutocomplete/useCurrentLocation.ts +116 -0
- package/src/components/form/AddressAutocomplete/useGoogleMapsAPI.ts +75 -0
- package/src/components/form/Button/Button.helpers.ts +36 -0
- package/src/components/form/Button/Button.stories.tsx +4 -1
- package/src/components/form/Button/Button.styles.ts +225 -0
- package/src/components/form/Button/Button.test.stories.tsx +25 -21
- package/src/components/form/Button/Button.tsx +45 -252
- package/src/components/form/Calendar/Calendar.dates.ts +100 -0
- package/src/components/form/Calendar/Calendar.helpers.ts +32 -0
- package/src/components/form/Calendar/Calendar.hooks.ts +278 -0
- package/src/components/form/Calendar/Calendar.keyboard.ts +32 -0
- package/src/components/form/Calendar/Calendar.selection.ts +156 -0
- package/src/components/form/Calendar/Calendar.test.stories.tsx +33 -34
- package/src/components/form/Calendar/Calendar.tsx +63 -551
- package/src/components/form/Calendar/Calendar.types.ts +16 -0
- package/src/components/form/Calendar/CalendarDay.tsx +127 -0
- package/src/components/form/Calendar/CalendarDayCell.tsx +52 -0
- package/src/components/form/Calendar/CalendarMonth.tsx +128 -0
- package/src/components/form/CepField/CepField.md +138 -0
- package/src/components/form/CepField/CepField.stories.tsx +138 -0
- package/src/components/form/CepField/CepField.test.stories.tsx +281 -0
- package/src/components/form/CepField/CepField.tsx +211 -0
- package/src/components/form/CepField/CepField.types.ts +73 -0
- package/src/components/form/CepField/index.ts +2 -0
- package/src/components/form/Checkbox/Checkbox.helpers.ts +28 -0
- package/src/components/form/Checkbox/Checkbox.tsx +19 -16
- package/src/components/form/CodeEditor/CodeEditor.helpers.ts +45 -0
- package/src/components/form/CodeEditor/CodeEditor.hooks.ts +104 -0
- package/src/components/form/CodeEditor/CodeEditor.monaco.ts +109 -0
- package/src/components/form/CodeEditor/CodeEditor.test.stories.tsx +17 -18
- package/src/components/form/CodeEditor/CodeEditor.tsx +81 -330
- package/src/components/form/CodeEditor/CodeEditorToolbar.tsx +168 -0
- package/src/components/form/Command/Command.hooks.ts +207 -0
- package/src/components/form/Command/Command.parts.tsx +58 -0
- package/src/components/form/Command/Command.styles.ts +83 -0
- package/src/components/form/Command/Command.tsx +61 -270
- package/src/components/form/CreatableSelect/CreatableSelect.md +1 -1
- package/src/components/form/CreatableSelect/CreatableSelect.test.stories.tsx +1 -1
- package/src/components/form/CreatableSelect/CreatableSelect.tsx +152 -71
- package/src/components/form/CreatableSelect/CreatableSelect.types.ts +13 -0
- package/src/components/form/HeaderButton/HeaderButton.tsx +80 -0
- package/src/components/form/HeaderButton/index.ts +2 -0
- package/src/components/form/Input/Input.stories.tsx +5 -1
- package/src/components/form/Input/Input.styles.ts +176 -0
- package/src/components/form/Input/Input.test.stories.tsx +30 -23
- package/src/components/form/Input/Input.tsx +71 -211
- package/src/components/form/Input/Input.types.ts +11 -0
- package/src/components/form/InputOTP/InputOTP.test.stories.tsx +9 -17
- package/src/components/form/Menubar/Menubar.test.stories.tsx +4 -8
- package/src/components/form/PasswordStrength/PasswordStrength.helpers.tsx +117 -0
- package/src/components/form/PasswordStrength/PasswordStrength.test.stories.tsx +3 -3
- package/src/components/form/PasswordStrength/PasswordStrength.tsx +202 -255
- package/src/components/form/PhoneInput/PhoneInput.hooks.ts +134 -0
- package/src/components/form/PhoneInput/PhoneInput.test.stories.tsx +4 -4
- package/src/components/form/PhoneInput/PhoneInput.tsx +279 -292
- package/src/components/form/PhoneInput/countries.ts +54 -0
- package/src/components/form/PhoneInput/phone.ts +47 -0
- package/src/components/form/RadioGroup/RadioGroup.test.stories.tsx +9 -9
- package/src/components/form/RichTextEditor/RichTextEditor.dom.ts +124 -0
- package/src/components/form/RichTextEditor/RichTextEditor.format.ts +61 -0
- package/src/components/form/RichTextEditor/RichTextEditor.hooks.ts +142 -0
- package/src/components/form/RichTextEditor/RichTextEditor.test.stories.tsx +5 -12
- package/src/components/form/RichTextEditor/RichTextEditor.tsx +98 -410
- package/src/components/form/RichTextEditor/RichTextEditorToolbar.tsx +187 -0
- package/src/components/form/SearchPalette/SearchPalette.parts.tsx +22 -0
- package/src/components/form/SearchPalette/SearchPalette.tsx +13 -9
- package/src/components/form/Select/Select.test.stories.tsx +35 -27
- package/src/components/form/Slider/Slider.test.stories.tsx +9 -11
- package/src/components/form/Switch/Switch.md +2 -1
- package/src/components/form/Switch/Switch.test.stories.tsx +6 -6
- package/src/components/form/Textarea/Textarea.styles.ts +143 -0
- package/src/components/form/Textarea/Textarea.test.stories.tsx +20 -26
- package/src/components/form/Textarea/Textarea.tsx +114 -535
- package/src/components/form/Textarea/TextareaRichEditor.tsx +377 -0
- package/src/components/form/Toggle/Toggle.styles.ts +211 -0
- package/src/components/form/Toggle/Toggle.test.stories.tsx +19 -27
- package/src/components/form/Toggle/Toggle.tsx +10 -185
- package/src/components/form/UploadButton/UploadButton.hooks.ts +323 -0
- package/src/components/form/UploadButton/UploadButton.parts.tsx +210 -0
- package/src/components/form/UploadButton/UploadButton.stories.tsx +2 -1
- package/src/components/form/UploadButton/UploadButton.test.stories.tsx +123 -4
- package/src/components/form/UploadButton/UploadButton.tsx +76 -305
- package/src/components/form/UploadButton/UploadButton.types.ts +16 -0
- package/src/components/form/index.ts +1 -0
- package/src/components/form/total-form/Fields/CepField.tsx +143 -0
- package/src/components/form/total-form/Fields/ToggleField.tsx +61 -0
- package/src/components/form/total-form/Fields/index.ts +4 -0
- package/src/components/form/total-form/FormContainer.tsx +3 -3
- package/src/components/form/total-form/SubmitButton.tsx +25 -2
- package/src/components/form/total-form/total-form.test.tsx +118 -1
- package/src/components/layout/Accordion/Accordion.md +1 -1
- package/src/components/layout/Accordion/Accordion.stories.tsx +5 -1
- package/src/components/layout/Accordion/Accordion.styles.ts +80 -0
- package/src/components/layout/Accordion/Accordion.test.stories.tsx +32 -50
- package/src/components/layout/Accordion/Accordion.tsx +2 -75
- package/src/components/layout/Card/Card.helpers.ts +30 -0
- package/src/components/layout/Card/Card.stories.tsx +9 -11
- package/src/components/layout/Card/Card.styles.ts +182 -0
- package/src/components/layout/Card/Card.test.stories.tsx +46 -46
- package/src/components/layout/Card/Card.tsx +24 -241
- package/src/components/layout/CardGrid/CardGrid.md +96 -0
- package/src/components/layout/CardGrid/CardGrid.tsx +140 -0
- package/src/components/layout/CardGrid/__tests__/CardGrid.test.tsx +92 -0
- package/src/components/layout/CardGrid/index.ts +2 -0
- package/src/components/layout/Collapsible/Collapsible.helpers.ts +83 -0
- package/src/components/layout/Collapsible/Collapsible.test.stories.tsx +7 -3
- package/src/components/layout/Collapsible/Collapsible.tsx +111 -107
- package/src/components/layout/Container/Container.test.stories.tsx +11 -16
- package/src/components/layout/ContentToolbar/ColumnsMenu.tsx +1 -1
- package/src/components/layout/ContentToolbar/ContentToolbar.tsx +120 -44
- package/src/components/layout/ContentToolbar/ContentToolbar.types.ts +9 -0
- package/src/components/layout/ContentToolbar/FilterTrigger.tsx +1 -1
- package/src/components/layout/ContentToolbar/MultiSelectDropdown.tsx +58 -43
- package/src/components/layout/ContentToolbar/MultiSelectTriggers.tsx +139 -0
- package/src/components/layout/ContentToolbar/SavedViewsMenu.tsx +10 -3
- package/src/components/layout/ContentToolbar/SortByDropdown.tsx +35 -11
- package/src/components/layout/ContentToolbar/ViewSelector.tsx +5 -6
- package/src/components/layout/ContentToolbar/__tests__/MultiSelectDropdown.test.tsx +21 -0
- package/src/components/layout/Dashboard/Dashboard.test.stories.tsx +27 -1
- package/src/components/layout/Dashboard/Dashboard.tsx +27 -8
- package/src/components/layout/Dashboard/DashboardParts.tsx +12 -19
- package/src/components/layout/Dashboard/index.ts +2 -1
- package/src/components/layout/Drawer/Drawer.stories.tsx +8 -10
- package/src/components/layout/Drawer/Drawer.test.stories.tsx +18 -14
- package/src/components/layout/Drawer/Drawer.tsx +67 -53
- package/src/components/layout/Resizable/Resizable.helpers.ts +133 -0
- package/src/components/layout/Resizable/Resizable.hooks.ts +68 -0
- package/src/components/layout/Resizable/Resizable.tsx +38 -153
- package/src/components/layout/ScrollArea/ScrollArea.helpers.ts +51 -0
- package/src/components/layout/ScrollArea/ScrollArea.styles.ts +248 -0
- package/src/components/layout/ScrollArea/ScrollArea.tsx +183 -374
- package/src/components/layout/ScrollArea/ScrollAreaContent.tsx +70 -0
- package/src/components/layout/ScrollArea/ScrollViewport.tsx +90 -0
- package/src/components/layout/Separator/Separator.styles.ts +128 -0
- package/src/components/layout/Separator/Separator.test.stories.tsx +3 -12
- package/src/components/layout/Separator/Separator.tsx +6 -132
- package/src/components/layout/SettingsLayout/SettingsLayout.parts.tsx +2 -1
- package/src/components/layout/SettingsLayout/SettingsLayout.stories.tsx +6 -8
- package/src/components/layout/Sidebar/Sidebar.stories.tsx +10 -12
- package/src/components/layout/Sidebar/Sidebar.test.stories.tsx +35 -37
- package/src/components/layout/Skeleton/Skeleton.helpers.ts +33 -0
- package/src/components/layout/Skeleton/Skeleton.styles.ts +114 -0
- package/src/components/layout/Skeleton/Skeleton.test.stories.tsx +3 -3
- package/src/components/layout/Skeleton/Skeleton.tsx +67 -155
- package/src/components/layout/TableFilter/TableFilter.tsx +2 -1
- package/src/components/navigation/Breadcrumbs/BreadcrumbEntry.tsx +305 -0
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.md +2 -1
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.stories.tsx +12 -14
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.styles.tsx +212 -0
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.test.stories.tsx +62 -61
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.tsx +116 -429
- package/src/components/navigation/CommandPalette/CommandPalette.helpers.ts +82 -0
- package/src/components/navigation/CommandPalette/CommandPalette.hooks.ts +202 -0
- package/src/components/navigation/CommandPalette/CommandPalette.stories.tsx +3 -1
- package/src/components/navigation/CommandPalette/CommandPalette.test.stories.tsx +3 -5
- package/src/components/navigation/CommandPalette/CommandPalette.tsx +108 -341
- package/src/components/navigation/CommandPalette/CommandPaletteResults.tsx +182 -0
- package/src/components/navigation/CommandPalette/ShortcutChip.tsx +18 -0
- package/src/components/navigation/ContextMenu/ContextMenu.md +3 -1
- package/src/components/navigation/ContextMenu/ContextMenu.stories.tsx +4 -1
- package/src/components/navigation/ContextMenu/ContextMenu.test.stories.tsx +19 -24
- package/src/components/navigation/ContextMenu/ContextMenu.tsx +70 -54
- package/src/components/navigation/DropdownMenu/DropdownMenu.md +3 -1
- package/src/components/navigation/DropdownMenu/DropdownMenu.stories.tsx +17 -19
- package/src/components/navigation/DropdownMenu/DropdownMenu.test.stories.tsx +26 -26
- package/src/components/navigation/DropdownMenu/DropdownMenu.tsx +189 -111
- package/src/components/navigation/NavigationMenu/NavigationMegaSection.tsx +66 -0
- package/src/components/navigation/NavigationMenu/NavigationMenu.md +7 -2
- package/src/components/navigation/NavigationMenu/NavigationMenu.shell.tsx +218 -0
- package/src/components/navigation/NavigationMenu/NavigationMenu.styles.ts +223 -0
- package/src/components/navigation/NavigationMenu/NavigationMenu.tsx +119 -808
- package/src/components/navigation/NavigationMenu/NavigationMenuItem.hooks.ts +126 -0
- package/src/components/navigation/NavigationMenu/NavigationMenuItem.tsx +352 -0
- package/src/components/navigation/NavigationMenu/NavigationStandardBody.tsx +148 -0
- package/src/components/navigation/NavigationMenu/stories/NavigationMenu.stories.tsx +15 -17
- package/src/components/navigation/NavigationMenu/stories/NavigationMenu.test.stories.tsx +27 -23
- package/src/components/navigation/NavigationMenu/stories/NavigationMenuHorizontal.stories.tsx +11 -13
- package/src/components/navigation/NavigationMenu/stories/NavigationMenuVertical.stories.tsx +9 -11
- package/src/components/navigation/Pagination/Pagination.helpers.tsx +85 -0
- package/src/components/navigation/Pagination/Pagination.md +2 -1
- package/src/components/navigation/Pagination/Pagination.stories.tsx +4 -6
- package/src/components/navigation/Pagination/Pagination.styles.ts +135 -0
- package/src/components/navigation/Pagination/Pagination.tsx +178 -313
- package/src/components/navigation/Pagination/PaginationParts.tsx +81 -0
- package/src/components/navigation/Tabs/Tabs.md +3 -1
- package/src/components/navigation/Tabs/Tabs.stories.tsx +21 -23
- package/src/components/navigation/Tabs/Tabs.styles.ts +163 -0
- package/src/components/navigation/Tabs/Tabs.test.stories.tsx +37 -37
- package/src/components/navigation/Tabs/Tabs.tsx +192 -361
- package/src/components/navigation/Tabs/TabsPanel.tsx +100 -0
- package/src/components/typography/Blockquote/Blockquote.tsx +1 -1
- package/src/components/typography/Code/Code.test.stories.tsx +5 -5
- package/src/components/typography/Code/Code.tsx +74 -49
- package/src/components/typography/Heading/Heading.test.stories.tsx +8 -8
- package/src/components/typography/Paragraph/Paragraph.test.stories.tsx +5 -12
- package/src/components/typography/Text/Text.tsx +84 -77
- package/src/components/utility/AnimatedIcon/AnimatedIcon.md +4 -4
- package/src/components/utility/AnimatedIcon/AnimatedIcon.stories.tsx +19 -21
- package/src/components/utility/AnimatedIcon/AnimatedIcon.test.stories.tsx +19 -12
- package/src/components/utility/AspectRatio/AspectRatio.test.stories.tsx +9 -9
- package/src/components/utility/InfiniteScroll/InfiniteScroll.hooks.ts +118 -0
- package/src/components/utility/InfiniteScroll/InfiniteScroll.parts.tsx +54 -0
- package/src/components/utility/InfiniteScroll/InfiniteScroll.test.stories.tsx +12 -9
- package/src/components/utility/InfiniteScroll/InfiniteScroll.tsx +29 -148
- package/src/components/utility/InstallPrompt/InstallPrompt.helpers.ts +124 -0
- package/src/components/utility/InstallPrompt/InstallPrompt.md +113 -0
- package/src/components/utility/InstallPrompt/InstallPrompt.stories.tsx +118 -0
- package/src/components/utility/InstallPrompt/InstallPrompt.styles.ts +50 -0
- package/src/components/utility/InstallPrompt/InstallPrompt.test.stories.tsx +83 -0
- package/src/components/utility/InstallPrompt/InstallPrompt.tsx +192 -0
- package/src/components/utility/InstallPrompt/InstallPrompt.types.ts +78 -0
- package/src/components/utility/InstallPrompt/__tests__/InstallPrompt.ios.test.tsx +65 -0
- package/src/components/utility/InstallPrompt/__tests__/usePwaInstall.test.tsx +271 -0
- package/src/components/utility/InstallPrompt/index.ts +10 -0
- package/src/components/utility/InstallPrompt/usePwaInstall.ts +171 -0
- package/src/components/utility/Transition/Transition.helpers.ts +40 -0
- package/src/components/utility/Transition/Transition.tsx +17 -68
- package/src/components/utility/VirtualList/VirtualList.hooks.ts +319 -0
- package/src/components/utility/VirtualList/VirtualList.test.stories.tsx +49 -38
- package/src/components/utility/VirtualList/VirtualList.tsx +110 -315
- package/src/components/utility/WorkflowStep/WorkflowStep.helpers.ts +151 -0
- package/src/components/utility/WorkflowStep/WorkflowStep.parts.tsx +371 -0
- package/src/components/utility/WorkflowStep/WorkflowStep.stories.tsx +9 -11
- package/src/components/utility/WorkflowStep/WorkflowStep.test.stories.tsx +7 -7
- package/src/components/utility/WorkflowStep/WorkflowStep.tsx +51 -449
- package/src/components/utility/WorkflowStep/WorkflowStepRow.tsx +96 -0
- package/src/components/utility/index.ts +1 -0
- package/src/mui/Link.ts +2 -0
- package/src/utils/index.ts +2 -1
- package/src/utils/viewport.ts +65 -0
|
@@ -1,232 +1,28 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ArrowForwardIos from '@mui/icons-material/ArrowForwardIos';
|
|
2
|
+
import ChevronRight from '@mui/icons-material/ChevronRight';
|
|
3
|
+
import NavigateNext from '@mui/icons-material/NavigateNext';
|
|
2
4
|
import {
|
|
3
|
-
alpha,
|
|
4
5
|
Box,
|
|
5
6
|
Breadcrumbs as MuiBreadcrumbs,
|
|
6
|
-
Fade,
|
|
7
|
-
Link,
|
|
8
|
-
Tooltip,
|
|
9
|
-
Typography,
|
|
10
7
|
useMediaQuery,
|
|
11
|
-
useTheme
|
|
12
|
-
} from '@mui/material';
|
|
13
|
-
import { keyframes,styled } from '@mui/material/styles';
|
|
8
|
+
useTheme } from '@mui/material';
|
|
9
|
+
import { styled } from '@mui/material/styles';
|
|
14
10
|
import React from 'react';
|
|
15
11
|
|
|
12
|
+
import {
|
|
13
|
+
breadcrumbsBarStyles,
|
|
14
|
+
sizeIconMap } from './Breadcrumbs.styles';
|
|
15
|
+
import { BreadcrumbEntry } from './BreadcrumbEntry';
|
|
16
16
|
import type { BreadcrumbItem,BreadcrumbsProps } from './Breadcrumbs.types';
|
|
17
17
|
|
|
18
18
|
// Animation keyframes
|
|
19
|
-
const slideIn = keyframes`
|
|
20
|
-
from {
|
|
21
|
-
opacity: 0;
|
|
22
|
-
transform: translateX(-10px);
|
|
23
|
-
}
|
|
24
|
-
to {
|
|
25
|
-
opacity: 1;
|
|
26
|
-
transform: translateX(0);
|
|
27
|
-
}
|
|
28
|
-
`;
|
|
29
|
-
|
|
30
|
-
const pulse = keyframes`
|
|
31
|
-
0% {
|
|
32
|
-
box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
|
|
33
|
-
}
|
|
34
|
-
70% {
|
|
35
|
-
box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
|
|
36
|
-
}
|
|
37
|
-
100% {
|
|
38
|
-
box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
|
|
39
|
-
}
|
|
40
|
-
`;
|
|
41
|
-
|
|
42
19
|
const StyledBreadcrumbs = styled(MuiBreadcrumbs, {
|
|
43
20
|
shouldForwardProp: (prop) =>
|
|
44
|
-
prop !== 'size' && prop !== 'color' && prop !== 'visualStyle' && prop !== 'elevation'
|
|
45
|
-
})<{ size?: string; color?: string; visualStyle?: string; elevation?: number }>(
|
|
21
|
+
prop !== 'size' && prop !== 'color' && prop !== 'visualStyle' && prop !== 'elevation' })<{ size?: string; color?: string; visualStyle?: string; elevation?: number }>(
|
|
46
22
|
({ theme, size, color, visualStyle, elevation = 0 }) => ({
|
|
47
|
-
|
|
48
|
-
borderRadius: theme.spacing(visualStyle === 'glass' ? 2 : 1),
|
|
49
|
-
animation: `${slideIn} 0.3s ease-out`,
|
|
50
|
-
transition: 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
|
|
51
|
-
position: 'relative',
|
|
52
|
-
|
|
53
|
-
// Glass morphism effect
|
|
54
|
-
...(visualStyle === 'glass' && {
|
|
55
|
-
background:
|
|
56
|
-
theme.palette.mode === 'dark' ? 'rgba(17, 24, 39, 0.7)' : 'rgba(255, 255, 255, 0.7)',
|
|
57
|
-
backdropFilter: 'blur(10px)',
|
|
58
|
-
WebkitBackdropFilter: 'blur(10px)',
|
|
59
|
-
border: `1px solid ${
|
|
60
|
-
theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)'
|
|
61
|
-
}`,
|
|
62
|
-
boxShadow:
|
|
63
|
-
theme.palette.mode === 'dark'
|
|
64
|
-
? `0 ${elevation * 4}px ${elevation * 8}px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1)`
|
|
65
|
-
: `0 ${elevation * 4}px ${elevation * 8}px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8)`,
|
|
66
|
-
}),
|
|
67
|
-
|
|
68
|
-
// Elevated variant
|
|
69
|
-
...(visualStyle === 'elevated' && {
|
|
70
|
-
background: theme.palette.background.paper,
|
|
71
|
-
boxShadow: theme.shadows[elevation] || theme.shadows[1],
|
|
72
|
-
borderRadius: theme.spacing(1.5),
|
|
73
|
-
}),
|
|
74
|
-
|
|
75
|
-
// Outlined variant
|
|
76
|
-
...(visualStyle === 'outlined' && {
|
|
77
|
-
border: `1px solid ${theme.palette.divider}`,
|
|
78
|
-
borderRadius: theme.spacing(1),
|
|
79
|
-
}),
|
|
80
|
-
|
|
81
|
-
'& .MuiBreadcrumbs-ol': {
|
|
82
|
-
alignItems: 'center',
|
|
83
|
-
flexWrap: 'nowrap',
|
|
84
|
-
[theme.breakpoints.down('sm')]: {
|
|
85
|
-
flexWrap: 'wrap',
|
|
86
|
-
gap: theme.spacing(0.5),
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
|
|
90
|
-
'& .MuiBreadcrumbs-separator': {
|
|
91
|
-
marginLeft: theme.spacing(size === 'sm' ? 0.5 : size === 'lg' ? 1.5 : 1),
|
|
92
|
-
marginRight: theme.spacing(size === 'sm' ? 0.5 : size === 'lg' ? 1.5 : 1),
|
|
93
|
-
opacity: 0.6,
|
|
94
|
-
transition: 'all 0.2s ease',
|
|
95
|
-
...(color === 'primary' && {
|
|
96
|
-
color: theme.palette.primary.main,
|
|
97
|
-
}),
|
|
98
|
-
...(color === 'secondary' && {
|
|
99
|
-
color: theme.palette.secondary.main,
|
|
100
|
-
}),
|
|
101
|
-
},
|
|
102
|
-
|
|
103
|
-
'&:hover': {
|
|
104
|
-
...(visualStyle === 'glass' && {
|
|
105
|
-
background:
|
|
106
|
-
theme.palette.mode === 'dark' ? 'rgba(17, 24, 39, 0.85)' : 'rgba(255, 255, 255, 0.85)',
|
|
107
|
-
boxShadow:
|
|
108
|
-
theme.palette.mode === 'dark'
|
|
109
|
-
? `0 ${elevation * 6}px ${elevation * 12}px rgba(0, 0, 0, 0.4)`
|
|
110
|
-
: `0 ${elevation * 6}px ${elevation * 12}px rgba(0, 0, 0, 0.12)`,
|
|
111
|
-
}),
|
|
112
|
-
},
|
|
113
|
-
}),
|
|
23
|
+
...breadcrumbsBarStyles({ theme, size, color, visualStyle, elevation }) }),
|
|
114
24
|
);
|
|
115
25
|
|
|
116
|
-
const BreadcrumbLink = styled(Link, {
|
|
117
|
-
shouldForwardProp: (prop) => prop !== 'size' && prop !== 'active' && prop !== 'visualStyle',
|
|
118
|
-
})<{ size?: string; active?: boolean; visualStyle?: string }>(
|
|
119
|
-
({ theme, size, active, visualStyle }) => ({
|
|
120
|
-
display: 'flex',
|
|
121
|
-
alignItems: 'center',
|
|
122
|
-
gap: theme.spacing(0.5),
|
|
123
|
-
textDecoration: 'none',
|
|
124
|
-
fontSize: size === 'sm' ? '0.875rem' : size === 'lg' ? '1.125rem' : '1rem',
|
|
125
|
-
fontWeight: active ? 600 : 400,
|
|
126
|
-
color: active ? theme.palette.text.primary : theme.palette.text.secondary,
|
|
127
|
-
padding: theme.spacing(0.5, 0.75),
|
|
128
|
-
borderRadius: theme.spacing(0.75),
|
|
129
|
-
position: 'relative',
|
|
130
|
-
overflow: 'hidden',
|
|
131
|
-
transition: 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
|
|
132
|
-
|
|
133
|
-
// Add subtle background for glass variant
|
|
134
|
-
...(visualStyle === 'glass' &&
|
|
135
|
-
!active && {
|
|
136
|
-
'&::before': {
|
|
137
|
-
content: '""',
|
|
138
|
-
position: 'absolute',
|
|
139
|
-
top: 0,
|
|
140
|
-
left: 0,
|
|
141
|
-
right: 0,
|
|
142
|
-
bottom: 0,
|
|
143
|
-
background: `linear-gradient(135deg, ${alpha(theme.palette.primary.main, 0)} 0%, ${alpha(theme.palette.primary.main, 0.05)} 100%)`,
|
|
144
|
-
opacity: 0,
|
|
145
|
-
transition: 'opacity 0.3s ease',
|
|
146
|
-
borderRadius: 'inherit',
|
|
147
|
-
},
|
|
148
|
-
}),
|
|
149
|
-
|
|
150
|
-
'&:hover, &[data-hover="true"]': {
|
|
151
|
-
color: theme.palette.primary.main,
|
|
152
|
-
backgroundColor: alpha(theme.palette.primary.main, visualStyle === 'glass' ? 0.1 : 0.08),
|
|
153
|
-
transform: 'translateY(-1px)',
|
|
154
|
-
|
|
155
|
-
'&::before': {
|
|
156
|
-
opacity: 1,
|
|
157
|
-
},
|
|
158
|
-
|
|
159
|
-
'& .breadcrumb-icon': {
|
|
160
|
-
transform: 'scale(1.1)',
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
|
|
164
|
-
'&:active': {
|
|
165
|
-
transform: 'translateY(0)',
|
|
166
|
-
backgroundColor: alpha(theme.palette.primary.main, 0.12),
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
'&:focus-visible': {
|
|
170
|
-
outline: `2px solid ${theme.palette.primary.main}`,
|
|
171
|
-
outlineOffset: 2,
|
|
172
|
-
backgroundColor: alpha(theme.palette.primary.main, 0.04),
|
|
173
|
-
},
|
|
174
|
-
|
|
175
|
-
...(active && {
|
|
176
|
-
pointerEvents: 'none',
|
|
177
|
-
cursor: 'default',
|
|
178
|
-
color: theme.palette.primary.main,
|
|
179
|
-
fontWeight: 600,
|
|
180
|
-
|
|
181
|
-
...(visualStyle === 'glass' && {
|
|
182
|
-
background: `linear-gradient(135deg, ${alpha(theme.palette.primary.main, 0.1)} 0%, ${alpha(theme.palette.primary.main, 0.05)} 100%)`,
|
|
183
|
-
animation: `${pulse} 2s infinite`,
|
|
184
|
-
}),
|
|
185
|
-
}),
|
|
186
|
-
|
|
187
|
-
'& .breadcrumb-icon': {
|
|
188
|
-
transition: 'transform 0.2s ease',
|
|
189
|
-
},
|
|
190
|
-
|
|
191
|
-
// Mobile responsiveness
|
|
192
|
-
[theme.breakpoints.down('sm')]: {
|
|
193
|
-
fontSize: size === 'lg' ? '1rem' : size === 'sm' ? '0.75rem' : '0.875rem',
|
|
194
|
-
padding: theme.spacing(0.375, 0.5),
|
|
195
|
-
},
|
|
196
|
-
}),
|
|
197
|
-
);
|
|
198
|
-
|
|
199
|
-
const BreadcrumbText = styled(Typography, {
|
|
200
|
-
shouldForwardProp: (prop) => prop !== 'size' && prop !== 'visualStyle',
|
|
201
|
-
})<{ size?: string; visualStyle?: string }>(({ theme, size, visualStyle }) => ({
|
|
202
|
-
display: 'flex',
|
|
203
|
-
alignItems: 'center',
|
|
204
|
-
gap: theme.spacing(0.5),
|
|
205
|
-
fontSize: size === 'sm' ? '0.875rem' : size === 'lg' ? '1.125rem' : '1rem',
|
|
206
|
-
fontWeight: 600,
|
|
207
|
-
color: theme.palette.primary.main,
|
|
208
|
-
padding: theme.spacing(0.5, 0.75),
|
|
209
|
-
borderRadius: theme.spacing(0.75),
|
|
210
|
-
position: 'relative',
|
|
211
|
-
|
|
212
|
-
...(visualStyle === 'glass' && {
|
|
213
|
-
background: `linear-gradient(135deg, ${alpha(theme.palette.primary.main, 0.1)} 0%, ${alpha(theme.palette.primary.main, 0.05)} 100%)`,
|
|
214
|
-
backdropFilter: 'blur(4px)',
|
|
215
|
-
border: `1px solid ${alpha(theme.palette.primary.main, 0.2)}`,
|
|
216
|
-
}),
|
|
217
|
-
|
|
218
|
-
'& .breadcrumb-icon': {
|
|
219
|
-
color: theme.palette.primary.main,
|
|
220
|
-
},
|
|
221
|
-
|
|
222
|
-
// Mobile responsiveness
|
|
223
|
-
[theme.breakpoints.down('sm')]: {
|
|
224
|
-
fontSize: size === 'lg' ? '1rem' : size === 'sm' ? '0.75rem' : '0.875rem',
|
|
225
|
-
padding: theme.spacing(0.375, 0.5),
|
|
226
|
-
},
|
|
227
|
-
}));
|
|
228
|
-
|
|
229
|
-
// Animated separator wrapper
|
|
230
26
|
const AnimatedSeparator = styled(Box)(() => ({
|
|
231
27
|
display: 'flex',
|
|
232
28
|
alignItems: 'center',
|
|
@@ -235,9 +31,7 @@ const AnimatedSeparator = styled(Box)(() => ({
|
|
|
235
31
|
|
|
236
32
|
'&:hover': {
|
|
237
33
|
opacity: 1,
|
|
238
|
-
transform: 'scale(1.1)'
|
|
239
|
-
},
|
|
240
|
-
}));
|
|
34
|
+
transform: 'scale(1.1)' } }));
|
|
241
35
|
|
|
242
36
|
const getSeparator = (separatorType: string) => {
|
|
243
37
|
const separatorContent = (() => {
|
|
@@ -260,151 +54,116 @@ const getSeparator = (separatorType: string) => {
|
|
|
260
54
|
return <AnimatedSeparator>{separatorContent}</AnimatedSeparator>;
|
|
261
55
|
};
|
|
262
56
|
|
|
263
|
-
|
|
264
|
-
sm: 'small' as const,
|
|
265
|
-
md: 'small' as const,
|
|
266
|
-
lg: 'medium' as const,
|
|
267
|
-
};
|
|
57
|
+
type DisplayItem = BreadcrumbItem & { isEllipsis?: boolean };
|
|
268
58
|
|
|
269
|
-
//
|
|
270
|
-
|
|
59
|
+
// Long trails either hide their middle behind a menu or replace it with an
|
|
60
|
+
// ellipsis crumb; short ones pass straight through.
|
|
61
|
+
const collapseItems = ({
|
|
271
62
|
items,
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
dataTestId,
|
|
275
|
-
}: {
|
|
63
|
+
effectiveMaxItems,
|
|
64
|
+
collapseBehavior }: {
|
|
276
65
|
items: BreadcrumbItem[];
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
66
|
+
effectiveMaxItems: number;
|
|
67
|
+
collapseBehavior: string;
|
|
68
|
+
}): { displayItems: DisplayItem[]; collapsedItems: BreadcrumbItem[] } => {
|
|
69
|
+
if (items.length <= effectiveMaxItems) {
|
|
70
|
+
return { displayItems: items, collapsedItems: [] };
|
|
71
|
+
}
|
|
283
72
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
73
|
+
if (collapseBehavior === 'menu') {
|
|
74
|
+
const firstItem = items[0];
|
|
75
|
+
const tail = items.slice(-(effectiveMaxItems - 2));
|
|
287
76
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
77
|
+
return {
|
|
78
|
+
displayItems: firstItem ? [firstItem, ...tail] : tail,
|
|
79
|
+
collapsedItems: items.slice(1, -(effectiveMaxItems - 2)) };
|
|
80
|
+
}
|
|
291
81
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
<Box
|
|
306
|
-
sx={{
|
|
307
|
-
position: 'absolute',
|
|
308
|
-
top: '100%',
|
|
309
|
-
left: 0,
|
|
310
|
-
mt: 1,
|
|
311
|
-
display: open ? 'block' : 'none',
|
|
312
|
-
zIndex: 1000,
|
|
313
|
-
}}
|
|
314
|
-
data-testid={dataTestId ? `${dataTestId}-collapsed-menu-items` : 'breadcrumbs-collapsed-menu-items'}
|
|
315
|
-
>
|
|
316
|
-
<Fade in={open}>
|
|
317
|
-
<Box
|
|
318
|
-
sx={{
|
|
319
|
-
background: (theme) =>
|
|
320
|
-
theme.palette.mode === 'dark'
|
|
321
|
-
? 'rgba(17, 24, 39, 0.95)'
|
|
322
|
-
: 'rgba(255, 255, 255, 0.95)',
|
|
323
|
-
backdropFilter: 'blur(10px)',
|
|
324
|
-
borderRadius: 1,
|
|
325
|
-
boxShadow: 3,
|
|
326
|
-
p: 1,
|
|
327
|
-
minWidth: 150,
|
|
328
|
-
}}
|
|
329
|
-
>
|
|
330
|
-
{items.map((item, index) => (
|
|
331
|
-
<Box
|
|
332
|
-
key={index}
|
|
333
|
-
component="a"
|
|
334
|
-
href={item.href || '#'}
|
|
335
|
-
onClick={(e) => {
|
|
336
|
-
handleClose();
|
|
337
|
-
item.onClick?.(e);
|
|
338
|
-
}}
|
|
339
|
-
sx={{
|
|
340
|
-
display: 'block',
|
|
341
|
-
px: 2,
|
|
342
|
-
py: 1,
|
|
343
|
-
color: 'text.secondary',
|
|
344
|
-
textDecoration: 'none',
|
|
345
|
-
borderRadius: 0.5,
|
|
346
|
-
transition: 'all 0.2s',
|
|
347
|
-
'&:hover': {
|
|
348
|
-
backgroundColor: 'action.hover',
|
|
349
|
-
color: 'primary.main',
|
|
350
|
-
},
|
|
351
|
-
}}
|
|
352
|
-
data-testid={dataTestId ? `${dataTestId}-collapsed-item-${index}` : `breadcrumbs-collapsed-item-${index}`}
|
|
353
|
-
>
|
|
354
|
-
{item.label}
|
|
355
|
-
</Box>
|
|
356
|
-
))}
|
|
357
|
-
</Box>
|
|
358
|
-
</Fade>
|
|
359
|
-
</Box>
|
|
360
|
-
</>
|
|
361
|
-
);
|
|
82
|
+
if (collapseBehavior === 'ellipsis') {
|
|
83
|
+
const half = Math.floor(effectiveMaxItems / 2);
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
displayItems: [
|
|
87
|
+
...items.slice(0, half),
|
|
88
|
+
{ label: '...', href: '#', isEllipsis: true },
|
|
89
|
+
...items.slice(-half),
|
|
90
|
+
],
|
|
91
|
+
collapsedItems: [] };
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return { displayItems: items, collapsedItems: [] };
|
|
362
95
|
};
|
|
363
96
|
|
|
97
|
+
type BreadcrumbsDefaultedKeys =
|
|
98
|
+
| 'variant'
|
|
99
|
+
| 'separatorType'
|
|
100
|
+
| 'maxItems'
|
|
101
|
+
| 'showHomeIcon'
|
|
102
|
+
| 'size'
|
|
103
|
+
| 'color'
|
|
104
|
+
| 'elevation'
|
|
105
|
+
| 'collapseBehavior'
|
|
106
|
+
| 'mobileMaxItems';
|
|
107
|
+
|
|
108
|
+
type ResolvedBreadcrumbsProps = BreadcrumbsProps &
|
|
109
|
+
Required<Pick<BreadcrumbsProps, BreadcrumbsDefaultedKeys>>;
|
|
110
|
+
|
|
111
|
+
const BREADCRUMBS_DEFAULTS: Pick<BreadcrumbsProps, BreadcrumbsDefaultedKeys> = {
|
|
112
|
+
variant: 'default',
|
|
113
|
+
separatorType: 'default',
|
|
114
|
+
maxItems: 8,
|
|
115
|
+
showHomeIcon: true,
|
|
116
|
+
size: 'md',
|
|
117
|
+
color: 'default',
|
|
118
|
+
elevation: 1,
|
|
119
|
+
collapseBehavior: 'menu',
|
|
120
|
+
mobileMaxItems: 3 };
|
|
121
|
+
|
|
122
|
+
// Strips explicitly-undefined props before the merge, so `prop={undefined}` still
|
|
123
|
+
// falls back to the default exactly as a destructuring default would. Applied as
|
|
124
|
+
// a merge rather than destructuring defaults, which would otherwise put nine
|
|
125
|
+
// branches into the component's own complexity budget.
|
|
126
|
+
const resolveProps = (props: BreadcrumbsProps): ResolvedBreadcrumbsProps =>
|
|
127
|
+
({
|
|
128
|
+
...BREADCRUMBS_DEFAULTS,
|
|
129
|
+
...(Object.fromEntries(
|
|
130
|
+
Object.entries(props).filter(([, value]) => value !== undefined),
|
|
131
|
+
) as Partial<BreadcrumbsProps>) }) as ResolvedBreadcrumbsProps;
|
|
132
|
+
|
|
364
133
|
export const Breadcrumbs = React.forwardRef<HTMLElement, BreadcrumbsProps>(
|
|
365
|
-
(
|
|
366
|
-
{
|
|
367
|
-
variant
|
|
368
|
-
separatorType
|
|
134
|
+
(componentProps, ref) => {
|
|
135
|
+
const {
|
|
136
|
+
variant,
|
|
137
|
+
separatorType,
|
|
369
138
|
items,
|
|
370
139
|
separator,
|
|
371
|
-
maxItems
|
|
372
|
-
showHomeIcon
|
|
373
|
-
size
|
|
374
|
-
color
|
|
375
|
-
elevation
|
|
376
|
-
collapseBehavior
|
|
377
|
-
mobileMaxItems
|
|
140
|
+
maxItems,
|
|
141
|
+
showHomeIcon,
|
|
142
|
+
size,
|
|
143
|
+
color,
|
|
144
|
+
elevation,
|
|
145
|
+
collapseBehavior,
|
|
146
|
+
mobileMaxItems,
|
|
378
147
|
ariaLabel,
|
|
379
148
|
dataTestId,
|
|
380
149
|
...props
|
|
381
|
-
}
|
|
382
|
-
ref,
|
|
383
|
-
) => {
|
|
150
|
+
} = resolveProps(componentProps);
|
|
384
151
|
const theme = useTheme();
|
|
385
|
-
|
|
152
|
+
// separatorType picks a built-in separator; an explicit `separator` wins.
|
|
153
|
+
// This was computed before but never passed on, so separatorType had no
|
|
154
|
+
// effect on what rendered.
|
|
386
155
|
const finalSeparator = separator || getSeparator(separatorType);
|
|
156
|
+
const isMobile = useMediaQuery(theme.breakpoints.down('sm'));
|
|
387
157
|
const iconSize = sizeIconMap[size];
|
|
388
158
|
|
|
389
159
|
// Handle mobile collapsing
|
|
390
160
|
const effectiveMaxItems = isMobile ? mobileMaxItems : maxItems;
|
|
391
161
|
const shouldCollapse = items.length > effectiveMaxItems;
|
|
392
162
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
const firstItem = items[0];
|
|
398
|
-
const lastItems = items.slice(-(effectiveMaxItems - 2));
|
|
399
|
-
collapsedItems = items.slice(1, -(effectiveMaxItems - 2));
|
|
400
|
-
displayItems = firstItem ? [firstItem, ...lastItems] : lastItems;
|
|
401
|
-
} else if (shouldCollapse && collapseBehavior === 'ellipsis') {
|
|
402
|
-
displayItems = [
|
|
403
|
-
...items.slice(0, Math.floor(effectiveMaxItems / 2)),
|
|
404
|
-
{ label: '...', href: '#', isEllipsis: true },
|
|
405
|
-
...items.slice(-Math.floor(effectiveMaxItems / 2)),
|
|
406
|
-
];
|
|
407
|
-
}
|
|
163
|
+
const { displayItems, collapsedItems } = collapseItems({
|
|
164
|
+
items,
|
|
165
|
+
effectiveMaxItems,
|
|
166
|
+
collapseBehavior });
|
|
408
167
|
|
|
409
168
|
return (
|
|
410
169
|
<StyledBreadcrumbs
|
|
@@ -420,94 +179,22 @@ export const Breadcrumbs = React.forwardRef<HTMLElement, BreadcrumbsProps>(
|
|
|
420
179
|
data-testid={dataTestId || 'breadcrumbs'}
|
|
421
180
|
{...props}
|
|
422
181
|
>
|
|
423
|
-
{displayItems.map((item, index) =>
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
// Handle ellipsis
|
|
440
|
-
if (isEllipsis) {
|
|
441
|
-
return (
|
|
442
|
-
<Tooltip key={index} title="More items" arrow>
|
|
443
|
-
<Box
|
|
444
|
-
sx={{
|
|
445
|
-
px: 1,
|
|
446
|
-
color: 'text.disabled',
|
|
447
|
-
cursor: 'default',
|
|
448
|
-
userSelect: 'none',
|
|
449
|
-
}}
|
|
450
|
-
data-testid={dataTestId ? `${dataTestId}-ellipsis` : 'breadcrumbs-ellipsis'}
|
|
451
|
-
>
|
|
452
|
-
{item.label}
|
|
453
|
-
</Box>
|
|
454
|
-
</Tooltip>
|
|
455
|
-
);
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
const icon =
|
|
459
|
-
isFirst && showHomeIcon && !item.icon ? (
|
|
460
|
-
<Home className="breadcrumb-icon" fontSize={iconSize} />
|
|
461
|
-
) : item.icon ? (
|
|
462
|
-
<Box
|
|
463
|
-
component="span"
|
|
464
|
-
className="breadcrumb-icon"
|
|
465
|
-
sx={{ display: 'flex', alignItems: 'center' }}
|
|
466
|
-
>
|
|
467
|
-
{item.icon}
|
|
468
|
-
</Box>
|
|
469
|
-
) : null;
|
|
470
|
-
|
|
471
|
-
// Render active/last item
|
|
472
|
-
if (isActive) {
|
|
473
|
-
return (
|
|
474
|
-
<BreadcrumbText
|
|
475
|
-
key={index}
|
|
476
|
-
size={size}
|
|
477
|
-
visualStyle={variant}
|
|
478
|
-
aria-current="page"
|
|
479
|
-
data-testid={dataTestId ? `${dataTestId}-item-${index}` : `breadcrumbs-item-${index}`}
|
|
480
|
-
>
|
|
481
|
-
{icon}
|
|
482
|
-
<span>{item.label}</span>
|
|
483
|
-
</BreadcrumbText>
|
|
484
|
-
);
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
// Render clickable breadcrumb
|
|
488
|
-
return (
|
|
489
|
-
<Tooltip
|
|
490
|
-
key={index}
|
|
491
|
-
title={item.tooltip || item.label}
|
|
492
|
-
arrow
|
|
493
|
-
disableHoverListener={!item.tooltip}
|
|
494
|
-
>
|
|
495
|
-
<BreadcrumbLink
|
|
496
|
-
href={item.href || '#'}
|
|
497
|
-
onClick={item.onClick}
|
|
498
|
-
size={size}
|
|
499
|
-
visualStyle={variant}
|
|
500
|
-
active={isActive}
|
|
501
|
-
underline="none"
|
|
502
|
-
aria-label={item.ariaLabel || item.label}
|
|
503
|
-
data-testid={dataTestId ? `${dataTestId}-link-${index}` : `breadcrumbs-link-${index}`}
|
|
504
|
-
>
|
|
505
|
-
{icon}
|
|
506
|
-
<span>{item.label}</span>
|
|
507
|
-
</BreadcrumbLink>
|
|
508
|
-
</Tooltip>
|
|
509
|
-
);
|
|
510
|
-
})}
|
|
182
|
+
{displayItems.map((item, index) => (
|
|
183
|
+
<BreadcrumbEntry
|
|
184
|
+
key={index}
|
|
185
|
+
item={item}
|
|
186
|
+
index={index}
|
|
187
|
+
itemCount={displayItems.length}
|
|
188
|
+
collapsedItems={collapsedItems}
|
|
189
|
+
collapseBehavior={collapseBehavior}
|
|
190
|
+
separator={finalSeparator}
|
|
191
|
+
showHomeIcon={showHomeIcon}
|
|
192
|
+
iconSize={iconSize}
|
|
193
|
+
size={size}
|
|
194
|
+
variant={variant}
|
|
195
|
+
dataTestId={dataTestId}
|
|
196
|
+
/>
|
|
197
|
+
))}
|
|
511
198
|
</StyledBreadcrumbs>
|
|
512
199
|
);
|
|
513
200
|
},
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type Fuse from 'fuse.js';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
|
|
4
|
+
import type { PaletteCommand } from './CommandPalette.types';
|
|
5
|
+
|
|
6
|
+
// Without a query the list is the recent commands first, then the rest; with one
|
|
7
|
+
// it is whatever fuzzy search returns.
|
|
8
|
+
export const filterCommands = ({
|
|
9
|
+
commands,
|
|
10
|
+
searchQuery,
|
|
11
|
+
fuse,
|
|
12
|
+
showRecent,
|
|
13
|
+
recentCommandIds,
|
|
14
|
+
}: {
|
|
15
|
+
commands: PaletteCommand[];
|
|
16
|
+
searchQuery: string;
|
|
17
|
+
fuse: Fuse<PaletteCommand>;
|
|
18
|
+
showRecent?: boolean;
|
|
19
|
+
recentCommandIds: string[];
|
|
20
|
+
}): PaletteCommand[] => {
|
|
21
|
+
if (searchQuery) {
|
|
22
|
+
return fuse.search(searchQuery).map((result) => result.item);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (!showRecent || recentCommandIds.length === 0) {
|
|
26
|
+
return commands;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const recent = recentCommandIds
|
|
30
|
+
.map((id) => commands.find((command) => command.id === id))
|
|
31
|
+
.filter(Boolean) as PaletteCommand[];
|
|
32
|
+
|
|
33
|
+
return [...recent, ...commands.filter((command) => !recentCommandIds.includes(command.id))];
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const groupByCategory = (commands: PaletteCommand[]): Record<string, PaletteCommand[]> => {
|
|
37
|
+
const groups: Record<string, PaletteCommand[]> = {};
|
|
38
|
+
|
|
39
|
+
for (const command of commands) {
|
|
40
|
+
const category = command.category || 'General';
|
|
41
|
+
groups[category] = groups[category] ?? [];
|
|
42
|
+
groups[category].push(command);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return groups;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// Arrow keys move the highlight, Enter runs the highlighted command, Escape
|
|
49
|
+
// closes. Built outside the effect so the switch does not count against the
|
|
50
|
+
// component body.
|
|
51
|
+
export const createPaletteKeyHandler = ({
|
|
52
|
+
commandCount,
|
|
53
|
+
selectedCommand,
|
|
54
|
+
setSelectedIndex,
|
|
55
|
+
executeCommand,
|
|
56
|
+
onClose,
|
|
57
|
+
}: {
|
|
58
|
+
commandCount: number;
|
|
59
|
+
selectedCommand?: PaletteCommand;
|
|
60
|
+
setSelectedIndex: React.Dispatch<React.SetStateAction<number>>;
|
|
61
|
+
executeCommand: (command: PaletteCommand) => void;
|
|
62
|
+
onClose: () => void;
|
|
63
|
+
}) => (event: globalThis.KeyboardEvent) => {
|
|
64
|
+
switch (event.key) {
|
|
65
|
+
case 'ArrowDown':
|
|
66
|
+
event.preventDefault();
|
|
67
|
+
setSelectedIndex((prev) => (prev < commandCount - 1 ? prev + 1 : prev));
|
|
68
|
+
break;
|
|
69
|
+
case 'ArrowUp':
|
|
70
|
+
event.preventDefault();
|
|
71
|
+
setSelectedIndex((prev) => (prev > 0 ? prev - 1 : prev));
|
|
72
|
+
break;
|
|
73
|
+
case 'Enter':
|
|
74
|
+
event.preventDefault();
|
|
75
|
+
if (selectedCommand) executeCommand(selectedCommand);
|
|
76
|
+
break;
|
|
77
|
+
case 'Escape':
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
onClose();
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
};
|