@12-apps/ui 1.5.0 → 1.5.2

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.
Files changed (229) hide show
  1. package/package.json +17 -9
  2. package/src/button/index.ts +1 -0
  3. package/src/social-login-button/index.ts +1 -0
  4. package/src/{social-login-button.tsx → social-login-button/social-login-button.tsx} +5 -5
  5. package/src/user-avatar/index.ts +1 -0
  6. package/src/{user-avatar.tsx → user-avatar/user-avatar.tsx} +4 -4
  7. package/eslint.config.js +0 -89
  8. package/src/__tests__/data-grid.test.tsx +0 -125
  9. package/src/__tests__/package-wiring.test.ts +0 -41
  10. package/src/__tests__/setup.ts +0 -1
  11. package/src/__tests__/social-login-button.test.tsx +0 -186
  12. package/src/__tests__/user-avatar.test.tsx +0 -195
  13. package/src/__tests__/viewport.test.ts +0 -50
  14. package/src/components/command/__tests__/command.test.tsx +0 -112
  15. package/src/components/data-display/Alert/Alert.stories.tsx +0 -559
  16. package/src/components/data-display/Alert/Alert.test.stories.tsx +0 -707
  17. package/src/components/data-display/AlertDialog/AlertDialog.stories.tsx +0 -362
  18. package/src/components/data-display/AlertDialog/AlertDialog.test.stories.tsx +0 -763
  19. package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.stories.tsx +0 -230
  20. package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.test.stories.tsx +0 -270
  21. package/src/components/data-display/Avatar/Avatar.stories.tsx +0 -721
  22. package/src/components/data-display/Avatar/Avatar.test.stories.tsx +0 -822
  23. package/src/components/data-display/Badge/Badge.stories.tsx +0 -1134
  24. package/src/components/data-display/Badge/Badge.test.stories.tsx +0 -1194
  25. package/src/components/data-display/Banner/Banner.stories.tsx +0 -528
  26. package/src/components/data-display/Banner/Banner.test.stories.tsx +0 -511
  27. package/src/components/data-display/Carousel/Carousel.stories.tsx +0 -607
  28. package/src/components/data-display/Carousel/Carousel.test.stories.tsx +0 -701
  29. package/src/components/data-display/Chart/Chart.stories.tsx +0 -568
  30. package/src/components/data-display/Chart/Chart.test.stories.tsx +0 -174
  31. package/src/components/data-display/Chart/SpecChart.stories.tsx +0 -150
  32. package/src/components/data-display/Chart/SpecChart.test.stories.tsx +0 -56
  33. package/src/components/data-display/Chart/__tests__/SpecChart.test.tsx +0 -60
  34. package/src/components/data-display/Chart/__tests__/chart-format.test.ts +0 -43
  35. package/src/components/data-display/Chart/__tests__/chart-spec.test.ts +0 -119
  36. package/src/components/data-display/Chip/Chip.stories.tsx +0 -252
  37. package/src/components/data-display/Chip/Chip.test.stories.tsx +0 -266
  38. package/src/components/data-display/DataGrid/DataGrid.stories.tsx +0 -515
  39. package/src/components/data-display/DataGrid/DataGrid.test.stories.tsx +0 -653
  40. package/src/components/data-display/DataViews/__tests__/DataViewsGrid.test.tsx +0 -271
  41. package/src/components/data-display/DataViews/__tests__/DataViewsTableBase.test.tsx +0 -134
  42. package/src/components/data-display/DataViews/__tests__/SaveViewModal.test.tsx +0 -83
  43. package/src/components/data-display/DataViews/__tests__/data-views-filter.test.ts +0 -115
  44. package/src/components/data-display/DataViews/__tests__/data-views-preview.test.ts +0 -53
  45. package/src/components/data-display/DataViews/__tests__/range-pill.test.tsx +0 -114
  46. package/src/components/data-display/DataViews/base-card.stories.tsx +0 -136
  47. package/src/components/data-display/DescriptionItem/DescriptionItem.stories.tsx +0 -254
  48. package/src/components/data-display/EmptyState/EmptyState.stories.tsx +0 -282
  49. package/src/components/data-display/EmptyState/EmptyState.test.stories.tsx +0 -441
  50. package/src/components/data-display/ErrorState/ErrorState.stories.tsx +0 -110
  51. package/src/components/data-display/ErrorState/ErrorState.test.stories.tsx +0 -133
  52. package/src/components/data-display/HoverCard/HoverCard.stories.tsx +0 -650
  53. package/src/components/data-display/HoverCard/HoverCard.test.stories.tsx +0 -929
  54. package/src/components/data-display/InteractiveTooltip/InteractiveTooltip.stories.tsx +0 -411
  55. package/src/components/data-display/LazyImage/LazyImage.stories.tsx +0 -387
  56. package/src/components/data-display/Lightbox/Lightbox.stories.tsx +0 -315
  57. package/src/components/data-display/Lightbox/Lightbox.test.stories.tsx +0 -598
  58. package/src/components/data-display/LoadingState/LoadingState.stories.tsx +0 -124
  59. package/src/components/data-display/LoadingState/LoadingState.test.stories.tsx +0 -99
  60. package/src/components/data-display/MapPreview/MapPreview.stories.tsx +0 -458
  61. package/src/components/data-display/MapPreview/MapPreview.test.stories.tsx +0 -394
  62. package/src/components/data-display/Popover/Popover.stories.tsx +0 -295
  63. package/src/components/data-display/Popover/Popover.test.stories.tsx +0 -1162
  64. package/src/components/data-display/Progress/Progress.stories.tsx +0 -481
  65. package/src/components/data-display/Progress/Progress.test.stories.tsx +0 -2070
  66. package/src/components/data-display/SectionOnboarding/SectionOnboarding.stories.tsx +0 -160
  67. package/src/components/data-display/SectionOnboarding/SectionOnboarding.test.stories.tsx +0 -190
  68. package/src/components/data-display/Sheet/Sheet.stories.tsx +0 -883
  69. package/src/components/data-display/Sheet/Sheet.test.stories.tsx +0 -1105
  70. package/src/components/data-display/StatCard/StatCard.stories.tsx +0 -167
  71. package/src/components/data-display/StatCard/StatCard.test.stories.tsx +0 -240
  72. package/src/components/data-display/Stepper/Stepper.stories.tsx +0 -540
  73. package/src/components/data-display/Stepper/Stepper.test.stories.tsx +0 -600
  74. package/src/components/data-display/Table/Table.stories.tsx +0 -803
  75. package/src/components/data-display/Table/Table.test.stories.tsx +0 -369
  76. package/src/components/data-display/Timeline/Timeline.stories.tsx +0 -442
  77. package/src/components/data-display/Timeline/Timeline.test.stories.tsx +0 -930
  78. package/src/components/data-display/TimingDiagram/TimingDiagram.stories.tsx +0 -475
  79. package/src/components/data-display/TimingDiagram/TimingDiagram.test.stories.tsx +0 -734
  80. package/src/components/data-display/Tooltip/Tooltip.stories.tsx +0 -468
  81. package/src/components/data-display/Tooltip/Tooltip.test.stories.tsx +0 -1154
  82. package/src/components/feedback/ConfirmAction/ConfirmAction.stories.tsx +0 -146
  83. package/src/components/feedback/ConfirmAction/ConfirmAction.test.stories.tsx +0 -114
  84. package/src/components/feedback/ConfirmAction/__tests__/confirm-action.test.tsx +0 -288
  85. package/src/components/feedback/Dialog/Dialog.stories.tsx +0 -833
  86. package/src/components/feedback/Dialog/Dialog.test.stories.tsx +0 -964
  87. package/src/components/feedback/Dialog/__tests__/dialog-content-spacing.test.tsx +0 -66
  88. package/src/components/feedback/Modal/Modal.stories.tsx +0 -765
  89. package/src/components/feedback/Modal/Modal.test.stories.tsx +0 -251
  90. package/src/components/feedback/Sonner/Sonner.stories.tsx +0 -698
  91. package/src/components/feedback/Sonner/Sonner.test.stories.tsx +0 -896
  92. package/src/components/feedback/StackedModal/StackedModal.stories.tsx +0 -1783
  93. package/src/components/feedback/StackedModal/StackedModal.test.stories.tsx +0 -973
  94. package/src/components/feedback/StackedModal/__tests__/stacked-modal-viewport.test.tsx +0 -104
  95. package/src/components/feedback/Toast/Toast.stories.tsx +0 -548
  96. package/src/components/feedback/Toast/Toast.test.stories.tsx +0 -834
  97. package/src/components/feedback/TutorialOverlay/TutorialOverlay.stories.tsx +0 -691
  98. package/src/components/feedback/TutorialOverlay/TutorialOverlay.test.stories.tsx +0 -634
  99. package/src/components/form/AddressAutocomplete/AddressAutocomplete.stories.tsx +0 -665
  100. package/src/components/form/AddressAutocomplete/AddressAutocomplete.test.stories.tsx +0 -727
  101. package/src/components/form/Autocomplete/Autocomplete.stories.tsx +0 -715
  102. package/src/components/form/Autocomplete/Autocomplete.test.stories.tsx +0 -825
  103. package/src/components/form/Button/Button.stories.tsx +0 -365
  104. package/src/components/form/Button/Button.test.stories.tsx +0 -607
  105. package/src/components/form/Calendar/Calendar.stories.tsx +0 -349
  106. package/src/components/form/Calendar/Calendar.test.stories.tsx +0 -464
  107. package/src/components/form/CepField/CepField.stories.tsx +0 -138
  108. package/src/components/form/CepField/CepField.test.stories.tsx +0 -281
  109. package/src/components/form/Checkbox/Checkbox.stories.tsx +0 -265
  110. package/src/components/form/Checkbox/Checkbox.test.stories.tsx +0 -181
  111. package/src/components/form/CodeEditor/CodeEditor.stories.tsx +0 -871
  112. package/src/components/form/CodeEditor/CodeEditor.test.stories.tsx +0 -574
  113. package/src/components/form/Command/Command.stories.tsx +0 -580
  114. package/src/components/form/Command/Command.test.stories.tsx +0 -215
  115. package/src/components/form/CreatableSelect/CreatableSelect.stories.tsx +0 -112
  116. package/src/components/form/CreatableSelect/CreatableSelect.test.stories.tsx +0 -134
  117. package/src/components/form/Form/Form.stories.tsx +0 -687
  118. package/src/components/form/Form/Form.test.stories.tsx +0 -601
  119. package/src/components/form/Input/Input.stories.tsx +0 -260
  120. package/src/components/form/Input/Input.test.stories.tsx +0 -1191
  121. package/src/components/form/InputOTP/InputOTP.stories.tsx +0 -774
  122. package/src/components/form/InputOTP/InputOTP.test.stories.tsx +0 -588
  123. package/src/components/form/Label/Label.stories.tsx +0 -473
  124. package/src/components/form/Label/Label.test.stories.tsx +0 -915
  125. package/src/components/form/Menubar/Menubar.stories.tsx +0 -472
  126. package/src/components/form/Menubar/Menubar.test.stories.tsx +0 -584
  127. package/src/components/form/PasswordStrength/PasswordStrength.stories.tsx +0 -562
  128. package/src/components/form/PasswordStrength/PasswordStrength.test.stories.tsx +0 -327
  129. package/src/components/form/PhoneInput/PhoneInput.stories.tsx +0 -495
  130. package/src/components/form/PhoneInput/PhoneInput.test.stories.tsx +0 -666
  131. package/src/components/form/RadioGroup/RadioGroup.stories.tsx +0 -518
  132. package/src/components/form/RadioGroup/RadioGroup.test.stories.tsx +0 -685
  133. package/src/components/form/RichTextEditor/RichTextEditor.stories.tsx +0 -261
  134. package/src/components/form/RichTextEditor/RichTextEditor.test.stories.tsx +0 -491
  135. package/src/components/form/SearchPalette/SearchPalette.stories.tsx +0 -135
  136. package/src/components/form/Select/Select.stories.tsx +0 -364
  137. package/src/components/form/Select/Select.test.stories.tsx +0 -985
  138. package/src/components/form/Slider/Slider.stories.tsx +0 -418
  139. package/src/components/form/Slider/Slider.test.stories.tsx +0 -1042
  140. package/src/components/form/Switch/Switch.stories.tsx +0 -697
  141. package/src/components/form/Switch/Switch.test.stories.tsx +0 -597
  142. package/src/components/form/Textarea/Textarea.stories.tsx +0 -473
  143. package/src/components/form/Textarea/Textarea.test.stories.tsx +0 -702
  144. package/src/components/form/Toggle/Toggle.stories.tsx +0 -638
  145. package/src/components/form/Toggle/Toggle.test.stories.tsx +0 -1159
  146. package/src/components/form/ToggleGroup/ToggleGroup.stories.tsx +0 -617
  147. package/src/components/form/ToggleGroup/ToggleGroup.test.stories.tsx +0 -915
  148. package/src/components/form/UploadButton/UploadButton.stories.tsx +0 -367
  149. package/src/components/form/UploadButton/UploadButton.test.stories.tsx +0 -573
  150. package/src/components/form/total-form/total-form.test.tsx +0 -214
  151. package/src/components/layout/Accordion/Accordion.stories.tsx +0 -694
  152. package/src/components/layout/Accordion/Accordion.test.stories.tsx +0 -1344
  153. package/src/components/layout/Card/Card.stories.tsx +0 -591
  154. package/src/components/layout/Card/Card.test.stories.tsx +0 -1134
  155. package/src/components/layout/CardGrid/__tests__/CardGrid.test.tsx +0 -92
  156. package/src/components/layout/Collapsible/Collapsible.stories.tsx +0 -180
  157. package/src/components/layout/Collapsible/Collapsible.test.stories.tsx +0 -308
  158. package/src/components/layout/Container/Container.stories.tsx +0 -557
  159. package/src/components/layout/Container/Container.test.stories.tsx +0 -745
  160. package/src/components/layout/ContentToolbar/ContentToolbar.stories.tsx +0 -129
  161. package/src/components/layout/ContentToolbar/ContentToolbar.test.stories.tsx +0 -251
  162. package/src/components/layout/ContentToolbar/__tests__/ColumnsMenu.test.tsx +0 -39
  163. package/src/components/layout/ContentToolbar/__tests__/MultiSelectDropdown.test.tsx +0 -131
  164. package/src/components/layout/ContentToolbar/__tests__/SavedViewsMenu.test.tsx +0 -99
  165. package/src/components/layout/Dashboard/Dashboard.stories.tsx +0 -104
  166. package/src/components/layout/Dashboard/Dashboard.test.stories.tsx +0 -190
  167. package/src/components/layout/Drawer/Drawer.stories.tsx +0 -658
  168. package/src/components/layout/Drawer/Drawer.test.stories.tsx +0 -1343
  169. package/src/components/layout/Resizable/Resizable.stories.tsx +0 -1039
  170. package/src/components/layout/Resizable/Resizable.test.stories.tsx +0 -754
  171. package/src/components/layout/ScrollArea/ScrollArea.stories.tsx +0 -651
  172. package/src/components/layout/ScrollArea/ScrollArea.test.stories.tsx +0 -619
  173. package/src/components/layout/Separator/Separator.stories.tsx +0 -563
  174. package/src/components/layout/Separator/Separator.test.stories.tsx +0 -518
  175. package/src/components/layout/SettingsLayout/SettingsLayout.stories.tsx +0 -192
  176. package/src/components/layout/SettingsLayout/SettingsLayout.test.stories.tsx +0 -175
  177. package/src/components/layout/Sidebar/Sidebar.stories.tsx +0 -609
  178. package/src/components/layout/Sidebar/Sidebar.test.stories.tsx +0 -1324
  179. package/src/components/layout/Skeleton/Skeleton.stories.tsx +0 -689
  180. package/src/components/layout/Skeleton/Skeleton.test.stories.tsx +0 -521
  181. package/src/components/layout/Spacer/Spacer.stories.tsx +0 -502
  182. package/src/components/layout/Spacer/Spacer.test.stories.tsx +0 -474
  183. package/src/components/layout/TableFilter/TableFilter.stories.tsx +0 -82
  184. package/src/components/layout/TableFilter/TableFilter.test.stories.tsx +0 -87
  185. package/src/components/navigation/Breadcrumbs/Breadcrumbs.stories.tsx +0 -638
  186. package/src/components/navigation/Breadcrumbs/Breadcrumbs.test.stories.tsx +0 -1008
  187. package/src/components/navigation/CommandPalette/CommandPalette.stories.tsx +0 -386
  188. package/src/components/navigation/CommandPalette/CommandPalette.test.stories.tsx +0 -435
  189. package/src/components/navigation/ContextMenu/ContextMenu.stories.tsx +0 -614
  190. package/src/components/navigation/ContextMenu/ContextMenu.test.stories.tsx +0 -845
  191. package/src/components/navigation/DropdownMenu/DropdownMenu.stories.tsx +0 -578
  192. package/src/components/navigation/DropdownMenu/DropdownMenu.test.stories.tsx +0 -660
  193. package/src/components/navigation/NavigationMenu/stories/NavigationMenu.stories.tsx +0 -516
  194. package/src/components/navigation/NavigationMenu/stories/NavigationMenu.test.stories.tsx +0 -935
  195. package/src/components/navigation/NavigationMenu/stories/NavigationMenuHorizontal.stories.tsx +0 -501
  196. package/src/components/navigation/NavigationMenu/stories/NavigationMenuVertical.stories.tsx +0 -453
  197. package/src/components/navigation/Pagination/Pagination.stories.tsx +0 -602
  198. package/src/components/navigation/Pagination/Pagination.test.stories.tsx +0 -520
  199. package/src/components/navigation/Tabs/Tabs.stories.tsx +0 -1004
  200. package/src/components/navigation/Tabs/Tabs.test.stories.tsx +0 -1225
  201. package/src/components/typography/Blockquote/Blockquote.stories.tsx +0 -359
  202. package/src/components/typography/Blockquote/Blockquote.test.stories.tsx +0 -432
  203. package/src/components/typography/Code/Code.stories.tsx +0 -686
  204. package/src/components/typography/Code/Code.test.stories.tsx +0 -703
  205. package/src/components/typography/Heading/Heading.stories.tsx +0 -451
  206. package/src/components/typography/Heading/Heading.test.stories.tsx +0 -830
  207. package/src/components/typography/Paragraph/Paragraph.stories.tsx +0 -280
  208. package/src/components/typography/Paragraph/Paragraph.test.stories.tsx +0 -231
  209. package/src/components/typography/Text/Text.stories.tsx +0 -359
  210. package/src/components/typography/Text/Text.test.stories.tsx +0 -759
  211. package/src/components/utility/AnimatedIcon/AnimatedIcon.stories.tsx +0 -945
  212. package/src/components/utility/AnimatedIcon/AnimatedIcon.test.stories.tsx +0 -603
  213. package/src/components/utility/AspectRatio/AspectRatio.stories.tsx +0 -414
  214. package/src/components/utility/AspectRatio/AspectRatio.test.stories.tsx +0 -859
  215. package/src/components/utility/InfiniteScroll/InfiniteScroll.stories.tsx +0 -620
  216. package/src/components/utility/InfiniteScroll/InfiniteScroll.test.stories.tsx +0 -361
  217. package/src/components/utility/InstallPrompt/InstallPrompt.stories.tsx +0 -118
  218. package/src/components/utility/InstallPrompt/InstallPrompt.test.stories.tsx +0 -83
  219. package/src/components/utility/InstallPrompt/__tests__/InstallPrompt.ios.test.tsx +0 -65
  220. package/src/components/utility/InstallPrompt/__tests__/usePwaInstall.test.tsx +0 -271
  221. package/src/components/utility/Portal/Portal.stories.tsx +0 -340
  222. package/src/components/utility/Portal/Portal.test.stories.tsx +0 -2086
  223. package/src/components/utility/Transition/Transition.stories.tsx +0 -493
  224. package/src/components/utility/Transition/Transition.test.stories.tsx +0 -854
  225. package/src/components/utility/VirtualList/VirtualList.stories.tsx +0 -1073
  226. package/src/components/utility/VirtualList/VirtualList.test.stories.tsx +0 -1085
  227. package/src/components/utility/WorkflowStep/WorkflowStep.stories.tsx +0 -431
  228. package/src/components/utility/WorkflowStep/WorkflowStep.test.stories.tsx +0 -364
  229. /package/src/{button.tsx → button/button.tsx} +0 -0
@@ -1,707 +0,0 @@
1
- import { createTheme,Stack, ThemeProvider } from '@mui/material';
2
- import type { Meta, StoryObj } from '@storybook/react-vite';
3
- import React from 'react';
4
- import { expect, fn,userEvent, waitFor, within } from 'storybook/test';
5
-
6
- import { Alert } from './Alert';
7
-
8
- const meta: Meta<typeof Alert> = {
9
- title: 'DataDisplay/Alert/Tests',
10
- component: Alert,
11
- parameters: {
12
- layout: 'padded',
13
- chromatic: { disableSnapshot: false },
14
- },
15
- tags: ['autodocs', 'test', 'component:Alert'],
16
- argTypes: {
17
- variant: {
18
- control: { type: 'select' },
19
- options: ['info', 'success', 'warning', 'danger', 'glass', 'gradient'],
20
- },
21
- color: {
22
- control: { type: 'select' },
23
- options: ['primary', 'secondary', 'success', 'warning', 'danger', 'neutral'],
24
- },
25
- },
26
- };
27
-
28
- export default meta;
29
- type Story = StoryObj<typeof meta>;
30
-
31
- // Interaction Tests
32
- export const BasicInteraction: Story = {
33
- name: '🧪 Basic Interaction Test',
34
- args: {
35
- variant: 'info',
36
- title: 'Interactive Alert',
37
- description: 'This alert tests basic interactions',
38
- closable: true,
39
- onClose: fn(),
40
- showIcon: true,
41
- },
42
- play: async ({ canvasElement, step, args }) => {
43
- const canvas = within(canvasElement);
44
-
45
- await step('Initial render verification', async () => {
46
- const alert = canvas.getByRole('alert');
47
- await expect(alert).toBeInTheDocument();
48
- await expect(alert).toHaveAttribute('aria-live', 'polite');
49
- await expect(alert).toHaveAttribute('aria-atomic', 'true');
50
- });
51
-
52
- await step('Verify title and description', async () => {
53
- await expect(canvas.getByText('Interactive Alert')).toBeInTheDocument();
54
- await expect(canvas.getByText('This alert tests basic interactions')).toBeInTheDocument();
55
- });
56
-
57
- await step('Close button interaction', async () => {
58
- const closeButton = canvas.getByLabelText('close alert');
59
- await expect(closeButton).toBeInTheDocument();
60
-
61
- await userEvent.click(closeButton);
62
- await waitFor(
63
- () => {
64
- expect(args.onClose).toHaveBeenCalledTimes(1);
65
- },
66
- { timeout: 500 },
67
- );
68
- });
69
- },
70
- };
71
-
72
- export const HoverEffects: Story = {
73
- name: '🎨 Hover Effects Test',
74
- args: {
75
- variant: 'success',
76
- title: 'Hover Me',
77
- description: 'Watch the animation when you hover',
78
- glow: true,
79
- animate: false, // Disable mount animation to test hover effects in isolation
80
- },
81
- play: async ({ canvasElement, step }) => {
82
- const canvas = within(canvasElement);
83
-
84
- await step('Initial state', async () => {
85
- const alert = canvas.getByRole('alert');
86
- await expect(alert).toBeInTheDocument();
87
-
88
- // Verify initial transform is none
89
- const initialStyle = window.getComputedStyle(alert);
90
- await expect(initialStyle.transform).toBe('none');
91
- });
92
-
93
- await step('Verify glow effect is applied', async () => {
94
- const alert = canvas.getByRole('alert');
95
- const computedStyle = window.getComputedStyle(alert);
96
-
97
- // Glow effect adds box-shadow with color
98
- await expect(computedStyle.boxShadow).toContain('rgb');
99
- // Glow also adds filter brightness
100
- await expect(computedStyle.filter).toContain('brightness');
101
- });
102
-
103
- await step('Verify hover styles exist in component', async () => {
104
- const alert = canvas.getByRole('alert');
105
-
106
- // Verify the alert has transition property (needed for hover effects)
107
- const computedStyle = window.getComputedStyle(alert);
108
- await expect(computedStyle.transition).toContain('cubic-bezier');
109
- // Also verify border-radius for proper styling
110
- await expect(computedStyle.borderRadius).not.toBe('0px');
111
- });
112
- },
113
- };
114
-
115
- // Accessibility Tests
116
- export const KeyboardNavigation: Story = {
117
- name: '⌨️ Keyboard Navigation Test',
118
- args: {
119
- variant: 'warning',
120
- title: 'Keyboard Accessible',
121
- description: 'Navigate with Tab and Enter keys',
122
- closable: true,
123
- onClose: fn(),
124
- },
125
- play: async ({ canvasElement, step, args }) => {
126
- const canvas = within(canvasElement);
127
-
128
- await step('Tab navigation to alert', async () => {
129
- const alert = canvas.getByRole('alert');
130
- await userEvent.click(alert);
131
- await waitFor(() => expect(alert).toHaveFocus());
132
- });
133
-
134
- await step('Tab to close button', async () => {
135
- await userEvent.tab();
136
- const closeButton = canvas.getByLabelText('close alert');
137
- await waitFor(() => expect(closeButton).toHaveFocus());
138
- });
139
-
140
- await step('Activate close button with Enter', async () => {
141
- await userEvent.keyboard('{Enter}');
142
- await waitFor(() => {
143
- expect(args.onClose).toHaveBeenCalled();
144
- });
145
- });
146
- },
147
- };
148
-
149
- export const ScreenReaderTest: Story = {
150
- name: '🔊 Screen Reader Test',
151
- args: {
152
- variant: 'danger',
153
- title: 'Critical Error',
154
- description: 'This is an urgent alert for screen readers',
155
- closable: true,
156
- },
157
- play: async ({ canvasElement, step }) => {
158
- const canvas = within(canvasElement);
159
-
160
- await step('Verify ARIA attributes', async () => {
161
- const alert = canvas.getByRole('alert');
162
- await expect(alert).toHaveAttribute('aria-live', 'assertive');
163
- await expect(alert).toHaveAttribute('aria-atomic', 'true');
164
- await expect(alert).toHaveAttribute('role', 'alert');
165
- });
166
-
167
- await step('Verify close button accessibility', async () => {
168
- const closeButton = canvas.getByLabelText('close alert');
169
- await expect(closeButton).toBeInTheDocument();
170
- await expect(closeButton).toHaveAttribute('aria-label', 'close alert');
171
- });
172
-
173
- await step('Verify focusable elements', async () => {
174
- const alert = canvas.getByRole('alert');
175
- await expect(alert).toHaveAttribute('tabIndex', '0');
176
- });
177
- },
178
- };
179
-
180
- // Visual Tests
181
- export const AllVariantsVisual: Story = {
182
- name: '👁️ All Variants Visual Test',
183
- render: () => {
184
- const variants = ['info', 'success', 'warning', 'danger', 'glass', 'gradient'] as const;
185
-
186
- return (
187
- <Stack spacing={2}>
188
- {variants.map((variant) => (
189
- <Alert
190
- key={variant}
191
- variant={variant}
192
- title={`${variant.charAt(0).toUpperCase() + variant.slice(1)} Alert`}
193
- description={`This is a ${variant} alert with all features enabled`}
194
- closable
195
- showIcon
196
- data-testid={`alert-${variant}`}
197
- />
198
- ))}
199
- </Stack>
200
- );
201
- },
202
- play: async ({ canvasElement, step }) => {
203
- const canvas = within(canvasElement);
204
-
205
- await step('Verify all variants rendered', async () => {
206
- const variants = ['info', 'success', 'warning', 'danger', 'glass', 'gradient'];
207
-
208
- for (const variant of variants) {
209
- const alert = canvas.getByTestId(`alert-${variant}`);
210
- await expect(alert).toBeInTheDocument();
211
- }
212
- });
213
-
214
- await step('Verify visual hierarchy', async () => {
215
- const titles = canvas.getAllByText(/Alert$/);
216
- expect(titles).toHaveLength(6);
217
-
218
- titles.forEach(async (title) => {
219
- const computedStyle = window.getComputedStyle(title);
220
- await expect(parseFloat(computedStyle.fontWeight)).toBeGreaterThanOrEqual(600);
221
- });
222
- });
223
- },
224
- };
225
-
226
- export const ResponsiveDesign: Story = {
227
- name: '📱 Responsive Design Test',
228
- args: {
229
- variant: 'info',
230
- title: 'Responsive Alert',
231
- description:
232
- 'This alert adapts to different screen sizes. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
233
- closable: true,
234
- },
235
- parameters: {
236
- viewport: {
237
- viewports: {
238
- mobile: {
239
- name: 'Mobile',
240
- styles: { width: '375px', height: '667px' },
241
- type: 'mobile',
242
- },
243
- tablet: {
244
- name: 'Tablet',
245
- styles: { width: '768px', height: '1024px' },
246
- type: 'tablet',
247
- },
248
- desktop: {
249
- name: 'Desktop',
250
- styles: { width: '1920px', height: '1080px' },
251
- type: 'desktop',
252
- },
253
- },
254
- defaultViewport: 'mobile',
255
- },
256
- chromatic: {
257
- viewports: [375, 768, 1920],
258
- delay: 300,
259
- },
260
- },
261
- play: async ({ canvasElement, step }) => {
262
- const canvas = within(canvasElement);
263
-
264
- await step('Verify responsive layout', async () => {
265
- const alert = canvas.getByRole('alert');
266
- await expect(alert).toBeInTheDocument();
267
-
268
- // Check text wrapping
269
- const description = canvas.getByText(/Lorem ipsum/);
270
- const computedStyle = window.getComputedStyle(description);
271
- await expect(computedStyle.wordWrap).toBe('break-word');
272
- });
273
- },
274
- };
275
-
276
- export const ThemeVariations: Story = {
277
- name: '🎨 Theme Variations Test',
278
- render: () => {
279
- const lightTheme = createTheme({ palette: { mode: 'light' } });
280
- const darkTheme = createTheme({ palette: { mode: 'dark' } });
281
-
282
- return (
283
- <Stack spacing={4}>
284
- <ThemeProvider theme={lightTheme}>
285
- <Stack spacing={2}>
286
- <Alert variant="info" title="Light Theme" description="Alert in light theme" />
287
- <Alert
288
- variant="glass"
289
- title="Glass Effect"
290
- description="Glass morphism in light theme"
291
- />
292
- </Stack>
293
- </ThemeProvider>
294
-
295
- <ThemeProvider theme={darkTheme}>
296
- <Stack spacing={2} sx={{ bgcolor: 'background.default', p: 2, borderRadius: 1 }}>
297
- <Alert variant="info" title="Dark Theme" description="Alert in dark theme" />
298
- <Alert
299
- variant="glass"
300
- title="Glass Effect"
301
- description="Glass morphism in dark theme"
302
- />
303
- </Stack>
304
- </ThemeProvider>
305
- </Stack>
306
- );
307
- },
308
- play: async ({ canvasElement, step }) => {
309
- const canvas = within(canvasElement);
310
-
311
- await step('Verify theme variations', async () => {
312
- const alerts = canvas.getAllByRole('alert');
313
- expect(alerts).toHaveLength(4);
314
- });
315
- },
316
- };
317
-
318
- // Animation Tests
319
- export const AnimationEffects: Story = {
320
- name: '✨ Animation Effects Test',
321
- render: () => (
322
- <Stack spacing={2}>
323
- <Alert
324
- variant="success"
325
- title="Glow Effect"
326
- description="This alert has a glowing animation"
327
- glow
328
- data-testid="glow-alert"
329
- />
330
- <Alert
331
- variant="warning"
332
- title="Pulse Effect"
333
- description="This alert has a pulsing animation"
334
- pulse
335
- data-testid="pulse-alert"
336
- />
337
- <Alert
338
- variant="danger"
339
- title="Combined Effects"
340
- description="This alert has both glow and pulse"
341
- glow
342
- pulse
343
- data-testid="combined-alert"
344
- />
345
- <Alert
346
- variant="gradient"
347
- title="Gradient with Shimmer"
348
- description="This gradient alert has a shimmer effect"
349
- data-testid="gradient-alert"
350
- />
351
- </Stack>
352
- ),
353
- play: async ({ canvasElement, step }) => {
354
- const canvas = within(canvasElement);
355
-
356
- await step('Verify glow effect', async () => {
357
- const glowAlert = canvas.getByTestId('glow-alert');
358
- const computedStyle = window.getComputedStyle(glowAlert);
359
- await expect(computedStyle.boxShadow).toContain('rgb');
360
- });
361
-
362
- await step('Verify animations are applied', async () => {
363
- const pulseAlert = canvas.getByTestId('pulse-alert');
364
- await expect(pulseAlert).toBeInTheDocument();
365
-
366
- const combinedAlert = canvas.getByTestId('combined-alert');
367
- await expect(combinedAlert).toBeInTheDocument();
368
- });
369
- },
370
- };
371
-
372
- // Edge Cases Tests
373
- export const EdgeCases: Story = {
374
- name: '🔧 Edge Cases Test',
375
- render: () => (
376
- <Stack spacing={2}>
377
- <Alert variant="info" title="Empty Description" />
378
- <Alert variant="success" description="No Title Alert" />
379
- <Alert variant="warning" />
380
- <Alert
381
- variant="danger"
382
- title="Very Long Title That Should Wrap Properly When It Exceeds The Container Width"
383
- description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
384
- />
385
- <Alert
386
- variant="glass"
387
- showIcon={false}
388
- title="No Icon"
389
- description="This alert has no icon"
390
- />
391
- </Stack>
392
- ),
393
- play: async ({ canvasElement, step }) => {
394
- const canvas = within(canvasElement);
395
-
396
- await step('Verify edge cases handled', async () => {
397
- const alerts = canvas.getAllByRole('alert');
398
- expect(alerts).toHaveLength(5);
399
-
400
- // All alerts should render without errors
401
- alerts.forEach(async (alert) => {
402
- await expect(alert).toBeInTheDocument();
403
- });
404
- });
405
-
406
- await step('Verify text overflow handling', async () => {
407
- const longTitle = canvas.getByText(/Very Long Title/);
408
- const computedStyle = window.getComputedStyle(longTitle);
409
- await expect(computedStyle.wordWrap).toBe('break-word');
410
- });
411
- },
412
- };
413
-
414
- // Performance Test
415
- export const PerformanceTest: Story = {
416
- name: '⚡ Performance Test',
417
- render: () => {
418
- const alerts = Array.from({ length: 50 }, (_, i) => ({
419
- id: i,
420
- variant: (['info', 'success', 'warning', 'danger', 'glass', 'gradient'] as const)[i % 6],
421
- title: `Alert ${i + 1}`,
422
- description: `Performance test alert number ${i + 1}`,
423
- }));
424
-
425
- return (
426
- <Stack spacing={1} sx={{ maxHeight: '600px', overflow: 'auto' }}>
427
- {alerts.map((alert) => (
428
- <Alert
429
- key={alert.id}
430
- variant={alert.variant}
431
- title={alert.title}
432
- description={alert.description}
433
- data-testid={`perf-alert-${alert.id}`}
434
- />
435
- ))}
436
- </Stack>
437
- );
438
- },
439
- play: async ({ canvasElement, step }) => {
440
- const canvas = within(canvasElement);
441
-
442
- await step('Measure render performance', async () => {
443
- const startTime = window.performance.now();
444
- const alerts = canvas.getAllByRole('alert');
445
- const endTime = window.performance.now();
446
-
447
- const renderTime = endTime - startTime;
448
-
449
- expect(alerts).toHaveLength(50);
450
- await expect(renderTime).toBeLessThan(1000);
451
- });
452
- },
453
- };
454
-
455
- // State Management Test
456
- export const StateManagement: Story = {
457
- name: '🔄 State Management Test',
458
- args: {
459
- variant: 'info',
460
- title: 'Stateful Alert',
461
- description: 'This alert manages its own state',
462
- closable: true,
463
- onClose: fn(),
464
- },
465
- play: async ({ canvasElement, step, args }) => {
466
- const canvas = within(canvasElement);
467
-
468
- await step('Initial state', async () => {
469
- // Wait for the alert to be rendered and visible
470
- const alert = await waitFor(() => canvas.getByRole('alert'), { timeout: 1000 });
471
- await expect(alert).toBeInTheDocument();
472
- // Check visibility by verifying the element has content
473
- await expect(canvas.getByText('Stateful Alert')).toBeInTheDocument();
474
- await expect(canvas.getByText('This alert manages its own state')).toBeInTheDocument();
475
- });
476
-
477
- await step('Close alert', async () => {
478
- const closeButton = canvas.getByLabelText('close alert');
479
- await userEvent.click(closeButton);
480
-
481
- // Wait for closing animation
482
- await waitFor(
483
- () => {
484
- expect(args.onClose).toHaveBeenCalled();
485
- },
486
- { timeout: 500 },
487
- );
488
- });
489
- },
490
- };
491
-
492
- // Focus Management Test
493
- export const FocusManagement: Story = {
494
- name: '🎯 Focus Management Test',
495
- args: {
496
- variant: 'success',
497
- title: 'Focus Management',
498
- description: 'Testing focus states and trap',
499
- closable: true,
500
- showIcon: true,
501
- },
502
- play: async ({ canvasElement, step }) => {
503
- const canvas = within(canvasElement);
504
-
505
- await step('Alert receives focus', async () => {
506
- const alert = canvas.getByRole('alert');
507
- await userEvent.click(alert);
508
- await waitFor(() => expect(alert).toHaveFocus());
509
- });
510
-
511
- await step('Tab to close button', async () => {
512
- await userEvent.tab();
513
- const closeButton = canvas.getByLabelText('close alert');
514
- await waitFor(() => expect(closeButton).toHaveFocus());
515
- });
516
-
517
- await step('Tab cycles back', async () => {
518
- await userEvent.tab();
519
- // Should cycle back to document or next focusable element
520
- const alert = canvas.getByRole('alert');
521
- await waitFor(() => expect(alert).not.toHaveFocus());
522
- });
523
- },
524
- };
525
-
526
- // Integration Test with Form
527
- const FormIntegrationComponent = () => {
528
- const [showAlert, setShowAlert] = React.useState(false);
529
- const [alertMessage, setAlertMessage] = React.useState('');
530
-
531
- const handleSubmit = (e: React.FormEvent) => {
532
- e.preventDefault();
533
- setAlertMessage('Form submitted successfully!');
534
- setShowAlert(true);
535
- };
536
-
537
- return (
538
- <Stack spacing={2}>
539
- {showAlert && (
540
- <Alert
541
- variant="success"
542
- title="Success"
543
- description={alertMessage}
544
- closable
545
- onClose={() => setShowAlert(false)}
546
- data-testid="form-alert"
547
- />
548
- )}
549
- <form onSubmit={handleSubmit}>
550
- <Stack spacing={2}>
551
- <input type="text" placeholder="Enter your name" data-testid="form-input" required />
552
- <button type="submit" data-testid="form-submit">
553
- Submit
554
- </button>
555
- </Stack>
556
- </form>
557
- </Stack>
558
- );
559
- };
560
-
561
- export const FormIntegration: Story = {
562
- name: '🔗 Form Integration Test',
563
- render: FormIntegrationComponent,
564
- play: async ({ canvasElement, step }) => {
565
- const canvas = within(canvasElement);
566
-
567
- await step('Fill and submit form', async () => {
568
- const input = canvas.getByTestId('form-input');
569
- await userEvent.type(input, 'Test User');
570
-
571
- const submitButton = canvas.getByTestId('form-submit');
572
- await userEvent.click(submitButton);
573
- });
574
-
575
- await step('Alert appears after submission', async () => {
576
- const alert = await canvas.findByTestId('form-alert');
577
- await expect(alert).toBeInTheDocument();
578
- await expect(alert).toHaveTextContent('Form submitted successfully!');
579
- });
580
- },
581
- };
582
-
583
- // Custom Icon Test
584
- export const CustomIconTest: Story = {
585
- name: '🎨 Custom Icon Test',
586
- render: () => {
587
- const CustomIcon = () => (
588
- <div
589
- style={{
590
- width: 24,
591
- height: 24,
592
- borderRadius: '50%',
593
- background: 'linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)',
594
- display: 'flex',
595
- alignItems: 'center',
596
- justifyContent: 'center',
597
- color: 'white',
598
- fontWeight: 'bold',
599
- }}
600
- >
601
- !
602
- </div>
603
- );
604
-
605
- return (
606
- <Stack spacing={2}>
607
- <Alert
608
- variant="info"
609
- icon={<CustomIcon />}
610
- title="Custom Icon"
611
- description="This alert uses a custom icon component"
612
- data-testid="custom-icon-alert"
613
- />
614
- <Alert
615
- variant="success"
616
- showIcon={false}
617
- title="No Icon"
618
- description="This alert has icons disabled"
619
- data-testid="no-icon-alert"
620
- />
621
- </Stack>
622
- );
623
- },
624
- play: async ({ canvasElement, step }) => {
625
- const canvas = within(canvasElement);
626
-
627
- await step('Verify custom icon is rendered', async () => {
628
- const customAlert = canvas.getByTestId('custom-icon-alert');
629
- await expect(customAlert).toBeInTheDocument();
630
- // Custom icon should be visible
631
- const customIcon = customAlert.querySelector('.MuiAlert-icon');
632
- await expect(customIcon).toBeInTheDocument();
633
- });
634
-
635
- await step('Verify no icon when disabled', async () => {
636
- const noIconAlert = canvas.getByTestId('no-icon-alert');
637
- await waitFor(() => {
638
- expect(noIconAlert).toBeInTheDocument();
639
- expect(noIconAlert.querySelector('.MuiAlert-icon')).not.toBeInTheDocument();
640
- });
641
- });
642
- },
643
- };
644
-
645
- // Color Override Test
646
- export const ColorOverrideTest: Story = {
647
- name: '🎨 Color Override Test',
648
- render: () => (
649
- <Stack spacing={2}>
650
- <Alert variant="info" color="primary" title="Primary Color" />
651
- <Alert variant="info" color="secondary" title="Secondary Color" />
652
- <Alert variant="info" color="success" title="Success Color" />
653
- <Alert variant="info" color="warning" title="Warning Color" />
654
- <Alert variant="info" color="danger" title="Danger Color" />
655
- <Alert variant="info" color="neutral" title="Neutral Color" />
656
- </Stack>
657
- ),
658
- play: async ({ canvasElement, step }) => {
659
- const canvas = within(canvasElement);
660
-
661
- await step('Verify all color overrides', async () => {
662
- const alerts = canvas.getAllByRole('alert');
663
- expect(alerts).toHaveLength(6);
664
-
665
- // Each should have different styling
666
- alerts.forEach(async (alert) => {
667
- await expect(alert).toBeInTheDocument();
668
- const style = window.getComputedStyle(alert);
669
- await expect(style.backgroundColor).toBeTruthy();
670
- });
671
- });
672
- },
673
- };
674
-
675
- // Animation Control Test
676
- export const AnimationControl: Story = {
677
- name: '🎬 Animation Control Test',
678
- render: () => (
679
- <Stack spacing={2}>
680
- <Alert
681
- variant="success"
682
- title="With Animation"
683
- description="This alert animates on mount"
684
- animate={true}
685
- data-testid="animated-alert"
686
- />
687
- <Alert
688
- variant="warning"
689
- title="Without Animation"
690
- description="This alert appears instantly"
691
- animate={false}
692
- data-testid="static-alert"
693
- />
694
- </Stack>
695
- ),
696
- play: async ({ canvasElement, step }) => {
697
- const canvas = within(canvasElement);
698
-
699
- await step('Verify animation states', async () => {
700
- const animatedAlert = canvas.getByTestId('animated-alert');
701
- const staticAlert = canvas.getByTestId('static-alert');
702
-
703
- await expect(animatedAlert).toBeInTheDocument();
704
- await expect(staticAlert).toBeInTheDocument();
705
- });
706
- },
707
- };