@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,691 +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
- // Wait a bit to ensure it doesn't advance
213
- await new Promise((resolve) => window.setTimeout(resolve, 1500));
214
-
215
- // Should still be on slide 2
216
- expect(canvas.getByText('Slide 2')).toBeVisible();
217
-
218
- // Unhover to resume
219
- await userEvent.unhover(carousel);
220
-
221
- // Should advance to slide 3
222
- await waitFor(
223
- () => {
224
- expect(canvas.getByText('Slide 3')).toBeVisible();
225
- },
226
- { timeout: 2000 },
227
- );
228
- }
229
- },
230
- };
231
-
232
- // Keyboard Navigation Test
233
- export const KeyboardNavigation: Story = {
234
- args: {
235
- items: sampleItems,
236
- showArrows: true,
237
- showIndicators: true,
238
- width: 600,
239
- height: 400,
240
- onFocus: fn(),
241
- onBlur: fn(),
242
- onClick: fn(),
243
- onChange: fn(),
244
- },
245
- play: async ({ canvasElement }) => {
246
- const canvas = within(canvasElement);
247
-
248
- await waitFor(() => {
249
- expect(canvas.getByText('Slide 1')).toBeInTheDocument();
250
- });
251
-
252
- // Focus on the carousel container
253
- const carousel = canvasElement.querySelector('[class*="MuiBox-root"]');
254
- if (carousel) {
255
- carousel.focus();
256
-
257
- // Press right arrow key
258
- await userEvent.keyboard('{ArrowRight}');
259
-
260
- // Note: Carousel may need keyboard event handlers implemented
261
- // This test verifies focus management
262
-
263
- // Tab through navigation controls
264
- await userEvent.tab();
265
-
266
- // Verify focus moves to first interactive element
267
- const activeElement = document.activeElement;
268
- expect(activeElement?.tagName).toBe('BUTTON');
269
- }
270
- },
271
- };
272
-
273
- // Screen Reader Test
274
- export const ScreenReader: Story = {
275
- args: {
276
- items: sampleItems,
277
- showArrows: true,
278
- showIndicators: true,
279
- width: 600,
280
- height: 400,
281
- onFocus: fn(),
282
- onBlur: fn(),
283
- onClick: fn(),
284
- onChange: fn(),
285
- },
286
- play: async ({ canvasElement }) => {
287
- const canvas = within(canvasElement);
288
-
289
- await waitFor(() => {
290
- expect(canvas.getByText('Slide 1')).toBeInTheDocument();
291
- });
292
-
293
- // Check for image alt text
294
- const images = canvas.getAllByRole('img');
295
- images.forEach((img, index) => {
296
- if (index < sampleItems.length) {
297
- expect(img).toHaveAttribute('alt');
298
- }
299
- });
300
-
301
- // Check navigation buttons have accessible labels
302
- const buttons = canvas.getAllByRole('button');
303
- buttons.forEach((button) => {
304
- // Buttons should be accessible (have text or aria-label)
305
- const hasText = button.textContent && button.textContent.trim().length > 0;
306
- const hasAriaLabel = button.hasAttribute('aria-label');
307
- expect(hasText || hasAriaLabel).toBeTruthy();
308
- });
309
- },
310
- };
311
-
312
- // Focus Management Test
313
- export const FocusManagement: Story = {
314
- args: {
315
- items: sampleItems,
316
- showArrows: true,
317
- showIndicators: true,
318
- onFocus: fn(),
319
- onBlur: fn(),
320
- width: 600,
321
- height: 400,
322
- },
323
- play: async ({ canvasElement, args }) => {
324
- const canvas = within(canvasElement);
325
-
326
- await waitFor(() => {
327
- expect(canvas.getByText('Slide 1')).toBeInTheDocument();
328
- });
329
-
330
- // Focus on carousel container
331
- const carousel = canvasElement.querySelector('[class*="MuiBox-root"]');
332
- if (carousel instanceof HTMLElement) {
333
- carousel.focus();
334
-
335
- // Tab through interactive elements
336
- await userEvent.tab();
337
- await userEvent.tab();
338
- await userEvent.tab();
339
-
340
- // Shift+Tab to go back
341
- await userEvent.tab({ shift: true });
342
-
343
- // Verify focus events were called if handlers provided
344
- if (args.onFocus) {
345
- await waitFor(() => {
346
- expect(args.onFocus).toHaveBeenCalled();
347
- });
348
- }
349
- }
350
- },
351
- };
352
-
353
- // Responsive Design Test
354
- export const ResponsiveDesign: Story = {
355
- args: {
356
- items: sampleItems,
357
- showArrows: true,
358
- showIndicators: true,
359
- width: '100%',
360
- height: 400,
361
- onFocus: fn(),
362
- onBlur: fn(),
363
- onClick: fn(),
364
- onChange: fn(),
365
- },
366
- parameters: {
367
- viewport: {
368
- viewports: {
369
- mobile: { name: 'Mobile', styles: { width: '360px', height: '640px' } },
370
- tablet: { name: 'Tablet', styles: { width: '768px', height: '1024px' } },
371
- desktop: { name: 'Desktop', styles: { width: '1440px', height: '900px' } },
372
- },
373
- },
374
- },
375
- play: async ({ canvasElement }) => {
376
- const canvas = within(canvasElement);
377
-
378
- await waitFor(() => {
379
- expect(canvas.getByText('Slide 1')).toBeInTheDocument();
380
- });
381
-
382
- // Test that carousel adapts to container width
383
- const carousel = canvasElement.querySelector('[class*="MuiBox-root"]');
384
- if (carousel) {
385
- const styles = window.getComputedStyle(carousel);
386
- expect(styles.width).toBeTruthy();
387
-
388
- // Verify responsive behavior
389
- expect(carousel.clientWidth).toBeLessThanOrEqual(window.innerWidth);
390
- }
391
- },
392
- };
393
-
394
- // Theme Variations Test
395
- export const ThemeVariations: Story = {
396
- args: {
397
- items: sampleItems.slice(0, 2),
398
- variant: 'glass',
399
- color: 'primary',
400
- glow: true,
401
- glass: true,
402
- showArrows: true,
403
- showIndicators: true,
404
- width: 600,
405
- height: 400,
406
- onFocus: fn(),
407
- onBlur: fn(),
408
- onClick: fn(),
409
- onChange: fn(),
410
- },
411
- play: async ({ canvasElement }) => {
412
- const canvas = within(canvasElement);
413
-
414
- await waitFor(() => {
415
- expect(canvas.getByText('Slide 1')).toBeInTheDocument();
416
- });
417
-
418
- // Test glass effect styles
419
- const carousel = canvasElement.querySelector('[class*="MuiBox-root"]');
420
- if (carousel) {
421
- const styles = window.getComputedStyle(carousel);
422
-
423
- // Glass effect should have backdrop filter
424
- expect(styles.backdropFilter || styles.webkitBackdropFilter).toBeTruthy();
425
-
426
- // Glow effect should have box shadow
427
- if (styles.boxShadow && styles.boxShadow !== 'none') {
428
- expect(styles.boxShadow).toContain('rgb');
429
- }
430
- }
431
- },
432
- };
433
-
434
- // Visual States Test
435
- export const VisualStates: Story = {
436
- args: {
437
- items: sampleItems,
438
- variant: 'elevated',
439
- showArrows: true,
440
- showIndicators: true,
441
- width: 600,
442
- height: 400,
443
- onFocus: fn(),
444
- onBlur: fn(),
445
- onClick: fn(),
446
- onChange: fn(),
447
- },
448
- play: async ({ canvasElement }) => {
449
- const canvas = within(canvasElement);
450
-
451
- await waitFor(() => {
452
- expect(canvas.getByText('Slide 1')).toBeInTheDocument();
453
- });
454
-
455
- // Test hover states on arrows
456
- const nextButton = canvas
457
- .getAllByRole('button')
458
- .find((btn) => btn.querySelector('[data-testid="ArrowForwardIosIcon"]'));
459
-
460
- if (nextButton) {
461
- const initialOpacity = window.getComputedStyle(nextButton).opacity;
462
-
463
- await userEvent.hover(nextButton);
464
- await waitFor(() => {
465
- const hoverOpacity = window.getComputedStyle(nextButton).opacity;
466
- // Opacity should change on hover for overlay arrows
467
- expect(parseFloat(hoverOpacity)).toBeGreaterThanOrEqual(parseFloat(initialOpacity));
468
- });
469
-
470
- await userEvent.unhover(nextButton);
471
- }
472
-
473
- // Test disabled state
474
- const prevButton = canvas
475
- .getAllByRole('button')
476
- .find((btn) => btn.querySelector('[data-testid="ArrowBackIosIcon"]'));
477
-
478
- if (prevButton && prevButton.hasAttribute('disabled')) {
479
- expect(prevButton).toBeDisabled();
480
- const styles = window.getComputedStyle(prevButton);
481
- expect(parseFloat(styles.opacity)).toBeLessThan(1);
482
- }
483
- },
484
- };
485
-
486
- // Performance Test
487
- export const Performance: Story = {
488
- args: {
489
- items: Array.from({ length: 20 }, (_, i) => ({
490
- id: `${i + 1}`,
491
- title: `Slide ${i + 1}`,
492
- description: `Description for slide ${i + 1}`,
493
- content: <div>Content {i + 1}</div>,
494
- image: sampleItems[i % 4].image, // Reuse sample images
495
- alt: `Slide ${i + 1} image`,
496
- })),
497
- autoPlay: true,
498
- autoPlayInterval: 2000,
499
- showIndicators: true,
500
- showArrows: true,
501
- width: 600,
502
- height: 400,
503
- onFocus: fn(),
504
- onBlur: fn(),
505
- onClick: fn(),
506
- onChange: fn(),
507
- },
508
- play: async ({ canvasElement }) => {
509
- const canvas = within(canvasElement);
510
-
511
- const startTime = window.performance.now();
512
-
513
- await waitFor(() => {
514
- expect(canvas.getByText('Slide 1')).toBeInTheDocument();
515
- });
516
-
517
- const renderTime = window.performance.now() - startTime;
518
-
519
- // Carousel should render quickly even with many items
520
- expect(renderTime).toBeLessThan(2000);
521
-
522
- // Test smooth transitions
523
- const nextButton = canvas
524
- .getAllByRole('button')
525
- .find((btn) => btn.querySelector('[data-testid="ArrowForwardIosIcon"]'));
526
-
527
- if (nextButton) {
528
- const transitionStart = window.performance.now();
529
- await userEvent.click(nextButton);
530
-
531
- await waitFor(() => {
532
- expect(canvas.getByText('Slide 2')).toBeVisible();
533
- });
534
-
535
- const transitionTime = window.performance.now() - transitionStart;
536
- // Transition should be smooth and complete within reasonable time
537
- expect(transitionTime).toBeLessThan(1500);
538
- }
539
- },
540
- };
541
-
542
- // Edge Cases Test
543
- export const EdgeCases: Story = {
544
- args: {
545
- items: [
546
- {
547
- id: '1',
548
- title:
549
- 'Very Long Title That Should Be Handled Gracefully Without Breaking The Layout Even When It Is Extremely Long',
550
- description:
551
- '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.',
552
- content: <div>Content with very long text</div>,
553
- },
554
- {
555
- id: '2',
556
- title: '',
557
- description: '',
558
- content: <div>Slide with no title or description</div>,
559
- },
560
- {
561
- id: '3',
562
- title: 'Slide without image',
563
- description: 'This slide has no image property',
564
- content: <div>Text only content</div>,
565
- },
566
- ],
567
- loop: false,
568
- showArrows: true,
569
- showIndicators: true,
570
- width: 600,
571
- height: 400,
572
- onFocus: fn(),
573
- onBlur: fn(),
574
- onClick: fn(),
575
- onChange: fn(),
576
- },
577
- play: async ({ canvasElement }) => {
578
- const canvas = within(canvasElement);
579
-
580
- await waitFor(() => {
581
- const longTitle = canvasElement.querySelector('h5');
582
- expect(longTitle).toBeInTheDocument();
583
- });
584
-
585
- // Test non-loop behavior at boundaries
586
- const prevButton = canvas
587
- .getAllByRole('button')
588
- .find((btn) => btn.querySelector('[data-testid="ArrowBackIosIcon"]'));
589
-
590
- // At first slide, previous should be disabled when loop is false
591
- if (prevButton) {
592
- // Note: Component may need to implement this logic
593
- // This test documents expected behavior
594
- }
595
-
596
- // Navigate to last slide
597
- const nextButton = canvas
598
- .getAllByRole('button')
599
- .find((btn) => btn.querySelector('[data-testid="ArrowForwardIosIcon"]'));
600
-
601
- if (nextButton && !nextButton.hasAttribute('disabled')) {
602
- await userEvent.click(nextButton);
603
- // Wait for transition
604
- await waitFor(() => {
605
- expect(canvas.queryByText('Slide without image')).toBeInTheDocument();
606
- });
607
-
608
- // Try to click again if not disabled
609
- if (!nextButton.hasAttribute('disabled')) {
610
- await userEvent.click(nextButton);
611
- }
612
-
613
- // At last slide, next should be disabled when loop is false
614
- // Note: Component may need to implement this logic
615
- }
616
-
617
- // Test empty content handling
618
- expect(canvas.getByText('Slide with no title or description')).toBeInTheDocument();
619
- },
620
- };
621
-
622
- // Integration Test
623
- export const Integration: Story = {
624
- args: {
625
- items: sampleItems,
626
- variant: 'cards',
627
- showArrows: true,
628
- showIndicators: true,
629
- showThumbnails: true,
630
- autoPlay: true,
631
- autoPlayInterval: 3000,
632
- pauseOnHover: true,
633
- onClick: fn(),
634
- onChange: fn(),
635
- onFocus: fn(),
636
- onBlur: fn(),
637
- width: 700,
638
- height: 450,
639
- },
640
- play: async ({ canvasElement, args }) => {
641
- const canvas = within(canvasElement);
642
-
643
- await waitFor(() => {
644
- expect(canvas.getByText('Slide 1')).toBeInTheDocument();
645
- });
646
-
647
- // Test onClick callback
648
- const firstSlide = canvas.getByText('Slide 1').closest('div');
649
- if (firstSlide) {
650
- await userEvent.click(firstSlide);
651
-
652
- if (args.onClick) {
653
- await waitFor(() => {
654
- expect(args.onClick).toHaveBeenCalledWith(expect.objectContaining({ id: '1' }), 0);
655
- });
656
- }
657
- }
658
-
659
- // Test onChange callback
660
- const nextButton = canvas
661
- .getAllByRole('button')
662
- .find((btn) => btn.querySelector('[data-testid="ArrowForwardIosIcon"]'));
663
-
664
- if (nextButton) {
665
- await userEvent.click(nextButton);
666
-
667
- if (args.onChange) {
668
- await waitFor(() => {
669
- expect(args.onChange).toHaveBeenCalledWith(1);
670
- });
671
- }
672
- }
673
-
674
- // Test integration of multiple features
675
- const indicators = canvas
676
- .getAllByRole('button')
677
- .filter((btn) => btn.querySelector('[data-testid="FiberManualRecordIcon"]'));
678
-
679
- if (indicators.length > 2) {
680
- await userEvent.click(indicators[2]);
681
-
682
- await waitFor(() => {
683
- expect(canvas.getByText('Slide 3')).toBeVisible();
684
- });
685
-
686
- if (args.onChange) {
687
- expect(args.onChange).toHaveBeenCalledWith(2);
688
- }
689
- }
690
- },
691
- };