@12-apps/ui 1.0.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 +806 -0
- package/components-guidelines.md +347 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/eslint.config.js +77 -0
- package/package.json +247 -0
- package/src/__tests__/package-wiring.test.ts +37 -0
- package/src/__tests__/setup.ts +1 -0
- package/src/__tests__/social-login-button.test.tsx +186 -0
- package/src/__tests__/user-avatar.test.tsx +195 -0
- package/src/button.tsx +22 -0
- package/src/components/command/__tests__/command.test.tsx +112 -0
- package/src/components/data-display/Alert/Alert.md +209 -0
- package/src/components/data-display/Alert/Alert.stories.tsx +561 -0
- package/src/components/data-display/Alert/Alert.test.stories.tsx +709 -0
- package/src/components/data-display/Alert/Alert.tsx +449 -0
- package/src/components/data-display/Alert/Alert.types.ts +79 -0
- package/src/components/data-display/Alert/index.ts +2 -0
- package/src/components/data-display/AlertDialog/AlertDialog.md +408 -0
- package/src/components/data-display/AlertDialog/AlertDialog.stories.tsx +360 -0
- package/src/components/data-display/AlertDialog/AlertDialog.test.stories.tsx +753 -0
- package/src/components/data-display/AlertDialog/AlertDialog.tsx +273 -0
- package/src/components/data-display/AlertDialog/AlertDialog.types.ts +74 -0
- package/src/components/data-display/AlertDialog/index.ts +2 -0
- package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.stories.tsx +230 -0
- package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.test.stories.tsx +270 -0
- package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.tsx +116 -0
- package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.types.ts +70 -0
- package/src/components/data-display/AsyncStateContainer/index.ts +2 -0
- package/src/components/data-display/Avatar/Avatar.md +568 -0
- package/src/components/data-display/Avatar/Avatar.stories.tsx +718 -0
- package/src/components/data-display/Avatar/Avatar.test.stories.tsx +820 -0
- package/src/components/data-display/Avatar/Avatar.tsx +507 -0
- package/src/components/data-display/Avatar/Avatar.types.ts +88 -0
- package/src/components/data-display/Avatar/index.ts +2 -0
- package/src/components/data-display/Badge/Badge.md +469 -0
- package/src/components/data-display/Badge/Badge.stories.tsx +1136 -0
- package/src/components/data-display/Badge/Badge.test.stories.tsx +1193 -0
- package/src/components/data-display/Badge/Badge.tsx +606 -0
- package/src/components/data-display/Badge/Badge.types.ts +118 -0
- package/src/components/data-display/Badge/index.ts +2 -0
- package/src/components/data-display/Banner/Banner.stories.tsx +524 -0
- package/src/components/data-display/Banner/Banner.test.stories.tsx +503 -0
- package/src/components/data-display/Banner/Banner.tsx +350 -0
- package/src/components/data-display/Banner/Banner.types.ts +41 -0
- package/src/components/data-display/Banner/banner.md +141 -0
- package/src/components/data-display/Banner/index.ts +2 -0
- package/src/components/data-display/Carousel/Carousel.md +815 -0
- package/src/components/data-display/Carousel/Carousel.stories.tsx +607 -0
- package/src/components/data-display/Carousel/Carousel.test.stories.tsx +691 -0
- package/src/components/data-display/Carousel/Carousel.tsx +765 -0
- package/src/components/data-display/Carousel/Carousel.types.ts +79 -0
- package/src/components/data-display/Carousel/index.ts +8 -0
- package/src/components/data-display/Chart/Chart.md +352 -0
- package/src/components/data-display/Chart/Chart.stories.tsx +568 -0
- package/src/components/data-display/Chart/Chart.test.stories.tsx +174 -0
- package/src/components/data-display/Chart/Chart.tsx +520 -0
- package/src/components/data-display/Chart/Chart.types.ts +65 -0
- package/src/components/data-display/Chart/index.ts +2 -0
- package/src/components/data-display/Chip/Chip.stories.tsx +251 -0
- package/src/components/data-display/Chip/Chip.test.stories.tsx +263 -0
- package/src/components/data-display/Chip/Chip.tsx +134 -0
- package/src/components/data-display/Chip/Chip.types.ts +51 -0
- package/src/components/data-display/Chip/chip.md +395 -0
- package/src/components/data-display/Chip/index.ts +2 -0
- package/src/components/data-display/DataGrid/DataGrid.md +602 -0
- package/src/components/data-display/DataGrid/DataGrid.stories.tsx +515 -0
- package/src/components/data-display/DataGrid/DataGrid.test.stories.tsx +659 -0
- package/src/components/data-display/DataGrid/DataGrid.tsx +743 -0
- package/src/components/data-display/DataGrid/DataGrid.types.ts +171 -0
- package/src/components/data-display/DataGrid/index.ts +21 -0
- package/src/components/data-display/DateTimeDisplay/DateTimeDisplay.tsx +197 -0
- package/src/components/data-display/DateTimeDisplay/DateTimeDisplay.types.ts +46 -0
- package/src/components/data-display/DateTimeDisplay/index.ts +2 -0
- package/src/components/data-display/DescriptionItem/DescriptionItem.md +226 -0
- package/src/components/data-display/DescriptionItem/DescriptionItem.stories.tsx +254 -0
- package/src/components/data-display/DescriptionItem/DescriptionItem.tsx +100 -0
- package/src/components/data-display/DescriptionItem/DescriptionItem.types.ts +1 -0
- package/src/components/data-display/DescriptionItem/index.ts +2 -0
- package/src/components/data-display/EmptyState/EmptyState.md +265 -0
- package/src/components/data-display/EmptyState/EmptyState.stories.tsx +282 -0
- package/src/components/data-display/EmptyState/EmptyState.test.stories.tsx +441 -0
- package/src/components/data-display/EmptyState/EmptyState.tsx +180 -0
- package/src/components/data-display/EmptyState/EmptyState.types.ts +31 -0
- package/src/components/data-display/EmptyState/index.ts +2 -0
- package/src/components/data-display/ErrorState/ErrorState.stories.tsx +110 -0
- package/src/components/data-display/ErrorState/ErrorState.test.stories.tsx +133 -0
- package/src/components/data-display/ErrorState/ErrorState.tsx +118 -0
- package/src/components/data-display/ErrorState/ErrorState.types.ts +45 -0
- package/src/components/data-display/ErrorState/index.ts +2 -0
- package/src/components/data-display/HoverCard/HoverCard.md +389 -0
- package/src/components/data-display/HoverCard/HoverCard.stories.tsx +648 -0
- package/src/components/data-display/HoverCard/HoverCard.test.stories.tsx +929 -0
- package/src/components/data-display/HoverCard/HoverCard.tsx +657 -0
- package/src/components/data-display/HoverCard/HoverCard.types.ts +116 -0
- package/src/components/data-display/HoverCard/index.ts +2 -0
- package/src/components/data-display/InteractiveTooltip/InteractiveTooltip.md +532 -0
- package/src/components/data-display/InteractiveTooltip/InteractiveTooltip.stories.tsx +411 -0
- package/src/components/data-display/InteractiveTooltip/InteractiveTooltip.tsx +245 -0
- package/src/components/data-display/InteractiveTooltip/InteractiveTooltip.types.ts +64 -0
- package/src/components/data-display/InteractiveTooltip/index.ts +2 -0
- package/src/components/data-display/LazyImage/LazyImage.md +356 -0
- package/src/components/data-display/LazyImage/LazyImage.stories.tsx +387 -0
- package/src/components/data-display/LazyImage/LazyImage.tsx +323 -0
- package/src/components/data-display/LazyImage/LazyImage.types.ts +205 -0
- package/src/components/data-display/LazyImage/index.ts +2 -0
- package/src/components/data-display/Lightbox/Lightbox.stories.tsx +315 -0
- package/src/components/data-display/Lightbox/Lightbox.test.stories.tsx +605 -0
- package/src/components/data-display/Lightbox/Lightbox.tsx +666 -0
- package/src/components/data-display/Lightbox/Lightbox.types.ts +49 -0
- package/src/components/data-display/Lightbox/index.ts +2 -0
- package/src/components/data-display/Lightbox/lightbox.md +298 -0
- package/src/components/data-display/LoadingState/LoadingState.stories.tsx +124 -0
- package/src/components/data-display/LoadingState/LoadingState.test.stories.tsx +99 -0
- package/src/components/data-display/LoadingState/LoadingState.tsx +103 -0
- package/src/components/data-display/LoadingState/LoadingState.types.ts +37 -0
- package/src/components/data-display/LoadingState/index.ts +2 -0
- package/src/components/data-display/MapPreview/MapPreview.md +154 -0
- package/src/components/data-display/MapPreview/MapPreview.stories.tsx +458 -0
- package/src/components/data-display/MapPreview/MapPreview.test.stories.tsx +390 -0
- package/src/components/data-display/MapPreview/MapPreview.tsx +922 -0
- package/src/components/data-display/MapPreview/MapPreview.types.ts +56 -0
- package/src/components/data-display/MapPreview/index.ts +2 -0
- package/src/components/data-display/Popover/Popover.md +245 -0
- package/src/components/data-display/Popover/Popover.stories.tsx +295 -0
- package/src/components/data-display/Popover/Popover.test.stories.tsx +1168 -0
- package/src/components/data-display/Popover/Popover.tsx +132 -0
- package/src/components/data-display/Popover/Popover.types.ts +33 -0
- package/src/components/data-display/Popover/index.ts +2 -0
- package/src/components/data-display/Progress/Progress.md +450 -0
- package/src/components/data-display/Progress/Progress.stories.tsx +481 -0
- package/src/components/data-display/Progress/Progress.test.stories.tsx +2070 -0
- package/src/components/data-display/Progress/Progress.tsx +332 -0
- package/src/components/data-display/Progress/Progress.types.ts +61 -0
- package/src/components/data-display/Progress/index.ts +2 -0
- package/src/components/data-display/SectionOnboarding/SectionOnboarding.md +108 -0
- package/src/components/data-display/SectionOnboarding/SectionOnboarding.stories.tsx +160 -0
- package/src/components/data-display/SectionOnboarding/SectionOnboarding.test.stories.tsx +190 -0
- package/src/components/data-display/SectionOnboarding/SectionOnboarding.tsx +224 -0
- package/src/components/data-display/SectionOnboarding/SectionOnboarding.types.ts +101 -0
- package/src/components/data-display/SectionOnboarding/index.ts +7 -0
- package/src/components/data-display/Sheet/Sheet.md +475 -0
- package/src/components/data-display/Sheet/Sheet.stories.tsx +883 -0
- package/src/components/data-display/Sheet/Sheet.test.stories.tsx +1101 -0
- package/src/components/data-display/Sheet/Sheet.tsx +978 -0
- package/src/components/data-display/Sheet/Sheet.types.ts +93 -0
- package/src/components/data-display/Sheet/index.ts +8 -0
- package/src/components/data-display/Stepper/Stepper.md +542 -0
- package/src/components/data-display/Stepper/Stepper.stories.tsx +540 -0
- package/src/components/data-display/Stepper/Stepper.test.stories.tsx +607 -0
- package/src/components/data-display/Stepper/Stepper.tsx +328 -0
- package/src/components/data-display/Stepper/Stepper.types.ts +97 -0
- package/src/components/data-display/Stepper/index.ts +2 -0
- package/src/components/data-display/Table/Table.md +243 -0
- package/src/components/data-display/Table/Table.stories.tsx +801 -0
- package/src/components/data-display/Table/Table.test.stories.tsx +369 -0
- package/src/components/data-display/Table/Table.tsx +831 -0
- package/src/components/data-display/Table/Table.types.ts +335 -0
- package/src/components/data-display/Table/index.ts +2 -0
- package/src/components/data-display/Timeline/Timeline.md +201 -0
- package/src/components/data-display/Timeline/Timeline.stories.tsx +444 -0
- package/src/components/data-display/Timeline/Timeline.test.stories.tsx +944 -0
- package/src/components/data-display/Timeline/Timeline.tsx +348 -0
- package/src/components/data-display/Timeline/Timeline.types.ts +26 -0
- package/src/components/data-display/Timeline/index.ts +2 -0
- package/src/components/data-display/TimingDiagram/TimingDiagram.md +162 -0
- package/src/components/data-display/TimingDiagram/TimingDiagram.stories.tsx +475 -0
- package/src/components/data-display/TimingDiagram/TimingDiagram.test.stories.tsx +734 -0
- package/src/components/data-display/TimingDiagram/TimingDiagram.tsx +399 -0
- package/src/components/data-display/TimingDiagram/TimingDiagram.types.ts +19 -0
- package/src/components/data-display/TimingDiagram/index.ts +2 -0
- package/src/components/data-display/Tooltip/Tooltip.md +397 -0
- package/src/components/data-display/Tooltip/Tooltip.stories.tsx +465 -0
- package/src/components/data-display/Tooltip/Tooltip.test.stories.tsx +1168 -0
- package/src/components/data-display/Tooltip/Tooltip.tsx +161 -0
- package/src/components/data-display/Tooltip/Tooltip.types.ts +33 -0
- package/src/components/data-display/Tooltip/index.ts +2 -0
- package/src/components/data-display/index.ts +29 -0
- package/src/components/feedback/Dialog/Dialog.md +527 -0
- package/src/components/feedback/Dialog/Dialog.stories.tsx +833 -0
- package/src/components/feedback/Dialog/Dialog.styles.ts +171 -0
- package/src/components/feedback/Dialog/Dialog.test.stories.tsx +955 -0
- package/src/components/feedback/Dialog/Dialog.tsx +256 -0
- package/src/components/feedback/Dialog/Dialog.types.ts +46 -0
- package/src/components/feedback/Dialog/index.ts +9 -0
- package/src/components/feedback/Modal/Modal.md +629 -0
- package/src/components/feedback/Modal/Modal.stories.tsx +765 -0
- package/src/components/feedback/Modal/Modal.test.stories.tsx +251 -0
- package/src/components/feedback/Modal/Modal.tsx +279 -0
- package/src/components/feedback/Modal/Modal.types.ts +26 -0
- package/src/components/feedback/Modal/index.ts +7 -0
- package/src/components/feedback/Sonner/Sonner.stories.tsx +698 -0
- package/src/components/feedback/Sonner/Sonner.test.stories.tsx +896 -0
- package/src/components/feedback/Sonner/Sonner.tsx +493 -0
- package/src/components/feedback/Sonner/Sonner.types.ts +65 -0
- package/src/components/feedback/Sonner/index.ts +8 -0
- package/src/components/feedback/StackedModal/StackedModal.md +273 -0
- package/src/components/feedback/StackedModal/StackedModal.stories.tsx +1785 -0
- package/src/components/feedback/StackedModal/StackedModal.test.stories.tsx +975 -0
- package/src/components/feedback/StackedModal/StackedModal.tsx +664 -0
- package/src/components/feedback/StackedModal/StackedModal.types.ts +70 -0
- package/src/components/feedback/StackedModal/index.ts +11 -0
- package/src/components/feedback/Toast/Toast.md +547 -0
- package/src/components/feedback/Toast/Toast.stories.tsx +548 -0
- package/src/components/feedback/Toast/Toast.test.stories.tsx +834 -0
- package/src/components/feedback/Toast/Toast.tsx +279 -0
- package/src/components/feedback/Toast/Toast.types.ts +59 -0
- package/src/components/feedback/Toast/index.ts +8 -0
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.md +610 -0
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.stories.tsx +691 -0
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.test.stories.tsx +634 -0
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.tsx +554 -0
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.types.ts +30 -0
- package/src/components/feedback/TutorialOverlay/index.ts +2 -0
- package/src/components/feedback/index.ts +6 -0
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.md +633 -0
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.stories.tsx +663 -0
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.test.stories.tsx +723 -0
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.tsx +836 -0
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.types.ts +37 -0
- package/src/components/form/AddressAutocomplete/index.ts +2 -0
- package/src/components/form/Autocomplete/Autocomplete.helpers.ts +115 -0
- package/src/components/form/Autocomplete/Autocomplete.keys.ts +134 -0
- package/src/components/form/Autocomplete/Autocomplete.parts.tsx +337 -0
- package/src/components/form/Autocomplete/Autocomplete.stories.tsx +715 -0
- package/src/components/form/Autocomplete/Autocomplete.test.stories.tsx +825 -0
- package/src/components/form/Autocomplete/Autocomplete.tsx +166 -0
- package/src/components/form/Autocomplete/Autocomplete.types.ts +116 -0
- package/src/components/form/Autocomplete/autocomplete.md +789 -0
- package/src/components/form/Autocomplete/index.ts +8 -0
- package/src/components/form/Autocomplete/useAutocomplete.ts +311 -0
- package/src/components/form/Button/Button.md +411 -0
- package/src/components/form/Button/Button.stories.tsx +362 -0
- package/src/components/form/Button/Button.test.stories.tsx +603 -0
- package/src/components/form/Button/Button.tsx +326 -0
- package/src/components/form/Button/Button.types.ts +74 -0
- package/src/components/form/Button/index.ts +2 -0
- package/src/components/form/Calendar/Calendar.md +807 -0
- package/src/components/form/Calendar/Calendar.stories.tsx +349 -0
- package/src/components/form/Calendar/Calendar.test.stories.tsx +465 -0
- package/src/components/form/Calendar/Calendar.tsx +571 -0
- package/src/components/form/Calendar/Calendar.types.ts +81 -0
- package/src/components/form/Calendar/index.ts +11 -0
- package/src/components/form/Checkbox/Checkbox.md +200 -0
- package/src/components/form/Checkbox/Checkbox.stories.tsx +265 -0
- package/src/components/form/Checkbox/Checkbox.test.stories.tsx +181 -0
- package/src/components/form/Checkbox/Checkbox.tsx +170 -0
- package/src/components/form/Checkbox/Checkbox.types.ts +20 -0
- package/src/components/form/Checkbox/index.ts +2 -0
- package/src/components/form/CodeEditor/CodeEditor.md +350 -0
- package/src/components/form/CodeEditor/CodeEditor.stories.tsx +871 -0
- package/src/components/form/CodeEditor/CodeEditor.test.stories.tsx +575 -0
- package/src/components/form/CodeEditor/CodeEditor.tsx +415 -0
- package/src/components/form/CodeEditor/CodeEditor.types.ts +38 -0
- package/src/components/form/CodeEditor/index.ts +2 -0
- package/src/components/form/Command/Command.md +468 -0
- package/src/components/form/Command/Command.stories.tsx +580 -0
- package/src/components/form/Command/Command.test.stories.tsx +215 -0
- package/src/components/form/Command/Command.tsx +545 -0
- package/src/components/form/Command/Command.types.ts +116 -0
- package/src/components/form/Command/index.ts +12 -0
- package/src/components/form/CreatableSelect/CreatableSelect.md +114 -0
- package/src/components/form/CreatableSelect/CreatableSelect.stories.tsx +112 -0
- package/src/components/form/CreatableSelect/CreatableSelect.test.stories.tsx +134 -0
- package/src/components/form/CreatableSelect/CreatableSelect.tsx +149 -0
- package/src/components/form/CreatableSelect/CreatableSelect.types.ts +37 -0
- package/src/components/form/CreatableSelect/index.ts +2 -0
- package/src/components/form/Form/Form.md +325 -0
- package/src/components/form/Form/Form.stories.tsx +687 -0
- package/src/components/form/Form/Form.test.stories.tsx +601 -0
- package/src/components/form/Form/Form.tsx +136 -0
- package/src/components/form/Form/Form.types.ts +42 -0
- package/src/components/form/Form/index.ts +8 -0
- package/src/components/form/Input/Input.md +252 -0
- package/src/components/form/Input/Input.stories.tsx +256 -0
- package/src/components/form/Input/Input.test.stories.tsx +1184 -0
- package/src/components/form/Input/Input.tsx +263 -0
- package/src/components/form/Input/Input.types.ts +24 -0
- package/src/components/form/Input/index.ts +2 -0
- package/src/components/form/InputOTP/InputOTP.md +419 -0
- package/src/components/form/InputOTP/InputOTP.stories.tsx +774 -0
- package/src/components/form/InputOTP/InputOTP.test.stories.tsx +596 -0
- package/src/components/form/InputOTP/InputOTP.tsx +231 -0
- package/src/components/form/InputOTP/InputOTP.types.ts +68 -0
- package/src/components/form/InputOTP/index.ts +2 -0
- package/src/components/form/Label/Label.md +426 -0
- package/src/components/form/Label/Label.stories.tsx +473 -0
- package/src/components/form/Label/Label.test.stories.tsx +909 -0
- package/src/components/form/Label/Label.tsx +367 -0
- package/src/components/form/Label/Label.types.ts +35 -0
- package/src/components/form/Label/index.ts +2 -0
- package/src/components/form/Menubar/Menubar.md +275 -0
- package/src/components/form/Menubar/Menubar.stories.tsx +472 -0
- package/src/components/form/Menubar/Menubar.test.stories.tsx +588 -0
- package/src/components/form/Menubar/Menubar.tsx +467 -0
- package/src/components/form/Menubar/Menubar.types.ts +71 -0
- package/src/components/form/Menubar/index.ts +8 -0
- package/src/components/form/PasswordStrength/PasswordStrength.md +139 -0
- package/src/components/form/PasswordStrength/PasswordStrength.stories.tsx +562 -0
- package/src/components/form/PasswordStrength/PasswordStrength.test.stories.tsx +327 -0
- package/src/components/form/PasswordStrength/PasswordStrength.tsx +419 -0
- package/src/components/form/PasswordStrength/PasswordStrength.types.ts +18 -0
- package/src/components/form/PasswordStrength/index.ts +2 -0
- package/src/components/form/PhoneInput/PhoneInput.md +578 -0
- package/src/components/form/PhoneInput/PhoneInput.stories.tsx +495 -0
- package/src/components/form/PhoneInput/PhoneInput.test.stories.tsx +666 -0
- package/src/components/form/PhoneInput/PhoneInput.tsx +376 -0
- package/src/components/form/PhoneInput/PhoneInput.types.ts +25 -0
- package/src/components/form/PhoneInput/index.ts +2 -0
- package/src/components/form/RadioGroup/RadioGroup.md +477 -0
- package/src/components/form/RadioGroup/RadioGroup.stories.tsx +518 -0
- package/src/components/form/RadioGroup/RadioGroup.test.stories.tsx +685 -0
- package/src/components/form/RadioGroup/RadioGroup.tsx +664 -0
- package/src/components/form/RadioGroup/RadioGroup.types.ts +82 -0
- package/src/components/form/RadioGroup/index.ts +2 -0
- package/src/components/form/RichTextEditor/RichTextEditor.md +710 -0
- package/src/components/form/RichTextEditor/RichTextEditor.stories.tsx +261 -0
- package/src/components/form/RichTextEditor/RichTextEditor.test.stories.tsx +498 -0
- package/src/components/form/RichTextEditor/RichTextEditor.tsx +468 -0
- package/src/components/form/RichTextEditor/RichTextEditor.types.ts +72 -0
- package/src/components/form/RichTextEditor/index.ts +2 -0
- package/src/components/form/SearchPalette/SearchPalette.md +69 -0
- package/src/components/form/SearchPalette/SearchPalette.parts.tsx +358 -0
- package/src/components/form/SearchPalette/SearchPalette.stories.tsx +135 -0
- package/src/components/form/SearchPalette/SearchPalette.tsx +141 -0
- package/src/components/form/SearchPalette/SearchPalette.types.ts +82 -0
- package/src/components/form/SearchPalette/index.ts +7 -0
- package/src/components/form/Select/Select.md +254 -0
- package/src/components/form/Select/Select.stories.tsx +364 -0
- package/src/components/form/Select/Select.test.stories.tsx +977 -0
- package/src/components/form/Select/Select.tsx +239 -0
- package/src/components/form/Select/Select.types.ts +57 -0
- package/src/components/form/Select/index.ts +2 -0
- package/src/components/form/Slider/Slider.md +326 -0
- package/src/components/form/Slider/Slider.stories.tsx +418 -0
- package/src/components/form/Slider/Slider.test.stories.tsx +1044 -0
- package/src/components/form/Slider/Slider.tsx +374 -0
- package/src/components/form/Slider/Slider.types.ts +113 -0
- package/src/components/form/Slider/index.ts +2 -0
- package/src/components/form/Switch/Switch.md +565 -0
- package/src/components/form/Switch/Switch.stories.tsx +697 -0
- package/src/components/form/Switch/Switch.test.stories.tsx +597 -0
- package/src/components/form/Switch/Switch.tsx +578 -0
- package/src/components/form/Switch/Switch.types.ts +130 -0
- package/src/components/form/Switch/index.ts +2 -0
- package/src/components/form/Textarea/Textarea.stories.tsx +473 -0
- package/src/components/form/Textarea/Textarea.test.stories.tsx +708 -0
- package/src/components/form/Textarea/Textarea.tsx +678 -0
- package/src/components/form/Textarea/Textarea.types.ts +84 -0
- package/src/components/form/Textarea/index.ts +2 -0
- package/src/components/form/Toggle/Toggle.md +234 -0
- package/src/components/form/Toggle/Toggle.stories.tsx +638 -0
- package/src/components/form/Toggle/Toggle.test.stories.tsx +1167 -0
- package/src/components/form/Toggle/Toggle.tsx +265 -0
- package/src/components/form/Toggle/Toggle.types.ts +79 -0
- package/src/components/form/Toggle/index.ts +2 -0
- package/src/components/form/ToggleGroup/ToggleGroup.md +329 -0
- package/src/components/form/ToggleGroup/ToggleGroup.stories.tsx +617 -0
- package/src/components/form/ToggleGroup/ToggleGroup.test.stories.tsx +918 -0
- package/src/components/form/ToggleGroup/ToggleGroup.tsx +129 -0
- package/src/components/form/ToggleGroup/ToggleGroup.types.ts +53 -0
- package/src/components/form/ToggleGroup/index.ts +2 -0
- package/src/components/form/UploadButton/UploadButton.md +44 -0
- package/src/components/form/UploadButton/UploadButton.stories.tsx +366 -0
- package/src/components/form/UploadButton/UploadButton.test.stories.tsx +454 -0
- package/src/components/form/UploadButton/UploadButton.tsx +312 -0
- package/src/components/form/UploadButton/UploadButton.types.ts +58 -0
- package/src/components/form/UploadButton/index.ts +2 -0
- package/src/components/form/index.ts +25 -0
- package/src/components/form/total-form/Fields/SelectField.tsx +57 -0
- package/src/components/form/total-form/Fields/TextField.tsx +58 -0
- package/src/components/form/total-form/Fields/index.ts +4 -0
- package/src/components/form/total-form/FormContainer.tsx +104 -0
- package/src/components/form/total-form/FormContext.tsx +38 -0
- package/src/components/form/total-form/FormErrorSnackbar.tsx +35 -0
- package/src/components/form/total-form/SubmitButton.tsx +27 -0
- package/src/components/form/total-form/index.ts +12 -0
- package/src/components/form/total-form/total-form.test.tsx +97 -0
- package/src/components/index.ts +7 -0
- package/src/components/layout/Accordion/Accordion.md +725 -0
- package/src/components/layout/Accordion/Accordion.stories.tsx +690 -0
- package/src/components/layout/Accordion/Accordion.test.stories.tsx +1362 -0
- package/src/components/layout/Accordion/Accordion.tsx +242 -0
- package/src/components/layout/Accordion/Accordion.types.ts +32 -0
- package/src/components/layout/Accordion/index.ts +8 -0
- package/src/components/layout/Card/Card.md +533 -0
- package/src/components/layout/Card/Card.stories.tsx +593 -0
- package/src/components/layout/Card/Card.test.stories.tsx +1134 -0
- package/src/components/layout/Card/Card.tsx +404 -0
- package/src/components/layout/Card/Card.types.ts +57 -0
- package/src/components/layout/Card/index.ts +8 -0
- package/src/components/layout/Collapsible/Collapsible.md +135 -0
- package/src/components/layout/Collapsible/Collapsible.stories.tsx +180 -0
- package/src/components/layout/Collapsible/Collapsible.test.stories.tsx +304 -0
- package/src/components/layout/Collapsible/Collapsible.tsx +198 -0
- package/src/components/layout/Collapsible/Collapsible.types.ts +35 -0
- package/src/components/layout/Collapsible/index.ts +6 -0
- package/src/components/layout/Container/Container.md +420 -0
- package/src/components/layout/Container/Container.stories.tsx +557 -0
- package/src/components/layout/Container/Container.test.stories.tsx +750 -0
- package/src/components/layout/Container/Container.tsx +72 -0
- package/src/components/layout/Container/Container.types.ts +11 -0
- package/src/components/layout/Container/index.ts +2 -0
- package/src/components/layout/ContentToolbar/ColumnsMenu.tsx +99 -0
- package/src/components/layout/ContentToolbar/ContentToolbar.md +75 -0
- package/src/components/layout/ContentToolbar/ContentToolbar.stories.tsx +129 -0
- package/src/components/layout/ContentToolbar/ContentToolbar.test.stories.tsx +251 -0
- package/src/components/layout/ContentToolbar/ContentToolbar.tsx +108 -0
- package/src/components/layout/ContentToolbar/ContentToolbar.types.ts +229 -0
- package/src/components/layout/ContentToolbar/FilterTrigger.tsx +71 -0
- package/src/components/layout/ContentToolbar/MultiSelectDropdown.tsx +297 -0
- package/src/components/layout/ContentToolbar/SavedViewsMenu.tsx +334 -0
- package/src/components/layout/ContentToolbar/SortByDropdown.tsx +213 -0
- package/src/components/layout/ContentToolbar/ViewSelector.tsx +98 -0
- package/src/components/layout/ContentToolbar/__tests__/ColumnsMenu.test.tsx +39 -0
- package/src/components/layout/ContentToolbar/__tests__/MultiSelectDropdown.test.tsx +110 -0
- package/src/components/layout/ContentToolbar/__tests__/SavedViewsMenu.test.tsx +99 -0
- package/src/components/layout/ContentToolbar/index.ts +24 -0
- package/src/components/layout/ContentToolbar/tests.md +42 -0
- package/src/components/layout/ContentToolbar/track.md +41 -0
- package/src/components/layout/Dashboard/Dashboard.md +71 -0
- package/src/components/layout/Dashboard/Dashboard.stories.tsx +104 -0
- package/src/components/layout/Dashboard/Dashboard.test.stories.tsx +164 -0
- package/src/components/layout/Dashboard/Dashboard.tsx +297 -0
- package/src/components/layout/Dashboard/Dashboard.types.ts +157 -0
- package/src/components/layout/Dashboard/DashboardContext.tsx +47 -0
- package/src/components/layout/Dashboard/DashboardParts.tsx +216 -0
- package/src/components/layout/Dashboard/index.ts +18 -0
- package/src/components/layout/Dashboard/tests.md +46 -0
- package/src/components/layout/Dashboard/track.md +50 -0
- package/src/components/layout/Drawer/Drawer.md +479 -0
- package/src/components/layout/Drawer/Drawer.stories.tsx +660 -0
- package/src/components/layout/Drawer/Drawer.test.stories.tsx +1339 -0
- package/src/components/layout/Drawer/Drawer.tsx +150 -0
- package/src/components/layout/Drawer/Drawer.types.ts +34 -0
- package/src/components/layout/Drawer/index.ts +2 -0
- package/src/components/layout/Resizable/Resizable.md +308 -0
- package/src/components/layout/Resizable/Resizable.stories.tsx +1039 -0
- package/src/components/layout/Resizable/Resizable.test.stories.tsx +750 -0
- package/src/components/layout/Resizable/Resizable.tsx +190 -0
- package/src/components/layout/Resizable/Resizable.types.ts +34 -0
- package/src/components/layout/Resizable/index.ts +2 -0
- package/src/components/layout/ScrollArea/ScrollArea.md +122 -0
- package/src/components/layout/ScrollArea/ScrollArea.stories.tsx +651 -0
- package/src/components/layout/ScrollArea/ScrollArea.test.stories.tsx +619 -0
- package/src/components/layout/ScrollArea/ScrollArea.tsx +449 -0
- package/src/components/layout/ScrollArea/ScrollArea.types.ts +80 -0
- package/src/components/layout/ScrollArea/index.ts +7 -0
- package/src/components/layout/Separator/Separator.stories.tsx +563 -0
- package/src/components/layout/Separator/Separator.test.stories.tsx +527 -0
- package/src/components/layout/Separator/Separator.tsx +187 -0
- package/src/components/layout/Separator/Separator.types.ts +17 -0
- package/src/components/layout/Separator/index.ts +2 -0
- package/src/components/layout/SettingsLayout/SettingsLayout.md +139 -0
- package/src/components/layout/SettingsLayout/SettingsLayout.parts.tsx +357 -0
- package/src/components/layout/SettingsLayout/SettingsLayout.stories.tsx +194 -0
- package/src/components/layout/SettingsLayout/SettingsLayout.test.stories.tsx +175 -0
- package/src/components/layout/SettingsLayout/SettingsLayout.tsx +69 -0
- package/src/components/layout/SettingsLayout/SettingsLayout.types.ts +61 -0
- package/src/components/layout/SettingsLayout/index.ts +6 -0
- package/src/components/layout/Sidebar/Sidebar.md +367 -0
- package/src/components/layout/Sidebar/Sidebar.stories.tsx +611 -0
- package/src/components/layout/Sidebar/Sidebar.test.stories.tsx +1326 -0
- package/src/components/layout/Sidebar/Sidebar.tsx +131 -0
- package/src/components/layout/Sidebar/Sidebar.types.ts +30 -0
- package/src/components/layout/Sidebar/index.ts +7 -0
- package/src/components/layout/Skeleton/Skeleton.md +240 -0
- package/src/components/layout/Skeleton/Skeleton.stories.tsx +689 -0
- package/src/components/layout/Skeleton/Skeleton.test.stories.tsx +521 -0
- package/src/components/layout/Skeleton/Skeleton.tsx +166 -0
- package/src/components/layout/Skeleton/Skeleton.types.ts +19 -0
- package/src/components/layout/Skeleton/index.ts +2 -0
- package/src/components/layout/Spacer/Spacer.md +84 -0
- package/src/components/layout/Spacer/Spacer.stories.tsx +502 -0
- package/src/components/layout/Spacer/Spacer.test.stories.tsx +472 -0
- package/src/components/layout/Spacer/Spacer.tsx +68 -0
- package/src/components/layout/Spacer/Spacer.types.ts +12 -0
- package/src/components/layout/Spacer/index.ts +2 -0
- package/src/components/layout/TableFilter/TableFilter.md +55 -0
- package/src/components/layout/TableFilter/TableFilter.stories.tsx +82 -0
- package/src/components/layout/TableFilter/TableFilter.test.stories.tsx +87 -0
- package/src/components/layout/TableFilter/TableFilter.tsx +383 -0
- package/src/components/layout/TableFilter/TableFilter.types.ts +87 -0
- package/src/components/layout/TableFilter/TableFilterContext.tsx +29 -0
- package/src/components/layout/TableFilter/index.ts +15 -0
- package/src/components/layout/TableFilter/tests.md +37 -0
- package/src/components/layout/TableFilter/track.md +36 -0
- package/src/components/layout/index.ts +14 -0
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.md +558 -0
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.stories.tsx +640 -0
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.test.stories.tsx +1007 -0
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.tsx +516 -0
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.types.ts +132 -0
- package/src/components/navigation/Breadcrumbs/index.ts +2 -0
- package/src/components/navigation/CommandPalette/CommandPalette.md +201 -0
- package/src/components/navigation/CommandPalette/CommandPalette.stories.tsx +384 -0
- package/src/components/navigation/CommandPalette/CommandPalette.test.stories.tsx +437 -0
- package/src/components/navigation/CommandPalette/CommandPalette.tsx +434 -0
- package/src/components/navigation/CommandPalette/CommandPalette.types.ts +25 -0
- package/src/components/navigation/CommandPalette/index.ts +2 -0
- package/src/components/navigation/ContextMenu/ContextMenu.md +535 -0
- package/src/components/navigation/ContextMenu/ContextMenu.stories.tsx +611 -0
- package/src/components/navigation/ContextMenu/ContextMenu.test.stories.tsx +850 -0
- package/src/components/navigation/ContextMenu/ContextMenu.tsx +254 -0
- package/src/components/navigation/ContextMenu/ContextMenu.types.ts +96 -0
- package/src/components/navigation/ContextMenu/index.ts +2 -0
- package/src/components/navigation/DropdownMenu/DropdownMenu.md +514 -0
- package/src/components/navigation/DropdownMenu/DropdownMenu.stories.tsx +580 -0
- package/src/components/navigation/DropdownMenu/DropdownMenu.test.stories.tsx +660 -0
- package/src/components/navigation/DropdownMenu/DropdownMenu.tsx +305 -0
- package/src/components/navigation/DropdownMenu/DropdownMenu.types.ts +116 -0
- package/src/components/navigation/DropdownMenu/index.ts +2 -0
- package/src/components/navigation/NavigationMenu/NavigationMenu.md +580 -0
- package/src/components/navigation/NavigationMenu/NavigationMenu.tsx +874 -0
- package/src/components/navigation/NavigationMenu/NavigationMenu.types.ts +135 -0
- package/src/components/navigation/NavigationMenu/index.ts +2 -0
- package/src/components/navigation/NavigationMenu/stories/NavigationMenu.stories.tsx +518 -0
- package/src/components/navigation/NavigationMenu/stories/NavigationMenu.test.stories.tsx +931 -0
- package/src/components/navigation/NavigationMenu/stories/NavigationMenuHorizontal.stories.tsx +503 -0
- package/src/components/navigation/NavigationMenu/stories/NavigationMenuVertical.stories.tsx +455 -0
- package/src/components/navigation/Pagination/Pagination.md +699 -0
- package/src/components/navigation/Pagination/Pagination.stories.tsx +604 -0
- package/src/components/navigation/Pagination/Pagination.test.stories.tsx +520 -0
- package/src/components/navigation/Pagination/Pagination.tsx +356 -0
- package/src/components/navigation/Pagination/Pagination.types.ts +129 -0
- package/src/components/navigation/Pagination/index.ts +2 -0
- package/src/components/navigation/Tabs/Tabs.md +774 -0
- package/src/components/navigation/Tabs/Tabs.stories.tsx +1006 -0
- package/src/components/navigation/Tabs/Tabs.test.stories.tsx +1225 -0
- package/src/components/navigation/Tabs/Tabs.tsx +433 -0
- package/src/components/navigation/Tabs/Tabs.types.ts +239 -0
- package/src/components/navigation/Tabs/index.ts +2 -0
- package/src/components/navigation/index.ts +7 -0
- package/src/components/typography/Blockquote/Blockquote.md +130 -0
- package/src/components/typography/Blockquote/Blockquote.stories.tsx +359 -0
- package/src/components/typography/Blockquote/Blockquote.test.stories.tsx +432 -0
- package/src/components/typography/Blockquote/Blockquote.tsx +166 -0
- package/src/components/typography/Blockquote/Blockquote.types.ts +11 -0
- package/src/components/typography/Blockquote/index.ts +2 -0
- package/src/components/typography/Code/Code.md +182 -0
- package/src/components/typography/Code/Code.stories.tsx +686 -0
- package/src/components/typography/Code/Code.test.stories.tsx +703 -0
- package/src/components/typography/Code/Code.tsx +228 -0
- package/src/components/typography/Code/Code.types.ts +12 -0
- package/src/components/typography/Code/index.ts +2 -0
- package/src/components/typography/Heading/Heading.md +143 -0
- package/src/components/typography/Heading/Heading.stories.tsx +451 -0
- package/src/components/typography/Heading/Heading.test.stories.tsx +830 -0
- package/src/components/typography/Heading/Heading.tsx +178 -0
- package/src/components/typography/Heading/Heading.types.ts +11 -0
- package/src/components/typography/Heading/index.ts +2 -0
- package/src/components/typography/Paragraph/Paragraph.md +80 -0
- package/src/components/typography/Paragraph/Paragraph.stories.tsx +280 -0
- package/src/components/typography/Paragraph/Paragraph.test.stories.tsx +238 -0
- package/src/components/typography/Paragraph/Paragraph.tsx +99 -0
- package/src/components/typography/Paragraph/Paragraph.types.ts +10 -0
- package/src/components/typography/Paragraph/index.ts +2 -0
- package/src/components/typography/Text/Text.md +129 -0
- package/src/components/typography/Text/Text.stories.tsx +359 -0
- package/src/components/typography/Text/Text.test.stories.tsx +762 -0
- package/src/components/typography/Text/Text.tsx +159 -0
- package/src/components/typography/Text/Text.types.ts +15 -0
- package/src/components/typography/Text/index.ts +2 -0
- package/src/components/typography/index.ts +5 -0
- package/src/components/utility/AnimatedIcon/AnimatedIcon.md +359 -0
- package/src/components/utility/AnimatedIcon/AnimatedIcon.stories.tsx +947 -0
- package/src/components/utility/AnimatedIcon/AnimatedIcon.test.stories.tsx +596 -0
- package/src/components/utility/AnimatedIcon/AnimatedIcon.tsx +595 -0
- package/src/components/utility/AnimatedIcon/AnimatedIcon.types.ts +98 -0
- package/src/components/utility/AnimatedIcon/index.ts +2 -0
- package/src/components/utility/AspectRatio/AspectRatio.md +200 -0
- package/src/components/utility/AspectRatio/AspectRatio.stories.tsx +414 -0
- package/src/components/utility/AspectRatio/AspectRatio.test.stories.tsx +859 -0
- package/src/components/utility/AspectRatio/AspectRatio.tsx +76 -0
- package/src/components/utility/AspectRatio/AspectRatio.types.ts +13 -0
- package/src/components/utility/AspectRatio/index.ts +2 -0
- package/src/components/utility/InfiniteScroll/InfiniteScroll.md +531 -0
- package/src/components/utility/InfiniteScroll/InfiniteScroll.stories.tsx +620 -0
- package/src/components/utility/InfiniteScroll/InfiniteScroll.test.stories.tsx +358 -0
- package/src/components/utility/InfiniteScroll/InfiniteScroll.tsx +204 -0
- package/src/components/utility/InfiniteScroll/InfiniteScroll.types.ts +39 -0
- package/src/components/utility/InfiniteScroll/index.ts +6 -0
- package/src/components/utility/Portal/Portal.button-container.example.tsx +99 -0
- package/src/components/utility/Portal/Portal.md +593 -0
- package/src/components/utility/Portal/Portal.stories.tsx +340 -0
- package/src/components/utility/Portal/Portal.test.stories.tsx +2086 -0
- package/src/components/utility/Portal/Portal.tsx +39 -0
- package/src/components/utility/Portal/Portal.types.ts +7 -0
- package/src/components/utility/Portal/index.ts +2 -0
- package/src/components/utility/Transition/Transition.md +684 -0
- package/src/components/utility/Transition/Transition.stories.tsx +493 -0
- package/src/components/utility/Transition/Transition.test.stories.tsx +854 -0
- package/src/components/utility/Transition/Transition.tsx +140 -0
- package/src/components/utility/Transition/Transition.types.ts +14 -0
- package/src/components/utility/Transition/index.ts +6 -0
- package/src/components/utility/VirtualList/VirtualList.md +520 -0
- package/src/components/utility/VirtualList/VirtualList.stories.tsx +1073 -0
- package/src/components/utility/VirtualList/VirtualList.test.stories.tsx +1074 -0
- package/src/components/utility/VirtualList/VirtualList.tsx +369 -0
- package/src/components/utility/VirtualList/VirtualList.types.ts +56 -0
- package/src/components/utility/VirtualList/index.ts +7 -0
- package/src/components/utility/WorkflowStep/WorkflowStep.md +187 -0
- package/src/components/utility/WorkflowStep/WorkflowStep.stories.tsx +433 -0
- package/src/components/utility/WorkflowStep/WorkflowStep.test.stories.tsx +364 -0
- package/src/components/utility/WorkflowStep/WorkflowStep.tsx +506 -0
- package/src/components/utility/WorkflowStep/WorkflowStep.types.ts +133 -0
- package/src/components/utility/WorkflowStep/index.ts +13 -0
- package/src/components/utility/index.ts +7 -0
- package/src/index.ts +17 -0
- package/src/mui/AppBar.ts +2 -0
- package/src/mui/Box.ts +2 -0
- package/src/mui/CssBaseline.ts +2 -0
- package/src/mui/FormControl.ts +2 -0
- package/src/mui/FormControlLabel.ts +2 -0
- package/src/mui/Grid2.ts +2 -0
- package/src/mui/InputLabel.ts +2 -0
- package/src/mui/List.ts +2 -0
- package/src/mui/ListItem.ts +2 -0
- package/src/mui/ListItemButton.ts +2 -0
- package/src/mui/ListItemText.ts +2 -0
- package/src/mui/Stack.ts +2 -0
- package/src/mui/SvgIcon.ts +2 -0
- package/src/mui/Toolbar.ts +2 -0
- package/src/mui/styles.ts +2 -0
- package/src/mui/useMediaQuery.ts +1 -0
- package/src/social-login-button.tsx +199 -0
- package/src/user-avatar.tsx +102 -0
- package/src/utils/cn.ts +9 -0
- package/src/utils/index.ts +1 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface StackedModalProps {
|
|
4
|
+
/** Controls the visibility of the modal */
|
|
5
|
+
open: boolean;
|
|
6
|
+
/** Callback fired when the component requests to be closed */
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
/** Enable glass morphism effect */
|
|
9
|
+
glass?: boolean;
|
|
10
|
+
/** Title displayed in the modal navigation bar */
|
|
11
|
+
navigationTitle?: string | ReactNode;
|
|
12
|
+
/** Modal content */
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
/** Actions to display in the modal header (desktop) or footer (mobile) */
|
|
15
|
+
actions?: ReactNode;
|
|
16
|
+
/** Unique identifier for the modal in the stack */
|
|
17
|
+
modalId?: string;
|
|
18
|
+
/** Whether the modal can be closed by clicking outside */
|
|
19
|
+
closeOnClickOutside?: boolean;
|
|
20
|
+
/** Whether the modal can be closed by pressing the escape key */
|
|
21
|
+
closeOnEsc?: boolean;
|
|
22
|
+
/** Show loading skeleton overlay */
|
|
23
|
+
loading?: boolean;
|
|
24
|
+
/** Text to display during loading state */
|
|
25
|
+
loadingText?: string;
|
|
26
|
+
/** Make modal full screen */
|
|
27
|
+
fullScreen?: boolean;
|
|
28
|
+
/** Maximum width of the modal */
|
|
29
|
+
maxWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | false;
|
|
30
|
+
/** Disable the backdrop click behavior */
|
|
31
|
+
disableBackdrop?: boolean;
|
|
32
|
+
/** Disable focus trap functionality */
|
|
33
|
+
disableFocusTrap?: boolean;
|
|
34
|
+
/** Keep the modal mounted when closed */
|
|
35
|
+
keepMounted?: boolean;
|
|
36
|
+
/** ARIA labelledby attribute */
|
|
37
|
+
'aria-labelledby'?: string;
|
|
38
|
+
/** ARIA describedby attribute */
|
|
39
|
+
'aria-describedby'?: string;
|
|
40
|
+
/** Enable right-to-left language support */
|
|
41
|
+
rtl?: boolean;
|
|
42
|
+
/** Base test ID for testing purposes - will be used to generate testIds for all sub-elements */
|
|
43
|
+
dataTestId?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface ModalInfo {
|
|
47
|
+
/** Unique identifier for the modal */
|
|
48
|
+
id: string;
|
|
49
|
+
/** Z-index value for stacking */
|
|
50
|
+
zIndex: number;
|
|
51
|
+
/** Role in the modal stack */
|
|
52
|
+
role: 'primary' | 'secondary' | 'background';
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface ModalStackContextValue {
|
|
56
|
+
/** Current modal stack */
|
|
57
|
+
stack: ModalInfo[];
|
|
58
|
+
/** Add a modal to the stack */
|
|
59
|
+
pushModal: (modalId: string) => void;
|
|
60
|
+
/** Remove a modal from the stack */
|
|
61
|
+
popModal: (modalId?: string) => void;
|
|
62
|
+
/** Clear all modals from the stack */
|
|
63
|
+
clearStack: () => void;
|
|
64
|
+
/** Current depth of the modal stack */
|
|
65
|
+
currentDepth: number;
|
|
66
|
+
/** Check if a modal is in the stack */
|
|
67
|
+
isModalInStack: (modalId: string) => boolean;
|
|
68
|
+
/** Get the role of a modal in the stack */
|
|
69
|
+
getModalRole: (modalId: string) => 'primary' | 'secondary' | 'background' | null;
|
|
70
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export {
|
|
2
|
+
ModalStackProvider,
|
|
3
|
+
StackedModal,
|
|
4
|
+
StackedModalActions as StackedModalActions,
|
|
5
|
+
StackedModalContent as StackedModalContent,
|
|
6
|
+
ModalStackProvider as StackedModalProvider,
|
|
7
|
+
useModalStack,
|
|
8
|
+
useModalStack as useStackedModal,
|
|
9
|
+
} from './StackedModal';
|
|
10
|
+
|
|
11
|
+
export type { StackedModalProps } from './StackedModal.types';
|
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
# Toast Component
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The Toast component provides a non-intrusive notification system for displaying temporary messages to users. It supports multiple severity levels, action buttons, promise-based notifications, and glass morphism effects. The component follows a provider-consumer pattern for centralized toast management across the application.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Multiple Variants**: Support for default, success, error, warning, info, and promise-based toasts
|
|
10
|
+
- **Auto-dismissal**: Configurable duration with automatic dismissal
|
|
11
|
+
- **Manual Control**: Optional close button and persistent mode
|
|
12
|
+
- **Action Support**: Add custom action buttons to toasts
|
|
13
|
+
- **Promise Notifications**: Track async operations with loading, success, and error states
|
|
14
|
+
- **Glass Morphism**: Optional glass effect for modern UI aesthetics
|
|
15
|
+
- **Positioning**: Flexible positioning (top-left, top-center, top-right, bottom-left, bottom-center, bottom-right)
|
|
16
|
+
- **Stacking**: Smart stacking with configurable maximum toast count
|
|
17
|
+
- **Accessibility**: Full keyboard navigation and screen reader support
|
|
18
|
+
- **Animations**: Smooth slide-in/out transitions
|
|
19
|
+
|
|
20
|
+
## Props
|
|
21
|
+
|
|
22
|
+
### Toast Component Props
|
|
23
|
+
|
|
24
|
+
| Prop | Type | Default | Description |
|
|
25
|
+
| ---------- | ----------------------------------------------------------------------- | ----------- | ---------------------------------------- |
|
|
26
|
+
| message | `string` | (required) | The message to display in the toast |
|
|
27
|
+
| variant | `'default' \| 'success' \| 'error' \| 'warning' \| 'info' \| 'promise'` | `'default'` | The visual style variant of the toast |
|
|
28
|
+
| duration | `number` | `5000` | Auto-dismiss duration in milliseconds |
|
|
29
|
+
| persistent | `boolean` | `false` | If true, toast won't auto-dismiss |
|
|
30
|
+
| closable | `boolean` | `true` | If true, shows a close button |
|
|
31
|
+
| glass | `boolean` | `false` | Enables glass morphism effect |
|
|
32
|
+
| action | `{ label: string; onClick: () => void }` | `undefined` | Action button configuration |
|
|
33
|
+
| promise | `{ loading: string; success: string; error: string }` | `undefined` | Messages for promise-based notifications |
|
|
34
|
+
| onClose | `() => void` | `undefined` | Callback when toast is closed |
|
|
35
|
+
| dataTestId | `string` | `'toast'` | Test ID for testing and automation |
|
|
36
|
+
|
|
37
|
+
### ToastContainer Props
|
|
38
|
+
|
|
39
|
+
| Prop | Type | Default | Description |
|
|
40
|
+
| ---------- | ------------------------------------------------------------------------------------------------- | -------------------- | ----------------------------------- |
|
|
41
|
+
| position | `'top-left' \| 'top-center' \| 'top-right' \| 'bottom-left' \| 'bottom-center' \| 'bottom-right'` | `'bottom-right'` | Position of the toast container |
|
|
42
|
+
| maxToasts | `number` | `5` | Maximum number of toasts to display |
|
|
43
|
+
| gap | `number` | `12` | Gap between toasts in pixels |
|
|
44
|
+
| className | `string` | `undefined` | CSS class name for styling |
|
|
45
|
+
| dataTestId | `string` | `'toast-container'` | Test ID for testing and automation |
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
### Basic Usage
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import { ToastProvider, useToast, ToastContainer } from '@procurement/ui';
|
|
53
|
+
|
|
54
|
+
// Wrap your app with ToastProvider
|
|
55
|
+
function App() {
|
|
56
|
+
return (
|
|
57
|
+
<ToastProvider>
|
|
58
|
+
<YourAppContent />
|
|
59
|
+
<ToastContainer position="bottom-right" maxToasts={5} />
|
|
60
|
+
</ToastProvider>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Use toast in any component
|
|
65
|
+
function MyComponent() {
|
|
66
|
+
const { addToast } = useToast();
|
|
67
|
+
|
|
68
|
+
const handleClick = () => {
|
|
69
|
+
addToast({
|
|
70
|
+
message: 'Operation completed successfully!',
|
|
71
|
+
variant: 'success',
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
return <button onClick={handleClick}>Show Toast</button>;
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Promise-based Notifications
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
const { promise } = useToast();
|
|
83
|
+
|
|
84
|
+
const handleAsyncOperation = async () => {
|
|
85
|
+
await promise(someAsyncOperation(), {
|
|
86
|
+
loading: 'Processing your request...',
|
|
87
|
+
success: 'Request completed successfully!',
|
|
88
|
+
error: 'Failed to process request',
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### With Action Button
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
const { addToast } = useToast();
|
|
97
|
+
|
|
98
|
+
const showActionToast = () => {
|
|
99
|
+
addToast({
|
|
100
|
+
message: 'New update available',
|
|
101
|
+
variant: 'info',
|
|
102
|
+
action: {
|
|
103
|
+
label: 'Update Now',
|
|
104
|
+
onClick: () => {
|
|
105
|
+
console.log('Updating...');
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
persistent: true,
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Persistent Toast
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
const { addToast } = useToast();
|
|
117
|
+
|
|
118
|
+
const showPersistentToast = () => {
|
|
119
|
+
addToast({
|
|
120
|
+
message: 'This toast will not auto-dismiss',
|
|
121
|
+
variant: 'warning',
|
|
122
|
+
persistent: true,
|
|
123
|
+
closable: true,
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Glass Effect
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
const { addToast } = useToast();
|
|
132
|
+
|
|
133
|
+
const showGlassToast = () => {
|
|
134
|
+
addToast({
|
|
135
|
+
message: 'Beautiful glass morphism effect',
|
|
136
|
+
variant: 'default',
|
|
137
|
+
glass: true,
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Context API
|
|
143
|
+
|
|
144
|
+
The Toast component provides a context API through `useToast` hook:
|
|
145
|
+
|
|
146
|
+
### Methods
|
|
147
|
+
|
|
148
|
+
- `addToast(options: ToastOptions): string` - Adds a new toast and returns its ID
|
|
149
|
+
- `removeToast(id: string): void` - Removes a specific toast
|
|
150
|
+
- `clearAllToasts(): void` - Removes all toasts
|
|
151
|
+
- `promise<T>(promise: Promise<T>, messages: PromiseMessages): Promise<T>` - Handles promise-based notifications
|
|
152
|
+
|
|
153
|
+
## Accessibility
|
|
154
|
+
|
|
155
|
+
The Toast component is fully accessible:
|
|
156
|
+
|
|
157
|
+
- **ARIA Roles**: Uses `role="alert"` for screen reader announcements
|
|
158
|
+
- **ARIA Labels**: Proper labeling for close buttons and actions
|
|
159
|
+
- **Keyboard Navigation**:
|
|
160
|
+
- `Escape` - Closes the focused toast
|
|
161
|
+
- `Tab` - Navigates between interactive elements
|
|
162
|
+
- **Focus Management**: Proper focus handling for action buttons
|
|
163
|
+
- **Screen Reader Support**: Announces new toasts automatically
|
|
164
|
+
|
|
165
|
+
## Styling
|
|
166
|
+
|
|
167
|
+
The Toast component uses Material-UI theming and supports:
|
|
168
|
+
|
|
169
|
+
- Theme-aware colors for different variants
|
|
170
|
+
- Responsive design that adapts to viewport size
|
|
171
|
+
- Glass morphism effect with backdrop blur
|
|
172
|
+
- Smooth animations for enter/exit transitions
|
|
173
|
+
- Custom positioning and stacking
|
|
174
|
+
|
|
175
|
+
## Best Practices
|
|
176
|
+
|
|
177
|
+
1. **Use appropriate variants**: Choose the variant that matches the message type (success, error, warning, info)
|
|
178
|
+
2. **Keep messages concise**: Toast messages should be brief and actionable
|
|
179
|
+
3. **Avoid overlapping actions**: Don't show too many toasts at once (use `maxToasts` prop)
|
|
180
|
+
4. **Use persistent mode sparingly**: Only for critical messages that require user attention
|
|
181
|
+
5. **Provide actions when needed**: Add action buttons for toasts that require user response
|
|
182
|
+
6. **Handle promises properly**: Use the promise method for async operations to provide loading feedback
|
|
183
|
+
|
|
184
|
+
## Examples
|
|
185
|
+
|
|
186
|
+
### Error Handling
|
|
187
|
+
|
|
188
|
+
```tsx
|
|
189
|
+
try {
|
|
190
|
+
await saveData();
|
|
191
|
+
addToast({
|
|
192
|
+
message: 'Data saved successfully',
|
|
193
|
+
variant: 'success',
|
|
194
|
+
});
|
|
195
|
+
} catch (error) {
|
|
196
|
+
addToast({
|
|
197
|
+
message: 'Failed to save data. Please try again.',
|
|
198
|
+
variant: 'error',
|
|
199
|
+
action: {
|
|
200
|
+
label: 'Retry',
|
|
201
|
+
onClick: () => saveData(),
|
|
202
|
+
},
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Form Submission
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
const handleSubmit = async (formData) => {
|
|
211
|
+
await promise(submitForm(formData), {
|
|
212
|
+
loading: 'Submitting form...',
|
|
213
|
+
success: 'Form submitted successfully!',
|
|
214
|
+
error: 'Failed to submit form. Please check your inputs.',
|
|
215
|
+
});
|
|
216
|
+
};
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Testing
|
|
220
|
+
|
|
221
|
+
The Toast component includes comprehensive testIds for automated testing. All testIds can be customized via the `dataTestId` prop.
|
|
222
|
+
|
|
223
|
+
### TestIds Structure
|
|
224
|
+
|
|
225
|
+
#### ToastContainer TestIds
|
|
226
|
+
|
|
227
|
+
| Element | Default TestId | Description |
|
|
228
|
+
| ------- | -------------- | ----------- |
|
|
229
|
+
| Container | `toast-container` | Main container wrapping all toasts |
|
|
230
|
+
| Toast Item Wrapper | `toast-container-item-{index}` | Individual toast wrapper with index |
|
|
231
|
+
|
|
232
|
+
#### Toast TestIds
|
|
233
|
+
|
|
234
|
+
| Element | Default TestId | Description |
|
|
235
|
+
| ------- | -------------- | ----------- |
|
|
236
|
+
| Toast Alert | `toast` | Main toast alert container |
|
|
237
|
+
| Message | `toast-message` | Toast message typography |
|
|
238
|
+
| Action Button | `toast-action` | Action button (when action prop is provided) |
|
|
239
|
+
| Close Button | `toast-close` | Close button (when closable is true) |
|
|
240
|
+
|
|
241
|
+
### Custom TestIds
|
|
242
|
+
|
|
243
|
+
You can provide custom testIds to both the ToastContainer and individual toasts:
|
|
244
|
+
|
|
245
|
+
```tsx
|
|
246
|
+
// Container with custom testId
|
|
247
|
+
<ToastContainer dataTestId="custom-toast-container" />
|
|
248
|
+
|
|
249
|
+
// Individual toast with custom testId
|
|
250
|
+
addToast({
|
|
251
|
+
message: 'Custom toast',
|
|
252
|
+
dataTestId: 'custom-toast',
|
|
253
|
+
});
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
When using custom testIds, the child elements follow the pattern:
|
|
257
|
+
- Message: `{dataTestId}-message`
|
|
258
|
+
- Action: `{dataTestId}-action`
|
|
259
|
+
- Close: `{dataTestId}-close`
|
|
260
|
+
|
|
261
|
+
### Testing Examples
|
|
262
|
+
|
|
263
|
+
#### Unit Testing with React Testing Library
|
|
264
|
+
|
|
265
|
+
```tsx
|
|
266
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
267
|
+
import userEvent from '@testing-library/user-event';
|
|
268
|
+
import { ToastProvider, useToast, ToastContainer } from './Toast';
|
|
269
|
+
|
|
270
|
+
describe('Toast Component', () => {
|
|
271
|
+
const TestComponent = () => {
|
|
272
|
+
const { addToast } = useToast();
|
|
273
|
+
|
|
274
|
+
return (
|
|
275
|
+
<div>
|
|
276
|
+
<button onClick={() => addToast({ message: 'Test message' })}>
|
|
277
|
+
Show Toast
|
|
278
|
+
</button>
|
|
279
|
+
<ToastContainer />
|
|
280
|
+
</div>
|
|
281
|
+
);
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
it('displays toast with correct message', async () => {
|
|
285
|
+
render(
|
|
286
|
+
<ToastProvider>
|
|
287
|
+
<TestComponent />
|
|
288
|
+
</ToastProvider>
|
|
289
|
+
);
|
|
290
|
+
|
|
291
|
+
const button = screen.getByText('Show Toast');
|
|
292
|
+
await userEvent.click(button);
|
|
293
|
+
|
|
294
|
+
expect(screen.getByTestId('toast')).toBeInTheDocument();
|
|
295
|
+
expect(screen.getByTestId('toast-message')).toHaveTextContent('Test message');
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
it('closes toast when close button is clicked', async () => {
|
|
299
|
+
render(
|
|
300
|
+
<ToastProvider>
|
|
301
|
+
<TestComponent />
|
|
302
|
+
</ToastProvider>
|
|
303
|
+
);
|
|
304
|
+
|
|
305
|
+
const button = screen.getByText('Show Toast');
|
|
306
|
+
await userEvent.click(button);
|
|
307
|
+
|
|
308
|
+
const closeButton = screen.getByTestId('toast-close');
|
|
309
|
+
await userEvent.click(closeButton);
|
|
310
|
+
|
|
311
|
+
await waitFor(() => {
|
|
312
|
+
expect(screen.queryByTestId('toast')).not.toBeInTheDocument();
|
|
313
|
+
});
|
|
314
|
+
});
|
|
315
|
+
|
|
316
|
+
it('calls action callback when action button is clicked', async () => {
|
|
317
|
+
const actionCallback = vi.fn();
|
|
318
|
+
|
|
319
|
+
const TestComponentWithAction = () => {
|
|
320
|
+
const { addToast } = useToast();
|
|
321
|
+
|
|
322
|
+
return (
|
|
323
|
+
<div>
|
|
324
|
+
<button
|
|
325
|
+
onClick={() =>
|
|
326
|
+
addToast({
|
|
327
|
+
message: 'Action toast',
|
|
328
|
+
action: { label: 'Undo', onClick: actionCallback },
|
|
329
|
+
})
|
|
330
|
+
}
|
|
331
|
+
>
|
|
332
|
+
Show Toast
|
|
333
|
+
</button>
|
|
334
|
+
<ToastContainer />
|
|
335
|
+
</div>
|
|
336
|
+
);
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
render(
|
|
340
|
+
<ToastProvider>
|
|
341
|
+
<TestComponentWithAction />
|
|
342
|
+
</ToastProvider>
|
|
343
|
+
);
|
|
344
|
+
|
|
345
|
+
await userEvent.click(screen.getByText('Show Toast'));
|
|
346
|
+
await userEvent.click(screen.getByTestId('toast-action'));
|
|
347
|
+
|
|
348
|
+
expect(actionCallback).toHaveBeenCalledTimes(1);
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
it('auto-dismisses after specified duration', async () => {
|
|
352
|
+
const TestComponentWithDuration = () => {
|
|
353
|
+
const { addToast } = useToast();
|
|
354
|
+
|
|
355
|
+
return (
|
|
356
|
+
<div>
|
|
357
|
+
<button onClick={() => addToast({ message: 'Quick toast', duration: 1000 })}>
|
|
358
|
+
Show Toast
|
|
359
|
+
</button>
|
|
360
|
+
<ToastContainer />
|
|
361
|
+
</div>
|
|
362
|
+
);
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
render(
|
|
366
|
+
<ToastProvider>
|
|
367
|
+
<TestComponentWithDuration />
|
|
368
|
+
</ToastProvider>
|
|
369
|
+
);
|
|
370
|
+
|
|
371
|
+
await userEvent.click(screen.getByText('Show Toast'));
|
|
372
|
+
expect(screen.getByTestId('toast')).toBeInTheDocument();
|
|
373
|
+
|
|
374
|
+
await waitFor(
|
|
375
|
+
() => {
|
|
376
|
+
expect(screen.queryByTestId('toast')).not.toBeInTheDocument();
|
|
377
|
+
},
|
|
378
|
+
{ timeout: 2000 }
|
|
379
|
+
);
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
it('displays multiple toasts with correct indices', async () => {
|
|
383
|
+
const TestMultipleToasts = () => {
|
|
384
|
+
const { addToast } = useToast();
|
|
385
|
+
|
|
386
|
+
return (
|
|
387
|
+
<div>
|
|
388
|
+
<button
|
|
389
|
+
onClick={() => {
|
|
390
|
+
addToast({ message: 'First toast' });
|
|
391
|
+
addToast({ message: 'Second toast' });
|
|
392
|
+
}}
|
|
393
|
+
>
|
|
394
|
+
Show Toasts
|
|
395
|
+
</button>
|
|
396
|
+
<ToastContainer />
|
|
397
|
+
</div>
|
|
398
|
+
);
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
render(
|
|
402
|
+
<ToastProvider>
|
|
403
|
+
<TestMultipleToasts />
|
|
404
|
+
</ToastProvider>
|
|
405
|
+
);
|
|
406
|
+
|
|
407
|
+
await userEvent.click(screen.getByText('Show Toasts'));
|
|
408
|
+
|
|
409
|
+
expect(screen.getByTestId('toast-container-item-0')).toBeInTheDocument();
|
|
410
|
+
expect(screen.getByTestId('toast-container-item-1')).toBeInTheDocument();
|
|
411
|
+
});
|
|
412
|
+
});
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
#### E2E Testing with Playwright
|
|
416
|
+
|
|
417
|
+
```typescript
|
|
418
|
+
import { test, expect } from '@playwright/test';
|
|
419
|
+
|
|
420
|
+
test.describe('Toast Component', () => {
|
|
421
|
+
test('should display and dismiss toast', async ({ page }) => {
|
|
422
|
+
await page.goto('/toast-demo');
|
|
423
|
+
|
|
424
|
+
// Trigger toast
|
|
425
|
+
await page.click('button:has-text("Show Toast")');
|
|
426
|
+
|
|
427
|
+
// Verify toast appears
|
|
428
|
+
const toast = page.getByTestId('toast');
|
|
429
|
+
await expect(toast).toBeVisible();
|
|
430
|
+
|
|
431
|
+
// Verify message
|
|
432
|
+
const message = page.getByTestId('toast-message');
|
|
433
|
+
await expect(message).toHaveText('Operation successful');
|
|
434
|
+
|
|
435
|
+
// Click close button
|
|
436
|
+
await page.getByTestId('toast-close').click();
|
|
437
|
+
|
|
438
|
+
// Verify toast is dismissed
|
|
439
|
+
await expect(toast).not.toBeVisible();
|
|
440
|
+
});
|
|
441
|
+
|
|
442
|
+
test('should handle action button click', async ({ page }) => {
|
|
443
|
+
await page.goto('/toast-demo');
|
|
444
|
+
|
|
445
|
+
await page.click('button:has-text("Show Action Toast")');
|
|
446
|
+
|
|
447
|
+
// Click action button
|
|
448
|
+
const actionButton = page.getByTestId('toast-action');
|
|
449
|
+
await expect(actionButton).toBeVisible();
|
|
450
|
+
await actionButton.click();
|
|
451
|
+
|
|
452
|
+
// Verify action was performed (depends on implementation)
|
|
453
|
+
await expect(page.getByText('Action performed')).toBeVisible();
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
test('should display multiple toasts', async ({ page }) => {
|
|
457
|
+
await page.goto('/toast-demo');
|
|
458
|
+
|
|
459
|
+
// Trigger multiple toasts
|
|
460
|
+
await page.click('button:has-text("Show Multiple")');
|
|
461
|
+
|
|
462
|
+
// Verify container and items
|
|
463
|
+
const container = page.getByTestId('toast-container');
|
|
464
|
+
await expect(container).toBeVisible();
|
|
465
|
+
|
|
466
|
+
await expect(page.getByTestId('toast-container-item-0')).toBeVisible();
|
|
467
|
+
await expect(page.getByTestId('toast-container-item-1')).toBeVisible();
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
test('should respect maxToasts limit', async ({ page }) => {
|
|
471
|
+
await page.goto('/toast-demo');
|
|
472
|
+
|
|
473
|
+
// Trigger more toasts than maxToasts
|
|
474
|
+
await page.click('button:has-text("Show Many Toasts")');
|
|
475
|
+
|
|
476
|
+
// Verify only maxToasts (5) are visible
|
|
477
|
+
const items = page.getByTestId(/toast-container-item-/);
|
|
478
|
+
await expect(items).toHaveCount(5);
|
|
479
|
+
});
|
|
480
|
+
});
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
#### Integration Testing with Custom TestIds
|
|
484
|
+
|
|
485
|
+
```tsx
|
|
486
|
+
import { render, screen } from '@testing-library/react';
|
|
487
|
+
import userEvent from '@testing-library/user-event';
|
|
488
|
+
import { ToastProvider, useToast, ToastContainer } from './Toast';
|
|
489
|
+
|
|
490
|
+
describe('Toast with Custom TestIds', () => {
|
|
491
|
+
it('uses custom testIds correctly', async () => {
|
|
492
|
+
const TestComponent = () => {
|
|
493
|
+
const { addToast } = useToast();
|
|
494
|
+
|
|
495
|
+
return (
|
|
496
|
+
<div>
|
|
497
|
+
<button
|
|
498
|
+
onClick={() =>
|
|
499
|
+
addToast({
|
|
500
|
+
message: 'Custom toast',
|
|
501
|
+
dataTestId: 'notification-toast',
|
|
502
|
+
action: { label: 'Retry', onClick: vi.fn() },
|
|
503
|
+
})
|
|
504
|
+
}
|
|
505
|
+
>
|
|
506
|
+
Show Toast
|
|
507
|
+
</button>
|
|
508
|
+
<ToastContainer dataTestId="notification-container" />
|
|
509
|
+
</div>
|
|
510
|
+
);
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
render(
|
|
514
|
+
<ToastProvider>
|
|
515
|
+
<TestComponent />
|
|
516
|
+
</ToastProvider>
|
|
517
|
+
);
|
|
518
|
+
|
|
519
|
+
await userEvent.click(screen.getByText('Show Toast'));
|
|
520
|
+
|
|
521
|
+
expect(screen.getByTestId('notification-container')).toBeInTheDocument();
|
|
522
|
+
expect(screen.getByTestId('notification-toast')).toBeInTheDocument();
|
|
523
|
+
expect(screen.getByTestId('notification-toast-message')).toBeInTheDocument();
|
|
524
|
+
expect(screen.getByTestId('notification-toast-action')).toBeInTheDocument();
|
|
525
|
+
expect(screen.getByTestId('notification-toast-close')).toBeInTheDocument();
|
|
526
|
+
});
|
|
527
|
+
});
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
### Testing Best Practices
|
|
531
|
+
|
|
532
|
+
1. **Always wrap with ToastProvider**: Tests must include the ToastProvider wrapper
|
|
533
|
+
2. **Use waitFor for async operations**: Toast dismissal and animations require waitFor
|
|
534
|
+
3. **Test auto-dismiss behavior**: Verify toasts disappear after specified duration
|
|
535
|
+
4. **Test user interactions**: Click events on close and action buttons
|
|
536
|
+
5. **Test multiple toasts**: Verify stacking and maxToasts behavior
|
|
537
|
+
6. **Test variant styling**: Ensure correct icons and colors for each variant
|
|
538
|
+
7. **Test accessibility**: Verify ARIA attributes and keyboard navigation
|
|
539
|
+
8. **Test promise notifications**: Verify loading, success, and error states
|
|
540
|
+
9. **Custom testIds**: Use custom testIds for domain-specific testing scenarios
|
|
541
|
+
|
|
542
|
+
## Related Components
|
|
543
|
+
|
|
544
|
+
- Alert - For inline notifications
|
|
545
|
+
- Snackbar - Alternative notification component
|
|
546
|
+
- Modal - For more prominent notifications
|
|
547
|
+
- Banner - For persistent page-level notifications
|