@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,1134 +0,0 @@
1
- import CheckCircle from '@mui/icons-material/CheckCircle';
2
- import ErrorIcon from '@mui/icons-material/Error';
3
- import Favorite from '@mui/icons-material/Favorite';
4
- import FiberManualRecord from '@mui/icons-material/FiberManualRecord';
5
- import Info from '@mui/icons-material/Info';
6
- import Mail from '@mui/icons-material/Mail';
7
- import NewReleases from '@mui/icons-material/NewReleases';
8
- import Notifications from '@mui/icons-material/Notifications';
9
- import Schedule from '@mui/icons-material/Schedule';
10
- import ShoppingCart from '@mui/icons-material/ShoppingCart';
11
- import Star from '@mui/icons-material/Star';
12
- import TrendingUp from '@mui/icons-material/TrendingUp';
13
- import Verified from '@mui/icons-material/Verified';
14
- import Warning from '@mui/icons-material/Warning';
15
- import {
16
- Avatar,
17
- Box,
18
- Button,
19
- createTheme,
20
- IconButton,
21
- Paper,
22
- Stack,
23
- ThemeProvider,
24
- Typography,
25
- } from '@mui/material';
26
- import type { Meta, StoryObj } from '@storybook/react-vite';
27
- import { useState } from 'react';
28
-
29
- import { Badge } from './Badge';
30
-
31
- const meta: Meta<typeof Badge> = {
32
- title: 'DataDisplay/Badge',
33
- component: Badge,
34
- parameters: {
35
- layout: 'centered',
36
- docs: {
37
- description: {
38
- component:
39
- 'A versatile badge component for displaying notifications, counts, and status indicators with various styles and animations.',
40
- },
41
- },
42
- },
43
- tags: ['autodocs', 'component:Badge'],
44
- argTypes: {
45
- variant: {
46
- control: { type: 'select' },
47
- options: [
48
- 'default',
49
- 'dot',
50
- 'count',
51
- 'gradient',
52
- 'glass',
53
- 'outline',
54
- 'secondary',
55
- 'destructive',
56
- 'success',
57
- 'warning',
58
- ],
59
- description: 'The visual style variant of the badge',
60
- },
61
- size: {
62
- control: { type: 'select' },
63
- options: ['xs', 'sm', 'md', 'lg'],
64
- },
65
- color: {
66
- control: { type: 'select' },
67
- options: ['primary', 'secondary', 'success', 'warning', 'error', 'neutral'],
68
- },
69
- position: {
70
- control: { type: 'select' },
71
- options: ['top-right', 'top-left', 'bottom-right', 'bottom-left'],
72
- },
73
- glow: {
74
- control: { type: 'boolean' },
75
- },
76
- pulse: {
77
- control: { type: 'boolean' },
78
- },
79
- showZero: {
80
- control: { type: 'boolean' },
81
- },
82
- animate: {
83
- control: { type: 'boolean' },
84
- description: 'Whether to animate the badge on mount',
85
- },
86
- shimmer: {
87
- control: { type: 'boolean' },
88
- description: 'Whether to show a shimmer effect',
89
- },
90
- bounce: {
91
- control: { type: 'boolean' },
92
- description: 'Whether to bounce on mount',
93
- },
94
- closable: {
95
- control: { type: 'boolean' },
96
- description: 'Whether the badge can be closed',
97
- },
98
- icon: {
99
- control: { type: 'text' },
100
- description: 'Icon to display in the badge',
101
- },
102
- 'aria-label': {
103
- control: { type: 'text' },
104
- description: 'Accessibility label for screen readers',
105
- },
106
- },
107
- };
108
-
109
- export default meta;
110
- type Story = StoryObj<typeof meta>;
111
-
112
- // Showcase all features
113
- export const Playground: Story = {
114
- args: {
115
- badgeContent: 5,
116
- variant: 'default',
117
- color: 'primary',
118
- size: 'md',
119
- position: 'top-right',
120
- glow: false,
121
- pulse: false,
122
- animate: true,
123
- showZero: false,
124
- max: 99,
125
- children: <Mail />,
126
- },
127
- parameters: {
128
- docs: {
129
- description: {
130
- story: 'Interactive playground to test all badge props and combinations.',
131
- },
132
- },
133
- },
134
- };
135
-
136
- // Basic examples
137
- export const Default: Story = {
138
- args: {
139
- badgeContent: 4,
140
- children: <Mail />,
141
- },
142
- };
143
-
144
- export const WithIcon: Story = {
145
- args: {
146
- badgeContent: 12,
147
- color: 'error',
148
- children: <Notifications />,
149
- },
150
- };
151
-
152
- export const WithText: Story = {
153
- args: {
154
- badgeContent: 'NEW',
155
- color: 'success',
156
- size: 'lg',
157
- children: <Box sx={{ p: 2, border: 1, borderColor: 'divider', borderRadius: 1 }}>Product</Box>,
158
- },
159
- };
160
-
161
- // Variants
162
- export const Variants: Story = {
163
- render: () => (
164
- <Stack spacing={3}>
165
- <Stack direction="row" spacing={4} alignItems="center">
166
- <Box textAlign="center">
167
- <Badge variant="default" badgeContent={4}>
168
- <Mail />
169
- </Badge>
170
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>Default</div>
171
- </Box>
172
- <Box textAlign="center">
173
- <Badge variant="dot" color="success">
174
- <Notifications />
175
- </Badge>
176
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>Dot</div>
177
- </Box>
178
- <Box textAlign="center">
179
- <Badge variant="count" badgeContent={99} color="error">
180
- <ShoppingCart />
181
- </Badge>
182
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>Count</div>
183
- </Box>
184
- <Box textAlign="center">
185
- <Badge variant="gradient" badgeContent="PRO" color="warning">
186
- <Star />
187
- </Badge>
188
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>Gradient</div>
189
- </Box>
190
- <Box textAlign="center">
191
- <Badge variant="glass" badgeContent="5" color="primary">
192
- <Favorite />
193
- </Badge>
194
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>Glass</div>
195
- </Box>
196
- </Stack>
197
- <Stack direction="row" spacing={4} alignItems="center">
198
- <Box textAlign="center">
199
- <Badge variant="outline" badgeContent="NEW" color="primary">
200
- <NewReleases />
201
- </Badge>
202
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>Outline</div>
203
- </Box>
204
- <Box textAlign="center">
205
- <Badge variant="secondary" badgeContent="12" color="secondary">
206
- <TrendingUp />
207
- </Badge>
208
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>Secondary</div>
209
- </Box>
210
- <Box textAlign="center">
211
- <Badge variant="destructive" badgeContent="!" color="error">
212
- <ErrorIcon />
213
- </Badge>
214
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>Destructive</div>
215
- </Box>
216
- <Box textAlign="center">
217
- <Badge variant="success" badgeContent="✓" color="success">
218
- <Verified />
219
- </Badge>
220
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>Success</div>
221
- </Box>
222
- <Box textAlign="center">
223
- <Badge variant="warning" badgeContent="⚠" color="warning">
224
- <Warning />
225
- </Badge>
226
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>Warning</div>
227
- </Box>
228
- </Stack>
229
- </Stack>
230
- ),
231
- };
232
-
233
- // Sizes
234
- export const Sizes: Story = {
235
- render: () => (
236
- <Stack direction="row" spacing={4} alignItems="center">
237
- <Box textAlign="center">
238
- <Badge size="xs" badgeContent={4}>
239
- <Mail />
240
- </Badge>
241
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>Extra Small</div>
242
- </Box>
243
- <Box textAlign="center">
244
- <Badge size="sm" badgeContent={4}>
245
- <Mail />
246
- </Badge>
247
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>Small</div>
248
- </Box>
249
- <Box textAlign="center">
250
- <Badge size="md" badgeContent={4}>
251
- <Mail />
252
- </Badge>
253
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>Medium</div>
254
- </Box>
255
- <Box textAlign="center">
256
- <Badge size="lg" badgeContent={4}>
257
- <Mail />
258
- </Badge>
259
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>Large</div>
260
- </Box>
261
- </Stack>
262
- ),
263
- };
264
-
265
- // Colors
266
- export const Colors: Story = {
267
- render: () => (
268
- <Stack direction="row" spacing={3} alignItems="center">
269
- <Badge color="primary" badgeContent={4}>
270
- <Mail />
271
- </Badge>
272
- <Badge color="secondary" badgeContent={4}>
273
- <Mail />
274
- </Badge>
275
- <Badge color="success" badgeContent={4}>
276
- <Mail />
277
- </Badge>
278
- <Badge color="warning" badgeContent={4}>
279
- <Mail />
280
- </Badge>
281
- <Badge color="error" badgeContent={4}>
282
- <Mail />
283
- </Badge>
284
- <Badge color="neutral" badgeContent={4}>
285
- <Mail />
286
- </Badge>
287
- </Stack>
288
- ),
289
- };
290
-
291
- // Positions
292
- export const Positions: Story = {
293
- render: () => (
294
- <Stack direction="row" spacing={4} alignItems="center">
295
- <Box textAlign="center">
296
- <Badge position="top-right" badgeContent={1}>
297
- <Box sx={{ width: 40, height: 40, bgcolor: 'grey.300', borderRadius: 1 }} />
298
- </Badge>
299
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>Top Right</div>
300
- </Box>
301
- <Box textAlign="center">
302
- <Badge position="top-left" badgeContent={2}>
303
- <Box sx={{ width: 40, height: 40, bgcolor: 'grey.300', borderRadius: 1 }} />
304
- </Badge>
305
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>Top Left</div>
306
- </Box>
307
- <Box textAlign="center">
308
- <Badge position="bottom-right" badgeContent={3}>
309
- <Box sx={{ width: 40, height: 40, bgcolor: 'grey.300', borderRadius: 1 }} />
310
- </Badge>
311
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>Bottom Right</div>
312
- </Box>
313
- <Box textAlign="center">
314
- <Badge position="bottom-left" badgeContent={4}>
315
- <Box sx={{ width: 40, height: 40, bgcolor: 'grey.300', borderRadius: 1 }} />
316
- </Badge>
317
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>Bottom Left</div>
318
- </Box>
319
- </Stack>
320
- ),
321
- };
322
-
323
- // Count formatting
324
- export const CountFormatting: Story = {
325
- render: () => (
326
- <Stack direction="row" spacing={3} alignItems="center">
327
- <Box textAlign="center">
328
- <Badge variant="count" badgeContent={5}>
329
- <Mail />
330
- </Badge>
331
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>5</div>
332
- </Box>
333
- <Box textAlign="center">
334
- <Badge variant="count" badgeContent={99}>
335
- <Mail />
336
- </Badge>
337
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>99</div>
338
- </Box>
339
- <Box textAlign="center">
340
- <Badge variant="count" badgeContent={100} max={99}>
341
- <Mail />
342
- </Badge>
343
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>99+</div>
344
- </Box>
345
- <Box textAlign="center">
346
- <Badge variant="count" badgeContent={1000} max={999}>
347
- <Mail />
348
- </Badge>
349
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>999+</div>
350
- </Box>
351
- </Stack>
352
- ),
353
- };
354
-
355
- // With effects
356
- export const WithGlow: Story = {
357
- args: {
358
- glow: true,
359
- badgeContent: 'HOT',
360
- color: 'error',
361
- size: 'lg',
362
- children: <Favorite />,
363
- },
364
- };
365
-
366
- export const WithPulse: Story = {
367
- args: {
368
- pulse: true,
369
- variant: 'dot',
370
- color: 'success',
371
- children: <Notifications />,
372
- },
373
- };
374
-
375
- export const WithGlowAndPulse: Story = {
376
- args: {
377
- glow: true,
378
- pulse: true,
379
- badgeContent: '!',
380
- color: 'warning',
381
- children: <Box sx={{ p: 2, border: 1, borderColor: 'divider', borderRadius: 1 }}>Alert</Box>,
382
- },
383
- };
384
-
385
- // Real-world examples
386
- export const NotificationBadges: Story = {
387
- render: () => (
388
- <Stack direction="row" spacing={3} alignItems="center">
389
- <IconButton>
390
- <Badge badgeContent={4} color="error">
391
- <Mail />
392
- </Badge>
393
- </IconButton>
394
- <IconButton>
395
- <Badge variant="dot" color="success">
396
- <Notifications />
397
- </Badge>
398
- </IconButton>
399
- <IconButton>
400
- <Badge badgeContent={12} color="warning">
401
- <ShoppingCart />
402
- </Badge>
403
- </IconButton>
404
- </Stack>
405
- ),
406
- };
407
-
408
- export const UserProfileWithBadge: Story = {
409
- render: () => (
410
- <Stack direction="row" spacing={2} alignItems="center">
411
- <Badge variant="dot" color="success" position="bottom-right">
412
- <Avatar
413
- src="https://images.unsplash.com/photo-1494790108755-2616b612b789?w=150&h=150&fit=crop&crop=face"
414
- alt="User"
415
- sx={{ width: 56, height: 56 }}
416
- />
417
- </Badge>
418
- <Box>
419
- <div style={{ fontWeight: 600 }}>Sarah Johnson</div>
420
- <div style={{ color: '#666', fontSize: '0.875rem' }}>Online</div>
421
- </Box>
422
- </Stack>
423
- ),
424
- };
425
-
426
- export const ProductBadges: Story = {
427
- render: () => (
428
- <Stack direction="row" spacing={3}>
429
- <Box
430
- sx={{
431
- position: 'relative',
432
- p: 2,
433
- border: 1,
434
- borderColor: 'divider',
435
- borderRadius: 2,
436
- width: 120,
437
- textAlign: 'center',
438
- }}
439
- >
440
- <Badge badgeContent="NEW" color="success" size="sm" position="top-left">
441
- <Box sx={{ width: '100%', height: 80, bgcolor: 'grey.100', borderRadius: 1, mb: 1 }} />
442
- </Badge>
443
- <div style={{ fontSize: '0.875rem' }}>Product A</div>
444
- </Box>
445
- <Box
446
- sx={{
447
- position: 'relative',
448
- p: 2,
449
- border: 1,
450
- borderColor: 'divider',
451
- borderRadius: 2,
452
- width: 120,
453
- textAlign: 'center',
454
- }}
455
- >
456
- <Badge badgeContent="50%" color="error" variant="gradient" position="top-right">
457
- <Box sx={{ width: '100%', height: 80, bgcolor: 'grey.100', borderRadius: 1, mb: 1 }} />
458
- </Badge>
459
- <div style={{ fontSize: '0.875rem' }}>Product B</div>
460
- </Box>
461
- <Box
462
- sx={{
463
- position: 'relative',
464
- p: 2,
465
- border: 1,
466
- borderColor: 'divider',
467
- borderRadius: 2,
468
- width: 120,
469
- textAlign: 'center',
470
- }}
471
- >
472
- <Badge variant="dot" color="warning" pulse position="top-left">
473
- <Box sx={{ width: '100%', height: 80, bgcolor: 'grey.100', borderRadius: 1, mb: 1 }} />
474
- </Badge>
475
- <div style={{ fontSize: '0.875rem' }}>Product C</div>
476
- </Box>
477
- </Stack>
478
- ),
479
- };
480
-
481
- // Zero handling
482
- export const ZeroHandling: Story = {
483
- render: () => (
484
- <Stack direction="row" spacing={4} alignItems="center">
485
- <Box textAlign="center">
486
- <Badge badgeContent={0} showZero={false}>
487
- <Mail />
488
- </Badge>
489
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>Hidden Zero</div>
490
- </Box>
491
- <Box textAlign="center">
492
- <Badge badgeContent={0} showZero={true}>
493
- <Mail />
494
- </Badge>
495
- <div style={{ marginTop: 8, fontSize: '0.875rem' }}>Show Zero</div>
496
- </Box>
497
- </Stack>
498
- ),
499
- };
500
-
501
- // Glass morphism effect
502
- export const GlassMorphism: Story = {
503
- render: () => (
504
- <Box
505
- sx={{
506
- p: 4,
507
- background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
508
- borderRadius: 2,
509
- }}
510
- >
511
- <Stack direction="row" spacing={3} alignItems="center">
512
- <Badge variant="glass" badgeContent="NEW" color="primary" size="lg">
513
- <Paper sx={{ p: 2, bgcolor: 'rgba(255,255,255,0.9)' }}>
514
- <Typography>Feature</Typography>
515
- </Paper>
516
- </Badge>
517
- <Badge variant="glass" badgeContent={7} color="success">
518
- <IconButton sx={{ bgcolor: 'rgba(255,255,255,0.9)' }}>
519
- <CheckCircle />
520
- </IconButton>
521
- </Badge>
522
- <Badge variant="glass" badgeContent="!" color="error" glow>
523
- <IconButton sx={{ bgcolor: 'rgba(255,255,255,0.9)' }}>
524
- <ErrorIcon />
525
- </IconButton>
526
- </Badge>
527
- </Stack>
528
- </Box>
529
- ),
530
- };
531
-
532
- // Theme Variations
533
- const darkTheme = createTheme({
534
- palette: {
535
- mode: 'dark',
536
- },
537
- });
538
-
539
- const lightTheme = createTheme({
540
- palette: {
541
- mode: 'light',
542
- },
543
- });
544
-
545
- export const ThemeVariations: Story = {
546
- render: () => (
547
- <Stack spacing={3}>
548
- <ThemeProvider theme={lightTheme}>
549
- <Paper sx={{ p: 3 }}>
550
- <Typography variant="h6" gutterBottom>
551
- Light Theme
552
- </Typography>
553
- <Stack direction="row" spacing={2}>
554
- <Badge badgeContent={4} color="primary">
555
- <Mail />
556
- </Badge>
557
- <Badge badgeContent="NEW" color="success" variant="gradient">
558
- <Star />
559
- </Badge>
560
- <Badge variant="dot" color="error" pulse>
561
- <Notifications />
562
- </Badge>
563
- <Badge variant="glass" badgeContent="5" color="warning">
564
- <ShoppingCart />
565
- </Badge>
566
- </Stack>
567
- </Paper>
568
- </ThemeProvider>
569
-
570
- <ThemeProvider theme={darkTheme}>
571
- <Paper sx={{ p: 3, bgcolor: 'background.default' }}>
572
- <Typography variant="h6" gutterBottom>
573
- Dark Theme
574
- </Typography>
575
- <Stack direction="row" spacing={2}>
576
- <Badge badgeContent={4} color="primary">
577
- <Mail />
578
- </Badge>
579
- <Badge badgeContent="NEW" color="success" variant="gradient">
580
- <Star />
581
- </Badge>
582
- <Badge variant="dot" color="error" pulse>
583
- <Notifications />
584
- </Badge>
585
- <Badge variant="glass" badgeContent="5" color="warning">
586
- <ShoppingCart />
587
- </Badge>
588
- </Stack>
589
- </Paper>
590
- </ThemeProvider>
591
- </Stack>
592
- ),
593
- };
594
-
595
- // Status Indicators
596
- export const StatusIndicators: Story = {
597
- render: () => (
598
- <Stack spacing={3}>
599
- <Typography variant="h6">Status Badges</Typography>
600
- <Stack direction="row" spacing={3} alignItems="center">
601
- <Box textAlign="center">
602
- <Badge variant="dot" color="success" pulse>
603
- <Avatar sx={{ bgcolor: 'grey.300' }}>
604
- <FiberManualRecord />
605
- </Avatar>
606
- </Badge>
607
- <Typography variant="caption" display="block" mt={1}>
608
- Online
609
- </Typography>
610
- </Box>
611
- <Box textAlign="center">
612
- <Badge variant="dot" color="warning">
613
- <Avatar sx={{ bgcolor: 'grey.300' }}>
614
- <FiberManualRecord />
615
- </Avatar>
616
- </Badge>
617
- <Typography variant="caption" display="block" mt={1}>
618
- Away
619
- </Typography>
620
- </Box>
621
- <Box textAlign="center">
622
- <Badge variant="dot" color="error">
623
- <Avatar sx={{ bgcolor: 'grey.300' }}>
624
- <FiberManualRecord />
625
- </Avatar>
626
- </Badge>
627
- <Typography variant="caption" display="block" mt={1}>
628
- Busy
629
- </Typography>
630
- </Box>
631
- <Box textAlign="center">
632
- <Badge variant="dot" color="neutral">
633
- <Avatar sx={{ bgcolor: 'grey.300' }}>
634
- <FiberManualRecord />
635
- </Avatar>
636
- </Badge>
637
- <Typography variant="caption" display="block" mt={1}>
638
- Offline
639
- </Typography>
640
- </Box>
641
- </Stack>
642
- </Stack>
643
- ),
644
- };
645
-
646
- // Animated Badges
647
- export const AnimatedBadges: Story = {
648
- render: () => (
649
- <Stack spacing={3}>
650
- <Typography variant="h6">Animated Badges</Typography>
651
- <Stack direction="row" spacing={3} alignItems="center">
652
- <Box textAlign="center">
653
- <Badge badgeContent="NEW" color="success" animate>
654
- <Paper sx={{ p: 2 }}>
655
- <Typography>Fade In</Typography>
656
- </Paper>
657
- </Badge>
658
- </Box>
659
- <Box textAlign="center">
660
- <Badge badgeContent="BOUNCE" color="primary" bounce>
661
- <IconButton>
662
- <Star />
663
- </IconButton>
664
- </Badge>
665
- <Typography variant="caption" display="block">
666
- Bounce
667
- </Typography>
668
- </Box>
669
- <Box textAlign="center">
670
- <Badge badgeContent={3} color="error" pulse>
671
- <IconButton>
672
- <Notifications />
673
- </IconButton>
674
- </Badge>
675
- <Typography variant="caption" display="block">
676
- Pulse
677
- </Typography>
678
- </Box>
679
- <Box textAlign="center">
680
- <Badge badgeContent="HOT" color="warning" glow>
681
- <IconButton>
682
- <Star />
683
- </IconButton>
684
- </Badge>
685
- <Typography variant="caption" display="block">
686
- Glow
687
- </Typography>
688
- </Box>
689
- <Box textAlign="center">
690
- <Badge badgeContent="VIP" color="secondary" shimmer variant="gradient">
691
- <IconButton>
692
- <Verified />
693
- </IconButton>
694
- </Badge>
695
- <Typography variant="caption" display="block">
696
- Shimmer
697
- </Typography>
698
- </Box>
699
- <Box textAlign="center">
700
- <Badge badgeContent="!" color="error" glow pulse>
701
- <IconButton>
702
- <Warning />
703
- </IconButton>
704
- </Badge>
705
- <Typography variant="caption" display="block">
706
- Glow + Pulse
707
- </Typography>
708
- </Box>
709
- </Stack>
710
- </Stack>
711
- ),
712
- };
713
-
714
- // New Feature: Closable Badges
715
- export const ClosableBadges: Story = {
716
- render: () => {
717
- const ClosableExample = () => {
718
- const [badges, setBadges] = useState([
719
- { id: 1, content: 'Tag 1' },
720
- { id: 2, content: 'Tag 2' },
721
- { id: 3, content: 'Tag 3' },
722
- ]);
723
-
724
- return (
725
- <Stack direction="row" spacing={2} alignItems="center">
726
- {badges.map((badge) => (
727
- <Badge
728
- key={badge.id}
729
- badgeContent={badge.content}
730
- closable
731
- onClose={() => setBadges(badges.filter((b) => b.id !== badge.id))}
732
- color="primary"
733
- variant="secondary"
734
- >
735
- <Box sx={{ width: 40, height: 40, bgcolor: 'grey.200', borderRadius: 1 }} />
736
- </Badge>
737
- ))}
738
- {badges.length === 0 && (
739
- <Button
740
- size="small"
741
- onClick={() =>
742
- setBadges([
743
- { id: 1, content: 'Tag 1' },
744
- { id: 2, content: 'Tag 2' },
745
- { id: 3, content: 'Tag 3' },
746
- ])
747
- }
748
- >
749
- Reset Tags
750
- </Button>
751
- )}
752
- </Stack>
753
- );
754
- };
755
-
756
- return <ClosableExample />;
757
- },
758
- parameters: {
759
- docs: {
760
- description: {
761
- story: 'Badges with close buttons that can be dismissed by users.',
762
- },
763
- },
764
- },
765
- };
766
-
767
- // New Feature: Badges with Icons
768
- export const BadgesWithIcons: Story = {
769
- render: () => (
770
- <Stack spacing={3}>
771
- <Typography variant="h6">Badges with Icons</Typography>
772
- <Stack direction="row" spacing={3} alignItems="center">
773
- <Badge
774
- icon={<CheckCircle sx={{ fontSize: 'inherit' }} />}
775
- badgeContent="Done"
776
- color="success"
777
- variant="success"
778
- >
779
- <Paper sx={{ p: 2 }}>Task 1</Paper>
780
- </Badge>
781
- <Badge
782
- icon={<Schedule sx={{ fontSize: 'inherit' }} />}
783
- badgeContent="Pending"
784
- color="warning"
785
- variant="warning"
786
- >
787
- <Paper sx={{ p: 2 }}>Task 2</Paper>
788
- </Badge>
789
- <Badge
790
- icon={<ErrorIcon sx={{ fontSize: 'inherit' }} />}
791
- badgeContent="Failed"
792
- color="error"
793
- variant="destructive"
794
- >
795
- <Paper sx={{ p: 2 }}>Task 3</Paper>
796
- </Badge>
797
- <Badge
798
- icon={<TrendingUp sx={{ fontSize: 'inherit' }} />}
799
- badgeContent="+25%"
800
- color="primary"
801
- variant="gradient"
802
- glow
803
- >
804
- <Paper sx={{ p: 2 }}>Stats</Paper>
805
- </Badge>
806
- </Stack>
807
- </Stack>
808
- ),
809
- };
810
-
811
- // New Feature: All Animation Combinations
812
- export const AnimationShowcase: Story = {
813
- render: () => (
814
- <Stack spacing={3}>
815
- <Typography variant="h6">Animation Showcase</Typography>
816
- <Stack direction="row" spacing={3} alignItems="center" flexWrap="wrap">
817
- <Badge badgeContent="Fade" animate color="primary">
818
- <Box sx={{ p: 2, bgcolor: 'grey.100', borderRadius: 1 }}>Fade In</Box>
819
- </Badge>
820
- <Badge badgeContent="Bounce" bounce color="secondary">
821
- <Box sx={{ p: 2, bgcolor: 'grey.100', borderRadius: 1 }}>Bounce</Box>
822
- </Badge>
823
- <Badge badgeContent="Pulse" pulse color="error">
824
- <Box sx={{ p: 2, bgcolor: 'grey.100', borderRadius: 1 }}>Pulse</Box>
825
- </Badge>
826
- <Badge badgeContent="Glow" glow color="warning">
827
- <Box sx={{ p: 2, bgcolor: 'grey.100', borderRadius: 1 }}>Glow</Box>
828
- </Badge>
829
- <Badge badgeContent="Shimmer" shimmer variant="gradient" color="success">
830
- <Box sx={{ p: 2, bgcolor: 'grey.100', borderRadius: 1 }}>Shimmer</Box>
831
- </Badge>
832
- <Badge badgeContent="All" bounce glow pulse shimmer variant="gradient" color="primary">
833
- <Box sx={{ p: 2, bgcolor: 'grey.100', borderRadius: 1 }}>All Effects</Box>
834
- </Badge>
835
- </Stack>
836
- </Stack>
837
- ),
838
- };
839
-
840
- // Accessibility Example
841
- export const AccessibilityExample: Story = {
842
- render: () => (
843
- <Stack spacing={3}>
844
- <Typography variant="h6">Accessible Badges</Typography>
845
- <Stack direction="row" spacing={3}>
846
- <Badge badgeContent={5} color="error" aria-label="5 new messages" aria-live="polite">
847
- <IconButton aria-label="Messages">
848
- <Mail />
849
- </IconButton>
850
- </Badge>
851
- <Badge variant="dot" color="success" aria-label="User is online" aria-live="polite">
852
- <Avatar aria-label="User avatar">U</Avatar>
853
- </Badge>
854
- <Badge
855
- badgeContent={99}
856
- max={99}
857
- color="warning"
858
- aria-label="99 items in cart"
859
- aria-live="polite"
860
- >
861
- <IconButton aria-label="Shopping cart">
862
- <ShoppingCart />
863
- </IconButton>
864
- </Badge>
865
- </Stack>
866
- <Paper sx={{ p: 2, bgcolor: 'grey.100' }}>
867
- <Typography variant="body2">
868
- <Info sx={{ fontSize: 16, verticalAlign: 'middle', mr: 1 }} />
869
- These badges include ARIA labels and live regions for screen reader support.
870
- </Typography>
871
- </Paper>
872
- </Stack>
873
- ),
874
- };
875
-
876
- // Required story exports for validation
877
- export const AllVariants: Story = {
878
- render: () => (
879
- <Stack spacing={4}>
880
- <Typography variant="h6">All Badge Variants</Typography>
881
- <Stack direction="row" spacing={3} flexWrap="wrap" alignItems="center">
882
- <Badge variant="default" badgeContent={4}>
883
- <Mail />
884
- </Badge>
885
- <Badge variant="dot" color="success">
886
- <Notifications />
887
- </Badge>
888
- <Badge variant="count" badgeContent={99} color="error">
889
- <ShoppingCart />
890
- </Badge>
891
- <Badge variant="gradient" badgeContent="PRO" color="warning">
892
- <Star />
893
- </Badge>
894
- <Badge variant="glass" badgeContent="5" color="primary">
895
- <Favorite />
896
- </Badge>
897
- <Badge variant="outline" badgeContent="NEW" color="primary">
898
- <NewReleases />
899
- </Badge>
900
- <Badge variant="secondary" badgeContent="12" color="secondary">
901
- <TrendingUp />
902
- </Badge>
903
- <Badge variant="destructive" badgeContent="!" color="error">
904
- <ErrorIcon />
905
- </Badge>
906
- <Badge variant="success" badgeContent="✓" color="success">
907
- <Verified />
908
- </Badge>
909
- <Badge variant="warning" badgeContent="⚠" color="warning">
910
- <Warning />
911
- </Badge>
912
- </Stack>
913
- </Stack>
914
- ),
915
- parameters: {
916
- docs: {
917
- description: {
918
- story: 'Showcases all available badge variants in one view.',
919
- },
920
- },
921
- },
922
- };
923
-
924
- export const AllSizes: Story = {
925
- render: () => (
926
- <Stack spacing={4}>
927
- <Typography variant="h6">All Badge Sizes</Typography>
928
- <Stack direction="row" spacing={3} alignItems="center">
929
- <Badge size="xs" badgeContent="XS" color="primary">
930
- <Mail />
931
- </Badge>
932
- <Badge size="sm" badgeContent="SM" color="primary">
933
- <Mail />
934
- </Badge>
935
- <Badge size="md" badgeContent="MD" color="primary">
936
- <Mail />
937
- </Badge>
938
- <Badge size="lg" badgeContent="LG" color="primary">
939
- <Mail />
940
- </Badge>
941
- </Stack>
942
- </Stack>
943
- ),
944
- parameters: {
945
- docs: {
946
- description: {
947
- story: 'Demonstrates all available badge sizes.',
948
- },
949
- },
950
- },
951
- };
952
-
953
- export const AllStates: Story = {
954
- render: () => (
955
- <Stack spacing={4}>
956
- <Typography variant="h6">All Badge States</Typography>
957
- <Stack spacing={2}>
958
- <Stack direction="row" spacing={3} alignItems="center">
959
- <Badge badgeContent="Default" color="primary">
960
- <Box sx={{ p: 2, bgcolor: 'grey.100', borderRadius: 1 }}>Default State</Box>
961
- </Badge>
962
- <Badge
963
- badgeContent="Hover"
964
- color="primary"
965
- sx={{ '&:hover': { transform: 'scale(1.05)' } }}
966
- >
967
- <Box sx={{ p: 2, bgcolor: 'grey.100', borderRadius: 1 }}>Hover State</Box>
968
- </Badge>
969
- </Stack>
970
- <Stack direction="row" spacing={3} alignItems="center">
971
- <Badge variant="dot" color="success" pulse>
972
- <Box sx={{ p: 2, bgcolor: 'grey.100', borderRadius: 1 }}>Active (Pulse)</Box>
973
- </Badge>
974
- <Badge badgeContent="Glow" color="error" glow>
975
- <Box sx={{ p: 2, bgcolor: 'grey.100', borderRadius: 1 }}>Glow Effect</Box>
976
- </Badge>
977
- </Stack>
978
- <Stack direction="row" spacing={3} alignItems="center">
979
- <Badge badgeContent={0} showZero={false}>
980
- <Box sx={{ p: 2, bgcolor: 'grey.100', borderRadius: 1 }}>Hidden (Zero)</Box>
981
- </Badge>
982
- <Badge badgeContent={0} showZero={true}>
983
- <Box sx={{ p: 2, bgcolor: 'grey.100', borderRadius: 1 }}>Visible (Zero)</Box>
984
- </Badge>
985
- </Stack>
986
- </Stack>
987
- </Stack>
988
- ),
989
- parameters: {
990
- docs: {
991
- description: {
992
- story: 'Shows all possible badge states including hover, active, and hidden states.',
993
- },
994
- },
995
- },
996
- };
997
-
998
- export const InteractiveStates: Story = {
999
- render: () => {
1000
- const InteractiveExample = () => {
1001
- const [count, setCount] = useState(0);
1002
- const [showBadge, setShowBadge] = useState(true);
1003
-
1004
- return (
1005
- <Stack spacing={4}>
1006
- <Typography variant="h6">Interactive Badge States</Typography>
1007
- <Stack direction="row" spacing={3} alignItems="center">
1008
- <Badge badgeContent={count} color="primary" invisible={!showBadge}>
1009
- <Mail />
1010
- </Badge>
1011
- <Button onClick={() => setCount(count + 1)} variant="outlined" size="small">
1012
- Increment
1013
- </Button>
1014
- <Button
1015
- onClick={() => setCount(Math.max(0, count - 1))}
1016
- variant="outlined"
1017
- size="small"
1018
- >
1019
- Decrement
1020
- </Button>
1021
- <Button onClick={() => setShowBadge(!showBadge)} variant="outlined" size="small">
1022
- {showBadge ? 'Hide' : 'Show'} Badge
1023
- </Button>
1024
- </Stack>
1025
- </Stack>
1026
- );
1027
- };
1028
-
1029
- return <InteractiveExample />;
1030
- },
1031
- parameters: {
1032
- docs: {
1033
- description: {
1034
- story: 'Interactive demonstration of badge state changes.',
1035
- },
1036
- },
1037
- },
1038
- };
1039
-
1040
- export const Responsive: Story = {
1041
- render: () => (
1042
- <Stack spacing={4}>
1043
- <Typography variant="h6">Responsive Badge Layout</Typography>
1044
- <Box
1045
- sx={{
1046
- display: 'grid',
1047
- gridTemplateColumns: {
1048
- xs: 'repeat(2, 1fr)',
1049
- sm: 'repeat(3, 1fr)',
1050
- md: 'repeat(4, 1fr)',
1051
- lg: 'repeat(6, 1fr)',
1052
- },
1053
- gap: 2,
1054
- }}
1055
- >
1056
- <Badge badgeContent="1" color="primary">
1057
- <Paper sx={{ p: 2, textAlign: 'center' }}>Item 1</Paper>
1058
- </Badge>
1059
- <Badge badgeContent="2" color="secondary">
1060
- <Paper sx={{ p: 2, textAlign: 'center' }}>Item 2</Paper>
1061
- </Badge>
1062
- <Badge badgeContent="3" color="success">
1063
- <Paper sx={{ p: 2, textAlign: 'center' }}>Item 3</Paper>
1064
- </Badge>
1065
- <Badge badgeContent="4" color="warning">
1066
- <Paper sx={{ p: 2, textAlign: 'center' }}>Item 4</Paper>
1067
- </Badge>
1068
- <Badge badgeContent="5" color="error">
1069
- <Paper sx={{ p: 2, textAlign: 'center' }}>Item 5</Paper>
1070
- </Badge>
1071
- <Badge badgeContent="6" color="neutral">
1072
- <Paper sx={{ p: 2, textAlign: 'center' }}>Item 6</Paper>
1073
- </Badge>
1074
- </Box>
1075
- <Paper sx={{ p: 2, bgcolor: 'grey.100' }}>
1076
- <Typography variant="body2">
1077
- <Info sx={{ fontSize: 16, verticalAlign: 'middle', mr: 1 }} />
1078
- This grid adjusts from 2 columns on mobile to 6 columns on large screens.
1079
- </Typography>
1080
- </Paper>
1081
- </Stack>
1082
- ),
1083
- parameters: {
1084
- viewport: { defaultViewport: 'responsive' },
1085
- docs: {
1086
- description: {
1087
- story: 'Responsive grid layout that adapts to different screen sizes.',
1088
- },
1089
- },
1090
- },
1091
- };
1092
-
1093
- // Edge Cases
1094
- export const EdgeCases: Story = {
1095
- render: () => (
1096
- <Stack spacing={3}>
1097
- <Typography variant="h6">Edge Cases</Typography>
1098
- <Stack direction="row" spacing={3} alignItems="center">
1099
- <Box textAlign="center">
1100
- <Badge badgeContent="VERYLONGTEXT" color="primary" size="sm">
1101
- <Mail />
1102
- </Badge>
1103
- <Typography variant="caption" display="block" mt={1}>
1104
- Long Text
1105
- </Typography>
1106
- </Box>
1107
- <Box textAlign="center">
1108
- <Badge badgeContent={999999} max={9999} color="error">
1109
- <Notifications />
1110
- </Badge>
1111
- <Typography variant="caption" display="block" mt={1}>
1112
- Large Number
1113
- </Typography>
1114
- </Box>
1115
- <Box textAlign="center">
1116
- <Badge badgeContent="🔥" color="warning" variant="gradient">
1117
- <Star />
1118
- </Badge>
1119
- <Typography variant="caption" display="block" mt={1}>
1120
- Emoji
1121
- </Typography>
1122
- </Box>
1123
- <Box textAlign="center">
1124
- <Badge badgeContent="" color="primary">
1125
- <ShoppingCart />
1126
- </Badge>
1127
- <Typography variant="caption" display="block" mt={1}>
1128
- Empty Content
1129
- </Typography>
1130
- </Box>
1131
- </Stack>
1132
- </Stack>
1133
- ),
1134
- };