@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,387 +0,0 @@
1
- import type { SxProps, Theme } from '@mui/material';
2
- import { Box, Stack, Typography } from '@mui/material';
3
- import BrokenImageIcon from '@mui/icons-material/BrokenImage';
4
- import { LazyImage } from './LazyImage';
5
- import type { Meta, StoryObj } from '@storybook/react-vite';
6
-
7
- const meta: Meta<typeof LazyImage> = {
8
- title: 'DataDisplay/LazyImage',
9
- component: LazyImage,
10
- parameters: {
11
- layout: 'padded',
12
- docs: {
13
- description: {
14
- component: 'A high-performance image component with lazy loading, progressive enhancement, and error handling.',
15
- },
16
- },
17
- },
18
- tags: ['autodocs'],
19
- argTypes: {
20
- src: {
21
- control: 'text',
22
- description: 'Image source URL',
23
- },
24
- alt: {
25
- control: 'text',
26
- description: 'Alternative text for accessibility',
27
- },
28
- width: {
29
- control: 'number',
30
- description: 'Image width',
31
- },
32
- height: {
33
- control: 'number',
34
- description: 'Image height',
35
- },
36
- loadingState: {
37
- control: 'select',
38
- options: ['skeleton', 'spinner', 'placeholder', 'none'],
39
- description: 'Type of loading indicator',
40
- },
41
- objectFit: {
42
- control: 'select',
43
- options: ['fill', 'contain', 'cover', 'none', 'scale-down'],
44
- description: 'Object fit CSS property',
45
- },
46
- lazy: {
47
- control: 'boolean',
48
- description: 'Enable lazy loading',
49
- },
50
- fadeIn: {
51
- control: 'boolean',
52
- description: 'Enable fade-in animation',
53
- },
54
- borderRadius: {
55
- control: 'number',
56
- description: 'Border radius in pixels',
57
- },
58
- },
59
- };
60
-
61
- export default meta;
62
- type Story = StoryObj<typeof LazyImage>;
63
-
64
- // Sample images for stories
65
- const SAMPLE_IMAGE = 'https://picsum.photos/800/600?random=1';
66
- const SAMPLE_PLACEHOLDER = 'https://picsum.photos/80/60?random=1&blur=2';
67
- const INVALID_IMAGE = 'https://invalid-url-that-will-fail.com/image.jpg';
68
- const FALLBACK_IMAGE = 'https://via.placeholder.com/800x600/cccccc/666666?text=Fallback+Image';
69
-
70
- export const Default: Story = {
71
- args: {
72
- src: SAMPLE_IMAGE,
73
- alt: 'Sample image',
74
- width: 400,
75
- height: 300,
76
- },
77
- };
78
-
79
- export const WithSkeletonLoading: Story = {
80
- args: {
81
- src: `https://picsum.photos/600/400?random=${Date.now()}`,
82
- alt: 'Image with skeleton loading',
83
- width: 600,
84
- height: 400,
85
- loadingState: 'skeleton',
86
- skeletonProps: {
87
- animation: 'pulse',
88
- intensity: 'medium',
89
- },
90
- },
91
- };
92
-
93
- export const WithSpinnerLoading: Story = {
94
- args: {
95
- src: `https://picsum.photos/600/400?random=${Date.now() + 1}`,
96
- alt: 'Image with spinner loading',
97
- width: 600,
98
- height: 400,
99
- loadingState: 'spinner',
100
- spinnerProps: {
101
- size: 48,
102
- thickness: 4,
103
- },
104
- },
105
- };
106
-
107
- export const WithPlaceholder: Story = {
108
- args: {
109
- src: `https://picsum.photos/800/600?random=${Date.now() + 2}`,
110
- placeholder: SAMPLE_PLACEHOLDER,
111
- alt: 'Progressive loading with placeholder',
112
- width: 800,
113
- height: 600,
114
- loadingState: 'placeholder',
115
- },
116
- };
117
-
118
- export const WithErrorFallback: Story = {
119
- args: {
120
- src: INVALID_IMAGE,
121
- fallback: FALLBACK_IMAGE,
122
- alt: 'Image with fallback on error',
123
- width: 400,
124
- height: 300,
125
- retryOnError: true,
126
- maxRetries: 2,
127
- },
128
- };
129
-
130
- export const WithCustomFallback: Story = {
131
- args: {
132
- src: INVALID_IMAGE,
133
- fallback: (
134
- <Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 1 }}>
135
- <BrokenImageIcon sx={{ fontSize: 64, color: 'text.secondary' }} />
136
- <Typography variant="body2" color="text.secondary">
137
- Image not available
138
- </Typography>
139
- </Box>
140
- ),
141
- alt: 'Image with custom fallback component',
142
- width: 400,
143
- height: 300,
144
- },
145
- };
146
-
147
- export const CircularImage: Story = {
148
- args: {
149
- src: 'https://picsum.photos/200/200?random=3',
150
- alt: 'Circular avatar',
151
- width: 150,
152
- height: 150,
153
- borderRadius: '50%',
154
- objectFit: 'cover',
155
- },
156
- };
157
-
158
- export const RoundedCorners: Story = {
159
- args: {
160
- src: 'https://picsum.photos/600/400?random=4',
161
- alt: 'Rounded corners image',
162
- width: 600,
163
- height: 400,
164
- borderRadius: 16,
165
- loadingState: 'skeleton',
166
- skeletonProps: {
167
- animation: 'wave',
168
- },
169
- },
170
- };
171
-
172
- export const NoLazyLoading: Story = {
173
- args: {
174
- src: 'https://picsum.photos/800/400?random=5',
175
- alt: 'Eager loading image',
176
- width: 800,
177
- height: 400,
178
- lazy: false,
179
- fetchPriority: 'high',
180
- loading: 'eager',
181
- },
182
- };
183
-
184
- export const ObjectFitVariants: Story = {
185
- render: () => (
186
- <Stack spacing={3}>
187
- <Typography variant="h6">Object Fit Variants</Typography>
188
- <Box sx={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))', gap: 2 }}>
189
- {(['fill', 'contain', 'cover', 'none', 'scale-down'] as const).map((fit) => (
190
- <Box key={fit}>
191
- <Typography variant="caption" gutterBottom>
192
- {fit}
193
- </Typography>
194
- <Box sx={{ width: 200, height: 150, border: '1px solid', borderColor: 'divider' }}>
195
- <LazyImage
196
- src="https://picsum.photos/300/400?random=6"
197
- alt={`Object fit ${fit}`}
198
- width="100%"
199
- height="100%"
200
- objectFit={fit}
201
- fadeIn={false}
202
- />
203
- </Box>
204
- </Box>
205
- ))}
206
- </Box>
207
- </Stack>
208
- ),
209
- };
210
-
211
- export const LoadingStateComparison: Story = {
212
- render: () => {
213
- const uniqueId = Date.now();
214
- return (
215
- <Stack spacing={3}>
216
- <Typography variant="h6">Loading State Comparison</Typography>
217
- <Box sx={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))', gap: 3 }}>
218
- <Box>
219
- <Typography variant="subtitle2" gutterBottom>
220
- Skeleton Loading
221
- </Typography>
222
- <LazyImage
223
- src={`https://picsum.photos/250/200?random=${uniqueId + 1}&delay=2000`}
224
- alt="Skeleton loading"
225
- width={250}
226
- height={200}
227
- loadingState="skeleton"
228
- />
229
- </Box>
230
- <Box>
231
- <Typography variant="subtitle2" gutterBottom>
232
- Spinner Loading
233
- </Typography>
234
- <LazyImage
235
- src={`https://picsum.photos/250/200?random=${uniqueId + 2}&delay=2000`}
236
- alt="Spinner loading"
237
- width={250}
238
- height={200}
239
- loadingState="spinner"
240
- />
241
- </Box>
242
- <Box>
243
- <Typography variant="subtitle2" gutterBottom>
244
- Placeholder Loading
245
- </Typography>
246
- <LazyImage
247
- src={`https://picsum.photos/250/200?random=${uniqueId + 3}&delay=2000`}
248
- placeholder="https://picsum.photos/25/20?random=1&blur=2"
249
- alt="Placeholder loading"
250
- width={250}
251
- height={200}
252
- loadingState="placeholder"
253
- />
254
- </Box>
255
- <Box>
256
- <Typography variant="subtitle2" gutterBottom>
257
- No Loading Indicator
258
- </Typography>
259
- <LazyImage
260
- src={`https://picsum.photos/250/200?random=${uniqueId + 4}&delay=2000`}
261
- alt="No loading indicator"
262
- width={250}
263
- height={200}
264
- loadingState="none"
265
- />
266
- </Box>
267
- </Box>
268
- </Stack>
269
- );
270
- },
271
- };
272
-
273
- export const Gallery: Story = {
274
- render: () => (
275
- <Stack spacing={3}>
276
- <Typography variant="h6">Image Gallery with Lazy Loading</Typography>
277
- <Box
278
- sx={{
279
- display: 'grid',
280
- gridTemplateColumns: 'repeat(auto-fill, minmax(200px, 1fr))',
281
- gap: 2,
282
- }}
283
- >
284
- {Array.from({ length: 12 }).map((_, index) => (
285
- <LazyImage
286
- key={index}
287
- src={`https://picsum.photos/200/200?random=${index + 100}`}
288
- alt={`Gallery image ${index + 1}`}
289
- width="100%"
290
- height={200}
291
- objectFit="cover"
292
- borderRadius={8}
293
- loadingState="skeleton"
294
- skeletonProps={{
295
- animation: 'wave',
296
- intensity: 'low',
297
- }}
298
- />
299
- ))}
300
- </Box>
301
- <Typography variant="caption" color="text.secondary">
302
- Scroll down to see lazy loading in action
303
- </Typography>
304
- </Stack>
305
- ),
306
- };
307
-
308
- export const WithEventCallbacks: Story = {
309
- args: {
310
- src: 'https://picsum.photos/600/400?random=7',
311
- alt: 'Image with event callbacks',
312
- width: 600,
313
- height: 400,
314
- onLoadStart: () => {
315
- // eslint-disable-next-line no-console -- demo output for the Storybook docs page
316
- console.info('🚀 Started loading image');
317
- },
318
- onLoad: (event) => {
319
- // eslint-disable-next-line no-console -- demo output for the Storybook docs page
320
- console.info('✅ Image loaded successfully', event);
321
- },
322
- onError: (event) => {
323
- // eslint-disable-next-line no-console -- demo output for the Storybook docs page
324
- console.error('❌ Image failed to load', event);
325
- },
326
- },
327
- parameters: {
328
- docs: {
329
- description: {
330
- story: 'Open browser console to see event callbacks in action',
331
- },
332
- },
333
- },
334
- };
335
-
336
- export const ResponsiveImage: Story = {
337
- args: {
338
- src: 'https://picsum.photos/1200/800?random=8',
339
- alt: 'Responsive image',
340
- width: '100%',
341
- height: 'auto',
342
- sx: {
343
- maxWidth: '100%',
344
- height: 'auto',
345
- },
346
- },
347
- };
348
-
349
- const hoverSx: SxProps<Theme> = {
350
- transition: 'transform 0.3s, box-shadow 0.3s',
351
- cursor: 'pointer',
352
- '&:hover': {
353
- transform: 'scale(1.05)',
354
- boxShadow: '0 8px 24px rgba(0,0,0,0.15)',
355
- },
356
- };
357
-
358
- export const HoverEffects: Story = {
359
- args: {
360
- src: 'https://picsum.photos/400/300?random=9',
361
- alt: 'Image with hover effects',
362
- width: 400,
363
- height: 300,
364
- borderRadius: 12,
365
- sx: hoverSx,
366
- },
367
- };
368
-
369
- export const AccessibleImage: Story = {
370
- args: {
371
- src: 'https://picsum.photos/600/400?random=10',
372
- alt: 'A beautiful landscape photo showing mountains at sunset',
373
- 'aria-label': 'Scenic mountain landscape',
374
- 'aria-describedby': 'image-description',
375
- role: 'img',
376
- width: 600,
377
- height: 400,
378
- },
379
- render: (args) => (
380
- <Stack spacing={2}>
381
- <LazyImage {...args} />
382
- <Typography id="image-description" variant="caption">
383
- This image shows a stunning mountain landscape during golden hour, with peaks silhouetted against a colorful sky.
384
- </Typography>
385
- </Stack>
386
- ),
387
- };
@@ -1,315 +0,0 @@
1
- import { Box, Button, Typography } from '@mui/material';
2
- import type { Meta, StoryObj } from '@storybook/react-vite';
3
- import React, { useState } from 'react';
4
-
5
- import { Lightbox } from './Lightbox';
6
- import type { LightboxItem } from './Lightbox.types';
7
-
8
- const meta: Meta<typeof Lightbox> = {
9
- title: 'DataDisplay/Lightbox',
10
- component: Lightbox,
11
- parameters: {
12
- layout: 'centered',
13
- docs: {
14
- description: {
15
- component:
16
- 'A sophisticated lightbox component for showcasing media with advanced features like zoom, pan, autoplay, and filmstrip navigation.',
17
- },
18
- },
19
- },
20
- tags: ['autodocs', 'component:Lightbox'],
21
- };
22
-
23
- export default meta;
24
- export type Story = StoryObj<typeof meta>;
25
-
26
- // Sample images for stories
27
- const sampleImages: LightboxItem[] = [
28
- {
29
- src: 'https://picsum.photos/800/600?random=1',
30
- alt: 'Beautiful landscape',
31
- caption: 'A beautiful landscape captured during golden hour',
32
- },
33
- {
34
- src: 'https://picsum.photos/600/800?random=2',
35
- alt: 'City architecture',
36
- caption: 'Modern architecture in the city center',
37
- },
38
- {
39
- src: 'https://picsum.photos/900/600?random=3',
40
- alt: 'Nature scene',
41
- caption: 'Peaceful nature scene with trees and water',
42
- },
43
- {
44
- src: 'https://picsum.photos/700/700?random=4',
45
- alt: 'Abstract art',
46
- caption: 'Abstract composition with vibrant colors',
47
- },
48
- ];
49
-
50
- const mixedMediaItems: LightboxItem[] = [
51
- {
52
- src: 'https://picsum.photos/800/600?random=5',
53
- alt: 'Image 1',
54
- caption: 'First image in the gallery',
55
- type: 'image',
56
- },
57
- {
58
- src: 'https://sample-videos.com/zip/10/mp4/SampleVideo_1280x720_1mb.mp4',
59
- alt: 'Sample video',
60
- caption: 'Sample video content',
61
- type: 'video',
62
- },
63
- {
64
- src: 'https://picsum.photos/800/600?random=6',
65
- alt: 'Image 2',
66
- caption: 'Second image in the gallery',
67
- type: 'image',
68
- },
69
- ];
70
-
71
- // Wrapper component for stories
72
- interface LightboxWrapperProps {
73
- items: LightboxItem[];
74
- triggerText?: string;
75
- thumbnails?: boolean;
76
- autoplay?: boolean | { interval?: number };
77
- loop?: boolean;
78
- showControls?: boolean;
79
- showCaptions?: boolean;
80
- zoomable?: boolean;
81
- startIndex?: number;
82
- }
83
-
84
- const LightboxWrapper = ({
85
- items,
86
- triggerText = 'Open Lightbox',
87
- ...props
88
- }: LightboxWrapperProps) => {
89
- const [isOpen, setIsOpen] = useState(false);
90
-
91
- return (
92
- <Box sx={{ textAlign: 'center', padding: 4 }}>
93
- <Button variant="contained" onClick={() => setIsOpen(true)} sx={{ mb: 2 }}>
94
- {triggerText}
95
- </Button>
96
- <Typography variant="body2" color="text.secondary">
97
- Click the button to open the lightbox
98
- </Typography>
99
- <Lightbox isOpen={isOpen} onClose={() => setIsOpen(false)} items={items} {...props} />
100
- </Box>
101
- );
102
- };
103
-
104
- // Stories
105
- export const Default: Story = {
106
- render: () => <LightboxWrapper items={sampleImages} />,
107
- };
108
-
109
- export const SingleImage: Story = {
110
- render: () => <LightboxWrapper items={[sampleImages[0]]} triggerText="Open Single Image" />,
111
- };
112
-
113
- export const WithFilmstrip: Story = {
114
- render: () => (
115
- <LightboxWrapper items={sampleImages} thumbnails={true} triggerText="Open with Thumbnails" />
116
- ),
117
- };
118
-
119
- export const Autoplay: Story = {
120
- render: () => (
121
- <LightboxWrapper items={sampleImages} autoplay={true} triggerText="Open with Autoplay" />
122
- ),
123
- };
124
-
125
- export const CustomAutoplayInterval: Story = {
126
- render: () => (
127
- <LightboxWrapper
128
- items={sampleImages}
129
- autoplay={{ interval: 2000 }}
130
- triggerText="Open with Fast Autoplay"
131
- />
132
- ),
133
- };
134
-
135
- export const WithLoop: Story = {
136
- render: () => <LightboxWrapper items={sampleImages} loop={true} triggerText="Open with Loop" />,
137
- };
138
-
139
- export const NoControls: Story = {
140
- render: () => (
141
- <LightboxWrapper
142
- items={sampleImages}
143
- showControls={false}
144
- triggerText="Open without Controls"
145
- />
146
- ),
147
- };
148
-
149
- export const NoCaptions: Story = {
150
- render: () => (
151
- <LightboxWrapper
152
- items={sampleImages}
153
- showCaptions={false}
154
- triggerText="Open without Captions"
155
- />
156
- ),
157
- };
158
-
159
- export const MixedMedia: Story = {
160
- render: () => <LightboxWrapper items={mixedMediaItems} triggerText="Open Mixed Media Gallery" />,
161
- };
162
-
163
- export const NotZoomable: Story = {
164
- render: () => (
165
- <LightboxWrapper items={sampleImages} zoomable={false} triggerText="Open without Zoom" />
166
- ),
167
- };
168
-
169
- export const StartAtIndex: Story = {
170
- render: () => (
171
- <LightboxWrapper items={sampleImages} startIndex={2} triggerText="Start at Third Image" />
172
- ),
173
- };
174
-
175
- export const FullFeatured: Story = {
176
- render: () => (
177
- <LightboxWrapper
178
- items={sampleImages}
179
- thumbnails={true}
180
- autoplay={{ interval: 3000 }}
181
- loop={true}
182
- zoomable={true}
183
- showCaptions={true}
184
- showControls={true}
185
- triggerText="Open Full Featured"
186
- />
187
- ),
188
- };
189
-
190
- // Dark mode example
191
- export const DarkMode: Story = {
192
- parameters: {
193
- backgrounds: { default: 'dark' },
194
- },
195
- render: () => (
196
- <Box sx={{ bgcolor: 'grey.900', minHeight: '100vh', py: 4 }}>
197
- <LightboxWrapper items={sampleImages} thumbnails={true} triggerText="Open in Dark Mode" />
198
- </Box>
199
- ),
200
- };
201
-
202
- // Mobile responsive example
203
- export const MobileResponsive: Story = {
204
- parameters: {
205
- viewport: {
206
- defaultViewport: 'mobile1',
207
- },
208
- },
209
- render: () => (
210
- <LightboxWrapper items={sampleImages} thumbnails={true} triggerText="Open on Mobile" />
211
- ),
212
- };
213
-
214
- // Required story exports
215
- export const AllVariants: Story = {
216
- render: () => (
217
- <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2, p: 4 }}>
218
- <Typography variant="h6">All Variants</Typography>
219
- <LightboxWrapper items={sampleImages} triggerText="Default" />
220
- <LightboxWrapper items={sampleImages} thumbnails={true} triggerText="With Thumbnails" />
221
- <LightboxWrapper items={sampleImages} autoplay={true} triggerText="With Autoplay" />
222
- <LightboxWrapper items={sampleImages} loop={true} triggerText="With Loop" />
223
- <LightboxWrapper items={mixedMediaItems} triggerText="Mixed Media" />
224
- </Box>
225
- ),
226
- };
227
-
228
- export const AllSizes: Story = {
229
- render: () => (
230
- <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2, p: 4 }}>
231
- <Typography variant="h6">All Sizes (Gallery sizes)</Typography>
232
- <LightboxWrapper items={[sampleImages[0]]} triggerText="Single Item" />
233
- <LightboxWrapper items={sampleImages.slice(0, 2)} triggerText="Two Items" />
234
- <LightboxWrapper items={sampleImages} triggerText="Multiple Items" />
235
- <LightboxWrapper
236
- items={[...sampleImages, ...sampleImages, ...sampleImages]}
237
- thumbnails={true}
238
- triggerText="Large Gallery"
239
- />
240
- </Box>
241
- ),
242
- };
243
-
244
- export const AllStates: Story = {
245
- render: () => (
246
- <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2, p: 4 }}>
247
- <Typography variant="h6">All States</Typography>
248
- <LightboxWrapper items={sampleImages} triggerText="Normal State" />
249
- <LightboxWrapper items={[]} triggerText="Empty State" />
250
- <LightboxWrapper
251
- items={sampleImages}
252
- showControls={false}
253
- showCaptions={false}
254
- triggerText="Minimal State"
255
- />
256
- <LightboxWrapper
257
- items={sampleImages}
258
- thumbnails={true}
259
- autoplay={true}
260
- loop={true}
261
- triggerText="Full Featured State"
262
- />
263
- </Box>
264
- ),
265
- };
266
-
267
- export const InteractiveStates: Story = {
268
- render: () => (
269
- <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2, p: 4 }}>
270
- <Typography variant="h6">Interactive States</Typography>
271
- <Typography variant="body2" color="text.secondary">
272
- Open any lightbox to test navigation, zoom, and touch gestures
273
- </Typography>
274
- <LightboxWrapper items={sampleImages} zoomable={true} triggerText="Zoomable Images" />
275
- <LightboxWrapper
276
- items={sampleImages}
277
- showControls={true}
278
- loop={true}
279
- triggerText="With Navigation"
280
- />
281
- <LightboxWrapper
282
- items={sampleImages}
283
- thumbnails={true}
284
- triggerText="With Thumbnail Navigation"
285
- />
286
- </Box>
287
- ),
288
- };
289
-
290
- export const Responsive: Story = {
291
- parameters: {
292
- viewport: {
293
- viewports: {
294
- mobile: { name: 'Mobile', styles: { width: '320px', height: '568px' } },
295
- tablet: { name: 'Tablet', styles: { width: '768px', height: '1024px' } },
296
- desktop: { name: 'Desktop', styles: { width: '1200px', height: '800px' } },
297
- },
298
- },
299
- },
300
- render: () => (
301
- <Box sx={{ p: 2 }}>
302
- <Typography variant="h6" gutterBottom>
303
- Responsive Lightbox
304
- </Typography>
305
- <Typography variant="body2" color="text.secondary" paragraph>
306
- Resize viewport or use viewport controls to test responsiveness
307
- </Typography>
308
- <LightboxWrapper
309
- items={sampleImages}
310
- thumbnails={true}
311
- triggerText="Open Responsive Lightbox"
312
- />
313
- </Box>
314
- ),
315
- };