@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,830 @@
|
|
|
1
|
+
import { Box, createTheme, Paper, Stack, ThemeProvider } from '@mui/material';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
|
+
import { expect, userEvent, waitFor, within } from 'storybook/test';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
|
|
6
|
+
import { Heading } from './Heading';
|
|
7
|
+
|
|
8
|
+
const meta: Meta<typeof Heading> = {
|
|
9
|
+
title: 'Typography/Heading/Tests',
|
|
10
|
+
component: Heading,
|
|
11
|
+
parameters: {
|
|
12
|
+
layout: 'centered',
|
|
13
|
+
chromatic: { disableSnapshot: false },
|
|
14
|
+
docs: {
|
|
15
|
+
description: {
|
|
16
|
+
component:
|
|
17
|
+
'Comprehensive test stories for the Heading component covering interaction, accessibility, visual states, performance, and edge cases.',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
tags: ['autodocs', 'test', 'component:Heading'],
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
type Story = StoryObj<typeof meta>;
|
|
26
|
+
|
|
27
|
+
// Basic Interaction Test Component
|
|
28
|
+
const BasicInteractionComponent = () => {
|
|
29
|
+
const [clickCount, setClickCount] = React.useState(0);
|
|
30
|
+
const handleClick = () => setClickCount((prev) => prev + 1);
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<Stack spacing={2} data-testid="basic-interaction-container">
|
|
34
|
+
<Heading level="h1" onClick={handleClick} data-testid="clickable-heading">
|
|
35
|
+
Click me! (Clicked: {clickCount})
|
|
36
|
+
</Heading>
|
|
37
|
+
<Heading level="h2" color="primary">
|
|
38
|
+
Static Heading
|
|
39
|
+
</Heading>
|
|
40
|
+
<div data-testid="click-count">{clickCount}</div>
|
|
41
|
+
</Stack>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// Keyboard Navigation Test Component
|
|
46
|
+
const KeyboardNavigationComponent = () => {
|
|
47
|
+
const [focusedId, setFocusedId] = React.useState<string>('');
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<Stack spacing={2} data-testid="keyboard-container">
|
|
51
|
+
<div data-testid="focused-element">Focused: {focusedId}</div>
|
|
52
|
+
<Heading
|
|
53
|
+
level="h1"
|
|
54
|
+
tabIndex={0}
|
|
55
|
+
onFocus={() => setFocusedId('h1')}
|
|
56
|
+
onBlur={() => setFocusedId('')}
|
|
57
|
+
data-testid="heading-h1"
|
|
58
|
+
>
|
|
59
|
+
Focusable H1 Heading
|
|
60
|
+
</Heading>
|
|
61
|
+
<Heading
|
|
62
|
+
level="h2"
|
|
63
|
+
tabIndex={0}
|
|
64
|
+
onFocus={() => setFocusedId('h2')}
|
|
65
|
+
onBlur={() => setFocusedId('')}
|
|
66
|
+
data-testid="heading-h2"
|
|
67
|
+
>
|
|
68
|
+
Focusable H2 Heading
|
|
69
|
+
</Heading>
|
|
70
|
+
<Heading
|
|
71
|
+
level="h3"
|
|
72
|
+
tabIndex={0}
|
|
73
|
+
onFocus={() => setFocusedId('h3')}
|
|
74
|
+
onBlur={() => setFocusedId('')}
|
|
75
|
+
data-testid="heading-h3"
|
|
76
|
+
>
|
|
77
|
+
Focusable H3 Heading
|
|
78
|
+
</Heading>
|
|
79
|
+
</Stack>
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
// Focus Management Test Component
|
|
84
|
+
const FocusManagementComponent = () => {
|
|
85
|
+
const [activeHeading, setActiveHeading] = React.useState<string>('');
|
|
86
|
+
const headingRefs = {
|
|
87
|
+
h1: React.useRef<globalThis.HTMLHeadingElement>(null),
|
|
88
|
+
h2: React.useRef<globalThis.HTMLHeadingElement>(null),
|
|
89
|
+
h3: React.useRef<globalThis.HTMLHeadingElement>(null),
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const focusHeading = (level: string) => {
|
|
93
|
+
const ref = headingRefs[level as keyof typeof headingRefs];
|
|
94
|
+
if (ref.current) {
|
|
95
|
+
ref.current.focus();
|
|
96
|
+
setActiveHeading(level);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<Stack spacing={2} data-testid="focus-management-container">
|
|
102
|
+
<Box>
|
|
103
|
+
<button onClick={() => focusHeading('h1')} data-testid="focus-h1-btn">
|
|
104
|
+
Focus H1
|
|
105
|
+
</button>
|
|
106
|
+
<button onClick={() => focusHeading('h2')} data-testid="focus-h2-btn">
|
|
107
|
+
Focus H2
|
|
108
|
+
</button>
|
|
109
|
+
<button onClick={() => focusHeading('h3')} data-testid="focus-h3-btn">
|
|
110
|
+
Focus H3
|
|
111
|
+
</button>
|
|
112
|
+
</Box>
|
|
113
|
+
<div data-testid="active-heading">Active: {activeHeading}</div>
|
|
114
|
+
|
|
115
|
+
<Heading
|
|
116
|
+
level="h1"
|
|
117
|
+
ref={headingRefs.h1}
|
|
118
|
+
tabIndex={-1}
|
|
119
|
+
onFocus={() => setActiveHeading('h1')}
|
|
120
|
+
data-testid="managed-h1"
|
|
121
|
+
>
|
|
122
|
+
Programmatically Focusable H1
|
|
123
|
+
</Heading>
|
|
124
|
+
|
|
125
|
+
<Heading
|
|
126
|
+
level="h2"
|
|
127
|
+
ref={headingRefs.h2}
|
|
128
|
+
tabIndex={-1}
|
|
129
|
+
onFocus={() => setActiveHeading('h2')}
|
|
130
|
+
data-testid="managed-h2"
|
|
131
|
+
>
|
|
132
|
+
Programmatically Focusable H2
|
|
133
|
+
</Heading>
|
|
134
|
+
|
|
135
|
+
<Heading
|
|
136
|
+
level="h3"
|
|
137
|
+
ref={headingRefs.h3}
|
|
138
|
+
tabIndex={-1}
|
|
139
|
+
onFocus={() => setActiveHeading('h3')}
|
|
140
|
+
data-testid="managed-h3"
|
|
141
|
+
>
|
|
142
|
+
Programmatically Focusable H3
|
|
143
|
+
</Heading>
|
|
144
|
+
</Stack>
|
|
145
|
+
);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// Performance Test Component
|
|
149
|
+
const PerformanceTestComponent = () => {
|
|
150
|
+
const startTime = React.useRef(globalThis.performance.now());
|
|
151
|
+
const [renderTime, setRenderTime] = React.useState<number>(0);
|
|
152
|
+
|
|
153
|
+
React.useEffect(() => {
|
|
154
|
+
setRenderTime(globalThis.performance.now() - startTime.current);
|
|
155
|
+
}, []);
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<Stack spacing={1} data-testid="performance-container">
|
|
159
|
+
<div data-testid="render-time">Render time: {renderTime.toFixed(2)}ms</div>
|
|
160
|
+
{Array.from({ length: 50 }, (_, index) => (
|
|
161
|
+
<Heading
|
|
162
|
+
key={index}
|
|
163
|
+
level={(['h1', 'h2', 'h3', 'h4', 'h5', 'h6'] as const)[index % 6]}
|
|
164
|
+
color={
|
|
165
|
+
(['primary', 'secondary', 'success', 'warning', 'danger', 'neutral'] as const)[
|
|
166
|
+
index % 6
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
weight={(['light', 'normal', 'medium', 'semibold', 'bold'] as const)[index % 5]}
|
|
170
|
+
data-testid={`perf-heading-${index}`}
|
|
171
|
+
>
|
|
172
|
+
Performance Test Heading {index + 1}
|
|
173
|
+
</Heading>
|
|
174
|
+
))}
|
|
175
|
+
</Stack>
|
|
176
|
+
);
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
// Integration Test Component
|
|
180
|
+
const IntegrationTestComponent = () => {
|
|
181
|
+
const [selectedTab, setSelectedTab] = React.useState(0);
|
|
182
|
+
const tabs = ['Tab 1', 'Tab 2', 'Tab 3'];
|
|
183
|
+
|
|
184
|
+
return (
|
|
185
|
+
<Stack spacing={3} data-testid="integration-container">
|
|
186
|
+
<Heading level="h1" data-testid="page-title">
|
|
187
|
+
Integration Testing Page
|
|
188
|
+
</Heading>
|
|
189
|
+
|
|
190
|
+
<Paper sx={{ p: 3 }}>
|
|
191
|
+
<Heading level="h2" color="primary" data-testid="section-title">
|
|
192
|
+
Content Section
|
|
193
|
+
</Heading>
|
|
194
|
+
|
|
195
|
+
<Box sx={{ borderBottom: 1, borderColor: 'divider', mb: 2 }}>
|
|
196
|
+
{tabs.map((tab, index) => (
|
|
197
|
+
<button
|
|
198
|
+
key={tab}
|
|
199
|
+
onClick={() => setSelectedTab(index)}
|
|
200
|
+
style={{
|
|
201
|
+
padding: '8px 16px',
|
|
202
|
+
marginRight: '8px',
|
|
203
|
+
backgroundColor: selectedTab === index ? '#1976d2' : 'transparent',
|
|
204
|
+
color: selectedTab === index ? 'white' : 'inherit',
|
|
205
|
+
border: '1px solid #ccc',
|
|
206
|
+
cursor: 'pointer',
|
|
207
|
+
}}
|
|
208
|
+
data-testid={`tab-${index}`}
|
|
209
|
+
>
|
|
210
|
+
{tab}
|
|
211
|
+
</button>
|
|
212
|
+
))}
|
|
213
|
+
</Box>
|
|
214
|
+
|
|
215
|
+
<Box data-testid="tab-content">
|
|
216
|
+
<Heading level="h3" data-testid="tab-heading">
|
|
217
|
+
{tabs[selectedTab]} Content
|
|
218
|
+
</Heading>
|
|
219
|
+
<Heading level="h4" weight="normal" data-testid="tab-subheading">
|
|
220
|
+
This is the content for {tabs[selectedTab].toLowerCase()}
|
|
221
|
+
</Heading>
|
|
222
|
+
</Box>
|
|
223
|
+
</Paper>
|
|
224
|
+
|
|
225
|
+
<Box sx={{ display: 'flex', gap: 2 }}>
|
|
226
|
+
<Paper sx={{ p: 2, flex: 1 }}>
|
|
227
|
+
<Heading level="h3" color="success" data-testid="card1-title">
|
|
228
|
+
Success Card
|
|
229
|
+
</Heading>
|
|
230
|
+
</Paper>
|
|
231
|
+
<Paper sx={{ p: 2, flex: 1 }}>
|
|
232
|
+
<Heading level="h3" color="warning" data-testid="card2-title">
|
|
233
|
+
Warning Card
|
|
234
|
+
</Heading>
|
|
235
|
+
</Paper>
|
|
236
|
+
<Paper sx={{ p: 2, flex: 1 }}>
|
|
237
|
+
<Heading level="h3" color="danger" data-testid="card3-title">
|
|
238
|
+
Danger Card
|
|
239
|
+
</Heading>
|
|
240
|
+
</Paper>
|
|
241
|
+
</Box>
|
|
242
|
+
</Stack>
|
|
243
|
+
);
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
// Basic Interaction Tests
|
|
247
|
+
export const BasicInteraction: Story = {
|
|
248
|
+
render: () => <BasicInteractionComponent />,
|
|
249
|
+
play: async ({ canvasElement }) => {
|
|
250
|
+
const canvas = within(canvasElement);
|
|
251
|
+
|
|
252
|
+
// Test basic rendering
|
|
253
|
+
const heading = canvas.getByTestId('clickable-heading');
|
|
254
|
+
expect(heading).toBeInTheDocument();
|
|
255
|
+
expect(heading).toHaveTextContent('Click me! (Clicked: 0)');
|
|
256
|
+
|
|
257
|
+
// Test click interaction
|
|
258
|
+
await userEvent.click(heading);
|
|
259
|
+
await waitFor(() => {
|
|
260
|
+
expect(heading).toHaveTextContent('Click me! (Clicked: 1)');
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
// Test multiple clicks
|
|
264
|
+
await userEvent.click(heading);
|
|
265
|
+
await userEvent.click(heading);
|
|
266
|
+
await waitFor(() => {
|
|
267
|
+
expect(heading).toHaveTextContent('Click me! (Clicked: 3)');
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
// Test container exists
|
|
271
|
+
expect(canvas.getByTestId('basic-interaction-container')).toBeInTheDocument();
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
// Anchor Links Test
|
|
276
|
+
export const AnchorLinks: Story = {
|
|
277
|
+
render: () => (
|
|
278
|
+
<Stack spacing={4} data-testid="anchor-links-container">
|
|
279
|
+
<Heading level="h1" id="main-title" data-testid="main-heading">
|
|
280
|
+
Main Title
|
|
281
|
+
</Heading>
|
|
282
|
+
<Heading level="h2" id="section-1" data-testid="section-heading">
|
|
283
|
+
Section 1
|
|
284
|
+
</Heading>
|
|
285
|
+
<Heading level="h3" id="subsection-1-1" data-testid="subsection-heading">
|
|
286
|
+
Subsection 1.1
|
|
287
|
+
</Heading>
|
|
288
|
+
<Box sx={{ mt: 4 }}>
|
|
289
|
+
<a href="#main-title" data-testid="main-link">
|
|
290
|
+
Go to Main Title
|
|
291
|
+
</a>
|
|
292
|
+
<br />
|
|
293
|
+
<a href="#section-1" data-testid="section-link">
|
|
294
|
+
Go to Section 1
|
|
295
|
+
</a>
|
|
296
|
+
<br />
|
|
297
|
+
<a href="#subsection-1-1" data-testid="subsection-link">
|
|
298
|
+
Go to Subsection 1.1
|
|
299
|
+
</a>
|
|
300
|
+
</Box>
|
|
301
|
+
</Stack>
|
|
302
|
+
),
|
|
303
|
+
play: async ({ canvasElement }) => {
|
|
304
|
+
const canvas = within(canvasElement);
|
|
305
|
+
|
|
306
|
+
// Test heading elements exist with proper IDs
|
|
307
|
+
const mainHeading = canvas.getByTestId('main-heading');
|
|
308
|
+
const sectionHeading = canvas.getByTestId('section-heading');
|
|
309
|
+
const subsectionHeading = canvas.getByTestId('subsection-heading');
|
|
310
|
+
|
|
311
|
+
expect(mainHeading).toHaveAttribute('id', 'main-title');
|
|
312
|
+
expect(sectionHeading).toHaveAttribute('id', 'section-1');
|
|
313
|
+
expect(subsectionHeading).toHaveAttribute('id', 'subsection-1-1');
|
|
314
|
+
|
|
315
|
+
// Test anchor links exist
|
|
316
|
+
const mainLink = canvas.getByTestId('main-link');
|
|
317
|
+
const sectionLink = canvas.getByTestId('section-link');
|
|
318
|
+
const subsectionLink = canvas.getByTestId('subsection-link');
|
|
319
|
+
|
|
320
|
+
expect(mainLink).toHaveAttribute('href', '#main-title');
|
|
321
|
+
expect(sectionLink).toHaveAttribute('href', '#section-1');
|
|
322
|
+
expect(subsectionLink).toHaveAttribute('href', '#subsection-1-1');
|
|
323
|
+
|
|
324
|
+
// Test clicking anchor links
|
|
325
|
+
await userEvent.click(mainLink);
|
|
326
|
+
await userEvent.click(sectionLink);
|
|
327
|
+
await userEvent.click(subsectionLink);
|
|
328
|
+
},
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
// Keyboard Navigation Test
|
|
332
|
+
export const KeyboardNavigation: Story = {
|
|
333
|
+
render: () => <KeyboardNavigationComponent />,
|
|
334
|
+
play: async ({ canvasElement }) => {
|
|
335
|
+
const canvas = within(canvasElement);
|
|
336
|
+
|
|
337
|
+
// Test keyboard navigation
|
|
338
|
+
const h1 = canvas.getByTestId('heading-h1');
|
|
339
|
+
const h2 = canvas.getByTestId('heading-h2');
|
|
340
|
+
const h3 = canvas.getByTestId('heading-h3');
|
|
341
|
+
const focusDisplay = canvas.getByTestId('focused-element');
|
|
342
|
+
|
|
343
|
+
// Tab to first heading
|
|
344
|
+
await userEvent.tab();
|
|
345
|
+
expect(h1).toHaveFocus();
|
|
346
|
+
await waitFor(() => {
|
|
347
|
+
expect(focusDisplay).toHaveTextContent('Focused: h1');
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
// Tab to second heading
|
|
351
|
+
await userEvent.tab();
|
|
352
|
+
expect(h2).toHaveFocus();
|
|
353
|
+
await waitFor(() => {
|
|
354
|
+
expect(focusDisplay).toHaveTextContent('Focused: h2');
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
// Tab to third heading
|
|
358
|
+
await userEvent.tab();
|
|
359
|
+
expect(h3).toHaveFocus();
|
|
360
|
+
await waitFor(() => {
|
|
361
|
+
expect(focusDisplay).toHaveTextContent('Focused: h3');
|
|
362
|
+
});
|
|
363
|
+
},
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
// Screen Reader Test
|
|
367
|
+
export const ScreenReader: Story = {
|
|
368
|
+
render: () => (
|
|
369
|
+
<Stack spacing={2} data-testid="screen-reader-container">
|
|
370
|
+
<Heading level="h1" data-testid="main-heading">
|
|
371
|
+
Main Page Title
|
|
372
|
+
</Heading>
|
|
373
|
+
<Heading level="h2" aria-label="Section heading for navigation" data-testid="section-heading">
|
|
374
|
+
Navigation Section
|
|
375
|
+
</Heading>
|
|
376
|
+
<Heading level="h3" role="heading" aria-level={3} data-testid="custom-heading">
|
|
377
|
+
Custom Semantic Heading
|
|
378
|
+
</Heading>
|
|
379
|
+
<Heading level="h4" aria-describedby="heading-description" data-testid="described-heading">
|
|
380
|
+
Heading with Description
|
|
381
|
+
</Heading>
|
|
382
|
+
<div id="heading-description">This heading describes important content below</div>
|
|
383
|
+
<Heading level="display" data-testid="display-heading">
|
|
384
|
+
Display Style Heading
|
|
385
|
+
</Heading>
|
|
386
|
+
</Stack>
|
|
387
|
+
),
|
|
388
|
+
play: async ({ canvasElement }) => {
|
|
389
|
+
const canvas = within(canvasElement);
|
|
390
|
+
|
|
391
|
+
// Test semantic heading elements
|
|
392
|
+
const mainHeading = canvas.getByTestId('main-heading');
|
|
393
|
+
const sectionHeading = canvas.getByTestId('section-heading');
|
|
394
|
+
const customHeading = canvas.getByTestId('custom-heading');
|
|
395
|
+
const describedHeading = canvas.getByTestId('described-heading');
|
|
396
|
+
const displayHeading = canvas.getByTestId('display-heading');
|
|
397
|
+
|
|
398
|
+
// Test correct HTML elements
|
|
399
|
+
expect(mainHeading.tagName).toBe('H1');
|
|
400
|
+
expect(sectionHeading.tagName).toBe('H2');
|
|
401
|
+
expect(customHeading.tagName).toBe('H3');
|
|
402
|
+
expect(describedHeading.tagName).toBe('H4');
|
|
403
|
+
expect(displayHeading.tagName).toBe('H1'); // display level maps to h1
|
|
404
|
+
|
|
405
|
+
// Test accessibility attributes
|
|
406
|
+
expect(sectionHeading).toHaveAttribute('aria-label', 'Section heading for navigation');
|
|
407
|
+
expect(customHeading).toHaveAttribute('role', 'heading');
|
|
408
|
+
expect(customHeading).toHaveAttribute('aria-level', '3');
|
|
409
|
+
expect(describedHeading).toHaveAttribute('aria-describedby', 'heading-description');
|
|
410
|
+
|
|
411
|
+
// Test heading hierarchy
|
|
412
|
+
const headings = canvas.getAllByRole('heading');
|
|
413
|
+
expect(headings).toHaveLength(5);
|
|
414
|
+
},
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
// Focus Management Test
|
|
418
|
+
export const FocusManagement: Story = {
|
|
419
|
+
render: () => <FocusManagementComponent />,
|
|
420
|
+
play: async ({ canvasElement }) => {
|
|
421
|
+
const canvas = within(canvasElement);
|
|
422
|
+
|
|
423
|
+
// Test programmatic focus
|
|
424
|
+
const focusH1Btn = canvas.getByTestId('focus-h1-btn');
|
|
425
|
+
const focusH2Btn = canvas.getByTestId('focus-h2-btn');
|
|
426
|
+
const focusH3Btn = canvas.getByTestId('focus-h3-btn');
|
|
427
|
+
|
|
428
|
+
const h1 = canvas.getByTestId('managed-h1');
|
|
429
|
+
const h2 = canvas.getByTestId('managed-h2');
|
|
430
|
+
const h3 = canvas.getByTestId('managed-h3');
|
|
431
|
+
|
|
432
|
+
const activeDisplay = canvas.getByTestId('active-heading');
|
|
433
|
+
|
|
434
|
+
// Focus H1
|
|
435
|
+
await userEvent.click(focusH1Btn);
|
|
436
|
+
expect(h1).toHaveFocus();
|
|
437
|
+
await waitFor(() => {
|
|
438
|
+
expect(activeDisplay).toHaveTextContent('Active: h1');
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
// Focus H2
|
|
442
|
+
await userEvent.click(focusH2Btn);
|
|
443
|
+
expect(h2).toHaveFocus();
|
|
444
|
+
await waitFor(() => {
|
|
445
|
+
expect(activeDisplay).toHaveTextContent('Active: h2');
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
// Focus H3
|
|
449
|
+
await userEvent.click(focusH3Btn);
|
|
450
|
+
expect(h3).toHaveFocus();
|
|
451
|
+
await waitFor(() => {
|
|
452
|
+
expect(activeDisplay).toHaveTextContent('Active: h3');
|
|
453
|
+
});
|
|
454
|
+
},
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
// Responsive Design Test
|
|
458
|
+
export const ResponsiveDesign: Story = {
|
|
459
|
+
parameters: {
|
|
460
|
+
viewport: { defaultViewport: 'mobile1' },
|
|
461
|
+
},
|
|
462
|
+
render: () => (
|
|
463
|
+
<Stack spacing={2} data-testid="responsive-container">
|
|
464
|
+
<Heading
|
|
465
|
+
level="h1"
|
|
466
|
+
sx={{
|
|
467
|
+
fontSize: { xs: '1.5rem', sm: '2rem', md: '2.5rem' },
|
|
468
|
+
}}
|
|
469
|
+
data-testid="responsive-h1"
|
|
470
|
+
>
|
|
471
|
+
Responsive H1
|
|
472
|
+
</Heading>
|
|
473
|
+
|
|
474
|
+
<Heading
|
|
475
|
+
level="h2"
|
|
476
|
+
sx={{
|
|
477
|
+
display: { xs: 'none', md: 'block' },
|
|
478
|
+
}}
|
|
479
|
+
data-testid="desktop-only-h2"
|
|
480
|
+
>
|
|
481
|
+
Desktop Only H2
|
|
482
|
+
</Heading>
|
|
483
|
+
|
|
484
|
+
<Heading
|
|
485
|
+
level="h2"
|
|
486
|
+
sx={{
|
|
487
|
+
display: { xs: 'block', md: 'none' },
|
|
488
|
+
}}
|
|
489
|
+
data-testid="mobile-only-h2"
|
|
490
|
+
>
|
|
491
|
+
Mobile Only H2
|
|
492
|
+
</Heading>
|
|
493
|
+
|
|
494
|
+
<Heading
|
|
495
|
+
level="h3"
|
|
496
|
+
sx={{
|
|
497
|
+
textAlign: { xs: 'center', md: 'left' },
|
|
498
|
+
}}
|
|
499
|
+
data-testid="adaptive-alignment-h3"
|
|
500
|
+
>
|
|
501
|
+
Adaptive Alignment H3
|
|
502
|
+
</Heading>
|
|
503
|
+
</Stack>
|
|
504
|
+
),
|
|
505
|
+
play: async ({ canvasElement }) => {
|
|
506
|
+
const canvas = within(canvasElement);
|
|
507
|
+
|
|
508
|
+
// Test responsive elements exist
|
|
509
|
+
expect(canvas.getByTestId('responsive-h1')).toBeInTheDocument();
|
|
510
|
+
expect(canvas.getByTestId('desktop-only-h2')).toBeInTheDocument();
|
|
511
|
+
expect(canvas.getByTestId('mobile-only-h2')).toBeInTheDocument();
|
|
512
|
+
expect(canvas.getByTestId('adaptive-alignment-h3')).toBeInTheDocument();
|
|
513
|
+
|
|
514
|
+
// Test responsive breakpoints applied (basic style verification)
|
|
515
|
+
const responsiveH1 = canvas.getByTestId('responsive-h1');
|
|
516
|
+
expect(responsiveH1).toHaveStyle('font-family: Roboto, Helvetica, Arial, sans-serif');
|
|
517
|
+
},
|
|
518
|
+
};
|
|
519
|
+
|
|
520
|
+
// Theme Variations Test
|
|
521
|
+
export const ThemeVariations: Story = {
|
|
522
|
+
render: () => {
|
|
523
|
+
const lightTheme = createTheme({ palette: { mode: 'light' } });
|
|
524
|
+
const darkTheme = createTheme({ palette: { mode: 'dark' } });
|
|
525
|
+
|
|
526
|
+
return (
|
|
527
|
+
<Stack spacing={4} data-testid="theme-variations-container">
|
|
528
|
+
<ThemeProvider theme={lightTheme}>
|
|
529
|
+
<Paper sx={{ p: 2 }} data-testid="light-theme-section">
|
|
530
|
+
<Heading level="h2" color="primary" data-testid="light-primary-heading">
|
|
531
|
+
Light Theme Primary
|
|
532
|
+
</Heading>
|
|
533
|
+
<Heading level="h3" color="secondary" data-testid="light-secondary-heading">
|
|
534
|
+
Light Theme Secondary
|
|
535
|
+
</Heading>
|
|
536
|
+
<Heading level="h4" color="neutral" data-testid="light-neutral-heading">
|
|
537
|
+
Light Theme Neutral
|
|
538
|
+
</Heading>
|
|
539
|
+
</Paper>
|
|
540
|
+
</ThemeProvider>
|
|
541
|
+
|
|
542
|
+
<ThemeProvider theme={darkTheme}>
|
|
543
|
+
<Paper sx={{ p: 2, bgcolor: 'background.paper' }} data-testid="dark-theme-section">
|
|
544
|
+
<Heading level="h2" color="primary" data-testid="dark-primary-heading">
|
|
545
|
+
Dark Theme Primary
|
|
546
|
+
</Heading>
|
|
547
|
+
<Heading level="h3" color="secondary" data-testid="dark-secondary-heading">
|
|
548
|
+
Dark Theme Secondary
|
|
549
|
+
</Heading>
|
|
550
|
+
<Heading level="h4" color="neutral" data-testid="dark-neutral-heading">
|
|
551
|
+
Dark Theme Neutral
|
|
552
|
+
</Heading>
|
|
553
|
+
</Paper>
|
|
554
|
+
</ThemeProvider>
|
|
555
|
+
</Stack>
|
|
556
|
+
);
|
|
557
|
+
},
|
|
558
|
+
play: async ({ canvasElement }) => {
|
|
559
|
+
const canvas = within(canvasElement);
|
|
560
|
+
|
|
561
|
+
// Test theme sections exist
|
|
562
|
+
expect(canvas.getByTestId('light-theme-section')).toBeInTheDocument();
|
|
563
|
+
expect(canvas.getByTestId('dark-theme-section')).toBeInTheDocument();
|
|
564
|
+
|
|
565
|
+
// Test headings exist in both themes
|
|
566
|
+
expect(canvas.getByTestId('light-primary-heading')).toBeInTheDocument();
|
|
567
|
+
expect(canvas.getByTestId('light-secondary-heading')).toBeInTheDocument();
|
|
568
|
+
expect(canvas.getByTestId('light-neutral-heading')).toBeInTheDocument();
|
|
569
|
+
|
|
570
|
+
expect(canvas.getByTestId('dark-primary-heading')).toBeInTheDocument();
|
|
571
|
+
expect(canvas.getByTestId('dark-secondary-heading')).toBeInTheDocument();
|
|
572
|
+
expect(canvas.getByTestId('dark-neutral-heading')).toBeInTheDocument();
|
|
573
|
+
},
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
// Visual States Test
|
|
577
|
+
export const VisualStates: Story = {
|
|
578
|
+
render: () => (
|
|
579
|
+
<Stack spacing={3} data-testid="visual-states-container">
|
|
580
|
+
<Stack spacing={1}>
|
|
581
|
+
<div>Heading Levels:</div>
|
|
582
|
+
<Heading level="h1" data-testid="level-h1">
|
|
583
|
+
H1 Heading
|
|
584
|
+
</Heading>
|
|
585
|
+
<Heading level="h2" data-testid="level-h2">
|
|
586
|
+
H2 Heading
|
|
587
|
+
</Heading>
|
|
588
|
+
<Heading level="h3" data-testid="level-h3">
|
|
589
|
+
H3 Heading
|
|
590
|
+
</Heading>
|
|
591
|
+
<Heading level="h4" data-testid="level-h4">
|
|
592
|
+
H4 Heading
|
|
593
|
+
</Heading>
|
|
594
|
+
<Heading level="h5" data-testid="level-h5">
|
|
595
|
+
H5 Heading
|
|
596
|
+
</Heading>
|
|
597
|
+
<Heading level="h6" data-testid="level-h6">
|
|
598
|
+
H6 Heading
|
|
599
|
+
</Heading>
|
|
600
|
+
<Heading level="display" data-testid="level-display">
|
|
601
|
+
Display Heading
|
|
602
|
+
</Heading>
|
|
603
|
+
</Stack>
|
|
604
|
+
|
|
605
|
+
<Stack spacing={1}>
|
|
606
|
+
<div>Color Variations:</div>
|
|
607
|
+
<Heading level="h3" color="primary" data-testid="color-primary">
|
|
608
|
+
Primary Color
|
|
609
|
+
</Heading>
|
|
610
|
+
<Heading level="h3" color="secondary" data-testid="color-secondary">
|
|
611
|
+
Secondary Color
|
|
612
|
+
</Heading>
|
|
613
|
+
<Heading level="h3" color="success" data-testid="color-success">
|
|
614
|
+
Success Color
|
|
615
|
+
</Heading>
|
|
616
|
+
<Heading level="h3" color="warning" data-testid="color-warning">
|
|
617
|
+
Warning Color
|
|
618
|
+
</Heading>
|
|
619
|
+
<Heading level="h3" color="danger" data-testid="color-danger">
|
|
620
|
+
Danger Color
|
|
621
|
+
</Heading>
|
|
622
|
+
<Heading level="h3" color="neutral" data-testid="color-neutral">
|
|
623
|
+
Neutral Color
|
|
624
|
+
</Heading>
|
|
625
|
+
</Stack>
|
|
626
|
+
|
|
627
|
+
<Stack spacing={1}>
|
|
628
|
+
<div>Weight Variations:</div>
|
|
629
|
+
<Heading level="h3" weight="light" data-testid="weight-light">
|
|
630
|
+
Light Weight
|
|
631
|
+
</Heading>
|
|
632
|
+
<Heading level="h3" weight="normal" data-testid="weight-normal">
|
|
633
|
+
Normal Weight
|
|
634
|
+
</Heading>
|
|
635
|
+
<Heading level="h3" weight="medium" data-testid="weight-medium">
|
|
636
|
+
Medium Weight
|
|
637
|
+
</Heading>
|
|
638
|
+
<Heading level="h3" weight="semibold" data-testid="weight-semibold">
|
|
639
|
+
Semibold Weight
|
|
640
|
+
</Heading>
|
|
641
|
+
<Heading level="h3" weight="bold" data-testid="weight-bold">
|
|
642
|
+
Bold Weight
|
|
643
|
+
</Heading>
|
|
644
|
+
</Stack>
|
|
645
|
+
|
|
646
|
+
<Stack spacing={1}>
|
|
647
|
+
<div>Gradient Effect:</div>
|
|
648
|
+
<Heading level="h2" gradient={true} data-testid="gradient-heading">
|
|
649
|
+
Gradient Heading
|
|
650
|
+
</Heading>
|
|
651
|
+
<Heading level="h2" gradient={false} data-testid="non-gradient-heading">
|
|
652
|
+
Non-Gradient Heading
|
|
653
|
+
</Heading>
|
|
654
|
+
</Stack>
|
|
655
|
+
</Stack>
|
|
656
|
+
),
|
|
657
|
+
play: async ({ canvasElement }) => {
|
|
658
|
+
const canvas = within(canvasElement);
|
|
659
|
+
|
|
660
|
+
// Test all heading levels
|
|
661
|
+
expect(canvas.getByTestId('level-h1').tagName).toBe('H1');
|
|
662
|
+
expect(canvas.getByTestId('level-h2').tagName).toBe('H2');
|
|
663
|
+
expect(canvas.getByTestId('level-h3').tagName).toBe('H3');
|
|
664
|
+
expect(canvas.getByTestId('level-h4').tagName).toBe('H4');
|
|
665
|
+
expect(canvas.getByTestId('level-h5').tagName).toBe('H5');
|
|
666
|
+
expect(canvas.getByTestId('level-h6').tagName).toBe('H6');
|
|
667
|
+
expect(canvas.getByTestId('level-display').tagName).toBe('H1');
|
|
668
|
+
|
|
669
|
+
// Test color variations exist
|
|
670
|
+
expect(canvas.getByTestId('color-primary')).toBeInTheDocument();
|
|
671
|
+
expect(canvas.getByTestId('color-secondary')).toBeInTheDocument();
|
|
672
|
+
expect(canvas.getByTestId('color-success')).toBeInTheDocument();
|
|
673
|
+
expect(canvas.getByTestId('color-warning')).toBeInTheDocument();
|
|
674
|
+
expect(canvas.getByTestId('color-danger')).toBeInTheDocument();
|
|
675
|
+
expect(canvas.getByTestId('color-neutral')).toBeInTheDocument();
|
|
676
|
+
|
|
677
|
+
// Test weight variations exist
|
|
678
|
+
expect(canvas.getByTestId('weight-light')).toBeInTheDocument();
|
|
679
|
+
expect(canvas.getByTestId('weight-normal')).toBeInTheDocument();
|
|
680
|
+
expect(canvas.getByTestId('weight-medium')).toBeInTheDocument();
|
|
681
|
+
expect(canvas.getByTestId('weight-semibold')).toBeInTheDocument();
|
|
682
|
+
expect(canvas.getByTestId('weight-bold')).toBeInTheDocument();
|
|
683
|
+
|
|
684
|
+
// Test gradient variations exist
|
|
685
|
+
expect(canvas.getByTestId('gradient-heading')).toBeInTheDocument();
|
|
686
|
+
expect(canvas.getByTestId('non-gradient-heading')).toBeInTheDocument();
|
|
687
|
+
},
|
|
688
|
+
};
|
|
689
|
+
|
|
690
|
+
// Performance Test
|
|
691
|
+
export const Performance: Story = {
|
|
692
|
+
render: () => <PerformanceTestComponent />,
|
|
693
|
+
play: async ({ canvasElement }) => {
|
|
694
|
+
const canvas = within(canvasElement);
|
|
695
|
+
|
|
696
|
+
// Test all performance headings render
|
|
697
|
+
for (let i = 0; i < 50; i++) {
|
|
698
|
+
expect(canvas.getByTestId(`perf-heading-${i}`)).toBeInTheDocument();
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
// Test render time is reasonable (under 100ms)
|
|
702
|
+
const renderTimeElement = canvas.getByTestId('render-time');
|
|
703
|
+
const renderTimeText = renderTimeElement.textContent;
|
|
704
|
+
const renderTime = parseFloat(renderTimeText?.match(/[\d.]+/)?.[0] || '0');
|
|
705
|
+
|
|
706
|
+
expect(renderTime).toBeLessThan(100);
|
|
707
|
+
},
|
|
708
|
+
};
|
|
709
|
+
|
|
710
|
+
// Edge Cases Test
|
|
711
|
+
export const EdgeCases: Story = {
|
|
712
|
+
render: () => (
|
|
713
|
+
<Stack spacing={2} data-testid="edge-cases-container">
|
|
714
|
+
<Heading level="h1" data-testid="empty-content"></Heading>
|
|
715
|
+
|
|
716
|
+
<Heading level="h2" data-testid="very-long-content">
|
|
717
|
+
This is a very long heading that should wrap properly and maintain readability even when the
|
|
718
|
+
content extends beyond the normal width of the container and continues to multiple lines to
|
|
719
|
+
test text overflow and wrapping behavior
|
|
720
|
+
</Heading>
|
|
721
|
+
|
|
722
|
+
<Heading level="h3" data-testid="special-characters">
|
|
723
|
+
Special Characters: !@#$%^&*()_+-=[]{}|;:'",./?`~
|
|
724
|
+
</Heading>
|
|
725
|
+
|
|
726
|
+
<Heading level="h4" data-testid="unicode-content">
|
|
727
|
+
Unicode: 你好 🌟 العربية Ελληνικά 🚀 日本語
|
|
728
|
+
</Heading>
|
|
729
|
+
|
|
730
|
+
<Heading level="h5" data-testid="html-entities">
|
|
731
|
+
HTML Entities: <div> & "quotes" 'apostrophes'
|
|
732
|
+
</Heading>
|
|
733
|
+
|
|
734
|
+
<Heading level="h6" data-testid="numbers-and-symbols">
|
|
735
|
+
123456789 αβγδε ∑∆∏π ∞≠≤≥ → ← ↑ ↓
|
|
736
|
+
</Heading>
|
|
737
|
+
|
|
738
|
+
<Heading level="display" data-testid="mixed-content">
|
|
739
|
+
Mixed: Text123 🎯 <span>HTML</span> & More!
|
|
740
|
+
</Heading>
|
|
741
|
+
|
|
742
|
+
<Box sx={{ width: 200, overflow: 'hidden' }}>
|
|
743
|
+
<Heading level="h3" data-testid="constrained-width">
|
|
744
|
+
Constrained Width Heading That Should Wrap
|
|
745
|
+
</Heading>
|
|
746
|
+
</Box>
|
|
747
|
+
|
|
748
|
+
<Heading
|
|
749
|
+
level="h2"
|
|
750
|
+
data-testid="all-props"
|
|
751
|
+
color="primary"
|
|
752
|
+
weight="bold"
|
|
753
|
+
gradient={true}
|
|
754
|
+
style={{ textDecoration: 'underline' }}
|
|
755
|
+
>
|
|
756
|
+
All Props Combined
|
|
757
|
+
</Heading>
|
|
758
|
+
</Stack>
|
|
759
|
+
),
|
|
760
|
+
play: async ({ canvasElement }) => {
|
|
761
|
+
const canvas = within(canvasElement);
|
|
762
|
+
|
|
763
|
+
// Test empty content handling
|
|
764
|
+
const emptyHeading = canvas.getByTestId('empty-content');
|
|
765
|
+
expect(emptyHeading).toBeInTheDocument();
|
|
766
|
+
|
|
767
|
+
// Test very long content
|
|
768
|
+
const longHeading = canvas.getByTestId('very-long-content');
|
|
769
|
+
expect(longHeading).toBeInTheDocument();
|
|
770
|
+
expect(longHeading.textContent).toContain('very long heading');
|
|
771
|
+
|
|
772
|
+
// Test special characters
|
|
773
|
+
const specialCharsHeading = canvas.getByTestId('special-characters');
|
|
774
|
+
expect(specialCharsHeading).toHaveTextContent('Special Characters');
|
|
775
|
+
|
|
776
|
+
// Test unicode content
|
|
777
|
+
const unicodeHeading = canvas.getByTestId('unicode-content');
|
|
778
|
+
expect(unicodeHeading).toHaveTextContent('你好 🌟 العربية Ελληνικά 🚀 日本語');
|
|
779
|
+
|
|
780
|
+
// Test HTML entities
|
|
781
|
+
const entitiesHeading = canvas.getByTestId('html-entities');
|
|
782
|
+
expect(entitiesHeading).toBeInTheDocument();
|
|
783
|
+
|
|
784
|
+
// Test numbers and symbols
|
|
785
|
+
const numbersHeading = canvas.getByTestId('numbers-and-symbols');
|
|
786
|
+
expect(numbersHeading).toBeInTheDocument();
|
|
787
|
+
|
|
788
|
+
// Test mixed content
|
|
789
|
+
const mixedHeading = canvas.getByTestId('mixed-content');
|
|
790
|
+
expect(mixedHeading).toBeInTheDocument();
|
|
791
|
+
|
|
792
|
+
// Test constrained width
|
|
793
|
+
const constrainedHeading = canvas.getByTestId('constrained-width');
|
|
794
|
+
expect(constrainedHeading).toBeInTheDocument();
|
|
795
|
+
|
|
796
|
+
// Test all props combined
|
|
797
|
+
const allPropsHeading = canvas.getByTestId('all-props');
|
|
798
|
+
expect(allPropsHeading).toBeInTheDocument();
|
|
799
|
+
expect(allPropsHeading.tagName).toBe('H2');
|
|
800
|
+
},
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
// Integration Test
|
|
804
|
+
export const Integration: Story = {
|
|
805
|
+
render: () => <IntegrationTestComponent />,
|
|
806
|
+
play: async ({ canvasElement }) => {
|
|
807
|
+
const canvas = within(canvasElement);
|
|
808
|
+
|
|
809
|
+
// Test initial state
|
|
810
|
+
expect(canvas.getByTestId('page-title')).toHaveTextContent('Integration Testing Page');
|
|
811
|
+
expect(canvas.getByTestId('section-title')).toHaveTextContent('Content Section');
|
|
812
|
+
expect(canvas.getByTestId('tab-heading')).toHaveTextContent('Tab 1 Content');
|
|
813
|
+
|
|
814
|
+
// Test tab switching
|
|
815
|
+
const tab2Button = canvas.getByTestId('tab-1');
|
|
816
|
+
await userEvent.click(tab2Button);
|
|
817
|
+
|
|
818
|
+
await waitFor(() => {
|
|
819
|
+
expect(canvas.getByTestId('tab-heading')).toHaveTextContent('Tab 2 Content');
|
|
820
|
+
expect(canvas.getByTestId('tab-subheading')).toHaveTextContent(
|
|
821
|
+
'This is the content for tab 2',
|
|
822
|
+
);
|
|
823
|
+
});
|
|
824
|
+
|
|
825
|
+
// Test card titles
|
|
826
|
+
expect(canvas.getByTestId('card1-title')).toHaveTextContent('Success Card');
|
|
827
|
+
expect(canvas.getByTestId('card2-title')).toHaveTextContent('Warning Card');
|
|
828
|
+
expect(canvas.getByTestId('card3-title')).toHaveTextContent('Danger Card');
|
|
829
|
+
},
|
|
830
|
+
};
|