@shohojdhara/atomix 0.4.6 → 0.4.8
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 +61 -56
- 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 +93 -109
- package/dist/charts.js +141 -233
- package/dist/charts.js.map +1 -1
- package/dist/core.js +51 -46
- package/dist/core.js.map +1 -1
- package/dist/forms.js +51 -46
- package/dist/forms.js.map +1 -1
- package/dist/heavy.js +51 -46
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +6 -22
- package/dist/index.esm.js +141 -234
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +144 -237
- 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/scripts/atomix-cli.js +40 -1875
- package/scripts/cli/commands/build-theme.js +112 -0
- package/scripts/cli/commands/generate.js +97 -0
- package/scripts/cli/commands/init.js +46 -0
- package/scripts/cli/internal/compiler.js +114 -0
- package/scripts/cli/internal/filesystem.js +58 -0
- package/scripts/cli/internal/generator.js +110 -0
- package/scripts/cli/internal/wizard.js +61 -0
- package/scripts/cli/utils/error.js +47 -0
- package/scripts/cli/utils/helpers.js +43 -0
- package/scripts/cli/utils/logger.js +75 -0
- package/scripts/cli/utils/validation.js +71 -0
- package/src/components/AtomixGlass/AtomixGlass.test.tsx +37 -3
- package/src/components/AtomixGlass/AtomixGlass.tsx +41 -29
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +4 -19
- package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +216 -0
- package/src/components/Chart/BubbleChart.tsx +6 -2
- package/src/components/Chart/Chart.stories.tsx +108 -96
- package/src/components/Chart/ChartToolbar.tsx +6 -4
- package/src/components/Chart/ChartTooltip.tsx +5 -4
- package/src/components/Chart/GaugeChart.tsx +20 -12
- package/src/components/Chart/HeatmapChart.tsx +53 -23
- package/src/components/Chart/TreemapChart.tsx +44 -15
- package/src/components/Chart/index.ts +0 -2
- package/src/components/Chart/types.ts +4 -4
- package/src/components/index.ts +0 -1
- package/src/lib/composables/useAtomixGlass.ts +4 -1
- package/src/lib/composables/useAtomixGlassStyles.ts +9 -7
- package/src/lib/constants/components.ts +7 -7
- package/src/styles/01-settings/_settings.chart.scss +13 -13
- package/src/styles/06-components/_components.atomix-glass.scss +17 -21
- package/src/styles/06-components/_components.chart.scss +23 -5
- package/src/styles/06-components/_components.edge-panel.scss +1 -5
- package/src/styles/06-components/_components.modal.scss +1 -4
- package/src/styles/06-components/_components.navbar.scss +1 -1
- package/src/styles/06-components/_components.tooltip.scss +9 -5
- package/scripts/cli/component-generator.js +0 -564
- package/scripts/cli/interactive-init.js +0 -357
- package/scripts/cli/utils.js +0 -359
- package/src/components/Chart/AnimatedChart.tsx +0 -230
package/dist/core.js
CHANGED
|
@@ -554,20 +554,20 @@ const _includesInstanceProperty = getDefaultExportFromCjs((function(it) {
|
|
|
554
554
|
SHADER: "c-atomix-glass--shader"
|
|
555
555
|
},
|
|
556
556
|
DEFAULTS: {
|
|
557
|
-
DISPLACEMENT_SCALE:
|
|
558
|
-
BLUR_AMOUNT:
|
|
557
|
+
DISPLACEMENT_SCALE: 70,
|
|
558
|
+
BLUR_AMOUNT: 0,
|
|
559
559
|
SATURATION: 140,
|
|
560
|
-
ABERRATION_INTENSITY: 2
|
|
561
|
-
ELASTICITY: .
|
|
562
|
-
CORNER_RADIUS:
|
|
560
|
+
ABERRATION_INTENSITY: 2,
|
|
561
|
+
ELASTICITY: .15,
|
|
562
|
+
CORNER_RADIUS: 20,
|
|
563
563
|
// Default border-radius matching design system
|
|
564
|
-
PADDING: "0
|
|
564
|
+
PADDING: "0",
|
|
565
565
|
MODE: "standard",
|
|
566
566
|
OVER_LIGHT: !1,
|
|
567
567
|
ENABLE_OVER_LIGHT_LAYERS: !0
|
|
568
568
|
},
|
|
569
569
|
CONSTANTS: {
|
|
570
|
-
ACTIVATION_ZONE:
|
|
570
|
+
ACTIVATION_ZONE: 200,
|
|
571
571
|
LERP_FACTOR: .08,
|
|
572
572
|
SMOOTHSTEP_POWER: 2.5,
|
|
573
573
|
MIN_BLUR: .1,
|
|
@@ -975,10 +975,7 @@ let idCounter = 0;
|
|
|
975
975
|
const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({children: children, className: className = "", style: style, displacementScale: displacementScale = 25, blurAmount: blurAmount = .0625, saturation: saturation = 180, aberrationIntensity: aberrationIntensity = 2, mouseOffset: mouseOffset = {
|
|
976
976
|
x: 0,
|
|
977
977
|
y: 0
|
|
978
|
-
},
|
|
979
|
-
x: 0,
|
|
980
|
-
y: 0
|
|
981
|
-
}, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onMouseDown: onMouseDown, onMouseUp: onMouseUp, isHovered: isHovered = !1, isActive: isActive = !1, overLight: overLight = !1, overLightConfig: overLightConfig = {}, borderRadius: borderRadius = 0, padding: padding = "0 0", glassSize: glassSize = {
|
|
978
|
+
}, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onMouseDown: onMouseDown, onMouseUp: onMouseUp, isActive: isActive = !1, overLight: overLight = !1, overLightConfig: overLightConfig = {}, borderRadius: borderRadius = 0, padding: padding = "0 0", glassSize: glassSize = {
|
|
982
979
|
width: 0,
|
|
983
980
|
height: 0
|
|
984
981
|
}, onClick: onClick, mode: mode = "standard", effectiveWithoutEffects: effectiveWithoutEffects = !1, effectiveReducedMotion: effectiveReducedMotion = !1, shaderVariant: shaderVariant = "liquidGlass", withLiquidBlur: withLiquidBlur = !1, contentRef: contentRef}, ref) => {
|
|
@@ -1122,21 +1119,18 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
1122
1119
|
backdropFilter: `blur(${blurAmount}px) saturate(${saturation}%) contrast(1.05) brightness(1.05)`
|
|
1123
1120
|
};
|
|
1124
1121
|
}
|
|
1125
|
-
}), [ liquidBlur, saturation, blurAmount, rectCache, effectiveReducedMotion, effectiveWithoutEffects, withLiquidBlur ]), containerVars = useMemo((() => {
|
|
1122
|
+
}), [ liquidBlur, saturation, blurAmount, rectCache, effectiveReducedMotion, effectiveWithoutEffects, withLiquidBlur, overLightConfig ]), containerVars = useMemo((() => {
|
|
1126
1123
|
try {
|
|
1127
1124
|
// Safe extraction of mouse offset values
|
|
1128
1125
|
const mx = mouseOffset && "number" == typeof mouseOffset.x && !isNaN(mouseOffset.x) ? mouseOffset.x : 0, my = mouseOffset && "number" == typeof mouseOffset.y && !isNaN(mouseOffset.y) ? mouseOffset.y : 0;
|
|
1129
1126
|
return {
|
|
1130
|
-
"--atomix-glass-container-width": `${glassSize?.width}`,
|
|
1131
|
-
"--atomix-glass-container-height": `${glassSize?.height}`,
|
|
1132
|
-
"--atomix-glass-container-padding": padding || "0 0",
|
|
1133
1127
|
"--atomix-glass-container-radius": `${"number" != typeof borderRadius || isNaN(borderRadius) ? 0 : borderRadius}px`,
|
|
1134
1128
|
"--atomix-glass-container-backdrop": backdropStyle?.backdropFilter || "none",
|
|
1135
1129
|
"--atomix-glass-container-shadow": overLight ? [ `inset 0 1px 0 rgba(255, 255, 255, ${(.4 + .002 * mx) * (overLightConfig?.shadowIntensity || 1)})`, `inset 0 -1px 0 rgba(0, 0, 0, ${(.2 + .001 * Math.abs(my)) * (overLightConfig?.shadowIntensity || 1)})`, `inset 0 0 20px rgba(0, 0, 0, ${(.08 + .001 * Math.abs(mx + my)) * (overLightConfig?.shadowIntensity || 1)})`, `0 2px 12px rgba(0, 0, 0, ${(.12 + .002 * Math.abs(my)) * (overLightConfig?.shadowIntensity || 1)})` ].join(", ") : "0 0 20px rgba(0, 0, 0, 0.15) inset, 0 4px 8px rgba(0, 0, 0, 0.08) inset",
|
|
1136
1130
|
"--atomix-glass-container-shadow-opacity": effectiveWithoutEffects ? 0 : 1,
|
|
1137
1131
|
// Background and shadow values use design token-aligned RGB values
|
|
1138
1132
|
"--atomix-glass-container-bg": overLight ? `linear-gradient(${180 + .5 * mx}deg, rgba(255, 255, 255, 0.1) 0%, transparent 20%, transparent 80%, rgba(0, 0, 0, 0.05) 100%)` : "none",
|
|
1139
|
-
"--atomix-glass-container-text-shadow": overLight ? "0px 2px
|
|
1133
|
+
"--atomix-glass-container-text-shadow": overLight ? "0px 1px 2px rgba(255, 255, 255, 0.15)" : "0px 2px 12px rgba(0, 0, 0, 0.4)",
|
|
1140
1134
|
"--atomix-glass-container-box-shadow": overLight ? "0px 16px 70px rgba(0, 0, 0, 0.75)" : "0px 12px 40px rgba(0, 0, 0, 0.25)"
|
|
1141
1135
|
};
|
|
1142
1136
|
} catch (error) {
|
|
@@ -1151,7 +1145,7 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
1151
1145
|
"--atomix-glass-container-text-shadow": "none"
|
|
1152
1146
|
};
|
|
1153
1147
|
}
|
|
1154
|
-
}), [
|
|
1148
|
+
}), [ borderRadius, backdropStyle, mouseOffset, overLight, effectiveWithoutEffects, overLightConfig ]);
|
|
1155
1149
|
return jsx("div", {
|
|
1156
1150
|
ref: el => {
|
|
1157
1151
|
// Apply force no-transition
|
|
@@ -1180,10 +1174,6 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
1180
1174
|
aberrationIntensity: "number" != typeof aberrationIntensity || isNaN(aberrationIntensity) ? 0 : aberrationIntensity,
|
|
1181
1175
|
shaderMapUrl: shaderMapUrl
|
|
1182
1176
|
}), jsx("div", {
|
|
1183
|
-
ref: el => {
|
|
1184
|
-
el && (el.style.setProperty("transition-duration", "0s", "important"), el.style.setProperty("animation-duration", "0s", "important"),
|
|
1185
|
-
el.style.setProperty("transition-delay", "0s", "important"));
|
|
1186
|
-
},
|
|
1187
1177
|
className: ATOMIX_GLASS.FILTER_OVERLAY_CLASS,
|
|
1188
1178
|
style: {
|
|
1189
1179
|
filter: `url(#${filterId})`
|
|
@@ -1288,7 +1278,7 @@ class {
|
|
|
1288
1278
|
}
|
|
1289
1279
|
}, updateAtomixGlassStyles = (wrapperElement, containerElement, params) => {
|
|
1290
1280
|
if (!wrapperElement && !containerElement) return;
|
|
1291
|
-
const {mouseOffset: mouseOffset, globalMousePosition: globalMousePosition, glassSize: glassSize, isHovered: isHovered, isActive: isActive, isOverLight: isOverLight, baseOverLightConfig: baseOverLightConfig, effectiveBorderRadius: effectiveBorderRadius, effectiveWithoutEffects: effectiveWithoutEffects, effectiveReducedMotion: effectiveReducedMotion, elasticity: elasticity, directionalScale: directionalScale, onClick: onClick, withLiquidBlur: withLiquidBlur, blurAmount: blurAmount = ATOMIX_GLASS.DEFAULTS.BLUR_AMOUNT, saturation: saturation = ATOMIX_GLASS.DEFAULTS.SATURATION, padding: padding = ATOMIX_GLASS.DEFAULTS.PADDING} = params, mouseInfluence = calculateMouseInfluence(mouseOffset), hoverIntensity = isHovered ? 1.4 : 1, activeIntensity = isActive ? 1.6 : 1, overLightConfig = {
|
|
1281
|
+
const {mouseOffset: mouseOffset, globalMousePosition: globalMousePosition, glassSize: glassSize, isHovered: isHovered, isActive: isActive, isOverLight: isOverLight, baseOverLightConfig: baseOverLightConfig, effectiveBorderRadius: effectiveBorderRadius, effectiveWithoutEffects: effectiveWithoutEffects, effectiveReducedMotion: effectiveReducedMotion, elasticity: elasticity, directionalScale: directionalScale, onClick: onClick, withLiquidBlur: withLiquidBlur, blurAmount: blurAmount = ATOMIX_GLASS.DEFAULTS.BLUR_AMOUNT, saturation: saturation = ATOMIX_GLASS.DEFAULTS.SATURATION, padding: padding = ATOMIX_GLASS.DEFAULTS.PADDING, isFixedOrSticky: isFixedOrSticky = !1} = params, mouseInfluence = calculateMouseInfluence(mouseOffset), hoverIntensity = isHovered ? 1.4 : 1, activeIntensity = isActive ? 1.6 : 1, overLightConfig = {
|
|
1292
1282
|
opacity: baseOverLightConfig.opacity * hoverIntensity * activeIntensity,
|
|
1293
1283
|
contrast: Math.min(1.6, baseOverLightConfig.contrast + .1 * mouseInfluence),
|
|
1294
1284
|
brightness: Math.min(1.1, baseOverLightConfig.brightness + .05 * mouseInfluence),
|
|
@@ -1378,7 +1368,7 @@ class {
|
|
|
1378
1368
|
}
|
|
1379
1369
|
// Update Container Styles (containerVars)
|
|
1380
1370
|
if (containerElement) {
|
|
1381
|
-
const mx = mouseOffset.x, my = mouseOffset.y, EDGE_BLUR_MULTIPLIER =
|
|
1371
|
+
const mx = mouseOffset.x, my = mouseOffset.y, EDGE_BLUR_MULTIPLIER = .5, CENTER_BLUR_MULTIPLIER = .2, FLOW_BLUR_MULTIPLIER = .3, MOUSE_INFLUENCE_BLUR_FACTOR = .4, EDGE_INTENSITY_MOUSE_FACTOR = .15, CENTER_INTENSITY_MOUSE_FACTOR = .1, MAX_BLUR_RELATIVE = 2, rect = containerElement.getBoundingClientRect();
|
|
1382
1372
|
let liquidBlur = {
|
|
1383
1373
|
baseBlur: blurAmount,
|
|
1384
1374
|
edgeBlur: blurAmount * EDGE_BLUR_MULTIPLIER,
|
|
@@ -1400,14 +1390,15 @@ class {
|
|
|
1400
1390
|
backdropFilterString = !withLiquidBlur || effectiveReducedMotion || effectiveWithoutEffects || area > 18e4 ? `blur(${clampBlur(Math.max(liquidBlur.baseBlur, .8 * liquidBlur.edgeBlur, 1.1 * liquidBlur.centerBlur, .9 * liquidBlur.flowBlur))}px) saturate(${Math.min(dynamicSaturation, 200)}%) contrast(${overLightConfig.contrast}) brightness(${overLightConfig.brightness})` : `blur(${clampBlur(.4 * liquidBlur.baseBlur + .25 * liquidBlur.edgeBlur + .15 * liquidBlur.centerBlur + .2 * liquidBlur.flowBlur)}px) saturate(${Math.min(dynamicSaturation, 200)}%) contrast(${overLightConfig.contrast}) brightness(${overLightConfig.brightness})`;
|
|
1401
1391
|
// Container variables
|
|
1402
1392
|
const style = containerElement.style;
|
|
1403
|
-
style.setProperty("--atomix-glass-container-width", `${glassSize.width}`
|
|
1393
|
+
style.setProperty("--atomix-glass-container-width", isFixedOrSticky ? `${glassSize.width}` : "100%"),
|
|
1394
|
+
style.setProperty("--atomix-glass-container-height", isFixedOrSticky ? `${glassSize.height}` : "100%"),
|
|
1404
1395
|
style.setProperty("--atomix-glass-container-padding", padding), style.setProperty("--atomix-glass-container-radius", `${effectiveBorderRadius}px`),
|
|
1405
1396
|
style.setProperty("--atomix-glass-container-backdrop", backdropFilterString),
|
|
1406
1397
|
// Shadows
|
|
1407
1398
|
style.setProperty("--atomix-glass-container-shadow", isOverLight ? [ `inset 0 1px 0 rgba(255, 255, 255, ${(.4 + .002 * mx) * (overLightConfig.shadowIntensity || 1)})`, `inset 0 -1px 0 rgba(0, 0, 0, ${(.2 + .001 * Math.abs(my)) * (overLightConfig.shadowIntensity || 1)})`, `inset 0 0 20px rgba(0, 0, 0, ${(.08 + .001 * Math.abs(mx + my)) * (overLightConfig.shadowIntensity || 1)})`, `0 2px 12px rgba(0, 0, 0, ${(.12 + .002 * Math.abs(my)) * (overLightConfig.shadowIntensity || 1)})` ].join(", ") : "0 0 20px rgba(0, 0, 0, 0.15) inset, 0 4px 8px rgba(0, 0, 0, 0.08) inset"),
|
|
1408
1399
|
style.setProperty("--atomix-glass-container-shadow-opacity", effectiveWithoutEffects ? "0" : "1"),
|
|
1409
1400
|
style.setProperty("--atomix-glass-container-bg", isOverLight ? `linear-gradient(${180 + .5 * mx}deg, rgba(255, 255, 255, 0.1) 0%, transparent 20%, transparent 80%, rgba(0, 0, 0, 0.05) 100%)` : "none"),
|
|
1410
|
-
style.setProperty("--atomix-glass-container-text-shadow", isOverLight ? "0px 2px
|
|
1401
|
+
style.setProperty("--atomix-glass-container-text-shadow", isOverLight ? "0px 1px 2px rgba(255, 255, 255, 0.15)" : "0px 2px 12px rgba(0, 0, 0, 0.4)"),
|
|
1411
1402
|
style.setProperty("--atomix-glass-container-box-shadow", isOverLight ? "0px 16px 70px rgba(0, 0, 0, 0.75)" : "0px 12px 40px rgba(0, 0, 0, 0.25)");
|
|
1412
1403
|
}
|
|
1413
1404
|
}, {CONSTANTS: CONSTANTS$1} = ATOMIX_GLASS;
|
|
@@ -1428,7 +1419,7 @@ class {
|
|
|
1428
1419
|
* Composable hook for AtomixGlass component logic
|
|
1429
1420
|
* Manages all state, calculations, and event handlers
|
|
1430
1421
|
*/
|
|
1431
|
-
function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef: wrapperRef, borderRadius: borderRadius, globalMousePosition: externalGlobalMousePosition, mouseOffset: externalMouseOffset, mouseContainer: mouseContainer, overLight: overLight = ATOMIX_GLASS.DEFAULTS.OVER_LIGHT, reducedMotion: reducedMotion = !1, highContrast: highContrast = !1, withoutEffects: withoutEffects = !1, elasticity: elasticity = .05, onClick: onClick, debugBorderRadius: debugBorderRadius = !1, debugOverLight: debugOverLight = !1,
|
|
1422
|
+
function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef: wrapperRef, borderRadius: borderRadius, globalMousePosition: externalGlobalMousePosition, mouseOffset: externalMouseOffset, mouseContainer: mouseContainer, overLight: overLight = ATOMIX_GLASS.DEFAULTS.OVER_LIGHT, reducedMotion: reducedMotion = !1, highContrast: highContrast = !1, withoutEffects: withoutEffects = !1, elasticity: elasticity = .05, onClick: onClick, debugBorderRadius: debugBorderRadius = !1, debugOverLight: debugOverLight = !1, children: children, blurAmount: blurAmount, saturation: saturation, padding: padding, withLiquidBlur: withLiquidBlur, isFixedOrSticky: isFixedOrSticky = !1}) {
|
|
1432
1423
|
// State
|
|
1433
1424
|
const [isHovered, setIsHovered] = useState(!1), [isActive, setIsActive] = useState(!1), cachedRectRef = useRef(null), internalGlobalMousePositionRef = useRef({
|
|
1434
1425
|
x: 0,
|
|
@@ -1739,12 +1730,13 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1739
1730
|
withLiquidBlur: withLiquidBlur,
|
|
1740
1731
|
blurAmount: blurAmount,
|
|
1741
1732
|
saturation: saturation,
|
|
1742
|
-
padding: padding
|
|
1733
|
+
padding: padding,
|
|
1734
|
+
isFixedOrSticky: isFixedOrSticky
|
|
1743
1735
|
}), lerpRafRef.current = requestAnimationFrame(tick);
|
|
1744
1736
|
};
|
|
1745
1737
|
// 0.08 – lower = more viscous
|
|
1746
1738
|
lerpRafRef.current = requestAnimationFrame(tick);
|
|
1747
|
-
}), [ glassRef, wrapperRef, glassSize, isHovered, isActive, overLightConfig, effectiveBorderRadius, effectiveWithoutEffects, effectiveReducedMotion, elasticity, onClick, withLiquidBlur, blurAmount, saturation, padding ]), stopLerpLoop = useCallback((() => {
|
|
1739
|
+
}), [ glassRef, wrapperRef, glassSize, isHovered, isActive, overLightConfig, effectiveBorderRadius, effectiveWithoutEffects, effectiveReducedMotion, elasticity, onClick, withLiquidBlur, blurAmount, saturation, padding, isFixedOrSticky ]), stopLerpLoop = useCallback((() => {
|
|
1748
1740
|
lerpActiveRef.current = !1, null !== lerpRafRef.current && (cancelAnimationFrame(lerpRafRef.current),
|
|
1749
1741
|
lerpRafRef.current = null);
|
|
1750
1742
|
}), []);
|
|
@@ -1891,7 +1883,7 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1891
1883
|
* <div>Content with debug logging enabled</div>
|
|
1892
1884
|
* </AtomixGlass>
|
|
1893
1885
|
*/ function AtomixGlass({children: children, displacementScale: displacementScale = ATOMIX_GLASS.DEFAULTS.DISPLACEMENT_SCALE, blurAmount: blurAmount = ATOMIX_GLASS.DEFAULTS.BLUR_AMOUNT, saturation: saturation = ATOMIX_GLASS.DEFAULTS.SATURATION, aberrationIntensity: aberrationIntensity = ATOMIX_GLASS.DEFAULTS.ABERRATION_INTENSITY, elasticity: elasticity = ATOMIX_GLASS.DEFAULTS.ELASTICITY, borderRadius: borderRadius, globalMousePosition: externalGlobalMousePosition, mouseOffset: externalMouseOffset, mouseContainer: mouseContainer = null, className: className = "", padding: padding = ATOMIX_GLASS.DEFAULTS.PADDING, overLight: overLight = ATOMIX_GLASS.DEFAULTS.OVER_LIGHT, style: style = {}, mode: mode = ATOMIX_GLASS.DEFAULTS.MODE, onClick: onClick, shaderVariant: shaderVariant = "liquidGlass", "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, reducedMotion: reducedMotion = !1, highContrast: highContrast = !1, withoutEffects: withoutEffects = !1, withLiquidBlur: withLiquidBlur = !1, withBorder: withBorder = !0, withOverLightLayers: withOverLightLayers = ATOMIX_GLASS.DEFAULTS.ENABLE_OVER_LIGHT_LAYERS, debugPerformance: debugPerformance = !1, debugBorderRadius: debugBorderRadius = !1, debugOverLight: debugOverLight = !1, height: height, width: width, ...rest}) {
|
|
1894
|
-
const glassRef = useRef(null), contentRef = useRef(null), {isHovered: isHovered, isActive: isActive, glassSize: glassSize, effectiveBorderRadius: effectiveBorderRadius, effectiveReducedMotion: effectiveReducedMotion, effectiveHighContrast: effectiveHighContrast, effectiveWithoutEffects: effectiveWithoutEffects, overLightConfig: overLightConfig, globalMousePosition: globalMousePosition, mouseOffset: mouseOffset, transformStyle: transformStyle, handleMouseEnter: handleMouseEnter, handleMouseLeave: handleMouseLeave, handleMouseDown: handleMouseDown, handleMouseUp: handleMouseUp, handleKeyDown: handleKeyDown} = useAtomixGlass({
|
|
1886
|
+
const glassRef = useRef(null), contentRef = useRef(null), {zIndex: customZIndex, ...restStyle} = style, isFixedOrSticky = "fixed" === restStyle.position || "sticky" === restStyle.position, {isHovered: isHovered, isActive: isActive, glassSize: glassSize, effectiveBorderRadius: effectiveBorderRadius, effectiveReducedMotion: effectiveReducedMotion, effectiveHighContrast: effectiveHighContrast, effectiveWithoutEffects: effectiveWithoutEffects, overLightConfig: overLightConfig, globalMousePosition: globalMousePosition, mouseOffset: mouseOffset, transformStyle: transformStyle, handleMouseEnter: handleMouseEnter, handleMouseLeave: handleMouseLeave, handleMouseDown: handleMouseDown, handleMouseUp: handleMouseUp, handleKeyDown: handleKeyDown} = useAtomixGlass({
|
|
1895
1887
|
glassRef: glassRef,
|
|
1896
1888
|
contentRef: contentRef,
|
|
1897
1889
|
borderRadius: borderRadius,
|
|
@@ -1912,8 +1904,9 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1912
1904
|
saturation: saturation,
|
|
1913
1905
|
withLiquidBlur: withLiquidBlur,
|
|
1914
1906
|
padding: padding,
|
|
1915
|
-
style: style
|
|
1916
|
-
|
|
1907
|
+
style: style,
|
|
1908
|
+
isFixedOrSticky: isFixedOrSticky
|
|
1909
|
+
}), isOverLight = useMemo((() => overLightConfig.isOverLight), [ overLightConfig.isOverLight ]), shouldRenderOverLightLayers = withOverLightLayers && isOverLight, rootLayoutStyle = useMemo((() => {
|
|
1917
1910
|
if (!isFixedOrSticky) return {};
|
|
1918
1911
|
const {position: p, top: t, left: l, right: r, bottom: b} = restStyle;
|
|
1919
1912
|
return {
|
|
@@ -1933,7 +1926,10 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1933
1926
|
bottom: b
|
|
1934
1927
|
}
|
|
1935
1928
|
};
|
|
1936
|
-
}), [ isFixedOrSticky, restStyle ])
|
|
1929
|
+
}), [ isFixedOrSticky, restStyle ]);
|
|
1930
|
+
// Calculate base style with transforms
|
|
1931
|
+
// When layout is hoisted to the root, strip those props from the container
|
|
1932
|
+
useMemo((() => {
|
|
1937
1933
|
if (isFixedOrSticky) {
|
|
1938
1934
|
const {position: _p, top: _t, left: _l, right: _r, bottom: _b, ...visualStyle} = restStyle;
|
|
1939
1935
|
return {
|
|
@@ -1949,18 +1945,20 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1949
1945
|
transform: transformStyle
|
|
1950
1946
|
}
|
|
1951
1947
|
};
|
|
1952
|
-
}), [ isFixedOrSticky, restStyle, effectiveWithoutEffects, transformStyle ])
|
|
1948
|
+
}), [ isFixedOrSticky, restStyle, effectiveWithoutEffects, transformStyle ]);
|
|
1949
|
+
// Build className with state modifiers
|
|
1950
|
+
const componentClassName = [ ATOMIX_GLASS.BASE_CLASS, effectiveReducedMotion && `${ATOMIX_GLASS.BASE_CLASS}--reduced-motion`, effectiveHighContrast && `${ATOMIX_GLASS.BASE_CLASS}--high-contrast`, effectiveWithoutEffects && `${ATOMIX_GLASS.BASE_CLASS}--disabled-effects`, className ].filter(Boolean).join(" "), positionStyles = useMemo((() => ({
|
|
1953
1951
|
position: isFixedOrSticky ? "absolute" : restStyle.position || "absolute",
|
|
1954
1952
|
top: isFixedOrSticky ? 0 : restStyle.top || 0,
|
|
1955
1953
|
left: isFixedOrSticky ? 0 : restStyle.left || 0
|
|
1956
1954
|
})), [ isFixedOrSticky, restStyle.position, restStyle.top, restStyle.left ]), adjustedSize = useMemo((() => {
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
};
|
|
1955
|
+
// Keep a reference to positionStyles to avoid unused-variable lint,
|
|
1956
|
+
// but sizing is driven by explicit width/height or measured size.
|
|
1957
|
+
positionStyles.position;
|
|
1958
|
+
const resolveLength = (value, measured) => void 0 !== value ? "number" == typeof value ? `${value}px` : value : measured > 0 ? `${measured}px` : "100%", effectiveWidth = width ?? restStyle.width, effectiveHeight = height ?? restStyle.height;
|
|
1961
1959
|
return {
|
|
1962
|
-
width:
|
|
1963
|
-
height:
|
|
1960
|
+
width: resolveLength(effectiveWidth, glassSize.width),
|
|
1961
|
+
height: resolveLength(effectiveHeight, glassSize.height)
|
|
1964
1962
|
};
|
|
1965
1963
|
}), [ width, height, restStyle.width, restStyle.height, positionStyles.position, glassSize.width, glassSize.height ]), gradientValues = useMemo((() => {
|
|
1966
1964
|
const mx = mouseOffset.x, my = mouseOffset.y, absMx = Math.abs(mx), absMy = Math.abs(my), GRADIENT = ATOMIX_GLASS.CONSTANTS.GRADIENT;
|
|
@@ -2009,9 +2007,10 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
2009
2007
|
},
|
|
2010
2008
|
"--atomix-glass-radius": `${effectiveBorderRadius}px`,
|
|
2011
2009
|
"--atomix-glass-transform": transformStyle || "none",
|
|
2012
|
-
|
|
2013
|
-
"--atomix-glass-
|
|
2014
|
-
"--atomix-glass-
|
|
2010
|
+
// Internal decorative layers are positioned relative to the root;
|
|
2011
|
+
"--atomix-glass-position": rootLayoutStyle.position,
|
|
2012
|
+
"--atomix-glass-top": `${isFixedOrSticky ? rootLayoutStyle.top : 0}px`,
|
|
2013
|
+
"--atomix-glass-left": `${isFixedOrSticky ? rootLayoutStyle.left : 0}px`,
|
|
2015
2014
|
"--atomix-glass-width": adjustedSize.width,
|
|
2016
2015
|
"--atomix-glass-height": adjustedSize.height,
|
|
2017
2016
|
"--atomix-glass-border-width": "var(--atomix-spacing-0-5, 0.09375rem)",
|
|
@@ -2031,10 +2030,12 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
2031
2030
|
"--atomix-glass-overlay-highlight-opacity": opacityValues.over * ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.OPACITY_MULTIPLIER,
|
|
2032
2031
|
"--atomix-glass-overlay-highlight-bg": `radial-gradient(circle at ${ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.POSITION_X}% ${ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.POSITION_Y}%, rgba(255, 255, 255, ${ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.WHITE_OPACITY}) 0%, transparent ${ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.STOP}%)`
|
|
2033
2032
|
};
|
|
2034
|
-
}), [ gradientValues, opacityValues, effectiveBorderRadius, transformStyle,
|
|
2033
|
+
}), [ gradientValues, opacityValues, effectiveBorderRadius, transformStyle, adjustedSize, isOverLight, overLightConfig.borderOpacity, customZIndex, rootLayoutStyle, isFixedOrSticky ]), renderBackgroundLayer = layerType => jsx("div", {
|
|
2035
2034
|
className: [ ATOMIX_GLASS.BACKGROUND_LAYER_CLASS, "dark" === layerType ? ATOMIX_GLASS.BACKGROUND_LAYER_DARK_CLASS : ATOMIX_GLASS.BACKGROUND_LAYER_BLACK_CLASS, isOverLight ? ATOMIX_GLASS.BACKGROUND_LAYER_OVER_LIGHT_CLASS : ATOMIX_GLASS.BACKGROUND_LAYER_HIDDEN_CLASS ].filter(Boolean).join(" ")
|
|
2036
2035
|
});
|
|
2037
|
-
|
|
2036
|
+
// Calculate position and size styles for internal layers
|
|
2037
|
+
// When root is fixed/sticky, internal layers use absolute (relative to root)
|
|
2038
|
+
return jsxs("div", {
|
|
2038
2039
|
...rest,
|
|
2039
2040
|
className: componentClassName,
|
|
2040
2041
|
style: {
|
|
@@ -2051,7 +2052,12 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
2051
2052
|
ref: glassRef,
|
|
2052
2053
|
contentRef: contentRef,
|
|
2053
2054
|
className: className,
|
|
2054
|
-
style:
|
|
2055
|
+
style: {
|
|
2056
|
+
...restStyle,
|
|
2057
|
+
...!isFixedOrSticky && {
|
|
2058
|
+
position: "relative"
|
|
2059
|
+
}
|
|
2060
|
+
},
|
|
2055
2061
|
borderRadius: effectiveBorderRadius,
|
|
2056
2062
|
displacementScale: effectiveWithoutEffects ? 0 : "shader" === mode ? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.SHADER_DISPLACEMENT : isOverLight ? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.OVER_LIGHT_DISPLACEMENT : displacementScale,
|
|
2057
2063
|
blurAmount: effectiveWithoutEffects ? 0 : blurAmount,
|
|
@@ -2082,7 +2088,6 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
2082
2088
|
},
|
|
2083
2089
|
onClick: onClick,
|
|
2084
2090
|
mode: mode,
|
|
2085
|
-
transform: baseStyle.transform,
|
|
2086
2091
|
effectiveWithoutEffects: effectiveWithoutEffects,
|
|
2087
2092
|
effectiveReducedMotion: effectiveReducedMotion,
|
|
2088
2093
|
shaderVariant: shaderVariant,
|