@shohojdhara/atomix 0.4.1 → 0.4.3

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 (131) hide show
  1. package/dist/atomix.css +9351 -9259
  2. package/dist/atomix.css.map +1 -1
  3. package/dist/atomix.min.css +4 -4
  4. package/dist/atomix.min.css.map +1 -1
  5. package/dist/charts.d.ts +12 -19
  6. package/dist/charts.js +555 -358
  7. package/dist/charts.js.map +1 -1
  8. package/dist/core.d.ts +21 -24
  9. package/dist/core.js +435 -265
  10. package/dist/core.js.map +1 -1
  11. package/dist/forms.d.ts +11 -18
  12. package/dist/forms.js +411 -257
  13. package/dist/forms.js.map +1 -1
  14. package/dist/heavy.d.ts +14 -21
  15. package/dist/heavy.js +409 -254
  16. package/dist/heavy.js.map +1 -1
  17. package/dist/index.d.ts +38 -41
  18. package/dist/index.esm.js +731 -487
  19. package/dist/index.esm.js.map +1 -1
  20. package/dist/index.js +733 -492
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.min.js +1 -1
  23. package/dist/index.min.js.map +1 -1
  24. package/package.json +1 -1
  25. package/scripts/atomix-cli.js +34 -1
  26. package/src/components/AtomixGlass/AtomixGlass.tsx +82 -54
  27. package/src/components/AtomixGlass/AtomixGlassContainer.tsx +17 -18
  28. package/src/components/AtomixGlass/README.md +5 -5
  29. package/src/components/AtomixGlass/stories/Customization.stories.tsx +2 -2
  30. package/src/components/AtomixGlass/stories/Examples.stories.tsx +42 -42
  31. package/src/components/AtomixGlass/stories/Modes.stories.tsx +5 -5
  32. package/src/components/AtomixGlass/stories/Overview.stories.tsx +3 -3
  33. package/src/components/AtomixGlass/stories/Performance.stories.tsx +2 -2
  34. package/src/components/AtomixGlass/stories/Playground.stories.tsx +45 -45
  35. package/src/components/AtomixGlass/stories/Shaders.stories.tsx +3 -3
  36. package/src/components/Badge/Badge.stories.tsx +1 -1
  37. package/src/components/Badge/Badge.tsx +1 -1
  38. package/src/components/Breadcrumb/Breadcrumb.tsx +90 -77
  39. package/src/components/Breadcrumb/index.ts +2 -2
  40. package/src/components/Button/Button.stories.tsx +1 -1
  41. package/src/components/Button/Button.tsx +2 -1
  42. package/src/components/Button/README.md +2 -2
  43. package/src/components/Callout/Callout.test.tsx +3 -3
  44. package/src/components/Callout/Callout.tsx +2 -2
  45. package/src/components/Callout/README.md +2 -2
  46. package/src/components/Card/Card.tsx +31 -11
  47. package/src/components/Chart/Chart.stories.tsx +1 -1
  48. package/src/components/Chart/Chart.tsx +5 -5
  49. package/src/components/Chart/TreemapChart.tsx +37 -29
  50. package/src/components/DatePicker/readme.md +3 -3
  51. package/src/components/Dropdown/Dropdown.stories.tsx +1 -1
  52. package/src/components/Dropdown/Dropdown.tsx +276 -273
  53. package/src/components/EdgePanel/EdgePanel.stories.tsx +7 -7
  54. package/src/components/Footer/FooterLink.tsx +2 -2
  55. package/src/components/Form/Checkbox.stories.tsx +1 -1
  56. package/src/components/Form/Checkbox.tsx +1 -1
  57. package/src/components/Form/Input.stories.tsx +1 -1
  58. package/src/components/Form/Input.tsx +1 -1
  59. package/src/components/Form/Radio.stories.tsx +1 -1
  60. package/src/components/Form/Radio.tsx +1 -1
  61. package/src/components/Form/Select.stories.tsx +1 -1
  62. package/src/components/Form/Select.tsx +1 -1
  63. package/src/components/Form/Textarea.stories.tsx +1 -1
  64. package/src/components/Form/Textarea.tsx +1 -1
  65. package/src/components/Hero/Hero.stories.tsx +2 -2
  66. package/src/components/Hero/Hero.tsx +2 -2
  67. package/src/components/Messages/Messages.stories.tsx +1 -1
  68. package/src/components/Messages/Messages.tsx +2 -2
  69. package/src/components/Modal/Modal.stories.tsx +1 -1
  70. package/src/components/Navigation/Nav/Nav.stories.tsx +2 -2
  71. package/src/components/Navigation/Nav/Nav.tsx +1 -1
  72. package/src/components/Navigation/Nav/NavItem.tsx +6 -3
  73. package/src/components/Navigation/Navbar/Navbar.stories.tsx +3 -3
  74. package/src/components/Navigation/Navbar/Navbar.tsx +1 -1
  75. package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +2 -2
  76. package/src/components/Navigation/SideMenu/SideMenu.tsx +1 -1
  77. package/src/components/Pagination/Pagination.stories.tsx +1 -1
  78. package/src/components/Pagination/Pagination.tsx +1 -1
  79. package/src/components/Popover/Popover.stories.tsx +1 -1
  80. package/src/components/Popover/Popover.tsx +1 -1
  81. package/src/components/Progress/Progress.tsx +1 -1
  82. package/src/components/Rating/Rating.stories.tsx +1 -1
  83. package/src/components/Rating/Rating.test.tsx +73 -0
  84. package/src/components/Rating/Rating.tsx +25 -37
  85. package/src/components/Spinner/Spinner.tsx +1 -1
  86. package/src/components/Steps/Steps.stories.tsx +1 -1
  87. package/src/components/Steps/Steps.tsx +2 -2
  88. package/src/components/Tabs/Tabs.stories.tsx +1 -1
  89. package/src/components/Tabs/Tabs.tsx +1 -1
  90. package/src/components/Todo/Todo.tsx +0 -1
  91. package/src/components/Toggle/Toggle.stories.tsx +1 -1
  92. package/src/components/Toggle/Toggle.tsx +1 -1
  93. package/src/components/Tooltip/Tooltip.stories.tsx +1 -1
  94. package/src/components/VideoPlayer/VideoPlayer.stories.tsx +2 -2
  95. package/src/lib/composables/__tests__/useAtomixGlassPerf.test.tsx +88 -0
  96. package/src/lib/composables/__tests__/useChart.test.ts +50 -0
  97. package/src/lib/composables/__tests__/useChart.test.tsx +139 -0
  98. package/src/lib/composables/__tests__/useHeroBackgroundSlider.test.tsx +59 -0
  99. package/src/lib/composables/__tests__/useSliderAutoplay.test.tsx +68 -0
  100. package/src/lib/composables/atomix-glass/useGlassBackgroundDetection.ts +329 -0
  101. package/src/lib/composables/atomix-glass/useGlassCornerRadius.ts +82 -0
  102. package/src/lib/composables/atomix-glass/useGlassMouseTracking.ts +153 -0
  103. package/src/lib/composables/atomix-glass/useGlassOverLight.ts +198 -0
  104. package/src/lib/composables/atomix-glass/useGlassSize.ts +117 -0
  105. package/src/lib/composables/atomix-glass/useGlassState.ts +112 -0
  106. package/src/lib/composables/atomix-glass/useGlassTransforms.ts +160 -0
  107. package/src/lib/composables/glass-styles.ts +302 -0
  108. package/src/lib/composables/index.ts +0 -4
  109. package/src/lib/composables/useAtomixGlass.ts +331 -522
  110. package/src/lib/composables/useAtomixGlassStyles.ts +307 -0
  111. package/src/lib/composables/useBarChart.ts +1 -1
  112. package/src/lib/composables/useBreadcrumb.ts +6 -6
  113. package/src/lib/composables/useChart.ts +104 -21
  114. package/src/lib/composables/useHeroBackgroundSlider.ts +16 -7
  115. package/src/lib/composables/useSlider.ts +66 -34
  116. package/src/lib/theme/devtools/CLI.ts +1 -1
  117. package/src/lib/theme/utils/__tests__/themeUtils.test.ts +213 -0
  118. package/src/lib/types/components.ts +18 -21
  119. package/src/lib/utils/__tests__/dom.test.ts +100 -0
  120. package/src/lib/utils/__tests__/fontPreloader.test.ts +102 -0
  121. package/src/styles/02-tools/_tools.breakpoints.scss +1 -1
  122. package/src/styles/02-tools/_tools.utility-api.scss +6 -6
  123. package/src/styles/06-components/_components.accordion.scss +0 -2
  124. package/src/styles/06-components/_components.chart.scss +0 -1
  125. package/src/styles/06-components/_components.dropdown.scss +0 -1
  126. package/src/styles/06-components/_components.edge-panel.scss +0 -2
  127. package/src/styles/06-components/_components.photoviewer.scss +0 -1
  128. package/src/styles/06-components/_components.river.scss +0 -1
  129. package/src/styles/06-components/_components.slider.scss +0 -3
  130. package/src/styles/99-utilities/_utilities.glass-fixes.scss +0 -1
  131. package/src/styles/99-utilities/_utilities.text.scss +1 -0
@@ -39,6 +39,8 @@ export const Card = React.memo(
39
39
  onFocus,
40
40
  href,
41
41
  target,
42
+ // Custom Link
43
+ LinkComponent,
42
44
  // Glass
43
45
  glass,
44
46
  // Accessibility
@@ -242,17 +244,35 @@ export const Card = React.memo(
242
244
 
243
245
  // Render as anchor if href is provided
244
246
  if (href && !isDisabled) {
245
- const anchorElement = (
246
- <a
247
- {...commonProps}
248
- ref={ref as React.Ref<HTMLAnchorElement>}
249
- href={href}
250
- target={target}
251
- rel={target === '_blank' ? 'noopener noreferrer' : undefined}
252
- >
253
- {cardContent}
254
- </a>
255
- );
247
+ let anchorElement: React.ReactElement;
248
+
249
+ if (LinkComponent) {
250
+ const LinkComp = LinkComponent as React.ComponentType<any>;
251
+ anchorElement = (
252
+ <LinkComp
253
+ {...commonProps}
254
+ ref={ref as React.Ref<HTMLAnchorElement>}
255
+ href={href}
256
+ to={href}
257
+ target={target}
258
+ rel={target === '_blank' ? 'noopener noreferrer' : undefined}
259
+ >
260
+ {cardContent}
261
+ </LinkComp>
262
+ );
263
+ } else {
264
+ anchorElement = (
265
+ <a
266
+ {...commonProps}
267
+ ref={ref as React.Ref<HTMLAnchorElement>}
268
+ href={href}
269
+ target={target}
270
+ rel={target === '_blank' ? 'noopener noreferrer' : undefined}
271
+ >
272
+ {cardContent}
273
+ </a>
274
+ );
275
+ }
256
276
 
257
277
  if (glass) {
258
278
  const glassProps = glass === true ? {} : glass;
@@ -250,7 +250,7 @@ export const GlassVariant: Story = {
250
250
  glass={{
251
251
  blurAmount: 0,
252
252
  saturation: 180,
253
- enableBorderEffect: true,
253
+ withBorder: true,
254
254
  }}
255
255
  showToolbar={true}
256
256
  />
@@ -278,8 +278,8 @@ const Chart = memo(
278
278
  saturation: 180,
279
279
  aberrationIntensity: 1.5,
280
280
  elasticity: 0, // No elastic effect for charts
281
- enableLiquidBlur: false, // Keep it simple
282
- enableBorderEffect: true,
281
+ withLiquidBlur: false, // Keep it simple
282
+ withBorder: true,
283
283
  mode: 'standard' as const,
284
284
  mouseContainer: chartContainerRef,
285
285
  reducedMotion: false,
@@ -300,8 +300,8 @@ const Chart = memo(
300
300
  const chartBorderRadius = useMemo(() => {
301
301
  // Use chart border-radius design token (typically 12px from $border-radius-lg)
302
302
  // AtomixGlass will extract from children if not provided
303
- return glassProps?.cornerRadius || undefined;
304
- }, [glassProps?.cornerRadius]);
303
+ return glassProps?.borderRadius || undefined;
304
+ }, [glassProps?.borderRadius]);
305
305
 
306
306
  // Create context value
307
307
  const chartContextValue = useMemo<ChartContextValue>(
@@ -404,7 +404,7 @@ const Chart = memo(
404
404
  const wrappedChart = glassProps ? (
405
405
  <AtomixGlass
406
406
  {...glassProps}
407
- cornerRadius={chartBorderRadius}
407
+ borderRadius={chartBorderRadius}
408
408
  style={{
409
409
  width: '100%',
410
410
  height: '100%',
@@ -98,21 +98,25 @@ interface TreemapChartProps extends Omit<ChartProps, 'type' | 'datasets'> {
98
98
  };
99
99
  }
100
100
 
101
+ const DEFAULT_COLOR_CONFIG: NonNullable<TreemapChartProps['colorConfig']> = { scheme: 'category' };
102
+ const DEFAULT_LABEL_CONFIG = {
103
+ showLabels: true,
104
+ minSize: 1000,
105
+ fontSize: 12,
106
+ textColor: 'white',
107
+ };
108
+ const DEFAULT_CONFIG = {};
109
+
101
110
  const TreemapChart = memo(
102
111
  forwardRef<HTMLDivElement, TreemapChartProps>(
103
112
  (
104
113
  {
105
114
  data = [],
106
115
  algorithm = 'squarified',
107
- colorConfig = { scheme: 'category' },
108
- labelConfig = {
109
- showLabels: true,
110
- minSize: 1000,
111
- fontSize: 12,
112
- textColor: 'white',
113
- },
116
+ colorConfig = DEFAULT_COLOR_CONFIG,
117
+ labelConfig = DEFAULT_LABEL_CONFIG,
114
118
  onDataPointClick,
115
- config = {},
119
+ config = DEFAULT_CONFIG,
116
120
  ...props
117
121
  },
118
122
  ref
@@ -122,9 +126,7 @@ const TreemapChart = memo(
122
126
  const [tooltipPosition, setTooltipPosition] = useState({ x: 0, y: 0 });
123
127
 
124
128
  const treeData = useMemo(() => {
125
- console.log('TreemapChart data:', data);
126
129
  if (!data.length) {
127
- console.log('No data provided to TreemapChart');
128
130
  return null;
129
131
  }
130
132
 
@@ -357,16 +359,17 @@ const TreemapChart = memo(
357
359
  []
358
360
  );
359
361
 
360
- const renderContent = ({
361
- scales,
362
- colors,
363
- datasets: renderedDatasets,
364
- handlers,
365
- hoveredPoint,
366
- }: ChartRenderContentParams) => {
367
- if (!data.length) return null;
368
-
369
- // Calculate available space with padding
362
+ const renderContent = useCallback(
363
+ ({
364
+ scales,
365
+ colors,
366
+ datasets: renderedDatasets,
367
+ handlers,
368
+ hoveredPoint,
369
+ }: ChartRenderContentParams) => {
370
+ if (!data.length) return null;
371
+
372
+ // Calculate available space with padding
370
373
  const padding = 20;
371
374
  const availableWidth = scales.width - padding * 2;
372
375
  const availableHeight = scales.height - padding * 2;
@@ -467,17 +470,22 @@ const TreemapChart = memo(
467
470
  </g>
468
471
  );
469
472
  })}
470
- </>
471
- );
472
- };
473
+ </>
474
+ );
475
+ },
476
+ [data, algorithm, generateColor, squarify, labelConfig, hoveredNode, selectedNode]
477
+ );
473
478
 
474
479
  // Convert data to datasets format for BaseChart
475
- const datasets = [
476
- {
477
- label: 'Treemap Data',
478
- data: data,
479
- },
480
- ];
480
+ const datasets = useMemo(
481
+ () => [
482
+ {
483
+ label: 'Treemap Data',
484
+ data: data,
485
+ },
486
+ ],
487
+ [data]
488
+ );
481
489
 
482
490
  return (
483
491
  <BaseChart
@@ -152,7 +152,7 @@ const CustomGlassExample = () => {
152
152
  blurAmount: 0,
153
153
  saturation: 180,
154
154
  aberrationIntensity: 2,
155
- cornerRadius: 16,
155
+ borderRadius: 16,
156
156
  overLight: false,
157
157
  mode: 'polar',
158
158
  }}
@@ -184,7 +184,7 @@ const GlassRangeExample = () => {
184
184
  blurAmount: 0,
185
185
  saturation: 160,
186
186
  aberrationIntensity: 1.5,
187
- cornerRadius: 14,
187
+ borderRadius: 14,
188
188
  mode: 'prominent',
189
189
  }}
190
190
  />
@@ -203,7 +203,7 @@ When `glass` is an object, it accepts the same props as the `AtomixGlass` compon
203
203
  | `blurAmount` | `number` | `0` | Blur amount for the backdrop |
204
204
  | `saturation` | `number` | `160` | Saturation percentage for the backdrop |
205
205
  | `aberrationIntensity` | `number` | `1.5` | Chromatic aberration intensity |
206
- | `cornerRadius` | `number` | `12` | Corner radius in pixels |
206
+ | `borderRadius` | `number` | `12` | Corner radius in pixels |
207
207
  | `overLight` | `boolean` | `false` | Whether the glass is over a light background |
208
208
  | `mode` | `'standard' \| 'polar' \| 'prominent' \| 'shader'` | `'standard'` | Glass effect mode |
209
209
 
@@ -505,7 +505,7 @@ export const GlassDropdownCustom: Story = {
505
505
  blurAmount: 2,
506
506
  saturation: 200,
507
507
  aberrationIntensity: 1,
508
- cornerRadius: 16,
508
+ borderRadius: 16,
509
509
  mode: 'polar',
510
510
  },
511
511
  },