@shohojdhara/atomix 0.3.13 → 0.3.15

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 (249) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +2 -0
  3. package/build-tools/EXAMPLES.md +372 -0
  4. package/build-tools/README.md +242 -0
  5. package/build-tools/__tests__/error-handler.test.js +230 -0
  6. package/build-tools/__tests__/index.test.js +141 -0
  7. package/build-tools/__tests__/rollup-plugin.test.js +194 -0
  8. package/build-tools/__tests__/utils.test.js +161 -0
  9. package/build-tools/__tests__/vite-plugin.test.js +129 -0
  10. package/build-tools/__tests__/webpack-loader.test.js +190 -0
  11. package/build-tools/error-handler.js +308 -0
  12. package/build-tools/index.d.ts +43 -0
  13. package/build-tools/index.js +88 -0
  14. package/build-tools/package.json +67 -0
  15. package/build-tools/rollup-plugin.js +236 -0
  16. package/build-tools/types.d.ts +163 -0
  17. package/build-tools/utils.js +203 -0
  18. package/build-tools/vite-plugin.js +161 -0
  19. package/build-tools/webpack-loader.js +123 -0
  20. package/dist/atomix.css +298 -167
  21. package/dist/atomix.css.map +1 -1
  22. package/dist/atomix.min.css +3 -3
  23. package/dist/atomix.min.css.map +1 -1
  24. package/dist/build-tools/EXAMPLES.md +372 -0
  25. package/dist/build-tools/README.md +242 -0
  26. package/dist/build-tools/__tests__/error-handler.test.js +230 -0
  27. package/dist/build-tools/__tests__/index.test.js +141 -0
  28. package/dist/build-tools/__tests__/rollup-plugin.test.js +194 -0
  29. package/dist/build-tools/__tests__/utils.test.js +161 -0
  30. package/dist/build-tools/__tests__/vite-plugin.test.js +129 -0
  31. package/dist/build-tools/__tests__/webpack-loader.test.js +190 -0
  32. package/dist/build-tools/error-handler.js +308 -0
  33. package/dist/build-tools/index.d.ts +43 -0
  34. package/dist/build-tools/index.js +88 -0
  35. package/dist/build-tools/package.json +67 -0
  36. package/dist/build-tools/rollup-plugin.js +236 -0
  37. package/dist/build-tools/types.d.ts +163 -0
  38. package/dist/build-tools/utils.js +203 -0
  39. package/dist/build-tools/vite-plugin.js +161 -0
  40. package/dist/build-tools/webpack-loader.js +123 -0
  41. package/dist/charts.d.ts +2 -2
  42. package/dist/charts.js +87 -58
  43. package/dist/charts.js.map +1 -1
  44. package/dist/core.d.ts +42 -12
  45. package/dist/core.js +175 -135
  46. package/dist/core.js.map +1 -1
  47. package/dist/forms.d.ts +30 -16
  48. package/dist/forms.js +146 -131
  49. package/dist/forms.js.map +1 -1
  50. package/dist/heavy.d.ts +2 -2
  51. package/dist/heavy.js +151 -118
  52. package/dist/heavy.js.map +1 -1
  53. package/dist/index.d.ts +130 -106
  54. package/dist/index.esm.js +1083 -465
  55. package/dist/index.esm.js.map +1 -1
  56. package/dist/index.js +1102 -483
  57. package/dist/index.js.map +1 -1
  58. package/dist/index.min.js +1 -1
  59. package/dist/index.min.js.map +1 -1
  60. package/dist/theme.d.ts +27 -2
  61. package/dist/theme.js +721 -108
  62. package/dist/theme.js.map +1 -1
  63. package/package.json +23 -8
  64. package/scripts/atomix-cli.js +749 -1153
  65. package/scripts/cli/__tests__/README.md +81 -0
  66. package/scripts/cli/__tests__/basic.test.js +115 -0
  67. package/scripts/cli/__tests__/component-generator.test.js +332 -0
  68. package/scripts/cli/__tests__/integration.test.js +327 -0
  69. package/scripts/cli/__tests__/test-setup.js +133 -0
  70. package/scripts/cli/__tests__/token-manager.test.js +251 -0
  71. package/scripts/cli/__tests__/utils.test.js +78 -118
  72. package/scripts/cli/component-generator.js +564 -0
  73. package/scripts/cli/dependency-checker.js +355 -0
  74. package/scripts/cli/documentation-sync.js +542 -0
  75. package/scripts/cli/interactive-init.js +129 -292
  76. package/scripts/cli/mappings.js +211 -0
  77. package/scripts/cli/migration-tools.js +95 -288
  78. package/scripts/cli/template-manager.js +105 -0
  79. package/scripts/cli/templates/README.md +123 -0
  80. package/scripts/cli/templates/common-templates.js +636 -0
  81. package/scripts/cli/templates/composable-templates.js +171 -0
  82. package/scripts/cli/templates/config-templates.js +126 -0
  83. package/scripts/cli/templates/index.js +102 -0
  84. package/scripts/cli/templates/project-templates.js +342 -0
  85. package/scripts/cli/templates/react-templates.js +331 -0
  86. package/scripts/cli/templates/scss-templates.js +155 -0
  87. package/scripts/cli/templates/storybook-templates.js +236 -0
  88. package/scripts/cli/templates/testing-templates.js +224 -0
  89. package/scripts/cli/templates/testing-utils.js +278 -0
  90. package/scripts/cli/templates/token-templates.js +447 -0
  91. package/scripts/cli/templates/types-templates.js +147 -0
  92. package/scripts/cli/templates.js +35 -0
  93. package/scripts/cli/theme-bridge.js +28 -16
  94. package/scripts/cli/token-manager.js +432 -247
  95. package/scripts/cli/utils.js +37 -26
  96. package/src/components/Accordion/Accordion.stories.tsx +369 -870
  97. package/src/components/Accordion/Accordion.test.tsx +57 -0
  98. package/src/components/Accordion/Accordion.tsx +4 -0
  99. package/src/components/AtomixGlass/AtomixGlass.tsx +80 -39
  100. package/src/components/AtomixGlass/AtomixGlassContainer.tsx +103 -81
  101. package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +8 -7
  102. package/src/components/AtomixGlass/glass-utils.ts +2 -2
  103. package/src/components/AtomixGlass/shader-utils.ts +5 -0
  104. package/src/components/AtomixGlass/stories/Customization.stories.tsx +131 -0
  105. package/src/components/AtomixGlass/stories/Examples.stories.tsx +2965 -2861
  106. package/src/components/AtomixGlass/stories/Modes.stories.tsx +1 -1
  107. package/src/components/AtomixGlass/stories/Overview.stories.tsx +348 -0
  108. package/src/components/AtomixGlass/stories/Performance.stories.tsx +103 -0
  109. package/src/components/AtomixGlass/stories/Playground.stories.tsx +73 -59
  110. package/src/components/AtomixGlass/stories/{ShaderVariants.stories.tsx → Shaders.stories.tsx} +1 -1
  111. package/src/components/AtomixGlass/stories/shared-components.tsx +90 -190
  112. package/src/components/Avatar/Avatar.stories.tsx +239 -27
  113. package/src/components/Badge/Badge.stories.tsx +132 -373
  114. package/src/components/Badge/Badge.test.tsx +51 -0
  115. package/src/components/Badge/Badge.tsx +20 -1
  116. package/src/components/Block/Block.stories.tsx +26 -17
  117. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +141 -23
  118. package/src/components/Breadcrumb/Breadcrumb.tsx +2 -2
  119. package/src/components/Button/Button.stories.tsx +463 -1126
  120. package/src/components/Button/Button.test.tsx +107 -0
  121. package/src/components/Button/Button.tsx +50 -54
  122. package/src/components/Button/ButtonGroup.stories.tsx +373 -217
  123. package/src/components/Button/README.md +5 -0
  124. package/src/components/Callout/Callout.stories.tsx +299 -644
  125. package/src/components/Callout/Callout.test.tsx +10 -10
  126. package/src/components/Callout/Callout.tsx +7 -7
  127. package/src/components/Callout/README.md +9 -8
  128. package/src/components/Card/Card.stories.tsx +248 -68
  129. package/src/components/Card/Card.tsx +2 -2
  130. package/src/components/Chart/Chart.stories.tsx +156 -14
  131. package/src/components/Chart/Chart.tsx +1 -1
  132. package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +151 -69
  133. package/src/components/Countdown/Countdown.stories.tsx +115 -8
  134. package/src/components/DataTable/DataTable.stories.tsx +346 -146
  135. package/src/components/DataTable/DataTable.tsx +14 -12
  136. package/src/components/DatePicker/DatePicker.stories.tsx +325 -1066
  137. package/src/components/Dropdown/Dropdown.stories.tsx +157 -37
  138. package/src/components/EdgePanel/EdgePanel.stories.tsx +230 -21
  139. package/src/components/Footer/Footer.stories.tsx +392 -328
  140. package/src/components/Form/Checkbox.stories.tsx +143 -9
  141. package/src/components/Form/Checkbox.test.tsx +63 -0
  142. package/src/components/Form/Checkbox.tsx +90 -52
  143. package/src/components/Form/Form.stories.tsx +121 -22
  144. package/src/components/Form/FormGroup.stories.tsx +128 -5
  145. package/src/components/Form/Input.stories.tsx +28 -16
  146. package/src/components/Form/Input.test.tsx +59 -0
  147. package/src/components/Form/Input.tsx +97 -95
  148. package/src/components/Form/Radio.stories.tsx +232 -97
  149. package/src/components/Form/Radio.tsx +2 -2
  150. package/src/components/Form/Select.stories.tsx +144 -12
  151. package/src/components/Form/Select.tsx +2 -2
  152. package/src/components/Form/Textarea.stories.tsx +171 -13
  153. package/src/components/Form/Textarea.test.tsx +45 -0
  154. package/src/components/Form/Textarea.tsx +88 -86
  155. package/src/components/Hero/Hero.stories.tsx +333 -32
  156. package/src/components/List/List.stories.tsx +143 -5
  157. package/src/components/Modal/Modal.stories.tsx +185 -46
  158. package/src/components/Navigation/Navbar/Navbar.stories.tsx +5 -5
  159. package/src/components/Navigation/Navbar/Navbar.tsx +1 -1
  160. package/src/components/Navigation/README.md +1 -1
  161. package/src/components/Pagination/Pagination.stories.tsx +5 -2
  162. package/src/components/Pagination/Pagination.tsx +1 -1
  163. package/src/components/PhotoViewer/PhotoViewer.stories.tsx +10 -10
  164. package/src/components/Popover/Popover.stories.tsx +449 -99
  165. package/src/components/ProductReview/ProductReview.tsx +1 -1
  166. package/src/components/Progress/Progress.stories.tsx +167 -5
  167. package/src/components/Progress/Progress.tsx +46 -46
  168. package/src/components/Rating/Rating.stories.tsx +4 -4
  169. package/src/components/Rating/Rating.tsx +8 -8
  170. package/src/components/River/River.stories.tsx +1 -1
  171. package/src/components/SectionIntro/SectionIntro.stories.tsx +240 -48
  172. package/src/components/Slider/Slider.stories.tsx +63 -63
  173. package/src/components/Spinner/Spinner.stories.tsx +104 -10
  174. package/src/components/Spinner/Spinner.test.tsx +35 -0
  175. package/src/components/Spinner/Spinner.tsx +9 -2
  176. package/src/components/Steps/Steps.stories.tsx +172 -43
  177. package/src/components/Tabs/Tabs.stories.tsx +136 -10
  178. package/src/components/Testimonial/Testimonial.stories.tsx +121 -4
  179. package/src/components/Todo/Todo.stories.tsx +198 -9
  180. package/src/components/Toggle/Toggle.stories.tsx +153 -43
  181. package/src/components/Toggle/Toggle.test.tsx +91 -0
  182. package/src/components/Toggle/Toggle.tsx +44 -27
  183. package/src/components/Tooltip/Tooltip.stories.tsx +194 -104
  184. package/src/components/Tooltip/Tooltip.tsx +1 -1
  185. package/src/components/Upload/Upload.stories.tsx +113 -24
  186. package/src/layouts/Grid/Grid.stories.tsx +49 -49
  187. package/src/layouts/MasonryGrid/MasonryGrid.stories.tsx +2 -2
  188. package/src/lib/README.md +2 -2
  189. package/src/lib/__tests__/theme-tools.test.ts +193 -0
  190. package/src/lib/composables/index.ts +2 -2
  191. package/src/lib/composables/useAccordion.ts +12 -3
  192. package/src/lib/composables/useAtomixGlass.ts +28 -56
  193. package/src/lib/composables/useBreadcrumb.ts +2 -2
  194. package/src/lib/composables/useCallout.ts +7 -7
  195. package/src/lib/composables/useChartExport.ts +2 -7
  196. package/src/lib/composables/useDataTable.ts +46 -29
  197. package/src/lib/composables/useNavbar.ts +1 -1
  198. package/src/lib/constants/components.ts +10 -33
  199. package/src/lib/storybook/InteractiveDemo.tsx +113 -0
  200. package/src/lib/storybook/PreviewContainer.tsx +36 -0
  201. package/src/lib/storybook/VariantsGrid.tsx +21 -0
  202. package/src/lib/storybook/index.ts +3 -0
  203. package/src/lib/theme/core/createThemeObject.ts +9 -5
  204. package/src/lib/theme/devtools/CLI.ts +155 -0
  205. package/src/lib/theme/devtools/DesignTokensCustomizer.stories.tsx +213 -0
  206. package/src/lib/theme/devtools/DesignTokensCustomizer.tsx +566 -0
  207. package/src/lib/theme/devtools/LiveEditor.tsx +2 -1
  208. package/src/lib/theme/devtools/index.ts +3 -0
  209. package/src/lib/theme/errors/errors.ts +8 -0
  210. package/src/lib/theme/runtime/ThemeProvider.tsx +117 -57
  211. package/src/lib/theme/runtime/__tests__/ThemeProvider.integration.test.tsx +305 -0
  212. package/src/lib/theme/runtime/__tests__/ThemeProvider.test.tsx +588 -0
  213. package/src/lib/theme/utils/__tests__/themeValidation.test.ts +264 -0
  214. package/src/lib/theme/utils/index.ts +1 -0
  215. package/src/lib/theme/utils/themeValidation.ts +501 -0
  216. package/src/lib/theme-tools.ts +32 -3
  217. package/src/lib/types/components.ts +82 -27
  218. package/src/lib/utils/__tests__/csv.test.ts +45 -0
  219. package/src/lib/utils/csv.ts +17 -0
  220. package/src/lib/utils/dataTableExport.ts +1 -10
  221. package/src/lib/utils/themeNaming.ts +1 -1
  222. package/src/styles/01-settings/_index.scss +2 -1
  223. package/src/styles/01-settings/_settings.accordion.scss +28 -7
  224. package/src/styles/01-settings/_settings.colors.scss +11 -11
  225. package/src/styles/01-settings/_settings.typography.scss +5 -5
  226. package/src/styles/02-tools/_tools.utility-api.scss +14 -0
  227. package/src/styles/06-components/_components.accordion.scss +56 -14
  228. package/src/styles/06-components/_components.callout.scss +29 -33
  229. package/src/styles/06-components/_components.checkbox.scss +23 -17
  230. package/src/styles/06-components/_index.scss +1 -1
  231. package/src/styles/99-utilities/_index.scss +2 -0
  232. package/src/styles/99-utilities/_utilities.display.scss +14 -3
  233. package/src/styles/99-utilities/_utilities.flex.scss +10 -10
  234. package/src/styles/99-utilities/_utilities.scss +3 -1
  235. package/src/styles/99-utilities/_utilities.text-gradient.scss +45 -0
  236. package/src/styles/99-utilities/_utilities.text.scss +28 -8
  237. package/themes/dark-complementary/README.md +98 -0
  238. package/themes/dark-complementary/index.scss +158 -0
  239. package/themes/default-light/README.md +81 -0
  240. package/themes/default-light/index.scss +154 -0
  241. package/themes/high-contrast/README.md +105 -0
  242. package/themes/high-contrast/index.scss +172 -0
  243. package/themes/test-theme/README.md +38 -0
  244. package/themes/test-theme/index.scss +47 -0
  245. package/scripts/cli/__tests__/cli-commands.test.js +0 -204
  246. package/scripts/cli/__tests__/vitest.config.js +0 -26
  247. package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +0 -1438
  248. package/src/lib/composables/useButton.ts +0 -93
  249. 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,167 @@ 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',
210
- },
211
- };
212
-
213
- // Loading example
214
- export const Loading: Story = {
215
- args: {
216
- data: users,
217
- columns,
218
- loading: true,
361
+ parameters: {
362
+ docs: {
363
+ description: {
364
+ story: 'DataTable with column-specific filters. Each filterable column has its own filter input.',
365
+ },
366
+ },
219
367
  },
220
368
  };
221
369
 
222
- // Interactive example with row click handler
223
- export const Interactive: Story = {
224
- render: args => {
225
- const [selectedUser, setSelectedUser] = useState<any>(null);
370
+ // ========================================
371
+ // ROW SELECTION STORIES
372
+ // ========================================
226
373
 
227
- const handleRowClick = (row: any) => {
228
- setSelectedUser(row);
229
- };
374
+ export const WithRowSelectionSingle: Story = {
375
+ render: (args) => {
376
+ const [selectedRow, setSelectedRow] = useState<any>(null);
230
377
 
231
378
  return (
232
379
  <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>
380
+ <DataTable
381
+ {...args}
382
+ data={args.data || users}
383
+ columns={args.columns || columns}
384
+ selectionMode="single"
385
+ onSelectionChange={(rows) => setSelectedRow(rows[0] || null)}
386
+ />
387
+ {selectedRow && (
388
+ <div className="u-mt-4 u-p-4 u-bg-gray-100 u-rounded u-text-sm">
389
+ <strong>Selected:</strong>
390
+ <pre className="u-mt-2 u-text-xs">
391
+ {JSON.stringify(selectedRow, null, 2)}
392
+ </pre>
245
393
  </div>
246
394
  )}
247
395
  </div>
@@ -252,24 +400,32 @@ export const Interactive: Story = {
252
400
  columns,
253
401
  sortable: true,
254
402
  },
403
+ parameters: {
404
+ docs: {
405
+ description: {
406
+ story: 'DataTable with single row selection enabled. Select a row using radio buttons.',
407
+ },
408
+ },
409
+ },
255
410
  };
256
411
 
257
- // Row selection - multiple
258
- export const RowSelectionMultiple: Story = {
259
- render: args => {
412
+ export const WithRowSelectionMultiple: Story = {
413
+ render: (args) => {
260
414
  const [selectedRows, setSelectedRows] = useState<any[]>([]);
261
415
 
262
416
  return (
263
417
  <div>
264
418
  <DataTable
265
419
  {...args}
420
+ data={args.data || users}
421
+ columns={args.columns || columns}
266
422
  selectionMode="multiple"
267
423
  onSelectionChange={(rows, ids) => setSelectedRows(rows)}
268
424
  />
269
425
  {selectedRows.length > 0 && (
270
- <div style={{ marginTop: '1rem', padding: '1rem', background: '#f5f5f5', borderRadius: '4px' }}>
426
+ <div className="u-mt-4 u-p-4 u-bg-gray-100 u-rounded u-text-sm">
271
427
  <strong>Selected: {selectedRows.length} row(s)</strong>
272
- <pre style={{ marginTop: '0.5rem', fontSize: '0.875rem' }}>
428
+ <pre className="u-mt-2 u-text-xs">
273
429
  {JSON.stringify(selectedRows.map(r => r.name), null, 2)}
274
430
  </pre>
275
431
  </div>
@@ -291,24 +447,30 @@ export const RowSelectionMultiple: Story = {
291
447
  },
292
448
  };
293
449
 
294
- // Row selection - single
295
- export const RowSelectionSingle: Story = {
296
- render: args => {
297
- const [selectedRow, setSelectedRow] = useState<any>(null);
450
+ // ========================================
451
+ // ADVANCED FEATURES STORIES
452
+ // ========================================
453
+
454
+ export const WithInteractiveRows: Story = {
455
+ render: (args) => {
456
+ const [selectedUser, setSelectedUser] = useState<any>(null);
457
+
458
+ const handleRowClick = (row: any) => {
459
+ setSelectedUser(row);
460
+ };
298
461
 
299
462
  return (
300
463
  <div>
301
- <DataTable
302
- {...args}
303
- selectionMode="single"
304
- onSelectionChange={(rows) => setSelectedRow(rows[0] || null)}
464
+ <DataTable
465
+ {...args}
466
+ data={args.data || users}
467
+ columns={args.columns || columns}
468
+ onRowClick={handleRowClick}
305
469
  />
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>
470
+ {selectedUser && (
471
+ <div className="u-mt-4 u-p-4 u-border u-border-gray-300 u-rounded u-bg-white">
472
+ <h3 className="u-m-0">Selected User:</h3>
473
+ <pre className="u-m-0">{JSON.stringify(selectedUser, null, 2)}</pre>
312
474
  </div>
313
475
  )}
314
476
  </div>
@@ -319,37 +481,50 @@ export const RowSelectionSingle: Story = {
319
481
  columns,
320
482
  sortable: true,
321
483
  },
484
+ };
485
+
486
+ // ========================================
487
+ // PAGINATION STORIES
488
+ // ========================================
489
+
490
+ export const WithPagination: Story = {
491
+ args: {
492
+ data: largeDataSet,
493
+ columns: columns,
494
+ paginated: true,
495
+ pageSize: 5,
496
+ },
322
497
  parameters: {
323
498
  docs: {
324
499
  description: {
325
- story: 'DataTable with single row selection enabled. Select a row using radio buttons.',
500
+ story: 'DataTable with pagination enabled to handle large datasets.',
326
501
  },
327
502
  },
328
503
  },
329
504
  };
330
505
 
331
- // Column-specific filtering
332
- export const ColumnFilters: Story = {
506
+ export const WithPaginationLargeDataset: Story = {
333
507
  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,
508
+ data: largeDataSet,
509
+ columns,
510
+ paginated: true,
511
+ pageSize: 10,
341
512
  },
342
513
  parameters: {
343
514
  docs: {
344
515
  description: {
345
- story: 'DataTable with column-specific filters. Each filterable column has its own filter input.',
516
+ story:
517
+ 'Pagination with a large dataset (100 items) demonstrating first/last buttons and ellipsis.',
346
518
  },
347
519
  },
348
520
  },
349
521
  };
350
522
 
351
- // Column resizing
352
- export const ResizableColumns: Story = {
523
+ // ========================================
524
+ // COLUMN CONFIGURATION STORIES
525
+ // ========================================
526
+
527
+ export const WithResizableColumns: Story = {
353
528
  args: {
354
529
  data: users,
355
530
  columns: columns.map(col => ({
@@ -369,8 +544,7 @@ export const ResizableColumns: Story = {
369
544
  },
370
545
  };
371
546
 
372
- // Column reordering
373
- export const ReorderableColumns: Story = {
547
+ export const WithReorderableColumns: Story = {
374
548
  args: {
375
549
  data: users,
376
550
  columns,
@@ -386,8 +560,7 @@ export const ReorderableColumns: Story = {
386
560
  },
387
561
  };
388
562
 
389
- // Column visibility toggle
390
- export const ColumnVisibility: Story = {
563
+ export const WithColumnVisibilityToggle: Story = {
391
564
  args: {
392
565
  data: users,
393
566
  columns,
@@ -403,8 +576,11 @@ export const ColumnVisibility: Story = {
403
576
  },
404
577
  };
405
578
 
406
- // Export functionality
407
- export const Exportable: Story = {
579
+ // ========================================
580
+ // EXPORT & CUSTOMIZATION STORIES
581
+ // ========================================
582
+
583
+ export const WithExportFunctionality: Story = {
408
584
  args: {
409
585
  data: users,
410
586
  columns,
@@ -422,8 +598,7 @@ export const Exportable: Story = {
422
598
  },
423
599
  };
424
600
 
425
- // Sticky headers
426
- export const StickyHeaders: Story = {
601
+ export const WithStickyHeaders: Story = {
427
602
  args: {
428
603
  data: largeDataSet,
429
604
  columns,
@@ -442,20 +617,45 @@ export const StickyHeaders: Story = {
442
617
  },
443
618
  };
444
619
 
445
- // All advanced features
620
+ // ========================================
621
+ // COMPREHENSIVE EXAMPLES
622
+ // ========================================
623
+
624
+ export const CompleteFeatures: Story = {
625
+ args: {
626
+ data: largeDataSet,
627
+ columns,
628
+ sortable: true,
629
+ filterable: true,
630
+ paginated: true,
631
+ pageSize: 10,
632
+ striped: true,
633
+ bordered: true,
634
+ },
635
+ parameters: {
636
+ docs: {
637
+ description: {
638
+ story: 'A complete data table with sorting, filtering, and pagination enabled.',
639
+ },
640
+ },
641
+ },
642
+ };
643
+
446
644
  export const AllAdvancedFeatures: Story = {
447
- render: args => {
645
+ render: (args) => {
448
646
  const [selectedRows, setSelectedRows] = useState<any[]>([]);
449
647
 
450
648
  return (
451
649
  <div>
452
650
  <DataTable
453
651
  {...args}
652
+ data={args.data || largeDataSet}
653
+ columns={args.columns || columns}
454
654
  selectionMode="multiple"
455
655
  onSelectionChange={(rows) => setSelectedRows(rows)}
456
656
  />
457
657
  {selectedRows.length > 0 && (
458
- <div style={{ marginTop: '1rem', padding: '1rem', background: '#f5f5f5', borderRadius: '4px' }}>
658
+ <div className="u-mt-4 u-p-4 u-bg-gray-100 u-rounded">
459
659
  <strong>Selected: {selectedRows.length} row(s)</strong>
460
660
  </div>
461
661
  )}