@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,651 +0,0 @@
1
- import { Box, Chip, List, ListItem, ListItemText, Paper, Typography } from '@mui/material';
2
- import type { Meta, StoryObj } from '@storybook/react-vite';
3
- import React, { useCallback, useMemo, useState } from 'react';
4
-
5
- import { ScrollArea } from './ScrollArea';
6
-
7
- const meta: Meta<typeof ScrollArea> = {
8
- title: 'Layout/ScrollArea',
9
- component: ScrollArea,
10
- parameters: {
11
- layout: 'centered',
12
- docs: {
13
- description: {
14
- component:
15
- 'A custom scrollable area component with styled scrollbars and smooth scrolling behavior.',
16
- },
17
- },
18
- },
19
- tags: ['autodocs', 'component:ScrollArea'],
20
- argTypes: {
21
- width: {
22
- control: 'text',
23
- description: 'Width of the scroll area container',
24
- },
25
- height: {
26
- control: 'text',
27
- description: 'Height of the scroll area container',
28
- },
29
- maxHeight: {
30
- control: 'text',
31
- description: 'Maximum height before scrolling is enabled',
32
- },
33
- orientation: {
34
- control: 'select',
35
- options: ['vertical', 'horizontal', 'both'],
36
- description: 'Scroll orientation',
37
- },
38
- scrollbarSize: {
39
- control: 'select',
40
- options: ['thin', 'medium', 'thick'],
41
- description: 'Size of the scrollbar',
42
- },
43
- autoHide: {
44
- control: 'boolean',
45
- description: 'Whether scrollbars auto-hide when not in use',
46
- },
47
- smoothScroll: {
48
- control: 'boolean',
49
- description: 'Enable smooth scrolling behavior',
50
- },
51
- variant: {
52
- control: 'select',
53
- options: ['default', 'overlay', 'glass'],
54
- description: 'Visual variant of the scroll area',
55
- },
56
- scrollToTopButton: {
57
- control: 'boolean',
58
- description: 'Show scroll-to-top button',
59
- },
60
- disabled: {
61
- control: 'boolean',
62
- description: 'Disable scrolling',
63
- },
64
- loading: {
65
- control: 'boolean',
66
- description: 'Loading state',
67
- },
68
- },
69
- };
70
-
71
- export default meta;
72
- type Story = StoryObj<typeof meta>;
73
-
74
- // Helper component to generate scrollable content
75
- const ScrollableContent = ({ lines = 30 }: { lines?: number }) => (
76
- <Box sx={{ p: 2 }}>
77
- {Array.from({ length: lines }, (_, i) => (
78
- <Typography key={i} paragraph>
79
- Line {i + 1}: This is a sample text line to demonstrate scrolling functionality. Lorem ipsum
80
- dolor sit amet, consectetur adipiscing elit.
81
- </Typography>
82
- ))}
83
- </Box>
84
- );
85
-
86
- // Helper component for list content
87
- const ListContent = ({ items = 50 }: { items?: number }) => (
88
- <List>
89
- {Array.from({ length: items }, (_, i) => (
90
- <ListItem key={i} divider>
91
- <ListItemText primary={`Item ${i + 1}`} secondary={`Description for item ${i + 1}`} />
92
- </ListItem>
93
- ))}
94
- </List>
95
- );
96
-
97
- export const Default: Story = {
98
- args: {
99
- width: 400,
100
- height: 300,
101
- children: <ScrollableContent />,
102
- },
103
- };
104
-
105
- export const VerticalScroll: Story = {
106
- args: {
107
- width: 400,
108
- height: 300,
109
- orientation: 'vertical',
110
- children: <ScrollableContent lines={50} />,
111
- },
112
- };
113
-
114
- export const HorizontalScroll: Story = {
115
- args: {
116
- width: 400,
117
- height: 200,
118
- orientation: 'horizontal',
119
- children: (
120
- <Box sx={{ display: 'flex', gap: 2, p: 2, width: 'max-content' }}>
121
- {Array.from({ length: 20 }, (_, i) => (
122
- <Paper key={i} sx={{ p: 2, minWidth: 150 }}>
123
- <Typography>Card {i + 1}</Typography>
124
- </Paper>
125
- ))}
126
- </Box>
127
- ),
128
- },
129
- };
130
-
131
- export const BothDirections: Story = {
132
- args: {
133
- width: 400,
134
- height: 300,
135
- orientation: 'both',
136
- children: (
137
- <Box sx={{ width: 800, p: 2 }}>
138
- <ScrollableContent lines={50} />
139
- </Box>
140
- ),
141
- },
142
- };
143
-
144
- export const ThinScrollbar: Story = {
145
- args: {
146
- width: 400,
147
- height: 300,
148
- scrollbarSize: 'thin',
149
- children: <ScrollableContent />,
150
- },
151
- };
152
-
153
- export const ThickScrollbar: Story = {
154
- args: {
155
- width: 400,
156
- height: 300,
157
- scrollbarSize: 'thick',
158
- children: <ScrollableContent />,
159
- },
160
- };
161
-
162
- export const AutoHideDisabled: Story = {
163
- args: {
164
- width: 400,
165
- height: 300,
166
- autoHide: false,
167
- alwaysShowScrollbar: true,
168
- children: <ScrollableContent />,
169
- },
170
- };
171
-
172
- export const SmoothScrollDisabled: Story = {
173
- args: {
174
- width: 400,
175
- height: 300,
176
- smoothScroll: false,
177
- children: <ScrollableContent />,
178
- },
179
- };
180
-
181
- export const OverlayVariant: Story = {
182
- args: {
183
- width: 400,
184
- height: 300,
185
- variant: 'overlay',
186
- children: <ScrollableContent />,
187
- },
188
- };
189
-
190
- export const GlassVariant: Story = {
191
- args: {
192
- width: 400,
193
- height: 300,
194
- variant: 'glass',
195
- children: <ScrollableContent />,
196
- },
197
- decorators: [
198
- (Story) => (
199
- <Box
200
- sx={{
201
- background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',
202
- p: 4,
203
- borderRadius: 2,
204
- }}
205
- >
206
- <Story />
207
- </Box>
208
- ),
209
- ],
210
- };
211
-
212
- export const WithScrollToTop: Story = {
213
- args: {
214
- width: 400,
215
- height: 300,
216
- scrollToTopButton: true,
217
- scrollToTopThreshold: 50,
218
- children: <ScrollableContent lines={100} />,
219
- },
220
- };
221
-
222
- export const CustomColors: Story = {
223
- args: {
224
- width: 400,
225
- height: 300,
226
- scrollbarColor: '#ff6b6b',
227
- scrollbarTrackColor: '#ffe0e0',
228
- children: <ScrollableContent />,
229
- },
230
- };
231
-
232
- export const WithPadding: Story = {
233
- args: {
234
- width: 400,
235
- height: 300,
236
- contentPadding: 3,
237
- children: <ScrollableContent />,
238
- },
239
- };
240
-
241
- export const MaxHeightExample: Story = {
242
- args: {
243
- width: 400,
244
- maxHeight: 300,
245
- children: <ScrollableContent lines={5} />,
246
- },
247
- };
248
-
249
- export const DisabledState: Story = {
250
- args: {
251
- width: 400,
252
- height: 300,
253
- disabled: true,
254
- children: <ScrollableContent />,
255
- },
256
- };
257
-
258
- export const LoadingState: Story = {
259
- args: {
260
- width: 400,
261
- height: 300,
262
- loading: true,
263
- children: <ScrollableContent />,
264
- },
265
- };
266
-
267
- export const EmptyState: Story = {
268
- args: {
269
- width: 400,
270
- height: 300,
271
- emptyContent: (
272
- <Box sx={{ textAlign: 'center' }}>
273
- <Typography variant="h6" color="text.secondary">
274
- No content available
275
- </Typography>
276
- <Typography variant="body2" color="text.secondary" sx={{ mt: 1 }}>
277
- There is no data to display
278
- </Typography>
279
- </Box>
280
- ),
281
- },
282
- };
283
-
284
- export const WithListContent: Story = {
285
- args: {
286
- width: 400,
287
- height: 400,
288
- scrollToTopButton: true,
289
- children: <ListContent />,
290
- },
291
- };
292
-
293
- export const ResponsiveWidth: Story = {
294
- args: {
295
- width: '100%',
296
- maxWidth: 600,
297
- height: 300,
298
- children: <ScrollableContent />,
299
- },
300
- };
301
-
302
- export const NestedScrollAreas: Story = {
303
- args: {
304
- width: 600,
305
- height: 400,
306
- children: (
307
- <Box sx={{ p: 2 }}>
308
- <Typography variant="h6" gutterBottom>
309
- Parent Scroll Area
310
- </Typography>
311
- <Box sx={{ display: 'flex', gap: 2, mt: 2 }}>
312
- <Paper sx={{ flex: 1 }}>
313
- <ScrollArea height={200} variant="overlay">
314
- <Box sx={{ p: 2 }}>
315
- <Typography variant="subtitle1" gutterBottom>
316
- Nested Area 1
317
- </Typography>
318
- <ScrollableContent lines={20} />
319
- </Box>
320
- </ScrollArea>
321
- </Paper>
322
- <Paper sx={{ flex: 1 }}>
323
- <ScrollArea height={200} variant="overlay">
324
- <Box sx={{ p: 2 }}>
325
- <Typography variant="subtitle1" gutterBottom>
326
- Nested Area 2
327
- </Typography>
328
- <ScrollableContent lines={20} />
329
- </Box>
330
- </ScrollArea>
331
- </Paper>
332
- </Box>
333
- <Box sx={{ mt: 2 }}>
334
- <ScrollableContent lines={10} />
335
- </Box>
336
- </Box>
337
- ),
338
- },
339
- };
340
-
341
- export const WithChips: Story = {
342
- args: {
343
- width: 400,
344
- height: 100,
345
- orientation: 'horizontal',
346
- scrollbarSize: 'thin',
347
- children: (
348
- <Box sx={{ display: 'flex', gap: 1, p: 2, width: 'max-content' }}>
349
- {Array.from({ length: 30 }, (_, i) => (
350
- <Chip key={i} label={`Tag ${i + 1}`} color="primary" variant="outlined" />
351
- ))}
352
- </Box>
353
- ),
354
- },
355
- };
356
-
357
- // Required story exports for validation
358
- export const AllVariants: Story = {
359
- render: () => (
360
- <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}>
361
- <Typography variant="h6">All ScrollArea Variants</Typography>
362
-
363
- <Box sx={{ display: 'flex', gap: 2 }}>
364
- <Box>
365
- <Typography variant="caption" color="text.secondary">Default</Typography>
366
- <ScrollArea width={300} height={200} variant="default">
367
- <ScrollableContent lines={20} />
368
- </ScrollArea>
369
- </Box>
370
-
371
- <Box>
372
- <Typography variant="caption" color="text.secondary">Overlay</Typography>
373
- <ScrollArea width={300} height={200} variant="overlay">
374
- <ScrollableContent lines={20} />
375
- </ScrollArea>
376
- </Box>
377
-
378
- <Box>
379
- <Typography variant="caption" color="text.secondary">Glass</Typography>
380
- <Box sx={{ background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)', p: 2, borderRadius: 1 }}>
381
- <ScrollArea width={300} height={200} variant="glass">
382
- <ScrollableContent lines={20} />
383
- </ScrollArea>
384
- </Box>
385
- </Box>
386
- </Box>
387
- </Box>
388
- ),
389
- };
390
-
391
- export const AllSizes: Story = {
392
- render: () => (
393
- <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}>
394
- <Typography variant="h6">All ScrollArea Sizes</Typography>
395
-
396
- <Box sx={{ display: 'flex', gap: 2, alignItems: 'flex-start' }}>
397
- <Box>
398
- <Typography variant="caption" color="text.secondary">Small (200x150)</Typography>
399
- <ScrollArea width={200} height={150}>
400
- <ScrollableContent lines={15} />
401
- </ScrollArea>
402
- </Box>
403
-
404
- <Box>
405
- <Typography variant="caption" color="text.secondary">Medium (400x300)</Typography>
406
- <ScrollArea width={400} height={300}>
407
- <ScrollableContent lines={25} />
408
- </ScrollArea>
409
- </Box>
410
-
411
- <Box>
412
- <Typography variant="caption" color="text.secondary">Large (600x400)</Typography>
413
- <ScrollArea width={600} height={400}>
414
- <ScrollableContent lines={35} />
415
- </ScrollArea>
416
- </Box>
417
- </Box>
418
- </Box>
419
- ),
420
- };
421
-
422
- export const AllStates: Story = {
423
- render: () => (
424
- <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}>
425
- <Typography variant="h6">All ScrollArea States</Typography>
426
-
427
- <Box sx={{ display: 'flex', gap: 2 }}>
428
- <Box>
429
- <Typography variant="caption" color="text.secondary">Normal</Typography>
430
- <ScrollArea width={300} height={200}>
431
- <ScrollableContent lines={20} />
432
- </ScrollArea>
433
- </Box>
434
-
435
- <Box>
436
- <Typography variant="caption" color="text.secondary">Disabled</Typography>
437
- <ScrollArea width={300} height={200} disabled>
438
- <ScrollableContent lines={20} />
439
- </ScrollArea>
440
- </Box>
441
-
442
- <Box>
443
- <Typography variant="caption" color="text.secondary">Loading</Typography>
444
- <ScrollArea width={300} height={200} loading>
445
- <ScrollableContent lines={20} />
446
- </ScrollArea>
447
- </Box>
448
-
449
- <Box>
450
- <Typography variant="caption" color="text.secondary">Empty</Typography>
451
- <ScrollArea
452
- width={300}
453
- height={200}
454
- emptyContent={
455
- <Box sx={{ textAlign: 'center', p: 3 }}>
456
- <Typography color="text.secondary">No content</Typography>
457
- </Box>
458
- }
459
- />
460
- </Box>
461
- </Box>
462
- </Box>
463
- ),
464
- };
465
-
466
- export const InteractiveStates: Story = {
467
- render: () => (
468
- <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}>
469
- <Typography variant="h6">Interactive ScrollArea States</Typography>
470
-
471
- <Box sx={{ display: 'flex', gap: 2 }}>
472
- <Box>
473
- <Typography variant="caption" color="text.secondary">Hover (Auto-hide scrollbar)</Typography>
474
- <ScrollArea width={300} height={200} autoHide>
475
- <ScrollableContent lines={20} />
476
- </ScrollArea>
477
- </Box>
478
-
479
- <Box>
480
- <Typography variant="caption" color="text.secondary">Active (Scrolling)</Typography>
481
- <ScrollArea width={300} height={200} smoothScroll>
482
- <ScrollableContent lines={20} />
483
- </ScrollArea>
484
- </Box>
485
-
486
- <Box>
487
- <Typography variant="caption" color="text.secondary">With Scroll-to-Top</Typography>
488
- <ScrollArea width={300} height={200} scrollToTopButton scrollToTopThreshold={50}>
489
- <ScrollableContent lines={30} />
490
- </ScrollArea>
491
- </Box>
492
- </Box>
493
- </Box>
494
- ),
495
- };
496
-
497
- export const Responsive: Story = {
498
- parameters: {
499
- viewport: { defaultViewport: 'responsive' },
500
- },
501
- render: () => (
502
- <Box sx={{ width: '100%', p: 2 }}>
503
- <Typography variant="h6" gutterBottom>Responsive ScrollArea</Typography>
504
-
505
- <Box sx={{ display: 'flex', flexDirection: { xs: 'column', md: 'row' }, gap: 2 }}>
506
- <Box sx={{ flex: 1 }}>
507
- <Typography variant="caption" color="text.secondary">100% width, max 500px</Typography>
508
- <ScrollArea width="100%" maxWidth={500} height={300}>
509
- <ScrollableContent lines={25} />
510
- </ScrollArea>
511
- </Box>
512
-
513
- <Box sx={{ flex: 1 }}>
514
- <Typography variant="caption" color="text.secondary">Responsive height</Typography>
515
- <ScrollArea
516
- width="100%"
517
- height={{ xs: 200, sm: 300, md: 400 }}
518
- sx={{ bgcolor: 'background.paper' }}
519
- >
520
- <ScrollableContent lines={30} />
521
- </ScrollArea>
522
- </Box>
523
- </Box>
524
- </Box>
525
- ),
526
- };
527
-
528
- // Virtualized grid component that uses ScrollArea
529
- interface VirtualizedGridInScrollAreaProps {
530
- totalItems: number;
531
- squareSize: number;
532
- gap: number;
533
- columnCount: number;
534
- visibleRows: number;
535
- }
536
-
537
- const VirtualizedGridInScrollArea: React.FC<VirtualizedGridInScrollAreaProps> = ({
538
- totalItems,
539
- squareSize,
540
- gap,
541
- columnCount,
542
- visibleRows,
543
- }) => {
544
- const [scrollTop, setScrollTop] = useState(0);
545
-
546
- const rowHeight = squareSize + gap;
547
- const totalRows = Math.ceil(totalItems / columnCount);
548
- const totalHeight = totalRows * squareSize + Math.max(0, totalRows - 1) * gap;
549
- const visibleHeight = visibleRows * squareSize + Math.max(0, visibleRows - 1) * gap;
550
- const containerWidth = columnCount * squareSize + (columnCount - 1) * gap;
551
-
552
- // Calculate visible rows with buffer
553
- const bufferRows = 2;
554
- const startRow = Math.max(0, Math.floor(scrollTop / rowHeight) - bufferRows);
555
- const endRow = Math.min(totalRows, Math.ceil((scrollTop + visibleHeight) / rowHeight) + bufferRows);
556
-
557
- const visibleSquares = useMemo(() => {
558
- const squares = [];
559
- for (let row = startRow; row < endRow; row++) {
560
- for (let col = 0; col < columnCount; col++) {
561
- const index = row * columnCount + col;
562
- if (index >= totalItems) break;
563
- squares.push({ index, row, col, number: index + 1 });
564
- }
565
- }
566
- return squares;
567
- }, [startRow, endRow, columnCount, totalItems]);
568
-
569
- const handleScroll = useCallback((event: React.UIEvent<HTMLDivElement>) => {
570
- setScrollTop(event.currentTarget.scrollTop);
571
- }, []);
572
-
573
- return (
574
- <ScrollArea
575
- width={containerWidth + 20}
576
- height={visibleHeight}
577
- autoHide
578
- autoHideDelay={800}
579
- onScroll={handleScroll}
580
- >
581
- <Box sx={{ position: 'relative', width: containerWidth, height: totalHeight }}>
582
- {visibleSquares.map(({ index, row, col, number }) => (
583
- <Box
584
- key={index}
585
- sx={{
586
- position: 'absolute',
587
- top: row * rowHeight,
588
- left: col * (squareSize + gap),
589
- width: squareSize,
590
- height: squareSize,
591
- bgcolor: 'primary.main',
592
- color: 'primary.contrastText',
593
- display: 'flex',
594
- alignItems: 'center',
595
- justifyContent: 'center',
596
- fontSize: '12px',
597
- fontWeight: 'bold',
598
- borderRadius: 1,
599
- boxShadow: 1,
600
- }}
601
- >
602
- {number}
603
- </Box>
604
- ))}
605
- </Box>
606
- </ScrollArea>
607
- );
608
- };
609
-
610
- export const NumberedSquaresGrid: Story = {
611
- parameters: {
612
- docs: {
613
- description: {
614
- story:
615
- 'A virtualized grid of 100,000 numbered squares (50x50px each with 5px gap) ' +
616
- 'inside ScrollArea. Demonstrates autoHide scrollbar with large datasets.',
617
- },
618
- },
619
- },
620
- render: () => {
621
- const GAP = 5;
622
- const SQUARE_SIZE = 50;
623
- const TOTAL_SQUARES = 100000;
624
- const COLUMN_COUNT = 9;
625
- const VISIBLE_ROWS = 3;
626
-
627
- return (
628
- <Box sx={{ p: 2 }}>
629
- <Typography variant="h6" gutterBottom>
630
- Numbered Squares Grid (100,000 items)
631
- </Typography>
632
- <Typography variant="body2" color="text.secondary" sx={{ mb: 2 }}>
633
- 50x50px squares with 5px gap. Scroll to see the autoHide scrollbar in action.
634
- </Typography>
635
- <Box sx={{ border: '1px solid', borderColor: 'divider', borderRadius: 1, p: 1 }}>
636
- <VirtualizedGridInScrollArea
637
- totalItems={TOTAL_SQUARES}
638
- squareSize={SQUARE_SIZE}
639
- gap={GAP}
640
- columnCount={COLUMN_COUNT}
641
- visibleRows={VISIBLE_ROWS}
642
- />
643
- </Box>
644
- <Typography variant="caption" color="text.secondary" sx={{ mt: 1, display: 'block' }}>
645
- Total items: {TOTAL_SQUARES.toLocaleString()} | Columns: {COLUMN_COUNT} | Gap: {GAP}px
646
- </Typography>
647
- </Box>
648
- );
649
- },
650
- };
651
-