@12-apps/ui 1.5.0 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/package.json +17 -9
  2. package/src/button/index.ts +1 -0
  3. package/src/social-login-button/index.ts +1 -0
  4. package/src/{social-login-button.tsx → social-login-button/social-login-button.tsx} +5 -5
  5. package/src/user-avatar/index.ts +1 -0
  6. package/src/{user-avatar.tsx → user-avatar/user-avatar.tsx} +4 -4
  7. package/eslint.config.js +0 -89
  8. package/src/__tests__/data-grid.test.tsx +0 -125
  9. package/src/__tests__/package-wiring.test.ts +0 -41
  10. package/src/__tests__/setup.ts +0 -1
  11. package/src/__tests__/social-login-button.test.tsx +0 -186
  12. package/src/__tests__/user-avatar.test.tsx +0 -195
  13. package/src/__tests__/viewport.test.ts +0 -50
  14. package/src/components/command/__tests__/command.test.tsx +0 -112
  15. package/src/components/data-display/Alert/Alert.stories.tsx +0 -559
  16. package/src/components/data-display/Alert/Alert.test.stories.tsx +0 -707
  17. package/src/components/data-display/AlertDialog/AlertDialog.stories.tsx +0 -362
  18. package/src/components/data-display/AlertDialog/AlertDialog.test.stories.tsx +0 -763
  19. package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.stories.tsx +0 -230
  20. package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.test.stories.tsx +0 -270
  21. package/src/components/data-display/Avatar/Avatar.stories.tsx +0 -721
  22. package/src/components/data-display/Avatar/Avatar.test.stories.tsx +0 -822
  23. package/src/components/data-display/Badge/Badge.stories.tsx +0 -1134
  24. package/src/components/data-display/Badge/Badge.test.stories.tsx +0 -1194
  25. package/src/components/data-display/Banner/Banner.stories.tsx +0 -528
  26. package/src/components/data-display/Banner/Banner.test.stories.tsx +0 -511
  27. package/src/components/data-display/Carousel/Carousel.stories.tsx +0 -607
  28. package/src/components/data-display/Carousel/Carousel.test.stories.tsx +0 -701
  29. package/src/components/data-display/Chart/Chart.stories.tsx +0 -568
  30. package/src/components/data-display/Chart/Chart.test.stories.tsx +0 -174
  31. package/src/components/data-display/Chart/SpecChart.stories.tsx +0 -150
  32. package/src/components/data-display/Chart/SpecChart.test.stories.tsx +0 -56
  33. package/src/components/data-display/Chart/__tests__/SpecChart.test.tsx +0 -60
  34. package/src/components/data-display/Chart/__tests__/chart-format.test.ts +0 -43
  35. package/src/components/data-display/Chart/__tests__/chart-spec.test.ts +0 -119
  36. package/src/components/data-display/Chip/Chip.stories.tsx +0 -252
  37. package/src/components/data-display/Chip/Chip.test.stories.tsx +0 -266
  38. package/src/components/data-display/DataGrid/DataGrid.stories.tsx +0 -515
  39. package/src/components/data-display/DataGrid/DataGrid.test.stories.tsx +0 -653
  40. package/src/components/data-display/DataViews/__tests__/DataViewsGrid.test.tsx +0 -271
  41. package/src/components/data-display/DataViews/__tests__/DataViewsTableBase.test.tsx +0 -134
  42. package/src/components/data-display/DataViews/__tests__/SaveViewModal.test.tsx +0 -83
  43. package/src/components/data-display/DataViews/__tests__/data-views-filter.test.ts +0 -115
  44. package/src/components/data-display/DataViews/__tests__/data-views-preview.test.ts +0 -53
  45. package/src/components/data-display/DataViews/__tests__/range-pill.test.tsx +0 -114
  46. package/src/components/data-display/DataViews/base-card.stories.tsx +0 -136
  47. package/src/components/data-display/DescriptionItem/DescriptionItem.stories.tsx +0 -254
  48. package/src/components/data-display/EmptyState/EmptyState.stories.tsx +0 -282
  49. package/src/components/data-display/EmptyState/EmptyState.test.stories.tsx +0 -441
  50. package/src/components/data-display/ErrorState/ErrorState.stories.tsx +0 -110
  51. package/src/components/data-display/ErrorState/ErrorState.test.stories.tsx +0 -133
  52. package/src/components/data-display/HoverCard/HoverCard.stories.tsx +0 -650
  53. package/src/components/data-display/HoverCard/HoverCard.test.stories.tsx +0 -929
  54. package/src/components/data-display/InteractiveTooltip/InteractiveTooltip.stories.tsx +0 -411
  55. package/src/components/data-display/LazyImage/LazyImage.stories.tsx +0 -387
  56. package/src/components/data-display/Lightbox/Lightbox.stories.tsx +0 -315
  57. package/src/components/data-display/Lightbox/Lightbox.test.stories.tsx +0 -598
  58. package/src/components/data-display/LoadingState/LoadingState.stories.tsx +0 -124
  59. package/src/components/data-display/LoadingState/LoadingState.test.stories.tsx +0 -99
  60. package/src/components/data-display/MapPreview/MapPreview.stories.tsx +0 -458
  61. package/src/components/data-display/MapPreview/MapPreview.test.stories.tsx +0 -394
  62. package/src/components/data-display/Popover/Popover.stories.tsx +0 -295
  63. package/src/components/data-display/Popover/Popover.test.stories.tsx +0 -1162
  64. package/src/components/data-display/Progress/Progress.stories.tsx +0 -481
  65. package/src/components/data-display/Progress/Progress.test.stories.tsx +0 -2070
  66. package/src/components/data-display/SectionOnboarding/SectionOnboarding.stories.tsx +0 -160
  67. package/src/components/data-display/SectionOnboarding/SectionOnboarding.test.stories.tsx +0 -190
  68. package/src/components/data-display/Sheet/Sheet.stories.tsx +0 -883
  69. package/src/components/data-display/Sheet/Sheet.test.stories.tsx +0 -1105
  70. package/src/components/data-display/StatCard/StatCard.stories.tsx +0 -167
  71. package/src/components/data-display/StatCard/StatCard.test.stories.tsx +0 -240
  72. package/src/components/data-display/Stepper/Stepper.stories.tsx +0 -540
  73. package/src/components/data-display/Stepper/Stepper.test.stories.tsx +0 -600
  74. package/src/components/data-display/Table/Table.stories.tsx +0 -803
  75. package/src/components/data-display/Table/Table.test.stories.tsx +0 -369
  76. package/src/components/data-display/Timeline/Timeline.stories.tsx +0 -442
  77. package/src/components/data-display/Timeline/Timeline.test.stories.tsx +0 -930
  78. package/src/components/data-display/TimingDiagram/TimingDiagram.stories.tsx +0 -475
  79. package/src/components/data-display/TimingDiagram/TimingDiagram.test.stories.tsx +0 -734
  80. package/src/components/data-display/Tooltip/Tooltip.stories.tsx +0 -468
  81. package/src/components/data-display/Tooltip/Tooltip.test.stories.tsx +0 -1154
  82. package/src/components/feedback/ConfirmAction/ConfirmAction.stories.tsx +0 -146
  83. package/src/components/feedback/ConfirmAction/ConfirmAction.test.stories.tsx +0 -114
  84. package/src/components/feedback/ConfirmAction/__tests__/confirm-action.test.tsx +0 -288
  85. package/src/components/feedback/Dialog/Dialog.stories.tsx +0 -833
  86. package/src/components/feedback/Dialog/Dialog.test.stories.tsx +0 -964
  87. package/src/components/feedback/Dialog/__tests__/dialog-content-spacing.test.tsx +0 -66
  88. package/src/components/feedback/Modal/Modal.stories.tsx +0 -765
  89. package/src/components/feedback/Modal/Modal.test.stories.tsx +0 -251
  90. package/src/components/feedback/Sonner/Sonner.stories.tsx +0 -698
  91. package/src/components/feedback/Sonner/Sonner.test.stories.tsx +0 -896
  92. package/src/components/feedback/StackedModal/StackedModal.stories.tsx +0 -1783
  93. package/src/components/feedback/StackedModal/StackedModal.test.stories.tsx +0 -973
  94. package/src/components/feedback/StackedModal/__tests__/stacked-modal-viewport.test.tsx +0 -104
  95. package/src/components/feedback/Toast/Toast.stories.tsx +0 -548
  96. package/src/components/feedback/Toast/Toast.test.stories.tsx +0 -834
  97. package/src/components/feedback/TutorialOverlay/TutorialOverlay.stories.tsx +0 -691
  98. package/src/components/feedback/TutorialOverlay/TutorialOverlay.test.stories.tsx +0 -634
  99. package/src/components/form/AddressAutocomplete/AddressAutocomplete.stories.tsx +0 -665
  100. package/src/components/form/AddressAutocomplete/AddressAutocomplete.test.stories.tsx +0 -727
  101. package/src/components/form/Autocomplete/Autocomplete.stories.tsx +0 -715
  102. package/src/components/form/Autocomplete/Autocomplete.test.stories.tsx +0 -825
  103. package/src/components/form/Button/Button.stories.tsx +0 -365
  104. package/src/components/form/Button/Button.test.stories.tsx +0 -607
  105. package/src/components/form/Calendar/Calendar.stories.tsx +0 -349
  106. package/src/components/form/Calendar/Calendar.test.stories.tsx +0 -464
  107. package/src/components/form/CepField/CepField.stories.tsx +0 -138
  108. package/src/components/form/CepField/CepField.test.stories.tsx +0 -281
  109. package/src/components/form/Checkbox/Checkbox.stories.tsx +0 -265
  110. package/src/components/form/Checkbox/Checkbox.test.stories.tsx +0 -181
  111. package/src/components/form/CodeEditor/CodeEditor.stories.tsx +0 -871
  112. package/src/components/form/CodeEditor/CodeEditor.test.stories.tsx +0 -574
  113. package/src/components/form/Command/Command.stories.tsx +0 -580
  114. package/src/components/form/Command/Command.test.stories.tsx +0 -215
  115. package/src/components/form/CreatableSelect/CreatableSelect.stories.tsx +0 -112
  116. package/src/components/form/CreatableSelect/CreatableSelect.test.stories.tsx +0 -134
  117. package/src/components/form/Form/Form.stories.tsx +0 -687
  118. package/src/components/form/Form/Form.test.stories.tsx +0 -601
  119. package/src/components/form/Input/Input.stories.tsx +0 -260
  120. package/src/components/form/Input/Input.test.stories.tsx +0 -1191
  121. package/src/components/form/InputOTP/InputOTP.stories.tsx +0 -774
  122. package/src/components/form/InputOTP/InputOTP.test.stories.tsx +0 -588
  123. package/src/components/form/Label/Label.stories.tsx +0 -473
  124. package/src/components/form/Label/Label.test.stories.tsx +0 -915
  125. package/src/components/form/Menubar/Menubar.stories.tsx +0 -472
  126. package/src/components/form/Menubar/Menubar.test.stories.tsx +0 -584
  127. package/src/components/form/PasswordStrength/PasswordStrength.stories.tsx +0 -562
  128. package/src/components/form/PasswordStrength/PasswordStrength.test.stories.tsx +0 -327
  129. package/src/components/form/PhoneInput/PhoneInput.stories.tsx +0 -495
  130. package/src/components/form/PhoneInput/PhoneInput.test.stories.tsx +0 -666
  131. package/src/components/form/RadioGroup/RadioGroup.stories.tsx +0 -518
  132. package/src/components/form/RadioGroup/RadioGroup.test.stories.tsx +0 -685
  133. package/src/components/form/RichTextEditor/RichTextEditor.stories.tsx +0 -261
  134. package/src/components/form/RichTextEditor/RichTextEditor.test.stories.tsx +0 -491
  135. package/src/components/form/SearchPalette/SearchPalette.stories.tsx +0 -135
  136. package/src/components/form/Select/Select.stories.tsx +0 -364
  137. package/src/components/form/Select/Select.test.stories.tsx +0 -985
  138. package/src/components/form/Slider/Slider.stories.tsx +0 -418
  139. package/src/components/form/Slider/Slider.test.stories.tsx +0 -1042
  140. package/src/components/form/Switch/Switch.stories.tsx +0 -697
  141. package/src/components/form/Switch/Switch.test.stories.tsx +0 -597
  142. package/src/components/form/Textarea/Textarea.stories.tsx +0 -473
  143. package/src/components/form/Textarea/Textarea.test.stories.tsx +0 -702
  144. package/src/components/form/Toggle/Toggle.stories.tsx +0 -638
  145. package/src/components/form/Toggle/Toggle.test.stories.tsx +0 -1159
  146. package/src/components/form/ToggleGroup/ToggleGroup.stories.tsx +0 -617
  147. package/src/components/form/ToggleGroup/ToggleGroup.test.stories.tsx +0 -915
  148. package/src/components/form/UploadButton/UploadButton.stories.tsx +0 -367
  149. package/src/components/form/UploadButton/UploadButton.test.stories.tsx +0 -573
  150. package/src/components/form/total-form/total-form.test.tsx +0 -214
  151. package/src/components/layout/Accordion/Accordion.stories.tsx +0 -694
  152. package/src/components/layout/Accordion/Accordion.test.stories.tsx +0 -1344
  153. package/src/components/layout/Card/Card.stories.tsx +0 -591
  154. package/src/components/layout/Card/Card.test.stories.tsx +0 -1134
  155. package/src/components/layout/CardGrid/__tests__/CardGrid.test.tsx +0 -92
  156. package/src/components/layout/Collapsible/Collapsible.stories.tsx +0 -180
  157. package/src/components/layout/Collapsible/Collapsible.test.stories.tsx +0 -308
  158. package/src/components/layout/Container/Container.stories.tsx +0 -557
  159. package/src/components/layout/Container/Container.test.stories.tsx +0 -745
  160. package/src/components/layout/ContentToolbar/ContentToolbar.stories.tsx +0 -129
  161. package/src/components/layout/ContentToolbar/ContentToolbar.test.stories.tsx +0 -251
  162. package/src/components/layout/ContentToolbar/__tests__/ColumnsMenu.test.tsx +0 -39
  163. package/src/components/layout/ContentToolbar/__tests__/MultiSelectDropdown.test.tsx +0 -131
  164. package/src/components/layout/ContentToolbar/__tests__/SavedViewsMenu.test.tsx +0 -99
  165. package/src/components/layout/Dashboard/Dashboard.stories.tsx +0 -104
  166. package/src/components/layout/Dashboard/Dashboard.test.stories.tsx +0 -190
  167. package/src/components/layout/Drawer/Drawer.stories.tsx +0 -658
  168. package/src/components/layout/Drawer/Drawer.test.stories.tsx +0 -1343
  169. package/src/components/layout/Resizable/Resizable.stories.tsx +0 -1039
  170. package/src/components/layout/Resizable/Resizable.test.stories.tsx +0 -754
  171. package/src/components/layout/ScrollArea/ScrollArea.stories.tsx +0 -651
  172. package/src/components/layout/ScrollArea/ScrollArea.test.stories.tsx +0 -619
  173. package/src/components/layout/Separator/Separator.stories.tsx +0 -563
  174. package/src/components/layout/Separator/Separator.test.stories.tsx +0 -518
  175. package/src/components/layout/SettingsLayout/SettingsLayout.stories.tsx +0 -192
  176. package/src/components/layout/SettingsLayout/SettingsLayout.test.stories.tsx +0 -175
  177. package/src/components/layout/Sidebar/Sidebar.stories.tsx +0 -609
  178. package/src/components/layout/Sidebar/Sidebar.test.stories.tsx +0 -1324
  179. package/src/components/layout/Skeleton/Skeleton.stories.tsx +0 -689
  180. package/src/components/layout/Skeleton/Skeleton.test.stories.tsx +0 -521
  181. package/src/components/layout/Spacer/Spacer.stories.tsx +0 -502
  182. package/src/components/layout/Spacer/Spacer.test.stories.tsx +0 -474
  183. package/src/components/layout/TableFilter/TableFilter.stories.tsx +0 -82
  184. package/src/components/layout/TableFilter/TableFilter.test.stories.tsx +0 -87
  185. package/src/components/navigation/Breadcrumbs/Breadcrumbs.stories.tsx +0 -638
  186. package/src/components/navigation/Breadcrumbs/Breadcrumbs.test.stories.tsx +0 -1008
  187. package/src/components/navigation/CommandPalette/CommandPalette.stories.tsx +0 -386
  188. package/src/components/navigation/CommandPalette/CommandPalette.test.stories.tsx +0 -435
  189. package/src/components/navigation/ContextMenu/ContextMenu.stories.tsx +0 -614
  190. package/src/components/navigation/ContextMenu/ContextMenu.test.stories.tsx +0 -845
  191. package/src/components/navigation/DropdownMenu/DropdownMenu.stories.tsx +0 -578
  192. package/src/components/navigation/DropdownMenu/DropdownMenu.test.stories.tsx +0 -660
  193. package/src/components/navigation/NavigationMenu/stories/NavigationMenu.stories.tsx +0 -516
  194. package/src/components/navigation/NavigationMenu/stories/NavigationMenu.test.stories.tsx +0 -935
  195. package/src/components/navigation/NavigationMenu/stories/NavigationMenuHorizontal.stories.tsx +0 -501
  196. package/src/components/navigation/NavigationMenu/stories/NavigationMenuVertical.stories.tsx +0 -453
  197. package/src/components/navigation/Pagination/Pagination.stories.tsx +0 -602
  198. package/src/components/navigation/Pagination/Pagination.test.stories.tsx +0 -520
  199. package/src/components/navigation/Tabs/Tabs.stories.tsx +0 -1004
  200. package/src/components/navigation/Tabs/Tabs.test.stories.tsx +0 -1225
  201. package/src/components/typography/Blockquote/Blockquote.stories.tsx +0 -359
  202. package/src/components/typography/Blockquote/Blockquote.test.stories.tsx +0 -432
  203. package/src/components/typography/Code/Code.stories.tsx +0 -686
  204. package/src/components/typography/Code/Code.test.stories.tsx +0 -703
  205. package/src/components/typography/Heading/Heading.stories.tsx +0 -451
  206. package/src/components/typography/Heading/Heading.test.stories.tsx +0 -830
  207. package/src/components/typography/Paragraph/Paragraph.stories.tsx +0 -280
  208. package/src/components/typography/Paragraph/Paragraph.test.stories.tsx +0 -231
  209. package/src/components/typography/Text/Text.stories.tsx +0 -359
  210. package/src/components/typography/Text/Text.test.stories.tsx +0 -759
  211. package/src/components/utility/AnimatedIcon/AnimatedIcon.stories.tsx +0 -945
  212. package/src/components/utility/AnimatedIcon/AnimatedIcon.test.stories.tsx +0 -603
  213. package/src/components/utility/AspectRatio/AspectRatio.stories.tsx +0 -414
  214. package/src/components/utility/AspectRatio/AspectRatio.test.stories.tsx +0 -859
  215. package/src/components/utility/InfiniteScroll/InfiniteScroll.stories.tsx +0 -620
  216. package/src/components/utility/InfiniteScroll/InfiniteScroll.test.stories.tsx +0 -361
  217. package/src/components/utility/InstallPrompt/InstallPrompt.stories.tsx +0 -118
  218. package/src/components/utility/InstallPrompt/InstallPrompt.test.stories.tsx +0 -83
  219. package/src/components/utility/InstallPrompt/__tests__/InstallPrompt.ios.test.tsx +0 -65
  220. package/src/components/utility/InstallPrompt/__tests__/usePwaInstall.test.tsx +0 -271
  221. package/src/components/utility/Portal/Portal.stories.tsx +0 -340
  222. package/src/components/utility/Portal/Portal.test.stories.tsx +0 -2086
  223. package/src/components/utility/Transition/Transition.stories.tsx +0 -493
  224. package/src/components/utility/Transition/Transition.test.stories.tsx +0 -854
  225. package/src/components/utility/VirtualList/VirtualList.stories.tsx +0 -1073
  226. package/src/components/utility/VirtualList/VirtualList.test.stories.tsx +0 -1085
  227. package/src/components/utility/WorkflowStep/WorkflowStep.stories.tsx +0 -431
  228. package/src/components/utility/WorkflowStep/WorkflowStep.test.stories.tsx +0 -364
  229. /package/src/{button.tsx → button/button.tsx} +0 -0
@@ -1,698 +0,0 @@
1
- import { Box, Button, Paper, Stack, Typography } from '@mui/material';
2
- import type { Meta, StoryObj } from '@storybook/react-vite';
3
- import React from 'react';
4
-
5
- import { toast,Toaster } from './Sonner';
6
-
7
- const meta: Meta<typeof Toaster> = {
8
- title: 'Feedback/Sonner',
9
- component: Toaster,
10
- parameters: {
11
- layout: 'padded',
12
- docs: {
13
- description: {
14
- component:
15
- 'Beautiful, customizable toast notifications powered by Sonner. Provides elegant feedback for user actions with various styles and positions.',
16
- },
17
- },
18
- },
19
- tags: ['autodocs', 'component:Sonner'],
20
- argTypes: {
21
- position: {
22
- control: { type: 'select' },
23
- options: [
24
- 'top-left',
25
- 'top-center',
26
- 'top-right',
27
- 'bottom-left',
28
- 'bottom-center',
29
- 'bottom-right',
30
- ],
31
- description: 'Toast position on screen',
32
- },
33
- theme: {
34
- control: { type: 'select' },
35
- options: ['light', 'dark', 'system'],
36
- description: 'Toast theme',
37
- },
38
- expand: {
39
- control: 'boolean',
40
- description: 'Expand toasts by default',
41
- },
42
- richColors: {
43
- control: 'boolean',
44
- description: 'Use rich colors for toast types',
45
- },
46
- closeButton: {
47
- control: 'boolean',
48
- description: 'Show close button on toasts',
49
- },
50
- },
51
- };
52
-
53
- export default meta;
54
- type Story = StoryObj<typeof meta>;
55
-
56
- export const Default: Story = {
57
- render: () => (
58
- <>
59
- <Toaster position="bottom-right" />
60
- <Button variant="contained" onClick={() => toast('This is a default toast notification')}>
61
- Show Toast
62
- </Button>
63
- </>
64
- ),
65
- };
66
-
67
- export const ToastTypes: Story = {
68
- render: () => (
69
- <>
70
- <Toaster richColors closeButton />
71
- <Stack spacing={2}>
72
- <Button variant="contained" onClick={() => toast('Default toast message')}>
73
- Default Toast
74
- </Button>
75
-
76
- <Button
77
- variant="contained"
78
- color="success"
79
- onClick={() => toast.success('Operation completed successfully!')}
80
- >
81
- Success Toast
82
- </Button>
83
-
84
- <Button
85
- variant="contained"
86
- color="error"
87
- onClick={() => toast.error('Something went wrong. Please try again.')}
88
- >
89
- Error Toast
90
- </Button>
91
-
92
- <Button
93
- variant="contained"
94
- color="warning"
95
- onClick={() => toast.warning('Please review before proceeding')}
96
- >
97
- Warning Toast
98
- </Button>
99
-
100
- <Button
101
- variant="contained"
102
- color="info"
103
- onClick={() => toast.info('New updates are available')}
104
- >
105
- Info Toast
106
- </Button>
107
- </Stack>
108
- </>
109
- ),
110
- };
111
-
112
- const ToastPositionsComponent = () => {
113
- const [position, setPosition] = React.useState<
114
- 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'
115
- >('bottom-right');
116
-
117
- return (
118
- <>
119
- <Toaster position={position} />
120
- <Stack spacing={3}>
121
- <Typography variant="h6">Toast Position</Typography>
122
-
123
- <Box display="grid" gridTemplateColumns="repeat(3, 1fr)" gap={2}>
124
- <Button
125
- variant={position === 'top-left' ? 'contained' : 'outlined'}
126
- onClick={() => {
127
- setPosition('top-left');
128
- toast('Top Left Position');
129
- }}
130
- >
131
- Top Left
132
- </Button>
133
-
134
- <Button
135
- variant={position === 'top-center' ? 'contained' : 'outlined'}
136
- onClick={() => {
137
- setPosition('top-center');
138
- toast('Top Center Position');
139
- }}
140
- >
141
- Top Center
142
- </Button>
143
-
144
- <Button
145
- variant={position === 'top-right' ? 'contained' : 'outlined'}
146
- onClick={() => {
147
- setPosition('top-right');
148
- toast('Top Right Position');
149
- }}
150
- >
151
- Top Right
152
- </Button>
153
-
154
- <Button
155
- variant={position === 'bottom-left' ? 'contained' : 'outlined'}
156
- onClick={() => {
157
- setPosition('bottom-left');
158
- toast('Bottom Left Position');
159
- }}
160
- >
161
- Bottom Left
162
- </Button>
163
-
164
- <Button
165
- variant={position === 'bottom-center' ? 'contained' : 'outlined'}
166
- onClick={() => {
167
- setPosition('bottom-center');
168
- toast('Bottom Center Position');
169
- }}
170
- >
171
- Bottom Center
172
- </Button>
173
-
174
- <Button
175
- variant={position === 'bottom-right' ? 'contained' : 'outlined'}
176
- onClick={() => {
177
- setPosition('bottom-right');
178
- toast('Bottom Right Position');
179
- }}
180
- >
181
- Bottom Right
182
- </Button>
183
- </Box>
184
- </Stack>
185
- </>
186
- );
187
- };
188
-
189
- export const ToastPositions: Story = {
190
- render: () => <ToastPositionsComponent />,
191
- };
192
-
193
- export const CustomToasts: Story = {
194
- render: () => (
195
- <>
196
- <Toaster richColors />
197
- <Stack spacing={2}>
198
- <Button
199
- variant="contained"
200
- onClick={() =>
201
- toast('Event has been created', {
202
- description: 'Monday, January 3rd at 6:00pm',
203
- action: {
204
- label: 'Undo',
205
- onClick: () => {
206
- // Undo action would go here
207
- },
208
- },
209
- })
210
- }
211
- >
212
- Toast with Icon
213
- </Button>
214
-
215
- <Button
216
- variant="contained"
217
- onClick={() => {
218
- const toastId = toast.loading('Uploading file...');
219
- window.setTimeout(() => {
220
- toast.success('File uploaded successfully!', {
221
- id: toastId,
222
- });
223
- }, 2000);
224
- }}
225
- >
226
- Loading Toast
227
- </Button>
228
- </Stack>
229
- </>
230
- ),
231
- };
232
-
233
- export const PromiseToast: Story = {
234
- render: () => (
235
- <>
236
- <Toaster richColors />
237
- <Stack spacing={2}>
238
- <Button
239
- variant="contained"
240
- onClick={() => {
241
- const promise = new Promise((resolve) => {
242
- window.setTimeout(() => {
243
- resolve({ name: 'Sonner' });
244
- }, 2000);
245
- });
246
-
247
- toast.promise(promise, {
248
- loading: 'Loading data...',
249
- success: 'Data loaded successfully!',
250
- error: 'Failed to load data',
251
- });
252
- }}
253
- >
254
- Promise Toast (Success)
255
- </Button>
256
-
257
- <Button
258
- variant="contained"
259
- color="error"
260
- onClick={() => {
261
- const promise = new Promise((_, reject) => {
262
- window.setTimeout(() => {
263
- reject(new Error('Network error'));
264
- }, 2000);
265
- });
266
-
267
- toast.promise(promise, {
268
- loading: 'Saving changes...',
269
- success: 'Changes saved!',
270
- error: 'Failed to save changes',
271
- });
272
- }}
273
- >
274
- Promise Toast (Error)
275
- </Button>
276
- </Stack>
277
- </>
278
- ),
279
- };
280
-
281
- export const ActionToasts: Story = {
282
- render: () => (
283
- <>
284
- <Toaster closeButton richColors />
285
- <Stack spacing={2}>
286
- <Button
287
- variant="contained"
288
- onClick={() => {
289
- toast('Message deleted', {
290
- action: {
291
- label: 'Undo',
292
- onClick: () => toast.success('Message restored'),
293
- },
294
- });
295
- }}
296
- >
297
- Toast with Undo Action
298
- </Button>
299
-
300
- <Button
301
- variant="contained"
302
- onClick={() => {
303
- toast.error('Connection failed', {
304
- action: {
305
- label: 'Retry',
306
- onClick: () => toast.success('Connected successfully'),
307
- },
308
- });
309
- }}
310
- >
311
- Error with Retry
312
- </Button>
313
-
314
- <Button
315
- variant="contained"
316
- onClick={() => {
317
- toast('New version available', {
318
- action: {
319
- label: 'Update Now',
320
- onClick: () => toast.loading('Updating...'),
321
- },
322
- duration: Infinity,
323
- });
324
- }}
325
- >
326
- Persistent Toast with Action
327
- </Button>
328
- </Stack>
329
- </>
330
- ),
331
- };
332
-
333
- export const DurationControl: Story = {
334
- render: () => (
335
- <>
336
- <Toaster />
337
- <Stack spacing={2}>
338
- <Button
339
- variant="outlined"
340
- onClick={() => toast('Quick toast (2 seconds)', { duration: 2000 })}
341
- >
342
- 2 Second Toast
343
- </Button>
344
-
345
- <Button
346
- variant="outlined"
347
- onClick={() => toast('Standard toast (4 seconds)', { duration: 4000 })}
348
- >
349
- 4 Second Toast
350
- </Button>
351
-
352
- <Button
353
- variant="outlined"
354
- onClick={() => toast('Long toast (10 seconds)', { duration: 10000 })}
355
- >
356
- 10 Second Toast
357
- </Button>
358
-
359
- <Button
360
- variant="outlined"
361
- onClick={() => {
362
- const id = toast('Persistent toast - click to dismiss', {
363
- duration: Infinity,
364
- onClick: () => toast.dismiss(id),
365
- });
366
- }}
367
- >
368
- Persistent Toast
369
- </Button>
370
- </Stack>
371
- </>
372
- ),
373
- };
374
-
375
- export const FormFeedback: Story = {
376
- render: () => {
377
- const handleSubmit = (success: boolean) => {
378
- if (success) {
379
- toast.success('Form submitted successfully!', {
380
- description: "We'll get back to you within 24 hours.",
381
- });
382
- } else {
383
- toast.error('Please fix the errors below', {
384
- description: 'Some required fields are missing.',
385
- });
386
- }
387
- };
388
-
389
- return (
390
- <>
391
- <Toaster richColors position="top-center" />
392
- <Paper sx={{ p: 3, maxWidth: 400 }}>
393
- <Typography variant="h6" gutterBottom>
394
- Contact Form
395
- </Typography>
396
-
397
- <Stack spacing={2}>
398
- <input placeholder="Name" style={{ padding: '8px' }} />
399
- <input placeholder="Email" style={{ padding: '8px' }} />
400
- <textarea placeholder="Message" rows={4} style={{ padding: '8px' }} />
401
-
402
- <Stack direction="row" spacing={2}>
403
- <Button variant="contained" onClick={() => handleSubmit(true)}>
404
- Submit (Success)
405
- </Button>
406
-
407
- <Button variant="outlined" color="error" onClick={() => handleSubmit(false)}>
408
- Submit (Error)
409
- </Button>
410
- </Stack>
411
- </Stack>
412
- </Paper>
413
- </>
414
- );
415
- },
416
- };
417
-
418
- export const MultipleToasts: Story = {
419
- render: () => (
420
- <>
421
- <Toaster expand richColors />
422
- <Stack spacing={2}>
423
- <Button
424
- variant="contained"
425
- onClick={() => {
426
- toast.success('File 1 uploaded');
427
- toast.success('File 2 uploaded');
428
- toast.success('File 3 uploaded');
429
- toast.info('All files processed');
430
- }}
431
- >
432
- Show Multiple Toasts
433
- </Button>
434
-
435
- <Button
436
- variant="outlined"
437
- onClick={() => {
438
- toast('First notification');
439
- window.setTimeout(() => toast('Second notification'), 500);
440
- window.setTimeout(() => toast('Third notification'), 1000);
441
- window.setTimeout(() => toast('Fourth notification'), 1500);
442
- }}
443
- >
444
- Staggered Toasts
445
- </Button>
446
-
447
- <Button variant="outlined" color="error" onClick={() => toast.dismiss()}>
448
- Dismiss All
449
- </Button>
450
- </Stack>
451
- </>
452
- ),
453
- };
454
-
455
- const ThemedToastsComponent = () => {
456
- const [theme, setTheme] = React.useState<'light' | 'dark'>('light');
457
-
458
- return (
459
- <Box
460
- sx={{
461
- p: 3,
462
- bgcolor: theme === 'dark' ? 'grey.900' : 'grey.50',
463
- minHeight: 300,
464
- }}
465
- >
466
- <Toaster theme={theme} richColors />
467
-
468
- <Stack spacing={3}>
469
- <Stack direction="row" spacing={2}>
470
- <Button
471
- variant={theme === 'light' ? 'contained' : 'outlined'}
472
- onClick={() => setTheme('light')}
473
- >
474
- Light Theme
475
- </Button>
476
-
477
- <Button
478
- variant={theme === 'dark' ? 'contained' : 'outlined'}
479
- onClick={() => setTheme('dark')}
480
- >
481
- Dark Theme
482
- </Button>
483
- </Stack>
484
-
485
- <Stack direction="row" spacing={2}>
486
- <Button
487
- variant="contained"
488
- onClick={() => toast.success(`Success in ${ theme } theme`)}
489
- >
490
- Success
491
- </Button>
492
-
493
- <Button
494
- variant="contained"
495
- color="error"
496
- onClick={() => toast.error(`Error in ${ theme } theme`)}
497
- >
498
- Error
499
- </Button>
500
-
501
- <Button
502
- variant="contained"
503
- color="info"
504
- onClick={() => toast.info(`Info in ${ theme } theme`)}
505
- >
506
- Info
507
- </Button>
508
- </Stack>
509
- </Stack>
510
- </Box>
511
- );
512
- };
513
-
514
- export const ThemedToasts: Story = {
515
- render: () => <ThemedToastsComponent />,
516
- };
517
-
518
- // Required story exports for validation
519
- export const AllVariants: Story = {
520
- render: () => (
521
- <>
522
- <Toaster richColors closeButton />
523
- <Stack spacing={2} direction="row" flexWrap="wrap">
524
- <Button variant="contained" onClick={() => toast('Default toast')}>
525
- Default
526
- </Button>
527
- <Button variant="contained" color="success" onClick={() => toast.success('Success!')}>
528
- Success
529
- </Button>
530
- <Button variant="contained" color="error" onClick={() => toast.error('Error!')}>
531
- Error
532
- </Button>
533
- <Button variant="contained" color="warning" onClick={() => toast.warning('Warning!')}>
534
- Warning
535
- </Button>
536
- <Button variant="contained" color="info" onClick={() => toast.info('Info!')}>
537
- Info
538
- </Button>
539
- <Button variant="outlined" onClick={() => toast.loading('Loading...')}>
540
- Loading
541
- </Button>
542
- </Stack>
543
- </>
544
- ),
545
- };
546
-
547
- export const AllSizes: Story = {
548
- render: () => (
549
- <>
550
- <Toaster />
551
- <Stack spacing={2}>
552
- <Button variant="outlined" onClick={() => toast('Compact', { duration: 3000 })}>
553
- Default Size
554
- </Button>
555
- <Button
556
- variant="outlined"
557
- onClick={() =>
558
- toast('Toast with description', {
559
- description: 'This is additional information',
560
- duration: 3000,
561
- })
562
- }
563
- >
564
- With Description
565
- </Button>
566
- <Button
567
- variant="outlined"
568
- onClick={() =>
569
- toast('Toast with action', {
570
- action: { label: 'Undo', onClick: () => {} },
571
- duration: 3000,
572
- })
573
- }
574
- >
575
- With Action
576
- </Button>
577
- </Stack>
578
- </>
579
- ),
580
- };
581
-
582
- export const AllStates: Story = {
583
- render: () => (
584
- <>
585
- <Toaster richColors closeButton />
586
- <Stack spacing={2}>
587
- <Button variant="outlined" onClick={() => toast('Normal state toast')}>
588
- Normal
589
- </Button>
590
- <Button
591
- variant="outlined"
592
- onClick={() => {
593
- const id = toast.loading('Processing...');
594
- window.setTimeout(() => toast.success('Complete!', { id }), 2000);
595
- }}
596
- >
597
- Loading → Success
598
- </Button>
599
- <Button
600
- variant="outlined"
601
- onClick={() => {
602
- const id = toast.loading('Processing...');
603
- window.setTimeout(() => toast.error('Failed!', { id }), 2000);
604
- }}
605
- >
606
- Loading → Error
607
- </Button>
608
- <Button variant="outlined" onClick={() => toast('Hoverable toast', { duration: 10000 })}>
609
- Hover to Pause
610
- </Button>
611
- </Stack>
612
- </>
613
- ),
614
- };
615
-
616
- export const InteractiveStates: Story = {
617
- render: () => (
618
- <>
619
- <Toaster closeButton richColors />
620
- <Stack spacing={2}>
621
- <Button
622
- variant="contained"
623
- onClick={() =>
624
- toast('Click to dismiss', {
625
- duration: Infinity,
626
- onClick: (t) => toast.dismiss(t.id),
627
- })
628
- }
629
- >
630
- Clickable Toast
631
- </Button>
632
- <Button
633
- variant="contained"
634
- onClick={() =>
635
- toast('Toast with action', {
636
- action: {
637
- label: 'Undo',
638
- onClick: () => toast.success('Undone!'),
639
- },
640
- })
641
- }
642
- >
643
- With Action Button
644
- </Button>
645
- <Button
646
- variant="contained"
647
- onClick={() =>
648
- toast('Dismissible toast', {
649
- duration: 10000,
650
- })
651
- }
652
- >
653
- With Close Button
654
- </Button>
655
- <Button variant="outlined" color="error" onClick={() => toast.dismiss()}>
656
- Dismiss All
657
- </Button>
658
- </Stack>
659
- </>
660
- ),
661
- };
662
-
663
- export const Responsive: Story = {
664
- parameters: {
665
- viewport: { defaultViewport: 'mobile1' },
666
- },
667
- render: () => (
668
- <>
669
- <Toaster position="bottom-center" />
670
- <Stack spacing={2}>
671
- <Typography variant="body2">Test on different screen sizes:</Typography>
672
- <Button variant="contained" onClick={() => toast('Mobile responsive toast')}>
673
- Show Toast (Mobile)
674
- </Button>
675
- <Button
676
- variant="contained"
677
- onClick={() =>
678
- toast.success('Success notification', {
679
- description: 'This adapts to screen size',
680
- })
681
- }
682
- >
683
- With Description
684
- </Button>
685
- <Button
686
- variant="contained"
687
- onClick={() => {
688
- toast('First toast');
689
- toast('Second toast');
690
- toast('Third toast');
691
- }}
692
- >
693
- Multiple Toasts
694
- </Button>
695
- </Stack>
696
- </>
697
- ),
698
- };