@shohojdhara/atomix 0.4.0 → 0.4.2
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 +0 -14
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +4 -4
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.d.ts +12 -19
- package/dist/charts.js +555 -359
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +98 -28
- package/dist/core.js +1082 -733
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +26 -21
- package/dist/forms.js +937 -350
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +14 -21
- package/dist/heavy.js +409 -256
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +518 -284
- package/dist/index.esm.js +1993 -1237
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1994 -1237
- 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 +2 -2
- package/scripts/atomix-cli.js +43 -1
- package/scripts/cli/__tests__/utils.test.js +6 -2
- package/scripts/cli/migration-tools.js +2 -2
- package/scripts/cli/theme-bridge.js +7 -9
- package/scripts/cli/utils.js +2 -1
- package/src/components/Accordion/Accordion.stories.tsx +40 -0
- package/src/components/Accordion/Accordion.tsx +174 -56
- package/src/components/Accordion/AccordionCompound.test.tsx +70 -0
- package/src/components/AtomixGlass/AtomixGlass.tsx +82 -54
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +17 -18
- package/src/components/AtomixGlass/README.md +5 -5
- package/src/components/AtomixGlass/stories/Customization.stories.tsx +2 -2
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +42 -42
- package/src/components/AtomixGlass/stories/Modes.stories.tsx +5 -5
- package/src/components/AtomixGlass/stories/Overview.stories.tsx +3 -3
- package/src/components/AtomixGlass/stories/Performance.stories.tsx +2 -2
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +45 -45
- package/src/components/AtomixGlass/stories/Shaders.stories.tsx +3 -3
- package/src/components/Badge/Badge.stories.tsx +1 -1
- package/src/components/Badge/Badge.tsx +1 -1
- package/src/components/Breadcrumb/Breadcrumb.tsx +185 -65
- package/src/components/Breadcrumb/BreadcrumbCompound.test.tsx +84 -0
- package/src/components/Breadcrumb/index.ts +2 -2
- package/src/components/Button/Button.stories.tsx +1 -1
- package/src/components/Button/README.md +2 -2
- package/src/components/Callout/Callout.stories.tsx +166 -1011
- package/src/components/Callout/Callout.test.tsx +3 -3
- package/src/components/Callout/Callout.tsx +196 -84
- package/src/components/Callout/CalloutCompound.test.tsx +72 -0
- package/src/components/Callout/README.md +2 -2
- package/src/components/Chart/Chart.stories.tsx +1 -1
- package/src/components/Chart/Chart.tsx +5 -5
- package/src/components/Chart/TreemapChart.tsx +37 -29
- package/src/components/DatePicker/readme.md +3 -3
- package/src/components/Dropdown/Dropdown.stories.tsx +1 -1
- package/src/components/Dropdown/Dropdown.tsx +133 -20
- package/src/components/Dropdown/DropdownCompound.test.tsx +64 -0
- package/src/components/EdgePanel/EdgePanel.stories.tsx +7 -7
- package/src/components/EdgePanel/EdgePanel.tsx +164 -112
- package/src/components/EdgePanel/EdgePanelCompound.test.tsx +53 -0
- package/src/components/Form/Checkbox.stories.tsx +1 -1
- package/src/components/Form/Checkbox.tsx +1 -1
- package/src/components/Form/Input.stories.tsx +1 -1
- package/src/components/Form/Input.tsx +1 -1
- package/src/components/Form/Radio.stories.tsx +1 -1
- package/src/components/Form/Radio.tsx +1 -1
- package/src/components/Form/Select.stories.tsx +24 -1
- package/src/components/Form/Select.test.tsx +99 -0
- package/src/components/Form/Select.tsx +145 -94
- package/src/components/Form/SelectOption.tsx +88 -0
- package/src/components/Form/Textarea.stories.tsx +1 -1
- package/src/components/Form/Textarea.tsx +1 -1
- package/src/components/Hero/Hero.stories.tsx +39 -2
- package/src/components/Hero/Hero.test.tsx +142 -0
- package/src/components/Hero/Hero.tsx +143 -4
- package/src/components/List/List.test.tsx +62 -0
- package/src/components/List/List.tsx +16 -5
- package/src/components/List/ListItem.tsx +20 -0
- package/src/components/Messages/Messages.stories.tsx +1 -1
- package/src/components/Messages/Messages.tsx +2 -2
- package/src/components/Modal/Modal.stories.tsx +66 -2
- package/src/components/Modal/Modal.tsx +115 -35
- package/src/components/Modal/ModalCompound.test.tsx +94 -0
- package/src/components/Navigation/Nav/Nav.stories.tsx +2 -2
- package/src/components/Navigation/Nav/Nav.tsx +1 -1
- package/src/components/Navigation/Navbar/Navbar.stories.tsx +3 -3
- package/src/components/Navigation/Navbar/Navbar.tsx +1 -1
- package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +2 -2
- package/src/components/Navigation/SideMenu/SideMenu.tsx +1 -1
- package/src/components/Pagination/Pagination.stories.tsx +1 -1
- package/src/components/Pagination/Pagination.tsx +1 -1
- package/src/components/Popover/Popover.stories.tsx +1 -1
- package/src/components/Popover/Popover.tsx +1 -1
- package/src/components/Progress/Progress.tsx +1 -1
- package/src/components/Rating/Rating.stories.tsx +1 -1
- package/src/components/Rating/Rating.test.tsx +73 -0
- package/src/components/Rating/Rating.tsx +25 -37
- package/src/components/Spinner/Spinner.tsx +1 -1
- package/src/components/Steps/Steps.stories.tsx +1 -1
- package/src/components/Steps/Steps.tsx +125 -22
- package/src/components/Steps/StepsCompound.test.tsx +81 -0
- package/src/components/Tabs/Tabs.stories.tsx +1 -1
- package/src/components/Tabs/Tabs.tsx +198 -45
- package/src/components/Tabs/TabsCompound.test.tsx +64 -0
- package/src/components/Todo/Todo.tsx +0 -1
- package/src/components/Toggle/Toggle.stories.tsx +1 -1
- package/src/components/Toggle/Toggle.tsx +1 -1
- package/src/components/Tooltip/Tooltip.stories.tsx +1 -1
- package/src/components/VideoPlayer/VideoPlayer.stories.tsx +2 -2
- package/src/lib/composables/__tests__/useAtomixGlassPerf.test.tsx +88 -0
- package/src/lib/composables/__tests__/useChart.test.ts +50 -0
- package/src/lib/composables/__tests__/useChart.test.tsx +139 -0
- package/src/lib/composables/__tests__/useHeroBackgroundSlider.test.tsx +59 -0
- package/src/lib/composables/__tests__/useSliderAutoplay.test.tsx +68 -0
- package/src/lib/composables/atomix-glass/useGlassBackgroundDetection.ts +329 -0
- package/src/lib/composables/atomix-glass/useGlassCornerRadius.ts +82 -0
- package/src/lib/composables/atomix-glass/useGlassMouseTracking.ts +153 -0
- package/src/lib/composables/atomix-glass/useGlassOverLight.ts +198 -0
- package/src/lib/composables/atomix-glass/useGlassSize.ts +117 -0
- package/src/lib/composables/atomix-glass/useGlassState.ts +112 -0
- package/src/lib/composables/atomix-glass/useGlassTransforms.ts +160 -0
- package/src/lib/composables/glass-styles.ts +302 -0
- package/src/lib/composables/index.ts +0 -8
- package/src/lib/composables/useAtomixGlass.ts +331 -537
- package/src/lib/composables/useAtomixGlassStyles.ts +307 -0
- package/src/lib/composables/useBarChart.ts +1 -1
- package/src/lib/composables/useBreadcrumb.ts +6 -6
- package/src/lib/composables/useChart.ts +104 -21
- package/src/lib/composables/useHeroBackgroundSlider.ts +16 -7
- package/src/lib/composables/useSlider.ts +66 -34
- package/src/lib/theme/devtools/CLI.ts +2 -10
- package/src/lib/theme/utils/__tests__/themeUtils.test.ts +213 -0
- package/src/lib/types/components.ts +21 -23
- package/src/lib/utils/__tests__/componentUtils.test.ts +57 -2
- package/src/lib/utils/__tests__/dom.test.ts +100 -0
- package/src/lib/utils/__tests__/fontPreloader.test.ts +102 -0
- package/src/lib/utils/__tests__/themeNaming.test.ts +117 -0
- package/src/lib/utils/themeNaming.ts +1 -1
- package/src/styles/06-components/_components.accordion.scss +0 -2
- package/src/styles/06-components/_components.chart.scss +0 -1
- package/src/styles/06-components/_components.dropdown.scss +0 -1
- package/src/styles/06-components/_components.edge-panel.scss +0 -2
- package/src/styles/06-components/_components.photoviewer.scss +0 -1
- package/src/styles/06-components/_components.river.scss +0 -1
- package/src/styles/06-components/_components.slider.scss +0 -3
- package/src/styles/99-utilities/_utilities.glass-fixes.scss +0 -1
|
@@ -33,7 +33,7 @@ import { useAtomixGlass } from '../../lib/composables/useAtomixGlass';
|
|
|
33
33
|
*
|
|
34
34
|
* @example
|
|
35
35
|
* // Manual border-radius override
|
|
36
|
-
* <AtomixGlass
|
|
36
|
+
* <AtomixGlass borderRadius={20}>
|
|
37
37
|
* <div>Content with 20px glass radius</div>
|
|
38
38
|
* </AtomixGlass>
|
|
39
39
|
*
|
|
@@ -82,7 +82,7 @@ export function AtomixGlass({
|
|
|
82
82
|
saturation = ATOMIX_GLASS.DEFAULTS.SATURATION,
|
|
83
83
|
aberrationIntensity = ATOMIX_GLASS.DEFAULTS.ABERRATION_INTENSITY,
|
|
84
84
|
elasticity = ATOMIX_GLASS.DEFAULTS.ELASTICITY,
|
|
85
|
-
|
|
85
|
+
borderRadius,
|
|
86
86
|
globalMousePosition: externalGlobalMousePosition,
|
|
87
87
|
mouseOffset: externalMouseOffset,
|
|
88
88
|
mouseContainer = null,
|
|
@@ -99,13 +99,16 @@ export function AtomixGlass({
|
|
|
99
99
|
tabIndex,
|
|
100
100
|
reducedMotion = false,
|
|
101
101
|
highContrast = false,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
102
|
+
withoutEffects = false,
|
|
103
|
+
withLiquidBlur = false,
|
|
104
|
+
withBorder = true,
|
|
105
|
+
withOverLightLayers = ATOMIX_GLASS.DEFAULTS.ENABLE_OVER_LIGHT_LAYERS,
|
|
106
|
+
debugPerformance = false,
|
|
107
|
+
debugBorderRadius = false,
|
|
108
108
|
debugOverLight = false,
|
|
109
|
+
height,
|
|
110
|
+
width,
|
|
111
|
+
...rest
|
|
109
112
|
}: AtomixGlassProps) {
|
|
110
113
|
const glassRef = useRef<HTMLDivElement>(null);
|
|
111
114
|
const contentRef = useRef<HTMLDivElement>(null);
|
|
@@ -115,10 +118,10 @@ export function AtomixGlass({
|
|
|
115
118
|
isHovered,
|
|
116
119
|
isActive,
|
|
117
120
|
glassSize,
|
|
118
|
-
|
|
121
|
+
effectiveBorderRadius,
|
|
119
122
|
effectiveReducedMotion,
|
|
120
123
|
effectiveHighContrast,
|
|
121
|
-
|
|
124
|
+
effectiveWithoutEffects,
|
|
122
125
|
overLightConfig,
|
|
123
126
|
globalMousePosition,
|
|
124
127
|
mouseOffset,
|
|
@@ -131,32 +134,38 @@ export function AtomixGlass({
|
|
|
131
134
|
} = useAtomixGlass({
|
|
132
135
|
glassRef,
|
|
133
136
|
contentRef,
|
|
134
|
-
|
|
137
|
+
borderRadius,
|
|
135
138
|
globalMousePosition: externalGlobalMousePosition,
|
|
136
139
|
mouseOffset: externalMouseOffset,
|
|
137
140
|
mouseContainer,
|
|
138
141
|
overLight,
|
|
139
142
|
reducedMotion,
|
|
140
143
|
highContrast,
|
|
141
|
-
|
|
144
|
+
withoutEffects,
|
|
142
145
|
elasticity,
|
|
143
146
|
onClick,
|
|
144
|
-
|
|
147
|
+
debugBorderRadius,
|
|
145
148
|
debugOverLight,
|
|
146
|
-
|
|
149
|
+
debugPerformance,
|
|
147
150
|
children,
|
|
151
|
+
blurAmount,
|
|
152
|
+
saturation,
|
|
153
|
+
withLiquidBlur,
|
|
154
|
+
padding,
|
|
155
|
+
style,
|
|
148
156
|
});
|
|
149
157
|
|
|
150
158
|
// Calculate isOverLight independently from overLightConfig to prevent displacement changes on hover
|
|
151
159
|
// overLightConfig recalculates with hover/active states, but displacement should remain stable
|
|
160
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
152
161
|
const isOverLight = useMemo(() => overLightConfig?.isOverLight, [overLight]);
|
|
153
162
|
|
|
154
|
-
const shouldRenderOverLightLayers =
|
|
163
|
+
const shouldRenderOverLightLayers = withOverLightLayers && isOverLight;
|
|
155
164
|
|
|
156
165
|
// Calculate base style with transforms
|
|
157
166
|
const baseStyle = {
|
|
158
167
|
...style,
|
|
159
|
-
...(!
|
|
168
|
+
...(!effectiveWithoutEffects && {
|
|
160
169
|
transform: transformStyle,
|
|
161
170
|
}),
|
|
162
171
|
};
|
|
@@ -166,7 +175,7 @@ export function AtomixGlass({
|
|
|
166
175
|
ATOMIX_GLASS.BASE_CLASS,
|
|
167
176
|
effectiveReducedMotion && `${ATOMIX_GLASS.BASE_CLASS}--reduced-motion`,
|
|
168
177
|
effectiveHighContrast && `${ATOMIX_GLASS.BASE_CLASS}--high-contrast`,
|
|
169
|
-
|
|
178
|
+
effectiveWithoutEffects && `${ATOMIX_GLASS.BASE_CLASS}--disabled-effects`,
|
|
170
179
|
className,
|
|
171
180
|
]
|
|
172
181
|
.filter(Boolean)
|
|
@@ -182,23 +191,32 @@ export function AtomixGlass({
|
|
|
182
191
|
[style.position, style.top, style.left]
|
|
183
192
|
);
|
|
184
193
|
|
|
185
|
-
const adjustedSize = useMemo(
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
194
|
+
const adjustedSize = useMemo(() => {
|
|
195
|
+
const resolveSize = (
|
|
196
|
+
propValue: string | number | undefined,
|
|
197
|
+
styleValue: string | number | undefined,
|
|
198
|
+
measuredSize: number
|
|
199
|
+
) => {
|
|
200
|
+
const explicitSize = propValue ?? styleValue;
|
|
201
|
+
if (explicitSize !== undefined) {
|
|
202
|
+
return typeof explicitSize === 'number' ? `${explicitSize}px` : explicitSize;
|
|
203
|
+
}
|
|
204
|
+
return positionStyles.position === 'fixed' ? `${Math.max(measuredSize, 0)}px` : '100%';
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
return {
|
|
208
|
+
width: resolveSize(width, style.width, glassSize.width),
|
|
209
|
+
height: resolveSize(height, style.height, glassSize.height),
|
|
210
|
+
};
|
|
211
|
+
}, [
|
|
212
|
+
width,
|
|
213
|
+
height,
|
|
214
|
+
style.width,
|
|
215
|
+
style.height,
|
|
216
|
+
positionStyles.position,
|
|
217
|
+
glassSize.width,
|
|
218
|
+
glassSize.height,
|
|
219
|
+
]);
|
|
202
220
|
|
|
203
221
|
// Memoize expensive gradient calculations
|
|
204
222
|
const gradientValues = useMemo(() => {
|
|
@@ -286,15 +304,13 @@ export function AtomixGlass({
|
|
|
286
304
|
const configBorderOpacity = overLightConfig?.borderOpacity ?? 1;
|
|
287
305
|
|
|
288
306
|
return {
|
|
289
|
-
'--atomix-glass-radius': `${
|
|
307
|
+
'--atomix-glass-radius': `${effectiveBorderRadius}px`,
|
|
290
308
|
'--atomix-glass-transform': transformStyle || 'none',
|
|
291
309
|
'--atomix-glass-position': positionStyles.position,
|
|
292
310
|
'--atomix-glass-top': positionStyles.top !== 'fixed' ? `${positionStyles.top}px` : '0',
|
|
293
311
|
'--atomix-glass-left': positionStyles.left !== 'fixed' ? `${positionStyles.left}px` : '0',
|
|
294
|
-
'--atomix-glass-width':
|
|
295
|
-
|
|
296
|
-
'--atomix-glass-height':
|
|
297
|
-
style.position !== 'fixed' ? adjustedSize.height : `${adjustedSize.height}px`,
|
|
312
|
+
'--atomix-glass-width': adjustedSize.width,
|
|
313
|
+
'--atomix-glass-height': adjustedSize.height,
|
|
298
314
|
'--atomix-glass-border-width': 'var(--atomix-spacing-0-5, 0.09375rem)',
|
|
299
315
|
'--atomix-glass-blend-mode': isOverLight ? 'multiply' : 'overlay',
|
|
300
316
|
'--atomix-glass-border-gradient-1': `linear-gradient(${borderGradientAngle}deg, rgba(${whiteColor}, 0) 0%, rgba(${whiteColor}, ${(borderOpacities[0] ?? 1) * configBorderOpacity}) ${borderStop1}%, rgba(${whiteColor}, ${(borderOpacities[1] ?? 1) * configBorderOpacity}) ${borderStop2}%, rgba(${whiteColor}, 0) 100%)`,
|
|
@@ -323,11 +339,10 @@ export function AtomixGlass({
|
|
|
323
339
|
}, [
|
|
324
340
|
gradientValues,
|
|
325
341
|
opacityValues,
|
|
326
|
-
|
|
342
|
+
effectiveBorderRadius,
|
|
327
343
|
transformStyle,
|
|
328
344
|
positionStyles,
|
|
329
345
|
adjustedSize,
|
|
330
|
-
style.position,
|
|
331
346
|
isOverLight,
|
|
332
347
|
overLightConfig.borderOpacity,
|
|
333
348
|
]);
|
|
@@ -350,7 +365,7 @@ export function AtomixGlass({
|
|
|
350
365
|
...positionStyles,
|
|
351
366
|
height: adjustedSize.height,
|
|
352
367
|
width: adjustedSize.width,
|
|
353
|
-
borderRadius: `${
|
|
368
|
+
borderRadius: `${effectiveBorderRadius}px`,
|
|
354
369
|
transform: baseStyle.transform,
|
|
355
370
|
}}
|
|
356
371
|
/>
|
|
@@ -358,13 +373,14 @@ export function AtomixGlass({
|
|
|
358
373
|
|
|
359
374
|
return (
|
|
360
375
|
<div
|
|
376
|
+
{...rest}
|
|
361
377
|
className={componentClassName}
|
|
362
378
|
style={glassVars}
|
|
363
379
|
role={role || (onClick ? 'button' : undefined)}
|
|
364
380
|
tabIndex={onClick ? (tabIndex ?? 0) : tabIndex}
|
|
365
381
|
aria-label={ariaLabel}
|
|
366
382
|
aria-describedby={ariaDescribedBy}
|
|
367
|
-
aria-disabled={onClick &&
|
|
383
|
+
aria-disabled={onClick && effectiveWithoutEffects ? true : onClick ? false : undefined}
|
|
368
384
|
aria-pressed={onClick && isActive ? true : onClick ? false : undefined}
|
|
369
385
|
onKeyDown={onClick ? handleKeyDown : undefined} // Dynamic CSS variables cause hydration mismatch due to mouse position calculations
|
|
370
386
|
>
|
|
@@ -373,9 +389,9 @@ export function AtomixGlass({
|
|
|
373
389
|
contentRef={contentRef}
|
|
374
390
|
className={className}
|
|
375
391
|
style={baseStyle}
|
|
376
|
-
|
|
392
|
+
borderRadius={effectiveBorderRadius}
|
|
377
393
|
displacementScale={
|
|
378
|
-
|
|
394
|
+
effectiveWithoutEffects
|
|
379
395
|
? 0
|
|
380
396
|
: mode === 'shader'
|
|
381
397
|
? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.SHADER_DISPLACEMENT
|
|
@@ -383,7 +399,7 @@ export function AtomixGlass({
|
|
|
383
399
|
? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.OVER_LIGHT_DISPLACEMENT
|
|
384
400
|
: displacementScale
|
|
385
401
|
}
|
|
386
|
-
blurAmount={
|
|
402
|
+
blurAmount={effectiveWithoutEffects ? 0 : blurAmount}
|
|
387
403
|
saturation={
|
|
388
404
|
effectiveHighContrast
|
|
389
405
|
? ATOMIX_GLASS.CONSTANTS.SATURATION.HIGH_CONTRAST
|
|
@@ -392,7 +408,7 @@ export function AtomixGlass({
|
|
|
392
408
|
: saturation
|
|
393
409
|
}
|
|
394
410
|
aberrationIntensity={
|
|
395
|
-
|
|
411
|
+
effectiveWithoutEffects
|
|
396
412
|
? 0
|
|
397
413
|
: mode === 'shader'
|
|
398
414
|
? aberrationIntensity * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.SHADER_ABERRATION
|
|
@@ -400,8 +416,8 @@ export function AtomixGlass({
|
|
|
400
416
|
}
|
|
401
417
|
glassSize={glassSize}
|
|
402
418
|
padding={padding}
|
|
403
|
-
mouseOffset={
|
|
404
|
-
globalMousePosition={
|
|
419
|
+
mouseOffset={effectiveWithoutEffects ? { x: 0, y: 0 } : mouseOffset}
|
|
420
|
+
globalMousePosition={effectiveWithoutEffects ? { x: 0, y: 0 } : globalMousePosition}
|
|
405
421
|
onMouseEnter={handleMouseEnter}
|
|
406
422
|
onMouseLeave={handleMouseLeave}
|
|
407
423
|
onMouseDown={handleMouseDown}
|
|
@@ -418,11 +434,11 @@ export function AtomixGlass({
|
|
|
418
434
|
onClick={onClick}
|
|
419
435
|
mode={mode}
|
|
420
436
|
transform={baseStyle.transform}
|
|
421
|
-
|
|
437
|
+
effectiveWithoutEffects={effectiveWithoutEffects}
|
|
422
438
|
effectiveReducedMotion={effectiveReducedMotion}
|
|
423
439
|
shaderVariant={shaderVariant}
|
|
424
440
|
elasticity={elasticity}
|
|
425
|
-
|
|
441
|
+
withLiquidBlur={withLiquidBlur}
|
|
426
442
|
>
|
|
427
443
|
{children}
|
|
428
444
|
</AtomixGlassContainer>
|
|
@@ -455,12 +471,24 @@ export function AtomixGlass({
|
|
|
455
471
|
/>
|
|
456
472
|
</>
|
|
457
473
|
)}
|
|
458
|
-
{
|
|
474
|
+
{withBorder && (
|
|
459
475
|
<>
|
|
460
476
|
{/* Border elements - all styles (static and dynamic via CSS variables) are in SCSS */}
|
|
461
477
|
{/* Position, size, transform, transition, border-radius all use CSS variables set in glassVars */}
|
|
462
|
-
<span
|
|
463
|
-
|
|
478
|
+
<span
|
|
479
|
+
className={ATOMIX_GLASS.BORDER_1_CLASS}
|
|
480
|
+
style={{
|
|
481
|
+
width: glassSize.width,
|
|
482
|
+
height: glassSize.height,
|
|
483
|
+
}}
|
|
484
|
+
/>
|
|
485
|
+
<span
|
|
486
|
+
className={ATOMIX_GLASS.BORDER_2_CLASS}
|
|
487
|
+
style={{
|
|
488
|
+
width: glassSize.width,
|
|
489
|
+
height: glassSize.height,
|
|
490
|
+
}}
|
|
491
|
+
/>
|
|
464
492
|
</>
|
|
465
493
|
)}
|
|
466
494
|
</div>
|
|
@@ -81,16 +81,16 @@ interface AtomixGlassContainerProps {
|
|
|
81
81
|
shadowIntensity?: number;
|
|
82
82
|
borderOpacity?: number;
|
|
83
83
|
};
|
|
84
|
-
|
|
84
|
+
borderRadius?: number;
|
|
85
85
|
padding?: string;
|
|
86
86
|
glassSize?: GlassSize;
|
|
87
87
|
onClick?: () => void;
|
|
88
88
|
mode?: DisplacementMode;
|
|
89
89
|
transform?: string;
|
|
90
|
-
|
|
90
|
+
effectiveWithoutEffects?: boolean;
|
|
91
91
|
effectiveReducedMotion?: boolean;
|
|
92
92
|
shaderVariant?: FragmentShaderType;
|
|
93
|
-
|
|
93
|
+
withLiquidBlur?: boolean;
|
|
94
94
|
elasticity?: number;
|
|
95
95
|
contentRef?: React.RefObject<HTMLDivElement>;
|
|
96
96
|
children?: React.ReactNode;
|
|
@@ -120,15 +120,15 @@ export const AtomixGlassContainer = forwardRef<HTMLDivElement, AtomixGlassContai
|
|
|
120
120
|
isActive = false,
|
|
121
121
|
overLight = false,
|
|
122
122
|
overLightConfig = {},
|
|
123
|
-
|
|
123
|
+
borderRadius = 0,
|
|
124
124
|
padding = '0 0',
|
|
125
125
|
glassSize = { width: 0, height: 0 },
|
|
126
126
|
onClick,
|
|
127
127
|
mode = 'standard',
|
|
128
|
-
|
|
128
|
+
effectiveWithoutEffects = false,
|
|
129
129
|
effectiveReducedMotion = false,
|
|
130
130
|
shaderVariant = 'liquidGlass',
|
|
131
|
-
|
|
131
|
+
withLiquidBlur = false,
|
|
132
132
|
elasticity = 0,
|
|
133
133
|
contentRef,
|
|
134
134
|
},
|
|
@@ -291,7 +291,7 @@ export const AtomixGlassContainer = forwardRef<HTMLDivElement, AtomixGlassContai
|
|
|
291
291
|
|
|
292
292
|
// Enhanced validation for liquid blur
|
|
293
293
|
if (
|
|
294
|
-
!
|
|
294
|
+
!withLiquidBlur ||
|
|
295
295
|
!rectCache ||
|
|
296
296
|
!mouseOffset ||
|
|
297
297
|
typeof mouseOffset.x !== 'number' ||
|
|
@@ -328,7 +328,7 @@ export const AtomixGlassContainer = forwardRef<HTMLDivElement, AtomixGlassContai
|
|
|
328
328
|
console.warn('AtomixGlassContainer: Error calculating liquid blur', error);
|
|
329
329
|
return defaultBlur;
|
|
330
330
|
}
|
|
331
|
-
}, [
|
|
331
|
+
}, [withLiquidBlur, blurAmount, mouseOffset, rectCache]);
|
|
332
332
|
|
|
333
333
|
const backdropStyle = useMemo(() => {
|
|
334
334
|
try {
|
|
@@ -355,8 +355,8 @@ export const AtomixGlassContainer = forwardRef<HTMLDivElement, AtomixGlassContai
|
|
|
355
355
|
// Adaptive strategy: prefer single-pass blur for large areas or when effects are reduced
|
|
356
356
|
const area = rectCache ? rectCache.width * rectCache.height : 0;
|
|
357
357
|
const areaIsLarge = area > 180000; // ~600x300 threshold; tune as needed
|
|
358
|
-
const devicePrefersPerformance = effectiveReducedMotion ||
|
|
359
|
-
const useMultiPass =
|
|
358
|
+
const devicePrefersPerformance = effectiveReducedMotion || effectiveWithoutEffects;
|
|
359
|
+
const useMultiPass = withLiquidBlur && !devicePrefersPerformance && !areaIsLarge;
|
|
360
360
|
|
|
361
361
|
if (useMultiPass) {
|
|
362
362
|
// Use a single weighted-average blur instead of stacking multiple
|
|
@@ -370,7 +370,7 @@ export const AtomixGlassContainer = forwardRef<HTMLDivElement, AtomixGlassContai
|
|
|
370
370
|
);
|
|
371
371
|
|
|
372
372
|
return {
|
|
373
|
-
backdropFilter: `blur(${weightedBlur}px) saturate(${Math.min(dynamicSaturation, 200)}%) contrast(${overLightConfig?.contrast || 1
|
|
373
|
+
backdropFilter: `blur(${weightedBlur}px) saturate(${Math.min(dynamicSaturation, 200)}%) contrast(${overLightConfig?.contrast || 1}) brightness(${overLightConfig?.brightness || 1})`,
|
|
374
374
|
};
|
|
375
375
|
}
|
|
376
376
|
|
|
@@ -399,8 +399,8 @@ export const AtomixGlassContainer = forwardRef<HTMLDivElement, AtomixGlassContai
|
|
|
399
399
|
blurAmount,
|
|
400
400
|
rectCache,
|
|
401
401
|
effectiveReducedMotion,
|
|
402
|
-
|
|
403
|
-
|
|
402
|
+
effectiveWithoutEffects,
|
|
403
|
+
withLiquidBlur,
|
|
404
404
|
]);
|
|
405
405
|
|
|
406
406
|
const containerVars = useMemo(() => {
|
|
@@ -418,7 +418,7 @@ export const AtomixGlassContainer = forwardRef<HTMLDivElement, AtomixGlassContai
|
|
|
418
418
|
'--atomix-glass-container-width': `${glassSize?.width}`,
|
|
419
419
|
'--atomix-glass-container-height': `${glassSize?.height}`,
|
|
420
420
|
'--atomix-glass-container-padding': padding || '0 0',
|
|
421
|
-
'--atomix-glass-container-radius': `${typeof
|
|
421
|
+
'--atomix-glass-container-radius': `${typeof borderRadius === 'number' && !isNaN(borderRadius) ? borderRadius : 0}px`,
|
|
422
422
|
'--atomix-glass-container-backdrop': backdropStyle?.backdropFilter || 'none',
|
|
423
423
|
'--atomix-glass-container-shadow': overLight
|
|
424
424
|
? [
|
|
@@ -428,7 +428,7 @@ export const AtomixGlassContainer = forwardRef<HTMLDivElement, AtomixGlassContai
|
|
|
428
428
|
`0 2px 12px rgba(0, 0, 0, ${(0.12 + Math.abs(my) * 0.002) * (overLightConfig?.shadowIntensity || 1)})`,
|
|
429
429
|
].join(', ')
|
|
430
430
|
: '0 0 20px rgba(0, 0, 0, 0.15) inset, 0 4px 8px rgba(0, 0, 0, 0.08) inset',
|
|
431
|
-
'--atomix-glass-container-shadow-opacity':
|
|
431
|
+
'--atomix-glass-container-shadow-opacity': effectiveWithoutEffects ? 0 : 1,
|
|
432
432
|
// Background and shadow values use design token-aligned RGB values
|
|
433
433
|
'--atomix-glass-container-bg': overLight
|
|
434
434
|
? `linear-gradient(${180 + mx * 0.5}deg, rgba(255, 255, 255, 0.1) 0%, transparent 20%, transparent 80%, rgba(0, 0, 0, 0.05) 100%)`
|
|
@@ -455,11 +455,11 @@ export const AtomixGlassContainer = forwardRef<HTMLDivElement, AtomixGlassContai
|
|
|
455
455
|
}, [
|
|
456
456
|
glassSize,
|
|
457
457
|
padding,
|
|
458
|
-
|
|
458
|
+
borderRadius,
|
|
459
459
|
backdropStyle,
|
|
460
460
|
mouseOffset,
|
|
461
461
|
overLight,
|
|
462
|
-
|
|
462
|
+
effectiveWithoutEffects,
|
|
463
463
|
]);
|
|
464
464
|
|
|
465
465
|
// Helper to force no transition/animation overrides with !important
|
|
@@ -475,7 +475,6 @@ export const AtomixGlassContainer = forwardRef<HTMLDivElement, AtomixGlassContai
|
|
|
475
475
|
<div
|
|
476
476
|
ref={el => {
|
|
477
477
|
// Apply force no-transition
|
|
478
|
-
setForceNoTransition(el);
|
|
479
478
|
|
|
480
479
|
// Handle forwarded ref
|
|
481
480
|
if (typeof ref === 'function') {
|
|
@@ -27,7 +27,7 @@ function MyComponent() {
|
|
|
27
27
|
<AtomixGlass
|
|
28
28
|
displacementScale={20}
|
|
29
29
|
blurAmount={10}
|
|
30
|
-
|
|
30
|
+
borderRadius={15}
|
|
31
31
|
>
|
|
32
32
|
<div>Your content here</div>
|
|
33
33
|
</AtomixGlass>
|
|
@@ -45,14 +45,14 @@ function MyComponent() {
|
|
|
45
45
|
| `saturation` | number | 150 | Controls the color saturation (100 is normal) |
|
|
46
46
|
| `aberrationIntensity` | number | 1.5 | Controls the chromatic aberration effect intensity |
|
|
47
47
|
| `elasticity` | number | 0.5 | Controls how responsive the glass is to mouse movement |
|
|
48
|
-
| `
|
|
48
|
+
| `borderRadius` | number | 15 | Border radius of the glass container |
|
|
49
49
|
| `globalMousePos` | boolean | false | Whether to use global mouse position instead of local |
|
|
50
50
|
| `mouseOffset` | { x: number, y: number } | { x: 0, y: 0 } | Offset for mouse position calculation |
|
|
51
51
|
| `mouseContainer` | RefObject<HTMLElement> | null | Container to use for mouse position calculation |
|
|
52
52
|
| `padding` | number | 0 | Additional padding around the content |
|
|
53
53
|
| `style` | CSSProperties | {} | Additional CSS styles |
|
|
54
54
|
| `overLight` | boolean \| 'auto' \| OverLightObjectConfig | 'auto' | OverLight configuration. See [OverLight Configuration](#overlight-configuration) section for details |
|
|
55
|
-
| `
|
|
55
|
+
| `withOverLightLayers` | boolean | true | Whether to render additional overlay layers for overLight mode |
|
|
56
56
|
| `debugOverLight` | boolean | false | Enable debug logging for overLight detection and configuration |
|
|
57
57
|
| `mode` | 'standard' \| 'polar' \| 'prominent' \| 'shader' | 'standard' | The glass effect mode |
|
|
58
58
|
| `onClick` | function | undefined | Click handler |
|
|
@@ -218,8 +218,8 @@ This logs to console:
|
|
|
218
218
|
- Use object config to fine-tune detection sensitivity and visual effects
|
|
219
219
|
- Enable `debugOverLight` when troubleshooting auto-detection issues
|
|
220
220
|
- Test glass effects across different devices and screen sizes
|
|
221
|
-
- Use appropriate `
|
|
222
|
-
- Consider disabling `
|
|
221
|
+
- Use appropriate `borderRadius` values to match your design language
|
|
222
|
+
- Consider disabling `withOverLightLayers` for performance optimization
|
|
223
223
|
|
|
224
224
|
## Customization
|
|
225
225
|
|
|
@@ -53,7 +53,7 @@ export const WithCustomStyling: Story = {
|
|
|
53
53
|
blurAmount: 0.4,
|
|
54
54
|
saturation: 160,
|
|
55
55
|
aberrationIntensity: 1.8,
|
|
56
|
-
|
|
56
|
+
borderRadius: 30,
|
|
57
57
|
padding: '40px',
|
|
58
58
|
style: {
|
|
59
59
|
width: '100%',
|
|
@@ -99,7 +99,7 @@ export const WithOtherComponents: Story = {
|
|
|
99
99
|
saturation={170}
|
|
100
100
|
aberrationIntensity={2.2}
|
|
101
101
|
elasticity={0.18}
|
|
102
|
-
|
|
102
|
+
borderRadius={28}
|
|
103
103
|
padding="36px"
|
|
104
104
|
className="u-w-11/12 u-max-w-2xl"
|
|
105
105
|
>
|