@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,603 +0,0 @@
1
- import Favorite from '@mui/icons-material/Favorite';
2
- import Refresh from '@mui/icons-material/Refresh';
3
- import Settings from '@mui/icons-material/Settings';
4
- import Star from '@mui/icons-material/Star';
5
- import { Box, Stack, Typography } from '@mui/material';
6
- import type { Meta, StoryObj } from '@storybook/react-vite';
7
- import React from 'react';
8
- import { expect, fn,userEvent, waitFor, within } from 'storybook/test';
9
-
10
- import { AnimatedIcon } from './AnimatedIcon';
11
-
12
- const meta: Meta<typeof AnimatedIcon> = {
13
- title: 'Enhanced/AnimatedIcon/Tests',
14
- component: AnimatedIcon,
15
- parameters: {
16
- layout: 'centered',
17
- chromatic: { disableSnapshot: false },
18
- },
19
- tags: ['autodocs', 'test'],
20
- };
21
-
22
- export default meta;
23
- export type Story = StoryObj<typeof meta>;
24
-
25
- // Basic Interaction Tests
26
- export const BasicInteraction: Story = {
27
- args: {
28
- children: <Settings />,
29
- variant: 'rotate',
30
- size: 'md',
31
- onClick: fn(),
32
- dataTestId: 'animated-icon-basic',
33
- },
34
- play: async ({ args, canvasElement }) => {
35
- const canvas = within(canvasElement);
36
- const animatedIcon = canvas.getByRole('img');
37
-
38
- // Test that component renders
39
- await expect(animatedIcon).toBeInTheDocument();
40
-
41
- // Test data-testid attribute
42
- await expect(animatedIcon).toHaveAttribute('data-testid', 'animated-icon-basic');
43
- const iconByTestId = canvas.getByTestId('animated-icon-basic');
44
- await expect(iconByTestId).toBeInTheDocument();
45
-
46
- // Test click functionality
47
- await userEvent.click(animatedIcon);
48
- await expect(args.onClick).toHaveBeenCalledTimes(1);
49
-
50
- // Test aria-label
51
- await expect(animatedIcon).toHaveAttribute('aria-label');
52
- },
53
- };
54
-
55
- // Form Interaction Tests
56
- const FormInteractionComponent = () => {
57
- const [selectedIcon, setSelectedIcon] = React.useState<string>('settings');
58
-
59
- return (
60
- <Stack spacing={3} alignItems="center">
61
- <Typography variant="h6">Select an Icon</Typography>
62
- <Stack direction="row" spacing={3}>
63
- {[
64
- { key: 'settings', icon: <Settings />, label: 'Settings' },
65
- { key: 'favorite', icon: <Favorite />, label: 'Favorite' },
66
- { key: 'star', icon: <Star />, label: 'Star' },
67
- ].map(({ key, icon, label }) => (
68
- <AnimatedIcon
69
- key={key}
70
- variant={selectedIcon === key ? 'pulse' : 'none'}
71
- size="lg"
72
- color={selectedIcon === key ? '#FF6B6B' : undefined}
73
- glow={selectedIcon === key}
74
- onClick={() => setSelectedIcon(key)}
75
- aria-label={`Select ${label} icon`}
76
- dataTestId={`animated-icon-${key}`}
77
- >
78
- {icon}
79
- </AnimatedIcon>
80
- ))}
81
- </Stack>
82
- <Typography variant="body2" data-testid="selected-icon">
83
- Selected: {selectedIcon}
84
- </Typography>
85
- </Stack>
86
- );
87
- };
88
-
89
- export const FormInteraction: Story = {
90
- render: () => <FormInteractionComponent />,
91
- play: async ({ canvasElement }) => {
92
- const canvas = within(canvasElement);
93
-
94
- // Test initial state
95
- const selectedText = canvas.getByTestId('selected-icon');
96
- await expect(selectedText).toHaveTextContent('Selected: settings');
97
-
98
- // Test that testIds are present
99
- const settingsIcon = canvas.getByTestId('animated-icon-settings');
100
- const favoriteIcon = canvas.getByTestId('animated-icon-favorite');
101
- const starIcon = canvas.getByTestId('animated-icon-star');
102
- await expect(settingsIcon).toBeInTheDocument();
103
- await expect(favoriteIcon).toBeInTheDocument();
104
- await expect(starIcon).toBeInTheDocument();
105
-
106
- // Test clicking different icons using testId
107
- await userEvent.click(favoriteIcon);
108
-
109
- await waitFor(async () => {
110
- await expect(selectedText).toHaveTextContent('Selected: favorite');
111
- });
112
-
113
- // Test star icon using testId
114
- await userEvent.click(starIcon);
115
-
116
- await waitFor(async () => {
117
- await expect(selectedText).toHaveTextContent('Selected: star');
118
- });
119
- },
120
- };
121
-
122
- // Keyboard Navigation Tests
123
- export const KeyboardNavigation: Story = {
124
- render: () => (
125
- <Stack spacing={3} alignItems="center">
126
- <Typography variant="h6">Keyboard Navigation Test</Typography>
127
- <Stack direction="row" spacing={3}>
128
- <AnimatedIcon
129
- variant="rotate"
130
- size="md"
131
- onClick={fn()}
132
- aria-label="First animated icon"
133
- tabIndex={0}
134
- >
135
- <Settings />
136
- </AnimatedIcon>
137
- <AnimatedIcon
138
- variant="pulse"
139
- size="md"
140
- onClick={fn()}
141
- aria-label="Second animated icon"
142
- tabIndex={0}
143
- >
144
- <Favorite />
145
- </AnimatedIcon>
146
- <AnimatedIcon
147
- variant="translate"
148
- size="md"
149
- onClick={fn()}
150
- aria-label="Third animated icon"
151
- tabIndex={0}
152
- >
153
- <Star />
154
- </AnimatedIcon>
155
- </Stack>
156
- </Stack>
157
- ),
158
- play: async ({ canvasElement }) => {
159
- const canvas = within(canvasElement);
160
-
161
- // Test tab navigation
162
- const firstIcon = canvas.getByLabelText('First animated icon');
163
- const secondIcon = canvas.getByLabelText('Second animated icon');
164
- const thirdIcon = canvas.getByLabelText('Third animated icon');
165
-
166
- // Tab to the first icon rather than focusing it directly, so the whole
167
- // sequence below exercises one keyboard journey through the three icons.
168
- await userEvent.tab();
169
- await waitFor(() => expect(firstIcon).toHaveFocus());
170
-
171
- // Tab to second icon
172
- await userEvent.tab();
173
- await waitFor(() => expect(secondIcon).toHaveFocus());
174
-
175
- // Tab to third icon
176
- await userEvent.tab();
177
- await waitFor(() => expect(thirdIcon).toHaveFocus());
178
-
179
- // Test Enter key activation
180
- await userEvent.keyboard('{Enter}');
181
- // Note: onClick would be called, but we can't test it directly in this context
182
- },
183
- };
184
-
185
- // Test ID Tests
186
- export const TestIdVerification: Story = {
187
- render: () => (
188
- <Stack spacing={3} alignItems="center">
189
- <Typography variant="h6">Test ID Verification</Typography>
190
- <Stack direction="row" spacing={3}>
191
- <AnimatedIcon
192
- variant="rotate"
193
- size="md"
194
- dataTestId="icon-with-testid"
195
- aria-label="Icon with test ID"
196
- >
197
- <Settings />
198
- </AnimatedIcon>
199
- <AnimatedIcon
200
- variant="pulse"
201
- size="md"
202
- aria-label="Icon without test ID"
203
- >
204
- <Favorite />
205
- </AnimatedIcon>
206
- </Stack>
207
- </Stack>
208
- ),
209
- play: async ({ canvasElement }) => {
210
- const canvas = within(canvasElement);
211
-
212
- // Test that icon with testId can be queried
213
- const iconWithTestId = canvas.getByTestId('icon-with-testid');
214
- await expect(iconWithTestId).toBeInTheDocument();
215
- await expect(iconWithTestId).toHaveAttribute('data-testid', 'icon-with-testid');
216
-
217
- // Test that icon without testId doesn't have the attribute
218
- const iconWithoutTestId = canvas.getByLabelText('Icon without test ID');
219
- await expect(iconWithoutTestId).toBeInTheDocument();
220
- await expect(iconWithoutTestId).not.toHaveAttribute('data-testid');
221
- },
222
- };
223
-
224
- // Screen Reader Tests
225
- export const ScreenReader: Story = {
226
- args: {
227
- children: <Refresh />,
228
- variant: 'rotate',
229
- size: 'lg',
230
- 'aria-label': 'Loading animation icon',
231
- },
232
- play: async ({ canvasElement }) => {
233
- const canvas = within(canvasElement);
234
- const icon = canvas.getByRole('img');
235
-
236
- // Test that proper ARIA attributes are present
237
- await expect(icon).toHaveAttribute('role', 'img');
238
- await expect(icon).toHaveAttribute('aria-label', 'Loading animation icon');
239
-
240
- // Test that the icon is accessible to screen readers
241
- const description = canvas.getByLabelText('Loading animation icon');
242
- await expect(description).toBeInTheDocument();
243
- },
244
- };
245
-
246
- // Focus Management Tests
247
- const FocusManagementComponent = () => {
248
- const [focusedIndex, setFocusedIndex] = React.useState<number | null>(null);
249
-
250
- return (
251
- <Stack spacing={3} alignItems="center">
252
- <Typography variant="h6">Focus Management</Typography>
253
- <Stack direction="row" spacing={3}>
254
- {[0, 1, 2].map((index) => (
255
- <AnimatedIcon
256
- key={index}
257
- variant={focusedIndex === index ? 'pulse' : 'none'}
258
- size="lg"
259
- glow={focusedIndex === index}
260
- onFocus={() => setFocusedIndex(index)}
261
- onBlur={() => setFocusedIndex(null)}
262
- tabIndex={0}
263
- aria-label={`Focus test icon ${index + 1}`}
264
- >
265
- <Settings />
266
- </AnimatedIcon>
267
- ))}
268
- </Stack>
269
- </Stack>
270
- );
271
- };
272
-
273
- export const FocusManagement: Story = {
274
- render: () => <FocusManagementComponent />,
275
- play: async ({ canvasElement }) => {
276
- const canvas = within(canvasElement);
277
-
278
- // Test focus events
279
- const firstIcon = canvas.getByLabelText('Focus test icon 1');
280
- const secondIcon = canvas.getByLabelText('Focus test icon 2');
281
-
282
- // Focus first icon
283
- await userEvent.tab();
284
- await waitFor(() => expect(firstIcon).toHaveFocus());
285
-
286
- // Move focus to second icon — asserted together so the hand-off is checked
287
- // as one state, not as two reads that could straddle a re-render.
288
- await userEvent.tab();
289
- await waitFor(() => {
290
- expect(secondIcon).toHaveFocus();
291
- expect(firstIcon).not.toHaveFocus();
292
- });
293
- },
294
- };
295
-
296
- // Responsive Design Tests
297
- export const ResponsiveDesign: Story = {
298
- render: () => (
299
- <Stack spacing={3}>
300
- <Typography variant="h6">Responsive Sizes</Typography>
301
- <Stack direction="row" spacing={3} flexWrap="wrap">
302
- {(['sm', 'md', 'lg', 'xl'] as const).map((size) => (
303
- <Box key={size} textAlign="center">
304
- <AnimatedIcon variant="pulse" size={size}>
305
- <Star />
306
- </AnimatedIcon>
307
- <Typography variant="caption" display="block" mt={1}>
308
- {size.toUpperCase()}
309
- </Typography>
310
- </Box>
311
- ))}
312
- </Stack>
313
- </Stack>
314
- ),
315
- play: async ({ canvasElement }) => {
316
- const canvas = within(canvasElement);
317
-
318
- // Test that all size variants render
319
- const sizes = ['SM', 'MD', 'LG', 'XL'];
320
- for (const size of sizes) {
321
- const sizeLabel = canvas.getByText(size);
322
- await expect(sizeLabel).toBeInTheDocument();
323
- }
324
- },
325
- parameters: {
326
- viewport: {
327
- viewports: {
328
- mobile: { name: 'Mobile', styles: { width: '375px', height: '667px' } },
329
- tablet: { name: 'Tablet', styles: { width: '768px', height: '1024px' } },
330
- desktop: { name: 'Desktop', styles: { width: '1200px', height: '800px' } },
331
- },
332
- },
333
- },
334
- };
335
-
336
- // Theme Variation Tests
337
- export const ThemeVariations: Story = {
338
- render: () => (
339
- <Stack spacing={3}>
340
- <Typography variant="h6">Theme Variations</Typography>
341
- <Stack direction="row" spacing={3}>
342
- <Box sx={{ p: 2, bgcolor: 'background.paper', borderRadius: 1 }}>
343
- <AnimatedIcon variant="rotate" size="lg">
344
- <Settings />
345
- </AnimatedIcon>
346
- </Box>
347
- <Box sx={{ p: 2, bgcolor: 'primary.main', borderRadius: 1 }}>
348
- <AnimatedIcon variant="pulse" size="lg" color="#ffffff">
349
- <Favorite />
350
- </AnimatedIcon>
351
- </Box>
352
- <Box sx={{ p: 2, bgcolor: 'secondary.main', borderRadius: 1 }}>
353
- <AnimatedIcon variant="translate" size="lg" color="#ffffff">
354
- <Star />
355
- </AnimatedIcon>
356
- </Box>
357
- </Stack>
358
- </Stack>
359
- ),
360
- play: async ({ canvasElement }) => {
361
- const canvas = within(canvasElement);
362
- const icons = canvas.getAllByRole('img');
363
-
364
- // Test that all theme variations render
365
- await expect(icons).toHaveLength(3);
366
-
367
- // Test that icons are properly themed
368
- for (const icon of icons) {
369
- await expect(icon).toBeVisible();
370
- }
371
- },
372
- };
373
-
374
- // Visual States Tests
375
- export const VisualStates: Story = {
376
- render: () => (
377
- <Stack spacing={4}>
378
- <Typography variant="h6">Visual Animation States</Typography>
379
- <Stack spacing={3}>
380
- <Box>
381
- <Typography variant="subtitle2" gutterBottom>
382
- Animation Variants
383
- </Typography>
384
- <Stack direction="row" spacing={3}>
385
- <AnimatedIcon variant="rotate" size="lg" aria-label="Rotating icon">
386
- <Refresh />
387
- </AnimatedIcon>
388
- <AnimatedIcon variant="pulse" size="lg" aria-label="Pulsing icon">
389
- <Favorite />
390
- </AnimatedIcon>
391
- <AnimatedIcon variant="translate" size="lg" aria-label="Translating icon">
392
- <Star />
393
- </AnimatedIcon>
394
- <AnimatedIcon variant="none" size="lg" aria-label="Static icon">
395
- <Settings />
396
- </AnimatedIcon>
397
- </Stack>
398
- </Box>
399
-
400
- <Box>
401
- <Typography variant="subtitle2" gutterBottom>
402
- Effects
403
- </Typography>
404
- <Stack direction="row" spacing={3}>
405
- <AnimatedIcon variant="pulse" size="lg" glow aria-label="Glowing icon">
406
- <Star />
407
- </AnimatedIcon>
408
- <AnimatedIcon variant="rotate" size="lg" glass aria-label="Glass effect icon">
409
- <Settings />
410
- </AnimatedIcon>
411
- </Stack>
412
- </Box>
413
- </Stack>
414
- </Stack>
415
- ),
416
- play: async ({ canvasElement }) => {
417
- const canvas = within(canvasElement);
418
-
419
- // Test that all visual states render
420
- const rotatingIcon = canvas.getByLabelText('Rotating icon');
421
- const pulsingIcon = canvas.getByLabelText('Pulsing icon');
422
- const translatingIcon = canvas.getByLabelText('Translating icon');
423
- const staticIcon = canvas.getByLabelText('Static icon');
424
- const glowingIcon = canvas.getByLabelText('Glowing icon');
425
- const glassIcon = canvas.getByLabelText('Glass effect icon');
426
-
427
- await expect(rotatingIcon).toBeVisible();
428
- await expect(pulsingIcon).toBeVisible();
429
- await expect(translatingIcon).toBeVisible();
430
- await expect(staticIcon).toBeVisible();
431
- await expect(glowingIcon).toBeVisible();
432
- await expect(glassIcon).toBeVisible();
433
- },
434
- };
435
-
436
- // Performance Tests
437
- export const Performance: Story = {
438
- render: () => {
439
- const icons = Array.from({ length: 20 }, (_, i) => (
440
- <AnimatedIcon
441
- key={i}
442
- variant={(['rotate', 'pulse', 'translate'] as const)[i % 3]}
443
- size="md"
444
- duration={1 + (i % 3)}
445
- >
446
- <Settings />
447
- </AnimatedIcon>
448
- ));
449
-
450
- return (
451
- <Stack spacing={3}>
452
- <Typography variant="h6">Performance Test - 20 Animated Icons</Typography>
453
- <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: 2 }}>{icons}</Box>
454
- </Stack>
455
- );
456
- },
457
- play: async ({ canvasElement }) => {
458
- const canvas = within(canvasElement);
459
- const icons = canvas.getAllByRole('img');
460
-
461
- // Test that all icons render without performance issues
462
- await expect(icons).toHaveLength(20);
463
-
464
- // Test that animations are working
465
- for (const icon of icons.slice(0, 5)) {
466
- // Test first 5 to avoid timeout
467
- await expect(icon).toBeVisible();
468
- }
469
- },
470
- };
471
-
472
- // Edge Cases Tests
473
- export const EdgeCases: Story = {
474
- render: () => (
475
- <Stack spacing={4}>
476
- <Typography variant="h6">Edge Cases</Typography>
477
-
478
- <Box>
479
- <Typography variant="subtitle2" gutterBottom>
480
- No Children
481
- </Typography>
482
- <AnimatedIcon variant="pulse" size="md" aria-label="Empty icon">
483
- {null}
484
- </AnimatedIcon>
485
- </Box>
486
-
487
- <Box>
488
- <Typography variant="subtitle2" gutterBottom>
489
- Very Long Duration
490
- </Typography>
491
- <AnimatedIcon variant="rotate" size="md" duration={10}>
492
- <Settings />
493
- </AnimatedIcon>
494
- </Box>
495
-
496
- <Box>
497
- <Typography variant="subtitle2" gutterBottom>
498
- Very Short Duration
499
- </Typography>
500
- <AnimatedIcon variant="pulse" size="md" duration={0.1}>
501
- <Favorite />
502
- </AnimatedIcon>
503
- </Box>
504
-
505
- <Box>
506
- <Typography variant="subtitle2" gutterBottom>
507
- With Delay
508
- </Typography>
509
- <AnimatedIcon variant="translate" size="md" delay={2}>
510
- <Star />
511
- </AnimatedIcon>
512
- </Box>
513
-
514
- <Box>
515
- <Typography variant="subtitle2" gutterBottom>
516
- Non-looping Animation
517
- </Typography>
518
- <AnimatedIcon variant="pulse" size="md" loop={false}>
519
- <Settings />
520
- </AnimatedIcon>
521
- </Box>
522
- </Stack>
523
- ),
524
- play: async ({ canvasElement }) => {
525
- const canvas = within(canvasElement);
526
-
527
- // Test that edge cases don't break the component
528
- const emptyIcon = canvas.getByLabelText('Empty icon');
529
- await expect(emptyIcon).toBeInTheDocument();
530
-
531
- // Test that all animations render
532
- const icons = canvas.getAllByRole('img');
533
- await expect(icons.length).toBeGreaterThan(0);
534
-
535
- for (const icon of icons) {
536
- await expect(icon).toBeVisible();
537
- }
538
- },
539
- };
540
-
541
- // Integration Tests
542
- export const Integration: Story = {
543
- render: () => (
544
- <Stack spacing={3}>
545
- <Typography variant="h6">Integration with Other Components</Typography>
546
-
547
- {/* Integration with Button-like behavior */}
548
- <Box sx={{ p: 2, border: '1px solid', borderColor: 'divider', borderRadius: 1 }}>
549
- <Stack direction="row" spacing={2} alignItems="center">
550
- <AnimatedIcon variant="rotate" size="sm">
551
- <Refresh />
552
- </AnimatedIcon>
553
- <Typography>Refreshing data...</Typography>
554
- </Stack>
555
- </Box>
556
-
557
- {/* Integration with form-like behavior */}
558
- <Box sx={{ p: 2, bgcolor: 'background.paper', borderRadius: 1 }}>
559
- <Stack direction="row" spacing={2} alignItems="center">
560
- <AnimatedIcon variant="pulse" size="md" glow glowColor="#4CAF50">
561
- <Favorite />
562
- </AnimatedIcon>
563
- <Typography>Like this content</Typography>
564
- </Stack>
565
- </Box>
566
-
567
- {/* Integration with complex layouts */}
568
- <Box sx={{ p: 3, background: 'linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)' }}>
569
- <Stack direction="row" spacing={3} alignItems="center">
570
- <AnimatedIcon variant="translate" size="lg" glass color="#ffffff">
571
- <Star />
572
- </AnimatedIcon>
573
- <Box>
574
- <Typography variant="h6" sx={{ color: 'common.white' }}>
575
- Premium Feature
576
- </Typography>
577
- <Typography variant="body2" sx={{ color: 'rgba(255,255,255,0.8)' }}>
578
- Enhanced with glass morphism
579
- </Typography>
580
- </Box>
581
- </Stack>
582
- </Box>
583
- </Stack>
584
- ),
585
- play: async ({ canvasElement }) => {
586
- const canvas = within(canvasElement);
587
-
588
- // Test integration scenarios
589
- const refreshText = canvas.getByText('Refreshing data...');
590
- const likeText = canvas.getByText('Like this content');
591
- const premiumText = canvas.getByText('Premium Feature');
592
-
593
- await expect(refreshText).toBeInTheDocument();
594
- await expect(likeText).toBeInTheDocument();
595
- await expect(premiumText).toBeInTheDocument();
596
-
597
- // Test that icons are still functional in integrated contexts
598
- const icons = canvas.getAllByRole('img');
599
- for (const icon of icons) {
600
- await expect(icon).toBeVisible();
601
- }
602
- },
603
- };