@shohojdhara/atomix 0.3.14 → 0.4.0

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 (343) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/build-tools/EXAMPLES.md +372 -0
  3. package/build-tools/README.md +242 -0
  4. package/build-tools/__tests__/error-handler.test.js +230 -0
  5. package/build-tools/__tests__/index.test.js +141 -0
  6. package/build-tools/__tests__/rollup-plugin.test.js +194 -0
  7. package/build-tools/__tests__/utils.test.js +161 -0
  8. package/build-tools/__tests__/vite-plugin.test.js +129 -0
  9. package/build-tools/__tests__/webpack-loader.test.js +190 -0
  10. package/build-tools/error-handler.js +308 -0
  11. package/build-tools/index.d.ts +44 -0
  12. package/build-tools/index.js +88 -0
  13. package/build-tools/package.json +50 -0
  14. package/build-tools/rollup-plugin.js +236 -0
  15. package/build-tools/types.d.ts +163 -0
  16. package/build-tools/utils.js +203 -0
  17. package/build-tools/vite-plugin.js +161 -0
  18. package/build-tools/webpack-loader.js +123 -0
  19. package/dist/atomix.css +21044 -2618
  20. package/dist/atomix.css.map +1 -1
  21. package/dist/atomix.min.css +77 -3
  22. package/dist/atomix.min.css.map +1 -1
  23. package/dist/build-tools/EXAMPLES.md +372 -0
  24. package/dist/build-tools/README.md +242 -0
  25. package/dist/build-tools/__tests__/error-handler.test.js +230 -0
  26. package/dist/build-tools/__tests__/index.test.js +141 -0
  27. package/dist/build-tools/__tests__/rollup-plugin.test.js +194 -0
  28. package/dist/build-tools/__tests__/utils.test.js +161 -0
  29. package/dist/build-tools/__tests__/vite-plugin.test.js +129 -0
  30. package/dist/build-tools/__tests__/webpack-loader.test.js +190 -0
  31. package/dist/build-tools/error-handler.js +308 -0
  32. package/dist/build-tools/index.d.ts +44 -0
  33. package/dist/build-tools/index.js +88 -0
  34. package/dist/build-tools/package.json +50 -0
  35. package/dist/build-tools/rollup-plugin.js +236 -0
  36. package/dist/build-tools/types.d.ts +163 -0
  37. package/dist/build-tools/utils.js +203 -0
  38. package/dist/build-tools/vite-plugin.js +161 -0
  39. package/dist/build-tools/webpack-loader.js +123 -0
  40. package/dist/charts.d.ts +1 -1
  41. package/dist/charts.js +86 -57
  42. package/dist/charts.js.map +1 -1
  43. package/dist/core.d.ts +1 -1
  44. package/dist/core.js +136 -112
  45. package/dist/core.js.map +1 -1
  46. package/dist/forms.d.ts +2 -5
  47. package/dist/forms.js +140 -128
  48. package/dist/forms.js.map +1 -1
  49. package/dist/heavy.d.ts +1 -1
  50. package/dist/heavy.js +136 -112
  51. package/dist/heavy.js.map +1 -1
  52. package/dist/index.d.ts +152 -78
  53. package/dist/index.esm.js +346 -340
  54. package/dist/index.esm.js.map +1 -1
  55. package/dist/index.js +359 -353
  56. package/dist/index.js.map +1 -1
  57. package/dist/index.min.js +1 -1
  58. package/dist/index.min.js.map +1 -1
  59. package/dist/layout.js.map +1 -1
  60. package/dist/theme.d.ts +9 -9
  61. package/dist/theme.js.map +1 -1
  62. package/package.json +23 -8
  63. package/scripts/atomix-cli.js +170 -73
  64. package/scripts/cli/__tests__/README.md +81 -0
  65. package/scripts/cli/__tests__/basic.test.js +115 -0
  66. package/scripts/cli/__tests__/component-generator.test.js +332 -0
  67. package/scripts/cli/__tests__/integration.test.js +327 -0
  68. package/scripts/cli/__tests__/test-setup.js +133 -0
  69. package/scripts/cli/__tests__/token-manager.test.js +251 -0
  70. package/scripts/cli/__tests__/utils.test.js +161 -0
  71. package/scripts/cli/component-generator.js +253 -299
  72. package/scripts/cli/dependency-checker.js +355 -0
  73. package/scripts/cli/interactive-init.js +46 -5
  74. package/scripts/cli/template-manager.js +0 -2
  75. package/scripts/cli/templates/common-templates.js +636 -0
  76. package/scripts/cli/templates/composable-templates.js +148 -126
  77. package/scripts/cli/templates/index.js +23 -16
  78. package/scripts/cli/templates/project-templates.js +151 -23
  79. package/scripts/cli/templates/react-templates.js +280 -210
  80. package/scripts/cli/templates/scss-templates.js +90 -91
  81. package/scripts/cli/templates/testing-templates.js +206 -27
  82. package/scripts/cli/templates/testing-utils.js +278 -0
  83. package/scripts/cli/templates/types-templates.js +70 -56
  84. package/scripts/cli/theme-bridge.js +8 -2
  85. package/scripts/cli/token-manager.js +318 -206
  86. package/scripts/cli/utils.js +0 -1
  87. package/src/components/Accordion/Accordion.stories.tsx +358 -850
  88. package/src/components/Accordion/Accordion.test.tsx +70 -50
  89. package/src/components/Accordion/Accordion.tsx +99 -94
  90. package/src/components/AtomixGlass/AtomixGlass.test.tsx +1 -1
  91. package/src/components/AtomixGlass/AtomixGlass.tsx +80 -39
  92. package/src/components/AtomixGlass/AtomixGlassContainer.tsx +103 -81
  93. package/src/components/AtomixGlass/GlassFilter.tsx +9 -16
  94. package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +8 -7
  95. package/src/components/AtomixGlass/glass-utils.ts +6 -5
  96. package/src/components/AtomixGlass/shader-utils.ts +133 -52
  97. package/src/components/AtomixGlass/stories/Customization.stories.tsx +131 -0
  98. package/src/components/AtomixGlass/stories/Examples.stories.tsx +2957 -2853
  99. package/src/components/AtomixGlass/stories/Modes.stories.tsx +1 -1
  100. package/src/components/AtomixGlass/stories/Overview.stories.tsx +348 -0
  101. package/src/components/AtomixGlass/stories/Performance.stories.tsx +103 -0
  102. package/src/components/AtomixGlass/stories/Playground.stories.tsx +51 -36
  103. package/src/components/AtomixGlass/stories/{ShaderVariants.stories.tsx → Shaders.stories.tsx} +2 -2
  104. package/src/components/AtomixGlass/stories/shared-components.tsx +90 -190
  105. package/src/components/Avatar/Avatar.stories.tsx +195 -0
  106. package/src/components/Avatar/Avatar.tsx +58 -56
  107. package/src/components/Badge/Badge.stories.tsx +122 -352
  108. package/src/components/Badge/Badge.test.tsx +41 -41
  109. package/src/components/Badge/Badge.tsx +64 -62
  110. package/src/components/Block/Block.stories.tsx +30 -11
  111. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +142 -23
  112. package/src/components/Breadcrumb/Breadcrumb.tsx +62 -60
  113. package/src/components/Button/Button.stories.tsx +454 -1126
  114. package/src/components/Button/Button.test.tsx +123 -0
  115. package/src/components/Button/Button.tsx +88 -60
  116. package/src/components/Button/ButtonGroup.stories.tsx +376 -215
  117. package/src/components/Button/ButtonGroup.tsx +4 -15
  118. package/src/components/Callout/Callout.stories.tsx +316 -568
  119. package/src/components/Card/Card.stories.tsx +292 -81
  120. package/src/components/Card/Card.tsx +30 -14
  121. package/src/components/Chart/AreaChart.tsx +1 -1
  122. package/src/components/Chart/CandlestickChart.tsx +23 -16
  123. package/src/components/Chart/Chart.stories.tsx +153 -16
  124. package/src/components/Chart/Chart.tsx +40 -44
  125. package/src/components/Chart/ChartRenderer.tsx +39 -12
  126. package/src/components/Chart/ChartToolbar.tsx +21 -5
  127. package/src/components/Chart/DonutChart.tsx +1 -1
  128. package/src/components/Chart/FunnelChart.tsx +4 -1
  129. package/src/components/Chart/GaugeChart.tsx +3 -1
  130. package/src/components/Chart/HeatmapChart.tsx +50 -37
  131. package/src/components/Chart/LineChart.tsx +3 -2
  132. package/src/components/Chart/MultiAxisChart.tsx +24 -16
  133. package/src/components/Chart/RadarChart.tsx +19 -17
  134. package/src/components/Chart/ScatterChart.tsx +29 -21
  135. package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +152 -66
  136. package/src/components/ColorModeToggle/ColorModeToggle.tsx +15 -3
  137. package/src/components/Countdown/Countdown.stories.tsx +114 -7
  138. package/src/components/DataTable/DataTable.stories.tsx +349 -144
  139. package/src/components/DataTable/DataTable.test.tsx +26 -148
  140. package/src/components/DataTable/DataTable.tsx +485 -456
  141. package/src/components/DatePicker/DatePicker.stories.tsx +310 -1066
  142. package/src/components/DatePicker/DatePicker.tsx +31 -26
  143. package/src/components/Dropdown/Dropdown.stories.tsx +153 -36
  144. package/src/components/Dropdown/Dropdown.tsx +313 -299
  145. package/src/components/EdgePanel/EdgePanel.stories.tsx +221 -25
  146. package/src/components/EdgePanel/EdgePanel.tsx +1 -3
  147. package/src/components/Footer/Footer.stories.tsx +396 -327
  148. package/src/components/Footer/Footer.tsx +130 -128
  149. package/src/components/Footer/FooterLink.tsx +2 -2
  150. package/src/components/Form/Checkbox.stories.tsx +140 -6
  151. package/src/components/Form/Checkbox.test.tsx +63 -0
  152. package/src/components/Form/Checkbox.tsx +122 -78
  153. package/src/components/Form/Form.stories.tsx +110 -19
  154. package/src/components/Form/FormGroup.stories.tsx +127 -4
  155. package/src/components/Form/Input.stories.tsx +22 -39
  156. package/src/components/Form/Input.test.tsx +38 -44
  157. package/src/components/Form/Radio.stories.tsx +146 -17
  158. package/src/components/Form/Radio.tsx +68 -66
  159. package/src/components/Form/Select.stories.tsx +140 -8
  160. package/src/components/Form/Select.tsx +184 -182
  161. package/src/components/Form/Textarea.stories.tsx +149 -6
  162. package/src/components/Form/Textarea.test.tsx +27 -32
  163. package/src/components/Hero/Hero.stories.tsx +372 -38
  164. package/src/components/Hero/Hero.tsx +201 -55
  165. package/src/components/Icon/index.ts +7 -1
  166. package/src/components/List/List.stories.tsx +141 -3
  167. package/src/components/List/List.tsx +19 -23
  168. package/src/components/Modal/Modal.stories.tsx +183 -43
  169. package/src/components/Modal/Modal.tsx +130 -127
  170. package/src/components/Navigation/Menu/MegaMenu.tsx +70 -70
  171. package/src/components/Navigation/Nav/NavDropdown.tsx +1 -5
  172. package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +128 -28
  173. package/src/components/Navigation/SideMenu/SideMenu.tsx +5 -7
  174. package/src/components/Navigation/SideMenu/SideMenuItem.tsx +4 -5
  175. package/src/components/Pagination/Pagination.stories.tsx +7 -4
  176. package/src/components/Pagination/Pagination.tsx +199 -202
  177. package/src/components/PhotoViewer/PhotoViewer.tsx +4 -1
  178. package/src/components/Popover/Popover.stories.tsx +354 -97
  179. package/src/components/Popover/Popover.tsx +41 -37
  180. package/src/components/Progress/Progress.stories.tsx +160 -7
  181. package/src/components/River/River.stories.tsx +3 -2
  182. package/src/components/SectionIntro/SectionIntro.stories.tsx +239 -47
  183. package/src/components/Slider/Slider.stories.tsx +12 -4
  184. package/src/components/Spinner/Spinner.stories.tsx +104 -8
  185. package/src/components/Spinner/Spinner.test.tsx +23 -23
  186. package/src/components/Spinner/Spinner.tsx +43 -46
  187. package/src/components/Steps/Steps.stories.tsx +173 -42
  188. package/src/components/Tabs/Tabs.stories.tsx +141 -12
  189. package/src/components/Tabs/Tabs.tsx +74 -72
  190. package/src/components/Testimonial/Testimonial.stories.tsx +120 -3
  191. package/src/components/Todo/Todo.stories.tsx +198 -9
  192. package/src/components/Toggle/Toggle.stories.tsx +137 -36
  193. package/src/components/Toggle/Toggle.test.tsx +65 -70
  194. package/src/components/Toggle/Toggle.tsx +4 -1
  195. package/src/components/Tooltip/Tooltip.stories.tsx +194 -100
  196. package/src/components/Tooltip/Tooltip.tsx +104 -106
  197. package/src/components/Upload/Upload.stories.tsx +241 -150
  198. package/src/components/Upload/Upload.tsx +287 -283
  199. package/src/components/VideoPlayer/VideoPlayer.tsx +6 -1
  200. package/src/components/index.ts +13 -2
  201. package/src/layouts/Grid/Grid.stories.tsx +9 -3
  202. package/src/layouts/MasonryGrid/MasonryGrid.tsx +5 -1
  203. package/src/lib/README.md +2 -2
  204. package/src/lib/__tests__/theme-tools.test.ts +219 -0
  205. package/src/lib/composables/index.ts +2 -2
  206. package/src/lib/composables/shared-mouse-tracker.ts +13 -14
  207. package/src/lib/composables/useAtomixGlass.ts +126 -97
  208. package/src/lib/composables/useChartExport.ts +3 -8
  209. package/src/lib/composables/useDataTable.ts +72 -43
  210. package/src/lib/composables/useHero.ts +58 -14
  211. package/src/lib/composables/useHeroBackgroundSlider.ts +2 -9
  212. package/src/lib/composables/useInput.ts +10 -8
  213. package/src/lib/composables/useSideMenu.ts +6 -5
  214. package/src/lib/composables/useTooltip.ts +1 -2
  215. package/src/lib/composables/useVideoPlayer.ts +44 -35
  216. package/src/lib/config/index.ts +154 -154
  217. package/src/lib/constants/components.ts +9 -32
  218. package/src/lib/constants/cssVariables.ts +29 -29
  219. package/src/lib/hooks/__tests__/useComponentCustomization.test.ts +2 -6
  220. package/src/lib/hooks/index.ts +1 -1
  221. package/src/lib/hooks/useComponentCustomization.ts +11 -17
  222. package/src/lib/hooks/usePerformanceMonitor.ts +6 -7
  223. package/src/lib/patterns/__tests__/slots.test.ts +1 -1
  224. package/src/lib/patterns/index.ts +1 -1
  225. package/src/lib/patterns/slots.tsx +8 -13
  226. package/src/lib/storybook/InteractiveDemo.tsx +13 -18
  227. package/src/lib/storybook/PreviewContainer.tsx +1 -1
  228. package/src/lib/storybook/VariantsGrid.tsx +3 -7
  229. package/src/lib/storybook/index.ts +1 -1
  230. package/src/lib/theme/adapters/cssVariableMapper.ts +47 -74
  231. package/src/lib/theme/adapters/index.ts +3 -9
  232. package/src/lib/theme/adapters/themeAdapter.ts +41 -26
  233. package/src/lib/theme/config/index.ts +1 -1
  234. package/src/lib/theme/config/types.ts +2 -2
  235. package/src/lib/theme/config/validator.ts +10 -5
  236. package/src/lib/theme/constants/constants.ts +2 -2
  237. package/src/lib/theme/constants/index.ts +1 -2
  238. package/src/lib/theme/core/__tests__/createTheme.test.ts +20 -22
  239. package/src/lib/theme/core/composeTheme.ts +32 -26
  240. package/src/lib/theme/core/createTheme.ts +1 -1
  241. package/src/lib/theme/core/createThemeObject.ts +308 -301
  242. package/src/lib/theme/core/index.ts +3 -3
  243. package/src/lib/theme/devtools/CLI.ts +107 -105
  244. package/src/lib/theme/devtools/Comparator.tsx +50 -32
  245. package/src/lib/theme/devtools/DesignTokensCustomizer.stories.tsx +50 -48
  246. package/src/lib/theme/devtools/DesignTokensCustomizer.tsx +257 -63
  247. package/src/lib/theme/devtools/Inspector.tsx +75 -60
  248. package/src/lib/theme/devtools/LiveEditor.tsx +97 -76
  249. package/src/lib/theme/devtools/Preview.tsx +150 -106
  250. package/src/lib/theme/devtools/ThemeValidator.ts +29 -21
  251. package/src/lib/theme/devtools/index.ts +3 -9
  252. package/src/lib/theme/devtools/useHistory.ts +23 -21
  253. package/src/lib/theme/errors/errors.ts +12 -11
  254. package/src/lib/theme/errors/index.ts +2 -7
  255. package/src/lib/theme/generators/generateCSS.ts +9 -13
  256. package/src/lib/theme/generators/generateCSSNested.ts +1 -6
  257. package/src/lib/theme/generators/generateCSSVariables.ts +673 -630
  258. package/src/lib/theme/generators/index.ts +1 -4
  259. package/src/lib/theme/i18n/index.ts +1 -1
  260. package/src/lib/theme/i18n/rtl.ts +13 -13
  261. package/src/lib/theme/index.ts +7 -16
  262. package/src/lib/theme/runtime/ThemeApplicator.ts +4 -4
  263. package/src/lib/theme/runtime/ThemeContext.tsx +1 -1
  264. package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +19 -23
  265. package/src/lib/theme/runtime/ThemeProvider.tsx +230 -239
  266. package/src/lib/theme/runtime/__tests__/ThemeProvider.integration.test.tsx +1 -1
  267. package/src/lib/theme/runtime/__tests__/ThemeProvider.test.tsx +24 -29
  268. package/src/lib/theme/runtime/index.ts +2 -5
  269. package/src/lib/theme/runtime/useTheme.ts +18 -18
  270. package/src/lib/theme/runtime/useThemeTokens.ts +22 -22
  271. package/src/lib/theme/test/testTheme.ts +15 -16
  272. package/src/lib/theme/tokens/index.ts +2 -7
  273. package/src/lib/theme/tokens/tokens.ts +25 -24
  274. package/src/lib/theme/types.ts +428 -411
  275. package/src/lib/theme/utils/__tests__/themeValidation.test.ts +3 -3
  276. package/src/lib/theme/utils/componentTheming.ts +18 -18
  277. package/src/lib/theme/utils/domUtils.ts +277 -289
  278. package/src/lib/theme/utils/index.ts +1 -2
  279. package/src/lib/theme/utils/injectCSS.ts +10 -14
  280. package/src/lib/theme/utils/naming.ts +20 -16
  281. package/src/lib/theme/utils/themeHelpers.ts +10 -12
  282. package/src/lib/theme/utils/themeUtils.ts +85 -86
  283. package/src/lib/theme/utils/themeValidation.ts +82 -33
  284. package/src/lib/theme-tools.ts +8 -6
  285. package/src/lib/types/components.ts +172 -71
  286. package/src/lib/types/partProps.ts +1 -1
  287. package/src/lib/utils/__tests__/csv.test.ts +45 -0
  288. package/src/lib/utils/componentUtils.ts +8 -12
  289. package/src/lib/utils/csv.ts +19 -0
  290. package/src/lib/utils/dataTableExport.ts +2 -15
  291. package/src/lib/utils/fontPreloader.ts +10 -19
  292. package/src/lib/utils/icons.ts +4 -1
  293. package/src/lib/utils/index.ts +2 -6
  294. package/src/lib/utils/memoryMonitor.ts +10 -8
  295. package/src/lib/utils/themeNaming.ts +2 -2
  296. package/src/styles/01-settings/_index.scss +1 -1
  297. package/src/styles/01-settings/_settings.accordion.scss +28 -7
  298. package/src/styles/01-settings/_settings.colors.scss +11 -11
  299. package/src/styles/01-settings/_settings.design-tokens.scss +61 -50
  300. package/src/styles/01-settings/_settings.navbar.scss +1 -1
  301. package/src/styles/01-settings/_settings.spacing.scss +3 -4
  302. package/src/styles/01-settings/_settings.tooltip.scss +1 -1
  303. package/src/styles/01-settings/_settings.typography.scss +4 -4
  304. package/src/styles/02-tools/_tools.button.scss +51 -21
  305. package/src/styles/02-tools/_tools.utility-api.scss +38 -12
  306. package/src/styles/03-generic/_generic.root.scss +4 -3
  307. package/src/styles/06-components/_components.accordion.scss +56 -14
  308. package/src/styles/06-components/_components.atomix-glass.scss +13 -9
  309. package/src/styles/06-components/_components.button.scss +16 -4
  310. package/src/styles/06-components/_components.callout.scss +27 -21
  311. package/src/styles/06-components/_components.card.scss +5 -14
  312. package/src/styles/06-components/_components.chart.scss +22 -19
  313. package/src/styles/06-components/_components.checkbox.scss +25 -17
  314. package/src/styles/06-components/_components.color-mode-toggle.scss +3 -1
  315. package/src/styles/06-components/_components.edge-panel.scss +9 -2
  316. package/src/styles/06-components/_components.footer.scss +1 -1
  317. package/src/styles/06-components/_components.side-menu.scss +5 -5
  318. package/src/styles/06-components/_components.toggle.scss +18 -0
  319. package/src/styles/06-components/_index.scss +1 -1
  320. package/src/styles/06-components/old.chart.styles.scss +0 -2
  321. package/src/styles/99-utilities/_index.scss +2 -0
  322. package/src/styles/99-utilities/_utilities.border.scss +69 -27
  323. package/src/styles/99-utilities/_utilities.display.scss +1 -1
  324. package/src/styles/99-utilities/_utilities.opacity.scss +10 -0
  325. package/src/styles/99-utilities/_utilities.position.scss +16 -9
  326. package/src/styles/99-utilities/_utilities.scss +2 -0
  327. package/src/styles/99-utilities/_utilities.sizes.scss +47 -18
  328. package/src/styles/99-utilities/_utilities.spacing.scss +118 -66
  329. package/src/styles/99-utilities/_utilities.text-gradient.scss +45 -0
  330. package/src/styles/99-utilities/_utilities.text.scss +67 -46
  331. package/themes/dark-complementary/README.md +98 -0
  332. package/themes/dark-complementary/index.scss +158 -0
  333. package/themes/default-light/README.md +81 -0
  334. package/themes/default-light/index.scss +154 -0
  335. package/themes/high-contrast/README.md +105 -0
  336. package/themes/high-contrast/index.scss +172 -0
  337. package/themes/test-theme/README.md +38 -0
  338. package/themes/test-theme/index.scss +47 -0
  339. package/scripts/cli/templates-original-backup.js +0 -1655
  340. package/scripts/cli/templates_backup.js +0 -684
  341. package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +0 -1438
  342. package/src/lib/composables/useButton.ts +0 -93
  343. package/src/lib/composables/useCheckbox.ts +0 -70
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
+ import { fn } from '@storybook/test';
3
4
  import { Accordion } from './Accordion';
4
5
  import { ACCORDION } from '../../lib/constants/components';
5
6
  import type { AtomixGlassProps } from '../../lib/types/components';
@@ -15,6 +16,125 @@ const BODY_CLASS = ACCORDION.SELECTORS.BODY.replace('.', '');
15
16
  const IS_OPEN_CLASS = ACCORDION.CLASSES.IS_OPEN;
16
17
  const IS_DISABLED_CLASS = ACCORDION.CLASSES.IS_DISABLED;
17
18
 
19
+ // ============================================================================
20
+ // SHARED UTILITIES & CONSTANTS
21
+ // ============================================================================
22
+
23
+ const mockHandlers = {
24
+ onOpenChange: fn(() => {}),
25
+ onOpen: fn(() => {}),
26
+ onClose: fn(() => {}),
27
+ };
28
+
29
+ // Sample content for stories
30
+ const sampleContent = (
31
+ <div>
32
+ <p>This accordion contains rich HTML content including headings, paragraphs, and lists.</p>
33
+ <ul>
34
+ <li>
35
+ List item with <a href="#">link</a>
36
+ </li>
37
+ <li>
38
+ List item with <strong>bold text</strong>
39
+ </li>
40
+ <li>
41
+ List item with <em>italic text</em>
42
+ </li>
43
+ </ul>
44
+ <div className="u-p-3 u-mt-3 u-bg-light u-border-radius-1">
45
+ <code>This is a code block inside the accordion</code>
46
+ </div>
47
+ </div>
48
+ );
49
+
50
+ // Component documentation
51
+ const accordionDocumentation = `
52
+ # Accordion
53
+
54
+ ## Overview
55
+
56
+ The Accordion component provides an expandable/collapsible container for content. It follows Atomix guidelines for accessibility, styling, and state management. The component supports both controlled and uncontrolled modes, custom icons, and full keyboard navigation.
57
+
58
+ ## Features
59
+
60
+ - Accessible with proper ARIA attributes
61
+ - Supports controlled and uncontrolled states
62
+ - Customizable icons and positioning
63
+ - Glass morphism effect support
64
+ - Keyboard navigation support
65
+ - Disabled state handling
66
+
67
+ ## Accessibility
68
+
69
+ - Keyboard support: Space/Enter to toggle accordion
70
+ - Screen reader: Proper ARIA labels and roles
71
+ - ARIA support: aria-expanded, aria-controls, aria-disabled
72
+ - Focus management: Maintains focus within component
73
+
74
+ ## Usage Examples
75
+
76
+ ### Basic Usage
77
+
78
+ \`\`\`tsx
79
+ <Accordion title="Section Title">
80
+ <p>Content goes here</p>
81
+ </Accordion>
82
+ \`\`\`
83
+
84
+ ### With Custom Icon
85
+
86
+ \`\`\`tsx
87
+ <Accordion
88
+ title="Custom Icon"
89
+ icon={<CustomIcon />}
90
+ >
91
+ <p>Content with custom icon</p>
92
+ </Accordion>
93
+ \`\`\`
94
+
95
+ ### Controlled State
96
+
97
+ \`\`\`tsx
98
+ <Accordion
99
+ title="Controlled Accordion"
100
+ isOpen={isOpen}
101
+ onOpenChange={setIsOpen}
102
+ >
103
+ <p>Controlled content</p>
104
+ </Accordion>
105
+ \`\`\`
106
+
107
+ ## API Reference
108
+
109
+ | Prop | Type | Default | Description |
110
+ | ---- | ---- | ------- | ----------- |
111
+ | title | string | - | Title of the accordion |
112
+ | children | ReactNode | - | Content to be shown when accordion is expanded |
113
+ | defaultOpen | boolean | false | Whether the accordion is initially open |
114
+ | iconPosition | 'right' \| 'left' | 'right' | Position of the icon |
115
+ | icon | ReactNode | - | Custom icon for the accordion |
116
+ | isOpen | boolean | - | Whether the accordion is open (controlled) |
117
+ | disabled | boolean | false | Whether the accordion is disabled |
118
+ | onOpenChange | (open: boolean) => void | - | Callback when open state changes |
119
+ | glass | AtomixGlassProps \| boolean | - | Glass morphism effect configuration |
120
+
121
+ ## Design Tokens
122
+
123
+ Used design tokens:
124
+
125
+ - \`--atomix-accordion-padding\`: Padding of the accordion
126
+ - \`--atomix-accordion-border\`: Border of the accordion
127
+ - \`--atomix-accordion-background\`: Background of the accordion
128
+
129
+ ## Notes
130
+
131
+ The Accordion component supports both controlled and uncontrolled usage patterns. Use [defaultOpen] for uncontrolled behavior and [isOpen]/[onOpenChange] for controlled behavior.
132
+ `;
133
+
134
+ // ============================================================================
135
+ // META CONFIGURATION
136
+ // ============================================================================
137
+
18
138
  const meta = {
19
139
  title: 'Components/Accordion',
20
140
  component: Accordion,
@@ -22,8 +142,7 @@ const meta = {
22
142
  layout: 'padded',
23
143
  docs: {
24
144
  description: {
25
- component:
26
- 'The Accordion component follows Atomix guidelines for accessibility, styling, and state. It supports both controlled and uncontrolled modes, custom icons, and full keyboard navigation.',
145
+ component: accordionDocumentation,
27
146
  },
28
147
  },
29
148
  },
@@ -33,28 +152,75 @@ const meta = {
33
152
  control: { type: 'radio' },
34
153
  options: ['right', 'left'],
35
154
  description: 'Position of the icon',
36
- defaultValue: 'right',
155
+ table: {
156
+ type: { summary: 'IconPosition' },
157
+ defaultValue: { summary: 'right' },
158
+ },
37
159
  },
38
160
  defaultOpen: {
39
161
  control: 'boolean',
40
162
  description: 'Whether the accordion is initially open',
41
- defaultValue: false,
163
+ table: {
164
+ type: { summary: 'boolean' },
165
+ defaultValue: { summary: 'false' },
166
+ },
42
167
  },
43
168
  disabled: {
44
169
  control: 'boolean',
45
170
  description: 'Whether the accordion is disabled',
171
+ table: {
172
+ type: { summary: 'boolean' },
173
+ defaultValue: { summary: 'false' },
174
+ },
46
175
  },
47
176
  title: {
48
177
  control: 'text',
49
178
  description: 'Title of the accordion',
179
+ table: {
180
+ type: { summary: 'string' },
181
+ },
50
182
  },
51
183
  children: {
52
184
  control: 'text',
53
185
  description: 'Content inside the accordion',
186
+ table: {
187
+ type: { summary: 'ReactNode' },
188
+ },
54
189
  },
55
190
  glass: {
56
- control: 'boolean',
191
+ control: 'object',
57
192
  description: 'Enable glass morphism effect',
193
+ table: {
194
+ type: { summary: 'AtomixGlassProps | boolean' },
195
+ },
196
+ },
197
+ isOpen: {
198
+ control: 'boolean',
199
+ description: 'Controlled open state of the accordion',
200
+ table: {
201
+ type: { summary: 'boolean' },
202
+ },
203
+ },
204
+ onOpenChange: {
205
+ action: 'onOpenChange',
206
+ description: 'Callback when the open state changes',
207
+ table: {
208
+ type: { summary: '(open: boolean) => void' },
209
+ },
210
+ },
211
+ onOpen: {
212
+ action: 'onOpen',
213
+ description: 'Callback when accordion opens',
214
+ table: {
215
+ type: { summary: '() => void' },
216
+ },
217
+ },
218
+ onClose: {
219
+ action: 'onClose',
220
+ description: 'Callback when accordion closes',
221
+ table: {
222
+ type: { summary: '() => void' },
223
+ },
58
224
  },
59
225
  },
60
226
  } satisfies Meta<typeof Accordion>;
@@ -62,53 +228,131 @@ const meta = {
62
228
  export default meta;
63
229
  type Story = StoryObj<typeof meta>;
64
230
 
65
- /**
66
- * Default accordion in closed state.
67
- */
68
- export const Default: Story = {
231
+ // ============================================================================
232
+ // BASIC USAGE STORIES
233
+ // ============================================================================
234
+
235
+ export const BasicUsage: Story = {
69
236
  args: {
70
237
  title: 'Accordion Title',
71
238
  children: <p>This is the content of the accordion that appears when expanded.</p>,
72
239
  },
240
+ parameters: {
241
+ docs: {
242
+ description: {
243
+ story: 'Basic usage of the Accordion component with minimal props.',
244
+ },
245
+ },
246
+ },
247
+ };
248
+
249
+ export const WithAllProps: Story = {
250
+ args: {
251
+ title: 'Fully Configured Accordion',
252
+ children: sampleContent,
253
+ defaultOpen: true,
254
+ iconPosition: 'left',
255
+ disabled: false,
256
+ onOpenChange: mockHandlers.onOpenChange,
257
+ onOpen: mockHandlers.onOpen,
258
+ onClose: mockHandlers.onClose,
259
+ },
260
+ parameters: {
261
+ docs: {
262
+ description: {
263
+ story: 'Accordion with all major props configured.',
264
+ },
265
+ },
266
+ },
267
+ };
268
+
269
+ // ============================================================================
270
+ // VARIANTS & STATES STORIES
271
+ // ============================================================================
272
+
273
+ export const DefaultState: Story = {
274
+ args: {
275
+ title: 'Default Accordion',
276
+ children: <p>This is the default state of the accordion.</p>,
277
+ },
278
+ parameters: {
279
+ docs: {
280
+ description: {
281
+ story: 'Accordion in its default, closed state.',
282
+ },
283
+ },
284
+ },
73
285
  };
74
286
 
75
- /**
76
- * Accordion in open state by default.
77
- */
78
- export const Open: Story = {
287
+ export const OpenState: Story = {
79
288
  args: {
80
289
  title: 'Open Accordion',
81
290
  children: <p>This accordion is open, showing its content.</p>,
82
291
  defaultOpen: true,
83
292
  },
293
+ parameters: {
294
+ docs: {
295
+ description: {
296
+ story: 'Accordion in the open state by default.',
297
+ },
298
+ },
299
+ },
84
300
  };
85
301
 
86
- /**
87
- * Disabled accordion - non-interactive state.
88
- */
89
- export const Disabled: Story = {
302
+ export const DisabledState: Story = {
90
303
  args: {
91
304
  title: 'Disabled Accordion',
92
- children: <p>This accordion is disabled.</p>,
305
+ children: <p>This accordion is disabled and cannot be interacted with.</p>,
93
306
  disabled: true,
94
307
  },
308
+ parameters: {
309
+ docs: {
310
+ description: {
311
+ story: 'Accordion in the disabled state, non-interactive.',
312
+ },
313
+ },
314
+ },
95
315
  };
96
316
 
97
- /**
98
- * Accordion with icon positioned on the left side.
99
- */
100
- export const IconLeft: Story = {
317
+ export const LoadingState: Story = {
318
+ args: {
319
+ title: 'Loading Content',
320
+ children: (
321
+ <div>
322
+ <p>Loading content...</p>
323
+ <div className="c-spinner c-spinner--sm">Loading...</div>
324
+ </div>
325
+ ),
326
+ },
327
+ parameters: {
328
+ docs: {
329
+ description: {
330
+ story: 'Accordion showing loading state with spinner.',
331
+ },
332
+ },
333
+ },
334
+ };
335
+
336
+ // ============================================================================
337
+ // ICON CONFIGURATIONS
338
+ // ============================================================================
339
+
340
+ export const WithIconLeft: Story = {
101
341
  args: {
102
342
  title: 'Icon on Left',
103
- children: <p>This accordion has the icon on the left side.</p>,
343
+ children: <p>This accordion has the icon positioned on the left side.</p>,
104
344
  iconPosition: 'left',
105
345
  },
346
+ parameters: {
347
+ docs: {
348
+ description: {
349
+ story: 'Accordion with icon positioned on the left side.',
350
+ },
351
+ },
352
+ },
106
353
  };
107
354
 
108
- /**
109
- * Accordion with custom icon instead of default chevron.
110
- */
111
- export const CustomIcon: Story = {
355
+ export const WithCustomIcon: Story = {
112
356
  args: {
113
357
  title: 'Custom Icon',
114
358
  children: <p>This accordion uses a custom plus icon.</p>,
@@ -132,11 +376,63 @@ export const CustomIcon: Story = {
132
376
  </i>
133
377
  ),
134
378
  },
379
+ parameters: {
380
+ docs: {
381
+ description: {
382
+ story: 'Accordion with a custom icon instead of the default chevron.',
383
+ },
384
+ },
385
+ },
386
+ };
387
+
388
+ // ============================================================================
389
+ // ADVANCED CONFIGURATIONS
390
+ // ============================================================================
391
+
392
+ export const ControlledState: Story = {
393
+ args: {
394
+ title: 'Controlled Accordion',
395
+ children: <p>This accordion is controlled by external state.</p>,
396
+ },
397
+ render: args => {
398
+ const [open, setOpen] = React.useState(false);
399
+ return (
400
+ <div>
401
+ <button className="c-btn c-btn--primary u-mb-3" onClick={() => setOpen(prev => !prev)}>
402
+ Toggle Accordion (Controlled)
403
+ </button>
404
+ <Accordion {...args} isOpen={open} onOpenChange={setOpen} />
405
+ </div>
406
+ );
407
+ },
408
+ parameters: {
409
+ docs: {
410
+ description: {
411
+ story:
412
+ 'This story demonstrates a controlled Accordion using the `isOpen` and `onOpenChange` props.',
413
+ },
414
+ },
415
+ },
135
416
  };
136
417
 
137
- /**
138
- * Multiple accordions grouped together.
139
- */
418
+ export const WithRichContent: Story = {
419
+ args: {
420
+ title: 'Rich Content',
421
+ children: sampleContent,
422
+ },
423
+ parameters: {
424
+ docs: {
425
+ description: {
426
+ story: 'Accordion containing rich HTML content with headings, paragraphs, and lists.',
427
+ },
428
+ },
429
+ },
430
+ };
431
+
432
+ // ============================================================================
433
+ // INTEGRATION EXAMPLES
434
+ // ============================================================================
435
+
140
436
  export const AccordionGroup: Story = {
141
437
  args: {
142
438
  title: 'Accordion Group',
@@ -145,7 +441,7 @@ export const AccordionGroup: Story = {
145
441
  render: () => (
146
442
  <div>
147
443
  <h2>Accordion Group</h2>
148
- <div className="u-flex u-flex-column u-gap-3" style={{ width: '500px' }}>
444
+ <div className="u-flex u-flex-col u-gap-3 u-w-md">
149
445
  <Accordion title="First Accordion" defaultOpen={true}>
150
446
  <p>Content of the first accordion.</p>
151
447
  </Accordion>
@@ -166,148 +462,20 @@ export const AccordionGroup: Story = {
166
462
  </div>
167
463
  </div>
168
464
  ),
169
- };
170
-
171
- /**
172
- * Showcase of all accordion variants and states.
173
- */
174
- export const AllVariants: Story = {
175
- args: {
176
- title: 'All Variants',
177
- children: <p>See render function for all variants</p>,
178
- },
179
465
  parameters: {
180
466
  docs: {
181
467
  description: {
182
- story: 'Comprehensive showcase of all accordion variants including default, open, disabled, icon positions, and custom icons.',
468
+ story: 'Multiple accordions grouped together in a vertical layout.',
183
469
  },
184
470
  },
185
471
  },
186
- render: () => (
187
- <div>
188
- <h2>All Accordion Variants</h2>
189
- <div className="u-flex u-flex-column u-gap-5">
190
- <div>
191
- <h3>Default</h3>
192
- <Accordion title="Default Accordion">
193
- <p>This is the default accordion.</p>
194
- </Accordion>
195
- </div>
196
-
197
- <div>
198
- <h3>Initially Open</h3>
199
- <Accordion title="Initially Open Accordion" defaultOpen={true}>
200
- <p>This accordion starts in the open state.</p>
201
- </Accordion>
202
- </div>
203
-
204
- <div>
205
- <h3>Disabled</h3>
206
- <Accordion title="Disabled Accordion" disabled={true}>
207
- <p>This accordion is disabled and cannot be interacted with.</p>
208
- </Accordion>
209
- </div>
210
-
211
- <div>
212
- <h3>Icon on Left</h3>
213
- <Accordion title="Icon on Left" iconPosition="left">
214
- <p>This accordion has its icon positioned on the left.</p>
215
- </Accordion>
216
- </div>
217
-
218
- <div>
219
- <h3>Custom Icon</h3>
220
- <Accordion
221
- title="Custom Icon"
222
- icon={
223
- <i className="c-accordion__icon">
224
- <svg
225
- xmlns="http://www.w3.org/2000/svg"
226
- width="24"
227
- height="24"
228
- viewBox="0 0 24 24"
229
- fill="none"
230
- stroke="currentColor"
231
- strokeWidth="2"
232
- strokeLinecap="round"
233
- strokeLinejoin="round"
234
- >
235
- <circle cx="12" cy="12" r="10" />
236
- <line x1="12" y1="8" x2="12" y2="16" />
237
- <line x1="8" y1="12" x2="16" y2="12" />
238
- </svg>
239
- </i>
240
- }
241
- >
242
- <p>This accordion uses a custom plus icon.</p>
243
- </Accordion>
244
- </div>
245
-
246
- <div>
247
- <h3>With Rich Content</h3>
248
- <Accordion title="Rich Content">
249
- <div>
250
- <h4>Section Title</h4>
251
- <p>
252
- This accordion contains rich HTML content including headings, paragraphs, and lists.
253
- </p>
254
- <ul>
255
- <li>
256
- List item with <a href="#">link</a>
257
- </li>
258
- <li>
259
- List item with <strong>bold text</strong>
260
- </li>
261
- <li>
262
- List item with <em>italic text</em>
263
- </li>
264
- </ul>
265
- <div className="u-p-3 u-mt-3 u-bg-light u-border-radius-1">
266
- <code>This is a code block inside the accordion</code>
267
- </div>
268
- </div>
269
- </Accordion>
270
- </div>
271
- </div>
272
- </div>
273
- ),
274
472
  };
275
473
 
276
- /**
277
- * Controlled accordion using external state management.
278
- */
279
- export const Controlled: Story = {
280
- args: {
281
- title: 'Controlled Accordion',
282
- children: <p>This accordion is controlled by external state.</p>,
283
- },
284
- render: () => {
285
- const [open, setOpen] = React.useState(false);
286
- return (
287
- <div>
288
- <button className="c-btn c-btn--primary u-mb-3" onClick={() => setOpen(prev => !prev)}>
289
- Toggle Accordion (Controlled)
290
- </button>
291
- <Accordion title="Controlled Accordion" isOpen={open} onOpenChange={setOpen}>
292
- <p>This accordion is controlled by external state.</p>
293
- </Accordion>
294
- </div>
295
- );
296
- },
297
- parameters: {
298
- docs: {
299
- description: {
300
- story:
301
- 'This story demonstrates a controlled Accordion using the `isOpen` and `onOpenChange` props.',
302
- },
303
- },
304
- },
305
- };
474
+ // ============================================================================
475
+ // GLASS EFFECT STORIES
476
+ // ============================================================================
306
477
 
307
- /**
308
- * Accordion with glass morphism effect enabled.
309
- */
310
- export const Glass: Story = {
478
+ export const GlassEffect: Story = {
311
479
  args: {
312
480
  title: 'Glass Accordion',
313
481
  children: <p>This accordion has a glass morphism effect applied.</p>,
@@ -315,20 +483,13 @@ export const Glass: Story = {
315
483
  },
316
484
  render: args => (
317
485
  <div
486
+ className="u-bg-cover u-bg-center u-p-8 u-rounded-xl u-min-h-97vh u-flex u-items-center u-justify-center"
318
487
  style={{
319
- background:
488
+ backgroundImage:
320
489
  'url(https://images.unsplash.com/photo-1759915995309-404c743bfbf9?q=80&w=3270&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D)',
321
- backgroundSize: 'cover',
322
- backgroundPosition: 'center',
323
- padding: '2rem',
324
- borderRadius: '12px',
325
- height: '97vh',
326
- display: 'flex',
327
- alignItems: 'center',
328
- justifyContent: 'center',
329
490
  }}
330
491
  >
331
- <div style={{ width: '100%', maxWidth: '500px' }}>
492
+ <div className="u-w-full u-max-w-md">
332
493
  <Accordion {...args} />
333
494
  </div>
334
495
  </div>
@@ -343,9 +504,6 @@ export const Glass: Story = {
343
504
  },
344
505
  };
345
506
 
346
- /**
347
- * Accordion with custom glass morphism settings.
348
- */
349
507
  export const GlassCustom: Story = {
350
508
  args: {
351
509
  title: 'Custom Glass Accordion',
@@ -359,17 +517,11 @@ export const GlassCustom: Story = {
359
517
  },
360
518
  render: args => (
361
519
  <div
520
+ className="u-bg-cover u-bg-center u-p-8 u-rounded-xl u-min-h-97vh u-flex u-items-center u-justify-center"
362
521
  style={{
363
- background:
522
+ backgroundImage:
364
523
  'url(https://images.unsplash.com/photo-1754147965582-edcb63324a81?q=80&w=2070&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D)',
365
524
  backgroundSize: '120%',
366
- backgroundPosition: 'center',
367
- padding: '2rem',
368
- borderRadius: '12px',
369
- minHeight: '97vh',
370
- display: 'flex',
371
- alignItems: 'center',
372
- justifyContent: 'center',
373
525
  animation: 'gradient 15s ease infinite',
374
526
  }}
375
527
  >
@@ -385,7 +537,7 @@ export const GlassCustom: Story = {
385
537
  }
386
538
  `}
387
539
  </style>
388
- <div style={{ width: '100%', maxWidth: '500px' }}>
540
+ <div className="u-w-full u-max-w-md">
389
541
  <Accordion {...args} />
390
542
  </div>
391
543
  </div>
@@ -400,683 +552,39 @@ export const GlassCustom: Story = {
400
552
  },
401
553
  };
402
554
 
403
- // Glass Accordion Group
404
- export const GlassGroup: Story = {
555
+ // ============================================================================
556
+ // ACCESSIBILITY STORIES
557
+ // ============================================================================
558
+
559
+ export const WithAriaLabels: Story = {
405
560
  args: {
406
- title: 'Glass Accordion Group',
407
- children: <p>Group example with glass effect - see render function</p>,
408
- glass: {
409
- displacementScale: 180,
410
- blurAmount: 1,
411
- saturation: 60,
412
- mode: 'shader',
413
- ShaderVariant: 'premiumGlass',
414
- } as any,
561
+ title: 'Accessible Accordion',
562
+ children: <p>This accordion includes proper ARIA labels for screen readers.</p>,
415
563
  },
416
- render: () => (
417
- <div
418
- style={{
419
- background:
420
- 'url(https://images.unsplash.com/photo-1623237353316-417116e040a5?q=80&w=3307&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D)',
421
- backgroundSize: '150%',
422
- animation: 'gradient 15s ease infinite',
423
- padding: '2rem',
424
- borderRadius: '12px',
425
- minHeight: '97vh',
426
- }}
427
- >
428
- <style>
429
- {`
430
- @keyframes gradient {
431
- 0% { background-position: 0% 50%; }
432
- 50% { background-position: 100% 50%; }
433
- 100% { background-position: 0% 50%; }
434
- }
435
- `}
436
- </style>
437
- <h2
438
- style={{
439
- color: 'white',
440
- textAlign: 'center',
441
- marginBottom: '2rem',
442
- textShadow: '0 2px 4px rgba(0,0,0,0.3)',
443
- }}
444
- >
445
- Glass Accordion Group
446
- </h2>
447
- <div
448
- className="u-flex u-flex-column u-gap-3"
449
- style={{ width: '100%', maxWidth: '600px', margin: '0 auto' }}
450
- >
451
- <Accordion title="First Glass Accordion" defaultOpen={true} glass>
452
- <p>Content of the first glass accordion with beautiful glass morphism effect.</p>
453
- </Accordion>
454
-
455
- <Accordion title="Second Glass Accordion" glass>
456
- <p>Content of the second glass accordion showcasing the glass effect.</p>
457
- </Accordion>
458
-
459
- <Accordion title="Third Glass Accordion" glass>
460
- <p>Content of the third glass accordion with more content.</p>
461
- <p>Additional paragraph to demonstrate scrolling and glass effects.</p>
462
- <ul>
463
- <li>Glass effect item 1</li>
464
- <li>Glass effect item 2</li>
465
- <li>Glass effect item 3</li>
466
- </ul>
467
- </Accordion>
468
- </div>
469
- </div>
470
- ),
471
564
  parameters: {
472
565
  docs: {
473
566
  description: {
474
- story:
475
- 'This story demonstrates multiple Accordions with glass morphism effects against an animated gradient background.',
567
+ story: 'Accordion with proper ARIA attributes for screen reader accessibility.',
476
568
  },
477
569
  },
478
570
  },
479
571
  };
480
572
 
481
- // Glass Mode Variants - Standard
482
- export const GlassModeStandard: Story = {
573
+ export const KeyboardNavigation: Story = {
483
574
  args: {
484
- title: 'Standard Glass Mode Accordion',
575
+ title: 'Keyboard Accessible',
485
576
  children: (
486
- <div>
487
- <p>
488
- This accordion uses the standard glass mode with classic blur and displacement effects.
489
- </p>
490
- <p>The standard mode provides a refined glass appearance perfect for elegant interfaces.</p>
491
- </div>
492
- ),
493
- glass: true,
494
- },
495
- render: args => (
496
- <div
497
- style={{
498
- background:
499
- 'url(https://images.unsplash.com/photo-1689960159745-fbc6434d4434?ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&q=80&w=1335)',
500
- backgroundSize: 'cover',
501
- backgroundPosition: 'center',
502
- padding: '3rem',
503
- borderRadius: '12px',
504
- minHeight: '95vh',
505
- display: 'flex',
506
- flexDirection: 'column',
507
- alignItems: 'center',
508
- justifyContent: 'center',
509
- gap: '2rem',
510
- }}
511
- >
512
- <div style={{ textAlign: 'center', color: 'white', textShadow: '0 2px 4px rgba(0,0,0,0.5)' }}>
513
- <h3 style={{ fontSize: '1.5rem', marginBottom: '0.5rem' }}>Standard Glass Mode</h3>
514
- <p style={{ fontSize: '0.875rem', opacity: 0.9 }}>
515
- Classic glass morphism with blur and displacement
516
- </p>
517
- </div>
518
- <div style={{ width: '100%', maxWidth: '600px' }}>
519
- <Accordion {...args} />
520
- </div>
521
- </div>
522
- ),
523
- };
524
-
525
- // Glass Mode Variants - Polar
526
- export const GlassModePolar: Story = {
527
- args: {
528
- title: 'Polar Glass Mode Accordion',
529
- children: (
530
- <div>
531
- <p>This accordion uses the polar glass mode with radial distortion effects.</p>
532
- <p>The polar mode creates unique distortion patterns emanating from the center point.</p>
533
- </div>
577
+ <p>
578
+ This accordion is fully operable via keyboard navigation. Press Tab to focus and Enter/Space
579
+ to toggle.
580
+ </p>
534
581
  ),
535
- glass: {
536
- mode: 'polar',
537
- displacementScale: 80,
538
- blurAmount: 1.5,
539
- saturation: 180,
540
- aberrationIntensity: 3,
541
- } as GlassProps,
542
582
  },
543
- render: args => (
544
- <div
545
- style={{
546
- background: 'url(https://images.unsplash.com/photo-1557683316-973673baf926?w=1920)',
547
- backgroundSize: 'cover',
548
- backgroundPosition: 'center',
549
- padding: '3rem',
550
- borderRadius: '12px',
551
- minHeight: '95vh',
552
- display: 'flex',
553
- flexDirection: 'column',
554
- alignItems: 'center',
555
- justifyContent: 'center',
556
- gap: '2rem',
557
- }}
558
- >
559
- <div style={{ textAlign: 'center', color: 'white', textShadow: '0 2px 4px rgba(0,0,0,0.5)' }}>
560
- <h3 style={{ fontSize: '1.5rem', marginBottom: '0.5rem' }}>Polar Glass Mode</h3>
561
- <p style={{ fontSize: '0.875rem', opacity: 0.9 }}>Radial distortion effect from center</p>
562
- </div>
563
- <div style={{ width: '100%', maxWidth: '600px' }}>
564
- <Accordion {...args} />
565
- </div>
566
- </div>
567
- ),
568
- };
569
-
570
- // Glass Mode Variants - Prominent
571
- export const GlassModeProminent: Story = {
572
- args: {
573
- title: 'Prominent Glass Mode Accordion',
574
- children: (
575
- <div>
576
- <p>This accordion uses the prominent glass mode with enhanced distortion effects.</p>
577
- <p>The prominent mode delivers maximum depth and visual impact for striking designs.</p>
578
- </div>
579
- ),
580
- glass: {
581
- mode: 'prominent',
582
- displacementScale: 100,
583
- blurAmount: 2.5,
584
- saturation: 200,
585
- aberrationIntensity: 4,
586
- } as GlassProps,
587
- },
588
- render: args => (
589
- <div
590
- style={{
591
- background: 'url(https://images.unsplash.com/photo-1579546929518-9e396f3cc809?w=1920)',
592
- backgroundSize: 'cover',
593
- backgroundPosition: 'center',
594
- padding: '3rem',
595
- borderRadius: '12px',
596
- minHeight: '95vh',
597
- display: 'flex',
598
- flexDirection: 'column',
599
- alignItems: 'center',
600
- justifyContent: 'center',
601
- gap: '2rem',
602
- }}
603
- >
604
- <div style={{ textAlign: 'center', color: 'white', textShadow: '0 2px 4px rgba(0,0,0,0.5)' }}>
605
- <h3 style={{ fontSize: '1.5rem', marginBottom: '0.5rem' }}>Prominent Glass Mode</h3>
606
- <p style={{ fontSize: '0.875rem', opacity: 0.9 }}>Enhanced distortion with maximum depth</p>
607
- </div>
608
- <div style={{ width: '100%', maxWidth: '600px' }}>
609
- <Accordion {...args} />
610
- </div>
611
- </div>
612
- ),
613
- };
614
-
615
- // Glass Mode Variants - Shader
616
- export const GlassModeShader: Story = {
617
- args: {
618
- title: 'Shader Glass Mode Accordion',
619
- children: (
620
- <div>
621
- <p>This accordion uses the shader glass mode with GPU-accelerated liquid glass effects.</p>
622
- <p>The shader mode provides smooth, performant animations with liquid glass dynamics.</p>
623
- </div>
624
- ),
625
- glass: {
626
- mode: 'shader',
627
- shaderVariant: 'liquidGlass',
628
- displacementScale: 70,
629
- blurAmount: 1.8,
630
- saturation: 170,
631
- } as GlassProps,
632
- },
633
- render: args => (
634
- <div
635
- style={{
636
- background: 'url(https://images.unsplash.com/photo-1557682250-33bd709cbe85?w=1920)',
637
- backgroundSize: 'cover',
638
- backgroundPosition: 'center',
639
- padding: '3rem',
640
- borderRadius: '12px',
641
- minHeight: '95vh',
642
- display: 'flex',
643
- flexDirection: 'column',
644
- alignItems: 'center',
645
- justifyContent: 'center',
646
- gap: '2rem',
647
- }}
648
- >
649
- <div style={{ textAlign: 'center', color: 'white', textShadow: '0 2px 4px rgba(0,0,0,0.5)' }}>
650
- <h3 style={{ fontSize: '1.5rem', marginBottom: '0.5rem' }}>Shader Glass Mode</h3>
651
- <p style={{ fontSize: '0.875rem', opacity: 0.9 }}>GPU-accelerated liquid glass effect</p>
652
- </div>
653
- <div style={{ width: '100%', maxWidth: '600px' }}>
654
- <Accordion {...args} />
655
- </div>
656
- </div>
657
- ),
658
- };
659
-
660
- // All Glass Modes Comparison
661
- export const AllGlassModesComparison: Story = {
662
- args: {
663
- title: 'Glass Modes Comparison',
664
- children: <p>Comparison example</p>,
665
- },
666
- render: () => (
667
- <div
668
- style={{
669
- background: 'url(https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=1920)',
670
- backgroundSize: 'cover',
671
- backgroundPosition: 'center',
672
- padding: '3rem',
673
- borderRadius: '12px',
674
- minHeight: '95vh',
675
- overflow: 'auto',
676
- }}
677
- >
678
- <div style={{ maxWidth: '1200px', margin: '0 auto' }}>
679
- <h2
680
- style={{
681
- textAlign: 'center',
682
- color: 'white',
683
- marginBottom: '3rem',
684
- fontSize: '2rem',
685
- textShadow: '0 2px 8px rgba(0,0,0,0.5)',
686
- }}
687
- >
688
- Glass Mode Accordions Comparison
689
- </h2>
690
-
691
- <div
692
- style={{
693
- display: 'grid',
694
- gridTemplateColumns: 'repeat(auto-fit, minmax(280px, 1fr))',
695
- gap: '2rem',
696
- }}
697
- >
698
- {/* Standard Mode */}
699
- <div>
700
- <h3
701
- style={{
702
- color: 'white',
703
- marginBottom: '1rem',
704
- fontSize: '1.25rem',
705
- textAlign: 'center',
706
- }}
707
- >
708
- Standard Mode
709
- </h3>
710
- <Accordion title="Standard Glass" glass={true}>
711
- <p>Classic blur and displacement effects for a refined glass appearance.</p>
712
- </Accordion>
713
- </div>
714
-
715
- {/* Polar Mode */}
716
- <div>
717
- <h3
718
- style={{
719
- color: 'white',
720
- marginBottom: '1rem',
721
- fontSize: '1.25rem',
722
- textAlign: 'center',
723
- }}
724
- >
725
- Polar Mode
726
- </h3>
727
- <Accordion
728
- title="Polar Glass"
729
- glass={
730
- {
731
- mode: 'polar',
732
- displacementScale: 80,
733
- blurAmount: 1.5,
734
- saturation: 180,
735
- aberrationIntensity: 3,
736
- } as GlassProps
737
- }
738
- >
739
- <p>Radial distortion effects emanating from the center point.</p>
740
- </Accordion>
741
- </div>
742
-
743
- {/* Prominent Mode */}
744
- <div>
745
- <h3
746
- style={{
747
- color: 'white',
748
- marginBottom: '1rem',
749
- fontSize: '1.25rem',
750
- textAlign: 'center',
751
- }}
752
- >
753
- Prominent Mode
754
- </h3>
755
- <Accordion
756
- title="Prominent Glass"
757
- glass={
758
- {
759
- mode: 'prominent',
760
- displacementScale: 100,
761
- blurAmount: 2.5,
762
- saturation: 200,
763
- aberrationIntensity: 4,
764
- } as GlassProps
765
- }
766
- >
767
- <p>Enhanced distortion with maximum depth and visual impact.</p>
768
- </Accordion>
769
- </div>
770
-
771
- {/* Shader Mode */}
772
- <div>
773
- <h3
774
- style={{
775
- color: 'white',
776
- marginBottom: '1rem',
777
- fontSize: '1.25rem',
778
- textAlign: 'center',
779
- }}
780
- >
781
- Shader Mode
782
- </h3>
783
- <Accordion
784
- title="Shader Glass"
785
- glass={
786
- {
787
- mode: 'shader',
788
- shaderVariant: 'liquidGlass',
789
- displacementScale: 70,
790
- blurAmount: 1.8,
791
- saturation: 170,
792
- } as GlassProps
793
- }
794
- >
795
- <p>GPU-accelerated liquid glass with smooth animations.</p>
796
- </Accordion>
797
- </div>
798
- </div>
799
- </div>
800
- </div>
801
- ),
802
- };
803
-
804
- // Glass Accordion Interactive Showcase
805
- export const GlassInteractiveShowcase: Story = {
806
- args: {
807
- title: 'Interactive Glass Accordion',
808
- children: <p>Interactive showcase</p>,
809
- },
810
- render: () => {
811
- const [openIndex, setOpenIndex] = React.useState<number | null>(0);
812
-
813
- return (
814
- <div
815
- style={{
816
- background: 'url(https://images.unsplash.com/photo-1519681393784-d120267933ba?w=1920)',
817
- backgroundSize: 'cover',
818
- backgroundPosition: 'center',
819
- padding: '3rem',
820
- borderRadius: '12px',
821
- minHeight: '95vh',
822
- overflow: 'auto',
823
- }}
824
- >
825
- <div style={{ maxWidth: '800px', margin: '0 auto' }}>
826
- <h2
827
- style={{
828
- textAlign: 'center',
829
- color: 'white',
830
- marginBottom: '3rem',
831
- fontSize: '2rem',
832
- textShadow: '0 2px 8px rgba(0,0,0,0.5)',
833
- }}
834
- >
835
- Interactive Glass Accordion Showcase
836
- </h2>
837
-
838
- <div className="u-flex u-flex-column u-gap-3">
839
- <Accordion
840
- title="Features & Benefits"
841
- isOpen={openIndex === 0}
842
- onOpenChange={open => setOpenIndex(open ? 0 : null)}
843
- glass={
844
- {
845
- mode: 'standard',
846
- displacementScale: 60,
847
- blurAmount: 2,
848
- } as any
849
- }
850
- >
851
- <div>
852
- <h4 style={{ marginBottom: '0.5rem' }}>Premium Glass Effects</h4>
853
- <ul style={{ paddingLeft: '1.5rem' }}>
854
- <li>Hardware-accelerated rendering</li>
855
- <li>Smooth mouse-responsive animations</li>
856
- <li>Multiple distortion modes</li>
857
- <li>Customizable parameters</li>
858
- </ul>
859
- </div>
860
- </Accordion>
861
-
862
- <Accordion
863
- title="Technical Specifications"
864
- isOpen={openIndex === 1}
865
- onOpenChange={open => setOpenIndex(open ? 1 : null)}
866
- glass={
867
- {
868
- mode: 'polar',
869
- displacementScale: 70,
870
- blurAmount: 1.8,
871
- } as any
872
- }
873
- >
874
- <div>
875
- <h4 style={{ marginBottom: '0.5rem' }}>Performance & Compatibility</h4>
876
- <p>Optimized for modern browsers with WebGL support.</p>
877
- <ul style={{ paddingLeft: '1.5rem', marginTop: '0.5rem' }}>
878
- <li>60 FPS animations</li>
879
- <li>Responsive design</li>
880
- <li>Accessibility compliant</li>
881
- <li>Mobile-friendly</li>
882
- </ul>
883
- </div>
884
- </Accordion>
885
-
886
- <Accordion
887
- title="Customization Options"
888
- isOpen={openIndex === 2}
889
- onOpenChange={open => setOpenIndex(open ? 2 : null)}
890
- glass={
891
- {
892
- mode: 'prominent',
893
- displacementScale: 80,
894
- blurAmount: 2.2,
895
- } as any
896
- }
897
- >
898
- <div>
899
- <h4 style={{ marginBottom: '0.5rem' }}>Flexible Configuration</h4>
900
- <p>Customize every aspect of the glass effect:</p>
901
- <ul style={{ paddingLeft: '1.5rem', marginTop: '0.5rem' }}>
902
- <li>Blur amount and saturation</li>
903
- <li>Displacement scale</li>
904
- <li>Aberration intensity</li>
905
- <li>Corner radius</li>
906
- <li>Mode selection</li>
907
- </ul>
908
- </div>
909
- </Accordion>
910
-
911
- <Accordion
912
- title="Integration Guide"
913
- isOpen={openIndex === 3}
914
- onOpenChange={open => setOpenIndex(open ? 3 : null)}
915
- glass={
916
- {
917
- mode: 'shader',
918
- shaderVariant: 'liquidGlass',
919
- displacementScale: 65,
920
- } as any
921
- }
922
- >
923
- <div>
924
- <h4 style={{ marginBottom: '0.5rem' }}>Easy Implementation</h4>
925
- <p>Simple to integrate with your existing components:</p>
926
- <div
927
- style={{
928
- background: 'rgba(0,0,0,0.3)',
929
- padding: '1rem',
930
- borderRadius: '4px',
931
- marginTop: '0.5rem',
932
- }}
933
- >
934
- <code style={{ color: '#fff', fontSize: '0.875rem' }}>
935
- {'<Accordion glass={true} />'}
936
- </code>
937
- </div>
938
- </div>
939
- </Accordion>
940
- </div>
941
- </div>
942
- </div>
943
- );
944
- },
945
- };
946
-
947
- // Glass Accordion with Rich Content
948
- export const GlassRichContent: Story = {
949
- args: {
950
- title: 'Glass Accordion with Rich Content',
951
- children: <p>Rich content example</p>,
583
+ parameters: {
584
+ docs: {
585
+ description: {
586
+ story: 'Demonstrates keyboard navigation support for the accordion component.',
587
+ },
588
+ },
952
589
  },
953
- render: () => (
954
- <div
955
- style={{
956
- background: 'url(https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?w=1920)',
957
- backgroundSize: 'cover',
958
- backgroundPosition: 'center',
959
- padding: '3rem',
960
- borderRadius: '12px',
961
- minHeight: '95vh',
962
- overflow: 'auto',
963
- }}
964
- >
965
- <div style={{ maxWidth: '800px', margin: '0 auto' }}>
966
- <h2
967
- style={{
968
- textAlign: 'center',
969
- color: 'white',
970
- marginBottom: '3rem',
971
- fontSize: '2rem',
972
- textShadow: '0 2px 8px rgba(0,0,0,0.5)',
973
- }}
974
- >
975
- Glass Accordion with Rich Content
976
- </h2>
977
-
978
- <div className="u-flex u-flex-column u-gap-3">
979
- <Accordion title="Design Philosophy" defaultOpen={true} glass={true}>
980
- <div>
981
- <p style={{ marginBottom: '1rem' }}>
982
- Our glass morphism design combines modern aesthetics with practical functionality.
983
- The translucent effects create depth and visual hierarchy while maintaining
984
- readability.
985
- </p>
986
- <div style={{ display: 'flex', gap: '1rem', marginTop: '1rem' }}>
987
- <div
988
- style={{
989
- flex: 1,
990
- background: 'rgba(255,255,255,0.1)',
991
- padding: '1rem',
992
- borderRadius: '8px',
993
- }}
994
- >
995
- <h5 style={{ marginBottom: '0.5rem' }}>Aesthetic</h5>
996
- <p style={{ fontSize: '0.875rem' }}>Beautiful, modern design</p>
997
- </div>
998
- <div
999
- style={{
1000
- flex: 1,
1001
- background: 'rgba(255,255,255,0.1)',
1002
- padding: '1rem',
1003
- borderRadius: '8px',
1004
- }}
1005
- >
1006
- <h5 style={{ marginBottom: '0.5rem' }}>Functional</h5>
1007
- <p style={{ fontSize: '0.875rem' }}>Practical and usable</p>
1008
- </div>
1009
- </div>
1010
- </div>
1011
- </Accordion>
1012
-
1013
- <Accordion
1014
- title="Component Features"
1015
- glass={
1016
- {
1017
- mode: 'polar',
1018
- displacementScale: 70,
1019
- } as any
1020
- }
1021
- >
1022
- <div>
1023
- <p style={{ marginBottom: '1rem' }}>
1024
- Explore the comprehensive features available in our glass accordion component:
1025
- </p>
1026
- <div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: '0.5rem' }}>
1027
- <div>✨ Glass morphism effects</div>
1028
- <div>🎨 Multiple visual modes</div>
1029
- <div>⚡ High performance</div>
1030
- <div>♿ Accessibility ready</div>
1031
- <div>📱 Mobile responsive</div>
1032
- <div>🎯 Easy customization</div>
1033
- </div>
1034
- </div>
1035
- </Accordion>
1036
-
1037
- <Accordion
1038
- title="Implementation Examples"
1039
- glass={
1040
- {
1041
- mode: 'shader',
1042
- shaderVariant: 'liquidGlass',
1043
- } as any
1044
- }
1045
- >
1046
- <div>
1047
- <p style={{ marginBottom: '1rem' }}>
1048
- Multiple ways to implement glass effects in your application:
1049
- </p>
1050
- <div
1051
- style={{
1052
- background: 'rgba(0,0,0,0.3)',
1053
- padding: '1rem',
1054
- borderRadius: '8px',
1055
- marginBottom: '1rem',
1056
- }}
1057
- >
1058
- <code
1059
- style={{
1060
- color: '#fff',
1061
- fontSize: '0.875rem',
1062
- display: 'block',
1063
- whiteSpace: 'pre',
1064
- }}
1065
- >
1066
- {`// Basic usage
1067
- <Accordion glass={true} />
1068
-
1069
- // Custom configuration
1070
- <Accordion glass={{
1071
- mode: 'polar',
1072
- displacementScale: 70
1073
- }} />`}
1074
- </code>
1075
- </div>
1076
- </div>
1077
- </Accordion>
1078
- </div>
1079
- </div>
1080
- </div>
1081
- ),
1082
590
  };