@shohojdhara/atomix 0.3.4 → 0.3.6

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 (237) hide show
  1. package/README.md +101 -199
  2. package/atomix.config.ts +241 -0
  3. package/dist/atomix.css +269 -189
  4. package/dist/atomix.css.map +1 -0
  5. package/dist/atomix.min.css +15179 -11
  6. package/dist/atomix.min.css.map +1 -0
  7. package/dist/charts.d.ts +1929 -0
  8. package/dist/charts.js +6477 -0
  9. package/dist/charts.js.map +1 -0
  10. package/dist/core.d.ts +1289 -0
  11. package/dist/core.js +3373 -0
  12. package/dist/core.js.map +1 -0
  13. package/dist/forms.d.ts +1085 -0
  14. package/dist/forms.js +2466 -0
  15. package/dist/forms.js.map +1 -0
  16. package/dist/heavy.d.ts +636 -0
  17. package/dist/heavy.js +4566 -0
  18. package/dist/heavy.js.map +1 -0
  19. package/dist/index.d.ts +5171 -4792
  20. package/dist/index.esm.js +6098 -4563
  21. package/dist/index.esm.js.map +1 -1
  22. package/dist/index.js +6291 -4747
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.min.js +1 -1
  25. package/dist/index.min.js.map +1 -1
  26. package/dist/layout.d.ts +300 -0
  27. package/dist/layout.js +336 -0
  28. package/dist/layout.js.map +1 -0
  29. package/dist/theme.d.ts +2122 -0
  30. package/dist/theme.js +6084 -0
  31. package/dist/theme.js.map +1 -0
  32. package/package.json +59 -27
  33. package/scripts/atomix-cli.js +544 -16
  34. package/scripts/cli/__tests__/cli-commands.test.js +204 -0
  35. package/scripts/cli/__tests__/utils.test.js +201 -0
  36. package/scripts/cli/__tests__/vitest.config.js +26 -0
  37. package/scripts/cli/interactive-init.js +1 -1
  38. package/scripts/cli/token-manager.js +32 -7
  39. package/scripts/cli/utils.js +347 -0
  40. package/src/components/Accordion/Accordion.stories.tsx +50 -17
  41. package/src/components/Accordion/Accordion.tsx +5 -54
  42. package/src/components/Accordion/index.ts +1 -1
  43. package/src/components/AtomixGlass/AtomixGlass.tsx +65 -31
  44. package/src/components/AtomixGlass/AtomixGlassContainer.tsx +11 -4
  45. package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +1 -32
  46. package/src/components/AtomixGlass/stories/Examples.stories.tsx +2 -2
  47. package/src/components/AtomixGlass/stories/shared-components.tsx +0 -31
  48. package/src/components/Avatar/Avatar.stories.tsx +7 -0
  49. package/src/components/Avatar/Avatar.tsx +3 -3
  50. package/src/components/Badge/Badge.stories.tsx +91 -13
  51. package/src/components/Badge/Badge.tsx +3 -3
  52. package/src/components/Block/Block.stories.tsx +7 -23
  53. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +7 -0
  54. package/src/components/Breadcrumb/Breadcrumb.tsx +3 -3
  55. package/src/components/Button/Button.stories.tsx +141 -22
  56. package/src/components/Button/ButtonGroup.stories.tsx +315 -0
  57. package/src/components/Button/ButtonGroup.tsx +67 -0
  58. package/src/components/Button/index.ts +2 -0
  59. package/src/components/Callout/Callout.stories.tsx +8 -6
  60. package/src/components/Card/Card.stories.tsx +82 -28
  61. package/src/components/Card/ElevationCard.tsx +1 -1
  62. package/src/components/Chart/AnimatedChart.tsx +19 -18
  63. package/src/components/Chart/AreaChart.tsx +5 -2
  64. package/src/components/Chart/BarChart.tsx +1 -1
  65. package/src/components/Chart/BubbleChart.tsx +6 -6
  66. package/src/components/Chart/CandlestickChart.tsx +0 -1
  67. package/src/components/Chart/Chart.stories.tsx +5 -7
  68. package/src/components/Chart/Chart.tsx +0 -16
  69. package/src/components/Chart/ChartRenderer.tsx +1 -1
  70. package/src/components/Chart/ChartToolbar.tsx +1 -0
  71. package/src/components/Chart/DonutChart.tsx +0 -1
  72. package/src/components/Chart/FunnelChart.tsx +1 -2
  73. package/src/components/Chart/GaugeChart.tsx +0 -1
  74. package/src/components/Chart/HeatmapChart.tsx +0 -1
  75. package/src/components/Chart/LineChart.tsx +0 -1
  76. package/src/components/Chart/MultiAxisChart.tsx +0 -1
  77. package/src/components/Chart/PieChart.tsx +0 -1
  78. package/src/components/Chart/RadarChart.tsx +19 -13
  79. package/src/components/Chart/ScatterChart.tsx +3 -4
  80. package/src/components/Chart/TreemapChart.tsx +2 -1
  81. package/src/components/Chart/WaterfallChart.tsx +0 -2
  82. package/src/components/Chart/types.ts +12 -2
  83. package/src/components/Chart/utils.ts +4 -3
  84. package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +7 -0
  85. package/src/components/DataTable/DataTable.stories.tsx +23 -16
  86. package/src/components/DataTable/DataTable.tsx +3 -3
  87. package/src/components/DatePicker/DatePicker.stories.tsx +27 -19
  88. package/src/components/Dropdown/Dropdown.stories.tsx +11 -19
  89. package/src/components/Dropdown/Dropdown.tsx +12 -9
  90. package/src/components/EdgePanel/EdgePanel.stories.tsx +1 -0
  91. package/src/components/Footer/Footer.stories.tsx +8 -6
  92. package/src/components/Footer/FooterLink.tsx +9 -2
  93. package/src/components/Footer/FooterSection.tsx +3 -3
  94. package/src/components/Form/Checkbox.stories.tsx +7 -0
  95. package/src/components/Form/Checkbox.tsx +3 -3
  96. package/src/components/Form/Form.stories.tsx +7 -0
  97. package/src/components/Form/FormGroup.stories.tsx +9 -1
  98. package/src/components/Form/Input.stories.tsx +69 -16
  99. package/src/components/Form/Input.tsx +4 -2
  100. package/src/components/Form/Radio.stories.tsx +9 -1
  101. package/src/components/Form/Radio.tsx +3 -3
  102. package/src/components/Form/Select.stories.tsx +9 -1
  103. package/src/components/Form/Select.tsx +3 -3
  104. package/src/components/Form/Textarea.stories.tsx +10 -2
  105. package/src/components/Form/Textarea.tsx +4 -2
  106. package/src/components/Hero/Hero.stories.tsx +7 -0
  107. package/src/components/List/List.stories.tsx +10 -3
  108. package/src/components/List/List.tsx +3 -3
  109. package/src/components/List/ListGroup.tsx +3 -1
  110. package/src/components/Messages/Messages.stories.tsx +8 -7
  111. package/src/components/Modal/Modal.stories.tsx +17 -6
  112. package/src/components/Modal/Modal.tsx +3 -3
  113. package/src/components/Navigation/Menu/MegaMenu.tsx +9 -3
  114. package/src/components/Navigation/Menu/Menu.stories.tsx +7 -0
  115. package/src/components/Navigation/Menu/Menu.tsx +9 -3
  116. package/src/components/Navigation/Nav/Nav.stories.tsx +7 -0
  117. package/src/components/Navigation/Navbar/Navbar.stories.tsx +1 -0
  118. package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +1 -1
  119. package/src/components/Pagination/Pagination.stories.tsx +188 -111
  120. package/src/components/Pagination/Pagination.tsx +88 -7
  121. package/src/components/PhotoViewer/PhotoViewer.stories.tsx +10 -5
  122. package/src/components/PhotoViewer/PhotoViewerImage.tsx +2 -2
  123. package/src/components/Popover/Popover.stories.tsx +191 -115
  124. package/src/components/Popover/Popover.tsx +4 -4
  125. package/src/components/ProductReview/ProductReview.stories.tsx +80 -58
  126. package/src/components/Progress/Progress.stories.tsx +79 -49
  127. package/src/components/Progress/Progress.tsx +6 -2
  128. package/src/components/Rating/Rating.stories.tsx +109 -84
  129. package/src/components/Rating/Rating.tsx +5 -2
  130. package/src/components/River/River.stories.tsx +194 -114
  131. package/src/components/SectionIntro/SectionIntro.stories.tsx +19 -9
  132. package/src/components/Slider/Slider.stories.tsx +7 -0
  133. package/src/components/Slider/Slider.tsx +10 -9
  134. package/src/components/Spinner/Spinner.stories.tsx +15 -11
  135. package/src/components/Spinner/Spinner.tsx +3 -3
  136. package/src/components/Steps/Steps.stories.tsx +132 -98
  137. package/src/components/Tabs/Tabs.stories.tsx +163 -112
  138. package/src/components/Tabs/Tabs.tsx +3 -3
  139. package/src/components/Testimonial/Testimonial.stories.tsx +114 -68
  140. package/src/components/Todo/Todo.stories.tsx +38 -12
  141. package/src/components/Toggle/Toggle.stories.tsx +61 -28
  142. package/src/components/Tooltip/Tooltip.stories.tsx +318 -200
  143. package/src/components/Tooltip/Tooltip.tsx +3 -3
  144. package/src/components/Upload/Upload.stories.tsx +122 -84
  145. package/src/components/VideoPlayer/VideoPlayer.stories.tsx +7 -24
  146. package/src/components/index.ts +6 -2
  147. package/src/layouts/MasonryGrid/MasonryGrid.tsx +2 -2
  148. package/src/lib/composables/useAtomixGlass.ts +2 -3
  149. package/src/lib/composables/useChartPerformance.ts +102 -78
  150. package/src/lib/composables/useChartScale.ts +10 -0
  151. package/src/lib/composables/useHero.ts +9 -2
  152. package/src/lib/composables/useHeroBackgroundSlider.ts +5 -3
  153. package/src/lib/composables/useNavbar.ts +0 -10
  154. package/src/lib/composables/useSideMenu.ts +1 -0
  155. package/src/lib/composables/useVideoPlayer.ts +3 -2
  156. package/src/lib/config/loader.ts +57 -14
  157. package/src/lib/constants/components.ts +10 -0
  158. package/src/lib/hooks/index.ts +0 -1
  159. package/src/lib/hooks/useComponentCustomization.ts +11 -15
  160. package/src/lib/hooks/usePerformanceMonitor.ts +149 -0
  161. package/src/lib/patterns/index.ts +2 -2
  162. package/src/lib/patterns/slots.tsx +2 -2
  163. package/src/lib/theme/README.md +174 -0
  164. package/src/lib/theme/adapters/index.ts +31 -0
  165. package/src/lib/theme/adapters/themeAdapter.ts +287 -0
  166. package/src/lib/theme/config/__tests__/configLoader.test.ts +207 -0
  167. package/src/lib/theme/config/configLoader.ts +254 -0
  168. package/src/lib/theme/config/loader.ts +37 -48
  169. package/src/lib/theme/config/types.ts +2 -2
  170. package/src/lib/theme/config/validator.ts +15 -91
  171. package/src/lib/theme/{constants.ts → constants/constants.ts} +0 -18
  172. package/src/lib/theme/constants/index.ts +8 -0
  173. package/src/lib/theme/core/ThemeRegistry.ts +19 -6
  174. package/src/lib/theme/core/__tests__/createTheme.test.ts +132 -0
  175. package/src/lib/theme/core/composeTheme.ts +155 -0
  176. package/src/lib/theme/core/createTheme.ts +94 -0
  177. package/src/lib/theme/{createTheme.ts → core/createThemeObject.ts} +10 -6
  178. package/src/lib/theme/core/index.ts +5 -19
  179. package/src/lib/theme/devtools/Comparator.tsx +346 -22
  180. package/src/lib/theme/devtools/IMPROVEMENTS.md +139 -38
  181. package/src/lib/theme/devtools/Inspector.tsx +335 -51
  182. package/src/lib/theme/devtools/LiveEditor.tsx +489 -112
  183. package/src/lib/theme/devtools/Preview.tsx +471 -221
  184. package/src/lib/theme/{core → devtools}/ThemeValidator.ts +6 -3
  185. package/src/lib/theme/devtools/index.ts +14 -4
  186. package/src/lib/theme/devtools/useHistory.ts +130 -0
  187. package/src/lib/theme/errors/index.ts +12 -0
  188. package/src/lib/theme/generators/cssFile.ts +79 -0
  189. package/src/lib/theme/generators/generateCSS.ts +89 -0
  190. package/src/lib/theme/{generateCSSVariables.ts → generators/generateCSSVariables.ts} +4 -14
  191. package/src/lib/theme/generators/index.ts +19 -0
  192. package/src/lib/theme/i18n/rtl.ts +7 -7
  193. package/src/lib/theme/index.ts +120 -15
  194. package/src/lib/theme/runtime/ThemeApplicator.ts +53 -95
  195. package/src/lib/theme/{ThemeContext.tsx → runtime/ThemeContext.tsx} +1 -1
  196. package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +4 -4
  197. package/src/lib/theme/runtime/ThemeProvider.tsx +456 -179
  198. package/src/lib/theme/runtime/index.ts +1 -2
  199. package/src/lib/theme/runtime/useTheme.ts +1 -2
  200. package/src/lib/theme/test/testTheme.ts +385 -0
  201. package/src/lib/theme/tokens/index.ts +12 -0
  202. package/src/lib/theme/tokens/tokens.ts +721 -0
  203. package/src/lib/theme/types.ts +6 -42
  204. package/src/lib/theme/{utils.ts → utils/domUtils.ts} +2 -2
  205. package/src/lib/theme/utils/index.ts +11 -0
  206. package/src/lib/theme/utils/injectCSS.ts +90 -0
  207. package/src/lib/theme/utils/themeHelpers.ts +78 -0
  208. package/src/lib/theme/{themeUtils.ts → utils/themeUtils.ts} +1 -1
  209. package/src/lib/theme-tools.ts +8 -9
  210. package/src/lib/types/components.ts +93 -34
  211. package/src/lib/types/partProps.ts +0 -16
  212. package/src/lib/utils/componentUtils.ts +1 -1
  213. package/src/lib/utils/fontPreloader.ts +148 -0
  214. package/src/lib/utils/index.ts +11 -0
  215. package/src/lib/utils/memoryMonitor.ts +189 -0
  216. package/src/styles/01-settings/_settings.design-tokens.scss +4 -1
  217. package/src/styles/01-settings/_settings.fonts.scss +2 -5
  218. package/src/styles/02-tools/_tools.button.scss +66 -79
  219. package/src/styles/06-components/_components.atomix-glass.scss +13 -3
  220. package/src/styles/06-components/_components.navbar.scss +0 -6
  221. package/src/styles/06-components/_components.pagination.scss +88 -0
  222. package/scripts/build-themes.js +0 -208
  223. package/scripts/sync-theme-config.js +0 -309
  224. package/src/components/AtomixGlass/atomixGLass.old.tsx +0 -1263
  225. package/src/lib/theme/composeTheme.ts +0 -370
  226. package/src/lib/theme/core/ThemeCache.ts +0 -283
  227. package/src/lib/theme/core/ThemeEngine.test.ts +0 -146
  228. package/src/lib/theme/core/ThemeEngine.ts +0 -657
  229. package/src/lib/theme/createThemeFromConfig.ts +0 -132
  230. package/src/lib/theme/devtools/CLI.ts +0 -364
  231. package/src/lib/theme/runtime/ThemeManager.test.ts +0 -192
  232. package/src/lib/theme/runtime/ThemeManager.ts +0 -442
  233. package/src/styles/03-generic/_generated-root.css +0 -5
  234. package/src/themes/README.md +0 -442
  235. package/src/themes/themes.config.js +0 -35
  236. /package/src/lib/theme/{cssVariableMapper.ts → adapters/cssVariableMapper.ts} +0 -0
  237. /package/src/lib/theme/{errors.ts → errors/errors.ts} +0 -0
@@ -45,6 +45,22 @@ const AnimatedChart = memo(
45
45
  }>
46
46
  >([]);
47
47
 
48
+ // Animation time tracking - moved outside callback
49
+ useEffect(() => {
50
+ const animateFrame = (timestamp: number) => {
51
+ timeRef.current = timestamp;
52
+ animationRef.current = requestAnimationFrame(animateFrame);
53
+ };
54
+
55
+ animationRef.current = requestAnimationFrame(animateFrame);
56
+
57
+ return () => {
58
+ if (animationRef.current) {
59
+ cancelAnimationFrame(animationRef.current);
60
+ }
61
+ };
62
+ }, []);
63
+
48
64
  const renderContent = useCallback(
49
65
  ({
50
66
  scales,
@@ -55,23 +71,7 @@ const AnimatedChart = memo(
55
71
  toolbarState,
56
72
  config: renderConfig,
57
73
  }: ChartRenderContentParams) => {
58
- // Use toolbar state if available, fallback to config for backward compatibility
59
74
  const shouldAnimate = toolbarState?.animationsEnabled ?? renderConfig?.animate ?? true;
60
- // Animation time tracking
61
- useEffect(() => {
62
- const animateFrame = (timestamp: number) => {
63
- timeRef.current = timestamp;
64
- animationRef.current = requestAnimationFrame(animateFrame);
65
- };
66
-
67
- animationRef.current = requestAnimationFrame(animateFrame);
68
-
69
- return () => {
70
- if (animationRef.current) {
71
- cancelAnimationFrame(animationRef.current);
72
- }
73
- };
74
- }, []);
75
75
 
76
76
  if (!chartDatasets.length) return null;
77
77
 
@@ -117,7 +117,7 @@ const AnimatedChart = memo(
117
117
 
118
118
  case 'area':
119
119
  case 'line':
120
- default:
120
+ default: {
121
121
  // Create animated line/area
122
122
  const points = dataset.data.map((point: any, pointIndex: number) => ({
123
123
  x: padding + (pointIndex / (dataset.data.length - 1)) * chartWidth,
@@ -181,6 +181,7 @@ const AnimatedChart = memo(
181
181
  });
182
182
  }
183
183
  break;
184
+ }
184
185
  }
185
186
  });
186
187
 
@@ -213,7 +214,7 @@ const AnimatedChart = memo(
213
214
  return (
214
215
  <BaseChart
215
216
  ref={ref}
216
- type="animated"
217
+ type="line"
217
218
  datasets={datasets}
218
219
  config={config}
219
220
  renderContent={renderContent}
@@ -33,7 +33,6 @@ const AreaChart = memo(
33
33
  }: ChartRenderContentParams) => {
34
34
  if (!renderedDatasets.length) return null;
35
35
 
36
- // Use toolbar state if available, fallback to config for backward compatibility
37
36
  const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? true;
38
37
 
39
38
  return (
@@ -100,7 +99,11 @@ const AreaChart = memo(
100
99
  {showTooltips && hoveredPoint && (
101
100
  <ChartTooltip
102
101
  dataPoint={
103
- renderedDatasets[hoveredPoint.datasetIndex]?.data?.[hoveredPoint.pointIndex]
102
+ renderedDatasets[hoveredPoint.datasetIndex]?.data?.[hoveredPoint.pointIndex] ?? {
103
+ label: '',
104
+ value: 0,
105
+ color: '',
106
+ }
104
107
  }
105
108
  datasetLabel={renderedDatasets[hoveredPoint.datasetIndex]?.label}
106
109
  datasetColor={
@@ -43,7 +43,6 @@ const BarChart = memo(
43
43
  }: ChartRenderContentParams) => {
44
44
  if (!renderedDatasets.length) return null;
45
45
 
46
- // Use toolbar state if available, fallback to config for backward compatibility
47
46
  const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? true;
48
47
 
49
48
  const barDimensions = calculateBarDimensions(
@@ -58,6 +57,7 @@ const BarChart = memo(
58
57
  <>
59
58
  {barDimensions.map((bar, index) => {
60
59
  const dataset = renderedDatasets[bar.datasetIndex];
60
+ if (!dataset) return null;
61
61
  const point = dataset.data?.[bar.pointIndex];
62
62
  const color = dataset.color || colors[bar.datasetIndex];
63
63
  const isHovered =
@@ -8,7 +8,7 @@ export interface BubbleDataPoint {
8
8
  x: number;
9
9
  y: number;
10
10
  size: number;
11
- value?: number;
11
+ value: number;
12
12
  color?: string;
13
13
  metadata?: Record<string, any>;
14
14
  }
@@ -109,10 +109,9 @@ const BubbleChart = memo(
109
109
  hoveredPoint,
110
110
  toolbarState,
111
111
  config: renderConfig,
112
- }: ChartRenderContentParams) => {
112
+ }: any) => {
113
113
  if (!bubbleData.length) return null;
114
114
 
115
- // Use toolbar state if available, fallback to config for backward compatibility
116
115
  const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? true;
117
116
 
118
117
  // Calculate bubble sizes based on data
@@ -197,9 +196,10 @@ const BubbleChart = memo(
197
196
  {bubbles}
198
197
  {showTooltips &&
199
198
  hoveredPoint &&
200
- hoveredPoint.pointIndex < bubbleData.length && (
199
+ hoveredPoint.pointIndex < bubbleData.length &&
200
+ bubbleData[hoveredPoint.pointIndex] && (
201
201
  <ChartTooltip
202
- dataPoint={bubbleData[hoveredPoint.pointIndex]}
202
+ dataPoint={bubbleData[hoveredPoint.pointIndex]!}
203
203
  datasetLabel="Bubbles"
204
204
  datasetColor={
205
205
  bubbleData[hoveredPoint.pointIndex]?.color ||
@@ -220,7 +220,7 @@ const BubbleChart = memo(
220
220
  <BaseChart
221
221
  ref={ref}
222
222
  type="bubble"
223
- datasets={datasets}
223
+ datasets={datasets as any}
224
224
  config={config}
225
225
  renderContent={renderContent}
226
226
  onDataPointClick={onDataPointClick}
@@ -189,7 +189,6 @@ const CandlestickChart = memo(
189
189
  }: ChartRenderContentParams) => {
190
190
  if (!candlestickData.length) return null;
191
191
 
192
- // Use toolbar state if available, fallback to config for backward compatibility
193
192
  const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? candlestickOptions.showTooltips ?? true;
194
193
 
195
194
  const padding = 40;
@@ -30,7 +30,7 @@ import {
30
30
  WaterfallChart,
31
31
  } from './index';
32
32
 
33
- const meta: Meta<typeof Chart> = {
33
+ const meta = {
34
34
  title: 'Components/Chart',
35
35
  component: Chart,
36
36
  parameters: {
@@ -38,17 +38,15 @@ const meta: Meta<typeof Chart> = {
38
38
  docs: {
39
39
  description: {
40
40
  component:
41
- 'Modern chart library with 20+ chart types, real-time updates, animations, and advanced interactions.',
42
- },
43
- source: {
44
- code: `<Icon name="Rocket" /> Modern chart library with 20+ chart types, real-time updates, animations, and advanced interactions.`,
41
+ 'The Chart component provides a comprehensive charting library with 20+ chart types including line, bar, pie, area, and more. Charts support real-time data updates, animations, interactive tooltips, and advanced customization options. Ideal for dashboards, analytics, data visualization, and any application requiring graphical data representation.',
45
42
  },
46
43
  },
47
44
  },
48
- };
45
+ tags: ['autodocs'],
46
+ } satisfies Meta<typeof Chart>;
49
47
 
50
48
  export default meta;
51
- type Story = StoryObj<typeof Chart>;
49
+ type Story = StoryObj<typeof meta>;
52
50
 
53
51
  // Glass Variant Story
54
52
  export const GlassVariant: Story = {
@@ -205,22 +205,6 @@ const Chart = memo(
205
205
  panEnabled,
206
206
  });
207
207
 
208
- // Legacy handlers for backward compatibility
209
- const handleFullscreen = useCallback(() => {
210
- toolbarHandlers.onFullscreen(!toolbarState.isFullscreen);
211
- }, [toolbarHandlers, toolbarState.isFullscreen]);
212
-
213
- const handleExport = useCallback(
214
- async (format: string) => {
215
- await toolbarHandlers.onExport(format);
216
- },
217
- [toolbarHandlers]
218
- );
219
-
220
- const handleRefresh = useCallback(() => {
221
- toolbarHandlers.onRefresh();
222
- }, [toolbarHandlers]);
223
-
224
208
  // Sync all toolbar state with component state
225
209
  useEffect(() => {
226
210
  setIsFullscreen(toolbarState.isFullscreen);
@@ -238,7 +238,7 @@ const ChartRenderer = memo(
238
238
  onMouseUp: handleMouseUp,
239
239
  onWheel: () => {
240
240
  // Wheel handling is done via native event listener (non-passive)
241
- // This is kept for API compatibility but not used
241
+ // Wheel handling is done via native event listener (non-passive)
242
242
  },
243
243
  }),
244
244
  [
@@ -201,6 +201,7 @@ const ChartToolbar = memo(
201
201
  document.removeEventListener('mousedown', handleClickOutside);
202
202
  };
203
203
  }
204
+ return undefined;
204
205
  }, [showExportMenu, showSettingsMenu]);
205
206
 
206
207
  // Handle keyboard shortcuts
@@ -172,7 +172,6 @@ const DonutChart = memo(
172
172
  };
173
173
  });
174
174
 
175
- // Use toolbar state if available, fallback to config for backward compatibility
176
175
  const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? true;
177
176
 
178
177
  return (
@@ -138,7 +138,6 @@ const FunnelChart = memo(
138
138
  }: ChartRenderContentParams) => {
139
139
  if (!funnelData.length) return null;
140
140
 
141
- // Use toolbar state if available, fallback to config for backward compatibility
142
141
  const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? true;
143
142
  const shouldAnimate = toolbarState?.animationsEnabled ?? renderConfig?.animate ?? animate;
144
143
 
@@ -281,7 +280,7 @@ const FunnelChart = memo(
281
280
  <g>{elements}</g>
282
281
  {showTooltips && hoveredPoint && funnelData[hoveredPoint.pointIndex] && (
283
282
  <ChartTooltip
284
- dataPoint={funnelData[hoveredPoint.pointIndex]}
283
+ dataPoint={funnelData[hoveredPoint.pointIndex]!}
285
284
  datasetLabel="Funnel Data"
286
285
  datasetColor={funnelData[hoveredPoint.pointIndex]?.color || colors[hoveredPoint.pointIndex % colors.length]}
287
286
  position={{
@@ -140,7 +140,6 @@ const GaugeChart = memo(
140
140
  }: ChartRenderContentParams) => {
141
141
  const width = scales.width;
142
142
 
143
- // Use toolbar state if available, fallback to config for backward compatibility
144
143
  const shouldAnimate = toolbarState?.animationsEnabled ?? renderConfig?.animate ?? animate;
145
144
  const height = scales.height;
146
145
  const centerX = width / 2;
@@ -267,7 +267,6 @@ const HeatmapChart = memo(
267
267
  }: ChartRenderContentParams) => {
268
268
  const { matrix, xLabels, yLabels } = processedData;
269
269
 
270
- // Use toolbar state if available, fallback to config for backward compatibility
271
270
  const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? true;
272
271
  if (!matrix.length) {
273
272
  return null;
@@ -80,7 +80,6 @@ const LineChart = memo(
80
80
  }: ChartRenderContentParams) => {
81
81
  if (!renderedDatasets.length) return null;
82
82
 
83
- // Use toolbar state if available, fallback to config for backward compatibility
84
83
  const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? true;
85
84
  const shouldAnimate = toolbarState?.animationsEnabled ?? renderConfig?.animate ?? mergedLineOptions.smooth;
86
85
 
@@ -164,7 +164,6 @@ const MultiAxisChart = memo(
164
164
  }: ChartRenderContentParams) => {
165
165
  if (!datasets.length) return null;
166
166
 
167
- // Use toolbar state if available, fallback to config for backward compatibility
168
167
  const effectiveShowTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? showTooltips ?? true;
169
168
  const effectiveShowGrid = toolbarState?.showGrid ?? true; // Grid visibility from toolbar
170
169
 
@@ -73,7 +73,6 @@ const PieChart = memo(
73
73
  };
74
74
  });
75
75
 
76
- // Use toolbar state if available, fallback to config for backward compatibility
77
76
  const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? true;
78
77
 
79
78
  return (
@@ -89,7 +89,6 @@ const RadarChart = memo(
89
89
  }: ChartRenderContentParams) => {
90
90
  if (!renderedDatasets.length) return null;
91
91
 
92
- // Use toolbar state if available, fallback to config for backward compatibility
93
92
  const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? true;
94
93
 
95
94
  const centerX = scales.width / 2;
@@ -97,6 +96,7 @@ const RadarChart = memo(
97
96
  const radius = Math.min(centerX, centerY) * 0.8;
98
97
 
99
98
  const firstDataset = renderedDatasets[0];
99
+ if (!firstDataset) return null;
100
100
  const dataPoints = firstDataset.data || [];
101
101
  const angleStep = (2 * Math.PI) / dataPoints.length;
102
102
 
@@ -195,24 +195,28 @@ const RadarChart = memo(
195
195
  points.push({ x, y, value, point: dataset.data[i] });
196
196
  }
197
197
 
198
- if (points.length === 0) return null;
198
+ if (points.length === 0 || !points[0]) return null;
199
199
 
200
200
  // Generate path
201
201
  let path = '';
202
202
  if (smooth && points.length > 2) {
203
203
  // For smooth curves, we would implement a more complex algorithm
204
204
  // For now, we'll just connect the points with straight lines
205
- path = `M ${points[0].x},${points[0].y}`;
205
+ path = `M ${points[0]!.x},${points[0]!.y}`;
206
206
  for (let i = 1; i < points.length; i++) {
207
- path += ` L ${points[i].x},${points[i].y}`;
207
+ if (points[i]) {
208
+ path += ` L ${points[i]!.x},${points[i]!.y}`;
209
+ }
208
210
  }
209
- path += ` L ${points[0].x},${points[0].y} Z`;
211
+ path += ` L ${points[0]!.x},${points[0]!.y} Z`;
210
212
  } else {
211
- path = `M ${points[0].x},${points[0].y}`;
213
+ path = `M ${points[0]!.x},${points[0]!.y}`;
212
214
  for (let i = 1; i < points.length; i++) {
213
- path += ` L ${points[i].x},${points[i].y}`;
215
+ if (points[i]) {
216
+ path += ` L ${points[i]!.x},${points[i]!.y}`;
217
+ }
214
218
  }
215
- path += ` L ${points[0].x},${points[0].y} Z`;
219
+ path += ` L ${points[0]!.x},${points[0]!.y} Z`;
216
220
  }
217
221
 
218
222
  return (
@@ -246,9 +250,11 @@ const RadarChart = memo(
246
250
  r={isHovered ? pointRadius * 1.5 : pointRadius}
247
251
  fill={color}
248
252
  className={`c-chart__radar-point ${isHovered ? 'c-chart__radar-point--hovered' : ''}`}
249
- onClick={() =>
250
- handlers.onDataPointClick?.(point.point, datasetIndex, pointIndex)
251
- }
253
+ onClick={() => {
254
+ if (point.point) {
255
+ handlers.onDataPointClick?.(point.point, datasetIndex, pointIndex);
256
+ }
257
+ }}
252
258
  onMouseEnter={e => {
253
259
  const rect = e.currentTarget.getBoundingClientRect();
254
260
  handlers.onPointHover(
@@ -276,10 +282,10 @@ const RadarChart = memo(
276
282
  {dataPaths}
277
283
  {axisLabels}
278
284
  </g>
279
- {showTooltips && hoveredPoint && (
285
+ {showTooltips && hoveredPoint && renderedDatasets[hoveredPoint.datasetIndex]?.data?.[hoveredPoint.pointIndex] && (
280
286
  <ChartTooltip
281
287
  dataPoint={
282
- renderedDatasets[hoveredPoint.datasetIndex]?.data?.[hoveredPoint.pointIndex]
288
+ renderedDatasets[hoveredPoint.datasetIndex]!.data![hoveredPoint.pointIndex]!
283
289
  }
284
290
  datasetLabel={renderedDatasets[hoveredPoint.datasetIndex]?.label}
285
291
  datasetColor={
@@ -52,7 +52,6 @@ const ScatterChart = memo(
52
52
  }: ChartRenderContentParams) => {
53
53
  if (!renderedDatasets.length) return null;
54
54
 
55
- // Use toolbar state if available, fallback to config for backward compatibility
56
55
  const showTooltips = toolbarState?.showTooltips ?? renderConfig?.showTooltips ?? true;
57
56
 
58
57
  const points: React.ReactNode[] = [];
@@ -60,7 +59,7 @@ const ScatterChart = memo(
60
59
  renderedDatasets.forEach((dataset: ChartDataset, datasetIndex: number) => {
61
60
  const color = dataset.color || colors[datasetIndex % colors.length];
62
61
 
63
- dataset.data?.forEach((point: ScatterDataPoint, pointIndex: number) => {
62
+ dataset.data?.forEach((point: any, pointIndex: number) => {
64
63
  const x =
65
64
  point.x !== undefined
66
65
  ? scales.padding.left + (point.x / 100) * scales.innerWidth
@@ -125,10 +124,10 @@ const ScatterChart = memo(
125
124
  return (
126
125
  <>
127
126
  {points}
128
- {showTooltips && hoveredPoint && (
127
+ {showTooltips && hoveredPoint && renderedDatasets[hoveredPoint.datasetIndex]?.data?.[hoveredPoint.pointIndex] && (
129
128
  <ChartTooltip
130
129
  dataPoint={
131
- renderedDatasets[hoveredPoint.datasetIndex]?.data?.[hoveredPoint.pointIndex]
130
+ renderedDatasets[hoveredPoint.datasetIndex]!.data![hoveredPoint.pointIndex]!
132
131
  }
133
132
  datasetLabel={renderedDatasets[hoveredPoint.datasetIndex]?.label}
134
133
  datasetColor={
@@ -197,7 +197,7 @@ const TreemapChart = memo(
197
197
  switch (scheme) {
198
198
  case 'category':
199
199
  return colors[index % colors.length];
200
- case 'depth':
200
+ case 'depth': {
201
201
  const depthColors = [
202
202
  'var(--atomix-blue-9)',
203
203
  'var(--atomix-blue-6)',
@@ -206,6 +206,7 @@ const TreemapChart = memo(
206
206
  'var(--atomix-blue-2)',
207
207
  ];
208
208
  return depthColors[Math.min(depth, depthColors.length - 1)];
209
+ }
209
210
  case 'value':
210
211
  if (data.length > 0) {
211
212
  const maxValue = Math.max(...data.map(d => d.value));
@@ -129,7 +129,6 @@ const WaterfallChart = memo(
129
129
  }: ChartRenderContentParams) => {
130
130
  if (!waterfallData.length) return null;
131
131
 
132
- // Use toolbar state if available, fallback to config for backward compatibility
133
132
  const shouldAnimate = toolbarState?.animationsEnabled ?? renderConfig?.animate ?? animate;
134
133
 
135
134
  const padding = 60;
@@ -409,4 +408,3 @@ const WaterfallChart = memo(
409
408
 
410
409
  WaterfallChart.displayName = 'WaterfallChart';
411
410
  export default WaterfallChart;
412
- export type { WaterfallChartProps, WaterfallDataPoint };
@@ -289,9 +289,19 @@ export interface ChartProps extends BaseComponentProps {
289
289
 
290
290
  /**
291
291
  * Chart scales interface
292
- * Imported from useChart for consistency
293
292
  */
294
- export type { ChartScales } from '../../lib/composables/useChart';
293
+ export interface ChartScales {
294
+ xScale: (index: number, dataLength?: number) => number;
295
+ yScale: (value: number) => number;
296
+ minValue: number;
297
+ maxValue: number;
298
+ valueRange: number;
299
+ innerWidth: number;
300
+ innerHeight: number;
301
+ width: number;
302
+ height: number;
303
+ padding: { top: number; right: number; bottom: number; left: number };
304
+ }
295
305
 
296
306
  /**
297
307
  * Chart interaction state
@@ -5,7 +5,8 @@
5
5
  * @returns Color string
6
6
  */
7
7
  export const getColorFromScheme = (colorScheme: string[], index: number): string => {
8
- return colorScheme[index % colorScheme.length];
8
+ const color = colorScheme[index % colorScheme.length];
9
+ return color || colorScheme[0] || '#000000';
9
10
  };
10
11
 
11
12
  /**
@@ -23,12 +24,12 @@ export const getColorFromValue = (
23
24
  colorScheme: string[]
24
25
  ): string => {
25
26
  if (minValue === maxValue) {
26
- return colorScheme[0];
27
+ return colorScheme[0] || '#000000';
27
28
  }
28
29
 
29
30
  const normalized = (value - minValue) / (maxValue - minValue);
30
31
  const index = Math.floor(normalized * (colorScheme.length - 1));
31
- return colorScheme[index];
32
+ return colorScheme[index] || colorScheme[0] || '#000000';
32
33
  };
33
34
 
34
35
  /**
@@ -8,7 +8,14 @@ const meta = {
8
8
  component: ColorModeToggle,
9
9
  parameters: {
10
10
  layout: 'centered',
11
+ docs: {
12
+ description: {
13
+ component:
14
+ 'The ColorModeToggle component provides a user-friendly switch for toggling between light and dark color modes. It automatically detects system preferences, persists user choices, and provides visual feedback. Essential for applications supporting theme customization and accessibility preferences.',
15
+ },
16
+ },
11
17
  },
18
+ tags: ['autodocs'],
12
19
  argTypes: {
13
20
  size: {
14
21
  control: 'select',
@@ -1,31 +1,38 @@
1
- import { Meta, StoryObj } from '@storybook/react';
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
2
  import { useState } from 'react';
3
3
  import { DataTableColumn } from '../../lib/types/components';
4
4
  import { DataTable } from './DataTable';
5
5
 
6
- const meta: Meta<typeof DataTable> = {
6
+ const meta = {
7
7
  title: 'Components/DataTable',
8
8
  component: DataTable,
9
9
  parameters: {
10
10
  layout: 'padded',
11
+ docs: {
12
+ 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.',
15
+ },
16
+ },
11
17
  },
18
+ tags: ['autodocs'],
12
19
  argTypes: {
13
- data: { control: 'object' },
14
- columns: { control: 'object' },
15
- sortable: { control: 'boolean' },
16
- filterable: { control: 'boolean' },
17
- paginated: { control: 'boolean' },
18
- pageSize: { control: 'number' },
19
- striped: { control: 'boolean' },
20
- bordered: { control: 'boolean' },
21
- dense: { control: 'boolean' },
22
- loading: { control: 'boolean' },
23
- emptyMessage: { control: 'text' },
24
- },
25
- };
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' },
31
+ },
32
+ } satisfies Meta<typeof DataTable>;
26
33
 
27
34
  export default meta;
28
- type Story = StoryObj<typeof DataTable>;
35
+ type Story = StoryObj<typeof meta>;
29
36
 
30
37
  // Generate more sample data for better pagination testing
31
38
  const generateUsers = (count: number) => {
@@ -1,4 +1,4 @@
1
- import React, { useRef } from 'react';
1
+ import React, { useRef, memo } from 'react';
2
2
  import { DataTableProps } from '../../lib/types/components';
3
3
  import { useDataTable } from '../../lib/composables/useDataTable';
4
4
  import { DATA_TABLE_CLASSES } from '../../lib/constants/components';
@@ -19,7 +19,7 @@ import { Pagination } from '../Pagination/Pagination';
19
19
  * />
20
20
  * ```
21
21
  */
22
- export const DataTable: React.FC<DataTableProps> = ({
22
+ export const DataTable: React.FC<DataTableProps> = memo(({
23
23
  data,
24
24
  columns,
25
25
  className,
@@ -205,7 +205,7 @@ export const DataTable: React.FC<DataTableProps> = ({
205
205
  {renderPagination()}
206
206
  </div>
207
207
  );
208
- };
208
+ });
209
209
 
210
210
  export type { DataTableProps };
211
211