@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,701 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react-vite';
2
- import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
3
-
4
- import { Carousel } from './Carousel';
5
-
6
- const meta: Meta<typeof Carousel> = {
7
- title: 'DataDisplay/Carousel/Tests',
8
- component: Carousel,
9
- parameters: {
10
- layout: 'centered',
11
- chromatic: { disableSnapshot: false },
12
- },
13
- tags: ['autodocs', 'test', 'component:Carousel'],
14
- };
15
-
16
- export default meta;
17
- type Story = StoryObj<typeof meta>;
18
-
19
- // Sample items for testing - using data URLs for images to avoid network issues
20
- const sampleItems = [
21
- {
22
- id: '1',
23
- title: 'Slide 1',
24
- description: 'Description for slide 1',
25
- content: <div>Content 1</div>,
26
- image:
27
- 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAwIiBoZWlnaHQ9IjQwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iNjAwIiBoZWlnaHQ9IjQwMCIgZmlsbD0iIzNmNTFiNSIvPjx0ZXh0IHRleHQtYW5jaG9yPSJtaWRkbGUiIHg9IjMwMCIgeT0iMjAwIiBzdHlsZT0iZmlsbDojZmZmO2ZvbnQtd2VpZ2h0OmJvbGQ7Zm9udC1zaXplOjMwcHg7Zm9udC1mYW1pbHk6QXJpYWwsSGVsdmV0aWNhLHNhbnMtc2VyaWY7ZG9taW5hbnQtYmFzZWxpbmU6Y2VudHJhbCI+U2xpZGUgMTwvdGV4dD48L3N2Zz4=',
28
- alt: 'Slide 1 image',
29
- },
30
- {
31
- id: '2',
32
- title: 'Slide 2',
33
- description: 'Description for slide 2',
34
- content: <div>Content 2</div>,
35
- image:
36
- 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAwIiBoZWlnaHQ9IjQwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iNjAwIiBoZWlnaHQ9IjQwMCIgZmlsbD0iIzIxOTZmMyIvPjx0ZXh0IHRleHQtYW5jaG9yPSJtaWRkbGUiIHg9IjMwMCIgeT0iMjAwIiBzdHlsZT0iZmlsbDojZmZmO2ZvbnQtd2VpZ2h0OmJvbGQ7Zm9udC1zaXplOjMwcHg7Zm9udC1mYW1pbHk6QXJpYWwsSGVsdmV0aWNhLHNhbnMtc2VyaWY7ZG9taW5hbnQtYmFzZWxpbmU6Y2VudHJhbCI+U2xpZGUgMjwvdGV4dD48L3N2Zz4=',
37
- alt: 'Slide 2 image',
38
- },
39
- {
40
- id: '3',
41
- title: 'Slide 3',
42
- description: 'Description for slide 3',
43
- content: <div>Content 3</div>,
44
- image:
45
- 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAwIiBoZWlnaHQ9IjQwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iNjAwIiBoZWlnaHQ9IjQwMCIgZmlsbD0iIzAwYmNkNCIvPjx0ZXh0IHRleHQtYW5jaG9yPSJtaWRkbGUiIHg9IjMwMCIgeT0iMjAwIiBzdHlsZT0iZmlsbDojZmZmO2ZvbnQtd2VpZ2h0OmJvbGQ7Zm9udC1zaXplOjMwcHg7Zm9udC1mYW1pbHk6QXJpYWwsSGVsdmV0aWNhLHNhbnMtc2VyaWY7ZG9taW5hbnQtYmFzZWxpbmU6Y2VudHJhbCI+U2xpZGUgMzwvdGV4dD48L3N2Zz4=',
46
- alt: 'Slide 3 image',
47
- },
48
- {
49
- id: '4',
50
- title: 'Slide 4',
51
- description: 'Description for slide 4',
52
- content: <div>Content 4</div>,
53
- image:
54
- 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAwIiBoZWlnaHQ9IjQwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iNjAwIiBoZWlnaHQ9IjQwMCIgZmlsbD0iIzRjYWY1MCIvPjx0ZXh0IHRleHQtYW5jaG9yPSJtaWRkbGUiIHg9IjMwMCIgeT0iMjAwIiBzdHlsZT0iZmlsbDojZmZmO2ZvbnQtd2VpZ2h0OmJvbGQ7Zm9udC1zaXplOjMwcHg7Zm9udC1mYW1pbHk6QXJpYWwsSGVsdmV0aWNhLHNhbnMtc2VyaWY7ZG9taW5hbnQtYmFzZWxpbmU6Y2VudHJhbCI+U2xpZGUgNDwvdGV4dD48L3N2Zz4=',
55
- alt: 'Slide 4 image',
56
- },
57
- ];
58
-
59
- // Basic Interaction Test
60
- export const BasicInteraction: Story = {
61
- args: {
62
- items: sampleItems,
63
- showArrows: true,
64
- showIndicators: true,
65
- width: 600,
66
- height: 400,
67
- onFocus: fn(),
68
- onBlur: fn(),
69
- onClick: fn(),
70
- onChange: fn(),
71
- },
72
- play: async ({ canvasElement }) => {
73
- const canvas = within(canvasElement);
74
-
75
- // Wait for carousel to render
76
- await waitFor(() => {
77
- expect(canvas.getByText('Slide 1')).toBeInTheDocument();
78
- });
79
-
80
- // Test that first slide is visible
81
- expect(canvas.getByText('Slide 1')).toBeVisible();
82
- expect(canvas.getByText('Description for slide 1')).toBeVisible();
83
-
84
- // Find and click next arrow
85
- const nextButton = canvas
86
- .getAllByRole('button')
87
- .find((btn) => btn.querySelector('[data-testid="ArrowForwardIosIcon"]'));
88
-
89
- if (nextButton) {
90
- await userEvent.click(nextButton);
91
-
92
- // Wait for slide transition
93
- await waitFor(
94
- () => {
95
- expect(canvas.getByText('Slide 2')).toBeVisible();
96
- },
97
- { timeout: 1000 },
98
- );
99
-
100
- expect(canvas.getByText('Description for slide 2')).toBeVisible();
101
- }
102
-
103
- // Find and click previous arrow
104
- const prevButton = canvas
105
- .getAllByRole('button')
106
- .find((btn) => btn.querySelector('[data-testid="ArrowBackIosIcon"]'));
107
-
108
- if (prevButton) {
109
- await userEvent.click(prevButton);
110
-
111
- // Wait for slide transition back
112
- await waitFor(
113
- () => {
114
- expect(canvas.getByText('Slide 1')).toBeVisible();
115
- },
116
- { timeout: 1000 },
117
- );
118
- }
119
- },
120
- };
121
-
122
- // Navigation Controls Test
123
- export const NavigationControls: Story = {
124
- args: {
125
- items: sampleItems,
126
- showArrows: true,
127
- showIndicators: true,
128
- showThumbnails: true,
129
- width: 600,
130
- height: 400,
131
- onFocus: fn(),
132
- onBlur: fn(),
133
- onClick: fn(),
134
- onChange: fn(),
135
- },
136
- play: async ({ canvasElement }) => {
137
- const canvas = within(canvasElement);
138
-
139
- await waitFor(() => {
140
- expect(canvas.getByText('Slide 1')).toBeInTheDocument();
141
- });
142
-
143
- // Test indicator navigation
144
- const indicators = canvas
145
- .getAllByRole('button')
146
- .filter((btn) => btn.querySelector('[data-testid="FiberManualRecordIcon"]'));
147
-
148
- if (indicators.length > 2) {
149
- // Click third indicator
150
- await userEvent.click(indicators[2]);
151
-
152
- await waitFor(
153
- () => {
154
- expect(canvas.getByText('Slide 3')).toBeVisible();
155
- },
156
- { timeout: 1000 },
157
- );
158
- }
159
-
160
- // Test thumbnail navigation if visible
161
- const thumbnails = canvas.getAllByRole('img');
162
- if (thumbnails.length > 4) {
163
- // Click fourth thumbnail (thumbnails include main images)
164
- await userEvent.click(thumbnails[4]);
165
-
166
- await waitFor(
167
- () => {
168
- expect(canvas.getByText('Slide 4')).toBeVisible();
169
- },
170
- { timeout: 1000 },
171
- );
172
- }
173
- },
174
- };
175
-
176
- // Autoplay Test
177
- export const Autoplay: Story = {
178
- args: {
179
- items: sampleItems.slice(0, 3),
180
- autoPlay: true,
181
- autoPlayInterval: 1000,
182
- pauseOnHover: true,
183
- showIndicators: true,
184
- width: 600,
185
- height: 400,
186
- onFocus: fn(),
187
- onBlur: fn(),
188
- onClick: fn(),
189
- onChange: fn(),
190
- },
191
- play: async ({ canvasElement }) => {
192
- const canvas = within(canvasElement);
193
-
194
- // Wait for initial render
195
- await waitFor(() => {
196
- expect(canvas.getByText('Slide 1')).toBeInTheDocument();
197
- });
198
-
199
- // Wait for autoplay to advance
200
- await waitFor(
201
- () => {
202
- expect(canvas.getByText('Slide 2')).toBeVisible();
203
- },
204
- { timeout: 2000 },
205
- );
206
-
207
- // Test pause on hover
208
- const carousel = canvasElement.querySelector('[class*="MuiBox-root"]');
209
- if (carousel) {
210
- await userEvent.hover(carousel);
211
-
212
- // This assertion is that nothing happens, which no query can await: a
213
- // findBy would resolve on the slide already showing, and waitFor passes
214
- // the instant its condition holds. Proving the timer is paused needs more
215
- // than one autoplay interval to actually elapse.
216
- // eslint-disable-next-line test-flakiness/no-hard-coded-timeout -- negative assertion over elapsed time
217
- await new Promise((resolve) => window.setTimeout(resolve, 1500));
218
-
219
- // Should still be on slide 2
220
- expect(canvas.getByText('Slide 2')).toBeVisible();
221
-
222
- // Unhover to resume
223
- await userEvent.unhover(carousel);
224
-
225
- // Should advance to slide 3
226
- await waitFor(
227
- () => {
228
- expect(canvas.getByText('Slide 3')).toBeVisible();
229
- },
230
- { timeout: 2000 },
231
- );
232
- }
233
- },
234
- };
235
-
236
- // Keyboard Navigation Test
237
- export const KeyboardNavigation: Story = {
238
- args: {
239
- items: sampleItems,
240
- showArrows: true,
241
- showIndicators: true,
242
- width: 600,
243
- height: 400,
244
- onFocus: fn(),
245
- onBlur: fn(),
246
- onClick: fn(),
247
- onChange: fn(),
248
- },
249
- play: async ({ canvasElement }) => {
250
- const canvas = within(canvasElement);
251
-
252
- await waitFor(() => {
253
- expect(canvas.getByText('Slide 1')).toBeInTheDocument();
254
- });
255
-
256
- // Focus on the carousel container
257
- const carousel = canvasElement.querySelector('[class*="MuiBox-root"]');
258
- if (carousel) {
259
- await userEvent.click(carousel);
260
-
261
- // Press right arrow key
262
- await userEvent.keyboard('{ArrowRight}');
263
-
264
- // Note: Carousel may need keyboard event handlers implemented
265
- // This test verifies focus management
266
-
267
- // Tab through navigation controls
268
- await userEvent.tab();
269
-
270
- // Verify focus moves to first interactive element
271
- const activeElement = document.activeElement;
272
- expect(activeElement?.tagName).toBe('BUTTON');
273
- }
274
- },
275
- };
276
-
277
- // Screen Reader Test
278
- export const ScreenReader: Story = {
279
- args: {
280
- items: sampleItems,
281
- showArrows: true,
282
- showIndicators: true,
283
- width: 600,
284
- height: 400,
285
- onFocus: fn(),
286
- onBlur: fn(),
287
- onClick: fn(),
288
- onChange: fn(),
289
- },
290
- play: async ({ canvasElement }) => {
291
- const canvas = within(canvasElement);
292
-
293
- await waitFor(() => {
294
- expect(canvas.getByText('Slide 1')).toBeInTheDocument();
295
- });
296
-
297
- // Check for image alt text
298
- const images = canvas.getAllByRole('img');
299
- images.forEach((img, index) => {
300
- if (index < sampleItems.length) {
301
- expect(img).toHaveAttribute('alt');
302
- }
303
- });
304
-
305
- // Check navigation buttons have accessible labels
306
- const buttons = canvas.getAllByRole('button');
307
- buttons.forEach((button) => {
308
- // Buttons should be accessible (have text or aria-label)
309
- const hasText = button.textContent && button.textContent.trim().length > 0;
310
- const hasAriaLabel = button.hasAttribute('aria-label');
311
- expect(hasText || hasAriaLabel).toBeTruthy();
312
- });
313
- },
314
- };
315
-
316
- // Focus Management Test
317
- export const FocusManagement: Story = {
318
- args: {
319
- items: sampleItems,
320
- showArrows: true,
321
- showIndicators: true,
322
- onFocus: fn(),
323
- onBlur: fn(),
324
- width: 600,
325
- height: 400,
326
- },
327
- play: async ({ canvasElement, args }) => {
328
- const canvas = within(canvasElement);
329
-
330
- await waitFor(() => {
331
- expect(canvas.getByText('Slide 1')).toBeInTheDocument();
332
- });
333
-
334
- // Focus on carousel container
335
- const carousel = canvasElement.querySelector('[class*="MuiBox-root"]');
336
- if (carousel instanceof HTMLElement) {
337
- await userEvent.click(carousel);
338
-
339
- // Tab through interactive elements
340
- await userEvent.tab();
341
- await userEvent.tab();
342
- await userEvent.tab();
343
-
344
- // Shift+Tab to go back
345
- await userEvent.tab({ shift: true });
346
-
347
- // Verify focus events were called if handlers provided
348
- if (args.onFocus) {
349
- await waitFor(() => {
350
- expect(args.onFocus).toHaveBeenCalled();
351
- });
352
- }
353
- }
354
- },
355
- };
356
-
357
- // Responsive Design Test
358
- export const ResponsiveDesign: Story = {
359
- args: {
360
- items: sampleItems,
361
- showArrows: true,
362
- showIndicators: true,
363
- width: '100%',
364
- height: 400,
365
- onFocus: fn(),
366
- onBlur: fn(),
367
- onClick: fn(),
368
- onChange: fn(),
369
- },
370
- parameters: {
371
- viewport: {
372
- viewports: {
373
- mobile: { name: 'Mobile', styles: { width: '360px', height: '640px' } },
374
- tablet: { name: 'Tablet', styles: { width: '768px', height: '1024px' } },
375
- desktop: { name: 'Desktop', styles: { width: '1440px', height: '900px' } },
376
- },
377
- },
378
- },
379
- play: async ({ canvasElement }) => {
380
- const canvas = within(canvasElement);
381
-
382
- await waitFor(() => {
383
- expect(canvas.getByText('Slide 1')).toBeInTheDocument();
384
- });
385
-
386
- // Test that carousel adapts to container width
387
- const carousel = canvasElement.querySelector('[class*="MuiBox-root"]');
388
- if (carousel) {
389
- const styles = window.getComputedStyle(carousel);
390
- expect(styles.width).toBeTruthy();
391
-
392
- // Responsive here means the carousel fills the box it is given, whatever
393
- // that box is — comparing it to the viewport would hold on any screen and
394
- // so would pass even if the carousel ignored its container entirely.
395
- const parent = carousel.parentElement;
396
- expect(carousel.clientWidth).toBeGreaterThan(0);
397
- if (parent) {
398
- expect(carousel.clientWidth).toBeLessThanOrEqual(parent.clientWidth);
399
- }
400
- }
401
- },
402
- };
403
-
404
- // Theme Variations Test
405
- export const ThemeVariations: Story = {
406
- args: {
407
- items: sampleItems.slice(0, 2),
408
- variant: 'glass',
409
- color: 'primary',
410
- glow: true,
411
- glass: true,
412
- showArrows: true,
413
- showIndicators: true,
414
- width: 600,
415
- height: 400,
416
- onFocus: fn(),
417
- onBlur: fn(),
418
- onClick: fn(),
419
- onChange: fn(),
420
- },
421
- play: async ({ canvasElement }) => {
422
- const canvas = within(canvasElement);
423
-
424
- await waitFor(() => {
425
- expect(canvas.getByText('Slide 1')).toBeInTheDocument();
426
- });
427
-
428
- // Test glass effect styles
429
- const carousel = canvasElement.querySelector('[class*="MuiBox-root"]');
430
- if (carousel) {
431
- const styles = window.getComputedStyle(carousel);
432
-
433
- // Glass effect should have backdrop filter
434
- expect(styles.backdropFilter || styles.webkitBackdropFilter).toBeTruthy();
435
-
436
- // Glow effect should have box shadow
437
- if (styles.boxShadow && styles.boxShadow !== 'none') {
438
- expect(styles.boxShadow).toContain('rgb');
439
- }
440
- }
441
- },
442
- };
443
-
444
- // Visual States Test
445
- export const VisualStates: Story = {
446
- args: {
447
- items: sampleItems,
448
- variant: 'elevated',
449
- showArrows: true,
450
- showIndicators: true,
451
- width: 600,
452
- height: 400,
453
- onFocus: fn(),
454
- onBlur: fn(),
455
- onClick: fn(),
456
- onChange: fn(),
457
- },
458
- play: async ({ canvasElement }) => {
459
- const canvas = within(canvasElement);
460
-
461
- await waitFor(() => {
462
- expect(canvas.getByText('Slide 1')).toBeInTheDocument();
463
- });
464
-
465
- // Test hover states on arrows
466
- const nextButton = canvas
467
- .getAllByRole('button')
468
- .find((btn) => btn.querySelector('[data-testid="ArrowForwardIosIcon"]'));
469
-
470
- if (nextButton) {
471
- const initialOpacity = window.getComputedStyle(nextButton).opacity;
472
-
473
- await userEvent.hover(nextButton);
474
- await waitFor(() => {
475
- const hoverOpacity = window.getComputedStyle(nextButton).opacity;
476
- // Opacity should change on hover for overlay arrows
477
- expect(parseFloat(hoverOpacity)).toBeGreaterThanOrEqual(parseFloat(initialOpacity));
478
- });
479
-
480
- await userEvent.unhover(nextButton);
481
- }
482
-
483
- // Test disabled state
484
- const prevButton = canvas
485
- .getAllByRole('button')
486
- .find((btn) => btn.querySelector('[data-testid="ArrowBackIosIcon"]'));
487
-
488
- if (prevButton && prevButton.hasAttribute('disabled')) {
489
- expect(prevButton).toBeDisabled();
490
- const styles = window.getComputedStyle(prevButton);
491
- expect(parseFloat(styles.opacity)).toBeLessThan(1);
492
- }
493
- },
494
- };
495
-
496
- // Performance Test
497
- export const Performance: Story = {
498
- args: {
499
- items: Array.from({ length: 20 }, (_, i) => ({
500
- id: `${i + 1}`,
501
- title: `Slide ${i + 1}`,
502
- description: `Description for slide ${i + 1}`,
503
- content: <div>Content {i + 1}</div>,
504
- image: sampleItems[i % 4].image, // Reuse sample images
505
- alt: `Slide ${i + 1} image`,
506
- })),
507
- autoPlay: true,
508
- autoPlayInterval: 2000,
509
- showIndicators: true,
510
- showArrows: true,
511
- width: 600,
512
- height: 400,
513
- onFocus: fn(),
514
- onBlur: fn(),
515
- onClick: fn(),
516
- onChange: fn(),
517
- },
518
- play: async ({ canvasElement }) => {
519
- const canvas = within(canvasElement);
520
-
521
- const startTime = window.performance.now();
522
-
523
- await waitFor(() => {
524
- expect(canvas.getByText('Slide 1')).toBeInTheDocument();
525
- });
526
-
527
- const renderTime = window.performance.now() - startTime;
528
-
529
- // Carousel should render quickly even with many items
530
- expect(renderTime).toBeLessThan(2000);
531
-
532
- // Test smooth transitions
533
- const nextButton = canvas
534
- .getAllByRole('button')
535
- .find((btn) => btn.querySelector('[data-testid="ArrowForwardIosIcon"]'));
536
-
537
- if (nextButton) {
538
- const transitionStart = window.performance.now();
539
- await userEvent.click(nextButton);
540
-
541
- await waitFor(() => {
542
- expect(canvas.getByText('Slide 2')).toBeVisible();
543
- });
544
-
545
- const transitionTime = window.performance.now() - transitionStart;
546
- // Transition should be smooth and complete within reasonable time
547
- expect(transitionTime).toBeLessThan(1500);
548
- }
549
- },
550
- };
551
-
552
- // Edge Cases Test
553
- export const EdgeCases: Story = {
554
- args: {
555
- items: [
556
- {
557
- id: '1',
558
- title:
559
- 'Very Long Title That Should Be Handled Gracefully Without Breaking The Layout Even When It Is Extremely Long',
560
- description:
561
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.',
562
- content: <div>Content with very long text</div>,
563
- },
564
- {
565
- id: '2',
566
- title: '',
567
- description: '',
568
- content: <div>Slide with no title or description</div>,
569
- },
570
- {
571
- id: '3',
572
- title: 'Slide without image',
573
- description: 'This slide has no image property',
574
- content: <div>Text only content</div>,
575
- },
576
- ],
577
- loop: false,
578
- showArrows: true,
579
- showIndicators: true,
580
- width: 600,
581
- height: 400,
582
- onFocus: fn(),
583
- onBlur: fn(),
584
- onClick: fn(),
585
- onChange: fn(),
586
- },
587
- play: async ({ canvasElement }) => {
588
- const canvas = within(canvasElement);
589
-
590
- await waitFor(() => {
591
- const longTitle = canvasElement.querySelector('h5');
592
- expect(longTitle).toBeInTheDocument();
593
- });
594
-
595
- // Test non-loop behavior at boundaries
596
- const prevButton = canvas
597
- .getAllByRole('button')
598
- .find((btn) => btn.querySelector('[data-testid="ArrowBackIosIcon"]'));
599
-
600
- // At first slide, previous should be disabled when loop is false
601
- if (prevButton) {
602
- // Note: Component may need to implement this logic
603
- // This test documents expected behavior
604
- }
605
-
606
- // Navigate to last slide
607
- const nextButton = canvas
608
- .getAllByRole('button')
609
- .find((btn) => btn.querySelector('[data-testid="ArrowForwardIosIcon"]'));
610
-
611
- if (nextButton && !nextButton.hasAttribute('disabled')) {
612
- await userEvent.click(nextButton);
613
- // Wait for transition
614
- await waitFor(() => {
615
- expect(canvas.queryByText('Slide without image')).toBeInTheDocument();
616
- });
617
-
618
- // Try to click again if not disabled
619
- if (!nextButton.hasAttribute('disabled')) {
620
- await userEvent.click(nextButton);
621
- }
622
-
623
- // At last slide, next should be disabled when loop is false
624
- // Note: Component may need to implement this logic
625
- }
626
-
627
- // Test empty content handling
628
- expect(canvas.getByText('Slide with no title or description')).toBeInTheDocument();
629
- },
630
- };
631
-
632
- // Integration Test
633
- export const Integration: Story = {
634
- args: {
635
- items: sampleItems,
636
- variant: 'cards',
637
- showArrows: true,
638
- showIndicators: true,
639
- showThumbnails: true,
640
- autoPlay: true,
641
- autoPlayInterval: 3000,
642
- pauseOnHover: true,
643
- onClick: fn(),
644
- onChange: fn(),
645
- onFocus: fn(),
646
- onBlur: fn(),
647
- width: 700,
648
- height: 450,
649
- },
650
- play: async ({ canvasElement, args }) => {
651
- const canvas = within(canvasElement);
652
-
653
- await waitFor(() => {
654
- expect(canvas.getByText('Slide 1')).toBeInTheDocument();
655
- });
656
-
657
- // Test onClick callback
658
- const firstSlide = canvas.getByText('Slide 1').closest('div');
659
- if (firstSlide) {
660
- await userEvent.click(firstSlide);
661
-
662
- if (args.onClick) {
663
- await waitFor(() => {
664
- expect(args.onClick).toHaveBeenCalledWith(expect.objectContaining({ id: '1' }), 0);
665
- });
666
- }
667
- }
668
-
669
- // Test onChange callback
670
- const nextButton = canvas
671
- .getAllByRole('button')
672
- .find((btn) => btn.querySelector('[data-testid="ArrowForwardIosIcon"]'));
673
-
674
- if (nextButton) {
675
- await userEvent.click(nextButton);
676
-
677
- if (args.onChange) {
678
- await waitFor(() => {
679
- expect(args.onChange).toHaveBeenCalledWith(1);
680
- });
681
- }
682
- }
683
-
684
- // Test integration of multiple features
685
- const indicators = canvas
686
- .getAllByRole('button')
687
- .filter((btn) => btn.querySelector('[data-testid="FiberManualRecordIcon"]'));
688
-
689
- if (indicators.length > 2) {
690
- await userEvent.click(indicators[2]);
691
-
692
- await waitFor(() => {
693
- expect(canvas.getByText('Slide 3')).toBeVisible();
694
- });
695
-
696
- if (args.onChange) {
697
- expect(args.onChange).toHaveBeenCalledWith(2);
698
- }
699
- }
700
- },
701
- };