@12-apps/ui 1.4.1 → 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 +17 -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 -77
  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 -753
  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 -503
  27. package/src/components/data-display/Carousel/Carousel.stories.tsx +0 -607
  28. package/src/components/data-display/Carousel/Carousel.test.stories.tsx +0 -691
  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 -1101
  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 -955
  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 -975
  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 -909
  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 -918
  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 -750
  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 -472
  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 -762
  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,562 +0,0 @@
1
- import { Alert,Box, Paper, Stack, TextField, Typography } from '@mui/material';
2
- import type { Meta, StoryObj } from '@storybook/react-vite';
3
- import React from 'react';
4
-
5
- import { PasswordStrength } from './PasswordStrength';
6
-
7
- const meta: Meta<typeof PasswordStrength> = {
8
- title: 'Form/PasswordStrength',
9
- component: PasswordStrength,
10
- parameters: {
11
- layout: 'padded',
12
- docs: {
13
- description: {
14
- component:
15
- 'A password strength indicator component with real-time feedback, requirements checking, and beautiful visual indicators.',
16
- },
17
- },
18
- },
19
- tags: ['autodocs', 'component:PasswordStrength'],
20
- argTypes: {
21
- variant: {
22
- control: { type: 'select' },
23
- options: ['linear', 'circular', 'steps'],
24
- description: 'Visual style of the strength indicator',
25
- },
26
- showRequirements: {
27
- control: 'boolean',
28
- description: 'Show password requirements checklist',
29
- },
30
- showStrengthLabel: {
31
- control: 'boolean',
32
- description: 'Show strength level text',
33
- },
34
- showSuggestions: {
35
- control: 'boolean',
36
- description: 'Show password improvement suggestions',
37
- },
38
- animated: {
39
- control: 'boolean',
40
- description: 'Enable smooth animations',
41
- },
42
- },
43
- };
44
-
45
- export default meta;
46
- type Story = StoryObj<typeof meta>;
47
-
48
- const DefaultComponent = () => {
49
- const [password, setPassword] = React.useState('');
50
-
51
- return (
52
- <Stack spacing={3} sx={{ maxWidth: 400 }}>
53
- <TextField
54
- type="password"
55
- label="Password"
56
- value={password}
57
- onChange={(e) => setPassword(e.target.value)}
58
- fullWidth
59
- placeholder="Enter your password"
60
- />
61
- <PasswordStrength
62
- value={password}
63
- variant="linear"
64
- showRequirements={true}
65
- showStrengthLabel={true}
66
- />
67
- </Stack>
68
- );
69
- };
70
-
71
- export const Default: Story = {
72
- render: () => <DefaultComponent />,
73
- };
74
-
75
- const AllVariantsComponent = () => {
76
- const [password, setPassword] = React.useState('MyP@ssw0rd123!');
77
-
78
- return (
79
- <Stack spacing={4}>
80
- <TextField
81
- type="password"
82
- label="Test Password"
83
- value={password}
84
- onChange={(e) => setPassword(e.target.value)}
85
- fullWidth
86
- helperText="Try different passwords to see the indicators change"
87
- />
88
-
89
- <Box display="grid" gridTemplateColumns="1fr 1fr" gap={3}>
90
- <Paper sx={{ p: 2 }}>
91
- <Typography variant="subtitle2" gutterBottom>
92
- Linear Progress
93
- </Typography>
94
- <PasswordStrength value={password} variant="linear" showStrengthLabel={true} />
95
- </Paper>
96
-
97
- <Paper sx={{ p: 2 }}>
98
- <Typography variant="subtitle2" gutterBottom>
99
- Circular Progress
100
- </Typography>
101
- <PasswordStrength value={password} variant="circular" showStrengthLabel={true} />
102
- </Paper>
103
-
104
- <Paper sx={{ p: 2 }}>
105
- <Typography variant="subtitle2" gutterBottom>
106
- Steps Indicator
107
- </Typography>
108
- <PasswordStrength value={password} variant="steps" showStrengthLabel={true} />
109
- </Paper>
110
-
111
- <Paper sx={{ p: 2 }}>
112
- <Typography variant="subtitle2" gutterBottom>
113
- Detailed View
114
- </Typography>
115
- <PasswordStrength value={password} variant="detailed" showStrengthLabel={true} />
116
- </Paper>
117
- </Box>
118
- </Stack>
119
- );
120
- };
121
-
122
- export const AllVariants: Story = {
123
- render: () => <AllVariantsComponent />,
124
- };
125
-
126
- const WithRequirementsComponent = () => {
127
- const [password, setPassword] = React.useState('');
128
-
129
- return (
130
- <Stack spacing={3} sx={{ maxWidth: 500 }}>
131
- <Typography variant="h6">Create a Strong Password</Typography>
132
-
133
- <TextField
134
- type="password"
135
- label="New Password"
136
- value={password}
137
- onChange={(e) => setPassword(e.target.value)}
138
- fullWidth
139
- placeholder="Enter a strong password"
140
- />
141
-
142
- <PasswordStrength
143
- value={password}
144
- variant="linear"
145
- showRequirements={true}
146
- showStrengthLabel={true}
147
- showSuggestions={true}
148
- requirements={{
149
- minLength: 8,
150
- uppercase: true,
151
- lowercase: true,
152
- numbers: true,
153
- special: true,
154
- }}
155
- />
156
- </Stack>
157
- );
158
- };
159
-
160
- export const WithRequirements: Story = {
161
- render: () => <WithRequirementsComponent />,
162
- };
163
-
164
- export const PasswordComparison: Story = {
165
- render: () => {
166
- const passwords = {
167
- weak: 'password',
168
- fair: 'Password1',
169
- good: 'MyPassword123',
170
- strong: 'MyP@ssw0rd!',
171
- veryStrong: 'MyS3cur3P@ssw0rd!2024',
172
- };
173
-
174
- return (
175
- <Stack spacing={3}>
176
- <Typography variant="h6">Password Strength Examples</Typography>
177
-
178
- {Object.entries(passwords).map(([level, pwd]) => (
179
- <Paper key={level} sx={{ p: 2 }}>
180
- <Typography variant="subtitle2" gutterBottom sx={{ textTransform: 'capitalize' }}>
181
- {level}: "{pwd}"
182
- </Typography>
183
- <PasswordStrength value={pwd} variant="linear" showStrengthLabel={true} />
184
- </Paper>
185
- ))}
186
- </Stack>
187
- );
188
- },
189
- };
190
-
191
- const RegistrationFormComponent = () => {
192
- const [password, setPassword] = React.useState('');
193
- const [confirmPassword, setConfirmPassword] = React.useState('');
194
- const [showSuccess, setShowSuccess] = React.useState(false);
195
-
196
- const passwordsMatch = password === confirmPassword && password !== '';
197
- const isStrong = password.length >= 8 && /[A-Z]/.test(password) && /[0-9]/.test(password);
198
-
199
- const handleSubmit = () => {
200
- if (passwordsMatch && isStrong) {
201
- setShowSuccess(true);
202
- window.setTimeout(() => setShowSuccess(false), 3000);
203
- }
204
- };
205
-
206
- return (
207
- <Stack spacing={3} sx={{ maxWidth: 400 }}>
208
- <Typography variant="h6">Create Your Account</Typography>
209
-
210
- <TextField label="Email" type="email" fullWidth defaultValue="user@example.com" />
211
-
212
- <TextField
213
- type="password"
214
- label="Password"
215
- value={password}
216
- onChange={(e) => setPassword(e.target.value)}
217
- fullWidth
218
- />
219
-
220
- <PasswordStrength
221
- value={password}
222
- variant="linear"
223
- showRequirements={true}
224
- showStrengthLabel={true}
225
- />
226
-
227
- <TextField
228
- type="password"
229
- label="Confirm Password"
230
- value={confirmPassword}
231
- onChange={(e) => setConfirmPassword(e.target.value)}
232
- fullWidth
233
- error={confirmPassword !== '' && !passwordsMatch}
234
- helperText={confirmPassword !== '' && !passwordsMatch ? 'Passwords do not match' : ''}
235
- />
236
-
237
- {showSuccess && <Alert severity="success">Account created successfully!</Alert>}
238
-
239
- <button onClick={handleSubmit} disabled={!passwordsMatch || !isStrong}>
240
- Create Account
241
- </button>
242
- </Stack>
243
- );
244
- };
245
-
246
- export const RegistrationForm: Story = {
247
- render: () => <RegistrationFormComponent />,
248
- };
249
-
250
- const WithCustomRequirementsComponent = () => {
251
- const [password, setPassword] = React.useState('');
252
-
253
- return (
254
- <Stack spacing={3} sx={{ maxWidth: 500 }}>
255
- <Typography variant="h6">Enterprise Password Policy</Typography>
256
-
257
- <Alert severity="info">Your organization requires strong passwords for security</Alert>
258
-
259
- <TextField
260
- type="password"
261
- label="Password"
262
- value={password}
263
- onChange={(e) => setPassword(e.target.value)}
264
- fullWidth
265
- />
266
-
267
- <PasswordStrength
268
- value={password}
269
- variant="linear"
270
- showRequirements={true}
271
- showStrengthLabel={true}
272
- showSuggestions={true}
273
- requirements={{
274
- minLength: 12,
275
- uppercase: true,
276
- lowercase: true,
277
- numbers: true,
278
- special: true,
279
- }}
280
- />
281
- </Stack>
282
- );
283
- };
284
-
285
- export const WithCustomRequirements: Story = {
286
- render: () => <WithCustomRequirementsComponent />,
287
- };
288
-
289
- const RealTimeValidationComponent = () => {
290
- const [password, setPassword] = React.useState('');
291
- const [focused, setFocused] = React.useState(false);
292
-
293
- return (
294
- <Stack spacing={3} sx={{ maxWidth: 400 }}>
295
- <Typography variant="h6">Real-time Password Validation</Typography>
296
-
297
- <TextField
298
- type="password"
299
- label="Create Password"
300
- value={password}
301
- onChange={(e) => setPassword(e.target.value)}
302
- onFocus={() => setFocused(true)}
303
- onBlur={() => setFocused(false)}
304
- fullWidth
305
- placeholder="Start typing..."
306
- />
307
-
308
- {(focused || password) && (
309
- <PasswordStrength
310
- value={password}
311
- variant="linear"
312
- showRequirements={true}
313
- showStrengthLabel={true}
314
- showSuggestions={focused}
315
- animated={true}
316
- />
317
- )}
318
-
319
- {password.length > 0 && (
320
- <Paper sx={{ p: 2, bgcolor: 'grey.50' }}>
321
- <Typography variant="caption">
322
- Password entropy: {(password.length * 4.3).toFixed(0)} bits
323
- </Typography>
324
- </Paper>
325
- )}
326
- </Stack>
327
- );
328
- };
329
-
330
- export const RealTimeValidation: Story = {
331
- render: () => <RealTimeValidationComponent />,
332
- };
333
-
334
- const MinimalIndicatorComponent = () => {
335
- const [password, setPassword] = React.useState('');
336
-
337
- return (
338
- <Stack spacing={2} sx={{ maxWidth: 300 }}>
339
- <TextField
340
- type="password"
341
- label="Password"
342
- value={password}
343
- onChange={(e) => setPassword(e.target.value)}
344
- fullWidth
345
- size="small"
346
- />
347
- <PasswordStrength
348
- value={password}
349
- variant="linear"
350
- showRequirements={false}
351
- showStrengthLabel={false}
352
- showSuggestions={false}
353
- />
354
- </Stack>
355
- );
356
- };
357
-
358
- export const MinimalIndicator: Story = {
359
- render: () => <MinimalIndicatorComponent />,
360
- };
361
-
362
- // Required story exports for validation
363
- export const AllSizes: Story = {
364
- render: () => (
365
- <Stack spacing={4}>
366
- <Typography variant="h6">Different Sizes</Typography>
367
-
368
- <Paper sx={{ p: 2 }}>
369
- <Typography variant="subtitle2" gutterBottom>
370
- Small Indicator
371
- </Typography>
372
- <Box sx={{ transform: 'scale(0.8)', transformOrigin: 'left center' }}>
373
- <PasswordStrength
374
- value="MyP@ssw0rd123!"
375
- variant="linear"
376
- showRequirements={false}
377
- showStrengthLabel={true}
378
- />
379
- </Box>
380
- </Paper>
381
-
382
- <Paper sx={{ p: 2 }}>
383
- <Typography variant="subtitle2" gutterBottom>
384
- Medium Indicator (Default)
385
- </Typography>
386
- <PasswordStrength
387
- value="MyP@ssw0rd123!"
388
- variant="linear"
389
- showRequirements={false}
390
- showStrengthLabel={true}
391
- />
392
- </Paper>
393
-
394
- <Paper sx={{ p: 2 }}>
395
- <Typography variant="subtitle2" gutterBottom>
396
- Large Indicator
397
- </Typography>
398
- <Box sx={{ transform: 'scale(1.2)', transformOrigin: 'left center' }}>
399
- <PasswordStrength
400
- value="MyP@ssw0rd123!"
401
- variant="linear"
402
- showRequirements={false}
403
- showStrengthLabel={true}
404
- />
405
- </Box>
406
- </Paper>
407
- </Stack>
408
- ),
409
- };
410
-
411
- export const AllStates: Story = {
412
- render: () => (
413
- <Stack spacing={3}>
414
- <Typography variant="h6">All Strength States</Typography>
415
-
416
- <Paper sx={{ p: 2 }}>
417
- <Typography variant="subtitle2" color="error.main">
418
- Very Weak
419
- </Typography>
420
- <PasswordStrength value="123" variant="linear" showStrengthLabel={true} />
421
- </Paper>
422
-
423
- <Paper sx={{ p: 2 }}>
424
- <Typography variant="subtitle2" color="warning.main">
425
- Weak
426
- </Typography>
427
- <PasswordStrength value="password" variant="linear" showStrengthLabel={true} />
428
- </Paper>
429
-
430
- <Paper sx={{ p: 2 }}>
431
- <Typography variant="subtitle2" color="info.main">
432
- Fair
433
- </Typography>
434
- <PasswordStrength value="Password123" variant="linear" showStrengthLabel={true} />
435
- </Paper>
436
-
437
- <Paper sx={{ p: 2 }}>
438
- <Typography variant="subtitle2" color="success.main">
439
- Good
440
- </Typography>
441
- <PasswordStrength value="MyPassword123!" variant="linear" showStrengthLabel={true} />
442
- </Paper>
443
-
444
- <Paper sx={{ p: 2 }}>
445
- <Typography variant="subtitle2" color="success.dark">
446
- Very Strong
447
- </Typography>
448
- <PasswordStrength value="MyS3cur3P@ssw0rd!2024" variant="linear" showStrengthLabel={true} />
449
- </Paper>
450
- </Stack>
451
- ),
452
- };
453
-
454
- export const InteractiveStates: Story = {
455
- render: () => {
456
- const InteractiveComponent = () => {
457
- const [password, setPassword] = React.useState('');
458
- const [showRequirements, setShowRequirements] = React.useState(true);
459
- const [variant, setVariant] = React.useState<'linear' | 'circular' | 'steps'>('linear');
460
-
461
- return (
462
- <Stack spacing={3} sx={{ maxWidth: 500 }}>
463
- <Typography variant="h6">Interactive Controls</Typography>
464
-
465
- <Box sx={{ display: 'flex', gap: 2, flexWrap: 'wrap' }}>
466
- <button onClick={() => setShowRequirements(!showRequirements)}>
467
- {showRequirements ? 'Hide' : 'Show'} Requirements
468
- </button>
469
- <button
470
- onClick={() =>
471
- setVariant(
472
- variant === 'linear' ? 'circular' : variant === 'circular' ? 'steps' : 'linear',
473
- )
474
- }
475
- >
476
- Variant: {variant}
477
- </button>
478
- <button onClick={() => setPassword('')}>Clear</button>
479
- </Box>
480
-
481
- <TextField
482
- type="password"
483
- label="Test Password"
484
- value={password}
485
- onChange={(e) => setPassword(e.target.value)}
486
- placeholder="Type to see real-time updates"
487
- fullWidth
488
- />
489
-
490
- <PasswordStrength
491
- value={password}
492
- variant={variant}
493
- showRequirements={showRequirements}
494
- showStrengthLabel={true}
495
- />
496
- </Stack>
497
- );
498
- };
499
-
500
- return <InteractiveComponent />;
501
- },
502
- };
503
-
504
- export const Responsive: Story = {
505
- parameters: {
506
- viewport: {
507
- viewports: {
508
- mobile: { name: 'Mobile', styles: { width: '375px', height: '667px' } },
509
- tablet: { name: 'Tablet', styles: { width: '768px', height: '1024px' } },
510
- desktop: { name: 'Desktop', styles: { width: '1024px', height: '768px' } },
511
- },
512
- defaultViewport: 'mobile',
513
- },
514
- },
515
- render: () => (
516
- <Stack spacing={4}>
517
- <Typography variant="h6">Responsive Behavior</Typography>
518
-
519
- <Box sx={{ display: 'grid', gap: 3, gridTemplateColumns: { xs: '1fr', md: '1fr 1fr' } }}>
520
- <Paper sx={{ p: 2 }}>
521
- <Typography variant="subtitle2" gutterBottom>
522
- Mobile View (Stacked)
523
- </Typography>
524
- <Box sx={{ maxWidth: 300 }}>
525
- <PasswordStrength
526
- value="MyPassword123!"
527
- variant="linear"
528
- showRequirements={true}
529
- showStrengthLabel={true}
530
- />
531
- </Box>
532
- </Paper>
533
-
534
- <Paper sx={{ p: 2 }}>
535
- <Typography variant="subtitle2" gutterBottom>
536
- Desktop View (Full Width)
537
- </Typography>
538
- <PasswordStrength
539
- value="MyPassword123!"
540
- variant="linear"
541
- showRequirements={true}
542
- showStrengthLabel={true}
543
- />
544
- </Paper>
545
- </Box>
546
-
547
- <Paper sx={{ p: 2 }}>
548
- <Typography variant="subtitle2" gutterBottom>
549
- Compact Mobile
550
- </Typography>
551
- <Box sx={{ maxWidth: 250 }}>
552
- <PasswordStrength
553
- value="MyPassword123!"
554
- variant="steps"
555
- showRequirements={false}
556
- showStrengthLabel={true}
557
- />
558
- </Box>
559
- </Paper>
560
- </Stack>
561
- ),
562
- };