@12-apps/ui 1.0.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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,791 +1,162 @@
|
|
|
1
|
-
import { ChevronRight, ExpandMore, Menu as MenuIcon } from '@mui/icons-material';
|
|
2
1
|
import {
|
|
3
|
-
alpha,
|
|
4
2
|
Box,
|
|
5
|
-
|
|
6
|
-
Divider,
|
|
7
|
-
Fade,
|
|
8
|
-
Grow,
|
|
9
|
-
List,
|
|
10
|
-
ListItem,
|
|
11
|
-
ListItemButton,
|
|
12
|
-
ListItemIcon,
|
|
13
|
-
ListItemText,
|
|
14
|
-
Paper,
|
|
15
|
-
Popover,
|
|
16
|
-
Typography,
|
|
17
|
-
} from '@mui/material';
|
|
18
|
-
import { keyframes,styled } from '@mui/material/styles';
|
|
3
|
+
Paper } from '@mui/material';
|
|
19
4
|
import React, { useState } from 'react';
|
|
20
5
|
|
|
6
|
+
import { NavigationMegaSection } from './NavigationMegaSection';
|
|
7
|
+
import { NavigationStandardBody } from './NavigationStandardBody';
|
|
8
|
+
import {
|
|
9
|
+
LogoBar,
|
|
10
|
+
NavigationShell } from './NavigationMenu.shell';
|
|
21
11
|
import type { NavigationMenuItem,NavigationMenuProps } from './NavigationMenu.types';
|
|
22
12
|
|
|
23
|
-
// Animation keyframes
|
|
24
|
-
const slideIn = keyframes`
|
|
25
|
-
from {
|
|
26
|
-
opacity: 0;
|
|
27
|
-
transform: translateX(-20px);
|
|
28
|
-
}
|
|
29
|
-
to {
|
|
30
|
-
opacity: 1;
|
|
31
|
-
transform: translateX(0);
|
|
32
|
-
}
|
|
33
|
-
`;
|
|
34
|
-
|
|
35
|
-
const pulseGlow = keyframes`
|
|
36
|
-
0% {
|
|
37
|
-
box-shadow: 0 0 0 0 rgba(25, 118, 210, 0.4);
|
|
38
|
-
}
|
|
39
|
-
70% {
|
|
40
|
-
box-shadow: 0 0 0 10px rgba(25, 118, 210, 0);
|
|
41
|
-
}
|
|
42
|
-
100% {
|
|
43
|
-
box-shadow: 0 0 0 0 rgba(25, 118, 210, 0);
|
|
44
|
-
}
|
|
45
|
-
`;
|
|
46
|
-
|
|
47
|
-
const NavigationContainer = styled(Box, {
|
|
48
|
-
shouldForwardProp: (prop) => !['variant', 'collapsed', 'minimal'].includes(prop as string),
|
|
49
|
-
})<{ variant?: string; collapsed?: boolean; minimal?: boolean }>(({ theme, variant, collapsed, minimal }) => ({
|
|
50
|
-
display: 'flex',
|
|
51
|
-
position: 'relative',
|
|
52
|
-
animation: `${slideIn} 0.4s ease-out`,
|
|
53
|
-
...(variant === 'horizontal' && {
|
|
54
|
-
flexDirection: 'row',
|
|
55
|
-
alignItems: 'center',
|
|
56
|
-
width: '100%',
|
|
57
|
-
...(!minimal && {
|
|
58
|
-
background: `linear-gradient(135deg, ${alpha(theme.palette.background.paper, 0.95)} 0%, ${alpha(theme.palette.background.paper, 0.98)} 100%)`,
|
|
59
|
-
backdropFilter: 'blur(10px)',
|
|
60
|
-
borderRadius: theme.spacing(2),
|
|
61
|
-
boxShadow: `0 8px 32px ${alpha(theme.palette.common.black, 0.08)}`,
|
|
62
|
-
}),
|
|
63
|
-
}),
|
|
64
|
-
...(variant === 'vertical' && {
|
|
65
|
-
flexDirection: 'column',
|
|
66
|
-
width: collapsed ? 80 : 280,
|
|
67
|
-
transition: 'all 0.4s cubic-bezier(0.4, 0, 0.2, 1)',
|
|
68
|
-
height: '100%',
|
|
69
|
-
...(!minimal && {
|
|
70
|
-
background: `linear-gradient(180deg, ${alpha(theme.palette.background.paper, 0.98)} 0%, ${alpha(theme.palette.background.paper, 0.95)} 100%)`,
|
|
71
|
-
backdropFilter: 'blur(12px)',
|
|
72
|
-
borderRadius: theme.spacing(2),
|
|
73
|
-
boxShadow: `0 12px 40px ${alpha(theme.palette.common.black, 0.1)}`,
|
|
74
|
-
'&::before': {
|
|
75
|
-
content: '""',
|
|
76
|
-
position: 'absolute',
|
|
77
|
-
top: 0,
|
|
78
|
-
left: 0,
|
|
79
|
-
right: 0,
|
|
80
|
-
height: '200px',
|
|
81
|
-
background: `radial-gradient(ellipse at top, ${alpha(theme.palette.primary.main, 0.05)} 0%, transparent 70%)`,
|
|
82
|
-
pointerEvents: 'none',
|
|
83
|
-
},
|
|
84
|
-
}),
|
|
85
|
-
}),
|
|
86
|
-
...(variant === 'mega' && {
|
|
87
|
-
flexDirection: 'column',
|
|
88
|
-
width: '100%',
|
|
89
|
-
...(!minimal && {
|
|
90
|
-
background: `linear-gradient(135deg, ${alpha(theme.palette.background.paper, 0.98)} 0%, ${alpha(theme.palette.background.default, 0.95)} 100%)`,
|
|
91
|
-
backdropFilter: 'blur(15px)',
|
|
92
|
-
borderRadius: theme.spacing(3),
|
|
93
|
-
overflow: 'hidden',
|
|
94
|
-
boxShadow: `0 20px 60px ${alpha(theme.palette.common.black, 0.12)}`,
|
|
95
|
-
}),
|
|
96
|
-
}),
|
|
97
|
-
}));
|
|
98
|
-
|
|
99
|
-
const StyledList = styled(List, {
|
|
100
|
-
shouldForwardProp: (prop) => !['variant', 'size'].includes(prop as string),
|
|
101
|
-
})<{ variant?: string; size?: string }>(({ theme, variant }) => ({
|
|
102
|
-
padding: 0,
|
|
103
|
-
width: '100%',
|
|
104
|
-
...(variant === 'horizontal' && {
|
|
105
|
-
display: 'flex',
|
|
106
|
-
flexDirection: 'row',
|
|
107
|
-
alignItems: 'center',
|
|
108
|
-
}),
|
|
109
|
-
...(variant === 'mega' && {
|
|
110
|
-
display: 'grid',
|
|
111
|
-
gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))',
|
|
112
|
-
gap: theme.spacing(2),
|
|
113
|
-
padding: theme.spacing(2),
|
|
114
|
-
}),
|
|
115
|
-
}));
|
|
116
|
-
|
|
117
|
-
const StyledListItem = styled(ListItem, {
|
|
118
|
-
shouldForwardProp: (prop) => !['variant', 'active', 'size', 'level'].includes(prop as string),
|
|
119
|
-
})<{ variant?: string; active?: boolean; size?: string; level?: number }>(
|
|
120
|
-
({ theme, variant, level = 0 }) => ({
|
|
121
|
-
padding: 0,
|
|
122
|
-
...(variant === 'horizontal' && {
|
|
123
|
-
width: 'auto',
|
|
124
|
-
}),
|
|
125
|
-
...(level > 0 && {
|
|
126
|
-
paddingLeft: theme.spacing(2 * level),
|
|
127
|
-
}),
|
|
128
|
-
}),
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
const StyledListItemButton = styled(ListItemButton, {
|
|
132
|
-
shouldForwardProp: (prop) => !['variant', 'active', 'size', 'collapsed', 'minimal'].includes(prop as string),
|
|
133
|
-
})<{ variant?: string; active?: boolean; size?: string; collapsed?: boolean; minimal?: boolean }>(
|
|
134
|
-
({ theme, variant, active, size, collapsed, minimal }) => ({
|
|
135
|
-
borderRadius: theme.spacing(1.5),
|
|
136
|
-
margin: theme.spacing(0.5),
|
|
137
|
-
position: 'relative',
|
|
138
|
-
overflow: 'hidden',
|
|
139
|
-
transition: 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
|
|
140
|
-
transformStyle: 'preserve-3d',
|
|
141
|
-
|
|
142
|
-
'&::before': {
|
|
143
|
-
content: '""',
|
|
144
|
-
position: 'absolute',
|
|
145
|
-
top: 0,
|
|
146
|
-
left: 0,
|
|
147
|
-
right: 0,
|
|
148
|
-
bottom: 0,
|
|
149
|
-
background: `linear-gradient(135deg, ${alpha(theme.palette.primary.main, 0)} 0%, ${alpha(theme.palette.primary.main, 0.08)} 100%)`,
|
|
150
|
-
opacity: 0,
|
|
151
|
-
transition: 'opacity 0.3s ease',
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
'&::after': {
|
|
155
|
-
content: '""',
|
|
156
|
-
position: 'absolute',
|
|
157
|
-
top: '50%',
|
|
158
|
-
left: '50%',
|
|
159
|
-
width: '100%',
|
|
160
|
-
height: '100%',
|
|
161
|
-
background: `radial-gradient(circle, ${alpha(theme.palette.primary.main, 0.3)} 0%, transparent 70%)`,
|
|
162
|
-
transform: 'translate(-50%, -50%) scale(0)',
|
|
163
|
-
transition: 'transform 0.6s ease',
|
|
164
|
-
borderRadius: '50%',
|
|
165
|
-
},
|
|
166
|
-
|
|
167
|
-
...(size === 'sm' && {
|
|
168
|
-
padding: theme.spacing(1, 1.5),
|
|
169
|
-
fontSize: '0.875rem',
|
|
170
|
-
'& .MuiListItemIcon-root': {
|
|
171
|
-
transform: 'scale(0.85)',
|
|
172
|
-
},
|
|
173
|
-
}),
|
|
174
|
-
...(size === 'lg' && {
|
|
175
|
-
padding: theme.spacing(2, 2.5),
|
|
176
|
-
fontSize: '1.125rem',
|
|
177
|
-
'& .MuiListItemIcon-root': {
|
|
178
|
-
transform: 'scale(1.15)',
|
|
179
|
-
},
|
|
180
|
-
}),
|
|
181
|
-
|
|
182
|
-
...(variant === 'horizontal' && {
|
|
183
|
-
borderRadius: theme.spacing(1.5),
|
|
184
|
-
margin: theme.spacing(0, 0.5),
|
|
185
|
-
background: alpha(theme.palette.background.paper, 0.6),
|
|
186
|
-
backdropFilter: 'blur(8px)',
|
|
187
|
-
border: `none`,
|
|
188
|
-
// border: `1px solid ${alpha(theme.palette.divider, 0.1)}`,
|
|
189
|
-
}),
|
|
190
|
-
|
|
191
|
-
...(collapsed && {
|
|
192
|
-
justifyContent: 'center',
|
|
193
|
-
minHeight: 56,
|
|
194
|
-
'& .MuiListItemIcon-root': {
|
|
195
|
-
margin: 0,
|
|
196
|
-
},
|
|
197
|
-
}),
|
|
198
|
-
|
|
199
|
-
'&:hover': minimal
|
|
200
|
-
? {
|
|
201
|
-
// Simple hover for minimal variant
|
|
202
|
-
backgroundColor: alpha(theme.palette.action.hover, 0.08),
|
|
203
|
-
color: theme.palette.primary.main,
|
|
204
|
-
|
|
205
|
-
'& .MuiListItemIcon-root': {
|
|
206
|
-
color: theme.palette.primary.main,
|
|
207
|
-
},
|
|
208
|
-
}
|
|
209
|
-
: {
|
|
210
|
-
// Fancy hover for non-minimal variant
|
|
211
|
-
background: `linear-gradient(135deg, ${alpha(theme.palette.primary.main, 0.15)} 0%, ${alpha(theme.palette.primary.main, 0.08)} 100%)`,
|
|
212
|
-
color: theme.palette.primary.main,
|
|
213
|
-
boxShadow: `0 8px 24px ${alpha(theme.palette.primary.main, 0.15)}`,
|
|
214
|
-
backgroundColor: alpha(theme.palette.primary.main, 0.04),
|
|
215
|
-
|
|
216
|
-
'&::before': {
|
|
217
|
-
opacity: 1,
|
|
218
|
-
},
|
|
219
|
-
|
|
220
|
-
'& .MuiListItemIcon-root': {
|
|
221
|
-
color: theme.palette.primary.main,
|
|
222
|
-
transform: collapsed
|
|
223
|
-
? 'scale(1.1)'
|
|
224
|
-
: size === 'sm'
|
|
225
|
-
? 'scale(0.95) rotate(-5deg)'
|
|
226
|
-
: size === 'lg'
|
|
227
|
-
? 'scale(1.25) rotate(-5deg)'
|
|
228
|
-
: 'scale(1.1) rotate(-5deg)',
|
|
229
|
-
transition: 'all 0.3s ease',
|
|
230
|
-
},
|
|
231
|
-
|
|
232
|
-
'& .MuiListItemText-primary': {
|
|
233
|
-
transform: 'translateX(4px)',
|
|
234
|
-
transition: 'transform 0.3s ease',
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
|
|
238
|
-
'&:active': minimal
|
|
239
|
-
? {
|
|
240
|
-
// Simple active state for minimal variant
|
|
241
|
-
opacity: 0.7,
|
|
242
|
-
}
|
|
243
|
-
: {
|
|
244
|
-
// Fancy active state for non-minimal variant
|
|
245
|
-
transform: 'scale(0.98)',
|
|
246
|
-
'&::after': {
|
|
247
|
-
transform: 'translate(-50%, -50%) scale(2)',
|
|
248
|
-
},
|
|
249
|
-
},
|
|
250
|
-
|
|
251
|
-
...(active && {
|
|
252
|
-
color: theme.palette.primary.main,
|
|
253
|
-
cursor: 'default',
|
|
254
|
-
|
|
255
|
-
'& .MuiListItemIcon-root': {
|
|
256
|
-
color: theme.palette.primary.main,
|
|
257
|
-
},
|
|
258
|
-
|
|
259
|
-
'&::before': {
|
|
260
|
-
opacity: 1,
|
|
261
|
-
background: `linear-gradient(135deg, ${alpha(theme.palette.primary.main, 0.2)} 0%, ${alpha(theme.palette.primary.main, 0.05)} 100%)`,
|
|
262
|
-
},
|
|
263
|
-
|
|
264
|
-
'&:hover': {
|
|
265
|
-
background: 'none',
|
|
266
|
-
transform: 'none',
|
|
267
|
-
boxShadow: 'none',
|
|
268
|
-
|
|
269
|
-
'&::before': {
|
|
270
|
-
opacity: 1,
|
|
271
|
-
},
|
|
272
|
-
|
|
273
|
-
'& .MuiListItemIcon-root': {
|
|
274
|
-
transform: 'none',
|
|
275
|
-
},
|
|
276
|
-
|
|
277
|
-
'& .MuiListItemText-primary': {
|
|
278
|
-
transform: 'none',
|
|
279
|
-
},
|
|
280
|
-
},
|
|
281
|
-
}),
|
|
282
|
-
}),
|
|
283
|
-
);
|
|
284
|
-
|
|
285
|
-
const LogoContainer = styled(Box)(({ theme }) => ({
|
|
286
|
-
padding: theme.spacing(2.5),
|
|
287
|
-
marginBottom: theme.spacing(2),
|
|
288
|
-
position: 'relative',
|
|
289
|
-
background: `linear-gradient(135deg, ${alpha(theme.palette.primary.main, 0.08)} 0%, ${alpha(theme.palette.primary.dark, 0.04)} 100%)`,
|
|
290
|
-
borderBottom: `2px solid ${alpha(theme.palette.primary.main, 0.2)}`,
|
|
291
|
-
overflow: 'hidden',
|
|
292
|
-
|
|
293
|
-
'&::before': {
|
|
294
|
-
content: '""',
|
|
295
|
-
position: 'absolute',
|
|
296
|
-
top: '-50%',
|
|
297
|
-
right: '-50%',
|
|
298
|
-
width: '200%',
|
|
299
|
-
height: '200%',
|
|
300
|
-
background: `radial-gradient(circle, ${alpha(theme.palette.primary.light, 0.1)} 0%, transparent 70%)`,
|
|
301
|
-
animation: `${slideIn} 1s ease-out`,
|
|
302
|
-
},
|
|
303
|
-
|
|
304
|
-
'& > *': {
|
|
305
|
-
position: 'relative',
|
|
306
|
-
zIndex: 1,
|
|
307
|
-
},
|
|
308
|
-
}));
|
|
309
|
-
|
|
310
|
-
const CollapseButton = styled(ListItemButton)(({ theme }) => ({
|
|
311
|
-
borderRadius: theme.spacing(1.5),
|
|
312
|
-
margin: theme.spacing(1),
|
|
313
|
-
background: `linear-gradient(135deg, ${alpha(theme.palette.primary.main, 0.08)} 0%, ${alpha(theme.palette.primary.dark, 0.04)} 100%)`,
|
|
314
|
-
border: `1px solid ${alpha(theme.palette.primary.main, 0.2)}`,
|
|
315
|
-
transition: 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
|
|
316
13
|
|
|
317
|
-
'&:hover': {
|
|
318
|
-
backgroundColor: alpha(theme.palette.primary.main, 0.12),
|
|
319
|
-
transform: 'scale(1.05)',
|
|
320
|
-
boxShadow: `0 6px 20px ${alpha(theme.palette.primary.main, 0.2)}`,
|
|
321
14
|
|
|
322
|
-
'& .MuiListItemIcon-root': {
|
|
323
|
-
transform: 'rotate(180deg)',
|
|
324
|
-
transition: 'transform 0.3s ease',
|
|
325
|
-
},
|
|
326
|
-
},
|
|
327
|
-
|
|
328
|
-
'&:active': {
|
|
329
|
-
transform: 'scale(0.98)',
|
|
330
|
-
},
|
|
331
|
-
}));
|
|
332
15
|
|
|
333
|
-
const megaMenuSlide = keyframes`
|
|
334
|
-
from {
|
|
335
|
-
opacity: 0;
|
|
336
|
-
transform: translateY(20px);
|
|
337
|
-
}
|
|
338
|
-
to {
|
|
339
|
-
opacity: 1;
|
|
340
|
-
transform: translateY(0);
|
|
341
|
-
}
|
|
342
|
-
`;
|
|
343
16
|
|
|
344
|
-
const MegaMenuSection = styled(Box)(({ theme }) => ({
|
|
345
|
-
padding: theme.spacing(3),
|
|
346
|
-
borderRadius: theme.spacing(2),
|
|
347
|
-
background: `linear-gradient(145deg, ${theme.palette.background.paper} 0%, ${alpha(theme.palette.background.default, 0.9)} 100%)`,
|
|
348
|
-
boxShadow: `0 10px 30px ${alpha(theme.palette.common.black, 0.08)}`,
|
|
349
|
-
border: `1px solid ${alpha(theme.palette.divider, 0.08)}`,
|
|
350
|
-
position: 'relative',
|
|
351
|
-
overflow: 'hidden',
|
|
352
|
-
animation: `${megaMenuSlide} 0.5s ease-out`,
|
|
353
|
-
animationFillMode: 'both',
|
|
354
17
|
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
right: 0,
|
|
361
|
-
height: '3px',
|
|
362
|
-
background: `linear-gradient(90deg, ${theme.palette.primary.main} 0%, ${theme.palette.primary.light} 50%, ${theme.palette.primary.main} 100%)`,
|
|
363
|
-
backgroundSize: '200% 100%',
|
|
364
|
-
animation: 'shimmer 3s ease-in-out infinite',
|
|
365
|
-
},
|
|
366
|
-
|
|
367
|
-
'@keyframes shimmer': {
|
|
368
|
-
'0%': {
|
|
369
|
-
backgroundPosition: '200% 0',
|
|
370
|
-
},
|
|
371
|
-
'100%': {
|
|
372
|
-
backgroundPosition: '-200% 0',
|
|
373
|
-
},
|
|
374
|
-
},
|
|
375
|
-
|
|
376
|
-
'&:hover': {
|
|
377
|
-
transform: 'translateY(-4px)',
|
|
378
|
-
boxShadow: `0 15px 40px ${alpha(theme.palette.common.black, 0.12)}`,
|
|
379
|
-
transition: 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
|
|
380
|
-
},
|
|
381
|
-
|
|
382
|
-
'&:nth-of-type(1)': { animationDelay: '0.1s' },
|
|
383
|
-
'&:nth-of-type(2)': { animationDelay: '0.2s' },
|
|
384
|
-
'&:nth-of-type(3)': { animationDelay: '0.3s' },
|
|
385
|
-
'&:nth-of-type(4)': { animationDelay: '0.4s' },
|
|
386
|
-
}));
|
|
387
|
-
|
|
388
|
-
interface MenuItemRendererProps {
|
|
389
|
-
item: NavigationMenuItem;
|
|
390
|
-
variant: string;
|
|
391
|
-
size: string;
|
|
18
|
+
// The mega-menu layout is a different shape from the list-based variants: a
|
|
19
|
+
// grid of titled sections rather than a single column.
|
|
20
|
+
// onItemClick and dataTestId are not on NavigationMenuProps; they arrive through
|
|
21
|
+
// the rest props and are forwarded to the item renderer, so they are named here.
|
|
22
|
+
type MegaMenuLayoutProps = NavigationMenuProps & {
|
|
392
23
|
collapsed: boolean;
|
|
393
|
-
minimal: boolean;
|
|
394
|
-
level: number;
|
|
395
24
|
onItemClick?: (item: NavigationMenuItem) => void;
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
const MenuItemRenderer: React.FC<MenuItemRendererProps> = ({
|
|
399
|
-
item,
|
|
400
|
-
variant,
|
|
401
|
-
size,
|
|
402
|
-
collapsed,
|
|
403
|
-
minimal,
|
|
404
|
-
level,
|
|
405
|
-
onItemClick,
|
|
406
|
-
}) => {
|
|
407
|
-
const [open, setOpen] = useState(false);
|
|
408
|
-
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null);
|
|
409
|
-
const closeTimerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
410
|
-
const hasChildren = item.children && item.children.length > 0;
|
|
411
|
-
|
|
412
|
-
const handleClick = (event: React.MouseEvent<HTMLElement>) => {
|
|
413
|
-
if (hasChildren && variant !== 'horizontal') {
|
|
414
|
-
setOpen(!open);
|
|
415
|
-
}
|
|
416
|
-
if (item.onClick) {
|
|
417
|
-
item.onClick(event);
|
|
418
|
-
}
|
|
419
|
-
if (onItemClick) {
|
|
420
|
-
onItemClick(item);
|
|
421
|
-
}
|
|
422
|
-
};
|
|
423
|
-
|
|
424
|
-
const clearCloseTimer = () => {
|
|
425
|
-
if (closeTimerRef.current) {
|
|
426
|
-
clearTimeout(closeTimerRef.current);
|
|
427
|
-
closeTimerRef.current = null;
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
const handleMouseEnter = (event: React.MouseEvent<HTMLElement>) => {
|
|
432
|
-
if (hasChildren && variant === 'horizontal') {
|
|
433
|
-
clearCloseTimer();
|
|
434
|
-
setAnchorEl(event.currentTarget);
|
|
435
|
-
}
|
|
436
|
-
};
|
|
437
|
-
|
|
438
|
-
const handleMouseLeave = () => {
|
|
439
|
-
if (variant === 'horizontal' && hasChildren) {
|
|
440
|
-
// Delay closing to allow user to move to popover
|
|
441
|
-
closeTimerRef.current = setTimeout(() => {
|
|
442
|
-
setAnchorEl(null);
|
|
443
|
-
}, 150);
|
|
444
|
-
}
|
|
445
|
-
};
|
|
446
|
-
|
|
447
|
-
const handlePopoverMouseEnter = () => {
|
|
448
|
-
clearCloseTimer();
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
const handlePopoverMouseLeave = () => {
|
|
452
|
-
setAnchorEl(null);
|
|
453
|
-
};
|
|
454
|
-
|
|
455
|
-
// Cleanup timer on unmount
|
|
456
|
-
React.useEffect(() => {
|
|
457
|
-
return () => {
|
|
458
|
-
clearCloseTimer();
|
|
459
|
-
};
|
|
460
|
-
}, []);
|
|
461
|
-
|
|
462
|
-
const itemContent = (
|
|
463
|
-
<StyledListItem key={item.id} variant={variant} active={item.active} size={size} level={level}>
|
|
464
|
-
<StyledListItemButton
|
|
465
|
-
variant={variant}
|
|
466
|
-
active={item.active}
|
|
467
|
-
size={size}
|
|
468
|
-
collapsed={collapsed}
|
|
469
|
-
minimal={minimal}
|
|
470
|
-
disabled={item.disabled}
|
|
471
|
-
onClick={handleClick}
|
|
472
|
-
onMouseEnter={handleMouseEnter}
|
|
473
|
-
onMouseLeave={handleMouseLeave}
|
|
474
|
-
{...(item.href && !hasChildren
|
|
475
|
-
? {
|
|
476
|
-
component: 'a' as React.ElementType,
|
|
477
|
-
href: item.href,
|
|
478
|
-
target: item.target,
|
|
479
|
-
}
|
|
480
|
-
: {})}
|
|
481
|
-
>
|
|
482
|
-
{item.icon && (
|
|
483
|
-
<ListItemIcon
|
|
484
|
-
sx={{
|
|
485
|
-
minWidth: collapsed ? 0 : 40,
|
|
486
|
-
justifyContent: 'center',
|
|
487
|
-
transition: 'all 0.3s ease',
|
|
488
|
-
'& svg': {
|
|
489
|
-
filter: item.active ? 'drop-shadow(0 2px 8px rgba(0,0,0,0.15))' : 'none',
|
|
490
|
-
transition: 'all 0.3s ease',
|
|
491
|
-
},
|
|
492
|
-
}}
|
|
493
|
-
>
|
|
494
|
-
<Grow in={true} timeout={600}>
|
|
495
|
-
<Box>{item.icon}</Box>
|
|
496
|
-
</Grow>
|
|
497
|
-
</ListItemIcon>
|
|
498
|
-
)}
|
|
499
|
-
{!collapsed && (
|
|
500
|
-
<Fade in={!collapsed} timeout={400}>
|
|
501
|
-
<Box sx={{ display: 'flex', alignItems: 'center', width: '100%', gap: 1 }}>
|
|
502
|
-
<ListItemText
|
|
503
|
-
primary={item.label}
|
|
504
|
-
secondary={item.description}
|
|
505
|
-
sx={{
|
|
506
|
-
flex: 1,
|
|
507
|
-
minWidth: 0, // Allows text truncation if needed
|
|
508
|
-
}}
|
|
509
|
-
slotProps={{
|
|
510
|
-
primary: {
|
|
511
|
-
variant: size === 'sm' ? 'body2' : size === 'lg' ? 'h6' : 'body1',
|
|
512
|
-
sx: {
|
|
513
|
-
fontWeight: item.active ? 600 : 400,
|
|
514
|
-
transition: 'all 0.3s ease',
|
|
515
|
-
},
|
|
516
|
-
},
|
|
517
|
-
secondary: {
|
|
518
|
-
sx: {
|
|
519
|
-
opacity: 0.7,
|
|
520
|
-
transition: 'all 0.3s ease',
|
|
521
|
-
},
|
|
522
|
-
},
|
|
523
|
-
}}
|
|
524
|
-
/>
|
|
525
|
-
{item.badge && (
|
|
526
|
-
<Box
|
|
527
|
-
component="span"
|
|
528
|
-
sx={{
|
|
529
|
-
flexShrink: 0,
|
|
530
|
-
display: 'inline-flex',
|
|
531
|
-
alignItems: 'center',
|
|
532
|
-
justifyContent: 'center',
|
|
533
|
-
minWidth: 20,
|
|
534
|
-
height: 20,
|
|
535
|
-
px: 0.75,
|
|
536
|
-
borderRadius: '10px',
|
|
537
|
-
fontSize: '0.75rem',
|
|
538
|
-
fontWeight: 600,
|
|
539
|
-
color: '#fff',
|
|
540
|
-
background: 'linear-gradient(135deg, #ff5252 0%, #ff1744 100%)',
|
|
541
|
-
boxShadow: '0 2px 8px rgba(255, 23, 68, 0.4)',
|
|
542
|
-
animation:
|
|
543
|
-
typeof item.badge === 'number' && item.badge > 0
|
|
544
|
-
? `${pulseGlow} 2s infinite`
|
|
545
|
-
: 'none',
|
|
546
|
-
}}
|
|
547
|
-
>
|
|
548
|
-
{item.badge}
|
|
549
|
-
</Box>
|
|
550
|
-
)}
|
|
551
|
-
{hasChildren && (
|
|
552
|
-
<Box
|
|
553
|
-
sx={{
|
|
554
|
-
display: 'flex',
|
|
555
|
-
alignItems: 'center',
|
|
556
|
-
flexShrink: 0, // Prevents expand icon from shrinking
|
|
557
|
-
transition: 'transform 0.3s ease',
|
|
558
|
-
transform: open ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
559
|
-
}}
|
|
560
|
-
>
|
|
561
|
-
{variant === 'horizontal' ? <ChevronRight fontSize="small" /> : <ExpandMore />}
|
|
562
|
-
</Box>
|
|
563
|
-
)}
|
|
564
|
-
</Box>
|
|
565
|
-
</Fade>
|
|
566
|
-
)}
|
|
567
|
-
</StyledListItemButton>
|
|
568
|
-
</StyledListItem>
|
|
569
|
-
);
|
|
25
|
+
dataTestId?: string;
|
|
26
|
+
};
|
|
570
27
|
|
|
571
|
-
|
|
572
|
-
|
|
28
|
+
const MegaMenuLayout = React.forwardRef<HTMLDivElement, MegaMenuLayoutProps>(
|
|
29
|
+
(
|
|
30
|
+
{
|
|
31
|
+
variant,
|
|
32
|
+
logo,
|
|
33
|
+
items,
|
|
34
|
+
size,
|
|
35
|
+
minimal,
|
|
36
|
+
dataTestId: _dataTestId,
|
|
37
|
+
className,
|
|
38
|
+
maxWidth,
|
|
39
|
+
style,
|
|
40
|
+
...props
|
|
41
|
+
},
|
|
42
|
+
ref,
|
|
43
|
+
) => {
|
|
573
44
|
return (
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
}}
|
|
588
|
-
|
|
45
|
+
<NavigationShell
|
|
46
|
+
ref={ref}
|
|
47
|
+
variant={variant}
|
|
48
|
+
minimal={minimal}
|
|
49
|
+
className={className}
|
|
50
|
+
style={{ maxWidth, ...style }}
|
|
51
|
+
{...props}
|
|
52
|
+
>
|
|
53
|
+
<Paper
|
|
54
|
+
elevation={minimal ? 0 : 1}
|
|
55
|
+
sx={{
|
|
56
|
+
width: '100%',
|
|
57
|
+
overflow: 'hidden',
|
|
58
|
+
background: minimal ? 'transparent' : undefined }}
|
|
59
|
+
>
|
|
60
|
+
{logo && <LogoBar>{logo}</LogoBar>}
|
|
61
|
+
<Box
|
|
589
62
|
sx={{
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
onMouseEnter: handlePopoverMouseEnter,
|
|
595
|
-
onMouseLeave: handlePopoverMouseLeave,
|
|
596
|
-
sx: {
|
|
597
|
-
pointerEvents: 'auto',
|
|
598
|
-
mt: 0.5,
|
|
599
|
-
borderRadius: 2,
|
|
600
|
-
boxShadow: (theme) => `0 12px 40px ${alpha(theme.palette.common.black, 0.15)}`,
|
|
601
|
-
border: (theme) => `1px solid ${alpha(theme.palette.divider, 0.1)}`,
|
|
602
|
-
background: (theme) =>
|
|
603
|
-
`linear-gradient(145deg, ${theme.palette.background.paper} 0%, ${alpha(theme.palette.background.default, 0.95)} 100%)`,
|
|
604
|
-
backdropFilter: 'blur(10px)',
|
|
605
|
-
minWidth: 200,
|
|
606
|
-
},
|
|
607
|
-
},
|
|
608
|
-
}}
|
|
63
|
+
display: 'grid',
|
|
64
|
+
gridTemplateColumns: 'repeat(auto-fit, minmax(280px, 1fr))',
|
|
65
|
+
gap: 3,
|
|
66
|
+
p: 3 }}
|
|
609
67
|
>
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
68
|
+
{items.map((section, sectionIndex) => (
|
|
69
|
+
<NavigationMegaSection
|
|
70
|
+
key={section.id}
|
|
71
|
+
section={section}
|
|
72
|
+
sectionIndex={sectionIndex}
|
|
73
|
+
variant={variant}
|
|
74
|
+
size={size}
|
|
75
|
+
minimal={minimal}
|
|
76
|
+
/>
|
|
77
|
+
))}
|
|
78
|
+
</Box>
|
|
79
|
+
</Paper>
|
|
80
|
+
</NavigationShell>
|
|
81
|
+
);
|
|
82
|
+
},
|
|
83
|
+
);
|
|
613
84
|
|
|
614
|
-
|
|
615
|
-
if (childHasChildren) {
|
|
616
|
-
return renderMenuItem(child, 'vertical', size, false, minimal, 0, onItemClick);
|
|
617
|
-
}
|
|
85
|
+
MegaMenuLayout.displayName = 'MegaMenuLayout';
|
|
618
86
|
|
|
619
|
-
|
|
620
|
-
return (
|
|
621
|
-
<Box
|
|
622
|
-
key={child.id}
|
|
623
|
-
onClick={() => {
|
|
624
|
-
clearCloseTimer();
|
|
625
|
-
setAnchorEl(null);
|
|
626
|
-
}}
|
|
627
|
-
>
|
|
628
|
-
{renderMenuItem(child, 'vertical', size, false, minimal, 0, onItemClick)}
|
|
629
|
-
</Box>
|
|
630
|
-
);
|
|
631
|
-
})}
|
|
632
|
-
</List>
|
|
633
|
-
</Popover>
|
|
634
|
-
</React.Fragment>
|
|
635
|
-
);
|
|
636
|
-
}
|
|
87
|
+
type NavigationDefaultedKeys = 'variant' | 'size' | 'minimal' | 'collapsible' | 'showDividers';
|
|
637
88
|
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
return (
|
|
641
|
-
<React.Fragment key={item.id}>
|
|
642
|
-
{itemContent}
|
|
643
|
-
{!collapsed && (
|
|
644
|
-
<Collapse in={open} timeout="auto" unmountOnExit>
|
|
645
|
-
<List component="div" disablePadding>
|
|
646
|
-
{item.children?.map((child) =>
|
|
647
|
-
renderMenuItem(child, variant, size, collapsed, minimal, level + 1, onItemClick),
|
|
648
|
-
)}
|
|
649
|
-
</List>
|
|
650
|
-
</Collapse>
|
|
651
|
-
)}
|
|
652
|
-
</React.Fragment>
|
|
653
|
-
);
|
|
654
|
-
}
|
|
89
|
+
type ResolvedNavigationProps = NavigationMenuProps &
|
|
90
|
+
Required<Pick<NavigationMenuProps, NavigationDefaultedKeys>>;
|
|
655
91
|
|
|
656
|
-
|
|
657
|
-
|
|
92
|
+
const NAVIGATION_DEFAULTS: Pick<NavigationMenuProps, NavigationDefaultedKeys> = {
|
|
93
|
+
variant: 'vertical',
|
|
94
|
+
size: 'md',
|
|
95
|
+
minimal: false,
|
|
96
|
+
collapsible: false,
|
|
97
|
+
showDividers: false };
|
|
658
98
|
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
)
|
|
668
|
-
<
|
|
669
|
-
key={item.id}
|
|
670
|
-
item={item}
|
|
671
|
-
variant={variant}
|
|
672
|
-
size={size}
|
|
673
|
-
collapsed={collapsed}
|
|
674
|
-
minimal={minimal}
|
|
675
|
-
level={level}
|
|
676
|
-
onItemClick={onItemClick}
|
|
677
|
-
/>
|
|
678
|
-
);
|
|
99
|
+
// Strips explicitly-undefined props before the merge, so `prop={undefined}` still
|
|
100
|
+
// falls back to the default exactly as a destructuring default would. Applied as
|
|
101
|
+
// a merge rather than destructuring defaults, which would otherwise put five
|
|
102
|
+
// branches into the component's own complexity budget.
|
|
103
|
+
const resolveProps = (props: NavigationMenuProps): ResolvedNavigationProps =>
|
|
104
|
+
({
|
|
105
|
+
...NAVIGATION_DEFAULTS,
|
|
106
|
+
...(Object.fromEntries(
|
|
107
|
+
Object.entries(props).filter(([, value]) => value !== undefined),
|
|
108
|
+
) as Partial<NavigationMenuProps>) }) as ResolvedNavigationProps;
|
|
679
109
|
|
|
680
110
|
export const NavigationMenu = React.forwardRef<HTMLDivElement, NavigationMenuProps>(
|
|
681
|
-
(
|
|
682
|
-
{
|
|
683
|
-
variant
|
|
111
|
+
(componentProps, ref) => {
|
|
112
|
+
const {
|
|
113
|
+
variant,
|
|
684
114
|
items,
|
|
685
|
-
size
|
|
686
|
-
minimal
|
|
687
|
-
collapsible
|
|
115
|
+
size,
|
|
116
|
+
minimal,
|
|
117
|
+
collapsible,
|
|
688
118
|
collapsed: controlledCollapsed,
|
|
689
119
|
onCollapseChange,
|
|
690
120
|
logo,
|
|
691
121
|
endContent,
|
|
692
122
|
maxWidth,
|
|
693
|
-
showDividers
|
|
123
|
+
showDividers,
|
|
694
124
|
className,
|
|
695
125
|
style,
|
|
696
126
|
...props
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
) => {
|
|
127
|
+
} = resolveProps(componentProps);
|
|
128
|
+
|
|
700
129
|
const [internalCollapsed, setInternalCollapsed] = useState(false);
|
|
701
130
|
|
|
131
|
+
// Controlled when the caller passes `collapsed`, uncontrolled otherwise.
|
|
702
132
|
const isControlled = controlledCollapsed !== undefined;
|
|
703
133
|
const collapsed = isControlled ? controlledCollapsed : internalCollapsed;
|
|
704
134
|
|
|
705
135
|
const handleCollapseToggle = () => {
|
|
706
|
-
if (!isControlled)
|
|
707
|
-
setInternalCollapsed(!collapsed);
|
|
708
|
-
}
|
|
136
|
+
if (!isControlled) setInternalCollapsed(!collapsed);
|
|
709
137
|
onCollapseChange?.(!collapsed);
|
|
710
138
|
};
|
|
711
139
|
|
|
712
140
|
if (variant === 'mega') {
|
|
713
141
|
return (
|
|
714
|
-
<
|
|
142
|
+
<MegaMenuLayout
|
|
715
143
|
ref={ref}
|
|
716
144
|
variant={variant}
|
|
145
|
+
collapsed={collapsed}
|
|
146
|
+
logo={logo}
|
|
147
|
+
items={items}
|
|
148
|
+
size={size}
|
|
717
149
|
minimal={minimal}
|
|
718
150
|
className={className}
|
|
719
|
-
|
|
151
|
+
maxWidth={maxWidth}
|
|
152
|
+
style={style}
|
|
720
153
|
{...props}
|
|
721
|
-
|
|
722
|
-
<Paper
|
|
723
|
-
elevation={minimal ? 0 : 1}
|
|
724
|
-
sx={{
|
|
725
|
-
width: '100%',
|
|
726
|
-
overflow: 'hidden',
|
|
727
|
-
background: minimal ? 'transparent' : undefined,
|
|
728
|
-
}}
|
|
729
|
-
>
|
|
730
|
-
{logo && <LogoContainer>{logo}</LogoContainer>}
|
|
731
|
-
<Box
|
|
732
|
-
sx={{
|
|
733
|
-
display: 'grid',
|
|
734
|
-
gridTemplateColumns: 'repeat(auto-fit, minmax(280px, 1fr))',
|
|
735
|
-
gap: 3,
|
|
736
|
-
p: 3,
|
|
737
|
-
}}
|
|
738
|
-
>
|
|
739
|
-
{items.map((section, sectionIndex) => (
|
|
740
|
-
<MegaMenuSection key={section.id}>
|
|
741
|
-
<Typography
|
|
742
|
-
variant="h6"
|
|
743
|
-
sx={{
|
|
744
|
-
mb: 2.5,
|
|
745
|
-
color: 'primary.main',
|
|
746
|
-
fontWeight: 600,
|
|
747
|
-
position: 'relative',
|
|
748
|
-
paddingBottom: 1,
|
|
749
|
-
|
|
750
|
-
'&::after': {
|
|
751
|
-
content: '""',
|
|
752
|
-
position: 'absolute',
|
|
753
|
-
bottom: 0,
|
|
754
|
-
left: 0,
|
|
755
|
-
width: '40px',
|
|
756
|
-
height: '3px',
|
|
757
|
-
background: (theme) =>
|
|
758
|
-
`linear-gradient(90deg, ${theme.palette.primary.main} 0%, transparent 100%)`,
|
|
759
|
-
borderRadius: '2px',
|
|
760
|
-
},
|
|
761
|
-
}}
|
|
762
|
-
>
|
|
763
|
-
{section.label}
|
|
764
|
-
</Typography>
|
|
765
|
-
<List sx={{ p: 0 }}>
|
|
766
|
-
{section.children?.map((item, itemIndex) => (
|
|
767
|
-
<Box
|
|
768
|
-
key={item.id}
|
|
769
|
-
sx={{
|
|
770
|
-
animation: `${slideIn} 0.4s ease-out`,
|
|
771
|
-
animationDelay: `${sectionIndex * 0.1 + itemIndex * 0.05}s`,
|
|
772
|
-
animationFillMode: 'both',
|
|
773
|
-
}}
|
|
774
|
-
>
|
|
775
|
-
{renderMenuItem(item, variant, size, false, minimal, 0)}
|
|
776
|
-
</Box>
|
|
777
|
-
))}
|
|
778
|
-
</List>
|
|
779
|
-
</MegaMenuSection>
|
|
780
|
-
))}
|
|
781
|
-
</Box>
|
|
782
|
-
</Paper>
|
|
783
|
-
</NavigationContainer>
|
|
154
|
+
/>
|
|
784
155
|
);
|
|
785
156
|
}
|
|
786
157
|
|
|
787
158
|
return (
|
|
788
|
-
<
|
|
159
|
+
<NavigationShell
|
|
789
160
|
ref={ref}
|
|
790
161
|
variant={variant}
|
|
791
162
|
minimal={minimal}
|
|
@@ -794,79 +165,19 @@ export const NavigationMenu = React.forwardRef<HTMLDivElement, NavigationMenuPro
|
|
|
794
165
|
style={style}
|
|
795
166
|
{...props}
|
|
796
167
|
>
|
|
797
|
-
<
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
}
|
|
805
|
-
|
|
806
|
-
{
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
<MenuIcon />
|
|
811
|
-
</Box>
|
|
812
|
-
) : (
|
|
813
|
-
logo
|
|
814
|
-
)}
|
|
815
|
-
</LogoContainer>
|
|
816
|
-
)}
|
|
817
|
-
|
|
818
|
-
{collapsible && variant === 'vertical' && (
|
|
819
|
-
<CollapseButton onClick={handleCollapseToggle}>
|
|
820
|
-
<ListItemIcon sx={{ minWidth: collapsed ? 0 : 40, justifyContent: 'center' }}>
|
|
821
|
-
<MenuIcon />
|
|
822
|
-
</ListItemIcon>
|
|
823
|
-
{!collapsed && <ListItemText primary="Collapse" />}
|
|
824
|
-
</CollapseButton>
|
|
825
|
-
)}
|
|
826
|
-
|
|
827
|
-
<StyledList variant={variant} size={size}>
|
|
828
|
-
{items.map((item, index) => (
|
|
829
|
-
<React.Fragment key={item.id}>
|
|
830
|
-
<Box
|
|
831
|
-
sx={{
|
|
832
|
-
animation: `${slideIn} 0.4s ease-out`,
|
|
833
|
-
animationDelay: `${index * 0.05}s`,
|
|
834
|
-
animationFillMode: 'both',
|
|
835
|
-
}}
|
|
836
|
-
>
|
|
837
|
-
{renderMenuItem(item, variant, size, collapsed, minimal, 0)}
|
|
838
|
-
</Box>
|
|
839
|
-
{showDividers && index < items.length - 1 && (
|
|
840
|
-
<Divider
|
|
841
|
-
sx={{
|
|
842
|
-
my: 1,
|
|
843
|
-
opacity: 0.5,
|
|
844
|
-
background: (theme) =>
|
|
845
|
-
`linear-gradient(90deg, transparent 0%, ${alpha(theme.palette.divider, 0.5)} 50%, transparent 100%)`,
|
|
846
|
-
}}
|
|
847
|
-
/>
|
|
848
|
-
)}
|
|
849
|
-
</React.Fragment>
|
|
850
|
-
))}
|
|
851
|
-
</StyledList>
|
|
852
|
-
|
|
853
|
-
{endContent && (
|
|
854
|
-
<Fade in={true} timeout={600}>
|
|
855
|
-
<Box
|
|
856
|
-
sx={{
|
|
857
|
-
mt: 'auto',
|
|
858
|
-
p: 2,
|
|
859
|
-
borderTop: (theme) => `1px solid ${alpha(theme.palette.divider, 0.1)}`,
|
|
860
|
-
background: (theme) =>
|
|
861
|
-
`linear-gradient(180deg, transparent 0%, ${alpha(theme.palette.background.default, 0.5)} 100%)`,
|
|
862
|
-
}}
|
|
863
|
-
>
|
|
864
|
-
{endContent}
|
|
865
|
-
</Box>
|
|
866
|
-
</Fade>
|
|
867
|
-
)}
|
|
868
|
-
</Paper>
|
|
869
|
-
</NavigationContainer>
|
|
168
|
+
<NavigationStandardBody
|
|
169
|
+
variant={variant}
|
|
170
|
+
size={size}
|
|
171
|
+
minimal={minimal}
|
|
172
|
+
collapsed={collapsed}
|
|
173
|
+
collapsible={collapsible}
|
|
174
|
+
showDividers={showDividers}
|
|
175
|
+
items={items}
|
|
176
|
+
logo={logo}
|
|
177
|
+
endContent={endContent}
|
|
178
|
+
onCollapseToggle={handleCollapseToggle}
|
|
179
|
+
/>
|
|
180
|
+
</NavigationShell>
|
|
870
181
|
);
|
|
871
182
|
},
|
|
872
183
|
);
|