@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,33 +1,184 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
+ import { fn } from '@storybook/test';
2
3
  import { useState } from 'react';
3
4
  import { DataTableColumn } from '../../lib/types/components';
4
5
  import { DataTable } from './DataTable';
5
6
 
6
- const meta = {
7
+ const meta: Meta<typeof DataTable> = {
7
8
  title: 'Components/DataTable',
8
9
  component: DataTable,
9
10
  parameters: {
10
11
  layout: 'padded',
11
12
  docs: {
12
13
  description: {
13
- component:
14
- 'The DataTable component provides a powerful and flexible way to display structured data in rows and columns. It supports sorting, filtering, pagination, selection, and various display options. DataTables are ideal for displaying large datasets, user lists, product catalogs, or any tabular information requiring advanced data manipulation.',
14
+ component: `
15
+ # DataTable
16
+
17
+ ## Overview
18
+
19
+ DataTable provides a powerful and flexible way to display structured data in rows and columns. It supports sorting, filtering, pagination, selection, and various display options. DataTables are ideal for displaying large datasets, user lists, product catalogs, or any tabular information requiring advanced data manipulation.
20
+
21
+ ## Features
22
+
23
+ - Sorting capability for columns
24
+ - Filtering functionality
25
+ - Pagination with configurable page size
26
+ - Row selection options
27
+ - Custom cell rendering
28
+ - Responsive design
29
+ - Loading states
30
+ - Empty state handling
31
+
32
+ ## Accessibility
33
+
34
+ - Keyboard support: Navigate with arrow keys, select with Space/Enter
35
+ - Screen reader: Table headers and data cells announced properly
36
+ - ARIA support: Appropriate roles and properties for tables
37
+ - Focus management: Maintains focus within the table controls
38
+
39
+ ## Usage Examples
40
+
41
+ ### Basic Usage
42
+
43
+ \`\`\`tsx
44
+ <DataTable
45
+ data={data}
46
+ columns={columns}
47
+ />
48
+ \`\`\`
49
+
50
+ ### With Pagination
51
+
52
+ \`\`\`tsx
53
+ <DataTable
54
+ data={data}
55
+ columns={columns}
56
+ paginated={true}
57
+ pageSize={10}
58
+ />
59
+ \`\`\`
60
+
61
+ ## API Reference
62
+
63
+ ### Props
64
+
65
+ | Prop | Type | Default | Description |
66
+ | ---- | ---- | ------- | ----------- |
67
+ | data | T[] | [] | Array of data objects to display |
68
+ | columns | DataTableColumn[] | [] | Column definitions for the table |
69
+ | sortable | boolean | false | Whether columns are sortable |
70
+ | filterable | boolean | false | Whether the table is filterable |
71
+ | paginated | boolean | false | Whether to enable pagination |
72
+ | pageSize | number | 10 | Number of rows per page |
73
+ | striped | boolean | false | Whether to apply striped row styling |
74
+ | bordered | boolean | false | Whether to show table borders |
75
+ | dense | boolean | false | Whether to use dense row spacing |
76
+ | loading | boolean | false | Whether the table is in loading state |
77
+ | emptyMessage | string | 'No records found' | Message to display when table is empty |
78
+ | onRowClick | (row: T) => void | - | Callback when a row is clicked |
79
+ | onSelectionChange | (selected: T[]) => void | - | Callback when selection changes |
80
+ `,
15
81
  },
16
82
  },
17
83
  },
18
84
  tags: ['autodocs'],
19
85
  argTypes: {
20
- data: { control: 'object', description: 'Array of data objects to display' },
21
- columns: { control: 'object', description: 'Column definitions for the table' },
22
- sortable: { control: 'boolean', description: 'Whether columns are sortable' },
23
- filterable: { control: 'boolean', description: 'Whether the table is filterable' },
24
- paginated: { control: 'boolean', description: 'Whether to enable pagination' },
25
- pageSize: { control: 'number', description: 'Number of rows per page' },
26
- striped: { control: 'boolean', description: 'Whether to apply striped row styling' },
27
- bordered: { control: 'boolean', description: 'Whether to show table borders' },
28
- dense: { control: 'boolean', description: 'Whether to use dense row spacing' },
29
- loading: { control: 'boolean', description: 'Whether the table is in loading state' },
30
- emptyMessage: { control: 'text', description: 'Message to display when table is empty' },
86
+ data: {
87
+ control: 'object',
88
+ description: 'Array of data objects to display',
89
+ table: {
90
+ type: { summary: 'T[]' },
91
+ defaultValue: { summary: '[]' },
92
+ },
93
+ },
94
+ columns: {
95
+ control: 'object',
96
+ description: 'Column definitions for the table',
97
+ table: {
98
+ type: { summary: 'DataTableColumn[]' },
99
+ defaultValue: { summary: '[]' },
100
+ },
101
+ },
102
+ sortable: {
103
+ control: 'boolean',
104
+ description: 'Whether columns are sortable',
105
+ table: {
106
+ type: { summary: 'boolean' },
107
+ defaultValue: { summary: 'false' },
108
+ },
109
+ },
110
+ filterable: {
111
+ control: 'boolean',
112
+ description: 'Whether the table is filterable',
113
+ table: {
114
+ type: { summary: 'boolean' },
115
+ defaultValue: { summary: 'false' },
116
+ },
117
+ },
118
+ paginated: {
119
+ control: 'boolean',
120
+ description: 'Whether to enable pagination',
121
+ table: {
122
+ type: { summary: 'boolean' },
123
+ defaultValue: { summary: 'false' },
124
+ },
125
+ },
126
+ pageSize: {
127
+ control: 'number',
128
+ description: 'Number of rows per page',
129
+ table: {
130
+ type: { summary: 'number' },
131
+ defaultValue: { summary: '10' },
132
+ },
133
+ },
134
+ striped: {
135
+ control: 'boolean',
136
+ description: 'Whether to apply striped row styling',
137
+ table: {
138
+ type: { summary: 'boolean' },
139
+ defaultValue: { summary: 'false' },
140
+ },
141
+ },
142
+ bordered: {
143
+ control: 'boolean',
144
+ description: 'Whether to show table borders',
145
+ table: {
146
+ type: { summary: 'boolean' },
147
+ defaultValue: { summary: 'false' },
148
+ },
149
+ },
150
+ dense: {
151
+ control: 'boolean',
152
+ description: 'Whether to use dense row spacing',
153
+ table: {
154
+ type: { summary: 'boolean' },
155
+ defaultValue: { summary: 'false' },
156
+ },
157
+ },
158
+ loading: {
159
+ control: 'boolean',
160
+ description: 'Whether the table is in loading state',
161
+ table: {
162
+ type: { summary: 'boolean' },
163
+ defaultValue: { summary: 'false' },
164
+ },
165
+ },
166
+ emptyMessage: {
167
+ control: 'text',
168
+ description: 'Message to display when table is empty',
169
+ table: {
170
+ type: { summary: 'string' },
171
+ defaultValue: { summary: 'No records found' },
172
+ },
173
+ },
174
+ onRowClick: {
175
+ action: 'row clicked',
176
+ description: 'Callback when a row is clicked',
177
+ },
178
+ onSelectionChange: {
179
+ action: 'selection changed',
180
+ description: 'Callback when selection changes',
181
+ },
31
182
  },
32
183
  } satisfies Meta<typeof DataTable>;
33
184
 
@@ -78,170 +229,166 @@ const columns: DataTableColumn[] = [
78
229
  title: 'Status',
79
230
  sortable: true,
80
231
  render: (value, row) => {
81
- let color = '';
232
+ let statusClass = '';
82
233
  switch (value) {
83
234
  case 'Active':
84
- color = 'green';
235
+ statusClass = 'u-text-success';
85
236
  break;
86
237
  case 'Inactive':
87
- color = 'red';
238
+ statusClass = 'u-text-error';
88
239
  break;
89
240
  case 'Pending':
90
- color = 'orange';
241
+ statusClass = 'u-text-warning';
91
242
  break;
92
243
  case 'Suspended':
93
- color = 'gray';
244
+ statusClass = 'u-text-gray';
94
245
  break;
246
+ default:
247
+ statusClass = 'u-text-gray';
95
248
  }
96
- return <span style={{ color }}>{value}</span>;
249
+ return <span className={statusClass}>{value}</span>;
97
250
  },
98
251
  },
99
252
  ];
100
253
 
101
- // Basic example
102
- export const Basic: Story = {
254
+ // ========================================
255
+ // BASIC USAGE STORIES
256
+ // ========================================
257
+
258
+ export const BasicUsage: Story = {
103
259
  args: {
104
260
  data: users,
105
- columns,
261
+ columns: columns,
262
+ },
263
+ parameters: {
264
+ docs: {
265
+ description: {
266
+ story: 'Basic DataTable component with sample user data.',
267
+ },
268
+ },
106
269
  },
107
270
  };
108
271
 
109
- // Sortable example
110
- export const Sortable: Story = {
272
+ // ========================================
273
+ // VARIANTS & STATES STORIES
274
+ // ========================================
275
+
276
+ export const LoadingState: Story = {
111
277
  args: {
112
278
  data: users,
113
279
  columns,
114
- sortable: true,
280
+ loading: true,
115
281
  },
116
282
  };
117
283
 
118
- // Filterable example
119
- export const Filterable: Story = {
284
+ export const EmptyState: Story = {
120
285
  args: {
121
- data: users,
286
+ data: [],
122
287
  columns,
123
- filterable: true,
288
+ emptyMessage: 'No users found',
124
289
  },
125
290
  };
126
291
 
127
- // Paginated example
128
- export const Paginated: Story = {
292
+ export const WithStripedRows: Story = {
129
293
  args: {
130
294
  data: users,
131
- columns,
132
- paginated: true,
133
- pageSize: 5,
295
+ columns: columns,
296
+ striped: true,
134
297
  },
135
298
  parameters: {
136
299
  docs: {
137
300
  description: {
138
- story: 'A paginated table with standard pagination controls below the table.',
301
+ story: 'DataTable with striped row styling for improved readability.',
139
302
  },
140
303
  },
141
304
  },
142
305
  };
143
306
 
144
- // Paginated with larger dataset
145
- export const PaginatedLargeDataset: Story = {
307
+ export const WithBorderedTable: Story = {
146
308
  args: {
147
- data: largeDataSet,
309
+ data: users,
148
310
  columns,
149
- paginated: true,
150
- pageSize: 10,
151
- },
152
- parameters: {
153
- docs: {
154
- description: {
155
- story:
156
- 'Pagination with a large dataset (100 items) demonstrating first/last buttons and ellipsis.',
157
- },
158
- },
311
+ bordered: true,
159
312
  },
160
313
  };
161
314
 
162
- // Complete example with all features
163
- export const CompleteFeatures: Story = {
315
+ export const DenseSpacing: Story = {
164
316
  args: {
165
- data: largeDataSet,
317
+ data: users,
166
318
  columns,
167
319
  sortable: true,
168
- filterable: true,
169
- paginated: true,
170
- pageSize: 10,
171
- striped: true,
172
- bordered: true,
320
+ dense: true,
321
+ },
322
+ };
323
+
324
+ // ========================================
325
+ // SORTING & FILTERING STORIES
326
+ // ========================================
327
+
328
+ export const WithSorting: Story = {
329
+ args: {
330
+ data: users,
331
+ columns: columns,
332
+ sortable: true,
173
333
  },
174
334
  parameters: {
175
335
  docs: {
176
336
  description: {
177
- story: 'A complete data table with sorting, filtering, and pagination enabled.',
337
+ story: 'DataTable with column sorting functionality enabled.',
178
338
  },
179
339
  },
180
340
  },
181
341
  };
182
342
 
183
- // Styled example
184
- export const Styled: Story = {
343
+ export const WithFiltering: Story = {
185
344
  args: {
186
345
  data: users,
187
346
  columns,
188
- sortable: true,
189
- striped: true,
190
- bordered: true,
347
+ filterable: true,
191
348
  },
192
349
  };
193
350
 
194
- // Dense example
195
- export const Dense: Story = {
351
+ export const WithColumnFilters: Story = {
196
352
  args: {
197
353
  data: users,
198
- columns,
354
+ columns: columns.map(col => ({
355
+ ...col,
356
+ filterable: ['name', 'role', 'email'].includes(col.key),
357
+ })),
358
+ columnFilters: true,
199
359
  sortable: true,
200
- dense: true,
201
360
  },
202
- };
203
-
204
- // Empty example
205
- export const Empty: Story = {
206
- args: {
207
- data: [],
208
- columns,
209
- emptyMessage: 'No users found',
361
+ parameters: {
362
+ docs: {
363
+ description: {
364
+ story:
365
+ 'DataTable with column-specific filters. Each filterable column has its own filter input.',
366
+ },
367
+ },
210
368
  },
211
369
  };
212
370
 
213
- // Loading example
214
- export const Loading: Story = {
215
- args: {
216
- data: users,
217
- columns,
218
- loading: true,
219
- },
220
- };
371
+ // ========================================
372
+ // ROW SELECTION STORIES
373
+ // ========================================
221
374
 
222
- // Interactive example with row click handler
223
- export const Interactive: Story = {
375
+ export const WithRowSelectionSingle: Story = {
224
376
  render: args => {
225
- const [selectedUser, setSelectedUser] = useState<any>(null);
226
-
227
- const handleRowClick = (row: any) => {
228
- setSelectedUser(row);
229
- };
377
+ const [selectedRow, setSelectedRow] = useState<any>(null);
230
378
 
231
379
  return (
232
380
  <div>
233
- <DataTable {...args} onRowClick={handleRowClick} />
234
- {selectedUser && (
235
- <div
236
- style={{
237
- marginTop: '1rem',
238
- padding: '1rem',
239
- border: '1px solid #ccc',
240
- borderRadius: '4px',
241
- }}
242
- >
243
- <h3>Selected User:</h3>
244
- <pre>{JSON.stringify(selectedUser, null, 2)}</pre>
381
+ <DataTable
382
+ {...args}
383
+ data={args.data || users}
384
+ columns={args.columns || columns}
385
+ selectionMode="single"
386
+ onSelectionChange={rows => setSelectedRow(rows[0] || null)}
387
+ />
388
+ {selectedRow && (
389
+ <div className="u-mt-4 u-p-4 u-bg-gray-100 u-rounded u-text-sm">
390
+ <strong>Selected:</strong>
391
+ <pre className="u-mt-2 u-text-xs">{JSON.stringify(selectedRow, null, 2)}</pre>
245
392
  </div>
246
393
  )}
247
394
  </div>
@@ -252,10 +399,16 @@ export const Interactive: Story = {
252
399
  columns,
253
400
  sortable: true,
254
401
  },
402
+ parameters: {
403
+ docs: {
404
+ description: {
405
+ story: 'DataTable with single row selection enabled. Select a row using radio buttons.',
406
+ },
407
+ },
408
+ },
255
409
  };
256
410
 
257
- // Row selection - multiple
258
- export const RowSelectionMultiple: Story = {
411
+ export const WithRowSelectionMultiple: Story = {
259
412
  render: args => {
260
413
  const [selectedRows, setSelectedRows] = useState<any[]>([]);
261
414
 
@@ -263,14 +416,20 @@ export const RowSelectionMultiple: Story = {
263
416
  <div>
264
417
  <DataTable
265
418
  {...args}
419
+ data={args.data || users}
420
+ columns={args.columns || columns}
266
421
  selectionMode="multiple"
267
422
  onSelectionChange={(rows, ids) => setSelectedRows(rows)}
268
423
  />
269
424
  {selectedRows.length > 0 && (
270
- <div style={{ marginTop: '1rem', padding: '1rem', background: '#f5f5f5', borderRadius: '4px' }}>
425
+ <div className="u-mt-4 u-p-4 u-bg-gray-100 u-rounded u-text-sm">
271
426
  <strong>Selected: {selectedRows.length} row(s)</strong>
272
- <pre style={{ marginTop: '0.5rem', fontSize: '0.875rem' }}>
273
- {JSON.stringify(selectedRows.map(r => r.name), null, 2)}
427
+ <pre className="u-mt-2 u-text-xs">
428
+ {JSON.stringify(
429
+ selectedRows.map(r => r.name),
430
+ null,
431
+ 2
432
+ )}
274
433
  </pre>
275
434
  </div>
276
435
  )}
@@ -291,24 +450,30 @@ export const RowSelectionMultiple: Story = {
291
450
  },
292
451
  };
293
452
 
294
- // Row selection - single
295
- export const RowSelectionSingle: Story = {
453
+ // ========================================
454
+ // ADVANCED FEATURES STORIES
455
+ // ========================================
456
+
457
+ export const WithInteractiveRows: Story = {
296
458
  render: args => {
297
- const [selectedRow, setSelectedRow] = useState<any>(null);
459
+ const [selectedUser, setSelectedUser] = useState<any>(null);
460
+
461
+ const handleRowClick = (row: any) => {
462
+ setSelectedUser(row);
463
+ };
298
464
 
299
465
  return (
300
466
  <div>
301
467
  <DataTable
302
468
  {...args}
303
- selectionMode="single"
304
- onSelectionChange={(rows) => setSelectedRow(rows[0] || null)}
469
+ data={args.data || users}
470
+ columns={args.columns || columns}
471
+ onRowClick={handleRowClick}
305
472
  />
306
- {selectedRow && (
307
- <div style={{ marginTop: '1rem', padding: '1rem', background: '#f5f5f5', borderRadius: '4px' }}>
308
- <strong>Selected:</strong>
309
- <pre style={{ marginTop: '0.5rem', fontSize: '0.875rem' }}>
310
- {JSON.stringify(selectedRow, null, 2)}
311
- </pre>
473
+ {selectedUser && (
474
+ <div className="u-mt-4 u-p-4 u-border u-border-gray-300 u-rounded u-bg-white">
475
+ <h3 className="u-m-0">Selected User:</h3>
476
+ <pre className="u-m-0">{JSON.stringify(selectedUser, null, 2)}</pre>
312
477
  </div>
313
478
  )}
314
479
  </div>
@@ -319,37 +484,50 @@ export const RowSelectionSingle: Story = {
319
484
  columns,
320
485
  sortable: true,
321
486
  },
487
+ };
488
+
489
+ // ========================================
490
+ // PAGINATION STORIES
491
+ // ========================================
492
+
493
+ export const WithPagination: Story = {
494
+ args: {
495
+ data: largeDataSet,
496
+ columns: columns,
497
+ paginated: true,
498
+ pageSize: 5,
499
+ },
322
500
  parameters: {
323
501
  docs: {
324
502
  description: {
325
- story: 'DataTable with single row selection enabled. Select a row using radio buttons.',
503
+ story: 'DataTable with pagination enabled to handle large datasets.',
326
504
  },
327
505
  },
328
506
  },
329
507
  };
330
508
 
331
- // Column-specific filtering
332
- export const ColumnFilters: Story = {
509
+ export const WithPaginationLargeDataset: Story = {
333
510
  args: {
334
- data: users,
335
- columns: columns.map(col => ({
336
- ...col,
337
- filterable: ['name', 'role', 'email'].includes(col.key),
338
- })),
339
- columnFilters: true,
340
- sortable: true,
511
+ data: largeDataSet,
512
+ columns,
513
+ paginated: true,
514
+ pageSize: 10,
341
515
  },
342
516
  parameters: {
343
517
  docs: {
344
518
  description: {
345
- story: 'DataTable with column-specific filters. Each filterable column has its own filter input.',
519
+ story:
520
+ 'Pagination with a large dataset (100 items) demonstrating first/last buttons and ellipsis.',
346
521
  },
347
522
  },
348
523
  },
349
524
  };
350
525
 
351
- // Column resizing
352
- export const ResizableColumns: Story = {
526
+ // ========================================
527
+ // COLUMN CONFIGURATION STORIES
528
+ // ========================================
529
+
530
+ export const WithResizableColumns: Story = {
353
531
  args: {
354
532
  data: users,
355
533
  columns: columns.map(col => ({
@@ -369,8 +547,7 @@ export const ResizableColumns: Story = {
369
547
  },
370
548
  };
371
549
 
372
- // Column reordering
373
- export const ReorderableColumns: Story = {
550
+ export const WithReorderableColumns: Story = {
374
551
  args: {
375
552
  data: users,
376
553
  columns,
@@ -386,8 +563,7 @@ export const ReorderableColumns: Story = {
386
563
  },
387
564
  };
388
565
 
389
- // Column visibility toggle
390
- export const ColumnVisibility: Story = {
566
+ export const WithColumnVisibilityToggle: Story = {
391
567
  args: {
392
568
  data: users,
393
569
  columns,
@@ -397,14 +573,18 @@ export const ColumnVisibility: Story = {
397
573
  parameters: {
398
574
  docs: {
399
575
  description: {
400
- story: 'DataTable with column visibility toggle. Use the Columns button to show/hide columns.',
576
+ story:
577
+ 'DataTable with column visibility toggle. Use the Columns button to show/hide columns.',
401
578
  },
402
579
  },
403
580
  },
404
581
  };
405
582
 
406
- // Export functionality
407
- export const Exportable: Story = {
583
+ // ========================================
584
+ // EXPORT & CUSTOMIZATION STORIES
585
+ // ========================================
586
+
587
+ export const WithExportFunctionality: Story = {
408
588
  args: {
409
589
  data: users,
410
590
  columns,
@@ -422,8 +602,7 @@ export const Exportable: Story = {
422
602
  },
423
603
  };
424
604
 
425
- // Sticky headers
426
- export const StickyHeaders: Story = {
605
+ export const WithStickyHeaders: Story = {
427
606
  args: {
428
607
  data: largeDataSet,
429
608
  columns,
@@ -442,7 +621,30 @@ export const StickyHeaders: Story = {
442
621
  },
443
622
  };
444
623
 
445
- // All advanced features
624
+ // ========================================
625
+ // COMPREHENSIVE EXAMPLES
626
+ // ========================================
627
+
628
+ export const CompleteFeatures: Story = {
629
+ args: {
630
+ data: largeDataSet,
631
+ columns,
632
+ sortable: true,
633
+ filterable: true,
634
+ paginated: true,
635
+ pageSize: 10,
636
+ striped: true,
637
+ bordered: true,
638
+ },
639
+ parameters: {
640
+ docs: {
641
+ description: {
642
+ story: 'A complete data table with sorting, filtering, and pagination enabled.',
643
+ },
644
+ },
645
+ },
646
+ };
647
+
446
648
  export const AllAdvancedFeatures: Story = {
447
649
  render: args => {
448
650
  const [selectedRows, setSelectedRows] = useState<any[]>([]);
@@ -451,11 +653,13 @@ export const AllAdvancedFeatures: Story = {
451
653
  <div>
452
654
  <DataTable
453
655
  {...args}
656
+ data={args.data || largeDataSet}
657
+ columns={args.columns || columns}
454
658
  selectionMode="multiple"
455
- onSelectionChange={(rows) => setSelectedRows(rows)}
659
+ onSelectionChange={rows => setSelectedRows(rows)}
456
660
  />
457
661
  {selectedRows.length > 0 && (
458
- <div style={{ marginTop: '1rem', padding: '1rem', background: '#f5f5f5', borderRadius: '4px' }}>
662
+ <div className="u-mt-4 u-p-4 u-bg-gray-100 u-rounded">
459
663
  <strong>Selected: {selectedRows.length} row(s)</strong>
460
664
  </div>
461
665
  )}
@@ -486,7 +690,8 @@ export const AllAdvancedFeatures: Story = {
486
690
  parameters: {
487
691
  docs: {
488
692
  description: {
489
- story: 'DataTable with all advanced features enabled: selection, filtering, resizing, reordering, visibility toggle, export, and sticky headers.',
693
+ story:
694
+ 'DataTable with all advanced features enabled: selection, filtering, resizing, reordering, visibility toggle, export, and sticky headers.',
490
695
  },
491
696
  },
492
697
  },