@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.
- package/README.md +101 -199
- package/atomix.config.ts +241 -0
- package/dist/atomix.css +269 -189
- package/dist/atomix.css.map +1 -0
- package/dist/atomix.min.css +15179 -11
- package/dist/atomix.min.css.map +1 -0
- package/dist/charts.d.ts +1929 -0
- package/dist/charts.js +6477 -0
- package/dist/charts.js.map +1 -0
- package/dist/core.d.ts +1289 -0
- package/dist/core.js +3373 -0
- package/dist/core.js.map +1 -0
- package/dist/forms.d.ts +1085 -0
- package/dist/forms.js +2466 -0
- package/dist/forms.js.map +1 -0
- package/dist/heavy.d.ts +636 -0
- package/dist/heavy.js +4566 -0
- package/dist/heavy.js.map +1 -0
- package/dist/index.d.ts +5171 -4792
- package/dist/index.esm.js +6098 -4563
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +6291 -4747
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/layout.d.ts +300 -0
- package/dist/layout.js +336 -0
- package/dist/layout.js.map +1 -0
- package/dist/theme.d.ts +2122 -0
- package/dist/theme.js +6084 -0
- package/dist/theme.js.map +1 -0
- package/package.json +59 -27
- package/scripts/atomix-cli.js +544 -16
- package/scripts/cli/__tests__/cli-commands.test.js +204 -0
- package/scripts/cli/__tests__/utils.test.js +201 -0
- package/scripts/cli/__tests__/vitest.config.js +26 -0
- package/scripts/cli/interactive-init.js +1 -1
- package/scripts/cli/token-manager.js +32 -7
- package/scripts/cli/utils.js +347 -0
- package/src/components/Accordion/Accordion.stories.tsx +50 -17
- package/src/components/Accordion/Accordion.tsx +5 -54
- package/src/components/Accordion/index.ts +1 -1
- package/src/components/AtomixGlass/AtomixGlass.tsx +65 -31
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +11 -4
- package/src/components/AtomixGlass/stories/AtomixGlass.stories.tsx +1 -32
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +2 -2
- package/src/components/AtomixGlass/stories/shared-components.tsx +0 -31
- package/src/components/Avatar/Avatar.stories.tsx +7 -0
- package/src/components/Avatar/Avatar.tsx +3 -3
- package/src/components/Badge/Badge.stories.tsx +91 -13
- package/src/components/Badge/Badge.tsx +3 -3
- package/src/components/Block/Block.stories.tsx +7 -23
- package/src/components/Breadcrumb/Breadcrumb.stories.tsx +7 -0
- package/src/components/Breadcrumb/Breadcrumb.tsx +3 -3
- package/src/components/Button/Button.stories.tsx +141 -22
- package/src/components/Button/ButtonGroup.stories.tsx +315 -0
- package/src/components/Button/ButtonGroup.tsx +67 -0
- package/src/components/Button/index.ts +2 -0
- package/src/components/Callout/Callout.stories.tsx +8 -6
- package/src/components/Card/Card.stories.tsx +82 -28
- package/src/components/Card/ElevationCard.tsx +1 -1
- package/src/components/Chart/AnimatedChart.tsx +19 -18
- package/src/components/Chart/AreaChart.tsx +5 -2
- package/src/components/Chart/BarChart.tsx +1 -1
- package/src/components/Chart/BubbleChart.tsx +6 -6
- package/src/components/Chart/CandlestickChart.tsx +0 -1
- package/src/components/Chart/Chart.stories.tsx +5 -7
- package/src/components/Chart/Chart.tsx +0 -16
- package/src/components/Chart/ChartRenderer.tsx +1 -1
- package/src/components/Chart/ChartToolbar.tsx +1 -0
- package/src/components/Chart/DonutChart.tsx +0 -1
- package/src/components/Chart/FunnelChart.tsx +1 -2
- package/src/components/Chart/GaugeChart.tsx +0 -1
- package/src/components/Chart/HeatmapChart.tsx +0 -1
- package/src/components/Chart/LineChart.tsx +0 -1
- package/src/components/Chart/MultiAxisChart.tsx +0 -1
- package/src/components/Chart/PieChart.tsx +0 -1
- package/src/components/Chart/RadarChart.tsx +19 -13
- package/src/components/Chart/ScatterChart.tsx +3 -4
- package/src/components/Chart/TreemapChart.tsx +2 -1
- package/src/components/Chart/WaterfallChart.tsx +0 -2
- package/src/components/Chart/types.ts +12 -2
- package/src/components/Chart/utils.ts +4 -3
- package/src/components/ColorModeToggle/ColorModeToggle.stories.tsx +7 -0
- package/src/components/DataTable/DataTable.stories.tsx +23 -16
- package/src/components/DataTable/DataTable.tsx +3 -3
- package/src/components/DatePicker/DatePicker.stories.tsx +27 -19
- package/src/components/Dropdown/Dropdown.stories.tsx +11 -19
- package/src/components/Dropdown/Dropdown.tsx +12 -9
- package/src/components/EdgePanel/EdgePanel.stories.tsx +1 -0
- package/src/components/Footer/Footer.stories.tsx +8 -6
- package/src/components/Footer/FooterLink.tsx +9 -2
- package/src/components/Footer/FooterSection.tsx +3 -3
- package/src/components/Form/Checkbox.stories.tsx +7 -0
- package/src/components/Form/Checkbox.tsx +3 -3
- package/src/components/Form/Form.stories.tsx +7 -0
- package/src/components/Form/FormGroup.stories.tsx +9 -1
- package/src/components/Form/Input.stories.tsx +69 -16
- package/src/components/Form/Input.tsx +4 -2
- package/src/components/Form/Radio.stories.tsx +9 -1
- package/src/components/Form/Radio.tsx +3 -3
- package/src/components/Form/Select.stories.tsx +9 -1
- package/src/components/Form/Select.tsx +3 -3
- package/src/components/Form/Textarea.stories.tsx +10 -2
- package/src/components/Form/Textarea.tsx +4 -2
- package/src/components/Hero/Hero.stories.tsx +7 -0
- package/src/components/List/List.stories.tsx +10 -3
- package/src/components/List/List.tsx +3 -3
- package/src/components/List/ListGroup.tsx +3 -1
- package/src/components/Messages/Messages.stories.tsx +8 -7
- package/src/components/Modal/Modal.stories.tsx +17 -6
- package/src/components/Modal/Modal.tsx +3 -3
- package/src/components/Navigation/Menu/MegaMenu.tsx +9 -3
- package/src/components/Navigation/Menu/Menu.stories.tsx +7 -0
- package/src/components/Navigation/Menu/Menu.tsx +9 -3
- package/src/components/Navigation/Nav/Nav.stories.tsx +7 -0
- package/src/components/Navigation/Navbar/Navbar.stories.tsx +1 -0
- package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +1 -1
- package/src/components/Pagination/Pagination.stories.tsx +188 -111
- package/src/components/Pagination/Pagination.tsx +88 -7
- package/src/components/PhotoViewer/PhotoViewer.stories.tsx +10 -5
- package/src/components/PhotoViewer/PhotoViewerImage.tsx +2 -2
- package/src/components/Popover/Popover.stories.tsx +191 -115
- package/src/components/Popover/Popover.tsx +4 -4
- package/src/components/ProductReview/ProductReview.stories.tsx +80 -58
- package/src/components/Progress/Progress.stories.tsx +79 -49
- package/src/components/Progress/Progress.tsx +6 -2
- package/src/components/Rating/Rating.stories.tsx +109 -84
- package/src/components/Rating/Rating.tsx +5 -2
- package/src/components/River/River.stories.tsx +194 -114
- package/src/components/SectionIntro/SectionIntro.stories.tsx +19 -9
- package/src/components/Slider/Slider.stories.tsx +7 -0
- package/src/components/Slider/Slider.tsx +10 -9
- package/src/components/Spinner/Spinner.stories.tsx +15 -11
- package/src/components/Spinner/Spinner.tsx +3 -3
- package/src/components/Steps/Steps.stories.tsx +132 -98
- package/src/components/Tabs/Tabs.stories.tsx +163 -112
- package/src/components/Tabs/Tabs.tsx +3 -3
- package/src/components/Testimonial/Testimonial.stories.tsx +114 -68
- package/src/components/Todo/Todo.stories.tsx +38 -12
- package/src/components/Toggle/Toggle.stories.tsx +61 -28
- package/src/components/Tooltip/Tooltip.stories.tsx +318 -200
- package/src/components/Tooltip/Tooltip.tsx +3 -3
- package/src/components/Upload/Upload.stories.tsx +122 -84
- package/src/components/VideoPlayer/VideoPlayer.stories.tsx +7 -24
- package/src/components/index.ts +6 -2
- package/src/layouts/MasonryGrid/MasonryGrid.tsx +2 -2
- package/src/lib/composables/useAtomixGlass.ts +2 -3
- package/src/lib/composables/useChartPerformance.ts +102 -78
- package/src/lib/composables/useChartScale.ts +10 -0
- package/src/lib/composables/useHero.ts +9 -2
- package/src/lib/composables/useHeroBackgroundSlider.ts +5 -3
- package/src/lib/composables/useNavbar.ts +0 -10
- package/src/lib/composables/useSideMenu.ts +1 -0
- package/src/lib/composables/useVideoPlayer.ts +3 -2
- package/src/lib/config/loader.ts +57 -14
- package/src/lib/constants/components.ts +10 -0
- package/src/lib/hooks/index.ts +0 -1
- package/src/lib/hooks/useComponentCustomization.ts +11 -15
- package/src/lib/hooks/usePerformanceMonitor.ts +149 -0
- package/src/lib/patterns/index.ts +2 -2
- package/src/lib/patterns/slots.tsx +2 -2
- package/src/lib/theme/README.md +174 -0
- package/src/lib/theme/adapters/index.ts +31 -0
- package/src/lib/theme/adapters/themeAdapter.ts +287 -0
- package/src/lib/theme/config/__tests__/configLoader.test.ts +207 -0
- package/src/lib/theme/config/configLoader.ts +254 -0
- package/src/lib/theme/config/loader.ts +37 -48
- package/src/lib/theme/config/types.ts +2 -2
- package/src/lib/theme/config/validator.ts +15 -91
- package/src/lib/theme/{constants.ts → constants/constants.ts} +0 -18
- package/src/lib/theme/constants/index.ts +8 -0
- package/src/lib/theme/core/ThemeRegistry.ts +19 -6
- package/src/lib/theme/core/__tests__/createTheme.test.ts +132 -0
- package/src/lib/theme/core/composeTheme.ts +155 -0
- package/src/lib/theme/core/createTheme.ts +94 -0
- package/src/lib/theme/{createTheme.ts → core/createThemeObject.ts} +10 -6
- package/src/lib/theme/core/index.ts +5 -19
- package/src/lib/theme/devtools/Comparator.tsx +346 -22
- package/src/lib/theme/devtools/IMPROVEMENTS.md +139 -38
- package/src/lib/theme/devtools/Inspector.tsx +335 -51
- package/src/lib/theme/devtools/LiveEditor.tsx +489 -112
- package/src/lib/theme/devtools/Preview.tsx +471 -221
- package/src/lib/theme/{core → devtools}/ThemeValidator.ts +6 -3
- package/src/lib/theme/devtools/index.ts +14 -4
- package/src/lib/theme/devtools/useHistory.ts +130 -0
- package/src/lib/theme/errors/index.ts +12 -0
- package/src/lib/theme/generators/cssFile.ts +79 -0
- package/src/lib/theme/generators/generateCSS.ts +89 -0
- package/src/lib/theme/{generateCSSVariables.ts → generators/generateCSSVariables.ts} +4 -14
- package/src/lib/theme/generators/index.ts +19 -0
- package/src/lib/theme/i18n/rtl.ts +7 -7
- package/src/lib/theme/index.ts +120 -15
- package/src/lib/theme/runtime/ThemeApplicator.ts +53 -95
- package/src/lib/theme/{ThemeContext.tsx → runtime/ThemeContext.tsx} +1 -1
- package/src/lib/theme/runtime/ThemeErrorBoundary.tsx +4 -4
- package/src/lib/theme/runtime/ThemeProvider.tsx +456 -179
- package/src/lib/theme/runtime/index.ts +1 -2
- package/src/lib/theme/runtime/useTheme.ts +1 -2
- package/src/lib/theme/test/testTheme.ts +385 -0
- package/src/lib/theme/tokens/index.ts +12 -0
- package/src/lib/theme/tokens/tokens.ts +721 -0
- package/src/lib/theme/types.ts +6 -42
- package/src/lib/theme/{utils.ts → utils/domUtils.ts} +2 -2
- package/src/lib/theme/utils/index.ts +11 -0
- package/src/lib/theme/utils/injectCSS.ts +90 -0
- package/src/lib/theme/utils/themeHelpers.ts +78 -0
- package/src/lib/theme/{themeUtils.ts → utils/themeUtils.ts} +1 -1
- package/src/lib/theme-tools.ts +8 -9
- package/src/lib/types/components.ts +93 -34
- package/src/lib/types/partProps.ts +0 -16
- package/src/lib/utils/componentUtils.ts +1 -1
- package/src/lib/utils/fontPreloader.ts +148 -0
- package/src/lib/utils/index.ts +11 -0
- package/src/lib/utils/memoryMonitor.ts +189 -0
- package/src/styles/01-settings/_settings.design-tokens.scss +4 -1
- package/src/styles/01-settings/_settings.fonts.scss +2 -5
- package/src/styles/02-tools/_tools.button.scss +66 -79
- package/src/styles/06-components/_components.atomix-glass.scss +13 -3
- package/src/styles/06-components/_components.navbar.scss +0 -6
- package/src/styles/06-components/_components.pagination.scss +88 -0
- package/scripts/build-themes.js +0 -208
- package/scripts/sync-theme-config.js +0 -309
- package/src/components/AtomixGlass/atomixGLass.old.tsx +0 -1263
- package/src/lib/theme/composeTheme.ts +0 -370
- package/src/lib/theme/core/ThemeCache.ts +0 -283
- package/src/lib/theme/core/ThemeEngine.test.ts +0 -146
- package/src/lib/theme/core/ThemeEngine.ts +0 -657
- package/src/lib/theme/createThemeFromConfig.ts +0 -132
- package/src/lib/theme/devtools/CLI.ts +0 -364
- package/src/lib/theme/runtime/ThemeManager.test.ts +0 -192
- package/src/lib/theme/runtime/ThemeManager.ts +0 -442
- package/src/styles/03-generic/_generated-root.css +0 -5
- package/src/themes/README.md +0 -442
- package/src/themes/themes.config.js +0 -35
- /package/src/lib/theme/{cssVariableMapper.ts → adapters/cssVariableMapper.ts} +0 -0
- /package/src/lib/theme/{errors.ts → errors/errors.ts} +0 -0
|
@@ -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
|
|
170
|
+
if (typeof window !== 'undefined' && glassRef.current) {
|
|
165
171
|
try {
|
|
166
172
|
const computedStyle = window.getComputedStyle(glassRef.current);
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
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
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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
|
|
397
|
-
//
|
|
398
|
-
//
|
|
399
|
-
//
|
|
400
|
-
const whiteColor = '255, 255, 255';
|
|
401
|
-
const blackColor = '0, 0, 0';
|
|
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
|
-
//
|
|
134
|
-
//
|
|
135
|
-
//
|
|
136
|
-
|
|
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,
|
|
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=
|
|
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',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
1
|
+
import React, { useState, memo } from 'react';
|
|
2
2
|
import { AvatarProps } from '../../lib/types/components';
|
|
3
3
|
import { AVATAR } from '../../lib/constants/components';
|
|
4
4
|
import { Icon } from '../Icon/Icon';
|
|
5
5
|
|
|
6
|
-
export const Avatar: React.FC<AvatarProps> = ({
|
|
6
|
+
export const Avatar: React.FC<AvatarProps> = memo(({
|
|
7
7
|
src,
|
|
8
8
|
alt = 'Avatar',
|
|
9
9
|
initials,
|
|
@@ -62,7 +62,7 @@ export const Avatar: React.FC<AvatarProps> = ({
|
|
|
62
62
|
)}
|
|
63
63
|
</div>
|
|
64
64
|
);
|
|
65
|
-
};
|
|
65
|
+
});
|
|
66
66
|
|
|
67
67
|
Avatar.displayName = 'Avatar';
|
|
68
68
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
3
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
3
4
|
import { BADGE, SIZES, THEME_COLORS } from '../../lib/constants/components';
|
|
@@ -11,17 +12,26 @@ const meta = {
|
|
|
11
12
|
component: Badge,
|
|
12
13
|
parameters: {
|
|
13
14
|
layout: 'centered',
|
|
15
|
+
docs: {
|
|
16
|
+
description: {
|
|
17
|
+
component:
|
|
18
|
+
'The Badge component displays small pieces of information, status indicators, or labels. It supports multiple variants, sizes, and can include icons. Badges are ideal for highlighting important information or showing status.',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
14
21
|
},
|
|
22
|
+
tags: ['autodocs'],
|
|
15
23
|
argTypes: {
|
|
16
24
|
variant: {
|
|
17
25
|
control: { type: 'select' },
|
|
18
26
|
options: THEME_COLORS,
|
|
19
27
|
description: 'The visual style of the badge',
|
|
28
|
+
defaultValue: 'primary',
|
|
20
29
|
},
|
|
21
30
|
size: {
|
|
22
31
|
control: { type: 'select' },
|
|
23
32
|
options: SIZES,
|
|
24
33
|
description: 'The size of the badge',
|
|
34
|
+
defaultValue: 'md',
|
|
25
35
|
},
|
|
26
36
|
disabled: {
|
|
27
37
|
control: 'boolean',
|
|
@@ -60,7 +70,9 @@ const Icon = () => (
|
|
|
60
70
|
</svg>
|
|
61
71
|
);
|
|
62
72
|
|
|
63
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Primary badge variant - the main badge style.
|
|
75
|
+
*/
|
|
64
76
|
export const Primary: Story = {
|
|
65
77
|
args: {
|
|
66
78
|
label: 'Primary',
|
|
@@ -69,6 +81,9 @@ export const Primary: Story = {
|
|
|
69
81
|
},
|
|
70
82
|
};
|
|
71
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Secondary badge variant - used for secondary information.
|
|
86
|
+
*/
|
|
72
87
|
export const Secondary: Story = {
|
|
73
88
|
args: {
|
|
74
89
|
label: 'Secondary',
|
|
@@ -77,6 +92,9 @@ export const Secondary: Story = {
|
|
|
77
92
|
},
|
|
78
93
|
};
|
|
79
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Success badge variant - indicates successful or positive status.
|
|
97
|
+
*/
|
|
80
98
|
export const Success: Story = {
|
|
81
99
|
args: {
|
|
82
100
|
label: 'Success',
|
|
@@ -85,6 +103,9 @@ export const Success: Story = {
|
|
|
85
103
|
},
|
|
86
104
|
};
|
|
87
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Info badge variant - used for informational status.
|
|
108
|
+
*/
|
|
88
109
|
export const Info: Story = {
|
|
89
110
|
args: {
|
|
90
111
|
label: 'Info',
|
|
@@ -93,6 +114,9 @@ export const Info: Story = {
|
|
|
93
114
|
},
|
|
94
115
|
};
|
|
95
116
|
|
|
117
|
+
/**
|
|
118
|
+
* Warning badge variant - indicates caution or warning status.
|
|
119
|
+
*/
|
|
96
120
|
export const Warning: Story = {
|
|
97
121
|
args: {
|
|
98
122
|
label: 'Warning',
|
|
@@ -101,7 +125,10 @@ export const Warning: Story = {
|
|
|
101
125
|
},
|
|
102
126
|
};
|
|
103
127
|
|
|
104
|
-
|
|
128
|
+
/**
|
|
129
|
+
* Error badge variant - indicates error or critical status.
|
|
130
|
+
*/
|
|
131
|
+
export const Error: Story = {
|
|
105
132
|
args: {
|
|
106
133
|
label: 'Error',
|
|
107
134
|
variant: 'error',
|
|
@@ -109,6 +136,9 @@ export const error: Story = {
|
|
|
109
136
|
},
|
|
110
137
|
};
|
|
111
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Light badge variant - light color scheme.
|
|
141
|
+
*/
|
|
112
142
|
export const Light: Story = {
|
|
113
143
|
args: {
|
|
114
144
|
label: 'Light',
|
|
@@ -117,6 +147,9 @@ export const Light: Story = {
|
|
|
117
147
|
},
|
|
118
148
|
};
|
|
119
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Dark badge variant - dark color scheme.
|
|
152
|
+
*/
|
|
120
153
|
export const Dark: Story = {
|
|
121
154
|
args: {
|
|
122
155
|
label: 'Dark',
|
|
@@ -125,7 +158,9 @@ export const Dark: Story = {
|
|
|
125
158
|
},
|
|
126
159
|
};
|
|
127
160
|
|
|
128
|
-
|
|
161
|
+
/**
|
|
162
|
+
* Small size badge variant.
|
|
163
|
+
*/
|
|
129
164
|
export const Small: Story = {
|
|
130
165
|
args: {
|
|
131
166
|
label: 'Small',
|
|
@@ -134,6 +169,9 @@ export const Small: Story = {
|
|
|
134
169
|
},
|
|
135
170
|
};
|
|
136
171
|
|
|
172
|
+
/**
|
|
173
|
+
* Medium size badge variant (default).
|
|
174
|
+
*/
|
|
137
175
|
export const Medium: Story = {
|
|
138
176
|
args: {
|
|
139
177
|
label: 'Medium',
|
|
@@ -142,6 +180,9 @@ export const Medium: Story = {
|
|
|
142
180
|
},
|
|
143
181
|
};
|
|
144
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Large size badge variant.
|
|
185
|
+
*/
|
|
145
186
|
export const Large: Story = {
|
|
146
187
|
args: {
|
|
147
188
|
label: 'Large',
|
|
@@ -150,7 +191,9 @@ export const Large: Story = {
|
|
|
150
191
|
},
|
|
151
192
|
};
|
|
152
193
|
|
|
153
|
-
|
|
194
|
+
/**
|
|
195
|
+
* Disabled badge state - non-interactive badge.
|
|
196
|
+
*/
|
|
154
197
|
export const Disabled: Story = {
|
|
155
198
|
args: {
|
|
156
199
|
label: 'Disabled',
|
|
@@ -160,7 +203,9 @@ export const Disabled: Story = {
|
|
|
160
203
|
},
|
|
161
204
|
};
|
|
162
205
|
|
|
163
|
-
|
|
206
|
+
/**
|
|
207
|
+
* Badge with icon - displays an icon alongside the label.
|
|
208
|
+
*/
|
|
164
209
|
export const WithIcon: Story = {
|
|
165
210
|
args: {
|
|
166
211
|
label: 'With Icon',
|
|
@@ -170,12 +215,21 @@ export const WithIcon: Story = {
|
|
|
170
215
|
},
|
|
171
216
|
};
|
|
172
217
|
|
|
173
|
-
|
|
218
|
+
/**
|
|
219
|
+
* Showcase of all badge color variants in a single view.
|
|
220
|
+
*/
|
|
174
221
|
export const AllVariants: Story = {
|
|
175
222
|
args: {
|
|
176
223
|
label: 'Badge',
|
|
177
224
|
variant: 'primary',
|
|
178
225
|
},
|
|
226
|
+
parameters: {
|
|
227
|
+
docs: {
|
|
228
|
+
description: {
|
|
229
|
+
story: 'Displays all available badge color variants for easy comparison and selection.',
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
},
|
|
179
233
|
render: () => (
|
|
180
234
|
<div className="u-d-flex u-flex-wrap u-gap-2">
|
|
181
235
|
{THEME_COLORS.map(color => (
|
|
@@ -185,12 +239,21 @@ export const AllVariants: Story = {
|
|
|
185
239
|
),
|
|
186
240
|
};
|
|
187
241
|
|
|
188
|
-
|
|
242
|
+
/**
|
|
243
|
+
* Showcase of all badge sizes (small, medium, large) in a single view.
|
|
244
|
+
*/
|
|
189
245
|
export const AllSizes: Story = {
|
|
190
246
|
args: {
|
|
191
247
|
label: 'Badge',
|
|
192
248
|
variant: 'primary',
|
|
193
249
|
},
|
|
250
|
+
parameters: {
|
|
251
|
+
docs: {
|
|
252
|
+
description: {
|
|
253
|
+
story: 'Compares all available badge sizes to help choose the appropriate size for your use case.',
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
},
|
|
194
257
|
render: () => (
|
|
195
258
|
<div className="u-d-flex u-align-items-center u-gap-2">
|
|
196
259
|
<Badge label="Small" variant="primary" size="sm" />
|
|
@@ -200,7 +263,9 @@ export const AllSizes: Story = {
|
|
|
200
263
|
),
|
|
201
264
|
};
|
|
202
265
|
|
|
203
|
-
|
|
266
|
+
/**
|
|
267
|
+
* Badge examples with different content types (numeric, status, with icons).
|
|
268
|
+
*/
|
|
204
269
|
export const WithDifferentContent: Story = {
|
|
205
270
|
args: {
|
|
206
271
|
label: 'Badge with different content',
|
|
@@ -241,11 +306,20 @@ export const WithDifferentContent: Story = {
|
|
|
241
306
|
),
|
|
242
307
|
};
|
|
243
308
|
|
|
244
|
-
|
|
309
|
+
/**
|
|
310
|
+
* Real-world usage examples showing badges in navigation, cards, and lists.
|
|
311
|
+
*/
|
|
245
312
|
export const UsageExamples: Story = {
|
|
246
313
|
args: {
|
|
247
314
|
label: 'Usage examples',
|
|
248
315
|
},
|
|
316
|
+
parameters: {
|
|
317
|
+
docs: {
|
|
318
|
+
description: {
|
|
319
|
+
story: 'Practical examples demonstrating how badges can be used in real-world scenarios such as navigation menus, product cards, and task lists.',
|
|
320
|
+
},
|
|
321
|
+
},
|
|
322
|
+
},
|
|
249
323
|
render: () => (
|
|
250
324
|
<div className="u-d-flex u-flex-column u-gap-6 u-max-width-80">
|
|
251
325
|
<div>
|
|
@@ -308,7 +382,9 @@ export const UsageExamples: Story = {
|
|
|
308
382
|
),
|
|
309
383
|
};
|
|
310
384
|
|
|
311
|
-
|
|
385
|
+
/**
|
|
386
|
+
* Theme-aware badges demonstrating how they adapt to different theme modes.
|
|
387
|
+
*/
|
|
312
388
|
export const ThemeAwareBadges: Story = {
|
|
313
389
|
args: {
|
|
314
390
|
label: 'Badge',
|
|
@@ -359,7 +435,7 @@ export const ThemeAwareBadges: Story = {
|
|
|
359
435
|
</div>
|
|
360
436
|
<div className="u-d-flex u-align-items-center u-gap-2">
|
|
361
437
|
<span className="u-d-inline-block" style={{ width: '120px' }}>
|
|
362
|
-
|
|
438
|
+
Error:
|
|
363
439
|
</span>
|
|
364
440
|
<Badge label="Failed" variant="error" />
|
|
365
441
|
</div>
|
|
@@ -375,7 +451,9 @@ export const ThemeAwareBadges: Story = {
|
|
|
375
451
|
),
|
|
376
452
|
};
|
|
377
453
|
|
|
378
|
-
|
|
454
|
+
/**
|
|
455
|
+
* Badge with glass morphism effect - primary variant.
|
|
456
|
+
*/
|
|
379
457
|
export const GlassPrimary: Story = {
|
|
380
458
|
args: {
|
|
381
459
|
label: 'Glass Primary',
|
|
@@ -540,7 +618,7 @@ export const GlassCustomSettings: Story = {
|
|
|
540
618
|
aberrationIntensity: 1,
|
|
541
619
|
cornerRadius: 16,
|
|
542
620
|
mode: 'polar',
|
|
543
|
-
},
|
|
621
|
+
} as any,
|
|
544
622
|
},
|
|
545
623
|
decorators: [
|
|
546
624
|
Story => (
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { useRef } from 'react';
|
|
1
|
+
import React, { useRef, memo } from 'react';
|
|
2
2
|
import { useBadge } from '../../lib/composables/useBadge';
|
|
3
3
|
import { BADGE } from '../../lib/constants/components';
|
|
4
4
|
import { BadgeProps } from '../../lib/types/components';
|
|
5
5
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
6
6
|
|
|
7
|
-
export const Badge: React.FC<BadgeProps> = ({
|
|
7
|
+
export const Badge: React.FC<BadgeProps> = memo(({
|
|
8
8
|
label,
|
|
9
9
|
variant = 'primary',
|
|
10
10
|
size = 'md',
|
|
@@ -53,7 +53,7 @@ export const Badge: React.FC<BadgeProps> = ({
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
return badgeElement;
|
|
56
|
-
};
|
|
56
|
+
});
|
|
57
57
|
|
|
58
58
|
Badge.displayName = 'Badge';
|
|
59
59
|
|
|
@@ -5,43 +5,27 @@ import { Button } from '../Button/Button';
|
|
|
5
5
|
import { Card } from '../Card/Card';
|
|
6
6
|
import { Block } from './Block';
|
|
7
7
|
|
|
8
|
-
const meta
|
|
8
|
+
const meta = {
|
|
9
9
|
title: 'Components/Block',
|
|
10
10
|
component: Block,
|
|
11
11
|
parameters: {
|
|
12
12
|
layout: 'fullscreen',
|
|
13
13
|
docs: {
|
|
14
14
|
description: {
|
|
15
|
-
component:
|
|
16
|
-
The Block component is a flexible layout container designed for creating consistent section layouts.
|
|
17
|
-
It provides standardized spacing, background variants, and container behavior for organizing content
|
|
18
|
-
into distinct sections or blocks.
|
|
19
|
-
|
|
20
|
-
## Key Features
|
|
21
|
-
- **Flexible spacing**: Multiple spacing sizes (xs, sm, md, lg, xl, none)
|
|
22
|
-
- **Background variants**: Transparent, subtle, muted, primary, secondary, accent
|
|
23
|
-
- **Container integration**: Built-in Container support for responsive layouts
|
|
24
|
-
- **Semantic HTML**: Configurable as section, div, article, aside, or main
|
|
25
|
-
- **Full-width support**: Option for edge-to-edge content
|
|
26
|
-
|
|
27
|
-
## Usage Guidelines
|
|
28
|
-
Use Block components to:
|
|
29
|
-
- Create consistent section spacing across pages
|
|
30
|
-
- Group related content with appropriate backgrounds
|
|
31
|
-
- Build hero sections, content areas, and feature blocks
|
|
32
|
-
- Maintain visual hierarchy and rhythm in layouts
|
|
33
|
-
`,
|
|
15
|
+
component:
|
|
16
|
+
'The Block component is a flexible layout container designed for creating consistent section layouts. It provides standardized spacing, background variants, and container behavior for organizing content into distinct sections or blocks. Blocks are ideal for hero sections, content areas, feature blocks, and maintaining visual hierarchy.',
|
|
34
17
|
},
|
|
35
18
|
},
|
|
36
19
|
},
|
|
20
|
+
tags: ['autodocs'],
|
|
37
21
|
argTypes: {
|
|
38
22
|
as: {
|
|
39
|
-
control: 'select',
|
|
23
|
+
control: { type: 'select' },
|
|
40
24
|
options: ['section', 'div', 'article', 'aside', 'main'],
|
|
41
25
|
description: 'The HTML element to render as',
|
|
42
26
|
},
|
|
43
27
|
spacing: {
|
|
44
|
-
control: 'select',
|
|
28
|
+
control: { type: 'select' },
|
|
45
29
|
options: ['xs', 'sm', 'md', 'lg', 'xl', 'none'],
|
|
46
30
|
description: 'Vertical padding size',
|
|
47
31
|
},
|
|
@@ -54,7 +38,7 @@ Use Block components to:
|
|
|
54
38
|
description: 'Content to render within the block',
|
|
55
39
|
},
|
|
56
40
|
},
|
|
57
|
-
}
|
|
41
|
+
} satisfies Meta<typeof Block>;
|
|
58
42
|
|
|
59
43
|
export default meta;
|
|
60
44
|
type Story = StoryObj<typeof meta>;
|
|
@@ -7,7 +7,14 @@ const meta = {
|
|
|
7
7
|
component: Breadcrumb,
|
|
8
8
|
parameters: {
|
|
9
9
|
layout: 'centered',
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component:
|
|
13
|
+
'The Breadcrumb component provides navigation context by showing the current page location within a site hierarchy. It helps users understand where they are and provides quick navigation to parent pages. Breadcrumbs support custom dividers, icons, and are fully accessible.',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
10
16
|
},
|
|
17
|
+
tags: ['autodocs'],
|
|
11
18
|
argTypes: {
|
|
12
19
|
items: { control: 'object' },
|
|
13
20
|
divider: { control: 'text' },
|