@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.
- package/package.json +16 -8
- 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,774 +0,0 @@
|
|
|
1
|
-
import { Box, Typography } from '@mui/material';
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
3
|
-
import { useState } from 'react';
|
|
4
|
-
|
|
5
|
-
import { InputOTP } from './InputOTP';
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof InputOTP> = {
|
|
8
|
-
title: 'Form/InputOTP',
|
|
9
|
-
component: InputOTP,
|
|
10
|
-
parameters: {
|
|
11
|
-
layout: 'padded',
|
|
12
|
-
},
|
|
13
|
-
tags: ['autodocs', 'component:InputOTP'],
|
|
14
|
-
argTypes: {
|
|
15
|
-
variant: {
|
|
16
|
-
control: { type: 'select' },
|
|
17
|
-
options: ['numeric', 'alphanumeric', 'masked'],
|
|
18
|
-
},
|
|
19
|
-
color: {
|
|
20
|
-
control: { type: 'select' },
|
|
21
|
-
options: ['primary', 'secondary', 'success', 'warning', 'danger', 'neutral'],
|
|
22
|
-
},
|
|
23
|
-
size: {
|
|
24
|
-
control: { type: 'select' },
|
|
25
|
-
options: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
26
|
-
},
|
|
27
|
-
length: {
|
|
28
|
-
control: { type: 'number', min: 3, max: 10 },
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default meta;
|
|
34
|
-
type Story = StoryObj<typeof meta>;
|
|
35
|
-
|
|
36
|
-
export const Default: Story = {
|
|
37
|
-
args: {
|
|
38
|
-
variant: 'numeric',
|
|
39
|
-
size: 'md',
|
|
40
|
-
color: 'primary',
|
|
41
|
-
length: 6,
|
|
42
|
-
autoFocus: true,
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const VariantsComponent = () => {
|
|
47
|
-
const [values, setValues] = useState({
|
|
48
|
-
numeric: '',
|
|
49
|
-
alphanumeric: '',
|
|
50
|
-
masked: '',
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
return (
|
|
54
|
-
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 4, alignItems: 'center' }}>
|
|
55
|
-
<Box sx={{ textAlign: 'center' }}>
|
|
56
|
-
<Typography variant="h6" gutterBottom>
|
|
57
|
-
Numeric (6 digits)
|
|
58
|
-
</Typography>
|
|
59
|
-
<InputOTP
|
|
60
|
-
variant="numeric"
|
|
61
|
-
length={6}
|
|
62
|
-
value={values.numeric}
|
|
63
|
-
onChange={(value) => setValues((prev) => ({ ...prev, numeric: value }))}
|
|
64
|
-
onComplete={(value) => {
|
|
65
|
-
// OTP Complete: value
|
|
66
|
-
void value;
|
|
67
|
-
}}
|
|
68
|
-
/>
|
|
69
|
-
</Box>
|
|
70
|
-
</Box>
|
|
71
|
-
);
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export const Variants: Story = {
|
|
75
|
-
render: () => <VariantsComponent />,
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const ColorsComponent = () => {
|
|
79
|
-
const [value, setValue] = useState('');
|
|
80
|
-
|
|
81
|
-
return (
|
|
82
|
-
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 3, alignItems: 'center' }}>
|
|
83
|
-
{['primary', 'secondary', 'success', 'warning', 'danger', 'neutral'].map((color) => (
|
|
84
|
-
<Box key={color} sx={{ textAlign: 'center' }}>
|
|
85
|
-
<Typography variant="subtitle1" gutterBottom sx={{ textTransform: 'capitalize' }}>
|
|
86
|
-
{color}
|
|
87
|
-
</Typography>
|
|
88
|
-
<InputOTP color={color} length={4} value={value} onChange={setValue} />
|
|
89
|
-
</Box>
|
|
90
|
-
))}
|
|
91
|
-
</Box>
|
|
92
|
-
);
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
export const Colors: Story = {
|
|
96
|
-
render: () => <ColorsComponent />,
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
const SizesComponent = () => {
|
|
100
|
-
const [value, setValue] = useState('');
|
|
101
|
-
|
|
102
|
-
return (
|
|
103
|
-
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 3, alignItems: 'center' }}>
|
|
104
|
-
{['xs', 'sm', 'md', 'lg', 'xl'].map((size) => (
|
|
105
|
-
<Box key={size} sx={{ textAlign: 'center' }}>
|
|
106
|
-
<Typography variant="subtitle1" gutterBottom>
|
|
107
|
-
Size: {size.toUpperCase()}
|
|
108
|
-
</Typography>
|
|
109
|
-
<InputOTP size={size} length={4} value={value} onChange={setValue} />
|
|
110
|
-
</Box>
|
|
111
|
-
))}
|
|
112
|
-
</Box>
|
|
113
|
-
);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
export const Sizes: Story = {
|
|
117
|
-
render: () => <SizesComponent />,
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
const SpecialEffectsComponent = () => {
|
|
121
|
-
const [values, setValues] = useState({
|
|
122
|
-
glass: '',
|
|
123
|
-
gradient: '',
|
|
124
|
-
combined: '',
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
return (
|
|
128
|
-
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 4, alignItems: 'center' }}>
|
|
129
|
-
<Box sx={{ textAlign: 'center' }}>
|
|
130
|
-
<Typography variant="h6" gutterBottom>
|
|
131
|
-
Glass Morphism
|
|
132
|
-
</Typography>
|
|
133
|
-
<InputOTP
|
|
134
|
-
glass
|
|
135
|
-
length={6}
|
|
136
|
-
value={values.glass}
|
|
137
|
-
onChange={(value) => setValues((prev) => ({ ...prev, glass: value }))}
|
|
138
|
-
/>
|
|
139
|
-
</Box>
|
|
140
|
-
|
|
141
|
-
<Box sx={{ textAlign: 'center' }}>
|
|
142
|
-
<Typography variant="h6" gutterBottom>
|
|
143
|
-
Gradient
|
|
144
|
-
</Typography>
|
|
145
|
-
<InputOTP
|
|
146
|
-
gradient
|
|
147
|
-
color="secondary"
|
|
148
|
-
length={6}
|
|
149
|
-
value={values.gradient}
|
|
150
|
-
onChange={(value) => setValues((prev) => ({ ...prev, gradient: value }))}
|
|
151
|
-
/>
|
|
152
|
-
</Box>
|
|
153
|
-
|
|
154
|
-
<Box sx={{ textAlign: 'center' }}>
|
|
155
|
-
<Typography variant="h6" gutterBottom>
|
|
156
|
-
Combined Effects
|
|
157
|
-
</Typography>
|
|
158
|
-
<InputOTP
|
|
159
|
-
glass
|
|
160
|
-
gradient
|
|
161
|
-
color="success"
|
|
162
|
-
size="lg"
|
|
163
|
-
length={4}
|
|
164
|
-
value={values.combined}
|
|
165
|
-
onChange={(value) => setValues((prev) => ({ ...prev, combined: value }))}
|
|
166
|
-
/>
|
|
167
|
-
</Box>
|
|
168
|
-
</Box>
|
|
169
|
-
);
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
export const SpecialEffects: Story = {
|
|
173
|
-
render: () => <SpecialEffectsComponent />,
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
const ErrorStateComponent = () => {
|
|
177
|
-
const [value, setValue] = useState('');
|
|
178
|
-
|
|
179
|
-
return (
|
|
180
|
-
<Box sx={{ textAlign: 'center' }}>
|
|
181
|
-
<Typography variant="h6" gutterBottom>
|
|
182
|
-
Error State
|
|
183
|
-
</Typography>
|
|
184
|
-
<InputOTP error length={6} value={value} onChange={setValue} />
|
|
185
|
-
<Typography variant="caption" color="error" sx={{ display: 'block', mt: 1 }}>
|
|
186
|
-
Invalid verification code
|
|
187
|
-
</Typography>
|
|
188
|
-
</Box>
|
|
189
|
-
);
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
export const ErrorState: Story = {
|
|
193
|
-
render: () => <ErrorStateComponent />,
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
const DifferentLengthsComponent = () => {
|
|
197
|
-
const [values, setValues] = useState({
|
|
198
|
-
short: '',
|
|
199
|
-
medium: '',
|
|
200
|
-
long: '',
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
return (
|
|
204
|
-
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 4, alignItems: 'center' }}>
|
|
205
|
-
<Box sx={{ textAlign: 'center' }}>
|
|
206
|
-
<Typography variant="h6" gutterBottom>
|
|
207
|
-
4 Digits (SMS Code)
|
|
208
|
-
</Typography>
|
|
209
|
-
<InputOTP
|
|
210
|
-
length={4}
|
|
211
|
-
color="primary"
|
|
212
|
-
value={values.short}
|
|
213
|
-
onChange={(value) => setValues((prev) => ({ ...prev, short: value }))}
|
|
214
|
-
/>
|
|
215
|
-
</Box>
|
|
216
|
-
|
|
217
|
-
<Box sx={{ textAlign: 'center' }}>
|
|
218
|
-
<Typography variant="h6" gutterBottom>
|
|
219
|
-
6 Digits (Authenticator)
|
|
220
|
-
</Typography>
|
|
221
|
-
<InputOTP
|
|
222
|
-
length={6}
|
|
223
|
-
color="secondary"
|
|
224
|
-
value={values.medium}
|
|
225
|
-
onChange={(value) => setValues((prev) => ({ ...prev, medium: value }))}
|
|
226
|
-
/>
|
|
227
|
-
</Box>
|
|
228
|
-
|
|
229
|
-
<Box sx={{ textAlign: 'center' }}>
|
|
230
|
-
<Typography variant="h6" gutterBottom>
|
|
231
|
-
8 Characters (Custom)
|
|
232
|
-
</Typography>
|
|
233
|
-
<InputOTP
|
|
234
|
-
variant="alphanumeric"
|
|
235
|
-
length={8}
|
|
236
|
-
color="success"
|
|
237
|
-
size="sm"
|
|
238
|
-
value={values.long}
|
|
239
|
-
onChange={(value) => setValues((prev) => ({ ...prev, long: value }))}
|
|
240
|
-
/>
|
|
241
|
-
</Box>
|
|
242
|
-
</Box>
|
|
243
|
-
);
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
export const DifferentLengths: Story = {
|
|
247
|
-
render: () => <DifferentLengthsComponent />,
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
export const Playground: Story = {
|
|
251
|
-
args: {
|
|
252
|
-
variant: 'numeric',
|
|
253
|
-
color: 'primary',
|
|
254
|
-
size: 'md',
|
|
255
|
-
length: 6,
|
|
256
|
-
autoFocus: true,
|
|
257
|
-
glass: false,
|
|
258
|
-
gradient: false,
|
|
259
|
-
error: false,
|
|
260
|
-
disabled: false,
|
|
261
|
-
},
|
|
262
|
-
};
|
|
263
|
-
|
|
264
|
-
// Additional static stories for comprehensive coverage
|
|
265
|
-
|
|
266
|
-
export const NumericVariant: Story = {
|
|
267
|
-
args: {
|
|
268
|
-
variant: 'numeric',
|
|
269
|
-
length: 6,
|
|
270
|
-
color: 'primary',
|
|
271
|
-
autoFocus: true,
|
|
272
|
-
},
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
export const AlphanumericVariant: Story = {
|
|
276
|
-
args: {
|
|
277
|
-
variant: 'alphanumeric',
|
|
278
|
-
length: 8,
|
|
279
|
-
color: 'secondary',
|
|
280
|
-
},
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
export const MaskedVariant: Story = {
|
|
284
|
-
args: {
|
|
285
|
-
variant: 'masked',
|
|
286
|
-
length: 6,
|
|
287
|
-
color: 'primary',
|
|
288
|
-
value: '123456',
|
|
289
|
-
},
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
export const DisabledState: Story = {
|
|
293
|
-
args: {
|
|
294
|
-
variant: 'numeric',
|
|
295
|
-
length: 6,
|
|
296
|
-
disabled: true,
|
|
297
|
-
value: '123',
|
|
298
|
-
},
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
export const AutoFocusEnabled: Story = {
|
|
302
|
-
args: {
|
|
303
|
-
variant: 'numeric',
|
|
304
|
-
length: 4,
|
|
305
|
-
autoFocus: true,
|
|
306
|
-
color: 'success',
|
|
307
|
-
},
|
|
308
|
-
};
|
|
309
|
-
|
|
310
|
-
export const GlassEffect: Story = {
|
|
311
|
-
args: {
|
|
312
|
-
variant: 'numeric',
|
|
313
|
-
length: 6,
|
|
314
|
-
glass: true,
|
|
315
|
-
color: 'primary',
|
|
316
|
-
},
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
export const GradientEffect: Story = {
|
|
320
|
-
args: {
|
|
321
|
-
variant: 'numeric',
|
|
322
|
-
length: 6,
|
|
323
|
-
gradient: true,
|
|
324
|
-
color: 'secondary',
|
|
325
|
-
},
|
|
326
|
-
};
|
|
327
|
-
|
|
328
|
-
export const CombinedEffects: Story = {
|
|
329
|
-
args: {
|
|
330
|
-
variant: 'numeric',
|
|
331
|
-
length: 6,
|
|
332
|
-
glass: true,
|
|
333
|
-
gradient: true,
|
|
334
|
-
color: 'success',
|
|
335
|
-
},
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
export const XSmallSize: Story = {
|
|
339
|
-
args: {
|
|
340
|
-
variant: 'numeric',
|
|
341
|
-
length: 6,
|
|
342
|
-
size: 'xs',
|
|
343
|
-
},
|
|
344
|
-
};
|
|
345
|
-
|
|
346
|
-
export const SmallSize: Story = {
|
|
347
|
-
args: {
|
|
348
|
-
variant: 'numeric',
|
|
349
|
-
length: 6,
|
|
350
|
-
size: 'sm',
|
|
351
|
-
},
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
export const MediumSize: Story = {
|
|
355
|
-
args: {
|
|
356
|
-
variant: 'numeric',
|
|
357
|
-
length: 6,
|
|
358
|
-
size: 'md',
|
|
359
|
-
},
|
|
360
|
-
};
|
|
361
|
-
|
|
362
|
-
export const LargeSize: Story = {
|
|
363
|
-
args: {
|
|
364
|
-
variant: 'numeric',
|
|
365
|
-
length: 6,
|
|
366
|
-
size: 'lg',
|
|
367
|
-
},
|
|
368
|
-
};
|
|
369
|
-
|
|
370
|
-
export const XLargeSize: Story = {
|
|
371
|
-
args: {
|
|
372
|
-
variant: 'numeric',
|
|
373
|
-
length: 6,
|
|
374
|
-
size: 'xl',
|
|
375
|
-
},
|
|
376
|
-
};
|
|
377
|
-
|
|
378
|
-
export const PrimaryColor: Story = {
|
|
379
|
-
args: {
|
|
380
|
-
variant: 'numeric',
|
|
381
|
-
length: 6,
|
|
382
|
-
color: 'primary',
|
|
383
|
-
},
|
|
384
|
-
};
|
|
385
|
-
|
|
386
|
-
export const SecondaryColor: Story = {
|
|
387
|
-
args: {
|
|
388
|
-
variant: 'numeric',
|
|
389
|
-
length: 6,
|
|
390
|
-
color: 'secondary',
|
|
391
|
-
},
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
export const SuccessColor: Story = {
|
|
395
|
-
args: {
|
|
396
|
-
variant: 'numeric',
|
|
397
|
-
length: 6,
|
|
398
|
-
color: 'success',
|
|
399
|
-
},
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
export const WarningColor: Story = {
|
|
403
|
-
args: {
|
|
404
|
-
variant: 'numeric',
|
|
405
|
-
length: 6,
|
|
406
|
-
color: 'warning',
|
|
407
|
-
},
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
export const DangerColor: Story = {
|
|
411
|
-
args: {
|
|
412
|
-
variant: 'numeric',
|
|
413
|
-
length: 6,
|
|
414
|
-
color: 'danger',
|
|
415
|
-
},
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
export const NeutralColor: Story = {
|
|
419
|
-
args: {
|
|
420
|
-
variant: 'numeric',
|
|
421
|
-
length: 6,
|
|
422
|
-
color: 'neutral',
|
|
423
|
-
},
|
|
424
|
-
};
|
|
425
|
-
|
|
426
|
-
export const FourDigits: Story = {
|
|
427
|
-
args: {
|
|
428
|
-
variant: 'numeric',
|
|
429
|
-
length: 4,
|
|
430
|
-
color: 'primary',
|
|
431
|
-
},
|
|
432
|
-
};
|
|
433
|
-
|
|
434
|
-
export const FiveDigits: Story = {
|
|
435
|
-
args: {
|
|
436
|
-
variant: 'numeric',
|
|
437
|
-
length: 5,
|
|
438
|
-
color: 'secondary',
|
|
439
|
-
},
|
|
440
|
-
};
|
|
441
|
-
|
|
442
|
-
export const EightDigits: Story = {
|
|
443
|
-
args: {
|
|
444
|
-
variant: 'numeric',
|
|
445
|
-
length: 8,
|
|
446
|
-
color: 'success',
|
|
447
|
-
},
|
|
448
|
-
};
|
|
449
|
-
|
|
450
|
-
// Required comprehensive story exports for validation
|
|
451
|
-
|
|
452
|
-
const AllVariantsComponent = () => {
|
|
453
|
-
const [values, setValues] = useState({
|
|
454
|
-
numeric: '',
|
|
455
|
-
alphanumeric: '',
|
|
456
|
-
masked: '123456',
|
|
457
|
-
});
|
|
458
|
-
|
|
459
|
-
return (
|
|
460
|
-
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 4, p: 4 }}>
|
|
461
|
-
<Typography variant="h5" gutterBottom>
|
|
462
|
-
All InputOTP Variants
|
|
463
|
-
</Typography>
|
|
464
|
-
|
|
465
|
-
<Box>
|
|
466
|
-
<Typography variant="subtitle1" gutterBottom>
|
|
467
|
-
Numeric (digits only)
|
|
468
|
-
</Typography>
|
|
469
|
-
<InputOTP
|
|
470
|
-
variant="numeric"
|
|
471
|
-
length={6}
|
|
472
|
-
value={values.numeric}
|
|
473
|
-
onChange={(value) => setValues((prev) => ({ ...prev, numeric: value }))}
|
|
474
|
-
/>
|
|
475
|
-
</Box>
|
|
476
|
-
|
|
477
|
-
<Box>
|
|
478
|
-
<Typography variant="subtitle1" gutterBottom>
|
|
479
|
-
Alphanumeric (letters and numbers)
|
|
480
|
-
</Typography>
|
|
481
|
-
<InputOTP
|
|
482
|
-
variant="alphanumeric"
|
|
483
|
-
length={8}
|
|
484
|
-
value={values.alphanumeric}
|
|
485
|
-
onChange={(value) => setValues((prev) => ({ ...prev, alphanumeric: value }))}
|
|
486
|
-
/>
|
|
487
|
-
</Box>
|
|
488
|
-
|
|
489
|
-
<Box>
|
|
490
|
-
<Typography variant="subtitle1" gutterBottom>
|
|
491
|
-
Masked (hidden input)
|
|
492
|
-
</Typography>
|
|
493
|
-
<InputOTP
|
|
494
|
-
variant="masked"
|
|
495
|
-
length={6}
|
|
496
|
-
value={values.masked}
|
|
497
|
-
onChange={(value) => setValues((prev) => ({ ...prev, masked: value }))}
|
|
498
|
-
/>
|
|
499
|
-
</Box>
|
|
500
|
-
</Box>
|
|
501
|
-
);
|
|
502
|
-
};
|
|
503
|
-
|
|
504
|
-
export const AllVariants: Story = {
|
|
505
|
-
render: () => <AllVariantsComponent />,
|
|
506
|
-
};
|
|
507
|
-
|
|
508
|
-
const AllSizesComponent = () => {
|
|
509
|
-
const sizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const;
|
|
510
|
-
const [value, setValue] = useState('');
|
|
511
|
-
|
|
512
|
-
return (
|
|
513
|
-
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 3, p: 4 }}>
|
|
514
|
-
<Typography variant="h5" gutterBottom>
|
|
515
|
-
All InputOTP Sizes
|
|
516
|
-
</Typography>
|
|
517
|
-
{sizes.map((size) => (
|
|
518
|
-
<Box key={size}>
|
|
519
|
-
<Typography variant="subtitle2" gutterBottom>
|
|
520
|
-
Size: {size.toUpperCase()}
|
|
521
|
-
</Typography>
|
|
522
|
-
<InputOTP
|
|
523
|
-
size={size}
|
|
524
|
-
length={6}
|
|
525
|
-
value={value}
|
|
526
|
-
onChange={setValue}
|
|
527
|
-
/>
|
|
528
|
-
</Box>
|
|
529
|
-
))}
|
|
530
|
-
</Box>
|
|
531
|
-
);
|
|
532
|
-
};
|
|
533
|
-
|
|
534
|
-
export const AllSizes: Story = {
|
|
535
|
-
render: () => <AllSizesComponent />,
|
|
536
|
-
};
|
|
537
|
-
|
|
538
|
-
const AllStatesComponent = () => {
|
|
539
|
-
const [values, setValues] = useState({
|
|
540
|
-
default: '',
|
|
541
|
-
disabled: '123',
|
|
542
|
-
error: '456',
|
|
543
|
-
glass: '',
|
|
544
|
-
gradient: '',
|
|
545
|
-
});
|
|
546
|
-
|
|
547
|
-
return (
|
|
548
|
-
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 3, p: 4 }}>
|
|
549
|
-
<Typography variant="h5" gutterBottom>
|
|
550
|
-
All InputOTP States
|
|
551
|
-
</Typography>
|
|
552
|
-
|
|
553
|
-
<Box>
|
|
554
|
-
<Typography variant="subtitle2" gutterBottom>
|
|
555
|
-
Default State
|
|
556
|
-
</Typography>
|
|
557
|
-
<InputOTP
|
|
558
|
-
length={6}
|
|
559
|
-
value={values.default}
|
|
560
|
-
onChange={(value) => setValues((prev) => ({ ...prev, default: value }))}
|
|
561
|
-
/>
|
|
562
|
-
</Box>
|
|
563
|
-
|
|
564
|
-
<Box>
|
|
565
|
-
<Typography variant="subtitle2" gutterBottom>
|
|
566
|
-
Disabled State
|
|
567
|
-
</Typography>
|
|
568
|
-
<InputOTP
|
|
569
|
-
length={6}
|
|
570
|
-
disabled
|
|
571
|
-
value={values.disabled}
|
|
572
|
-
onChange={(value) => setValues((prev) => ({ ...prev, disabled: value }))}
|
|
573
|
-
/>
|
|
574
|
-
</Box>
|
|
575
|
-
|
|
576
|
-
<Box>
|
|
577
|
-
<Typography variant="subtitle2" gutterBottom>
|
|
578
|
-
Error State
|
|
579
|
-
</Typography>
|
|
580
|
-
<InputOTP
|
|
581
|
-
length={6}
|
|
582
|
-
error
|
|
583
|
-
value={values.error}
|
|
584
|
-
onChange={(value) => setValues((prev) => ({ ...prev, error: value }))}
|
|
585
|
-
/>
|
|
586
|
-
</Box>
|
|
587
|
-
|
|
588
|
-
<Box>
|
|
589
|
-
<Typography variant="subtitle2" gutterBottom>
|
|
590
|
-
Glass Morphism
|
|
591
|
-
</Typography>
|
|
592
|
-
<InputOTP
|
|
593
|
-
length={6}
|
|
594
|
-
glass
|
|
595
|
-
value={values.glass}
|
|
596
|
-
onChange={(value) => setValues((prev) => ({ ...prev, glass: value }))}
|
|
597
|
-
/>
|
|
598
|
-
</Box>
|
|
599
|
-
|
|
600
|
-
<Box>
|
|
601
|
-
<Typography variant="subtitle2" gutterBottom>
|
|
602
|
-
Gradient Effect
|
|
603
|
-
</Typography>
|
|
604
|
-
<InputOTP
|
|
605
|
-
length={6}
|
|
606
|
-
gradient
|
|
607
|
-
value={values.gradient}
|
|
608
|
-
onChange={(value) => setValues((prev) => ({ ...prev, gradient: value }))}
|
|
609
|
-
/>
|
|
610
|
-
</Box>
|
|
611
|
-
</Box>
|
|
612
|
-
);
|
|
613
|
-
};
|
|
614
|
-
|
|
615
|
-
export const AllStates: Story = {
|
|
616
|
-
render: () => <AllStatesComponent />,
|
|
617
|
-
};
|
|
618
|
-
|
|
619
|
-
const InteractiveStatesComponent = () => {
|
|
620
|
-
const [values, setValues] = useState({
|
|
621
|
-
hover: '',
|
|
622
|
-
focus: '',
|
|
623
|
-
active: '',
|
|
624
|
-
complete: '',
|
|
625
|
-
});
|
|
626
|
-
|
|
627
|
-
return (
|
|
628
|
-
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 3, p: 4 }}>
|
|
629
|
-
<Typography variant="h5" gutterBottom>
|
|
630
|
-
Interactive States Demo
|
|
631
|
-
</Typography>
|
|
632
|
-
|
|
633
|
-
<Box>
|
|
634
|
-
<Typography variant="subtitle2" gutterBottom>
|
|
635
|
-
Hover over the inputs
|
|
636
|
-
</Typography>
|
|
637
|
-
<InputOTP
|
|
638
|
-
length={4}
|
|
639
|
-
color="primary"
|
|
640
|
-
value={values.hover}
|
|
641
|
-
onChange={(value) => setValues((prev) => ({ ...prev, hover: value }))}
|
|
642
|
-
/>
|
|
643
|
-
</Box>
|
|
644
|
-
|
|
645
|
-
<Box>
|
|
646
|
-
<Typography variant="subtitle2" gutterBottom>
|
|
647
|
-
Focus state (click to focus)
|
|
648
|
-
</Typography>
|
|
649
|
-
<InputOTP
|
|
650
|
-
length={4}
|
|
651
|
-
color="secondary"
|
|
652
|
-
value={values.focus}
|
|
653
|
-
onChange={(value) => setValues((prev) => ({ ...prev, focus: value }))}
|
|
654
|
-
/>
|
|
655
|
-
</Box>
|
|
656
|
-
|
|
657
|
-
<Box>
|
|
658
|
-
<Typography variant="subtitle2" gutterBottom>
|
|
659
|
-
Active state (type to see)
|
|
660
|
-
</Typography>
|
|
661
|
-
<InputOTP
|
|
662
|
-
length={4}
|
|
663
|
-
color="success"
|
|
664
|
-
value={values.active}
|
|
665
|
-
onChange={(value) => setValues((prev) => ({ ...prev, active: value }))}
|
|
666
|
-
/>
|
|
667
|
-
</Box>
|
|
668
|
-
|
|
669
|
-
<Box>
|
|
670
|
-
<Typography variant="subtitle2" gutterBottom>
|
|
671
|
-
Complete state (fill all inputs)
|
|
672
|
-
</Typography>
|
|
673
|
-
<InputOTP
|
|
674
|
-
length={4}
|
|
675
|
-
color="warning"
|
|
676
|
-
value={values.complete}
|
|
677
|
-
onChange={(value) => setValues((prev) => ({ ...prev, complete: value }))}
|
|
678
|
-
onComplete={(value) => {
|
|
679
|
-
// Completed with value
|
|
680
|
-
void value;
|
|
681
|
-
}}
|
|
682
|
-
/>
|
|
683
|
-
</Box>
|
|
684
|
-
</Box>
|
|
685
|
-
);
|
|
686
|
-
};
|
|
687
|
-
|
|
688
|
-
export const InteractiveStates: Story = {
|
|
689
|
-
render: () => <InteractiveStatesComponent />,
|
|
690
|
-
};
|
|
691
|
-
|
|
692
|
-
const ResponsiveComponent = () => {
|
|
693
|
-
const [value, setValue] = useState('');
|
|
694
|
-
|
|
695
|
-
return (
|
|
696
|
-
<Box sx={{ p: { xs: 2, sm: 3, md: 4 } }}>
|
|
697
|
-
<Typography variant="h5" gutterBottom>
|
|
698
|
-
Responsive InputOTP
|
|
699
|
-
</Typography>
|
|
700
|
-
|
|
701
|
-
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}>
|
|
702
|
-
<Box>
|
|
703
|
-
<Typography variant="subtitle2" gutterBottom>
|
|
704
|
-
Mobile View (xs-sm)
|
|
705
|
-
</Typography>
|
|
706
|
-
<Box sx={{ maxWidth: '320px' }}>
|
|
707
|
-
<InputOTP
|
|
708
|
-
size="sm"
|
|
709
|
-
length={4}
|
|
710
|
-
value={value}
|
|
711
|
-
onChange={setValue}
|
|
712
|
-
/>
|
|
713
|
-
</Box>
|
|
714
|
-
</Box>
|
|
715
|
-
|
|
716
|
-
<Box>
|
|
717
|
-
<Typography variant="subtitle2" gutterBottom>
|
|
718
|
-
Tablet View (md)
|
|
719
|
-
</Typography>
|
|
720
|
-
<Box sx={{ maxWidth: '768px' }}>
|
|
721
|
-
<InputOTP
|
|
722
|
-
size="md"
|
|
723
|
-
length={6}
|
|
724
|
-
value={value}
|
|
725
|
-
onChange={setValue}
|
|
726
|
-
/>
|
|
727
|
-
</Box>
|
|
728
|
-
</Box>
|
|
729
|
-
|
|
730
|
-
<Box>
|
|
731
|
-
<Typography variant="subtitle2" gutterBottom>
|
|
732
|
-
Desktop View (lg-xl)
|
|
733
|
-
</Typography>
|
|
734
|
-
<Box sx={{ maxWidth: '1200px' }}>
|
|
735
|
-
<InputOTP
|
|
736
|
-
size="lg"
|
|
737
|
-
length={8}
|
|
738
|
-
value={value}
|
|
739
|
-
onChange={setValue}
|
|
740
|
-
/>
|
|
741
|
-
</Box>
|
|
742
|
-
</Box>
|
|
743
|
-
|
|
744
|
-
<Box>
|
|
745
|
-
<Typography variant="subtitle2" gutterBottom>
|
|
746
|
-
Responsive with MUI Breakpoints
|
|
747
|
-
</Typography>
|
|
748
|
-
<Box
|
|
749
|
-
sx={{
|
|
750
|
-
'& .MuiInputBase-root': {
|
|
751
|
-
fontSize: { xs: '14px', sm: '16px', md: '18px' },
|
|
752
|
-
},
|
|
753
|
-
}}
|
|
754
|
-
>
|
|
755
|
-
<InputOTP
|
|
756
|
-
length={6}
|
|
757
|
-
value={value}
|
|
758
|
-
onChange={setValue}
|
|
759
|
-
/>
|
|
760
|
-
</Box>
|
|
761
|
-
</Box>
|
|
762
|
-
</Box>
|
|
763
|
-
</Box>
|
|
764
|
-
);
|
|
765
|
-
};
|
|
766
|
-
|
|
767
|
-
export const Responsive: Story = {
|
|
768
|
-
render: () => <ResponsiveComponent />,
|
|
769
|
-
parameters: {
|
|
770
|
-
viewport: {
|
|
771
|
-
defaultViewport: 'responsive',
|
|
772
|
-
},
|
|
773
|
-
},
|
|
774
|
-
};
|