@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.
- package/package.json +17 -9
- package/src/button/index.ts +1 -0
- package/src/social-login-button/index.ts +1 -0
- package/src/{social-login-button.tsx → social-login-button/social-login-button.tsx} +5 -5
- package/src/user-avatar/index.ts +1 -0
- package/src/{user-avatar.tsx → user-avatar/user-avatar.tsx} +4 -4
- package/eslint.config.js +0 -89
- package/src/__tests__/data-grid.test.tsx +0 -125
- package/src/__tests__/package-wiring.test.ts +0 -41
- package/src/__tests__/setup.ts +0 -1
- package/src/__tests__/social-login-button.test.tsx +0 -186
- package/src/__tests__/user-avatar.test.tsx +0 -195
- package/src/__tests__/viewport.test.ts +0 -50
- package/src/components/command/__tests__/command.test.tsx +0 -112
- package/src/components/data-display/Alert/Alert.stories.tsx +0 -559
- package/src/components/data-display/Alert/Alert.test.stories.tsx +0 -707
- package/src/components/data-display/AlertDialog/AlertDialog.stories.tsx +0 -362
- package/src/components/data-display/AlertDialog/AlertDialog.test.stories.tsx +0 -763
- package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.stories.tsx +0 -230
- package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.test.stories.tsx +0 -270
- package/src/components/data-display/Avatar/Avatar.stories.tsx +0 -721
- package/src/components/data-display/Avatar/Avatar.test.stories.tsx +0 -822
- package/src/components/data-display/Badge/Badge.stories.tsx +0 -1134
- package/src/components/data-display/Badge/Badge.test.stories.tsx +0 -1194
- package/src/components/data-display/Banner/Banner.stories.tsx +0 -528
- package/src/components/data-display/Banner/Banner.test.stories.tsx +0 -511
- package/src/components/data-display/Carousel/Carousel.stories.tsx +0 -607
- package/src/components/data-display/Carousel/Carousel.test.stories.tsx +0 -701
- package/src/components/data-display/Chart/Chart.stories.tsx +0 -568
- package/src/components/data-display/Chart/Chart.test.stories.tsx +0 -174
- package/src/components/data-display/Chart/SpecChart.stories.tsx +0 -150
- package/src/components/data-display/Chart/SpecChart.test.stories.tsx +0 -56
- package/src/components/data-display/Chart/__tests__/SpecChart.test.tsx +0 -60
- package/src/components/data-display/Chart/__tests__/chart-format.test.ts +0 -43
- package/src/components/data-display/Chart/__tests__/chart-spec.test.ts +0 -119
- package/src/components/data-display/Chip/Chip.stories.tsx +0 -252
- package/src/components/data-display/Chip/Chip.test.stories.tsx +0 -266
- package/src/components/data-display/DataGrid/DataGrid.stories.tsx +0 -515
- package/src/components/data-display/DataGrid/DataGrid.test.stories.tsx +0 -653
- package/src/components/data-display/DataViews/__tests__/DataViewsGrid.test.tsx +0 -271
- package/src/components/data-display/DataViews/__tests__/DataViewsTableBase.test.tsx +0 -134
- package/src/components/data-display/DataViews/__tests__/SaveViewModal.test.tsx +0 -83
- package/src/components/data-display/DataViews/__tests__/data-views-filter.test.ts +0 -115
- package/src/components/data-display/DataViews/__tests__/data-views-preview.test.ts +0 -53
- package/src/components/data-display/DataViews/__tests__/range-pill.test.tsx +0 -114
- package/src/components/data-display/DataViews/base-card.stories.tsx +0 -136
- package/src/components/data-display/DescriptionItem/DescriptionItem.stories.tsx +0 -254
- package/src/components/data-display/EmptyState/EmptyState.stories.tsx +0 -282
- package/src/components/data-display/EmptyState/EmptyState.test.stories.tsx +0 -441
- package/src/components/data-display/ErrorState/ErrorState.stories.tsx +0 -110
- package/src/components/data-display/ErrorState/ErrorState.test.stories.tsx +0 -133
- package/src/components/data-display/HoverCard/HoverCard.stories.tsx +0 -650
- package/src/components/data-display/HoverCard/HoverCard.test.stories.tsx +0 -929
- package/src/components/data-display/InteractiveTooltip/InteractiveTooltip.stories.tsx +0 -411
- package/src/components/data-display/LazyImage/LazyImage.stories.tsx +0 -387
- package/src/components/data-display/Lightbox/Lightbox.stories.tsx +0 -315
- package/src/components/data-display/Lightbox/Lightbox.test.stories.tsx +0 -598
- package/src/components/data-display/LoadingState/LoadingState.stories.tsx +0 -124
- package/src/components/data-display/LoadingState/LoadingState.test.stories.tsx +0 -99
- package/src/components/data-display/MapPreview/MapPreview.stories.tsx +0 -458
- package/src/components/data-display/MapPreview/MapPreview.test.stories.tsx +0 -394
- package/src/components/data-display/Popover/Popover.stories.tsx +0 -295
- package/src/components/data-display/Popover/Popover.test.stories.tsx +0 -1162
- package/src/components/data-display/Progress/Progress.stories.tsx +0 -481
- package/src/components/data-display/Progress/Progress.test.stories.tsx +0 -2070
- package/src/components/data-display/SectionOnboarding/SectionOnboarding.stories.tsx +0 -160
- package/src/components/data-display/SectionOnboarding/SectionOnboarding.test.stories.tsx +0 -190
- package/src/components/data-display/Sheet/Sheet.stories.tsx +0 -883
- package/src/components/data-display/Sheet/Sheet.test.stories.tsx +0 -1105
- package/src/components/data-display/StatCard/StatCard.stories.tsx +0 -167
- package/src/components/data-display/StatCard/StatCard.test.stories.tsx +0 -240
- package/src/components/data-display/Stepper/Stepper.stories.tsx +0 -540
- package/src/components/data-display/Stepper/Stepper.test.stories.tsx +0 -600
- package/src/components/data-display/Table/Table.stories.tsx +0 -803
- package/src/components/data-display/Table/Table.test.stories.tsx +0 -369
- package/src/components/data-display/Timeline/Timeline.stories.tsx +0 -442
- package/src/components/data-display/Timeline/Timeline.test.stories.tsx +0 -930
- package/src/components/data-display/TimingDiagram/TimingDiagram.stories.tsx +0 -475
- package/src/components/data-display/TimingDiagram/TimingDiagram.test.stories.tsx +0 -734
- package/src/components/data-display/Tooltip/Tooltip.stories.tsx +0 -468
- package/src/components/data-display/Tooltip/Tooltip.test.stories.tsx +0 -1154
- package/src/components/feedback/ConfirmAction/ConfirmAction.stories.tsx +0 -146
- package/src/components/feedback/ConfirmAction/ConfirmAction.test.stories.tsx +0 -114
- package/src/components/feedback/ConfirmAction/__tests__/confirm-action.test.tsx +0 -288
- package/src/components/feedback/Dialog/Dialog.stories.tsx +0 -833
- package/src/components/feedback/Dialog/Dialog.test.stories.tsx +0 -964
- package/src/components/feedback/Dialog/__tests__/dialog-content-spacing.test.tsx +0 -66
- package/src/components/feedback/Modal/Modal.stories.tsx +0 -765
- package/src/components/feedback/Modal/Modal.test.stories.tsx +0 -251
- package/src/components/feedback/Sonner/Sonner.stories.tsx +0 -698
- package/src/components/feedback/Sonner/Sonner.test.stories.tsx +0 -896
- package/src/components/feedback/StackedModal/StackedModal.stories.tsx +0 -1783
- package/src/components/feedback/StackedModal/StackedModal.test.stories.tsx +0 -973
- package/src/components/feedback/StackedModal/__tests__/stacked-modal-viewport.test.tsx +0 -104
- package/src/components/feedback/Toast/Toast.stories.tsx +0 -548
- package/src/components/feedback/Toast/Toast.test.stories.tsx +0 -834
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.stories.tsx +0 -691
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.test.stories.tsx +0 -634
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.stories.tsx +0 -665
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.test.stories.tsx +0 -727
- package/src/components/form/Autocomplete/Autocomplete.stories.tsx +0 -715
- package/src/components/form/Autocomplete/Autocomplete.test.stories.tsx +0 -825
- package/src/components/form/Button/Button.stories.tsx +0 -365
- package/src/components/form/Button/Button.test.stories.tsx +0 -607
- package/src/components/form/Calendar/Calendar.stories.tsx +0 -349
- package/src/components/form/Calendar/Calendar.test.stories.tsx +0 -464
- package/src/components/form/CepField/CepField.stories.tsx +0 -138
- package/src/components/form/CepField/CepField.test.stories.tsx +0 -281
- package/src/components/form/Checkbox/Checkbox.stories.tsx +0 -265
- package/src/components/form/Checkbox/Checkbox.test.stories.tsx +0 -181
- package/src/components/form/CodeEditor/CodeEditor.stories.tsx +0 -871
- package/src/components/form/CodeEditor/CodeEditor.test.stories.tsx +0 -574
- package/src/components/form/Command/Command.stories.tsx +0 -580
- package/src/components/form/Command/Command.test.stories.tsx +0 -215
- package/src/components/form/CreatableSelect/CreatableSelect.stories.tsx +0 -112
- package/src/components/form/CreatableSelect/CreatableSelect.test.stories.tsx +0 -134
- package/src/components/form/Form/Form.stories.tsx +0 -687
- package/src/components/form/Form/Form.test.stories.tsx +0 -601
- package/src/components/form/Input/Input.stories.tsx +0 -260
- package/src/components/form/Input/Input.test.stories.tsx +0 -1191
- package/src/components/form/InputOTP/InputOTP.stories.tsx +0 -774
- package/src/components/form/InputOTP/InputOTP.test.stories.tsx +0 -588
- package/src/components/form/Label/Label.stories.tsx +0 -473
- package/src/components/form/Label/Label.test.stories.tsx +0 -915
- package/src/components/form/Menubar/Menubar.stories.tsx +0 -472
- package/src/components/form/Menubar/Menubar.test.stories.tsx +0 -584
- package/src/components/form/PasswordStrength/PasswordStrength.stories.tsx +0 -562
- package/src/components/form/PasswordStrength/PasswordStrength.test.stories.tsx +0 -327
- package/src/components/form/PhoneInput/PhoneInput.stories.tsx +0 -495
- package/src/components/form/PhoneInput/PhoneInput.test.stories.tsx +0 -666
- package/src/components/form/RadioGroup/RadioGroup.stories.tsx +0 -518
- package/src/components/form/RadioGroup/RadioGroup.test.stories.tsx +0 -685
- package/src/components/form/RichTextEditor/RichTextEditor.stories.tsx +0 -261
- package/src/components/form/RichTextEditor/RichTextEditor.test.stories.tsx +0 -491
- package/src/components/form/SearchPalette/SearchPalette.stories.tsx +0 -135
- package/src/components/form/Select/Select.stories.tsx +0 -364
- package/src/components/form/Select/Select.test.stories.tsx +0 -985
- package/src/components/form/Slider/Slider.stories.tsx +0 -418
- package/src/components/form/Slider/Slider.test.stories.tsx +0 -1042
- package/src/components/form/Switch/Switch.stories.tsx +0 -697
- package/src/components/form/Switch/Switch.test.stories.tsx +0 -597
- package/src/components/form/Textarea/Textarea.stories.tsx +0 -473
- package/src/components/form/Textarea/Textarea.test.stories.tsx +0 -702
- package/src/components/form/Toggle/Toggle.stories.tsx +0 -638
- package/src/components/form/Toggle/Toggle.test.stories.tsx +0 -1159
- package/src/components/form/ToggleGroup/ToggleGroup.stories.tsx +0 -617
- package/src/components/form/ToggleGroup/ToggleGroup.test.stories.tsx +0 -915
- package/src/components/form/UploadButton/UploadButton.stories.tsx +0 -367
- package/src/components/form/UploadButton/UploadButton.test.stories.tsx +0 -573
- package/src/components/form/total-form/total-form.test.tsx +0 -214
- package/src/components/layout/Accordion/Accordion.stories.tsx +0 -694
- package/src/components/layout/Accordion/Accordion.test.stories.tsx +0 -1344
- package/src/components/layout/Card/Card.stories.tsx +0 -591
- package/src/components/layout/Card/Card.test.stories.tsx +0 -1134
- package/src/components/layout/CardGrid/__tests__/CardGrid.test.tsx +0 -92
- package/src/components/layout/Collapsible/Collapsible.stories.tsx +0 -180
- package/src/components/layout/Collapsible/Collapsible.test.stories.tsx +0 -308
- package/src/components/layout/Container/Container.stories.tsx +0 -557
- package/src/components/layout/Container/Container.test.stories.tsx +0 -745
- package/src/components/layout/ContentToolbar/ContentToolbar.stories.tsx +0 -129
- package/src/components/layout/ContentToolbar/ContentToolbar.test.stories.tsx +0 -251
- package/src/components/layout/ContentToolbar/__tests__/ColumnsMenu.test.tsx +0 -39
- package/src/components/layout/ContentToolbar/__tests__/MultiSelectDropdown.test.tsx +0 -131
- package/src/components/layout/ContentToolbar/__tests__/SavedViewsMenu.test.tsx +0 -99
- package/src/components/layout/Dashboard/Dashboard.stories.tsx +0 -104
- package/src/components/layout/Dashboard/Dashboard.test.stories.tsx +0 -190
- package/src/components/layout/Drawer/Drawer.stories.tsx +0 -658
- package/src/components/layout/Drawer/Drawer.test.stories.tsx +0 -1343
- package/src/components/layout/Resizable/Resizable.stories.tsx +0 -1039
- package/src/components/layout/Resizable/Resizable.test.stories.tsx +0 -754
- package/src/components/layout/ScrollArea/ScrollArea.stories.tsx +0 -651
- package/src/components/layout/ScrollArea/ScrollArea.test.stories.tsx +0 -619
- package/src/components/layout/Separator/Separator.stories.tsx +0 -563
- package/src/components/layout/Separator/Separator.test.stories.tsx +0 -518
- package/src/components/layout/SettingsLayout/SettingsLayout.stories.tsx +0 -192
- package/src/components/layout/SettingsLayout/SettingsLayout.test.stories.tsx +0 -175
- package/src/components/layout/Sidebar/Sidebar.stories.tsx +0 -609
- package/src/components/layout/Sidebar/Sidebar.test.stories.tsx +0 -1324
- package/src/components/layout/Skeleton/Skeleton.stories.tsx +0 -689
- package/src/components/layout/Skeleton/Skeleton.test.stories.tsx +0 -521
- package/src/components/layout/Spacer/Spacer.stories.tsx +0 -502
- package/src/components/layout/Spacer/Spacer.test.stories.tsx +0 -474
- package/src/components/layout/TableFilter/TableFilter.stories.tsx +0 -82
- package/src/components/layout/TableFilter/TableFilter.test.stories.tsx +0 -87
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.stories.tsx +0 -638
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.test.stories.tsx +0 -1008
- package/src/components/navigation/CommandPalette/CommandPalette.stories.tsx +0 -386
- package/src/components/navigation/CommandPalette/CommandPalette.test.stories.tsx +0 -435
- package/src/components/navigation/ContextMenu/ContextMenu.stories.tsx +0 -614
- package/src/components/navigation/ContextMenu/ContextMenu.test.stories.tsx +0 -845
- package/src/components/navigation/DropdownMenu/DropdownMenu.stories.tsx +0 -578
- package/src/components/navigation/DropdownMenu/DropdownMenu.test.stories.tsx +0 -660
- package/src/components/navigation/NavigationMenu/stories/NavigationMenu.stories.tsx +0 -516
- package/src/components/navigation/NavigationMenu/stories/NavigationMenu.test.stories.tsx +0 -935
- package/src/components/navigation/NavigationMenu/stories/NavigationMenuHorizontal.stories.tsx +0 -501
- package/src/components/navigation/NavigationMenu/stories/NavigationMenuVertical.stories.tsx +0 -453
- package/src/components/navigation/Pagination/Pagination.stories.tsx +0 -602
- package/src/components/navigation/Pagination/Pagination.test.stories.tsx +0 -520
- package/src/components/navigation/Tabs/Tabs.stories.tsx +0 -1004
- package/src/components/navigation/Tabs/Tabs.test.stories.tsx +0 -1225
- package/src/components/typography/Blockquote/Blockquote.stories.tsx +0 -359
- package/src/components/typography/Blockquote/Blockquote.test.stories.tsx +0 -432
- package/src/components/typography/Code/Code.stories.tsx +0 -686
- package/src/components/typography/Code/Code.test.stories.tsx +0 -703
- package/src/components/typography/Heading/Heading.stories.tsx +0 -451
- package/src/components/typography/Heading/Heading.test.stories.tsx +0 -830
- package/src/components/typography/Paragraph/Paragraph.stories.tsx +0 -280
- package/src/components/typography/Paragraph/Paragraph.test.stories.tsx +0 -231
- package/src/components/typography/Text/Text.stories.tsx +0 -359
- package/src/components/typography/Text/Text.test.stories.tsx +0 -759
- package/src/components/utility/AnimatedIcon/AnimatedIcon.stories.tsx +0 -945
- package/src/components/utility/AnimatedIcon/AnimatedIcon.test.stories.tsx +0 -603
- package/src/components/utility/AspectRatio/AspectRatio.stories.tsx +0 -414
- package/src/components/utility/AspectRatio/AspectRatio.test.stories.tsx +0 -859
- package/src/components/utility/InfiniteScroll/InfiniteScroll.stories.tsx +0 -620
- package/src/components/utility/InfiniteScroll/InfiniteScroll.test.stories.tsx +0 -361
- package/src/components/utility/InstallPrompt/InstallPrompt.stories.tsx +0 -118
- package/src/components/utility/InstallPrompt/InstallPrompt.test.stories.tsx +0 -83
- package/src/components/utility/InstallPrompt/__tests__/InstallPrompt.ios.test.tsx +0 -65
- package/src/components/utility/InstallPrompt/__tests__/usePwaInstall.test.tsx +0 -271
- package/src/components/utility/Portal/Portal.stories.tsx +0 -340
- package/src/components/utility/Portal/Portal.test.stories.tsx +0 -2086
- package/src/components/utility/Transition/Transition.stories.tsx +0 -493
- package/src/components/utility/Transition/Transition.test.stories.tsx +0 -854
- package/src/components/utility/VirtualList/VirtualList.stories.tsx +0 -1073
- package/src/components/utility/VirtualList/VirtualList.test.stories.tsx +0 -1085
- package/src/components/utility/WorkflowStep/WorkflowStep.stories.tsx +0 -431
- package/src/components/utility/WorkflowStep/WorkflowStep.test.stories.tsx +0 -364
- /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
|
-
};
|