@12-apps/ui 1.4.1 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/package.json +17 -8
  2. package/src/button/index.ts +1 -0
  3. package/src/social-login-button/index.ts +1 -0
  4. package/src/{social-login-button.tsx → social-login-button/social-login-button.tsx} +5 -5
  5. package/src/user-avatar/index.ts +1 -0
  6. package/src/{user-avatar.tsx → user-avatar/user-avatar.tsx} +4 -4
  7. package/eslint.config.js +0 -77
  8. package/src/__tests__/data-grid.test.tsx +0 -125
  9. package/src/__tests__/package-wiring.test.ts +0 -41
  10. package/src/__tests__/setup.ts +0 -1
  11. package/src/__tests__/social-login-button.test.tsx +0 -186
  12. package/src/__tests__/user-avatar.test.tsx +0 -195
  13. package/src/__tests__/viewport.test.ts +0 -50
  14. package/src/components/command/__tests__/command.test.tsx +0 -112
  15. package/src/components/data-display/Alert/Alert.stories.tsx +0 -559
  16. package/src/components/data-display/Alert/Alert.test.stories.tsx +0 -707
  17. package/src/components/data-display/AlertDialog/AlertDialog.stories.tsx +0 -362
  18. package/src/components/data-display/AlertDialog/AlertDialog.test.stories.tsx +0 -753
  19. package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.stories.tsx +0 -230
  20. package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.test.stories.tsx +0 -270
  21. package/src/components/data-display/Avatar/Avatar.stories.tsx +0 -721
  22. package/src/components/data-display/Avatar/Avatar.test.stories.tsx +0 -822
  23. package/src/components/data-display/Badge/Badge.stories.tsx +0 -1134
  24. package/src/components/data-display/Badge/Badge.test.stories.tsx +0 -1194
  25. package/src/components/data-display/Banner/Banner.stories.tsx +0 -528
  26. package/src/components/data-display/Banner/Banner.test.stories.tsx +0 -503
  27. package/src/components/data-display/Carousel/Carousel.stories.tsx +0 -607
  28. package/src/components/data-display/Carousel/Carousel.test.stories.tsx +0 -691
  29. package/src/components/data-display/Chart/Chart.stories.tsx +0 -568
  30. package/src/components/data-display/Chart/Chart.test.stories.tsx +0 -174
  31. package/src/components/data-display/Chart/SpecChart.stories.tsx +0 -150
  32. package/src/components/data-display/Chart/SpecChart.test.stories.tsx +0 -56
  33. package/src/components/data-display/Chart/__tests__/SpecChart.test.tsx +0 -60
  34. package/src/components/data-display/Chart/__tests__/chart-format.test.ts +0 -43
  35. package/src/components/data-display/Chart/__tests__/chart-spec.test.ts +0 -119
  36. package/src/components/data-display/Chip/Chip.stories.tsx +0 -252
  37. package/src/components/data-display/Chip/Chip.test.stories.tsx +0 -266
  38. package/src/components/data-display/DataGrid/DataGrid.stories.tsx +0 -515
  39. package/src/components/data-display/DataGrid/DataGrid.test.stories.tsx +0 -653
  40. package/src/components/data-display/DataViews/__tests__/DataViewsGrid.test.tsx +0 -271
  41. package/src/components/data-display/DataViews/__tests__/DataViewsTableBase.test.tsx +0 -134
  42. package/src/components/data-display/DataViews/__tests__/SaveViewModal.test.tsx +0 -83
  43. package/src/components/data-display/DataViews/__tests__/data-views-filter.test.ts +0 -115
  44. package/src/components/data-display/DataViews/__tests__/data-views-preview.test.ts +0 -53
  45. package/src/components/data-display/DataViews/__tests__/range-pill.test.tsx +0 -114
  46. package/src/components/data-display/DataViews/base-card.stories.tsx +0 -136
  47. package/src/components/data-display/DescriptionItem/DescriptionItem.stories.tsx +0 -254
  48. package/src/components/data-display/EmptyState/EmptyState.stories.tsx +0 -282
  49. package/src/components/data-display/EmptyState/EmptyState.test.stories.tsx +0 -441
  50. package/src/components/data-display/ErrorState/ErrorState.stories.tsx +0 -110
  51. package/src/components/data-display/ErrorState/ErrorState.test.stories.tsx +0 -133
  52. package/src/components/data-display/HoverCard/HoverCard.stories.tsx +0 -650
  53. package/src/components/data-display/HoverCard/HoverCard.test.stories.tsx +0 -929
  54. package/src/components/data-display/InteractiveTooltip/InteractiveTooltip.stories.tsx +0 -411
  55. package/src/components/data-display/LazyImage/LazyImage.stories.tsx +0 -387
  56. package/src/components/data-display/Lightbox/Lightbox.stories.tsx +0 -315
  57. package/src/components/data-display/Lightbox/Lightbox.test.stories.tsx +0 -598
  58. package/src/components/data-display/LoadingState/LoadingState.stories.tsx +0 -124
  59. package/src/components/data-display/LoadingState/LoadingState.test.stories.tsx +0 -99
  60. package/src/components/data-display/MapPreview/MapPreview.stories.tsx +0 -458
  61. package/src/components/data-display/MapPreview/MapPreview.test.stories.tsx +0 -394
  62. package/src/components/data-display/Popover/Popover.stories.tsx +0 -295
  63. package/src/components/data-display/Popover/Popover.test.stories.tsx +0 -1162
  64. package/src/components/data-display/Progress/Progress.stories.tsx +0 -481
  65. package/src/components/data-display/Progress/Progress.test.stories.tsx +0 -2070
  66. package/src/components/data-display/SectionOnboarding/SectionOnboarding.stories.tsx +0 -160
  67. package/src/components/data-display/SectionOnboarding/SectionOnboarding.test.stories.tsx +0 -190
  68. package/src/components/data-display/Sheet/Sheet.stories.tsx +0 -883
  69. package/src/components/data-display/Sheet/Sheet.test.stories.tsx +0 -1101
  70. package/src/components/data-display/StatCard/StatCard.stories.tsx +0 -167
  71. package/src/components/data-display/StatCard/StatCard.test.stories.tsx +0 -240
  72. package/src/components/data-display/Stepper/Stepper.stories.tsx +0 -540
  73. package/src/components/data-display/Stepper/Stepper.test.stories.tsx +0 -600
  74. package/src/components/data-display/Table/Table.stories.tsx +0 -803
  75. package/src/components/data-display/Table/Table.test.stories.tsx +0 -369
  76. package/src/components/data-display/Timeline/Timeline.stories.tsx +0 -442
  77. package/src/components/data-display/Timeline/Timeline.test.stories.tsx +0 -930
  78. package/src/components/data-display/TimingDiagram/TimingDiagram.stories.tsx +0 -475
  79. package/src/components/data-display/TimingDiagram/TimingDiagram.test.stories.tsx +0 -734
  80. package/src/components/data-display/Tooltip/Tooltip.stories.tsx +0 -468
  81. package/src/components/data-display/Tooltip/Tooltip.test.stories.tsx +0 -1154
  82. package/src/components/feedback/ConfirmAction/ConfirmAction.stories.tsx +0 -146
  83. package/src/components/feedback/ConfirmAction/ConfirmAction.test.stories.tsx +0 -114
  84. package/src/components/feedback/ConfirmAction/__tests__/confirm-action.test.tsx +0 -288
  85. package/src/components/feedback/Dialog/Dialog.stories.tsx +0 -833
  86. package/src/components/feedback/Dialog/Dialog.test.stories.tsx +0 -955
  87. package/src/components/feedback/Dialog/__tests__/dialog-content-spacing.test.tsx +0 -66
  88. package/src/components/feedback/Modal/Modal.stories.tsx +0 -765
  89. package/src/components/feedback/Modal/Modal.test.stories.tsx +0 -251
  90. package/src/components/feedback/Sonner/Sonner.stories.tsx +0 -698
  91. package/src/components/feedback/Sonner/Sonner.test.stories.tsx +0 -896
  92. package/src/components/feedback/StackedModal/StackedModal.stories.tsx +0 -1783
  93. package/src/components/feedback/StackedModal/StackedModal.test.stories.tsx +0 -975
  94. package/src/components/feedback/StackedModal/__tests__/stacked-modal-viewport.test.tsx +0 -104
  95. package/src/components/feedback/Toast/Toast.stories.tsx +0 -548
  96. package/src/components/feedback/Toast/Toast.test.stories.tsx +0 -834
  97. package/src/components/feedback/TutorialOverlay/TutorialOverlay.stories.tsx +0 -691
  98. package/src/components/feedback/TutorialOverlay/TutorialOverlay.test.stories.tsx +0 -634
  99. package/src/components/form/AddressAutocomplete/AddressAutocomplete.stories.tsx +0 -665
  100. package/src/components/form/AddressAutocomplete/AddressAutocomplete.test.stories.tsx +0 -727
  101. package/src/components/form/Autocomplete/Autocomplete.stories.tsx +0 -715
  102. package/src/components/form/Autocomplete/Autocomplete.test.stories.tsx +0 -825
  103. package/src/components/form/Button/Button.stories.tsx +0 -365
  104. package/src/components/form/Button/Button.test.stories.tsx +0 -607
  105. package/src/components/form/Calendar/Calendar.stories.tsx +0 -349
  106. package/src/components/form/Calendar/Calendar.test.stories.tsx +0 -464
  107. package/src/components/form/CepField/CepField.stories.tsx +0 -138
  108. package/src/components/form/CepField/CepField.test.stories.tsx +0 -281
  109. package/src/components/form/Checkbox/Checkbox.stories.tsx +0 -265
  110. package/src/components/form/Checkbox/Checkbox.test.stories.tsx +0 -181
  111. package/src/components/form/CodeEditor/CodeEditor.stories.tsx +0 -871
  112. package/src/components/form/CodeEditor/CodeEditor.test.stories.tsx +0 -574
  113. package/src/components/form/Command/Command.stories.tsx +0 -580
  114. package/src/components/form/Command/Command.test.stories.tsx +0 -215
  115. package/src/components/form/CreatableSelect/CreatableSelect.stories.tsx +0 -112
  116. package/src/components/form/CreatableSelect/CreatableSelect.test.stories.tsx +0 -134
  117. package/src/components/form/Form/Form.stories.tsx +0 -687
  118. package/src/components/form/Form/Form.test.stories.tsx +0 -601
  119. package/src/components/form/Input/Input.stories.tsx +0 -260
  120. package/src/components/form/Input/Input.test.stories.tsx +0 -1191
  121. package/src/components/form/InputOTP/InputOTP.stories.tsx +0 -774
  122. package/src/components/form/InputOTP/InputOTP.test.stories.tsx +0 -588
  123. package/src/components/form/Label/Label.stories.tsx +0 -473
  124. package/src/components/form/Label/Label.test.stories.tsx +0 -909
  125. package/src/components/form/Menubar/Menubar.stories.tsx +0 -472
  126. package/src/components/form/Menubar/Menubar.test.stories.tsx +0 -584
  127. package/src/components/form/PasswordStrength/PasswordStrength.stories.tsx +0 -562
  128. package/src/components/form/PasswordStrength/PasswordStrength.test.stories.tsx +0 -327
  129. package/src/components/form/PhoneInput/PhoneInput.stories.tsx +0 -495
  130. package/src/components/form/PhoneInput/PhoneInput.test.stories.tsx +0 -666
  131. package/src/components/form/RadioGroup/RadioGroup.stories.tsx +0 -518
  132. package/src/components/form/RadioGroup/RadioGroup.test.stories.tsx +0 -685
  133. package/src/components/form/RichTextEditor/RichTextEditor.stories.tsx +0 -261
  134. package/src/components/form/RichTextEditor/RichTextEditor.test.stories.tsx +0 -491
  135. package/src/components/form/SearchPalette/SearchPalette.stories.tsx +0 -135
  136. package/src/components/form/Select/Select.stories.tsx +0 -364
  137. package/src/components/form/Select/Select.test.stories.tsx +0 -985
  138. package/src/components/form/Slider/Slider.stories.tsx +0 -418
  139. package/src/components/form/Slider/Slider.test.stories.tsx +0 -1042
  140. package/src/components/form/Switch/Switch.stories.tsx +0 -697
  141. package/src/components/form/Switch/Switch.test.stories.tsx +0 -597
  142. package/src/components/form/Textarea/Textarea.stories.tsx +0 -473
  143. package/src/components/form/Textarea/Textarea.test.stories.tsx +0 -702
  144. package/src/components/form/Toggle/Toggle.stories.tsx +0 -638
  145. package/src/components/form/Toggle/Toggle.test.stories.tsx +0 -1159
  146. package/src/components/form/ToggleGroup/ToggleGroup.stories.tsx +0 -617
  147. package/src/components/form/ToggleGroup/ToggleGroup.test.stories.tsx +0 -918
  148. package/src/components/form/UploadButton/UploadButton.stories.tsx +0 -367
  149. package/src/components/form/UploadButton/UploadButton.test.stories.tsx +0 -573
  150. package/src/components/form/total-form/total-form.test.tsx +0 -214
  151. package/src/components/layout/Accordion/Accordion.stories.tsx +0 -694
  152. package/src/components/layout/Accordion/Accordion.test.stories.tsx +0 -1344
  153. package/src/components/layout/Card/Card.stories.tsx +0 -591
  154. package/src/components/layout/Card/Card.test.stories.tsx +0 -1134
  155. package/src/components/layout/CardGrid/__tests__/CardGrid.test.tsx +0 -92
  156. package/src/components/layout/Collapsible/Collapsible.stories.tsx +0 -180
  157. package/src/components/layout/Collapsible/Collapsible.test.stories.tsx +0 -308
  158. package/src/components/layout/Container/Container.stories.tsx +0 -557
  159. package/src/components/layout/Container/Container.test.stories.tsx +0 -745
  160. package/src/components/layout/ContentToolbar/ContentToolbar.stories.tsx +0 -129
  161. package/src/components/layout/ContentToolbar/ContentToolbar.test.stories.tsx +0 -251
  162. package/src/components/layout/ContentToolbar/__tests__/ColumnsMenu.test.tsx +0 -39
  163. package/src/components/layout/ContentToolbar/__tests__/MultiSelectDropdown.test.tsx +0 -131
  164. package/src/components/layout/ContentToolbar/__tests__/SavedViewsMenu.test.tsx +0 -99
  165. package/src/components/layout/Dashboard/Dashboard.stories.tsx +0 -104
  166. package/src/components/layout/Dashboard/Dashboard.test.stories.tsx +0 -190
  167. package/src/components/layout/Drawer/Drawer.stories.tsx +0 -658
  168. package/src/components/layout/Drawer/Drawer.test.stories.tsx +0 -1343
  169. package/src/components/layout/Resizable/Resizable.stories.tsx +0 -1039
  170. package/src/components/layout/Resizable/Resizable.test.stories.tsx +0 -750
  171. package/src/components/layout/ScrollArea/ScrollArea.stories.tsx +0 -651
  172. package/src/components/layout/ScrollArea/ScrollArea.test.stories.tsx +0 -619
  173. package/src/components/layout/Separator/Separator.stories.tsx +0 -563
  174. package/src/components/layout/Separator/Separator.test.stories.tsx +0 -518
  175. package/src/components/layout/SettingsLayout/SettingsLayout.stories.tsx +0 -192
  176. package/src/components/layout/SettingsLayout/SettingsLayout.test.stories.tsx +0 -175
  177. package/src/components/layout/Sidebar/Sidebar.stories.tsx +0 -609
  178. package/src/components/layout/Sidebar/Sidebar.test.stories.tsx +0 -1324
  179. package/src/components/layout/Skeleton/Skeleton.stories.tsx +0 -689
  180. package/src/components/layout/Skeleton/Skeleton.test.stories.tsx +0 -521
  181. package/src/components/layout/Spacer/Spacer.stories.tsx +0 -502
  182. package/src/components/layout/Spacer/Spacer.test.stories.tsx +0 -472
  183. package/src/components/layout/TableFilter/TableFilter.stories.tsx +0 -82
  184. package/src/components/layout/TableFilter/TableFilter.test.stories.tsx +0 -87
  185. package/src/components/navigation/Breadcrumbs/Breadcrumbs.stories.tsx +0 -638
  186. package/src/components/navigation/Breadcrumbs/Breadcrumbs.test.stories.tsx +0 -1008
  187. package/src/components/navigation/CommandPalette/CommandPalette.stories.tsx +0 -386
  188. package/src/components/navigation/CommandPalette/CommandPalette.test.stories.tsx +0 -435
  189. package/src/components/navigation/ContextMenu/ContextMenu.stories.tsx +0 -614
  190. package/src/components/navigation/ContextMenu/ContextMenu.test.stories.tsx +0 -845
  191. package/src/components/navigation/DropdownMenu/DropdownMenu.stories.tsx +0 -578
  192. package/src/components/navigation/DropdownMenu/DropdownMenu.test.stories.tsx +0 -660
  193. package/src/components/navigation/NavigationMenu/stories/NavigationMenu.stories.tsx +0 -516
  194. package/src/components/navigation/NavigationMenu/stories/NavigationMenu.test.stories.tsx +0 -935
  195. package/src/components/navigation/NavigationMenu/stories/NavigationMenuHorizontal.stories.tsx +0 -501
  196. package/src/components/navigation/NavigationMenu/stories/NavigationMenuVertical.stories.tsx +0 -453
  197. package/src/components/navigation/Pagination/Pagination.stories.tsx +0 -602
  198. package/src/components/navigation/Pagination/Pagination.test.stories.tsx +0 -520
  199. package/src/components/navigation/Tabs/Tabs.stories.tsx +0 -1004
  200. package/src/components/navigation/Tabs/Tabs.test.stories.tsx +0 -1225
  201. package/src/components/typography/Blockquote/Blockquote.stories.tsx +0 -359
  202. package/src/components/typography/Blockquote/Blockquote.test.stories.tsx +0 -432
  203. package/src/components/typography/Code/Code.stories.tsx +0 -686
  204. package/src/components/typography/Code/Code.test.stories.tsx +0 -703
  205. package/src/components/typography/Heading/Heading.stories.tsx +0 -451
  206. package/src/components/typography/Heading/Heading.test.stories.tsx +0 -830
  207. package/src/components/typography/Paragraph/Paragraph.stories.tsx +0 -280
  208. package/src/components/typography/Paragraph/Paragraph.test.stories.tsx +0 -231
  209. package/src/components/typography/Text/Text.stories.tsx +0 -359
  210. package/src/components/typography/Text/Text.test.stories.tsx +0 -762
  211. package/src/components/utility/AnimatedIcon/AnimatedIcon.stories.tsx +0 -945
  212. package/src/components/utility/AnimatedIcon/AnimatedIcon.test.stories.tsx +0 -603
  213. package/src/components/utility/AspectRatio/AspectRatio.stories.tsx +0 -414
  214. package/src/components/utility/AspectRatio/AspectRatio.test.stories.tsx +0 -859
  215. package/src/components/utility/InfiniteScroll/InfiniteScroll.stories.tsx +0 -620
  216. package/src/components/utility/InfiniteScroll/InfiniteScroll.test.stories.tsx +0 -361
  217. package/src/components/utility/InstallPrompt/InstallPrompt.stories.tsx +0 -118
  218. package/src/components/utility/InstallPrompt/InstallPrompt.test.stories.tsx +0 -83
  219. package/src/components/utility/InstallPrompt/__tests__/InstallPrompt.ios.test.tsx +0 -65
  220. package/src/components/utility/InstallPrompt/__tests__/usePwaInstall.test.tsx +0 -271
  221. package/src/components/utility/Portal/Portal.stories.tsx +0 -340
  222. package/src/components/utility/Portal/Portal.test.stories.tsx +0 -2086
  223. package/src/components/utility/Transition/Transition.stories.tsx +0 -493
  224. package/src/components/utility/Transition/Transition.test.stories.tsx +0 -854
  225. package/src/components/utility/VirtualList/VirtualList.stories.tsx +0 -1073
  226. package/src/components/utility/VirtualList/VirtualList.test.stories.tsx +0 -1085
  227. package/src/components/utility/WorkflowStep/WorkflowStep.stories.tsx +0 -431
  228. package/src/components/utility/WorkflowStep/WorkflowStep.test.stories.tsx +0 -364
  229. /package/src/{button.tsx → button/button.tsx} +0 -0
@@ -1,472 +0,0 @@
1
- import { Box, Button, Typography } from '@mui/material';
2
- import type { Meta, StoryObj } from '@storybook/react-vite';
3
- import { expect,userEvent, within } from 'storybook/test';
4
-
5
- import { Spacer } from './Spacer';
6
-
7
- const meta: Meta<typeof Spacer> = {
8
- title: 'Layout/Spacer/Tests',
9
- component: Spacer,
10
- parameters: {
11
- layout: 'centered',
12
- chromatic: { disableSnapshot: false },
13
- },
14
- tags: ['autodocs', 'test'],
15
- };
16
-
17
- export default meta;
18
- type Story = StoryObj<typeof meta>;
19
-
20
- /**
21
- * Test 1: Basic Interaction
22
- * Tests basic rendering and DOM structure of the Spacer component
23
- */
24
- export const BasicInteraction: Story = {
25
- args: {
26
- size: 'md',
27
- },
28
- render: (args) => (
29
- <Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
30
- <Typography>Content Above</Typography>
31
- <Spacer {...args} data-testid="spacer" />
32
- <Typography>Content Below</Typography>
33
- </Box>
34
- ),
35
- play: async ({ canvasElement, step }) => {
36
- const canvas = within(canvasElement);
37
-
38
- await step('Verify spacer renders', async () => {
39
- const spacer = await canvas.findByTestId('spacer');
40
- await expect(spacer).toBeInTheDocument();
41
- });
42
-
43
- await step('Verify spacer creates spacing', async () => {
44
- const spacer = await canvas.findByTestId('spacer');
45
- const computedStyle = window.getComputedStyle(spacer);
46
- // md size should have both width and height
47
- await expect(parseInt(computedStyle.height)).toBeGreaterThan(0);
48
- });
49
-
50
- await step('Pass Test', async () => {
51
- const statusElement = document.createElement('div');
52
- statusElement.setAttribute('aria-label', 'Status of the test run');
53
- statusElement.textContent = 'PASS';
54
- document.body.appendChild(statusElement);
55
- });
56
- },
57
- };
58
-
59
- /**
60
- * Test 2: Keyboard Navigation
61
- * Tests that spacer doesn't interfere with keyboard navigation
62
- */
63
- export const KeyboardNavigation: Story = {
64
- render: () => (
65
- <Box sx={{ display: 'flex', flexDirection: 'column' }}>
66
- <Button>First Button</Button>
67
- <Spacer size="lg" />
68
- <Button>Second Button</Button>
69
- </Box>
70
- ),
71
- play: async ({ canvasElement, step }) => {
72
- const canvas = within(canvasElement);
73
-
74
- await step('Tab through elements', async () => {
75
- const firstButton = canvas.getByText('First Button');
76
- const secondButton = canvas.getByText('Second Button');
77
-
78
- // Focus first button
79
- firstButton.focus();
80
- await expect(document.activeElement).toBe(firstButton);
81
-
82
- // Tab to second button (spacer should be skipped)
83
- await userEvent.tab();
84
- await expect(document.activeElement).toBe(secondButton);
85
- });
86
-
87
- await step('Pass Test', async () => {
88
- const statusElement = document.createElement('div');
89
- statusElement.setAttribute('aria-label', 'Status of the test run');
90
- statusElement.textContent = 'PASS';
91
- document.body.appendChild(statusElement);
92
- });
93
- },
94
- };
95
-
96
- /**
97
- * Test 3: Screen Reader
98
- * Tests that spacer is invisible to screen readers
99
- */
100
- export const ScreenReader: Story = {
101
- args: {
102
- size: 'xl',
103
- },
104
- render: (args) => (
105
- <Box>
106
- <Typography id="content1">First content block</Typography>
107
- <Spacer {...args} data-testid="spacer" />
108
- <Typography id="content2">Second content block</Typography>
109
- </Box>
110
- ),
111
- play: async ({ canvasElement, step }) => {
112
- const canvas = within(canvasElement);
113
-
114
- await step('Verify spacer has no semantic content', async () => {
115
- const spacer = await canvas.findByTestId('spacer');
116
-
117
- // Spacer should not have any aria labels
118
- await expect(spacer.getAttribute('aria-label')).toBeNull();
119
- await expect(spacer.getAttribute('aria-hidden')).toBe('true');
120
-
121
- // Spacer should not have any text content
122
- await expect(spacer.textContent).toBe('');
123
- });
124
-
125
- await step('Pass Test', async () => {
126
- const statusElement = document.createElement('div');
127
- statusElement.setAttribute('aria-label', 'Status of the test run');
128
- statusElement.textContent = 'PASS';
129
- document.body.appendChild(statusElement);
130
- });
131
- },
132
- };
133
-
134
- /**
135
- * Test 4: Focus Management
136
- * Tests that spacer doesn't capture or interfere with focus
137
- */
138
- export const FocusManagement: Story = {
139
- render: () => (
140
- <Box sx={{ display: 'flex', gap: 0 }}>
141
- <Button>Button 1</Button>
142
- <Spacer size="md" direction="horizontal" data-testid="spacer" />
143
- <Button>Button 2</Button>
144
- </Box>
145
- ),
146
- play: async ({ canvasElement, step }) => {
147
- const canvas = within(canvasElement);
148
-
149
- await step('Verify spacer is not focusable', async () => {
150
- const spacer = await canvas.findByTestId('spacer');
151
-
152
- // Spacer should not have tabindex
153
- await expect(spacer.getAttribute('tabindex')).toBeNull();
154
-
155
- // Try to focus spacer - should not work
156
- spacer.focus();
157
- await expect(document.activeElement).not.toBe(spacer);
158
- });
159
-
160
- await step('Pass Test', async () => {
161
- const statusElement = document.createElement('div');
162
- statusElement.setAttribute('aria-label', 'Status of the test run');
163
- statusElement.textContent = 'PASS';
164
- document.body.appendChild(statusElement);
165
- });
166
- },
167
- };
168
-
169
- /**
170
- * Test 5: Responsive Design
171
- * Tests spacer behavior at different viewport sizes
172
- */
173
- export const ResponsiveDesign: Story = {
174
- args: {
175
- size: 'lg',
176
- },
177
- render: (args) => (
178
- <Box sx={{ width: '100%' }}>
179
- <Typography>Responsive Content 1</Typography>
180
- <Spacer {...args} data-testid="spacer-responsive" />
181
- <Typography>Responsive Content 2</Typography>
182
- </Box>
183
- ),
184
- play: async ({ canvasElement, step }) => {
185
- const canvas = within(canvasElement);
186
-
187
- await step('Test spacer at different sizes', async () => {
188
- const spacer = await canvas.findByTestId('spacer-responsive');
189
-
190
- // Get initial size
191
- const initialStyle = window.getComputedStyle(spacer);
192
- const initialHeight = parseInt(initialStyle.height);
193
-
194
- // Verify spacer has proper dimensions
195
- await expect(initialHeight).toBeGreaterThan(0);
196
-
197
- // Spacer should maintain consistent spacing
198
- await expect(spacer).toHaveStyle({ display: 'block' });
199
- });
200
-
201
- await step('Pass Test', async () => {
202
- const statusElement = document.createElement('div');
203
- statusElement.setAttribute('aria-label', 'Status of the test run');
204
- statusElement.textContent = 'PASS';
205
- document.body.appendChild(statusElement);
206
- });
207
- },
208
- };
209
-
210
- /**
211
- * Test 6: Theme Variations
212
- * Tests spacer with different theme contexts
213
- */
214
- export const ThemeVariations: Story = {
215
- render: () => (
216
- <Box sx={{ display: 'flex', flexDirection: 'column', gap: 1 }}>
217
- <Box sx={{ bgcolor: 'background.paper', p: 2 }}>
218
- <Typography>Light Theme Context</Typography>
219
- <Spacer size="md" />
220
- <Typography>Content with spacing</Typography>
221
- </Box>
222
- <Box sx={{ bgcolor: 'grey.900', color: 'white', p: 2 }}>
223
- <Typography>Dark Theme Context</Typography>
224
- <Spacer size="md" />
225
- <Typography>Content with spacing</Typography>
226
- </Box>
227
- </Box>
228
- ),
229
- play: async ({ canvasElement, step }) => {
230
- const canvas = within(canvasElement);
231
-
232
- await step('Verify spacer works in different theme contexts', async () => {
233
- // Spacers should maintain consistent behavior regardless of theme
234
- const containers = canvas.getAllByText(/Theme Context/);
235
- await expect(containers).toHaveLength(2);
236
- });
237
-
238
- await step('Pass Test', async () => {
239
- const statusElement = document.createElement('div');
240
- statusElement.setAttribute('aria-label', 'Status of the test run');
241
- statusElement.textContent = 'PASS';
242
- document.body.appendChild(statusElement);
243
- });
244
- },
245
- };
246
-
247
- /**
248
- * Test 7: Visual States
249
- * Tests different visual configurations of spacer
250
- */
251
- export const VisualStates: Story = {
252
- render: () => (
253
- <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
254
- <Box sx={{ display: 'flex', alignItems: 'center', border: '1px solid #ccc', p: 1 }}>
255
- <Typography>Horizontal:</Typography>
256
- <Spacer size="md" direction="horizontal" data-testid="horizontal-spacer" />
257
- <Typography>Spacing</Typography>
258
- </Box>
259
- <Box sx={{ border: '1px solid #ccc', p: 1 }}>
260
- <Typography>Vertical:</Typography>
261
- <Spacer size="md" direction="vertical" data-testid="vertical-spacer" />
262
- <Typography>Spacing</Typography>
263
- </Box>
264
- <Box sx={{ border: '1px solid #ccc', p: 1 }}>
265
- <Typography>Both:</Typography>
266
- <Spacer size="md" direction="both" data-testid="both-spacer" />
267
- <Typography>Spacing</Typography>
268
- </Box>
269
- </Box>
270
- ),
271
- play: async ({ canvasElement, step }) => {
272
- const canvas = within(canvasElement);
273
-
274
- await step('Test different directions', async () => {
275
- const horizontal = await canvas.findByTestId('horizontal-spacer');
276
- const vertical = await canvas.findByTestId('vertical-spacer');
277
- const both = await canvas.findByTestId('both-spacer');
278
-
279
- const hStyle = window.getComputedStyle(horizontal);
280
- const vStyle = window.getComputedStyle(vertical);
281
- const bStyle = window.getComputedStyle(both);
282
-
283
- // Horizontal should have width but minimal height
284
- await expect(parseInt(hStyle.width)).toBeGreaterThan(0);
285
-
286
- // Vertical should have height
287
- await expect(parseInt(vStyle.height)).toBeGreaterThan(0);
288
-
289
- // Both should have both dimensions
290
- await expect(parseInt(bStyle.width)).toBeGreaterThan(0);
291
- await expect(parseInt(bStyle.height)).toBeGreaterThan(0);
292
- });
293
-
294
- await step('Pass Test', async () => {
295
- const statusElement = document.createElement('div');
296
- statusElement.setAttribute('aria-label', 'Status of the test run');
297
- statusElement.textContent = 'PASS';
298
- document.body.appendChild(statusElement);
299
- });
300
- },
301
- };
302
-
303
- /**
304
- * Test 8: Performance
305
- * Tests performance with multiple spacers
306
- */
307
- export const Performance: Story = {
308
- render: () => (
309
- <Box sx={{ maxHeight: 400, overflow: 'auto' }}>
310
- {Array.from({ length: 50 }, (_, i) => (
311
- <Box key={i} sx={{ display: 'flex', alignItems: 'center' }}>
312
- <Typography>Item {i + 1}</Typography>
313
- <Spacer size="sm" direction="horizontal" />
314
- <Button size="small">Action</Button>
315
- <Spacer size="xs" direction="horizontal" />
316
- <Typography variant="caption">Status</Typography>
317
- </Box>
318
- ))}
319
- </Box>
320
- ),
321
- play: async ({ canvasElement, step }) => {
322
- const canvas = within(canvasElement);
323
-
324
- await step('Verify multiple spacers render efficiently', async () => {
325
- // Check that all items rendered
326
- const items = canvas.getAllByText(/Item \d+/);
327
- await expect(items).toHaveLength(50);
328
-
329
- // Verify buttons are interactive
330
- const buttons = canvas.getAllByRole('button');
331
- await expect(buttons).toHaveLength(50);
332
- });
333
-
334
- await step('Pass Test', async () => {
335
- const statusElement = document.createElement('div');
336
- statusElement.setAttribute('aria-label', 'Status of the test run');
337
- statusElement.textContent = 'PASS';
338
- document.body.appendChild(statusElement);
339
- });
340
- },
341
- };
342
-
343
- /**
344
- * Test 9: Edge Cases
345
- * Tests edge cases and boundary conditions
346
- */
347
- export const EdgeCases: Story = {
348
- render: () => (
349
- <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
350
- <Box sx={{ border: '1px solid #ccc', p: 1 }}>
351
- <Typography>Zero width:</Typography>
352
- <Spacer width={0} data-testid="zero-width" />
353
- <Typography>After</Typography>
354
- </Box>
355
- <Box sx={{ border: '1px solid #ccc', p: 1 }}>
356
- <Typography>Zero height:</Typography>
357
- <Spacer height={0} data-testid="zero-height" />
358
- <Typography>After</Typography>
359
- </Box>
360
- <Box sx={{ border: '1px solid #ccc', p: 1 }}>
361
- <Typography>Custom string dimension:</Typography>
362
- <Spacer width="2rem" height="1.5em" data-testid="custom-string" />
363
- <Typography>After</Typography>
364
- </Box>
365
- <Box sx={{ border: '1px solid #ccc', p: 1, display: 'flex' }}>
366
- <Typography>Flex spacer:</Typography>
367
- <Spacer flex data-testid="flex-spacer" />
368
- <Typography>Pushed to end</Typography>
369
- </Box>
370
- </Box>
371
- ),
372
- play: async ({ canvasElement, step }) => {
373
- const canvas = within(canvasElement);
374
-
375
- await step('Test zero dimensions', async () => {
376
- const zeroWidth = await canvas.findByTestId('zero-width');
377
- const zeroHeight = await canvas.findByTestId('zero-height');
378
-
379
- const zeroWidthStyle = window.getComputedStyle(zeroWidth);
380
- const zeroHeightStyle = window.getComputedStyle(zeroHeight);
381
-
382
- await expect(parseInt(zeroWidthStyle.width)).toBe(0);
383
- await expect(parseInt(zeroHeightStyle.height)).toBe(0);
384
- });
385
-
386
- await step('Test custom string dimensions', async () => {
387
- const customString = await canvas.findByTestId('custom-string');
388
- const style = window.getComputedStyle(customString);
389
-
390
- // Should have applied custom dimensions
391
- await expect(style.width).toBeTruthy();
392
- await expect(style.height).toBeTruthy();
393
- });
394
-
395
- await step('Test flex spacer', async () => {
396
- const flexSpacer = await canvas.findByTestId('flex-spacer');
397
- const style = window.getComputedStyle(flexSpacer);
398
-
399
- // flex: 1 with flexShrink: 0 results in '1 0 0%'
400
- await expect(style.flex).toBe('1 0 0%');
401
- });
402
-
403
- await step('Pass Test', async () => {
404
- const statusElement = document.createElement('div');
405
- statusElement.setAttribute('aria-label', 'Status of the test run');
406
- statusElement.textContent = 'PASS';
407
- document.body.appendChild(statusElement);
408
- });
409
- },
410
- };
411
-
412
- /**
413
- * Test 10: Integration
414
- * Tests integration with other layout components
415
- */
416
- export const Integration: Story = {
417
- render: () => (
418
- <Box sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}>
419
- <Box sx={{ display: 'flex', alignItems: 'center', p: 2, bgcolor: 'background.paper' }}>
420
- <Typography>Grid Layout:</Typography>
421
- <Spacer size="md" direction="horizontal" />
422
- <Box sx={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 1 }}>
423
- <Button size="small">1</Button>
424
- <Button size="small">2</Button>
425
- <Button size="small">3</Button>
426
- </Box>
427
- </Box>
428
-
429
- <Box sx={{ display: 'flex', p: 2, bgcolor: 'background.paper' }}>
430
- <Typography>Flexbox:</Typography>
431
- <Spacer flex />
432
- <Button>Right Aligned</Button>
433
- </Box>
434
-
435
- <Box sx={{ p: 2, bgcolor: 'background.paper' }}>
436
- <Typography component="div">Stack Layout:</Typography>
437
- <Spacer size="sm" />
438
- <Box sx={{ display: 'flex', flexDirection: 'column', gap: 0 }}>
439
- <Button>Item 1</Button>
440
- <Spacer size="xs" />
441
- <Button>Item 2</Button>
442
- <Spacer size="xs" />
443
- <Button>Item 3</Button>
444
- </Box>
445
- </Box>
446
- </Box>
447
- ),
448
- play: async ({ canvasElement, step }) => {
449
- const canvas = within(canvasElement);
450
-
451
- await step('Verify integration with different layouts', async () => {
452
- // Check grid layout buttons
453
- const gridButtons = canvas.getAllByText(/^[123]$/);
454
- await expect(gridButtons).toHaveLength(3);
455
-
456
- // Check flex-aligned button
457
- const rightAligned = canvas.getByText('Right Aligned');
458
- await expect(rightAligned).toBeInTheDocument();
459
-
460
- // Check stack items
461
- const stackItems = canvas.getAllByText(/Item \d/);
462
- await expect(stackItems).toHaveLength(3);
463
- });
464
-
465
- await step('Pass Test', async () => {
466
- const statusElement = document.createElement('div');
467
- statusElement.setAttribute('aria-label', 'Status of the test run');
468
- statusElement.textContent = 'PASS';
469
- document.body.appendChild(statusElement);
470
- });
471
- },
472
- };
@@ -1,82 +0,0 @@
1
- import { Box, Typography } from '@mui/material';
2
- import type { Meta, StoryObj } from '@storybook/react-vite';
3
- import { useState } from 'react';
4
-
5
- import { FilterTrigger } from '../ContentToolbar/FilterTrigger';
6
- import { TableFilter } from './TableFilter';
7
- import type { TableFilterRange } from './TableFilter.types';
8
-
9
- const meta: Meta<typeof TableFilter> = {
10
- title: 'Layout/TableFilter',
11
- component: TableFilter,
12
- parameters: {
13
- layout: 'fullscreen',
14
- docs: {
15
- description: {
16
- component:
17
- 'Compound filter-panel system (MUI port of the reference `TableFilter`). A `Panel` slides in from the right beside `Main`; compose it from `Keyword`, `Section`, `CheckboxField`, and `RangeField`. Pair the funnel `FilterTrigger` with the same open state.',
18
- },
19
- },
20
- },
21
- tags: ['autodocs'],
22
- };
23
-
24
- export default meta;
25
- type Story = StoryObj<typeof meta>;
26
-
27
- const CATEGORIES = [
28
- { value: 'drinks', label: 'Drinks', count: 12 },
29
- { value: 'snacks', label: 'Snacks', count: 7 },
30
- { value: 'cleaning', label: 'Cleaning', count: 3 },
31
- ];
32
-
33
- export const Default: Story = {
34
- render: () => {
35
- const [open, setOpen] = useState(true);
36
- const [keyword, setKeyword] = useState('');
37
- const [cats, setCats] = useState<Set<string>>(new Set(['drinks']));
38
- const [price, setPrice] = useState<TableFilterRange>({});
39
- const active = keyword !== '' || cats.size > 0 || price.min != null || price.max != null;
40
-
41
- return (
42
- <Box sx={{ display: 'flex', flexDirection: 'column', height: 420, border: 1, borderColor: 'divider' }}>
43
- <Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', p: 2, borderBottom: 1, borderColor: 'divider' }}>
44
- <Typography variant="h6">Products</Typography>
45
- <FilterTrigger open={open} onOpenChange={setOpen} hasActiveFilters={active} />
46
- </Box>
47
- <TableFilter open={open} onOpenChange={setOpen} hasActiveFilters={active}>
48
- <TableFilter.Layout>
49
- <TableFilter.Main>
50
- <Box sx={{ p: 2, color: 'text.secondary' }}>Table / grid content…</Box>
51
- </TableFilter.Main>
52
- <TableFilter.Panel
53
- onClearAll={() => {
54
- setKeyword('');
55
- setCats(new Set());
56
- setPrice({});
57
- }}
58
- >
59
- <TableFilter.Keyword value={keyword} onChange={setKeyword} />
60
- <TableFilter.Section title="Attributes">
61
- <TableFilter.CheckboxField
62
- label="Category"
63
- options={CATEGORIES}
64
- selected={cats}
65
- onToggle={(value, checked) =>
66
- setCats((prev) => {
67
- const next = new Set(prev);
68
- if (checked) next.add(value);
69
- else next.delete(value);
70
- return next;
71
- })
72
- }
73
- />
74
- <TableFilter.RangeField label="Price" unit="R$" step={0.01} value={price} onChange={setPrice} />
75
- </TableFilter.Section>
76
- </TableFilter.Panel>
77
- </TableFilter.Layout>
78
- </TableFilter>
79
- </Box>
80
- );
81
- },
82
- };
@@ -1,87 +0,0 @@
1
- import { Box } from '@mui/material';
2
- import type { Meta, StoryObj } from '@storybook/react-vite';
3
- import { expect, userEvent, waitFor, within } from 'storybook/test';
4
- import { useState } from 'react';
5
-
6
- import { FilterTrigger } from '../ContentToolbar/FilterTrigger';
7
- import { TableFilter } from './TableFilter';
8
- import type { TableFilterRange } from './TableFilter.types';
9
-
10
- const meta: Meta<typeof TableFilter> = {
11
- title: 'Layout/TableFilter/Tests',
12
- component: TableFilter,
13
- parameters: { layout: 'fullscreen', chromatic: { disableSnapshot: false } },
14
- tags: ['autodocs', 'test', 'component:TableFilter', 'checked'],
15
- };
16
-
17
- export default meta;
18
- type Story = StoryObj<typeof meta>;
19
-
20
- const CATEGORIES = [
21
- { value: 'drinks', label: 'Drinks' },
22
- { value: 'snacks', label: 'Snacks' },
23
- ];
24
-
25
- function Harness(): React.JSX.Element {
26
- const [open, setOpen] = useState(false);
27
- const [cats, setCats] = useState<Set<string>>(new Set());
28
- const [price, setPrice] = useState<TableFilterRange>({});
29
- return (
30
- <Box sx={{ display: 'flex', flexDirection: 'column', height: 360 }}>
31
- <FilterTrigger open={open} onOpenChange={setOpen} hasActiveFilters={cats.size > 0} data-testid="funnel" />
32
- <TableFilter open={open} onOpenChange={setOpen} hasActiveFilters={cats.size > 0}>
33
- <TableFilter.Layout>
34
- <TableFilter.Main>
35
- <Box data-testid="main">main</Box>
36
- </TableFilter.Main>
37
- <TableFilter.Panel onClearAll={() => setCats(new Set())} clearTestId="clear-all">
38
- <TableFilter.Section title="Attributes">
39
- <TableFilter.CheckboxField
40
- label="Category"
41
- options={CATEGORIES}
42
- selected={cats}
43
- onToggle={(value, checked) =>
44
- setCats((prev) => {
45
- const next = new Set(prev);
46
- if (checked) next.add(value);
47
- else next.delete(value);
48
- return next;
49
- })
50
- }
51
- testId="cat-field"
52
- />
53
- <TableFilter.RangeField label="Price" value={price} onChange={setPrice} testId="price-range" />
54
- </TableFilter.Section>
55
- </TableFilter.Panel>
56
- </TableFilter.Layout>
57
- </TableFilter>
58
- </Box>
59
- );
60
- }
61
-
62
- export const OpenPanelAndFilter: Story = {
63
- name: '🧪 Funnel opens panel; checkbox + range work',
64
- render: () => <Harness />,
65
- play: async ({ canvasElement, step }) => {
66
- const canvas = within(canvasElement);
67
- await step('Funnel toggles the panel open', async () => {
68
- await expect(canvas.getByTestId('funnel')).toHaveAttribute('aria-expanded', 'false');
69
- await userEvent.click(canvas.getByTestId('funnel'));
70
- await waitFor(() => expect(canvas.getByTestId('funnel')).toHaveAttribute('aria-expanded', 'true'));
71
- });
72
- await step('Toggle a category checkbox', async () => {
73
- const drinks = canvas.getByTestId('cat-field-drinks').querySelector('input')!;
74
- await userEvent.click(drinks);
75
- await waitFor(() => expect(drinks).toBeChecked());
76
- });
77
- await step('Type a min price', async () => {
78
- const min = canvas.getByTestId('price-range-min');
79
- await userEvent.type(min, '10');
80
- await waitFor(() => expect(min).toHaveValue(10));
81
- });
82
- await step('Clear All Filters resets the checkbox', async () => {
83
- await userEvent.click(canvas.getByTestId('clear-all'));
84
- await waitFor(() => expect(canvas.getByTestId('cat-field-drinks').querySelector('input')).not.toBeChecked());
85
- });
86
- },
87
- };