@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
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { alpha } from '@mui/material';
|
|
2
|
+
import type { CSSObject, Theme } from '@mui/material/styles';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
bounceAnimation,
|
|
6
|
+
fadeInScaleAnimation,
|
|
7
|
+
glowPulseAnimation,
|
|
8
|
+
pulseAnimation,
|
|
9
|
+
shimmerAnimation } from './Badge.animations';
|
|
10
|
+
import { badgeVariantStyles } from './Badge.variants';
|
|
11
|
+
import type { BadgeSize, BadgeVariant } from './Badge.types';
|
|
12
|
+
|
|
13
|
+
export type BadgePalette = {
|
|
14
|
+
main: string;
|
|
15
|
+
light?: string;
|
|
16
|
+
dark?: string;
|
|
17
|
+
contrastText?: string;
|
|
18
|
+
};
|
|
19
|
+
export type BadgeSizeStyles = ReturnType<typeof getSizeStyles>;
|
|
20
|
+
|
|
21
|
+
const getColorFromTheme = (theme: Theme, color: string) => {
|
|
22
|
+
const colorMap: Record<string, ReturnType<typeof theme.palette.augmentColor>> = {
|
|
23
|
+
primary: theme.palette.primary,
|
|
24
|
+
secondary: theme.palette.secondary,
|
|
25
|
+
success: theme.palette.success,
|
|
26
|
+
warning: theme.palette.warning,
|
|
27
|
+
error: theme.palette.error,
|
|
28
|
+
info: theme.palette.info,
|
|
29
|
+
neutral: {
|
|
30
|
+
main: theme.palette.grey[600],
|
|
31
|
+
light: theme.palette.grey[400],
|
|
32
|
+
dark: theme.palette.grey[800],
|
|
33
|
+
contrastText: theme.palette.getContrastText(theme.palette.grey[600]) } };
|
|
34
|
+
|
|
35
|
+
return colorMap[color] || theme.palette.primary;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const getSizeStyles = (size: BadgeSize) => {
|
|
39
|
+
const sizeMap: Record<
|
|
40
|
+
BadgeSize,
|
|
41
|
+
{
|
|
42
|
+
minWidth: number;
|
|
43
|
+
height: number;
|
|
44
|
+
fontSize: string;
|
|
45
|
+
padding: string;
|
|
46
|
+
dotSize: number;
|
|
47
|
+
iconSize: string;
|
|
48
|
+
}
|
|
49
|
+
> = {
|
|
50
|
+
xs: {
|
|
51
|
+
minWidth: 14,
|
|
52
|
+
height: 14,
|
|
53
|
+
fontSize: '0.5rem',
|
|
54
|
+
padding: '0 3px',
|
|
55
|
+
dotSize: 6,
|
|
56
|
+
iconSize: '0.625rem' },
|
|
57
|
+
sm: {
|
|
58
|
+
minWidth: 16,
|
|
59
|
+
height: 16,
|
|
60
|
+
fontSize: '0.625rem',
|
|
61
|
+
padding: '0 4px',
|
|
62
|
+
dotSize: 8,
|
|
63
|
+
iconSize: '0.75rem' },
|
|
64
|
+
md: {
|
|
65
|
+
minWidth: 20,
|
|
66
|
+
height: 20,
|
|
67
|
+
fontSize: '0.75rem',
|
|
68
|
+
padding: '0 6px',
|
|
69
|
+
dotSize: 10,
|
|
70
|
+
iconSize: '0.875rem' },
|
|
71
|
+
lg: {
|
|
72
|
+
minWidth: 24,
|
|
73
|
+
height: 24,
|
|
74
|
+
fontSize: '0.875rem',
|
|
75
|
+
padding: '0 8px',
|
|
76
|
+
dotSize: 12,
|
|
77
|
+
iconSize: '1rem' } };
|
|
78
|
+
|
|
79
|
+
return sizeMap[size] || sizeMap.md;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const getAnchorOrigin = (position: string) => {
|
|
83
|
+
const positionMap: Record<string, { vertical: 'top' | 'bottom'; horizontal: 'left' | 'right' }> =
|
|
84
|
+
{
|
|
85
|
+
'top-right': { vertical: 'top', horizontal: 'right' },
|
|
86
|
+
'top-left': { vertical: 'top', horizontal: 'left' },
|
|
87
|
+
'bottom-right': { vertical: 'bottom', horizontal: 'right' },
|
|
88
|
+
'bottom-left': { vertical: 'bottom', horizontal: 'left' } };
|
|
89
|
+
|
|
90
|
+
return positionMap[position] || positionMap['top-right'];
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// Exactly one variant applies, so a lookup replaces ten mutually exclusive
|
|
94
|
+
// spreads inside the style object.
|
|
95
|
+
// The glow effect needs the badge colour as bare RGB components for a CSS
|
|
96
|
+
// variable, and the palette hands them over as hex or rgb().
|
|
97
|
+
const rgbValuesOf = (color: string): string => {
|
|
98
|
+
if (color.startsWith('#')) {
|
|
99
|
+
const hex = color.slice(1);
|
|
100
|
+
const [r, g, b] = [0, 2, 4].map((offset) => parseInt(hex.slice(offset, offset + 2), 16));
|
|
101
|
+
return `${r}, ${g}, ${b}`;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const match = color.match(/\d+/g);
|
|
105
|
+
if (match) return `${match[0]}, ${match[1]}, ${match[2]}`;
|
|
106
|
+
return '255, 255, 255';
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
// Glow and pulse combine into a third, distinct treatment rather than stacking.
|
|
110
|
+
const badgeLightingStyles = ({
|
|
111
|
+
glow,
|
|
112
|
+
pulse,
|
|
113
|
+
colorPalette }: {
|
|
114
|
+
glow?: boolean;
|
|
115
|
+
pulse?: boolean;
|
|
116
|
+
colorPalette: BadgePalette;
|
|
117
|
+
}): CSSObject => ({
|
|
118
|
+
// Glow effect
|
|
119
|
+
...(glow &&
|
|
120
|
+
!pulse && {
|
|
121
|
+
boxShadow: `0 0 15px 3px ${alpha(colorPalette.main, 0.5)}`,
|
|
122
|
+
filter: 'brightness(1.1)',
|
|
123
|
+
'&:hover': {
|
|
124
|
+
boxShadow: `0 0 20px 4px ${alpha(colorPalette.main, 0.6)}` } }),
|
|
125
|
+
|
|
126
|
+
// Pulse animation
|
|
127
|
+
...(pulse &&
|
|
128
|
+
!glow && {
|
|
129
|
+
animation: `${pulseAnimation} 2s ease-in-out infinite` }),
|
|
130
|
+
|
|
131
|
+
// Both glow and pulse
|
|
132
|
+
...(glow &&
|
|
133
|
+
pulse && {
|
|
134
|
+
animation: `${glowPulseAnimation} 2s ease-in-out infinite, ${pulseAnimation} 2s ease-in-out infinite`,
|
|
135
|
+
filter: 'brightness(1.1)',
|
|
136
|
+
}),
|
|
137
|
+
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const badgeAnimationStyles = ({
|
|
141
|
+
animate,
|
|
142
|
+
bounce,
|
|
143
|
+
shimmer,
|
|
144
|
+
glow: _glow,
|
|
145
|
+
pulse: _pulse,
|
|
146
|
+
customVariant,
|
|
147
|
+
colorPalette,
|
|
148
|
+
theme }: {
|
|
149
|
+
animate?: boolean;
|
|
150
|
+
bounce?: boolean;
|
|
151
|
+
shimmer?: boolean;
|
|
152
|
+
glow?: boolean;
|
|
153
|
+
pulse?: boolean;
|
|
154
|
+
customVariant?: BadgeVariant;
|
|
155
|
+
colorPalette: BadgePalette;
|
|
156
|
+
theme: Theme;
|
|
157
|
+
}): CSSObject => ({
|
|
158
|
+
...(animate &&
|
|
159
|
+
!bounce && {
|
|
160
|
+
animation: `${fadeInScaleAnimation} 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55)` }),
|
|
161
|
+
|
|
162
|
+
// Bounce animation
|
|
163
|
+
...(bounce && {
|
|
164
|
+
animation: `${bounceAnimation} 1s ease-in-out` }),
|
|
165
|
+
|
|
166
|
+
// Shimmer effect
|
|
167
|
+
...(shimmer && {
|
|
168
|
+
background:
|
|
169
|
+
customVariant === 'gradient'
|
|
170
|
+
? `linear-gradient(135deg, ${colorPalette.main} 0%, ${colorPalette.dark || colorPalette.main} 100%)`
|
|
171
|
+
: colorPalette.main,
|
|
172
|
+
backgroundSize: shimmer ? '1000px 100%' : 'auto',
|
|
173
|
+
position: 'relative',
|
|
174
|
+
overflow: 'hidden',
|
|
175
|
+
'&::after': {
|
|
176
|
+
content: '""',
|
|
177
|
+
position: 'absolute',
|
|
178
|
+
top: 0,
|
|
179
|
+
left: 0,
|
|
180
|
+
width: '100%',
|
|
181
|
+
height: '100%',
|
|
182
|
+
background: `linear-gradient(
|
|
183
|
+
90deg,
|
|
184
|
+
transparent,
|
|
185
|
+
${alpha(theme.palette.common.white, 0.4)},
|
|
186
|
+
transparent
|
|
187
|
+
)`,
|
|
188
|
+
animation: `${shimmerAnimation} 3s infinite` } }) });
|
|
189
|
+
|
|
190
|
+
// The badge chip's own styling, lifted out so the styled() callback just
|
|
191
|
+
// forwards its props.
|
|
192
|
+
interface BadgeStyleArgs {
|
|
193
|
+
theme: Theme;
|
|
194
|
+
customVariant?: BadgeVariant;
|
|
195
|
+
customSize?: BadgeSize;
|
|
196
|
+
customColor?: string;
|
|
197
|
+
glow?: boolean;
|
|
198
|
+
pulse?: boolean;
|
|
199
|
+
animate?: boolean;
|
|
200
|
+
shimmer?: boolean;
|
|
201
|
+
bounce?: boolean;
|
|
202
|
+
hasIcon?: boolean;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export const badgeStyles = ({
|
|
206
|
+
theme,
|
|
207
|
+
customVariant,
|
|
208
|
+
customSize = 'md',
|
|
209
|
+
customColor = 'primary',
|
|
210
|
+
glow,
|
|
211
|
+
pulse,
|
|
212
|
+
animate,
|
|
213
|
+
shimmer,
|
|
214
|
+
bounce,
|
|
215
|
+
hasIcon }: BadgeStyleArgs): CSSObject => {
|
|
216
|
+
const colorPalette = getColorFromTheme(theme, customColor);
|
|
217
|
+
const sizeStyles = getSizeStyles(customSize);
|
|
218
|
+
|
|
219
|
+
return {
|
|
220
|
+
'--glow-color': rgbValuesOf(colorPalette.main),
|
|
221
|
+
'& .MuiBadge-badge': {
|
|
222
|
+
transition: 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)',
|
|
223
|
+
fontWeight: 600,
|
|
224
|
+
border: `2px solid ${theme.palette.background.paper}`,
|
|
225
|
+
letterSpacing: '0.025em',
|
|
226
|
+
textTransform:
|
|
227
|
+
customVariant === 'gradient' || customVariant === 'glass' ? 'uppercase' : 'none',
|
|
228
|
+
willChange: 'transform, opacity',
|
|
229
|
+
backfaceVisibility: 'hidden',
|
|
230
|
+
|
|
231
|
+
// Outline variant
|
|
232
|
+
|
|
233
|
+
// Destructive variant
|
|
234
|
+
|
|
235
|
+
// Warning variant
|
|
236
|
+
|
|
237
|
+
// Adjust padding when icon is present
|
|
238
|
+
...badgeVariantStyles(theme, colorPalette, sizeStyles, customVariant),
|
|
239
|
+
...(hasIcon && {
|
|
240
|
+
paddingLeft: sizeStyles.padding.split(' ')[1],
|
|
241
|
+
display: 'inline-flex',
|
|
242
|
+
alignItems: 'center',
|
|
243
|
+
gap: '2px',
|
|
244
|
+
}),
|
|
245
|
+
|
|
246
|
+
// Animation on mount
|
|
247
|
+
...badgeAnimationStyles({
|
|
248
|
+
animate,
|
|
249
|
+
bounce,
|
|
250
|
+
shimmer,
|
|
251
|
+
glow,
|
|
252
|
+
pulse,
|
|
253
|
+
customVariant,
|
|
254
|
+
colorPalette,
|
|
255
|
+
theme }),
|
|
256
|
+
...badgeLightingStyles({ glow, pulse, colorPalette }),
|
|
257
|
+
|
|
258
|
+
'&:not(.MuiBadge-dot):hover': {
|
|
259
|
+
transform: 'scale(1.1)',
|
|
260
|
+
zIndex: 1 } } };
|
|
261
|
+
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Star,
|
|
9
|
-
} from '@mui/icons-material';
|
|
1
|
+
import CheckCircle from '@mui/icons-material/CheckCircle';
|
|
2
|
+
import Mail from '@mui/icons-material/Mail';
|
|
3
|
+
import Notifications from '@mui/icons-material/Notifications';
|
|
4
|
+
import Person from '@mui/icons-material/Person';
|
|
5
|
+
import Settings from '@mui/icons-material/Settings';
|
|
6
|
+
import ShoppingCart from '@mui/icons-material/ShoppingCart';
|
|
7
|
+
import Star from '@mui/icons-material/Star';
|
|
10
8
|
import { Box, Button, IconButton } from '@mui/material';
|
|
11
9
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
12
10
|
import React, { useState } from 'react';
|
|
@@ -95,8 +93,7 @@ export const CountVariantTest: Story = {
|
|
|
95
93
|
|
|
96
94
|
await step('Zero count should be hidden when showZero is false', async () => {
|
|
97
95
|
// Initially showZero is false and count is 0
|
|
98
|
-
|
|
99
|
-
await expect(badge).not.toBeInTheDocument();
|
|
96
|
+
await waitFor(() => expect(canvas.queryByText('0')).not.toBeInTheDocument());
|
|
100
97
|
});
|
|
101
98
|
|
|
102
99
|
await step('Toggle to show zero', async () => {
|
|
@@ -191,27 +188,30 @@ export const KeyboardNavigation: Story = {
|
|
|
191
188
|
const firstButton = canvas.getByTestId('first-focusable');
|
|
192
189
|
const secondButton = canvas.getByTestId('second-focusable');
|
|
193
190
|
|
|
194
|
-
//
|
|
195
|
-
|
|
196
|
-
await
|
|
191
|
+
// Tab in from the body — the old .focus() call plus assertion only proved
|
|
192
|
+
// the DOM honours focus(), not that this button is the first tab stop.
|
|
193
|
+
await userEvent.tab();
|
|
194
|
+
await waitFor(() => expect(firstButton).toHaveFocus());
|
|
197
195
|
|
|
198
196
|
// Tab to next element
|
|
199
197
|
await userEvent.tab();
|
|
200
|
-
await expect(secondButton).toHaveFocus();
|
|
198
|
+
await waitFor(() => expect(secondButton).toHaveFocus());
|
|
201
199
|
});
|
|
202
200
|
|
|
203
201
|
await step('Tab navigation backward', async () => {
|
|
204
202
|
await userEvent.tab({ shift: true });
|
|
205
203
|
const firstButton = canvas.getByTestId('first-focusable');
|
|
206
|
-
await expect(firstButton).toHaveFocus();
|
|
204
|
+
await waitFor(() => expect(firstButton).toHaveFocus());
|
|
207
205
|
});
|
|
208
206
|
|
|
209
207
|
await step('Enter key activation on focused button', async () => {
|
|
210
208
|
const button = canvas.getByTestId('first-focusable');
|
|
211
|
-
button.
|
|
209
|
+
// Focus is already back on this button from the shift-tab above.
|
|
210
|
+
await waitFor(() => expect(button).toHaveFocus());
|
|
211
|
+
|
|
212
212
|
await userEvent.keyboard('{Enter}');
|
|
213
|
-
//
|
|
214
|
-
await expect(button).toHaveFocus();
|
|
213
|
+
// Focus must survive activation rather than jump elsewhere.
|
|
214
|
+
await waitFor(() => expect(button).toHaveFocus());
|
|
215
215
|
});
|
|
216
216
|
},
|
|
217
217
|
};
|
|
@@ -1007,15 +1007,15 @@ export const FocusManagementTest: Story = {
|
|
|
1007
1007
|
});
|
|
1008
1008
|
|
|
1009
1009
|
await step('Tab through focusable elements', async () => {
|
|
1010
|
-
//
|
|
1010
|
+
// Tab in from the body to reach the first item.
|
|
1011
1011
|
const firstItem = canvas.getByTestId('focus-item-0');
|
|
1012
|
-
|
|
1013
|
-
await expect(firstItem).toHaveFocus();
|
|
1012
|
+
await userEvent.tab();
|
|
1013
|
+
await waitFor(() => expect(firstItem).toHaveFocus());
|
|
1014
1014
|
|
|
1015
1015
|
// Tab to second item
|
|
1016
1016
|
await userEvent.tab();
|
|
1017
1017
|
const secondItem = canvas.getByTestId('focus-item-1');
|
|
1018
|
-
await expect(secondItem).toHaveFocus();
|
|
1018
|
+
await waitFor(() => expect(secondItem).toHaveFocus());
|
|
1019
1019
|
|
|
1020
1020
|
const activeDisplay = canvas.getByTestId('active-index');
|
|
1021
1021
|
await expect(activeDisplay).toHaveTextContent('Active: 1');
|
|
@@ -1023,7 +1023,7 @@ export const FocusManagementTest: Story = {
|
|
|
1023
1023
|
// Tab to third item
|
|
1024
1024
|
await userEvent.tab();
|
|
1025
1025
|
const thirdItem = canvas.getByTestId('focus-item-2');
|
|
1026
|
-
await expect(thirdItem).toHaveFocus();
|
|
1026
|
+
await waitFor(() => expect(thirdItem).toHaveFocus());
|
|
1027
1027
|
|
|
1028
1028
|
await expect(canvas.getByTestId('active-index')).toHaveTextContent('Active: 2');
|
|
1029
1029
|
});
|
|
@@ -1031,7 +1031,7 @@ export const FocusManagementTest: Story = {
|
|
|
1031
1031
|
await step('Reverse tab navigation', async () => {
|
|
1032
1032
|
await userEvent.tab({ shift: true });
|
|
1033
1033
|
const secondItem = canvas.getByTestId('focus-item-1');
|
|
1034
|
-
await expect(secondItem).toHaveFocus();
|
|
1034
|
+
await waitFor(() => expect(secondItem).toHaveFocus());
|
|
1035
1035
|
|
|
1036
1036
|
const activeDisplay = canvas.getByTestId('active-index');
|
|
1037
1037
|
await expect(activeDisplay).toHaveTextContent('Active: 1');
|
|
@@ -1103,9 +1103,9 @@ export const WCAGComplianceTest: Story = {
|
|
|
1103
1103
|
const button = canvas.getByTestId('wcag-button');
|
|
1104
1104
|
await expect(button).toHaveAttribute('aria-describedby', 'badge-description');
|
|
1105
1105
|
|
|
1106
|
-
// Button should be focusable
|
|
1107
|
-
|
|
1108
|
-
await expect(button).toHaveFocus();
|
|
1106
|
+
// Button should be focusable — reached by keyboard, not by calling focus().
|
|
1107
|
+
await userEvent.tab();
|
|
1108
|
+
await waitFor(() => expect(button).toHaveFocus());
|
|
1109
1109
|
});
|
|
1110
1110
|
|
|
1111
1111
|
await step('Color contrast verification', async () => {
|
|
@@ -1122,15 +1122,16 @@ export const WCAGComplianceTest: Story = {
|
|
|
1122
1122
|
|
|
1123
1123
|
await step('Keyboard activation', async () => {
|
|
1124
1124
|
const button = canvas.getByTestId('wcag-button');
|
|
1125
|
-
button.
|
|
1125
|
+
// Focus is already on the button from the previous step.
|
|
1126
|
+
await waitFor(() => expect(button).toHaveFocus());
|
|
1126
1127
|
|
|
1127
1128
|
// Should be activatable with Enter
|
|
1128
1129
|
await userEvent.keyboard('{Enter}');
|
|
1129
|
-
await expect(button).toHaveFocus();
|
|
1130
|
+
await waitFor(() => expect(button).toHaveFocus());
|
|
1130
1131
|
|
|
1131
1132
|
// Should be activatable with Space
|
|
1132
1133
|
await userEvent.keyboard(' ');
|
|
1133
|
-
await expect(button).toHaveFocus();
|
|
1134
|
+
await waitFor(() => expect(button).toHaveFocus());
|
|
1134
1135
|
});
|
|
1135
1136
|
},
|
|
1136
1137
|
};
|