@shohojdhara/atomix 0.3.5 → 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 (173) hide show
  1. package/README.md +101 -199
  2. package/atomix.config.ts +241 -0
  3. package/dist/atomix.css +260 -179
  4. package/dist/atomix.css.map +1 -1
  5. package/dist/atomix.min.css +250 -179
  6. package/dist/atomix.min.css.map +1 -1
  7. package/dist/charts.js +61 -66
  8. package/dist/charts.js.map +1 -1
  9. package/dist/core.js +47 -31
  10. package/dist/core.js.map +1 -1
  11. package/dist/forms.js +47 -31
  12. package/dist/forms.js.map +1 -1
  13. package/dist/heavy.js +47 -31
  14. package/dist/heavy.js.map +1 -1
  15. package/dist/index.d.ts +1841 -1633
  16. package/dist/index.esm.js +4975 -4113
  17. package/dist/index.esm.js.map +1 -1
  18. package/dist/index.js +5151 -4290
  19. package/dist/index.js.map +1 -1
  20. package/dist/index.min.js +1 -1
  21. package/dist/index.min.js.map +1 -1
  22. package/dist/theme.d.ts +1572 -1442
  23. package/dist/theme.js +4816 -4080
  24. package/dist/theme.js.map +1 -1
  25. package/package.json +6 -20
  26. package/src/components/Accordion/Accordion.stories.tsx +50 -17
  27. package/src/components/AtomixGlass/AtomixGlass.tsx +65 -31
  28. package/src/components/AtomixGlass/AtomixGlassContainer.tsx +11 -4
  29. package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +1 -32
  30. package/src/components/AtomixGlass/stories/Examples.stories.tsx +2 -2
  31. package/src/components/AtomixGlass/stories/shared-components.tsx +0 -31
  32. package/src/components/Avatar/Avatar.stories.tsx +7 -0
  33. package/src/components/Badge/Badge.stories.tsx +91 -13
  34. package/src/components/Block/Block.stories.tsx +7 -23
  35. package/src/components/Breadcrumb/Breadcrumb.stories.tsx +7 -0
  36. package/src/components/Button/Button.stories.tsx +141 -22
  37. package/src/components/Button/ButtonGroup.stories.tsx +315 -0
  38. package/src/components/Button/ButtonGroup.tsx +67 -0
  39. package/src/components/Button/index.ts +2 -0
  40. package/src/components/Callout/Callout.stories.tsx +8 -6
  41. package/src/components/Card/Card.stories.tsx +82 -28
  42. package/src/components/Chart/AnimatedChart.tsx +0 -1
  43. package/src/components/Chart/AreaChart.tsx +0 -1
  44. package/src/components/Chart/BarChart.tsx +0 -1
  45. package/src/components/Chart/BubbleChart.tsx +0 -1
  46. package/src/components/Chart/CandlestickChart.tsx +0 -1
  47. package/src/components/Chart/Chart.stories.tsx +5 -7
  48. package/src/components/Chart/Chart.tsx +0 -16
  49. package/src/components/Chart/ChartRenderer.tsx +1 -1
  50. package/src/components/Chart/DonutChart.tsx +0 -1
  51. package/src/components/Chart/FunnelChart.tsx +0 -1
  52. package/src/components/Chart/GaugeChart.tsx +0 -1
  53. package/src/components/Chart/HeatmapChart.tsx +0 -1
  54. package/src/components/Chart/LineChart.tsx +0 -1
  55. package/src/components/Chart/MultiAxisChart.tsx +0 -1
  56. package/src/components/Chart/PieChart.tsx +0 -1
  57. package/src/components/Chart/RadarChart.tsx +0 -1
  58. package/src/components/Chart/ScatterChart.tsx +0 -1
  59. package/src/components/Chart/WaterfallChart.tsx +0 -1
  60. package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +7 -0
  61. package/src/components/DataTable/DataTable.stories.tsx +23 -16
  62. package/src/components/DatePicker/DatePicker.stories.tsx +27 -19
  63. package/src/components/Dropdown/Dropdown.stories.tsx +11 -19
  64. package/src/components/EdgePanel/EdgePanel.stories.tsx +1 -0
  65. package/src/components/Footer/Footer.stories.tsx +8 -6
  66. package/src/components/Footer/FooterLink.tsx +9 -2
  67. package/src/components/Form/Checkbox.stories.tsx +7 -0
  68. package/src/components/Form/Form.stories.tsx +7 -0
  69. package/src/components/Form/FormGroup.stories.tsx +9 -1
  70. package/src/components/Form/Input.stories.tsx +69 -16
  71. package/src/components/Form/Radio.stories.tsx +9 -1
  72. package/src/components/Form/Select.stories.tsx +9 -1
  73. package/src/components/Form/Textarea.stories.tsx +10 -2
  74. package/src/components/Hero/Hero.stories.tsx +7 -0
  75. package/src/components/List/List.stories.tsx +7 -0
  76. package/src/components/Messages/Messages.stories.tsx +8 -7
  77. package/src/components/Modal/Modal.stories.tsx +17 -6
  78. package/src/components/Navigation/Menu/Menu.stories.tsx +7 -0
  79. package/src/components/Navigation/Nav/Nav.stories.tsx +7 -0
  80. package/src/components/Navigation/Navbar/Navbar.stories.tsx +1 -0
  81. package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +1 -1
  82. package/src/components/Pagination/Pagination.stories.tsx +188 -111
  83. package/src/components/Pagination/Pagination.tsx +83 -3
  84. package/src/components/PhotoViewer/PhotoViewer.stories.tsx +10 -5
  85. package/src/components/Popover/Popover.stories.tsx +191 -115
  86. package/src/components/ProductReview/ProductReview.stories.tsx +80 -58
  87. package/src/components/Progress/Progress.stories.tsx +79 -49
  88. package/src/components/Rating/Rating.stories.tsx +109 -84
  89. package/src/components/River/River.stories.tsx +194 -114
  90. package/src/components/SectionIntro/SectionIntro.stories.tsx +19 -9
  91. package/src/components/Slider/Slider.stories.tsx +7 -0
  92. package/src/components/Spinner/Spinner.stories.tsx +15 -11
  93. package/src/components/Steps/Steps.stories.tsx +132 -98
  94. package/src/components/Tabs/Tabs.stories.tsx +163 -112
  95. package/src/components/Testimonial/Testimonial.stories.tsx +114 -68
  96. package/src/components/Todo/Todo.stories.tsx +38 -12
  97. package/src/components/Toggle/Toggle.stories.tsx +61 -28
  98. package/src/components/Tooltip/Tooltip.stories.tsx +318 -200
  99. package/src/components/Upload/Upload.stories.tsx +122 -84
  100. package/src/components/VideoPlayer/VideoPlayer.stories.tsx +7 -24
  101. package/src/components/index.ts +1 -0
  102. package/src/lib/composables/useAtomixGlass.ts +2 -3
  103. package/src/lib/composables/useNavbar.ts +0 -10
  104. package/src/lib/config/loader.ts +2 -1
  105. package/src/lib/constants/components.ts +10 -0
  106. package/src/lib/hooks/useComponentCustomization.ts +1 -1
  107. package/src/lib/theme/README.md +174 -0
  108. package/src/lib/theme/adapters/index.ts +31 -0
  109. package/src/lib/theme/adapters/themeAdapter.ts +287 -0
  110. package/src/lib/theme/config/__tests__/configLoader.test.ts +207 -0
  111. package/src/lib/theme/config/configLoader.ts +254 -0
  112. package/src/lib/theme/config/loader.ts +37 -48
  113. package/src/lib/theme/config/types.ts +2 -2
  114. package/src/lib/theme/config/validator.ts +15 -91
  115. package/src/lib/theme/{constants.ts → constants/constants.ts} +0 -18
  116. package/src/lib/theme/constants/index.ts +8 -0
  117. package/src/lib/theme/core/ThemeRegistry.ts +19 -6
  118. package/src/lib/theme/core/__tests__/createTheme.test.ts +132 -0
  119. package/src/lib/theme/core/composeTheme.ts +155 -0
  120. package/src/lib/theme/core/createTheme.ts +94 -0
  121. package/src/lib/theme/{createTheme.ts → core/createThemeObject.ts} +10 -6
  122. package/src/lib/theme/core/index.ts +5 -19
  123. package/src/lib/theme/devtools/Comparator.tsx +346 -22
  124. package/src/lib/theme/devtools/IMPROVEMENTS.md +139 -38
  125. package/src/lib/theme/devtools/Inspector.tsx +335 -51
  126. package/src/lib/theme/devtools/LiveEditor.tsx +478 -107
  127. package/src/lib/theme/devtools/Preview.tsx +471 -221
  128. package/src/lib/theme/{core → devtools}/ThemeValidator.ts +1 -1
  129. package/src/lib/theme/devtools/index.ts +14 -4
  130. package/src/lib/theme/devtools/useHistory.ts +130 -0
  131. package/src/lib/theme/errors/index.ts +12 -0
  132. package/src/lib/theme/generators/cssFile.ts +79 -0
  133. package/src/lib/theme/generators/generateCSS.ts +89 -0
  134. package/src/lib/theme/{generateCSSVariables.ts → generators/generateCSSVariables.ts} +3 -13
  135. package/src/lib/theme/generators/index.ts +19 -0
  136. package/src/lib/theme/i18n/rtl.ts +5 -6
  137. package/src/lib/theme/index.ts +120 -15
  138. package/src/lib/theme/runtime/ThemeApplicator.ts +52 -111
  139. package/src/lib/theme/{ThemeContext.tsx → runtime/ThemeContext.tsx} +1 -1
  140. package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +1 -1
  141. package/src/lib/theme/runtime/ThemeProvider.tsx +456 -179
  142. package/src/lib/theme/runtime/index.ts +1 -2
  143. package/src/lib/theme/runtime/useTheme.ts +1 -2
  144. package/src/lib/theme/test/testTheme.ts +385 -0
  145. package/src/lib/theme/tokens/index.ts +12 -0
  146. package/src/lib/theme/tokens/tokens.ts +721 -0
  147. package/src/lib/theme/types.ts +6 -42
  148. package/src/lib/theme/{utils.ts → utils/domUtils.ts} +2 -2
  149. package/src/lib/theme/utils/index.ts +11 -0
  150. package/src/lib/theme/utils/injectCSS.ts +90 -0
  151. package/src/lib/theme/utils/themeHelpers.ts +78 -0
  152. package/src/lib/theme/{themeUtils.ts → utils/themeUtils.ts} +1 -1
  153. package/src/lib/theme-tools.ts +7 -8
  154. package/src/lib/types/components.ts +40 -130
  155. package/src/lib/utils/componentUtils.ts +1 -1
  156. package/src/styles/01-settings/_settings.design-tokens.scss +4 -1
  157. package/src/styles/02-tools/_tools.button.scss +66 -79
  158. package/src/styles/06-components/_components.atomix-glass.scss +13 -3
  159. package/src/styles/06-components/_components.pagination.scss +88 -0
  160. package/scripts/sync-theme-config.js +0 -309
  161. package/src/lib/theme/composeTheme.ts +0 -370
  162. package/src/lib/theme/core/ThemeCache.ts +0 -283
  163. package/src/lib/theme/core/ThemeEngine.test.ts +0 -146
  164. package/src/lib/theme/core/ThemeEngine.ts +0 -665
  165. package/src/lib/theme/createThemeFromConfig.ts +0 -132
  166. package/src/lib/theme/devtools/CLI.ts +0 -364
  167. package/src/lib/theme/runtime/ThemeManager.test.ts +0 -192
  168. package/src/lib/theme/runtime/ThemeManager.ts +0 -446
  169. package/src/styles/03-generic/_generated-root.css +0 -26
  170. package/src/themes/README.md +0 -442
  171. package/src/themes/themes.config.js +0 -68
  172. /package/src/lib/theme/{cssVariableMapper.ts → adapters/cssVariableMapper.ts} +0 -0
  173. /package/src/lib/theme/{errors.ts → errors/errors.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shohojdhara/atomix",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "Atomix Design System - A modern component library for web applications",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -86,16 +86,6 @@
86
86
  "import": "./dist/theme.js",
87
87
  "default": "./dist/theme.js"
88
88
  },
89
- "./themes/*": {
90
- "import": "./dist/themes/*.css",
91
- "require": "./dist/themes/*.css",
92
- "default": "./dist/themes/*.css"
93
- },
94
- "./themes/*.min": {
95
- "import": "./dist/themes/*.min.css",
96
- "require": "./dist/themes/*.min.css",
97
- "default": "./dist/themes/*.min.css"
98
- },
99
89
  "./charts": {
100
90
  "types": "./dist/charts.d.ts",
101
91
  "import": "./dist/charts.js",
@@ -233,11 +223,10 @@
233
223
  "changeset": "changeset",
234
224
  "typecheck": "tsc --noEmit",
235
225
  "attw": "attw --pack",
236
- "sync:config": "npx tsx scripts/sync-theme-config-ts.ts",
237
226
  "sync:tokens": "npx tsx scripts/generate-tokens.ts",
238
227
  "validate:config": "npx tsx scripts/validate-config-sync.ts",
239
- "prebuild": "npm run sync:config && npm run validate:config",
240
- "prebuild:with-tokens": "npm run sync:config && npm run sync:tokens && npm run validate:config",
228
+ "prebuild": "npm run validate:config",
229
+ "prebuild:with-tokens": "npm run sync:tokens && npm run validate:config",
241
230
  "verify:build": "node scripts/verify-build.js",
242
231
  "test:build": "node scripts/test-build.js",
243
232
  "prepublishOnly": "npm run clean && npm run build && npm run attw",
@@ -245,16 +234,13 @@
245
234
  },
246
235
  "files": [
247
236
  "dist/**/*",
248
- "dist/themes/**/*",
249
237
  "src/styles/**/*",
250
238
  "src/components/**/*",
251
239
  "src/lib/**/*",
252
240
  "src/layouts/**/*",
253
- "src/themes/**/*",
254
241
  "scripts/atomix-cli.js",
255
- "scripts/sync-theme-config.js",
256
242
  "scripts/cli/**/*",
257
- "theme.config.ts",
243
+ "atomix.config.ts",
258
244
  "README.md",
259
245
  "LICENSE",
260
246
  "CHANGELOG.md"
@@ -296,9 +282,9 @@
296
282
  },
297
283
  "engines": {
298
284
  "node": ">=18.0.0",
299
- "npm": ">=8.0.0"
285
+ "npm": ">=8.0.0 <11.0.0 || >=11.7.0"
300
286
  },
301
287
  "publishConfig": {
302
288
  "access": "public"
303
289
  }
304
- }
290
+ }
@@ -4,6 +4,9 @@ import { Accordion } from './Accordion';
4
4
  import { ACCORDION } from '../../lib/constants/components';
5
5
  import type { AtomixGlassProps } from '../../lib/types/components';
6
6
 
7
+ // Helper type for glass props in stories (without children requirement)
8
+ type GlassProps = boolean | Omit<AtomixGlassProps, 'children'>;
9
+
7
10
  // Extract class names without the leading dots
8
11
  const ACCORDION_CLASS = ACCORDION.SELECTORS.ACCORDION.replace('.', '');
9
12
  const HEADER_CLASS = ACCORDION.SELECTORS.HEADER.replace('.', '');
@@ -24,15 +27,18 @@ const meta = {
24
27
  },
25
28
  },
26
29
  },
30
+ tags: ['autodocs'],
27
31
  argTypes: {
28
32
  iconPosition: {
29
33
  control: { type: 'radio' },
30
34
  options: ['right', 'left'],
31
35
  description: 'Position of the icon',
36
+ defaultValue: 'right',
32
37
  },
33
38
  defaultOpen: {
34
39
  control: 'boolean',
35
40
  description: 'Whether the accordion is initially open',
41
+ defaultValue: false,
36
42
  },
37
43
  disabled: {
38
44
  control: 'boolean',
@@ -56,7 +62,9 @@ const meta = {
56
62
  export default meta;
57
63
  type Story = StoryObj<typeof meta>;
58
64
 
59
- // Default Accordion (Closed)
65
+ /**
66
+ * Default accordion in closed state.
67
+ */
60
68
  export const Default: Story = {
61
69
  args: {
62
70
  title: 'Accordion Title',
@@ -64,7 +72,9 @@ export const Default: Story = {
64
72
  },
65
73
  };
66
74
 
67
- // Open Accordion
75
+ /**
76
+ * Accordion in open state by default.
77
+ */
68
78
  export const Open: Story = {
69
79
  args: {
70
80
  title: 'Open Accordion',
@@ -73,7 +83,9 @@ export const Open: Story = {
73
83
  },
74
84
  };
75
85
 
76
- // Disabled Accordion
86
+ /**
87
+ * Disabled accordion - non-interactive state.
88
+ */
77
89
  export const Disabled: Story = {
78
90
  args: {
79
91
  title: 'Disabled Accordion',
@@ -82,7 +94,9 @@ export const Disabled: Story = {
82
94
  },
83
95
  };
84
96
 
85
- // Icon on Left
97
+ /**
98
+ * Accordion with icon positioned on the left side.
99
+ */
86
100
  export const IconLeft: Story = {
87
101
  args: {
88
102
  title: 'Icon on Left',
@@ -91,7 +105,9 @@ export const IconLeft: Story = {
91
105
  },
92
106
  };
93
107
 
94
- // Custom Icon
108
+ /**
109
+ * Accordion with custom icon instead of default chevron.
110
+ */
95
111
  export const CustomIcon: Story = {
96
112
  args: {
97
113
  title: 'Custom Icon',
@@ -118,7 +134,9 @@ export const CustomIcon: Story = {
118
134
  },
119
135
  };
120
136
 
121
- // Accordion Group
137
+ /**
138
+ * Multiple accordions grouped together.
139
+ */
122
140
  export const AccordionGroup: Story = {
123
141
  args: {
124
142
  title: 'Accordion Group',
@@ -150,12 +168,21 @@ export const AccordionGroup: Story = {
150
168
  ),
151
169
  };
152
170
 
153
- // All Variants
171
+ /**
172
+ * Showcase of all accordion variants and states.
173
+ */
154
174
  export const AllVariants: Story = {
155
175
  args: {
156
176
  title: 'All Variants',
157
177
  children: <p>See render function for all variants</p>,
158
178
  },
179
+ parameters: {
180
+ docs: {
181
+ description: {
182
+ story: 'Comprehensive showcase of all accordion variants including default, open, disabled, icon positions, and custom icons.',
183
+ },
184
+ },
185
+ },
159
186
  render: () => (
160
187
  <div>
161
188
  <h2>All Accordion Variants</h2>
@@ -246,7 +273,9 @@ export const AllVariants: Story = {
246
273
  ),
247
274
  };
248
275
 
249
- // Controlled Accordion
276
+ /**
277
+ * Controlled accordion using external state management.
278
+ */
250
279
  export const Controlled: Story = {
251
280
  args: {
252
281
  title: 'Controlled Accordion',
@@ -275,7 +304,9 @@ export const Controlled: Story = {
275
304
  },
276
305
  };
277
306
 
278
- // Glass Variant
307
+ /**
308
+ * Accordion with glass morphism effect enabled.
309
+ */
279
310
  export const Glass: Story = {
280
311
  args: {
281
312
  title: 'Glass Accordion',
@@ -312,7 +343,9 @@ export const Glass: Story = {
312
343
  },
313
344
  };
314
345
 
315
- // Glass with Custom Settings
346
+ /**
347
+ * Accordion with custom glass morphism settings.
348
+ */
316
349
  export const GlassCustom: Story = {
317
350
  args: {
318
351
  title: 'Custom Glass Accordion',
@@ -322,7 +355,7 @@ export const GlassCustom: Story = {
322
355
  blurAmount: 3,
323
356
  saturation: 60,
324
357
  mode: 'polar',
325
- } as AtomixGlassProps as any,
358
+ } as GlassProps,
326
359
  },
327
360
  render: args => (
328
361
  <div
@@ -505,7 +538,7 @@ export const GlassModePolar: Story = {
505
538
  blurAmount: 1.5,
506
539
  saturation: 180,
507
540
  aberrationIntensity: 3,
508
- } as any,
541
+ } as GlassProps,
509
542
  },
510
543
  render: args => (
511
544
  <div
@@ -550,7 +583,7 @@ export const GlassModeProminent: Story = {
550
583
  blurAmount: 2.5,
551
584
  saturation: 200,
552
585
  aberrationIntensity: 4,
553
- } as any,
586
+ } as GlassProps,
554
587
  },
555
588
  render: args => (
556
589
  <div
@@ -595,7 +628,7 @@ export const GlassModeShader: Story = {
595
628
  displacementScale: 70,
596
629
  blurAmount: 1.8,
597
630
  saturation: 170,
598
- } as any,
631
+ } as GlassProps,
599
632
  },
600
633
  render: args => (
601
634
  <div
@@ -700,7 +733,7 @@ export const AllGlassModesComparison: Story = {
700
733
  blurAmount: 1.5,
701
734
  saturation: 180,
702
735
  aberrationIntensity: 3,
703
- } as any
736
+ } as GlassProps
704
737
  }
705
738
  >
706
739
  <p>Radial distortion effects emanating from the center point.</p>
@@ -728,7 +761,7 @@ export const AllGlassModesComparison: Story = {
728
761
  blurAmount: 2.5,
729
762
  saturation: 200,
730
763
  aberrationIntensity: 4,
731
- } as any
764
+ } as GlassProps
732
765
  }
733
766
  >
734
767
  <p>Enhanced distortion with maximum depth and visual impact.</p>
@@ -756,7 +789,7 @@ export const AllGlassModesComparison: Story = {
756
789
  displacementScale: 70,
757
790
  blurAmount: 1.8,
758
791
  saturation: 170,
759
- } as any
792
+ } as GlassProps
760
793
  }
761
794
  >
762
795
  <p>GPU-accelerated liquid glass with smooth animations.</p>
@@ -118,6 +118,12 @@ export function AtomixGlass({
118
118
  opacity0: number;
119
119
  } | null>(null);
120
120
 
121
+ // Cache RGB color values from design tokens
122
+ const rgbCacheRef = useRef<{
123
+ whiteRgb: string;
124
+ blackRgb: string;
125
+ } | null>(null);
126
+
121
127
  // Use composable hook for all state and logic
122
128
  const {
123
129
  isHovered,
@@ -161,35 +167,63 @@ export function AtomixGlass({
161
167
 
162
168
  // Read CSS custom properties once on mount and cache them
163
169
  useEffect(() => {
164
- if (typeof window !== 'undefined' && glassRef.current && !opacityCacheRef.current) {
170
+ if (typeof window !== 'undefined' && glassRef.current) {
165
171
  try {
166
172
  const computedStyle = window.getComputedStyle(glassRef.current);
167
- const opacity50Value = computedStyle.getPropertyValue('--atomix-opacity-50').trim();
168
- const opacity40Value = computedStyle.getPropertyValue('--atomix-opacity-40').trim();
169
- const opacity80Value = computedStyle.getPropertyValue('--atomix-opacity-80').trim();
170
- const opacity0Value = computedStyle.getPropertyValue('--atomix-opacity-0').trim();
171
-
172
- // Parse opacity values, handling 0 correctly (use NaN check instead of falsy check)
173
- const parseOpacity = (value: string, defaultValue: number): number => {
174
- if (!value) return defaultValue;
175
- const parsed = parseFloat(value);
176
- return isNaN(parsed) ? defaultValue : parsed;
177
- };
178
-
179
- opacityCacheRef.current = {
180
- opacity50: parseOpacity(opacity50Value, 0.5),
181
- opacity40: parseOpacity(opacity40Value, 0.4),
182
- opacity80: parseOpacity(opacity80Value, 0.8),
183
- opacity0: parseOpacity(opacity0Value, 0),
184
- };
173
+
174
+ // Cache opacity values
175
+ if (!opacityCacheRef.current) {
176
+ const opacity50Value = computedStyle.getPropertyValue('--atomix-opacity-50').trim();
177
+ const opacity40Value = computedStyle.getPropertyValue('--atomix-opacity-40').trim();
178
+ const opacity80Value = computedStyle.getPropertyValue('--atomix-opacity-80').trim();
179
+ const opacity0Value = computedStyle.getPropertyValue('--atomix-opacity-0').trim();
180
+
181
+ // Parse opacity values, handling 0 correctly (use NaN check instead of falsy check)
182
+ const parseOpacity = (value: string, defaultValue: number): number => {
183
+ if (!value) return defaultValue;
184
+ const parsed = parseFloat(value);
185
+ return isNaN(parsed) ? defaultValue : parsed;
186
+ };
187
+
188
+ opacityCacheRef.current = {
189
+ opacity50: parseOpacity(opacity50Value, 0.5),
190
+ opacity40: parseOpacity(opacity40Value, 0.4),
191
+ opacity80: parseOpacity(opacity80Value, 0.8),
192
+ opacity0: parseOpacity(opacity0Value, 0),
193
+ };
194
+ }
195
+
196
+ // Cache RGB color values from design tokens
197
+ if (!rgbCacheRef.current) {
198
+ // Try to read from design tokens, fallback to defaults
199
+ const whiteRgbValue = computedStyle.getPropertyValue('--atomix-light-rgb').trim() ||
200
+ computedStyle.getPropertyValue('--atomix-white-rgb').trim() ||
201
+ '';
202
+ const blackRgbValue = computedStyle.getPropertyValue('--atomix-dark-rgb').trim() ||
203
+ computedStyle.getPropertyValue('--atomix-black-rgb').trim() ||
204
+ '';
205
+
206
+ rgbCacheRef.current = {
207
+ whiteRgb: whiteRgbValue || '255, 255, 255', // Fallback to white RGB
208
+ blackRgb: blackRgbValue || '0, 0, 0', // Fallback to black RGB
209
+ };
210
+ }
185
211
  } catch (error) {
186
212
  // Fallback to defaults if reading fails
187
- opacityCacheRef.current = {
188
- opacity50: 0.5,
189
- opacity40: 0.4,
190
- opacity80: 0.8,
191
- opacity0: 0,
192
- };
213
+ if (!opacityCacheRef.current) {
214
+ opacityCacheRef.current = {
215
+ opacity50: 0.5,
216
+ opacity40: 0.4,
217
+ opacity80: 0.8,
218
+ opacity0: 0,
219
+ };
220
+ }
221
+ if (!rgbCacheRef.current) {
222
+ rgbCacheRef.current = {
223
+ whiteRgb: '255, 255, 255',
224
+ blackRgb: '0, 0, 0',
225
+ };
226
+ }
193
227
  }
194
228
  }
195
229
  }, []);
@@ -393,12 +427,12 @@ export function AtomixGlass({
393
427
 
394
428
  const glassVars = useMemo(() => {
395
429
  // RGB color values for rgba() functions
396
- // Note: CSS doesn't support rgba(var(--rgb), opacity) syntax, so we use direct values
397
- // These values align with design tokens: --atomix-white-rgb and --atomix-black-rgb
398
- // The actual RGB values are defined in SCSS and should match these fallbacks
399
- // TODO: Consider reading from CSS custom properties if browser support improves
400
- const whiteColor = '255, 255, 255'; // Matches --atomix-white-rgb design token
401
- const blackColor = '0, 0, 0'; // Matches --atomix-black-rgb design token
430
+ // Note: CSS doesn't support rgba(var(--rgb), opacity) syntax - this is a CSS specification
431
+ // limitation, not a browser support issue. We read RGB values from design tokens at mount
432
+ // and cache them for performance. Falls back to defaults if tokens are not available.
433
+ // Uses design tokens: --atomix-light-rgb / --atomix-white-rgb and --atomix-dark-rgb / --atomix-black-rgb
434
+ const whiteColor = rgbCacheRef.current?.whiteRgb || '255, 255, 255';
435
+ const blackColor = rgbCacheRef.current?.blackRgb || '0, 0, 0';
402
436
 
403
437
  return {
404
438
  // Standard CSS custom properties for dynamic values
@@ -130,10 +130,17 @@ export const AtomixGlassContainer = forwardRef<HTMLDivElement, AtomixGlassContai
130
130
  },
131
131
  ref
132
132
  ) => {
133
- // Use React's useId() for SSR compatibility
134
- // Note: In Next.js, IDs may differ between server and client
135
- // We'll suppress hydration warnings on elements that use this ID
136
- const filterId = useId();
133
+ // Generate a stable, deterministic ID for SSR compatibility
134
+ // React's useId() should produce the same ID on server and client for the same
135
+ // component position in the tree. We use useState to ensure the ID is only
136
+ // generated once and remains stable across renders.
137
+ const baseId = useId();
138
+ const [filterId] = useState(() => {
139
+ // Normalize the ID to ensure it's valid and consistent
140
+ // Remove colons (which useId() uses) and ensure it starts with a letter
141
+ const normalizedId = baseId.replace(/:/g, '-').replace(/^[^a-z]/i, 'atomix-');
142
+ return `atomix-glass-filter-${normalizedId}`;
143
+ });
137
144
 
138
145
  const [shaderMapUrl, setShaderMapUrl] = useState<string>('');
139
146
  const shaderGeneratorRef = useRef<any>(null);
@@ -124,7 +124,7 @@ See documentation for detailed examples of each mode.`,
124
124
  },
125
125
  },
126
126
  mode: {
127
- control: 'select',
127
+ control: { type: 'select' },
128
128
  options: ['standard', 'polar', 'prominent', 'shader'],
129
129
  description: 'Glass effect mode (default: "standard")',
130
130
  table: { defaultValue: { summary: '"standard"' } },
@@ -446,37 +446,6 @@ const backgroundImages = [
446
446
  'https://images.unsplash.com/photo-1521587760476-6c12a4b040da?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
447
447
  ];
448
448
 
449
- /**
450
- * Legacy backgrounds object for backward compatibility
451
- * @deprecated Use backgroundImages array instead
452
- */
453
- const backgrounds = {
454
- // Office and workspace environments
455
- blueGradient: backgroundImages[0], // Modern office interior
456
- purpleGradient: backgroundImages[1], // Mountain landscape
457
- greenGradient: backgroundImages[3], // Forest path
458
-
459
- // Apple-inspired natural scenes
460
- macosWallpaper: backgroundImages[1], // Mountain landscape
461
- iosWallpaper: backgroundImages[4], // Ocean waves
462
-
463
- // Nature scenes
464
- mountains: backgroundImages[1], // Mountain landscape
465
- ocean: backgroundImages[4], // Ocean waves
466
-
467
- // Urban environments
468
- cityNight: backgroundImages[2], // Urban cityscape
469
- cityDay: backgroundImages[5], // Modern architecture
470
-
471
- // Interior spaces
472
- abstract1: backgroundImages[6], // Cozy café interior
473
- abstract2: backgroundImages[9], // Modern library
474
-
475
- // Video backgrounds
476
- videoBackground:
477
- 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
478
- };
479
-
480
449
  /**
481
450
  * Default showcase of the AtomixGlass component
482
451
  *
@@ -11,7 +11,7 @@ import React from 'react';
11
11
  import { useState, useEffect } from 'react';
12
12
  import { Meta, StoryObj } from '@storybook/react';
13
13
  import AtomixGlass from '../AtomixGlass';
14
- import { BackgroundWrapper, backgrounds, backgroundImages } from './shared-components';
14
+ import { BackgroundWrapper, backgroundImages } from './shared-components';
15
15
 
16
16
  import { Button } from '../../Button';
17
17
  import { Badge } from '../../Badge';
@@ -181,7 +181,7 @@ export const VideoBackground: Story = {
181
181
  zIndex: -1,
182
182
  }}
183
183
  >
184
- <source src={backgrounds.videoBackground} type="video/mp4" />
184
+ <source src="https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" type="video/mp4" />
185
185
  </video>
186
186
 
187
187
  <div
@@ -106,37 +106,6 @@ export const backgroundImages = [
106
106
  'https://images.unsplash.com/photo-1521587760476-6c12a4b040da?q=80&w=2940&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D',
107
107
  ];
108
108
 
109
- /**
110
- * Legacy backgrounds object for backward compatibility
111
- * @deprecated Use backgroundImages array instead
112
- */
113
- export const backgrounds = {
114
- // Office and workspace environments
115
- blueGradient: backgroundImages[0], // Modern office interior
116
- purpleGradient: backgroundImages[1], // Mountain landscape
117
- greenGradient: backgroundImages[3], // Forest path
118
-
119
- // Apple-inspired natural scenes
120
- macosWallpaper: backgroundImages[1], // Mountain landscape
121
- iosWallpaper: backgroundImages[4], // Ocean waves
122
-
123
- // Nature scenes
124
- mountains: backgroundImages[1], // Mountain landscape
125
- ocean: backgroundImages[4], // Ocean waves
126
-
127
- // Urban environments
128
- cityNight: backgroundImages[2], // Urban cityscape
129
- cityDay: backgroundImages[5], // Modern architecture
130
-
131
- // Interior spaces
132
- abstract1: backgroundImages[6], // Cozy café interior
133
- abstract2: backgroundImages[9], // Modern library
134
-
135
- // Video backgrounds
136
- videoBackground:
137
- 'https://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4',
138
- };
139
-
140
109
  /**
141
110
  * BackgroundWrapper Component Implementation
142
111
  *
@@ -8,7 +8,14 @@ const meta = {
8
8
  component: Avatar,
9
9
  parameters: {
10
10
  layout: 'centered',
11
+ docs: {
12
+ description: {
13
+ component:
14
+ 'The Avatar component displays user profile images, initials, or icons. It provides a consistent way to represent users throughout the application. Avatars support various sizes, can be circular or square, and gracefully handle missing images by showing initials or icons.',
15
+ },
16
+ },
11
17
  },
18
+ tags: ['autodocs'],
12
19
  argTypes: {
13
20
  src: {
14
21
  control: 'text',