@shohojdhara/atomix 0.6.3 → 0.6.5
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/dist/atomix.css +119 -40
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +1 -1
- package/dist/atomix.min.css.map +1 -1
- package/dist/atomix.umd.js +1 -1
- package/dist/atomix.umd.js.map +1 -1
- package/dist/atomix.umd.min.js +1 -1
- package/dist/charts.d.ts +30 -1
- package/dist/charts.js +566 -597
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +30 -1
- package/dist/core.js +600 -624
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +30 -1
- package/dist/forms.js +1122 -1163
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +31 -89
- package/dist/heavy.js +1015 -1045
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +378 -104
- package/dist/index.esm.js +10959 -10837
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +10935 -10812
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Accordion/Accordion.tsx +2 -5
- package/src/components/AtomixGlass/AtomixGlass.test.tsx +14 -16
- package/src/components/AtomixGlass/AtomixGlass.tsx +137 -355
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +32 -249
- package/src/components/AtomixGlass/GlassFilter.tsx +62 -68
- package/src/components/AtomixGlass/README.md +2 -1
- package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +19 -18
- package/src/components/AtomixGlass/glass-border-styles.test.ts +58 -0
- package/src/components/AtomixGlass/glass-border-styles.ts +136 -0
- package/src/components/AtomixGlass/glass-utils.ts +411 -6
- package/src/components/AtomixGlass/stories/AnimationFeatures.stories.tsx +158 -537
- package/src/components/AtomixGlass/stories/Border.stories.tsx +149 -0
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +229 -89
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +29 -340
- package/src/components/AtomixGlass/stories/argTypes.ts +30 -13
- package/src/components/AtomixGlass/stories/premium-presets.ts +206 -0
- package/src/components/AtomixGlass/stories/shared-components.tsx +52 -8
- package/src/components/Badge/Badge.tsx +4 -4
- package/src/components/Button/Button.tsx +2 -6
- package/src/components/Callout/Callout.test.tsx +4 -3
- package/src/components/Callout/Callout.tsx +2 -5
- package/src/components/Dropdown/Dropdown.tsx +3 -7
- package/src/components/Form/Checkbox.tsx +2 -8
- package/src/components/Form/Input.tsx +2 -9
- package/src/components/Form/Radio.tsx +2 -9
- package/src/components/Form/Select.tsx +2 -7
- package/src/components/Form/Textarea.tsx +2 -9
- package/src/components/Messages/Messages.tsx +2 -8
- package/src/components/Modal/Modal.tsx +4 -5
- package/src/components/Navigation/Nav/Nav.tsx +2 -6
- package/src/components/Navigation/Navbar/Navbar.tsx +2 -9
- package/src/components/Navigation/SideMenu/SideMenu.tsx +2 -6
- package/src/components/Pagination/Pagination.tsx +2 -10
- package/src/components/Popover/Popover.tsx +2 -9
- package/src/components/Progress/Progress.tsx +2 -7
- package/src/components/Rating/Rating.tsx +2 -10
- package/src/components/Spinner/Spinner.tsx +2 -7
- package/src/components/Steps/Steps.tsx +2 -10
- package/src/components/Tabs/Tabs.tsx +2 -9
- package/src/components/Toggle/Toggle.tsx +2 -10
- package/src/components/Tooltip/Tooltip.tsx +2 -5
- package/src/lib/composables/useAtomixGlass.ts +41 -10
- package/src/lib/composables/useAtomixGlassStyles.ts +59 -75
- package/src/lib/composables/usePerformanceMonitor.ts +5 -0
- package/src/lib/constants/components.ts +358 -46
- package/src/lib/types/components.ts +33 -1
- package/src/styles/01-settings/_settings.atomix-glass.scss +69 -31
- package/src/styles/02-tools/_tools.glass.scss +45 -3
- package/src/styles/06-components/_components.atomix-glass.scss +114 -77
- package/src/components/AtomixGlass/deprecated/AtomixGlass.deprecated.tsx +0 -390
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Premium / Apple liquid-glass presets for AtomixGlass Storybook stories.
|
|
3
|
+
* Centralizes tuned displacement, blur, and saturation so previews stay consistent.
|
|
4
|
+
*/
|
|
5
|
+
import type { AtomixGlassProps } from '../../../lib/types/components';
|
|
6
|
+
|
|
7
|
+
/** Curated backgrounds that show frost, tint, and depth well */
|
|
8
|
+
export const premiumBackgrounds = [
|
|
9
|
+
'https://images.unsplash.com/photo-1614188973043-4ed7d383de37?ixlib=rb-4.1.0&auto=format&fit=crop&q=80&w=2000',
|
|
10
|
+
'https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?ixlib=rb-4.1.0&auto=format&fit=crop&q=80&w=2128',
|
|
11
|
+
'https://images.unsplash.com/photo-1593433073755-4233a78ee359?q=80&w=1600&auto=format&fit=crop',
|
|
12
|
+
'https://images.unsplash.com/photo-1637825891028-564f672aa42c?ixlib=rb-4.1.0&auto=format&fit=crop&q=80&w=2000',
|
|
13
|
+
'https://images.unsplash.com/photo-1506905925346-21bda4d32df4?q=80&w=2000&auto=format&fit=crop',
|
|
14
|
+
'https://images.unsplash.com/photo-1519681393784-d120267933ba?ixlib=rb-4.1.0&auto=format&fit=crop&q=80&w=2000',
|
|
15
|
+
] as const;
|
|
16
|
+
|
|
17
|
+
/** Apple Music–style dark canvas when no photo is needed */
|
|
18
|
+
export const premiumDarkCanvas =
|
|
19
|
+
'radial-gradient(ellipse 110% 90% at 65% 15%, #5c1030 0%, #1a0a12 42%, #0a0a0c 100%)';
|
|
20
|
+
|
|
21
|
+
export type PremiumGlassPreset = Pick<
|
|
22
|
+
AtomixGlassProps,
|
|
23
|
+
| 'displacementScale'
|
|
24
|
+
| 'blurAmount'
|
|
25
|
+
| 'saturation'
|
|
26
|
+
| 'aberrationIntensity'
|
|
27
|
+
| 'elasticity'
|
|
28
|
+
| 'borderRadius'
|
|
29
|
+
| 'mode'
|
|
30
|
+
| 'withLiquidBlur'
|
|
31
|
+
| 'withTimeAnimation'
|
|
32
|
+
| 'withMultiLayerDistortion'
|
|
33
|
+
| 'distortionQuality'
|
|
34
|
+
| 'animationSpeed'
|
|
35
|
+
| 'shaderVariant'
|
|
36
|
+
>;
|
|
37
|
+
|
|
38
|
+
/** Production-tuned glass recipes */
|
|
39
|
+
export const PREMIUM_GLASS = {
|
|
40
|
+
/** Sidebar, nav bar, player chrome — minimal warp, deep blur */
|
|
41
|
+
chrome: {
|
|
42
|
+
displacementScale: 24,
|
|
43
|
+
blurAmount: 24,
|
|
44
|
+
saturation: 180,
|
|
45
|
+
aberrationIntensity: 0.4,
|
|
46
|
+
elasticity: 0,
|
|
47
|
+
borderRadius: 12,
|
|
48
|
+
},
|
|
49
|
+
/** Cards, modals, panels */
|
|
50
|
+
card: {
|
|
51
|
+
displacementScale: 28,
|
|
52
|
+
blurAmount: 20,
|
|
53
|
+
saturation: 180,
|
|
54
|
+
aberrationIntensity: 0.56,
|
|
55
|
+
elasticity: 0.05,
|
|
56
|
+
borderRadius: 16,
|
|
57
|
+
},
|
|
58
|
+
/** Floating pills, toolbars */
|
|
59
|
+
pill: {
|
|
60
|
+
displacementScale: 22,
|
|
61
|
+
blurAmount: 22,
|
|
62
|
+
saturation: 180,
|
|
63
|
+
aberrationIntensity: 0.35,
|
|
64
|
+
elasticity: 0,
|
|
65
|
+
borderRadius: 999,
|
|
66
|
+
},
|
|
67
|
+
/** Marketing hero — more presence, still refined */
|
|
68
|
+
hero: {
|
|
69
|
+
displacementScale: 48,
|
|
70
|
+
blurAmount: 28,
|
|
71
|
+
saturation: 185,
|
|
72
|
+
aberrationIntensity: 1.2,
|
|
73
|
+
elasticity: 0.08,
|
|
74
|
+
borderRadius: 24,
|
|
75
|
+
mode: 'prominent' as const,
|
|
76
|
+
withLiquidBlur: true,
|
|
77
|
+
withTimeAnimation: true,
|
|
78
|
+
withMultiLayerDistortion: true,
|
|
79
|
+
distortionQuality: 'high' as const,
|
|
80
|
+
},
|
|
81
|
+
/** Shader + FBM demos */
|
|
82
|
+
liquid: {
|
|
83
|
+
displacementScale: 40,
|
|
84
|
+
blurAmount: 26,
|
|
85
|
+
saturation: 185,
|
|
86
|
+
aberrationIntensity: 1,
|
|
87
|
+
elasticity: 0.06,
|
|
88
|
+
borderRadius: 22,
|
|
89
|
+
mode: 'shader' as const,
|
|
90
|
+
withTimeAnimation: true,
|
|
91
|
+
withMultiLayerDistortion: true,
|
|
92
|
+
withLiquidBlur: true,
|
|
93
|
+
distortionQuality: 'high' as const,
|
|
94
|
+
animationSpeed: 1,
|
|
95
|
+
shaderVariant: 'liquidGlass' as const,
|
|
96
|
+
},
|
|
97
|
+
/** Cinematic / showcase */
|
|
98
|
+
cinematic: {
|
|
99
|
+
displacementScale: 56,
|
|
100
|
+
blurAmount: 32,
|
|
101
|
+
saturation: 190,
|
|
102
|
+
aberrationIntensity: 1.4,
|
|
103
|
+
elasticity: 0.1,
|
|
104
|
+
borderRadius: 28,
|
|
105
|
+
mode: 'shader' as const,
|
|
106
|
+
withTimeAnimation: true,
|
|
107
|
+
withMultiLayerDistortion: true,
|
|
108
|
+
withLiquidBlur: true,
|
|
109
|
+
distortionQuality: 'ultra' as const,
|
|
110
|
+
animationSpeed: 1.1,
|
|
111
|
+
shaderVariant: 'appleFluid' as const,
|
|
112
|
+
},
|
|
113
|
+
} satisfies Record<string, PremiumGlassPreset>;
|
|
114
|
+
|
|
115
|
+
export const premiumTypography = {
|
|
116
|
+
fontFamily:
|
|
117
|
+
'-apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif',
|
|
118
|
+
titleGradient:
|
|
119
|
+
'linear-gradient(135deg, #ffffff 0%, rgba(255,255,255,0.72) 100%)',
|
|
120
|
+
muted: 'rgba(255,255,255,0.72)',
|
|
121
|
+
dim: 'rgba(255,255,255,0.45)',
|
|
122
|
+
} as const;
|
|
123
|
+
|
|
124
|
+
/** Playground sidebar preset bundle (settings object shape) */
|
|
125
|
+
export const createPlaygroundPresetSettings = (
|
|
126
|
+
glass: PremiumGlassPreset,
|
|
127
|
+
extras: Record<string, unknown> = {}
|
|
128
|
+
) => ({
|
|
129
|
+
displacementScale: glass.displacementScale ?? 28,
|
|
130
|
+
blurAmount: glass.blurAmount ?? 20,
|
|
131
|
+
saturation: glass.saturation ?? 180,
|
|
132
|
+
aberrationIntensity: glass.aberrationIntensity ?? 0.56,
|
|
133
|
+
elasticity: glass.elasticity ?? 0,
|
|
134
|
+
borderRadius: glass.borderRadius ?? 16,
|
|
135
|
+
overLight: false,
|
|
136
|
+
reducedMotion: false,
|
|
137
|
+
highContrast: false,
|
|
138
|
+
withoutEffects: false,
|
|
139
|
+
withLiquidBlur: Boolean(glass.withLiquidBlur),
|
|
140
|
+
withBorder: true,
|
|
141
|
+
withTimeAnimation: Boolean(glass.withTimeAnimation),
|
|
142
|
+
animationSpeed: glass.animationSpeed ?? 1,
|
|
143
|
+
withMultiLayerDistortion: Boolean(glass.withMultiLayerDistortion),
|
|
144
|
+
distortionOctaves: 5,
|
|
145
|
+
distortionLacunarity: 2,
|
|
146
|
+
distortionGain: 0.5,
|
|
147
|
+
distortionQuality: (glass.distortionQuality ?? 'high') as 'low' | 'medium' | 'high' | 'ultra',
|
|
148
|
+
devicePreset: 'quality' as const,
|
|
149
|
+
disableResponsiveBreakpoints: false,
|
|
150
|
+
debugPerformance: false,
|
|
151
|
+
debugOverLight: false,
|
|
152
|
+
...extras,
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
export const PLAYGROUND_PRESETS = {
|
|
156
|
+
apple: {
|
|
157
|
+
name: 'Apple Chrome',
|
|
158
|
+
icon: '',
|
|
159
|
+
settings: createPlaygroundPresetSettings(PREMIUM_GLASS.chrome, {
|
|
160
|
+
withTimeAnimation: false,
|
|
161
|
+
devicePreset: 'balanced' as const,
|
|
162
|
+
}),
|
|
163
|
+
mode: 'standard' as const,
|
|
164
|
+
shader: 'liquidGlass' as const,
|
|
165
|
+
},
|
|
166
|
+
card: {
|
|
167
|
+
name: 'Premium Card',
|
|
168
|
+
icon: '💎',
|
|
169
|
+
settings: createPlaygroundPresetSettings(PREMIUM_GLASS.card),
|
|
170
|
+
mode: 'standard' as const,
|
|
171
|
+
shader: 'liquidGlass' as const,
|
|
172
|
+
},
|
|
173
|
+
liquid: {
|
|
174
|
+
name: 'Liquid Glass',
|
|
175
|
+
icon: '💧',
|
|
176
|
+
settings: createPlaygroundPresetSettings(PREMIUM_GLASS.liquid, {
|
|
177
|
+
animationSpeed: 1.1,
|
|
178
|
+
distortionOctaves: 5,
|
|
179
|
+
}),
|
|
180
|
+
mode: 'shader' as const,
|
|
181
|
+
shader: 'appleFluid' as const,
|
|
182
|
+
},
|
|
183
|
+
hero: {
|
|
184
|
+
name: 'Hero',
|
|
185
|
+
icon: '✨',
|
|
186
|
+
settings: createPlaygroundPresetSettings(PREMIUM_GLASS.hero, {
|
|
187
|
+
distortionOctaves: 4,
|
|
188
|
+
}),
|
|
189
|
+
mode: 'prominent' as const,
|
|
190
|
+
shader: 'liquidGlass' as const,
|
|
191
|
+
},
|
|
192
|
+
cinematic: {
|
|
193
|
+
name: 'Cinematic',
|
|
194
|
+
icon: '🎬',
|
|
195
|
+
settings: createPlaygroundPresetSettings(PREMIUM_GLASS.cinematic, {
|
|
196
|
+
animationSpeed: 1.2,
|
|
197
|
+
distortionOctaves: 6,
|
|
198
|
+
distortionLacunarity: 2.2,
|
|
199
|
+
}),
|
|
200
|
+
mode: 'shader' as const,
|
|
201
|
+
shader: 'appleFluid' as const,
|
|
202
|
+
},
|
|
203
|
+
} as const;
|
|
204
|
+
|
|
205
|
+
/** Default playground starting point */
|
|
206
|
+
export const PLAYGROUND_DEFAULT_SETTINGS = PLAYGROUND_PRESETS.apple.settings;
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import React, { useState, useEffect, useCallback, useRef } from 'react';
|
|
13
13
|
import type { RefObject, ErrorInfo } from 'react';
|
|
14
14
|
import type { StoryErrorBoundaryProps } from './types';
|
|
15
|
+
import { premiumBackgrounds, premiumDarkCanvas } from './premium-presets';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Enhanced BackgroundWrapper Component
|
|
@@ -197,14 +198,57 @@ export const StoryContainer: React.FC<StoryContainerProps> = ({
|
|
|
197
198
|
/**
|
|
198
199
|
* Collection of high-quality background images for different moods and scenarios
|
|
199
200
|
*/
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
'
|
|
206
|
-
|
|
207
|
-
|
|
201
|
+
/** @deprecated Use premiumBackgrounds — kept for backward compatibility */
|
|
202
|
+
export const backgroundImages = [...premiumBackgrounds];
|
|
203
|
+
|
|
204
|
+
export interface PremiumSceneProps {
|
|
205
|
+
children: React.ReactNode;
|
|
206
|
+
variant?: 'photo' | 'dark';
|
|
207
|
+
photoIndex?: number;
|
|
208
|
+
height?: string;
|
|
209
|
+
overlay?: boolean;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Premium story backdrop — Apple-style dark gradient or rich photography.
|
|
214
|
+
*/
|
|
215
|
+
export const PremiumScene: React.FC<PremiumSceneProps> = ({
|
|
216
|
+
children,
|
|
217
|
+
variant = 'photo',
|
|
218
|
+
photoIndex = 0,
|
|
219
|
+
height = '100vh',
|
|
220
|
+
overlay = true,
|
|
221
|
+
}) => {
|
|
222
|
+
if (variant === 'dark') {
|
|
223
|
+
return (
|
|
224
|
+
<div
|
|
225
|
+
className="u-relative u-flex u-items-center u-justify-center u-overflow-hidden"
|
|
226
|
+
style={{
|
|
227
|
+
minHeight: height,
|
|
228
|
+
width: '100%',
|
|
229
|
+
background: premiumDarkCanvas,
|
|
230
|
+
}}
|
|
231
|
+
>
|
|
232
|
+
<div className="u-relative u-z-10 u-w-100 u-flex u-items-center u-justify-center u-p-6">
|
|
233
|
+
{children}
|
|
234
|
+
</div>
|
|
235
|
+
</div>
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return (
|
|
240
|
+
<BackgroundWrapper
|
|
241
|
+
backgroundImage={premiumBackgrounds[photoIndex % premiumBackgrounds.length]}
|
|
242
|
+
height={height}
|
|
243
|
+
overlay={overlay}
|
|
244
|
+
overlayColor="rgba(0, 0, 0, 0.35)"
|
|
245
|
+
overlayOpacity={0.45}
|
|
246
|
+
padding="2rem"
|
|
247
|
+
>
|
|
248
|
+
{children}
|
|
249
|
+
</BackgroundWrapper>
|
|
250
|
+
);
|
|
251
|
+
};
|
|
208
252
|
|
|
209
253
|
/**
|
|
210
254
|
* StoryErrorBoundary Component
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useRef, memo } from 'react';
|
|
2
2
|
import { useBadge } from '../../lib/composables/useBadge';
|
|
3
|
-
import { BADGE } from '../../lib/constants/components';
|
|
3
|
+
import { BADGE, GLASS_DEFAULTS } from '../../lib/constants/components';
|
|
4
4
|
import { BadgeProps } from '../../lib/types/components';
|
|
5
5
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
6
6
|
|
|
@@ -59,12 +59,12 @@ export const Badge: React.FC<BadgeProps> = memo(
|
|
|
59
59
|
if (glass) {
|
|
60
60
|
// Default glass settings for badges
|
|
61
61
|
const defaultGlassProps = {
|
|
62
|
-
|
|
62
|
+
...GLASS_DEFAULTS.BADGE,
|
|
63
|
+
// Override borderRadius dynamically if the ref is available
|
|
63
64
|
borderRadius: ref.current?.getBoundingClientRect().width
|
|
64
65
|
? ref.current?.getBoundingClientRect().width / 2
|
|
65
|
-
:
|
|
66
|
+
: GLASS_DEFAULTS.BADGE.borderRadius,
|
|
66
67
|
className: 'c-badge--glass',
|
|
67
|
-
elasticity: 0,
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
@@ -3,7 +3,7 @@ import { ButtonProps } from '../../lib/types/components';
|
|
|
3
3
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
4
4
|
import { Spinner } from '../Spinner/Spinner';
|
|
5
5
|
import { Icon, type PhosphorIconsType } from '../Icon/Icon';
|
|
6
|
-
import { BUTTON, THEME_NAMING } from '../../lib/constants/components';
|
|
6
|
+
import { BUTTON, THEME_NAMING, GLASS_DEFAULTS } from '../../lib/constants/components';
|
|
7
7
|
import { ThemeNaming } from '../../lib/utils/themeNaming';
|
|
8
8
|
import { renderSlot } from '../../lib/patterns';
|
|
9
9
|
|
|
@@ -321,11 +321,7 @@ export const Button = React.memo(
|
|
|
321
321
|
|
|
322
322
|
if (glass) {
|
|
323
323
|
// Default glass props
|
|
324
|
-
const defaultGlassProps =
|
|
325
|
-
displacementScale: 20,
|
|
326
|
-
blurAmount: 0,
|
|
327
|
-
saturation: 200,
|
|
328
|
-
};
|
|
324
|
+
const defaultGlassProps = GLASS_DEFAULTS.BUTTON;
|
|
329
325
|
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
330
326
|
return <AtomixGlass {...glassProps}>{buttonChildren}</AtomixGlass>;
|
|
331
327
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { render, screen, fireEvent } from '@testing-library/react';
|
|
2
2
|
import { describe, it, expect, vi } from 'vitest';
|
|
3
3
|
import { Callout } from './Callout';
|
|
4
|
+
import { GLASS_DEFAULTS } from '../../lib/constants/components';
|
|
4
5
|
|
|
5
6
|
// Mock AtomixGlass component since it has complex WebGL dependencies
|
|
6
7
|
vi.mock('../AtomixGlass/AtomixGlass', () => ({
|
|
@@ -151,9 +152,9 @@ describe('Callout Component', () => {
|
|
|
151
152
|
const glassProps = JSON.parse(glassElement.getAttribute('data-glass-props') || '{}');
|
|
152
153
|
|
|
153
154
|
expect(glassProps).toMatchObject({
|
|
154
|
-
displacementScale:
|
|
155
|
-
borderRadius:
|
|
156
|
-
elasticity:
|
|
155
|
+
displacementScale: GLASS_DEFAULTS.CALLOUT.displacementScale,
|
|
156
|
+
borderRadius: GLASS_DEFAULTS.CALLOUT.borderRadius,
|
|
157
|
+
elasticity: GLASS_DEFAULTS.CALLOUT.elasticity,
|
|
157
158
|
});
|
|
158
159
|
});
|
|
159
160
|
|
|
@@ -3,6 +3,7 @@ import { CalloutProps } from '../../lib/types/components';
|
|
|
3
3
|
import { useCallout } from '../../lib/composables/useCallout';
|
|
4
4
|
import { Icon } from '../Icon/Icon';
|
|
5
5
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
6
|
+
import { GLASS_DEFAULTS } from '../../lib/constants/components';
|
|
6
7
|
|
|
7
8
|
// Type-safe interface for compound component detection
|
|
8
9
|
type ExtendedComponentType<P = {}> = ComponentType<P> & {
|
|
@@ -176,11 +177,7 @@ const CalloutComponentBase = ({
|
|
|
176
177
|
|
|
177
178
|
if (glass) {
|
|
178
179
|
// Default glass settings for callouts
|
|
179
|
-
const defaultGlassProps =
|
|
180
|
-
displacementScale: 30,
|
|
181
|
-
borderRadius: 8,
|
|
182
|
-
elasticity: 0,
|
|
183
|
-
};
|
|
180
|
+
const defaultGlassProps = GLASS_DEFAULTS.CALLOUT;
|
|
184
181
|
|
|
185
182
|
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
186
183
|
|
|
@@ -10,7 +10,7 @@ import React, {
|
|
|
10
10
|
ReactNode,
|
|
11
11
|
ComponentType,
|
|
12
12
|
} from 'react';
|
|
13
|
-
import { DROPDOWN } from '../../lib/constants/components';
|
|
13
|
+
import { DROPDOWN, GLASS_DEFAULTS } from '../../lib/constants/components';
|
|
14
14
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
15
15
|
import type {
|
|
16
16
|
DropdownProps,
|
|
@@ -504,12 +504,8 @@ export const Dropdown: DropdownComponent = memo(function DropdownBase({
|
|
|
504
504
|
onKeyDown={handleKeyDown}
|
|
505
505
|
>
|
|
506
506
|
{glass
|
|
507
|
-
?
|
|
508
|
-
|
|
509
|
-
const defaultGlassProps = {
|
|
510
|
-
displacementScale: 20,
|
|
511
|
-
elasticity: 0,
|
|
512
|
-
};
|
|
507
|
+
? (() => {
|
|
508
|
+
const defaultGlassProps = GLASS_DEFAULTS.DROPDOWN;
|
|
513
509
|
|
|
514
510
|
const glassProps =
|
|
515
511
|
glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { memo, forwardRef, useRef, useEffect, useImperativeHandle } from 'react';
|
|
2
2
|
import { CheckboxProps } from '../../lib/types/components';
|
|
3
3
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
4
|
+
import { GLASS_DEFAULTS } from '../../lib/constants/components';
|
|
4
5
|
|
|
5
6
|
const CHECKBOX_CLASSES = {
|
|
6
7
|
BASE: 'c-checkbox',
|
|
@@ -112,14 +113,7 @@ export const Checkbox = React.memo(
|
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
if (glass) {
|
|
115
|
-
const defaultGlassProps =
|
|
116
|
-
displacementScale: 40,
|
|
117
|
-
blurAmount: 1,
|
|
118
|
-
saturation: 160,
|
|
119
|
-
aberrationIntensity: 0.3,
|
|
120
|
-
borderRadius: 6,
|
|
121
|
-
mode: 'shader' as const,
|
|
122
|
-
};
|
|
116
|
+
const defaultGlassProps = GLASS_DEFAULTS.CHECKBOX;
|
|
123
117
|
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
124
118
|
return <AtomixGlass {...glassProps}>{content}</AtomixGlass>;
|
|
125
119
|
}
|
|
@@ -2,6 +2,7 @@ import React, { forwardRef, memo } from 'react';
|
|
|
2
2
|
import { InputProps } from '../../lib/types/components';
|
|
3
3
|
import { useInput } from '../../lib/composables/useInput';
|
|
4
4
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
5
|
+
import { GLASS_DEFAULTS } from '../../lib/constants/components';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Input - A component for text input fields
|
|
@@ -95,15 +96,7 @@ export const Input = memo(
|
|
|
95
96
|
);
|
|
96
97
|
|
|
97
98
|
if (glass) {
|
|
98
|
-
|
|
99
|
-
const defaultGlassProps = {
|
|
100
|
-
displacementScale: 60,
|
|
101
|
-
blurAmount: 1,
|
|
102
|
-
saturation: 180,
|
|
103
|
-
aberrationIntensity: 0.2,
|
|
104
|
-
borderRadius: 12,
|
|
105
|
-
mode: 'shader' as const,
|
|
106
|
-
};
|
|
99
|
+
const defaultGlassProps = GLASS_DEFAULTS.INPUT;
|
|
107
100
|
|
|
108
101
|
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
109
102
|
|
|
@@ -2,6 +2,7 @@ import React, { memo } from 'react';
|
|
|
2
2
|
import { RadioProps } from '../../lib/types/components';
|
|
3
3
|
import { useRadio } from '../../lib/composables/useRadio';
|
|
4
4
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
5
|
+
import { GLASS_DEFAULTS } from '../../lib/constants/components';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Radio - A component for radio button inputs
|
|
@@ -62,15 +63,7 @@ export const Radio: React.FC<RadioProps> = memo(
|
|
|
62
63
|
);
|
|
63
64
|
|
|
64
65
|
if (glass) {
|
|
65
|
-
|
|
66
|
-
const defaultGlassProps = {
|
|
67
|
-
displacementScale: 40,
|
|
68
|
-
blurAmount: 1,
|
|
69
|
-
saturation: 160,
|
|
70
|
-
aberrationIntensity: 0.3,
|
|
71
|
-
borderRadius: 6,
|
|
72
|
-
mode: 'shader' as const,
|
|
73
|
-
};
|
|
66
|
+
const defaultGlassProps = GLASS_DEFAULTS.RADIO;
|
|
74
67
|
|
|
75
68
|
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
76
69
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useRef, useEffect, useState, memo, useCallback, useMemo } from 'react';
|
|
2
2
|
import { SelectProps, SelectOption as SelectOptionType } from '../../lib/types/components';
|
|
3
3
|
import { useSelect } from '../../lib/composables';
|
|
4
|
-
import { SELECT } from '../../lib/constants/components';
|
|
4
|
+
import { SELECT, GLASS_DEFAULTS } from '../../lib/constants/components';
|
|
5
5
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
6
6
|
import { SelectContext, SelectOption } from './SelectOption';
|
|
7
7
|
|
|
@@ -396,12 +396,7 @@ const SelectComponentBase = ({
|
|
|
396
396
|
);
|
|
397
397
|
|
|
398
398
|
if (glass) {
|
|
399
|
-
|
|
400
|
-
const defaultGlassProps = {
|
|
401
|
-
displacementScale: 60,
|
|
402
|
-
blurAmount: 10,
|
|
403
|
-
mode: 'shader' as const,
|
|
404
|
-
};
|
|
399
|
+
const defaultGlassProps = GLASS_DEFAULTS.SELECT;
|
|
405
400
|
|
|
406
401
|
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
407
402
|
|
|
@@ -2,6 +2,7 @@ import React, { forwardRef, memo } from 'react';
|
|
|
2
2
|
import { TextareaProps } from '../../lib/types/components';
|
|
3
3
|
import { useTextarea } from '../../lib/composables/useTextarea';
|
|
4
4
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
5
|
+
import { GLASS_DEFAULTS } from '../../lib/constants/components';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Textarea - A component for multiline text input
|
|
@@ -86,15 +87,7 @@ export const Textarea = memo(
|
|
|
86
87
|
);
|
|
87
88
|
|
|
88
89
|
if (glass) {
|
|
89
|
-
|
|
90
|
-
const defaultGlassProps = {
|
|
91
|
-
displacementScale: 60,
|
|
92
|
-
blurAmount: 1,
|
|
93
|
-
saturation: 180,
|
|
94
|
-
aberrationIntensity: 1,
|
|
95
|
-
borderRadius: 8,
|
|
96
|
-
mode: 'shader' as const,
|
|
97
|
-
};
|
|
90
|
+
const defaultGlassProps = GLASS_DEFAULTS.TEXTAREA;
|
|
98
91
|
|
|
99
92
|
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
100
93
|
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Icon } from '../Icon/Icon';
|
|
3
3
|
import { Avatar } from '../Avatar/Avatar';
|
|
4
4
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
5
|
-
import { MESSAGES } from '../../lib/constants/components';
|
|
5
|
+
import { MESSAGES, GLASS_DEFAULTS } from '../../lib/constants/components';
|
|
6
6
|
import { MessagesProps } from '../../lib/types/components';
|
|
7
7
|
import { useMessages } from '../../lib/composables/useMessages';
|
|
8
8
|
|
|
@@ -32,13 +32,7 @@ export const Messages: React.FC<MessagesProps> = ({
|
|
|
32
32
|
const messagesId = id || `messages-${Math.random().toString(36).substr(2, 9)}`;
|
|
33
33
|
const inputId = `${messagesId}-input`;
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
const defaultGlassProps = {
|
|
37
|
-
displacementScale: 150,
|
|
38
|
-
borderRadius: 12,
|
|
39
|
-
elasticity: 0,
|
|
40
|
-
aberrationIntensity: 2,
|
|
41
|
-
};
|
|
35
|
+
const defaultGlassProps = GLASS_DEFAULTS.MESSAGES;
|
|
42
36
|
|
|
43
37
|
const messagesClasses = `${MESSAGES.CLASSES.BASE} ${glass ? 'c-messages--glass' : ''} ${disabled ? 'is-disabled' : ''} ${className}`;
|
|
44
38
|
|
|
@@ -10,7 +10,7 @@ import React, {
|
|
|
10
10
|
ComponentType,
|
|
11
11
|
} from 'react';
|
|
12
12
|
import { ModalProps } from '../../lib/types/components';
|
|
13
|
-
import { MODAL } from '../../lib/constants/components';
|
|
13
|
+
import { MODAL, GLASS_DEFAULTS } from '../../lib/constants/components';
|
|
14
14
|
|
|
15
15
|
// Define ExtendedComponentType as a type alias instead of an interface to avoid TS2312 error
|
|
16
16
|
type ExtendedComponentType<P = {}> = ComponentType<P> & {
|
|
@@ -299,13 +299,12 @@ const ModalImpl = memo(
|
|
|
299
299
|
{glass
|
|
300
300
|
? // Default glass settings for modals
|
|
301
301
|
(() => {
|
|
302
|
+
// Default glass settings for modals
|
|
302
303
|
const defaultGlassProps = {
|
|
304
|
+
...GLASS_DEFAULTS.MODAL,
|
|
305
|
+
// displacementScale driven by modal content height at runtime
|
|
303
306
|
displacementScale: document.querySelector('.c-modal---glass .c-modal__content')
|
|
304
307
|
?.clientHeight,
|
|
305
|
-
blurAmount: 2.2,
|
|
306
|
-
elasticity: 0,
|
|
307
|
-
mode: 'shader' as const,
|
|
308
|
-
shaderMode: 'premiumGlass',
|
|
309
308
|
};
|
|
310
309
|
|
|
311
310
|
const glassProps =
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef } from 'react';
|
|
2
2
|
import { NavProps } from '../../../lib/types/components';
|
|
3
3
|
import { useNav } from '../../../lib/composables/useNavbar';
|
|
4
|
+
import { GLASS_DEFAULTS } from '../../../lib/constants/components';
|
|
4
5
|
import { AtomixGlass } from '../../AtomixGlass/AtomixGlass';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -48,12 +49,7 @@ export const Nav = forwardRef<HTMLUListElement, NavProps>(
|
|
|
48
49
|
);
|
|
49
50
|
|
|
50
51
|
if (glass) {
|
|
51
|
-
const defaultGlassProps =
|
|
52
|
-
displacementScale: 60,
|
|
53
|
-
blurAmount: 1.5,
|
|
54
|
-
borderRadius: 8,
|
|
55
|
-
mode: 'shader' as const,
|
|
56
|
-
};
|
|
52
|
+
const defaultGlassProps = GLASS_DEFAULTS.NAV;
|
|
57
53
|
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
58
54
|
return <AtomixGlass {...glassProps}>{navContent}</AtomixGlass>;
|
|
59
55
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState, useEffect, useRef, forwardRef } from 'react';
|
|
2
2
|
import { NavbarProps } from '../../../lib/types/components';
|
|
3
3
|
import { useNavbar } from '../../../lib/composables/useNavbar';
|
|
4
|
-
import { NAVBAR } from '../../../lib/constants/components';
|
|
4
|
+
import { NAVBAR, GLASS_DEFAULTS } from '../../../lib/constants/components';
|
|
5
5
|
import { AtomixGlass } from '../../AtomixGlass/AtomixGlass';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -187,14 +187,7 @@ export const Navbar = forwardRef<HTMLElement, NavbarProps>(
|
|
|
187
187
|
);
|
|
188
188
|
|
|
189
189
|
if (glass) {
|
|
190
|
-
const defaultGlassProps =
|
|
191
|
-
displacementScale: 30,
|
|
192
|
-
blurAmount: 2,
|
|
193
|
-
borderRadius: 0,
|
|
194
|
-
elasticity: 0,
|
|
195
|
-
mode: 'shader' as const,
|
|
196
|
-
shaderVariant: 'premiumGlass' as const,
|
|
197
|
-
};
|
|
190
|
+
const defaultGlassProps = GLASS_DEFAULTS.NAVBAR;
|
|
198
191
|
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
199
192
|
|
|
200
193
|
// AtomixGlass hoists layout props (position/top/left/right/zIndex) to its
|
|
@@ -6,6 +6,7 @@ import { AtomixGlass } from '../../AtomixGlass/AtomixGlass';
|
|
|
6
6
|
import useForkRef from '../../../lib/utils/useForkRef';
|
|
7
7
|
import SideMenuList from './SideMenuList';
|
|
8
8
|
import SideMenuItem from './SideMenuItem';
|
|
9
|
+
import { GLASS_DEFAULTS } from '../../../lib/constants/components';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* SideMenu component provides a collapsible navigation menu with title and menu items.
|
|
@@ -305,12 +306,7 @@ export const SideMenu = forwardRef<HTMLDivElement, SideMenuProps>(
|
|
|
305
306
|
);
|
|
306
307
|
|
|
307
308
|
if (glass) {
|
|
308
|
-
const defaultGlassProps =
|
|
309
|
-
displacementScale: 70,
|
|
310
|
-
blurAmount: 2,
|
|
311
|
-
borderRadius: 12,
|
|
312
|
-
mode: 'shader' as const,
|
|
313
|
-
};
|
|
309
|
+
const defaultGlassProps = GLASS_DEFAULTS.SIDE_MENU;
|
|
314
310
|
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
315
311
|
return (
|
|
316
312
|
<AtomixGlass {...glassProps}>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { memo, useState, FormEvent } from 'react';
|
|
2
2
|
import { PaginationProps } from '../../lib/types/components';
|
|
3
3
|
import { usePagination, DOTS } from '../../lib/composables/usePagination';
|
|
4
|
-
import { PAGINATION_DEFAULTS } from '../../lib/constants/components';
|
|
4
|
+
import { PAGINATION_DEFAULTS, GLASS_DEFAULTS } from '../../lib/constants/components';
|
|
5
5
|
import { Icon, IconProps } from '../Icon/Icon';
|
|
6
6
|
import { AtomixGlass } from '../AtomixGlass/AtomixGlass';
|
|
7
7
|
|
|
@@ -238,15 +238,7 @@ export const Pagination: React.FC<PaginationProps> = memo(
|
|
|
238
238
|
);
|
|
239
239
|
|
|
240
240
|
if (glass) {
|
|
241
|
-
|
|
242
|
-
const defaultGlassProps = {
|
|
243
|
-
displacementScale: 60,
|
|
244
|
-
blurAmount: 1,
|
|
245
|
-
saturation: 160,
|
|
246
|
-
aberrationIntensity: 0.5,
|
|
247
|
-
borderRadius: 8,
|
|
248
|
-
mode: 'shader' as const,
|
|
249
|
-
};
|
|
241
|
+
const defaultGlassProps = GLASS_DEFAULTS.PAGINATION;
|
|
250
242
|
|
|
251
243
|
const glassProps = glass === true ? defaultGlassProps : { ...defaultGlassProps, ...glass };
|
|
252
244
|
|