@12-apps/ui 1.5.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/package.json +16 -8
  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,634 +0,0 @@
1
- import { Box, Button, Card, CardContent, TextField,Typography } 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 { TutorialOverlay } from './TutorialOverlay';
7
-
8
- const meta: Meta<typeof TutorialOverlay> = {
9
- title: 'Enhanced/TutorialOverlay/Tests',
10
- component: TutorialOverlay,
11
- parameters: {
12
- layout: 'fullscreen',
13
- chromatic: { disableSnapshot: false },
14
- },
15
- tags: ['autodocs', 'test', 'component:TutorialOverlay'],
16
- };
17
-
18
- export default meta;
19
- type Story = StoryObj<typeof meta>;
20
-
21
- const testSteps = [
22
- {
23
- id: '1',
24
- target: '#test-card',
25
- title: 'Tutorial Step 1',
26
- content: 'This is a test tutorial step.',
27
- position: 'bottom' as const,
28
- },
29
- {
30
- id: '2',
31
- target: '#test-input',
32
- title: 'Tutorial Step 2',
33
- content: 'This is the second test step.',
34
- position: 'top' as const,
35
- },
36
- ];
37
-
38
- const TestEnvironment = ({ children }: { children: React.ReactNode }) => (
39
- <Box sx={{ p: 4, minHeight: '100vh' }}>
40
- <Card id="test-card" sx={{ mb: 3 }}>
41
- <CardContent>
42
- <Typography variant="h6">Test Card</Typography>
43
- <Typography>This is a test card for tutorial targeting.</Typography>
44
- </CardContent>
45
- </Card>
46
-
47
- <TextField id="test-input" label="Test Input" variant="outlined" fullWidth sx={{ mb: 3 }} />
48
-
49
- <Button id="test-button" variant="contained">
50
- Test Button
51
- </Button>
52
-
53
- {children}
54
- </Box>
55
- );
56
-
57
- export const BasicInteraction: Story = {
58
- render: () => {
59
- const [showTutorial, setShowTutorial] = React.useState(true);
60
- const onCompleteMock = fn();
61
- const onSkipMock = fn();
62
-
63
- return (
64
- <TestEnvironment>
65
- {showTutorial && (
66
- <TutorialOverlay
67
- steps={testSteps}
68
- onComplete={() => {
69
- onCompleteMock();
70
- setShowTutorial(false);
71
- }}
72
- onSkip={() => {
73
- onSkipMock();
74
- setShowTutorial(false);
75
- }}
76
- variant="tooltip"
77
- showProgress
78
- allowSkip
79
- animated
80
- />
81
- )}
82
- </TestEnvironment>
83
- );
84
- },
85
- play: async ({ canvasElement }) => {
86
- const _canvas = within(canvasElement);
87
- // Tutorial is portaled to document.body
88
- const body = within(document.body);
89
-
90
- // Tutorial should be visible
91
- await waitFor(
92
- () => {
93
- expect(body.getByText('Tutorial Step 1')).toBeInTheDocument();
94
- },
95
- { timeout: 3000 },
96
- );
97
-
98
- // Should show progress indicator
99
- const progressElement = body.queryByText('1 of 2');
100
- if (progressElement) {
101
- expect(progressElement).toBeInTheDocument();
102
- }
103
-
104
- // Should show skip button when allowSkip is true
105
- const skipButton = body.queryByText('Skip');
106
- if (skipButton) {
107
- expect(skipButton).toBeInTheDocument();
108
- }
109
-
110
- // Navigate to next step
111
- const nextButton = body.queryByText('Next');
112
- if (nextButton) {
113
- await userEvent.click(nextButton);
114
- await waitFor(
115
- () => {
116
- expect(body.getByText('Tutorial Step 2')).toBeInTheDocument();
117
- },
118
- { timeout: 3000 },
119
- );
120
- }
121
- },
122
- };
123
-
124
- export const FormInteraction: Story = {
125
- render: () => {
126
- const [showTutorial, setShowTutorial] = React.useState(true);
127
-
128
- return (
129
- <TestEnvironment>
130
- {showTutorial && (
131
- <TutorialOverlay
132
- steps={[
133
- {
134
- id: '1',
135
- target: '#test-input',
136
- title: 'Fill Input',
137
- content: 'Please fill in this input field.',
138
- position: 'top',
139
- requiresAction: true,
140
- },
141
- {
142
- id: '2',
143
- target: '#test-button',
144
- title: 'Click Button',
145
- content: 'Now click this button to continue.',
146
- position: 'bottom',
147
- },
148
- ]}
149
- onComplete={() => setShowTutorial(false)}
150
- variant="highlight"
151
- showProgress
152
- />
153
- )}
154
- </TestEnvironment>
155
- );
156
- },
157
- play: async ({ canvasElement }) => {
158
- const _canvas = within(canvasElement);
159
- // Tutorial is portaled to document.body
160
- const body = within(document.body);
161
-
162
- // Wait for target elements to be available first
163
- await waitFor(
164
- () => {
165
- expect(canvas.getByLabelText('Test Input')).toBeInTheDocument();
166
- },
167
- { timeout: 3000 },
168
- );
169
-
170
- // Check if tutorial appears - be more lenient
171
- const tutorialText = body.queryByText('Fill Input');
172
- if (tutorialText) {
173
- expect(tutorialText).toBeInTheDocument();
174
- }
175
-
176
- // Interact with the targeted input
177
- const input = canvas.getByLabelText('Test Input');
178
- await userEvent.type(input, 'test value');
179
-
180
- expect(input).toHaveValue('test value');
181
- },
182
- };
183
-
184
- export const KeyboardNavigation: Story = {
185
- render: () => {
186
- const [showTutorial, setShowTutorial] = React.useState(true);
187
-
188
- return (
189
- <TestEnvironment>
190
- {showTutorial && (
191
- <TutorialOverlay
192
- steps={testSteps}
193
- onComplete={() => setShowTutorial(false)}
194
- onSkip={() => setShowTutorial(false)}
195
- variant="modal"
196
- showProgress
197
- allowSkip
198
- />
199
- )}
200
- </TestEnvironment>
201
- );
202
- },
203
- play: async ({ canvasElement }) => {
204
- const _canvas = within(canvasElement);
205
- // Tutorial is portaled to document.body
206
- const body = within(document.body);
207
-
208
- // Wait for the tutorial to appear
209
- await waitFor(
210
- () => {
211
- expect(body.getByText('Tutorial Step 1')).toBeInTheDocument();
212
- },
213
- { timeout: 3000 },
214
- );
215
-
216
- // Test Escape key to skip
217
- await userEvent.keyboard('{Escape}');
218
-
219
- // Tutorial should close after escape - check that tutorial text disappears
220
- await waitFor(
221
- () => {
222
- expect(body.queryByText('Tutorial Step 1')).not.toBeInTheDocument();
223
- },
224
- { timeout: 3000 },
225
- );
226
- },
227
- };
228
-
229
- export const ScreenReaderTest: Story = {
230
- render: () => (
231
- <TestEnvironment>
232
- <TutorialOverlay
233
- steps={[
234
- {
235
- id: '1',
236
- target: '#test-card',
237
- title: 'Accessible Tutorial',
238
- content: 'This tutorial step is screen reader accessible.',
239
- position: 'bottom',
240
- },
241
- ]}
242
- onComplete={() => {}}
243
- variant="tooltip"
244
- showProgress
245
- />
246
- </TestEnvironment>
247
- ),
248
- play: async ({ canvasElement }) => {
249
- const _canvas = within(canvasElement);
250
- // Tutorial is portaled to document.body
251
- const body = within(document.body);
252
-
253
- // Wait for tutorial to appear and check for ARIA attributes
254
- await waitFor(
255
- () => {
256
- const tutorialElement = body.getByRole('dialog');
257
- expect(tutorialElement).toHaveAttribute('aria-labelledby');
258
- expect(tutorialElement).toHaveAttribute('aria-describedby');
259
- },
260
- { timeout: 3000 },
261
- );
262
-
263
- // Check for accessible title
264
- expect(body.getByText('Accessible Tutorial')).toBeInTheDocument();
265
- },
266
- };
267
-
268
- export const FocusManagement: Story = {
269
- render: () => {
270
- const [showTutorial, setShowTutorial] = React.useState(false);
271
-
272
- return (
273
- <TestEnvironment>
274
- <Button onClick={() => setShowTutorial(true)} autoFocus>
275
- Start Tutorial
276
- </Button>
277
- {showTutorial && (
278
- <TutorialOverlay
279
- steps={testSteps}
280
- onComplete={() => setShowTutorial(false)}
281
- onSkip={() => setShowTutorial(false)}
282
- variant="spotlight"
283
- showProgress
284
- allowSkip
285
- />
286
- )}
287
- </TestEnvironment>
288
- );
289
- },
290
- play: async ({ canvasElement }) => {
291
- const _canvas = within(canvasElement);
292
- // Tutorial is portaled to document.body
293
- const body = within(document.body);
294
-
295
- // Start tutorial
296
- const startButton = canvas.getByText('Start Tutorial');
297
- await userEvent.click(startButton);
298
-
299
- // Focus should move to tutorial
300
- await waitFor(() => {
301
- const tutorialDialog = body.getByRole('dialog');
302
- expect(tutorialDialog).toBeInTheDocument();
303
- });
304
-
305
- // Focus should be trapped within tutorial
306
- await userEvent.keyboard('{Tab}');
307
- const focusedElement = document.activeElement;
308
- expect(focusedElement).toBeInstanceOf(window.Element);
309
- },
310
- };
311
-
312
- export const ResponsiveDesign: Story = {
313
- parameters: {
314
- viewport: {
315
- viewports: {
316
- mobile: { name: 'Mobile', styles: { width: '375px', height: '667px' } },
317
- tablet: { name: 'Tablet', styles: { width: '768px', height: '1024px' } },
318
- desktop: { name: 'Desktop', styles: { width: '1200px', height: '800px' } },
319
- },
320
- defaultViewport: 'mobile',
321
- },
322
- },
323
- render: () => (
324
- <TestEnvironment>
325
- <TutorialOverlay
326
- steps={testSteps}
327
- onComplete={() => {}}
328
- variant="tooltip"
329
- showProgress
330
- allowSkip
331
- animated
332
- />
333
- </TestEnvironment>
334
- ),
335
- play: async ({ canvasElement }) => {
336
- const _canvas = within(canvasElement);
337
- // Tutorial is portaled to document.body
338
- const body = within(document.body);
339
-
340
- // Tutorial should adapt to small screen
341
- await waitFor(() => {
342
- expect(canvas.getByText('Test Card')).toBeInTheDocument();
343
- });
344
-
345
- // Check if tutorial is properly positioned
346
- const tutorialDialog = body.getByRole('dialog');
347
- expect(tutorialDialog).toBeInTheDocument();
348
- },
349
- };
350
-
351
- export const ThemeVariations: Story = {
352
- render: () => (
353
- <TestEnvironment>
354
- <TutorialOverlay
355
- steps={[
356
- {
357
- id: '1',
358
- target: '#test-card',
359
- title: 'Themed Tutorial',
360
- content: 'This tutorial respects the current theme.',
361
- position: 'bottom',
362
- },
363
- ]}
364
- onComplete={() => {}}
365
- variant="spotlight"
366
- showProgress
367
- />
368
- </TestEnvironment>
369
- ),
370
- play: async ({ canvasElement }) => {
371
- const _canvas = within(canvasElement);
372
- // Tutorial is portaled to document.body
373
- const body = within(document.body);
374
-
375
- await waitFor(() => {
376
- expect(body.getByText('Themed Tutorial')).toBeInTheDocument();
377
- });
378
-
379
- // Check if theme styles are applied
380
- const tutorialDialog = body.getByRole('dialog');
381
- const computedStyle = window.getComputedStyle(tutorialDialog);
382
- expect(computedStyle).toBeDefined();
383
- },
384
- };
385
-
386
- export const VisualStates: Story = {
387
- render: () => {
388
- const [variant, setVariant] = React.useState<'tooltip' | 'modal' | 'highlight' | 'spotlight'>(
389
- 'tooltip',
390
- );
391
-
392
- return (
393
- <TestEnvironment>
394
- <Box sx={{ mb: 2 }}>
395
- {(['tooltip', 'modal', 'highlight', 'spotlight'] as const).map((v) => (
396
- <Button
397
- key={v}
398
- variant={variant === v ? 'contained' : 'outlined'}
399
- onClick={() => setVariant(v)}
400
- sx={{ mr: 1 }}
401
- >
402
- {v}
403
- </Button>
404
- ))}
405
- </Box>
406
- <TutorialOverlay
407
- steps={[
408
- {
409
- id: '1',
410
- target: '#test-card',
411
- title: `${variant} Variant`,
412
- content: `This shows the ${variant} visual state.`,
413
- position: 'bottom',
414
- },
415
- ]}
416
- onComplete={() => {}}
417
- variant={variant}
418
- showProgress
419
- />
420
- </TestEnvironment>
421
- );
422
- },
423
- play: async ({ canvasElement }) => {
424
- const _canvas = within(canvasElement);
425
- // Tutorial is portaled to document.body
426
- const body = within(document.body);
427
-
428
- // Test different visual states
429
- await waitFor(() => {
430
- expect(body.getByText(/Variant/)).toBeInTheDocument();
431
- });
432
-
433
- // Switch to different variants
434
- const modalButton = canvas.getByText('modal');
435
- await userEvent.click(modalButton);
436
-
437
- await waitFor(() => {
438
- expect(body.getByText('modal Variant')).toBeInTheDocument();
439
- });
440
- },
441
- };
442
-
443
- export const PerformanceTest: Story = {
444
- render: () => {
445
- const stepCount = 10;
446
-
447
- const manySteps = Array.from({ length: stepCount }, (_, i) => ({
448
- id: `${i + 1}`,
449
- target: i % 2 === 0 ? '#test-card' : '#test-input',
450
- title: `Step ${i + 1}`,
451
- content: `This is step ${i + 1} of ${stepCount} steps.`,
452
- position: (i % 2 === 0 ? 'bottom' : 'top') as const,
453
- }));
454
-
455
- return (
456
- <TestEnvironment>
457
- <TutorialOverlay
458
- steps={manySteps}
459
- onComplete={() => {}}
460
- variant="tooltip"
461
- showProgress
462
- animated
463
- />
464
- </TestEnvironment>
465
- );
466
- },
467
- play: async ({ canvasElement }) => {
468
- const _canvas = within(canvasElement);
469
- // Tutorial is portaled to document.body
470
- const body = within(document.body);
471
- const startTime = window.performance.now();
472
-
473
- // Tutorial should render quickly even with many steps
474
- await waitFor(() => {
475
- expect(body.getByText('Step 1')).toBeInTheDocument();
476
- });
477
-
478
- const endTime = window.performance.now();
479
- const renderTime = endTime - startTime;
480
-
481
- // Should render within reasonable time (less than 100ms)
482
- expect(renderTime).toBeLessThan(100);
483
- },
484
- };
485
-
486
- export const EdgeCases: Story = {
487
- render: () => {
488
- const [testCase, setTestCase] = React.useState('empty');
489
-
490
- const testCases = {
491
- empty: [],
492
- invalid: [
493
- {
494
- id: '1',
495
- target: '#nonexistent',
496
- title: 'Invalid Target',
497
- content: 'This targets a non-existent element.',
498
- },
499
- ],
500
- singleStep: [
501
- {
502
- id: '1',
503
- target: '#test-card',
504
- title: 'Single Step',
505
- content: 'Tutorial with only one step.',
506
- },
507
- ],
508
- };
509
-
510
- return (
511
- <TestEnvironment>
512
- <Box sx={{ mb: 2 }}>
513
- {Object.keys(testCases).map((key) => (
514
- <Button
515
- key={key}
516
- variant={testCase === key ? 'contained' : 'outlined'}
517
- onClick={() => setTestCase(key)}
518
- sx={{ mr: 1 }}
519
- >
520
- {key}
521
- </Button>
522
- ))}
523
- </Box>
524
- <TutorialOverlay
525
- steps={testCases[testCase as keyof typeof testCases]}
526
- onComplete={() => {}}
527
- variant="tooltip"
528
- showProgress
529
- />
530
- </TestEnvironment>
531
- );
532
- },
533
- play: async ({ canvasElement }) => {
534
- const _canvas = within(canvasElement);
535
- // Tutorial is portaled to document.body
536
- const body = within(document.body);
537
-
538
- // Test single step case
539
- const singleStepButton = canvas.getByText('singleStep');
540
- await userEvent.click(singleStepButton);
541
-
542
- await waitFor(() => {
543
- expect(body.getByText('Single Step')).toBeInTheDocument();
544
- });
545
-
546
- // Single step should not show "Next" button
547
- await waitFor(() => expect(body.queryByText('Next')).not.toBeInTheDocument());
548
- },
549
- };
550
-
551
- export const IntegrationTest: Story = {
552
- render: () => {
553
- const [tutorials, setTutorials] = React.useState<{
554
- onboarding: boolean;
555
- features: boolean;
556
- }>({ onboarding: false, features: false });
557
-
558
- return (
559
- <TestEnvironment>
560
- <Box sx={{ mb: 2 }}>
561
- <Button
562
- variant="outlined"
563
- onClick={() => setTutorials((prev) => ({ ...prev, onboarding: true }))}
564
- sx={{ mr: 1 }}
565
- >
566
- Start Onboarding
567
- </Button>
568
- <Button
569
- variant="outlined"
570
- onClick={() => setTutorials((prev) => ({ ...prev, features: true }))}
571
- >
572
- Start Features Tour
573
- </Button>
574
- </Box>
575
-
576
- {tutorials.onboarding && (
577
- <TutorialOverlay
578
- steps={[
579
- {
580
- id: '1',
581
- target: '#test-card',
582
- title: 'Onboarding Step',
583
- content: 'Welcome to the onboarding tutorial.',
584
- },
585
- ]}
586
- onComplete={() => setTutorials((prev) => ({ ...prev, onboarding: false }))}
587
- variant="spotlight"
588
- showProgress
589
- />
590
- )}
591
-
592
- {tutorials.features && (
593
- <TutorialOverlay
594
- steps={[
595
- {
596
- id: '1',
597
- target: '#test-input',
598
- title: 'Feature Tour',
599
- content: 'This is the features tutorial.',
600
- },
601
- ]}
602
- onComplete={() => setTutorials((prev) => ({ ...prev, features: false }))}
603
- variant="highlight"
604
- showProgress
605
- />
606
- )}
607
- </TestEnvironment>
608
- );
609
- },
610
- play: async ({ canvasElement }) => {
611
- const _canvas = within(canvasElement);
612
- // Tutorial is portaled to document.body
613
- const body = within(document.body);
614
-
615
- // Start onboarding tutorial
616
- const onboardingButton = canvas.getByText('Start Onboarding');
617
- await userEvent.click(onboardingButton);
618
-
619
- await waitFor(() => {
620
- expect(body.getByText('Onboarding Step')).toBeInTheDocument();
621
- });
622
-
623
- // Complete tutorial (single step uses "Complete" button)
624
- const completeButton = body.queryByText('Complete');
625
- if (completeButton) {
626
- await userEvent.click(completeButton);
627
-
628
- // Wait for tutorial to close
629
- await waitFor(() => {
630
- expect(body.queryByText('Onboarding Step')).not.toBeInTheDocument();
631
- }, { timeout: 3000 });
632
- }
633
- },
634
- };