@shohojdhara/atomix 0.4.8 → 0.4.9
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/atomix.config.ts +58 -1
- package/dist/atomix.css +148 -120
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +1 -1
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.d.ts +33 -0
- package/dist/charts.js +1227 -122
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +33 -10
- package/dist/core.js +1052 -41
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +33 -0
- package/dist/forms.js +2086 -1035
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +42 -1
- package/dist/heavy.js +1620 -600
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +441 -270
- package/dist/index.esm.js +1900 -638
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1935 -670
- 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 +6 -3
- package/scripts/atomix-cli.js +148 -4
- package/scripts/cli/__tests__/basic.test.js +3 -2
- package/scripts/cli/__tests__/clean.test.js +278 -0
- package/scripts/cli/__tests__/component-validator.test.js +433 -0
- package/scripts/cli/__tests__/generator.test.js +613 -0
- package/scripts/cli/__tests__/glass-motion.test.js +256 -0
- package/scripts/cli/__tests__/integration.test.js +719 -108
- package/scripts/cli/__tests__/migrate.test.js +74 -0
- package/scripts/cli/__tests__/security.test.js +206 -0
- package/scripts/cli/__tests__/test-setup.js +3 -1
- package/scripts/cli/__tests__/theme-bridge.test.js +507 -0
- package/scripts/cli/__tests__/token-provider.test.js +361 -0
- package/scripts/cli/__tests__/utils.test.js +5 -5
- package/scripts/cli/commands/benchmark.js +105 -0
- package/scripts/cli/commands/build-theme.js +4 -1
- package/scripts/cli/commands/clean.js +109 -0
- package/scripts/cli/commands/doctor.js +88 -0
- package/scripts/cli/commands/generate.js +135 -14
- package/scripts/cli/commands/init.js +45 -18
- package/scripts/cli/commands/migrate.js +106 -0
- package/scripts/cli/commands/sync-tokens.js +206 -0
- package/scripts/cli/commands/theme-bridge.js +248 -0
- package/scripts/cli/commands/tokens.js +157 -0
- package/scripts/cli/commands/validate.js +194 -0
- package/scripts/cli/internal/ai-engine.js +156 -0
- package/scripts/cli/internal/component-validator.js +443 -0
- package/scripts/cli/internal/config-loader.js +162 -0
- package/scripts/cli/internal/filesystem.js +102 -2
- package/scripts/cli/internal/generator.js +359 -39
- package/scripts/cli/internal/glass-generator.js +398 -0
- package/scripts/cli/internal/hook-generator.js +369 -0
- package/scripts/cli/internal/hooks.js +61 -0
- package/scripts/cli/internal/itcss-generator.js +565 -0
- package/scripts/cli/internal/motion-generator.js +679 -0
- package/scripts/cli/internal/template-engine.js +301 -0
- package/scripts/cli/internal/theme-bridge.js +664 -0
- package/scripts/cli/internal/tokens/engine.js +122 -0
- package/scripts/cli/internal/tokens/provider.js +34 -0
- package/scripts/cli/internal/tokens/providers/figma.js +50 -0
- package/scripts/cli/internal/tokens/providers/style-dictionary.js +48 -0
- package/scripts/cli/internal/tokens/providers/w3c.js +48 -0
- package/scripts/cli/internal/tokens/token-provider.js +443 -0
- package/scripts/cli/internal/tokens/token-validator.js +513 -0
- package/scripts/cli/internal/validator.js +276 -0
- package/scripts/cli/internal/wizard.js +60 -6
- package/scripts/cli/mappings.js +23 -0
- package/scripts/cli/migration-tools.js +164 -94
- package/scripts/cli/plugins/style-dictionary.js +46 -0
- package/scripts/cli/templates/README.md +525 -95
- package/scripts/cli/templates/common-templates.js +40 -14
- package/scripts/cli/templates/components/react-component.ts +282 -0
- package/scripts/cli/templates/config/project-config.ts +112 -0
- package/scripts/cli/templates/hooks/use-component.ts +477 -0
- package/scripts/cli/templates/index.js +19 -4
- package/scripts/cli/templates/index.ts +171 -0
- package/scripts/cli/templates/next-templates.js +72 -0
- package/scripts/cli/templates/react-templates.js +70 -126
- package/scripts/cli/templates/scss-templates.js +35 -35
- package/scripts/cli/templates/stories/storybook-story.ts +241 -0
- package/scripts/cli/templates/styles/scss-component.ts +255 -0
- package/scripts/cli/templates/tests/vitest-test.ts +229 -0
- package/scripts/cli/templates/token-templates.js +337 -1
- package/scripts/cli/templates/tokens/token-generators.ts +1088 -0
- package/scripts/cli/templates/types/component-types.ts +145 -0
- package/scripts/cli/templates/utils/testing-utils.ts +144 -0
- package/scripts/cli/templates/vanilla-templates.js +39 -0
- package/scripts/cli/token-manager.js +8 -2
- package/scripts/cli/utils/cache-manager.js +240 -0
- package/scripts/cli/utils/detector.js +46 -0
- package/scripts/cli/utils/diagnostics.js +289 -0
- package/scripts/cli/utils/error.js +45 -3
- package/scripts/cli/utils/helpers.js +24 -0
- package/scripts/cli/utils/logger.js +1 -1
- package/scripts/cli/utils/security.js +302 -0
- package/scripts/cli/utils/telemetry.js +115 -0
- package/scripts/cli/utils/validation.js +4 -38
- package/scripts/cli/utils.js +46 -0
- package/src/components/Accordion/Accordion.stories.tsx +0 -18
- package/src/components/Accordion/Accordion.test.tsx +0 -17
- package/src/components/Accordion/Accordion.tsx +0 -4
- package/src/components/AtomixGlass/AtomixGlass.tsx +102 -2
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +125 -12
- package/src/components/AtomixGlass/PerformanceDashboard.tsx +219 -0
- package/src/components/AtomixGlass/README.md +25 -10
- package/src/components/AtomixGlass/animation-system.ts +578 -0
- package/src/components/AtomixGlass/shader-utils.ts +4 -1
- package/src/components/AtomixGlass/stories/Overview.stories.tsx +157 -6
- package/src/components/AtomixGlass/stories/Phase1-Animation.stories.tsx +653 -0
- package/src/components/AtomixGlass/stories/Phase1-Test.stories.tsx +95 -0
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +51 -51
- package/src/components/AtomixGlass/stories/shared-components.tsx +6 -0
- package/src/components/Avatar/Avatar.tsx +1 -1
- package/src/components/Button/Button.stories.disabled-link.tsx +10 -0
- package/src/components/Button/Button.stories.tsx +10 -0
- package/src/components/Button/Button.test.tsx +16 -11
- package/src/components/Button/Button.tsx +4 -4
- package/src/components/Card/Card.tsx +1 -1
- package/src/components/Dropdown/Dropdown.tsx +12 -12
- package/src/components/Form/Select.tsx +62 -3
- package/src/components/Modal/Modal.tsx +14 -3
- package/src/components/Navigation/Navbar/Navbar.tsx +44 -0
- package/src/components/Slider/Slider.stories.tsx +3 -3
- package/src/components/Slider/Slider.tsx +38 -0
- package/src/components/Steps/Steps.tsx +3 -3
- package/src/components/Tabs/Tabs.tsx +77 -8
- package/src/components/Testimonial/Testimonial.tsx +1 -1
- package/src/components/TypedButton/TypedButton.stories.tsx +59 -0
- package/src/components/TypedButton/TypedButton.tsx +39 -0
- package/src/components/TypedButton/index.ts +2 -0
- package/src/components/VideoPlayer/VideoPlayer.tsx +11 -4
- package/src/lib/composables/index.ts +4 -7
- package/src/lib/composables/types.ts +45 -0
- package/src/lib/composables/useAccordion.ts +0 -7
- package/src/lib/composables/useAtomixGlass.ts +144 -5
- package/src/lib/composables/useChartExport.ts +3 -13
- package/src/lib/composables/useDropdown.ts +66 -0
- package/src/lib/composables/useFocusTrap.ts +80 -0
- package/src/lib/composables/usePerformanceMonitor.ts +448 -0
- package/src/lib/composables/useResponsiveGlass.presets.ts +192 -0
- package/src/lib/composables/useResponsiveGlass.ts +441 -0
- package/src/lib/composables/useTooltip.ts +16 -0
- package/src/lib/composables/useTypedButton.ts +66 -0
- package/src/lib/config/index.ts +62 -5
- package/src/lib/constants/components.ts +55 -0
- package/src/lib/theme/devtools/__tests__/useHistory.test.tsx +150 -0
- package/src/lib/theme/tokens/centralized-tokens.ts +120 -0
- package/src/lib/theme/utils/__tests__/domUtils.test.ts +101 -0
- package/src/lib/types/components.ts +37 -11
- package/src/lib/types/glass.ts +35 -0
- package/src/lib/types/index.ts +1 -0
- package/src/lib/utils/displacement-generator.ts +1 -1
- package/src/styles/01-settings/_settings.testtypecheck.scss +53 -0
- package/src/styles/01-settings/_settings.typedbutton.scss +53 -0
- package/src/styles/06-components/_components.testbutton.scss +212 -0
- package/src/styles/06-components/_components.testtypecheck.scss +212 -0
- package/src/styles/06-components/_components.typedbutton.scss +212 -0
- package/src/styles/99-utilities/_index.scss +1 -0
- package/src/styles/99-utilities/_utilities.text.scss +1 -1
- package/src/styles/99-utilities/_utilities.touch-target.scss +36 -0
- package/src/styles/06-components/old.chart.styles.scss +0 -2788
package/dist/forms.js
CHANGED
|
@@ -55,7 +55,16 @@ import React, { memo, forwardRef, useMemo, useState, useRef, useEffect, useCallb
|
|
|
55
55
|
PADDING: "0",
|
|
56
56
|
MODE: "standard",
|
|
57
57
|
OVER_LIGHT: !1,
|
|
58
|
-
ENABLE_OVER_LIGHT_LAYERS: !0
|
|
58
|
+
ENABLE_OVER_LIGHT_LAYERS: !0,
|
|
59
|
+
// Phase 1: Time-Based Animation System defaults
|
|
60
|
+
WITH_TIME_ANIMATION: !0,
|
|
61
|
+
ANIMATION_SPEED: 1,
|
|
62
|
+
// Phase 1: Multi-Layer Distortion System defaults
|
|
63
|
+
WITH_MULTI_LAYER_DISTORTION: !1,
|
|
64
|
+
DISTORTION_OCTAVES: 5,
|
|
65
|
+
DISTORTION_LACUNARITY: 2,
|
|
66
|
+
DISTORTION_GAIN: .5,
|
|
67
|
+
DISTORTION_QUALITY: "high"
|
|
59
68
|
},
|
|
60
69
|
CONSTANTS: {
|
|
61
70
|
ACTIVATION_ZONE: 200,
|
|
@@ -218,6 +227,44 @@ import React, { memo, forwardRef, useMemo, useState, useRef, useEffect, useCallb
|
|
|
218
227
|
// Saturation constants
|
|
219
228
|
SATURATION: {
|
|
220
229
|
HIGH_CONTRAST: 200
|
|
230
|
+
},
|
|
231
|
+
// Phase 1: Animation System Constants
|
|
232
|
+
ANIMATION: {
|
|
233
|
+
// Breathing effect timing (in milliseconds)
|
|
234
|
+
BREATHING_CYCLE: 2e3,
|
|
235
|
+
// 2-second breathing cycle
|
|
236
|
+
// Flow animation speed
|
|
237
|
+
FLOW_SPEED_X: .1,
|
|
238
|
+
// Horizontal flow speed
|
|
239
|
+
FLOW_SPEED_Y: .15,
|
|
240
|
+
// Vertical flow speed
|
|
241
|
+
// Wave propagation
|
|
242
|
+
WAVE_SPEED: .05,
|
|
243
|
+
// Radial wave speed
|
|
244
|
+
WAVE_AMPLITUDE: .02
|
|
245
|
+
},
|
|
246
|
+
// Phase 1: Multi-Layer Distortion Quality Presets
|
|
247
|
+
DISTORTION_QUALITY_PRESETS: {
|
|
248
|
+
low: {
|
|
249
|
+
octaves: 2,
|
|
250
|
+
lacunarity: 2,
|
|
251
|
+
gain: .5
|
|
252
|
+
},
|
|
253
|
+
medium: {
|
|
254
|
+
octaves: 4,
|
|
255
|
+
lacunarity: 2,
|
|
256
|
+
gain: .5
|
|
257
|
+
},
|
|
258
|
+
high: {
|
|
259
|
+
octaves: 5,
|
|
260
|
+
lacunarity: 2,
|
|
261
|
+
gain: .5
|
|
262
|
+
},
|
|
263
|
+
ultra: {
|
|
264
|
+
octaves: 7,
|
|
265
|
+
lacunarity: 2,
|
|
266
|
+
gain: .5
|
|
267
|
+
}
|
|
221
268
|
}
|
|
222
269
|
}
|
|
223
270
|
}, {CONSTANTS: CONSTANTS$2} = ATOMIX_GLASS, calculateDistance = (pos1, pos2) => {
|
|
@@ -296,7 +343,7 @@ import React, { memo, forwardRef, useMemo, useState, useRef, useEffect, useCallb
|
|
|
296
343
|
// Silently handle errors
|
|
297
344
|
}
|
|
298
345
|
return CONSTANTS$2.DEFAULT_CORNER_RADIUS;
|
|
299
|
-
}, lerp = (a, b, t) => a + (b - a) * t, softClamp = (value, max) => max <= 0 ? 0 : max * (1 - Math.exp(-value / max)), getDisplacementMap = (mode, displacementMap, polarDisplacementMap, prominentDisplacementMap, shaderMapUrl) => {
|
|
346
|
+
}, lerp$1 = (a, b, t) => a + (b - a) * t, softClamp = (value, max) => max <= 0 ? 0 : max * (1 - Math.exp(-value / max)), getDisplacementMap = (mode, displacementMap, polarDisplacementMap, prominentDisplacementMap, shaderMapUrl) => {
|
|
300
347
|
switch (mode) {
|
|
301
348
|
case "standard":
|
|
302
349
|
return displacementMap;
|
|
@@ -466,14 +513,16 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
466
513
|
}, 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 = {
|
|
467
514
|
width: 0,
|
|
468
515
|
height: 0
|
|
469
|
-
}, onClick: onClick, mode: mode = "standard", effectiveWithoutEffects: effectiveWithoutEffects = !1, effectiveReducedMotion: effectiveReducedMotion = !1, shaderVariant: shaderVariant = "liquidGlass", withLiquidBlur: withLiquidBlur = !1,
|
|
516
|
+
}, onClick: onClick, mode: mode = "standard", effectiveWithoutEffects: effectiveWithoutEffects = !1, effectiveReducedMotion: effectiveReducedMotion = !1, shaderVariant: shaderVariant = "liquidGlass", withLiquidBlur: withLiquidBlur = !1,
|
|
517
|
+
// Phase 1: Animation System props
|
|
518
|
+
shaderTime: shaderTime, withTimeAnimation: withTimeAnimation = !1, animationSpeed: animationSpeed = 1, withMultiLayerDistortion: withMultiLayerDistortion = !1, distortionOctaves: distortionOctaves = 3, distortionLacunarity: distortionLacunarity = 2, distortionGain: distortionGain = .5, distortionQuality: distortionQuality = "medium", contentRef: contentRef}, ref) => {
|
|
470
519
|
// Generate a stable, deterministic ID for SSR compatibility
|
|
471
520
|
// Use a module-level counter that's consistent across server and client
|
|
472
|
-
const filterId = useMemo((() => "atomix-glass-filter-" + ++idCounter), []), [shaderMapUrl, setShaderMapUrl] = useState(""), shaderGeneratorRef = useRef(null), shaderUtilsRef = useRef(null), shaderDebounceTimeoutRef = useRef(null);
|
|
521
|
+
const filterId = useMemo((() => "atomix-glass-filter-" + ++idCounter), []), [shaderMapUrl, setShaderMapUrl] = useState(""), shaderGeneratorRef = useRef(null), shaderUtilsRef = useRef(null), shaderDebounceTimeoutRef = useRef(null), shaderUpdateTimeoutRef = useRef(null), animationFrameRef = useRef(null);
|
|
473
522
|
// Lazy load shader utilities only when shader mode is needed
|
|
474
523
|
useEffect((() => {
|
|
475
524
|
"shader" === mode ?
|
|
476
|
-
// Dynamic import shader utilities
|
|
525
|
+
// Dynamic import shader utilities with animation support
|
|
477
526
|
Promise.resolve().then((() => shaderUtils)).then((shaderUtils => {
|
|
478
527
|
shaderUtilsRef.current = {
|
|
479
528
|
ShaderDisplacementGenerator: shaderUtils.ShaderDisplacementGenerator,
|
|
@@ -488,7 +537,7 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
488
537
|
// Generate shader map with debouncing and caching
|
|
489
538
|
useEffect((() => {
|
|
490
539
|
// Enhanced validation for shader mode
|
|
491
|
-
if ("shader" === mode && glassSize && validateGlassSize(glassSize)
|
|
540
|
+
if ("shader" === mode && glassSize && validateGlassSize(glassSize)) {
|
|
492
541
|
// Create cache key from size and variant
|
|
493
542
|
const cacheKey = `${glassSize.width}x${glassSize.height}-${shaderVariant}`, cachedUrl = (key => {
|
|
494
543
|
const entry = sharedShaderCache.get(key);
|
|
@@ -510,11 +559,9 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
510
559
|
width: glassSize.width,
|
|
511
560
|
height: glassSize.height,
|
|
512
561
|
fragment: selectedShader
|
|
513
|
-
}),
|
|
514
|
-
// Defer shader generation with longer delay to avoid blocking
|
|
515
|
-
setTimeout((() => {
|
|
562
|
+
}), shaderUpdateTimeoutRef.current = setTimeout((() => {
|
|
516
563
|
const url = shaderGeneratorRef.current?.updateShader() || "";
|
|
517
|
-
((key, url) => {
|
|
564
|
+
url && ((key, url) => {
|
|
518
565
|
// Evict oldest entries if at capacity
|
|
519
566
|
if (sharedShaderCache.size >= 15) {
|
|
520
567
|
const entries = Array.from(sharedShaderCache.entries());
|
|
@@ -546,7 +593,8 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
546
593
|
// Cleanup function with error handling
|
|
547
594
|
return () => {
|
|
548
595
|
shaderDebounceTimeoutRef.current && (clearTimeout(shaderDebounceTimeoutRef.current),
|
|
549
|
-
shaderDebounceTimeoutRef.current = null)
|
|
596
|
+
shaderDebounceTimeoutRef.current = null), shaderUpdateTimeoutRef.current && (clearTimeout(shaderUpdateTimeoutRef.current),
|
|
597
|
+
shaderUpdateTimeoutRef.current = null);
|
|
550
598
|
try {
|
|
551
599
|
shaderGeneratorRef.current?.destroy();
|
|
552
600
|
} catch (error) {
|
|
@@ -555,7 +603,37 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
555
603
|
shaderGeneratorRef.current = null;
|
|
556
604
|
}
|
|
557
605
|
};
|
|
558
|
-
}), [ mode, glassSize, shaderVariant ])
|
|
606
|
+
}), [ mode, glassSize, shaderVariant ]),
|
|
607
|
+
// Phase 1: Time-Based Animation Loop - Continuous shader regeneration
|
|
608
|
+
useEffect((() => {
|
|
609
|
+
// Only run animations in shader mode with time animation enabled
|
|
610
|
+
if ("shader" !== mode || !withTimeAnimation || effectiveReducedMotion || effectiveWithoutEffects)
|
|
611
|
+
// Cancel any existing animation frame
|
|
612
|
+
return void (null !== animationFrameRef.current && (cancelAnimationFrame(animationFrameRef.current),
|
|
613
|
+
animationFrameRef.current = null));
|
|
614
|
+
const baseFps = "ultra" === distortionQuality ? 60 : "high" === distortionQuality ? 30 : "medium" === distortionQuality ? 24 : 20, effectiveSpeed = Math.max(.5, Math.min(2, animationSpeed || 1)), complexity = withMultiLayerDistortion ? Math.max(1, (distortionOctaves || 3) / 3 + .25 * Math.max(0, (distortionLacunarity || 2) - 2) + Math.max(0, (distortionGain || .5) - .5)) : 1, frameInterval = 1e3 / Math.max(12, Math.min(60, Math.round(baseFps * effectiveSpeed / complexity)));
|
|
615
|
+
let lastUpdate = 0, isCancelled = !1;
|
|
616
|
+
const animate = currentTime => {
|
|
617
|
+
if (!isCancelled) {
|
|
618
|
+
if (currentTime - lastUpdate >= frameInterval && shaderGeneratorRef.current) {
|
|
619
|
+
lastUpdate = currentTime;
|
|
620
|
+
try {
|
|
621
|
+
const animatedShaderUrl = shaderGeneratorRef.current.updateShader();
|
|
622
|
+
animatedShaderUrl && setShaderMapUrl(animatedShaderUrl);
|
|
623
|
+
} catch (error) {
|
|
624
|
+
console.warn("AtomixGlassContainer: Error in animation loop", error);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
animationFrameRef.current = requestAnimationFrame(animate);
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
// Start animation loop
|
|
631
|
+
// Cleanup animation on unmount or dependency change
|
|
632
|
+
return animationFrameRef.current = requestAnimationFrame(animate), () => {
|
|
633
|
+
isCancelled = !0, null !== animationFrameRef.current && (cancelAnimationFrame(animationFrameRef.current),
|
|
634
|
+
animationFrameRef.current = null);
|
|
635
|
+
};
|
|
636
|
+
}), [ mode, withTimeAnimation, animationSpeed, displacementScale, withMultiLayerDistortion, distortionOctaves, distortionLacunarity, distortionGain, distortionQuality, effectiveReducedMotion, effectiveWithoutEffects, glassSize ]);
|
|
559
637
|
// Removed forced reflow to avoid layout thrash and potential feedback sizing loops
|
|
560
638
|
const [rectCache, setRectCache] = useState(null);
|
|
561
639
|
useEffect((() => {
|
|
@@ -889,12 +967,144 @@ class {
|
|
|
889
967
|
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)"),
|
|
890
968
|
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)");
|
|
891
969
|
}
|
|
892
|
-
}
|
|
970
|
+
};
|
|
893
971
|
|
|
894
972
|
/**
|
|
895
973
|
* Updates the styles of the AtomixGlass wrapper and container elements imperatively
|
|
896
974
|
* to avoid React re-renders on mouse movement.
|
|
897
|
-
*/
|
|
975
|
+
*/
|
|
976
|
+
/**
|
|
977
|
+
* Animation System for AtomixGlass Component
|
|
978
|
+
*
|
|
979
|
+
* Implements Phase 1 features from the AtomixGlass Feature Implementation Roadmap:
|
|
980
|
+
* - Feature 1.1: Time-Based Animation System
|
|
981
|
+
* - Feature 1.2: Multi-Layer Distortion System (FBM)
|
|
982
|
+
*
|
|
983
|
+
* @packageDocumentation
|
|
984
|
+
*/
|
|
985
|
+
// ============================================================================
|
|
986
|
+
// Noise Functions for FBM (Feature 1.2)
|
|
987
|
+
// ============================================================================
|
|
988
|
+
/**
|
|
989
|
+
* Perlin noise implementation for smooth gradient noise
|
|
990
|
+
*
|
|
991
|
+
* @param x - X coordinate
|
|
992
|
+
* @param y - Y coordinate
|
|
993
|
+
* @returns Noise value in range [0, 1]
|
|
994
|
+
*/
|
|
995
|
+
function perlinNoise(x, y) {
|
|
996
|
+
// Simplified Perlin noise using pseudo-random gradients
|
|
997
|
+
const X = 255 & Math.floor(x), Y = 255 & Math.floor(y), xf = x - Math.floor(x), yf = y - Math.floor(y), u = fade(xf), v = fade(yf), A = p[X] + Y & 255, B = p[X + 1] + Y & 255, ga = grad(p[A], xf, yf), gb = grad(p[B], xf - 1, yf), gc = grad(p[A + 1 & 255], xf, yf - 1), gd = grad(p[B + 1 & 255], xf - 1, yf - 1), lerpX1 = lerp(ga, gb, u), lerpX2 = lerp(gc, gd, u);
|
|
998
|
+
// Scale to [0, 1] range
|
|
999
|
+
return (lerp(lerpX1, lerpX2, v) + 1) / 2;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
// ============================================================================
|
|
1003
|
+
// Fractal Brownian Motion (FBM) Engine (Feature 1.2)
|
|
1004
|
+
// ============================================================================
|
|
1005
|
+
/**
|
|
1006
|
+
* Creates an FBM engine with configurable parameters
|
|
1007
|
+
*
|
|
1008
|
+
* @param config - FBM configuration (octaves, lacunarity, gain)
|
|
1009
|
+
* @returns Object with fbm function
|
|
1010
|
+
*
|
|
1011
|
+
* @example
|
|
1012
|
+
* ```typescript
|
|
1013
|
+
* const fbmEngine = createFBMEngine({ octaves: 5, lacunarity: 2, gain: 0.5 });
|
|
1014
|
+
*
|
|
1015
|
+
* // Generate noise at position (0.5, 0.5) with time animation
|
|
1016
|
+
* const noiseValue = fbmEngine.fbm(0.5, 0.5, Date.now());
|
|
1017
|
+
* ```
|
|
1018
|
+
*/ function createFBMEngine(config) {
|
|
1019
|
+
/**
|
|
1020
|
+
* Fractal Brownian Motion function
|
|
1021
|
+
* Combines multiple octaves of noise for complex, natural patterns
|
|
1022
|
+
*
|
|
1023
|
+
* @param x - X coordinate
|
|
1024
|
+
* @param y - Y coordinate
|
|
1025
|
+
* @param time - Optional time value for animation
|
|
1026
|
+
* @returns FBM noise value in range [0, 1]
|
|
1027
|
+
*/
|
|
1028
|
+
const fbm = (x, y, time = 0) => {
|
|
1029
|
+
let value = 0, amplitude = .5, frequency = 1, phase = .001 * time;
|
|
1030
|
+
// Convert to seconds for reasonable animation speed
|
|
1031
|
+
for (let i = 0; i < config.octaves; i++)
|
|
1032
|
+
// Apply time-based phase shift to all octaves
|
|
1033
|
+
value += perlinNoise(x * frequency + phase, y * frequency + phase) * amplitude,
|
|
1034
|
+
frequency *= config.lacunarity, // Increase frequency
|
|
1035
|
+
amplitude *= config.gain;
|
|
1036
|
+
return value;
|
|
1037
|
+
};
|
|
1038
|
+
/**
|
|
1039
|
+
* Get FBM with simple time factor
|
|
1040
|
+
*/ return {
|
|
1041
|
+
fbm: fbm,
|
|
1042
|
+
fbmWithTime: (x, y, time) => fbm(x, y, time)
|
|
1043
|
+
};
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* Gets optimal FBM config based on quality preset
|
|
1048
|
+
*
|
|
1049
|
+
* @param quality - Quality preset level
|
|
1050
|
+
* @returns FBM configuration for the quality level
|
|
1051
|
+
*/ const fbmEngineCache = new Map;
|
|
1052
|
+
|
|
1053
|
+
// ============================================================================
|
|
1054
|
+
// Shader Utility Functions for Time-Based Effects
|
|
1055
|
+
// ============================================================================
|
|
1056
|
+
/**
|
|
1057
|
+
* Liquid glass distortion with time-based animation
|
|
1058
|
+
* Uses FBM to create organic, flowing liquid effects
|
|
1059
|
+
*
|
|
1060
|
+
* @param uv - UV coordinates (normalized 0-1)
|
|
1061
|
+
* @param time - Elapsed time in milliseconds
|
|
1062
|
+
* @param config - FBM configuration
|
|
1063
|
+
* @returns Distorted UV coordinates
|
|
1064
|
+
*/ function liquidGlassWithTime(uv, time, config) {
|
|
1065
|
+
const configKey = `${config.octaves}-${config.lacunarity}-${config.gain}`;
|
|
1066
|
+
let fbmEngine = fbmEngineCache.get(configKey);
|
|
1067
|
+
fbmEngine || (fbmEngine = createFBMEngine(config), fbmEngineCache.set(configKey, fbmEngine));
|
|
1068
|
+
// Animate noise with time
|
|
1069
|
+
const animatedNoise = fbmEngine.fbmWithTime(2 * uv.x + 1e-4 * time, 2 * uv.y + 15e-5 * time, time);
|
|
1070
|
+
return {
|
|
1071
|
+
x: uv.x + .04 * (animatedNoise - .5),
|
|
1072
|
+
y: uv.y + .04 * (animatedNoise - .5)
|
|
1073
|
+
};
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
// ============================================================================
|
|
1077
|
+
// Helper Functions
|
|
1078
|
+
// ============================================================================
|
|
1079
|
+
/**
|
|
1080
|
+
* Fade curve for smooth interpolation (Perlin's fade function)
|
|
1081
|
+
*/ function fade(t) {
|
|
1082
|
+
return t * t * t * (t * (6 * t - 15) + 10);
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
/**
|
|
1086
|
+
* Linear interpolation
|
|
1087
|
+
*/ function lerp(a, b, t) {
|
|
1088
|
+
return a + t * (b - a);
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
/**
|
|
1092
|
+
* Gradient calculation for Perlin noise
|
|
1093
|
+
*/ function grad(hash, x, y) {
|
|
1094
|
+
const h = 15 & hash, u = h < 8 ? x : y, v = h < 4 ? y : 12 === h || 14 === h ? x : 0;
|
|
1095
|
+
return (1 & h ? -u : u) + (2 & h ? -v : v);
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
/**
|
|
1099
|
+
* Permutation table for Perlin noise
|
|
1100
|
+
*/ const p = (() => {
|
|
1101
|
+
const permutation = [];
|
|
1102
|
+
for (let i = 0; i < 256; i++) permutation[i] = Math.floor(256 * Math.random());
|
|
1103
|
+
// Duplicate for overflow handling
|
|
1104
|
+
return [ ...permutation, ...permutation ];
|
|
1105
|
+
})(), {CONSTANTS: CONSTANTS$1} = ATOMIX_GLASS;
|
|
1106
|
+
|
|
1107
|
+
const {CONSTANTS: CONSTANTS} = ATOMIX_GLASS, backgroundDetectionCache = new WeakMap, setCachedBackgroundDetection = (parentElement, overLightConfig, result, threshold) => {
|
|
898
1108
|
parentElement && backgroundDetectionCache.set(parentElement, {
|
|
899
1109
|
result: result,
|
|
900
1110
|
timestamp: Date.now(),
|
|
@@ -907,7 +1117,9 @@ class {
|
|
|
907
1117
|
* Composable hook for AtomixGlass component logic
|
|
908
1118
|
* Manages all state, calculations, and event handlers
|
|
909
1119
|
*/
|
|
910
|
-
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
|
|
1120
|
+
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, withTimeAnimation:
|
|
1121
|
+
// Phase 1: Animation System Props
|
|
1122
|
+
withTimeAnimation = ATOMIX_GLASS.DEFAULTS.WITH_TIME_ANIMATION, animationSpeed: animationSpeed = ATOMIX_GLASS.DEFAULTS.ANIMATION_SPEED, withMultiLayerDistortion: withMultiLayerDistortion = ATOMIX_GLASS.DEFAULTS.WITH_MULTI_LAYER_DISTORTION, distortionOctaves: distortionOctaves = ATOMIX_GLASS.DEFAULTS.DISTORTION_OCTAVES, distortionLacunarity: distortionLacunarity = ATOMIX_GLASS.DEFAULTS.DISTORTION_LACUNARITY, distortionGain: distortionGain = ATOMIX_GLASS.DEFAULTS.DISTORTION_GAIN, distortionQuality: distortionQuality = ATOMIX_GLASS.DEFAULTS.DISTORTION_QUALITY}) {
|
|
911
1123
|
// State
|
|
912
1124
|
const [isHovered, setIsHovered] = useState(!1), [isActive, setIsActive] = useState(!1), cachedRectRef = useRef(null), internalGlobalMousePositionRef = useRef({
|
|
913
1125
|
x: 0,
|
|
@@ -921,7 +1133,47 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
921
1133
|
}), targetGlobalMousePositionRef = useRef({
|
|
922
1134
|
x: 0,
|
|
923
1135
|
y: 0
|
|
924
|
-
}), lerpRafRef = useRef(null), lerpActiveRef = useRef(!1), [dynamicBorderRadius, setDynamicCornerRadius] = useState(CONSTANTS.DEFAULT_CORNER_RADIUS), [userPrefersReducedMotion, setUserPrefersReducedMotion] = useState(!1), [userPrefersHighContrast, setUserPrefersHighContrast] = useState(!1), [detectedOverLight, setDetectedOverLight] = useState(!1),
|
|
1136
|
+
}), lerpRafRef = useRef(null), lerpActiveRef = useRef(!1), [dynamicBorderRadius, setDynamicCornerRadius] = useState(CONSTANTS.DEFAULT_CORNER_RADIUS), [userPrefersReducedMotion, setUserPrefersReducedMotion] = useState(!1), [userPrefersHighContrast, setUserPrefersHighContrast] = useState(!1), [detectedOverLight, setDetectedOverLight] = useState(!1), animationFrameIdRef = useRef(null), animationStartTimeRef = useRef(0), elapsedTimeRef = useRef(0), shaderTimeRef = useRef(0), fbmConfig = useMemo((() => {
|
|
1137
|
+
// If quality preset is provided, use it as base
|
|
1138
|
+
const preset = (quality = distortionQuality, ATOMIX_GLASS.CONSTANTS.DISTORTION_QUALITY_PRESETS[quality]);
|
|
1139
|
+
// Override with custom values if provided
|
|
1140
|
+
var quality;
|
|
1141
|
+
return {
|
|
1142
|
+
octaves: distortionOctaves ?? preset.octaves,
|
|
1143
|
+
lacunarity: distortionLacunarity ?? preset.lacunarity,
|
|
1144
|
+
gain: distortionGain ?? preset.gain
|
|
1145
|
+
};
|
|
1146
|
+
}), [ distortionQuality, distortionOctaves, distortionLacunarity, distortionGain ]), fbmEngine = useMemo((() => withMultiLayerDistortion ? createFBMEngine(fbmConfig) : null), [ withMultiLayerDistortion, fbmConfig ]), effectiveReducedMotion = useMemo((() => reducedMotion || userPrefersReducedMotion), [ reducedMotion, userPrefersReducedMotion ]), effectiveWithTimeAnimation = useMemo((() => withTimeAnimation && !effectiveReducedMotion), [ withTimeAnimation, effectiveReducedMotion ]);
|
|
1147
|
+
/**
|
|
1148
|
+
* Animation loop for time-based effects
|
|
1149
|
+
*/
|
|
1150
|
+
useEffect((() => {
|
|
1151
|
+
if (!effectiveWithTimeAnimation || "undefined" == typeof window) return;
|
|
1152
|
+
let lastFrameTime = performance.now();
|
|
1153
|
+
/**
|
|
1154
|
+
* Animation frame handler
|
|
1155
|
+
*/ const animate = currentTime => {
|
|
1156
|
+
// Calculate delta time
|
|
1157
|
+
const deltaTime = currentTime - lastFrameTime;
|
|
1158
|
+
lastFrameTime = currentTime;
|
|
1159
|
+
// Apply animation speed multiplier
|
|
1160
|
+
const scaledDelta = deltaTime * animationSpeed;
|
|
1161
|
+
elapsedTimeRef.current += scaledDelta, shaderTimeRef.current = elapsedTimeRef.current,
|
|
1162
|
+
// Continue animation loop
|
|
1163
|
+
animationFrameIdRef.current = requestAnimationFrame(animate);
|
|
1164
|
+
};
|
|
1165
|
+
// Start animation
|
|
1166
|
+
// Cleanup
|
|
1167
|
+
return animationStartTimeRef.current = performance.now(), animationFrameIdRef.current = requestAnimationFrame(animate),
|
|
1168
|
+
() => {
|
|
1169
|
+
null !== animationFrameIdRef.current && (cancelAnimationFrame(animationFrameIdRef.current),
|
|
1170
|
+
animationFrameIdRef.current = null);
|
|
1171
|
+
};
|
|
1172
|
+
}), [ effectiveWithTimeAnimation, animationSpeed ]);
|
|
1173
|
+
/**
|
|
1174
|
+
* Get current shader time for animations
|
|
1175
|
+
*/
|
|
1176
|
+
const getShaderTime = useCallback((() => shaderTimeRef.current), []), applyTimeBasedDistortion = useCallback((uv => effectiveWithTimeAnimation && fbmEngine ? liquidGlassWithTime(uv, shaderTimeRef.current, fbmConfig) : uv), [ effectiveWithTimeAnimation, fbmEngine, fbmConfig ]), effectiveBorderRadius = useMemo((() => void 0 !== borderRadius ? Math.max(0, borderRadius) : Math.max(0, dynamicBorderRadius)), [ borderRadius, dynamicBorderRadius ]), {glassSize: glassSize} = function({glassRef: glassRef, effectiveBorderRadius: effectiveBorderRadius, cachedRectRef: cachedRectRef}) {
|
|
925
1177
|
const [glassSize, setGlassSize] = useState({
|
|
926
1178
|
width: 270,
|
|
927
1179
|
height: 69
|
|
@@ -980,7 +1232,10 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
980
1232
|
glassRef: glassRef,
|
|
981
1233
|
effectiveBorderRadius: effectiveBorderRadius,
|
|
982
1234
|
cachedRectRef: cachedRectRef
|
|
983
|
-
}),
|
|
1235
|
+
}), effectiveHighContrast = useMemo((() => highContrast || userPrefersHighContrast), [ highContrast, userPrefersHighContrast ]), effectiveWithoutEffects = useMemo((() => withoutEffects || effectiveReducedMotion), [ withoutEffects, effectiveReducedMotion ]), globalMousePosition = externalGlobalMousePosition || internalGlobalMousePositionRef.current, mouseOffset = externalMouseOffset || internalMouseOffsetRef.current;
|
|
1236
|
+
/**
|
|
1237
|
+
* Apply time-based distortion to UV coordinates
|
|
1238
|
+
*/
|
|
984
1239
|
// Extract border-radius from children
|
|
985
1240
|
useEffect((() => {
|
|
986
1241
|
const extractRadius = () => {
|
|
@@ -1183,6 +1438,8 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1183
1438
|
lerpActiveRef.current = !0;
|
|
1184
1439
|
const LERP_T = CONSTANTS.LERP_FACTOR, tick = () => {
|
|
1185
1440
|
if (!lerpActiveRef.current) return;
|
|
1441
|
+
// Add ref validity check to prevent memory leaks
|
|
1442
|
+
if (!glassRef.current || !wrapperRef?.current) return void (lerpActiveRef.current = !1);
|
|
1186
1443
|
const cur = internalMouseOffsetRef.current, tgt = targetMouseOffsetRef.current, dx = tgt.x - cur.x, dy = tgt.y - cur.y;
|
|
1187
1444
|
// If we're close enough, snap and park
|
|
1188
1445
|
if (Math.abs(dx) < .05 && Math.abs(dy) < .05) internalMouseOffsetRef.current = {
|
|
@@ -1191,17 +1448,17 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1191
1448
|
...targetGlobalMousePositionRef.current
|
|
1192
1449
|
}; else {
|
|
1193
1450
|
internalMouseOffsetRef.current = {
|
|
1194
|
-
x: lerp(cur.x, tgt.x, LERP_T),
|
|
1195
|
-
y: lerp(cur.y, tgt.y, LERP_T)
|
|
1451
|
+
x: lerp$1(cur.x, tgt.x, LERP_T),
|
|
1452
|
+
y: lerp$1(cur.y, tgt.y, LERP_T)
|
|
1196
1453
|
};
|
|
1197
1454
|
const curG = internalGlobalMousePositionRef.current, tgtG = targetGlobalMousePositionRef.current;
|
|
1198
1455
|
internalGlobalMousePositionRef.current = {
|
|
1199
|
-
x: lerp(curG.x, tgtG.x, LERP_T),
|
|
1200
|
-
y: lerp(curG.y, tgtG.y, LERP_T)
|
|
1456
|
+
x: lerp$1(curG.x, tgtG.x, LERP_T),
|
|
1457
|
+
y: lerp$1(curG.y, tgtG.y, LERP_T)
|
|
1201
1458
|
};
|
|
1202
1459
|
}
|
|
1203
1460
|
// Imperative style update with the smoothed values
|
|
1204
|
-
updateAtomixGlassStyles(wrapperRef
|
|
1461
|
+
updateAtomixGlassStyles(wrapperRef.current, glassRef.current, {
|
|
1205
1462
|
mouseOffset: internalMouseOffsetRef.current,
|
|
1206
1463
|
globalMousePosition: internalGlobalMousePositionRef.current,
|
|
1207
1464
|
glassSize: glassSize,
|
|
@@ -1292,6 +1549,8 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1292
1549
|
// This is now static (refs or props) unless prop changes
|
|
1293
1550
|
overLightConfig: overLightConfig,
|
|
1294
1551
|
transformStyle: transformStyle,
|
|
1552
|
+
getShaderTime: getShaderTime,
|
|
1553
|
+
applyTimeBasedDistortion: applyTimeBasedDistortion,
|
|
1295
1554
|
handleMouseEnter: handleMouseEnter,
|
|
1296
1555
|
handleMouseLeave: handleMouseLeave,
|
|
1297
1556
|
handleMouseDown: handleMouseDown,
|
|
@@ -1301,1064 +1560,1819 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1301
1560
|
}
|
|
1302
1561
|
|
|
1303
1562
|
/**
|
|
1304
|
-
*
|
|
1305
|
-
*
|
|
1306
|
-
* Features:
|
|
1307
|
-
* - Hardware-accelerated glass effects with SVG filters
|
|
1308
|
-
* - Mouse-responsive liquid distortion
|
|
1309
|
-
* - Dynamic border-radius extraction from children CSS properties
|
|
1310
|
-
* - Automatic light/dark theme detection via overLight prop
|
|
1311
|
-
* - Accessibility and performance optimizations
|
|
1312
|
-
* - Multiple displacement modes (standard, polar, prominent, shader)
|
|
1313
|
-
* - Design token integration for consistent theming
|
|
1314
|
-
* - Focus ring support for keyboard navigation
|
|
1315
|
-
* - Responsive breakpoints for mobile optimization
|
|
1316
|
-
* - Enhanced ARIA attributes for screen readers
|
|
1317
|
-
*
|
|
1318
|
-
* Design System Compliance:
|
|
1319
|
-
* - Uses design tokens for opacity, spacing, and colors
|
|
1320
|
-
* - Follows BEM methodology for class naming
|
|
1321
|
-
* - Implements focus-ring mixin for accessibility
|
|
1322
|
-
* - Supports reduced motion and high contrast preferences
|
|
1323
|
-
*
|
|
1324
|
-
* @example
|
|
1325
|
-
* // Basic usage with dynamic border-radius extraction
|
|
1326
|
-
* <AtomixGlass>
|
|
1327
|
-
* <div style={{ borderRadius: '12px' }}>Content with 12px radius</div>
|
|
1328
|
-
* </AtomixGlass>
|
|
1329
|
-
*
|
|
1330
|
-
* @example
|
|
1331
|
-
* // Manual border-radius override
|
|
1332
|
-
* <AtomixGlass borderRadius={20}>
|
|
1333
|
-
* <div>Content with 20px glass radius</div>
|
|
1334
|
-
* </AtomixGlass>
|
|
1335
|
-
*
|
|
1336
|
-
* @example
|
|
1337
|
-
* // Interactive glass with click handler
|
|
1338
|
-
* <AtomixGlass onClick={() => console.log('Clicked')} aria-label="Glass card">
|
|
1339
|
-
* <div>Clickable content</div>
|
|
1340
|
-
* </AtomixGlass>
|
|
1341
|
-
*
|
|
1342
|
-
* @example
|
|
1343
|
-
* // OverLight - Boolean mode (explicit control)
|
|
1344
|
-
* <AtomixGlass overLight={true}>
|
|
1345
|
-
* <div>Content on light background</div>
|
|
1346
|
-
* </AtomixGlass>
|
|
1563
|
+
* Default responsive breakpoints configuration
|
|
1347
1564
|
*
|
|
1348
|
-
*
|
|
1349
|
-
*
|
|
1350
|
-
*
|
|
1351
|
-
*
|
|
1352
|
-
|
|
1565
|
+
* These breakpoints are optimized for glass effect performance across device classes:
|
|
1566
|
+
* - Mobile: Reduced complexity for 60 FPS target
|
|
1567
|
+
* - Tablet: Balanced quality and performance
|
|
1568
|
+
* - Desktop: Full fidelity effects
|
|
1569
|
+
*/ const DEFAULT_BREAKPOINTS = {
|
|
1570
|
+
mobile: {
|
|
1571
|
+
maxWidth: 640,
|
|
1572
|
+
params: {
|
|
1573
|
+
distortionOctaves: 3,
|
|
1574
|
+
displacementScale: .7,
|
|
1575
|
+
blurAmount: .8,
|
|
1576
|
+
animationSpeed: .8,
|
|
1577
|
+
chromaticIntensity: .5
|
|
1578
|
+
}
|
|
1579
|
+
},
|
|
1580
|
+
tablet: {
|
|
1581
|
+
minWidth: 641,
|
|
1582
|
+
maxWidth: 1024,
|
|
1583
|
+
params: {
|
|
1584
|
+
distortionOctaves: 4,
|
|
1585
|
+
displacementScale: .85,
|
|
1586
|
+
blurAmount: .9,
|
|
1587
|
+
animationSpeed: .9,
|
|
1588
|
+
chromaticIntensity: .75
|
|
1589
|
+
}
|
|
1590
|
+
},
|
|
1591
|
+
desktop: {
|
|
1592
|
+
minWidth: 1025,
|
|
1593
|
+
params: {
|
|
1594
|
+
distortionOctaves: 5,
|
|
1595
|
+
displacementScale: 1,
|
|
1596
|
+
blurAmount: 1,
|
|
1597
|
+
animationSpeed: 1,
|
|
1598
|
+
chromaticIntensity: 1
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
};
|
|
1602
|
+
|
|
1603
|
+
/**
|
|
1604
|
+
* Device performance tier detection
|
|
1353
1605
|
*
|
|
1354
|
-
*
|
|
1355
|
-
*
|
|
1356
|
-
* <AtomixGlass
|
|
1357
|
-
* overLight={{
|
|
1358
|
-
* threshold: 0.8,
|
|
1359
|
-
* opacity: 0.6,
|
|
1360
|
-
* contrast: 1.8,
|
|
1361
|
-
* brightness: 1.0,
|
|
1362
|
-
* saturationBoost: 1.5
|
|
1363
|
-
* }}
|
|
1364
|
-
* >
|
|
1365
|
-
* <div>Content with custom overLight config</div>
|
|
1366
|
-
* </AtomixGlass>
|
|
1606
|
+
* Uses Device Memory API and Hardware Concurrency API to classify devices
|
|
1607
|
+
* into performance tiers for automatic quality adjustment.
|
|
1367
1608
|
*
|
|
1368
|
-
* @
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
// Calculate base style with transforms
|
|
1419
|
-
// When layout is hoisted to the root, strip those props from the container
|
|
1420
|
-
useMemo((() => {
|
|
1421
|
-
if (isFixedOrSticky) {
|
|
1422
|
-
const {position: _p, top: _t, left: _l, right: _r, bottom: _b, ...visualStyle} = restStyle;
|
|
1423
|
-
return {
|
|
1424
|
-
...visualStyle,
|
|
1425
|
-
...!effectiveWithoutEffects && {
|
|
1426
|
-
transform: transformStyle
|
|
1427
|
-
}
|
|
1428
|
-
};
|
|
1609
|
+
* @returns Performance tier classification
|
|
1610
|
+
*/ var commonjsGlobal = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {};
|
|
1611
|
+
|
|
1612
|
+
function getDefaultExportFromCjs(x) {
|
|
1613
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x.default : x;
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
var fails$8 = function(exec) {
|
|
1617
|
+
try {
|
|
1618
|
+
return !!exec();
|
|
1619
|
+
} catch (error) {
|
|
1620
|
+
return !0;
|
|
1621
|
+
}
|
|
1622
|
+
}, functionBindNative = !fails$8((function() {
|
|
1623
|
+
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
|
1624
|
+
var test = function() {/* empty */}.bind();
|
|
1625
|
+
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
1626
|
+
return "function" != typeof test || test.hasOwnProperty("prototype");
|
|
1627
|
+
})), NATIVE_BIND$3 = functionBindNative, FunctionPrototype$1 = Function.prototype, call$5 = FunctionPrototype$1.call, uncurryThisWithBind = NATIVE_BIND$3 && FunctionPrototype$1.bind.bind(call$5, call$5), functionUncurryThis = NATIVE_BIND$3 ? uncurryThisWithBind : function(fn) {
|
|
1628
|
+
return function() {
|
|
1629
|
+
return call$5.apply(fn, arguments);
|
|
1630
|
+
};
|
|
1631
|
+
}, objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf), check = function(it) {
|
|
1632
|
+
return it && it.Math === Math && it;
|
|
1633
|
+
}, globalThis_1 =
|
|
1634
|
+
// eslint-disable-next-line es/no-global-this -- safe
|
|
1635
|
+
check("object" == typeof globalThis && globalThis) || check("object" == typeof window && window) ||
|
|
1636
|
+
// eslint-disable-next-line no-restricted-globals -- safe
|
|
1637
|
+
check("object" == typeof self && self) || check("object" == typeof commonjsGlobal && commonjsGlobal) || check("object" == typeof commonjsGlobal && commonjsGlobal) ||
|
|
1638
|
+
// eslint-disable-next-line no-new-func -- fallback
|
|
1639
|
+
function() {
|
|
1640
|
+
return this;
|
|
1641
|
+
}() || Function("return this")(), NATIVE_BIND$2 = functionBindNative, FunctionPrototype = Function.prototype, apply$1 = FunctionPrototype.apply, call$4 = FunctionPrototype.call, functionApply = "object" == typeof Reflect && Reflect.apply || (NATIVE_BIND$2 ? call$4.bind(apply$1) : function() {
|
|
1642
|
+
return call$4.apply(apply$1, arguments);
|
|
1643
|
+
}), uncurryThis$7 = functionUncurryThis, toString$3 = uncurryThis$7({}.toString), stringSlice = uncurryThis$7("".slice), classofRaw$2 = function(it) {
|
|
1644
|
+
return stringSlice(toString$3(it), 8, -1);
|
|
1645
|
+
}, classofRaw$1 = classofRaw$2, uncurryThis$6 = functionUncurryThis, functionUncurryThisClause = function(fn) {
|
|
1646
|
+
// Nashorn bug:
|
|
1647
|
+
// https://github.com/zloirock/core-js/issues/1128
|
|
1648
|
+
// https://github.com/zloirock/core-js/issues/1130
|
|
1649
|
+
if ("Function" === classofRaw$1(fn)) return uncurryThis$6(fn);
|
|
1650
|
+
}, documentAll = "object" == typeof document && document.all, isCallable$8 = void 0 === documentAll && void 0 !== documentAll ? function(argument) {
|
|
1651
|
+
return "function" == typeof argument || argument === documentAll;
|
|
1652
|
+
} : function(argument) {
|
|
1653
|
+
return "function" == typeof argument;
|
|
1654
|
+
}, objectGetOwnPropertyDescriptor = {}, descriptors = !fails$8((function() {
|
|
1655
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
1656
|
+
return 7 !== Object.defineProperty({}, 1, {
|
|
1657
|
+
get: function() {
|
|
1658
|
+
return 7;
|
|
1429
1659
|
}
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
"
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
}
|
|
1660
|
+
})[1];
|
|
1661
|
+
})), NATIVE_BIND$1 = functionBindNative, call$3 = Function.prototype.call, functionCall = NATIVE_BIND$1 ? call$3.bind(call$3) : function() {
|
|
1662
|
+
return call$3.apply(call$3, arguments);
|
|
1663
|
+
}, objectPropertyIsEnumerable = {}, $propertyIsEnumerable = {}.propertyIsEnumerable, getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor, NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({
|
|
1664
|
+
1: 2
|
|
1665
|
+
}, 1);
|
|
1666
|
+
|
|
1667
|
+
// `Object.prototype.propertyIsEnumerable` method implementation
|
|
1668
|
+
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
|
1669
|
+
objectPropertyIsEnumerable.f = NASHORN_BUG ? function(V) {
|
|
1670
|
+
var descriptor = getOwnPropertyDescriptor$1(this, V);
|
|
1671
|
+
return !!descriptor && descriptor.enumerable;
|
|
1672
|
+
} : $propertyIsEnumerable;
|
|
1673
|
+
|
|
1674
|
+
var match, version, createPropertyDescriptor$2 = function(bitmap, value) {
|
|
1675
|
+
return {
|
|
1676
|
+
enumerable: !(1 & bitmap),
|
|
1677
|
+
configurable: !(2 & bitmap),
|
|
1678
|
+
writable: !(4 & bitmap),
|
|
1679
|
+
value: value
|
|
1680
|
+
};
|
|
1681
|
+
}, fails$5 = fails$8, classof$3 = classofRaw$2, $Object$3 = Object, split = functionUncurryThis("".split), indexedObject = fails$5((function() {
|
|
1682
|
+
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
1683
|
+
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
1684
|
+
return !$Object$3("z").propertyIsEnumerable(0);
|
|
1685
|
+
})) ? function(it) {
|
|
1686
|
+
return "String" === classof$3(it) ? split(it, "") : $Object$3(it);
|
|
1687
|
+
} : $Object$3, isNullOrUndefined$2 = function(it) {
|
|
1688
|
+
return null == it;
|
|
1689
|
+
}, isNullOrUndefined$1 = isNullOrUndefined$2, $TypeError$6 = TypeError, requireObjectCoercible$3 = function(it) {
|
|
1690
|
+
if (isNullOrUndefined$1(it)) throw new $TypeError$6("Can't call method on " + it);
|
|
1691
|
+
return it;
|
|
1692
|
+
}, IndexedObject = indexedObject, requireObjectCoercible$2 = requireObjectCoercible$3, toIndexedObject$2 = function(it) {
|
|
1693
|
+
return IndexedObject(requireObjectCoercible$2(it));
|
|
1694
|
+
}, isCallable$7 = isCallable$8, isObject$5 = function(it) {
|
|
1695
|
+
return "object" == typeof it ? null !== it : isCallable$7(it);
|
|
1696
|
+
}, path$3 = {}, path$2 = path$3, globalThis$a = globalThis_1, isCallable$6 = isCallable$8, aFunction = function(variable) {
|
|
1697
|
+
return isCallable$6(variable) ? variable : void 0;
|
|
1698
|
+
}, navigator$1 = globalThis_1.navigator, userAgent$1 = navigator$1 && navigator$1.userAgent, globalThis$8 = globalThis_1, userAgent = userAgent$1 ? String(userAgent$1) : "", process$1 = globalThis$8.process, Deno = globalThis$8.Deno, versions = process$1 && process$1.versions || Deno && Deno.version, v8 = versions && versions.v8;
|
|
1699
|
+
|
|
1700
|
+
v8 && (
|
|
1701
|
+
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
|
1702
|
+
// but their correct versions are not interesting for us
|
|
1703
|
+
version = (match = v8.split("."))[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1])),
|
|
1704
|
+
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
|
1705
|
+
// so check `userAgent` even if `.v8` exists, but 0
|
|
1706
|
+
!version && userAgent && (!(match = userAgent.match(/Edge\/(\d+)/)) || match[1] >= 74) && (match = userAgent.match(/Chrome\/(\d+)/)) && (version = +match[1]);
|
|
1707
|
+
|
|
1708
|
+
var V8_VERSION = version, fails$4 = fails$8, $String$3 = globalThis_1.String, symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$4((function() {
|
|
1709
|
+
var symbol = Symbol("symbol detection");
|
|
1710
|
+
// Chrome 38 Symbol has incorrect toString conversion
|
|
1711
|
+
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
1712
|
+
// nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
|
|
1713
|
+
// of course, fail.
|
|
1714
|
+
return !$String$3(symbol) || !(Object(symbol) instanceof Symbol) ||
|
|
1715
|
+
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
|
1716
|
+
!Symbol.sham && V8_VERSION && V8_VERSION < 41;
|
|
1717
|
+
})), useSymbolAsUid = symbolConstructorDetection && !Symbol.sham && "symbol" == typeof Symbol.iterator, isCallable$5 = isCallable$8, isPrototypeOf$1 = objectIsPrototypeOf, $Object$2 = Object, isSymbol$2 = useSymbolAsUid ? function(it) {
|
|
1718
|
+
return "symbol" == typeof it;
|
|
1719
|
+
} : function(it) {
|
|
1720
|
+
var $Symbol = function(namespace, method) {
|
|
1721
|
+
return arguments.length < 2 ? aFunction(path$2[namespace]) || aFunction(globalThis$a[namespace]) : path$2[namespace] && path$2[namespace][method] || globalThis$a[namespace] && globalThis$a[namespace][method];
|
|
1722
|
+
}("Symbol");
|
|
1723
|
+
return isCallable$5($Symbol) && isPrototypeOf$1($Symbol.prototype, $Object$2(it));
|
|
1724
|
+
}, $String$2 = String, isCallable$4 = isCallable$8, $TypeError$5 = TypeError, aCallable$2 = function(argument) {
|
|
1725
|
+
if (isCallable$4(argument)) return argument;
|
|
1726
|
+
throw new $TypeError$5(function(argument) {
|
|
1727
|
+
try {
|
|
1728
|
+
return $String$2(argument);
|
|
1729
|
+
} catch (error) {
|
|
1730
|
+
return "Object";
|
|
1731
|
+
}
|
|
1732
|
+
}(argument) + " is not a function");
|
|
1733
|
+
}, aCallable$1 = aCallable$2, isNullOrUndefined = isNullOrUndefined$2, call$2 = functionCall, isCallable$3 = isCallable$8, isObject$4 = isObject$5, $TypeError$4 = TypeError, sharedStore = {
|
|
1734
|
+
exports: {}
|
|
1735
|
+
}, globalThis$6 = globalThis_1, defineProperty = Object.defineProperty, globalThis$5 = globalThis_1, store$1 = sharedStore.exports = globalThis$5["__core-js_shared__"] || function(key, value) {
|
|
1736
|
+
try {
|
|
1737
|
+
defineProperty(globalThis$6, key, {
|
|
1738
|
+
value: value,
|
|
1739
|
+
configurable: !0,
|
|
1740
|
+
writable: !0
|
|
1741
|
+
});
|
|
1742
|
+
} catch (error) {
|
|
1743
|
+
globalThis$6[key] = value;
|
|
1744
|
+
}
|
|
1745
|
+
return value;
|
|
1746
|
+
}("__core-js_shared__", {});
|
|
1747
|
+
|
|
1748
|
+
/* eslint-disable es/no-symbol -- required for testing */ (store$1.versions || (store$1.versions = [])).push({
|
|
1749
|
+
version: "3.43.0",
|
|
1750
|
+
mode: "pure",
|
|
1751
|
+
copyright: "© 2014-2025 Denis Pushkarev (zloirock.ru)",
|
|
1752
|
+
license: "https://github.com/zloirock/core-js/blob/v3.43.0/LICENSE",
|
|
1753
|
+
source: "https://github.com/zloirock/core-js"
|
|
1754
|
+
});
|
|
1755
|
+
|
|
1756
|
+
var key, value, store = sharedStore.exports, requireObjectCoercible$1 = requireObjectCoercible$3, $Object$1 = Object, hasOwnProperty = functionUncurryThis({}.hasOwnProperty), hasOwnProperty_1 = Object.hasOwn || function(it, key) {
|
|
1757
|
+
return hasOwnProperty($Object$1(requireObjectCoercible$1(it)), key);
|
|
1758
|
+
}, uncurryThis$3 = functionUncurryThis, id = 0, postfix = Math.random(), toString$2 = uncurryThis$3(1.1.toString), hasOwn$2 = hasOwnProperty_1, NATIVE_SYMBOL = symbolConstructorDetection, USE_SYMBOL_AS_UID = useSymbolAsUid, Symbol$1 = globalThis_1.Symbol, WellKnownSymbolsStore = store[key = "wks"] || (store[key] = value || {}), createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1.for || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || function(key) {
|
|
1759
|
+
return "Symbol(" + (void 0 === key ? "" : key) + ")_" + toString$2(++id + postfix, 36);
|
|
1760
|
+
}, wellKnownSymbol$5 = function(name) {
|
|
1761
|
+
return hasOwn$2(WellKnownSymbolsStore, name) || (WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$2(Symbol$1, name) ? Symbol$1[name] : createWellKnownSymbol("Symbol." + name)),
|
|
1762
|
+
WellKnownSymbolsStore[name];
|
|
1763
|
+
}, call$1 = functionCall, isObject$3 = isObject$5, isSymbol$1 = isSymbol$2, $TypeError$3 = TypeError, TO_PRIMITIVE = wellKnownSymbol$5("toPrimitive"), toPrimitive = function(input, pref) {
|
|
1764
|
+
if (!isObject$3(input) || isSymbol$1(input)) return input;
|
|
1765
|
+
var result, func, exoticToPrim = (func = input[TO_PRIMITIVE], isNullOrUndefined(func) ? void 0 : aCallable$1(func));
|
|
1766
|
+
if (exoticToPrim) {
|
|
1767
|
+
if (void 0 === pref && (pref = "default"), result = call$1(exoticToPrim, input, pref),
|
|
1768
|
+
!isObject$3(result) || isSymbol$1(result)) return result;
|
|
1769
|
+
throw new $TypeError$3("Can't convert object to primitive value");
|
|
1770
|
+
}
|
|
1771
|
+
return void 0 === pref && (pref = "number"), function(input, pref) {
|
|
1772
|
+
var fn, val;
|
|
1773
|
+
if ("string" === pref && isCallable$3(fn = input.toString) && !isObject$4(val = call$2(fn, input))) return val;
|
|
1774
|
+
if (isCallable$3(fn = input.valueOf) && !isObject$4(val = call$2(fn, input))) return val;
|
|
1775
|
+
if ("string" !== pref && isCallable$3(fn = input.toString) && !isObject$4(val = call$2(fn, input))) return val;
|
|
1776
|
+
throw new $TypeError$4("Can't convert object to primitive value");
|
|
1777
|
+
}(input, pref);
|
|
1778
|
+
}, isSymbol = isSymbol$2, toPropertyKey$2 = function(argument) {
|
|
1779
|
+
var key = toPrimitive(argument, "string");
|
|
1780
|
+
return isSymbol(key) ? key : key + "";
|
|
1781
|
+
}, isObject$2 = isObject$5, document$1 = globalThis_1.document, EXISTS = isObject$2(document$1) && isObject$2(document$1.createElement), ie8DomDefine = !descriptors && !fails$8((function() {
|
|
1782
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
1783
|
+
return 7 !== Object.defineProperty((it = "div", EXISTS ? document$1.createElement(it) : {}), "a", {
|
|
1784
|
+
get: function() {
|
|
1785
|
+
return 7;
|
|
1786
|
+
}
|
|
1787
|
+
}).a;
|
|
1788
|
+
var it;
|
|
1789
|
+
})), DESCRIPTORS$3 = descriptors, call = functionCall, propertyIsEnumerableModule = objectPropertyIsEnumerable, createPropertyDescriptor$1 = createPropertyDescriptor$2, toIndexedObject$1 = toIndexedObject$2, toPropertyKey$1 = toPropertyKey$2, hasOwn$1 = hasOwnProperty_1, IE8_DOM_DEFINE$1 = ie8DomDefine, $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
1790
|
+
|
|
1791
|
+
// `Object.getOwnPropertyDescriptor` method
|
|
1792
|
+
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
|
1793
|
+
objectGetOwnPropertyDescriptor.f = DESCRIPTORS$3 ? $getOwnPropertyDescriptor$1 : function(O, P) {
|
|
1794
|
+
if (O = toIndexedObject$1(O), P = toPropertyKey$1(P), IE8_DOM_DEFINE$1) try {
|
|
1795
|
+
return $getOwnPropertyDescriptor$1(O, P);
|
|
1796
|
+
} catch (error) {/* empty */}
|
|
1797
|
+
if (hasOwn$1(O, P)) return createPropertyDescriptor$1(!call(propertyIsEnumerableModule.f, O, P), O[P]);
|
|
1798
|
+
};
|
|
1799
|
+
|
|
1800
|
+
var fails$2 = fails$8, isCallable$2 = isCallable$8, replacement = /#|\.prototype\./, isForced$1 = function(feature, detection) {
|
|
1801
|
+
var value = data[normalize(feature)];
|
|
1802
|
+
return value === POLYFILL || value !== NATIVE && (isCallable$2(detection) ? fails$2(detection) : !!detection);
|
|
1803
|
+
}, normalize = isForced$1.normalize = function(string) {
|
|
1804
|
+
return String(string).replace(replacement, ".").toLowerCase();
|
|
1805
|
+
}, data = isForced$1.data = {}, NATIVE = isForced$1.NATIVE = "N", POLYFILL = isForced$1.POLYFILL = "P", isForced_1 = isForced$1, aCallable = aCallable$2, NATIVE_BIND = functionBindNative, bind$1 = functionUncurryThisClause(functionUncurryThisClause.bind), objectDefineProperty = {}, v8PrototypeDefineBug = descriptors && fails$8((function() {
|
|
1806
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
1807
|
+
return 42 !== Object.defineProperty((function() {/* empty */}), "prototype", {
|
|
1808
|
+
value: 42,
|
|
1809
|
+
writable: !1
|
|
1810
|
+
}).prototype;
|
|
1811
|
+
})), isObject$1 = isObject$5, $String$1 = String, $TypeError$2 = TypeError, DESCRIPTORS$1 = descriptors, IE8_DOM_DEFINE = ie8DomDefine, V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug, anObject = function(argument) {
|
|
1812
|
+
if (isObject$1(argument)) return argument;
|
|
1813
|
+
throw new $TypeError$2($String$1(argument) + " is not an object");
|
|
1814
|
+
}, toPropertyKey = toPropertyKey$2, $TypeError$1 = TypeError, $defineProperty = Object.defineProperty, $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
1815
|
+
|
|
1816
|
+
// `Object.defineProperty` method
|
|
1817
|
+
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
1818
|
+
objectDefineProperty.f = DESCRIPTORS$1 ? V8_PROTOTYPE_DEFINE_BUG ? function(O, P, Attributes) {
|
|
1819
|
+
if (anObject(O), P = toPropertyKey(P), anObject(Attributes), "function" == typeof O && "prototype" === P && "value" in Attributes && "writable" in Attributes && !Attributes.writable) {
|
|
1820
|
+
var current = $getOwnPropertyDescriptor(O, P);
|
|
1821
|
+
current && current.writable && (O[P] = Attributes.value, Attributes = {
|
|
1822
|
+
configurable: "configurable" in Attributes ? Attributes.configurable : current.configurable,
|
|
1823
|
+
enumerable: "enumerable" in Attributes ? Attributes.enumerable : current.enumerable,
|
|
1824
|
+
writable: !1
|
|
1825
|
+
});
|
|
1826
|
+
}
|
|
1827
|
+
return $defineProperty(O, P, Attributes);
|
|
1828
|
+
} : $defineProperty : function(O, P, Attributes) {
|
|
1829
|
+
if (anObject(O), P = toPropertyKey(P), anObject(Attributes), IE8_DOM_DEFINE) try {
|
|
1830
|
+
return $defineProperty(O, P, Attributes);
|
|
1831
|
+
} catch (error) {/* empty */}
|
|
1832
|
+
if ("get" in Attributes || "set" in Attributes) throw new $TypeError$1("Accessors not supported");
|
|
1833
|
+
return "value" in Attributes && (O[P] = Attributes.value), O;
|
|
1834
|
+
};
|
|
1835
|
+
|
|
1836
|
+
var definePropertyModule = objectDefineProperty, createPropertyDescriptor = createPropertyDescriptor$2, createNonEnumerableProperty$1 = descriptors ? function(object, key, value) {
|
|
1837
|
+
return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
|
|
1838
|
+
} : function(object, key, value) {
|
|
1839
|
+
return object[key] = value, object;
|
|
1840
|
+
}, globalThis$2 = globalThis_1, apply = functionApply, uncurryThis$1 = functionUncurryThisClause, isCallable$1 = isCallable$8, getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f, isForced = isForced_1, path$1 = path$3, bind = function(fn, that) {
|
|
1841
|
+
return aCallable(fn), void 0 === that ? fn : NATIVE_BIND ? bind$1(fn, that) : function() {
|
|
1842
|
+
return fn.apply(that, arguments);
|
|
1843
|
+
};
|
|
1844
|
+
}, createNonEnumerableProperty = createNonEnumerableProperty$1, hasOwn = hasOwnProperty_1, wrapConstructor = function(NativeConstructor) {
|
|
1845
|
+
var Wrapper = function(a, b, c) {
|
|
1846
|
+
if (this instanceof Wrapper) {
|
|
1847
|
+
switch (arguments.length) {
|
|
1848
|
+
case 0:
|
|
1849
|
+
return new NativeConstructor;
|
|
1850
|
+
|
|
1851
|
+
case 1:
|
|
1852
|
+
return new NativeConstructor(a);
|
|
1853
|
+
|
|
1854
|
+
case 2:
|
|
1855
|
+
return new NativeConstructor(a, b);
|
|
1856
|
+
}
|
|
1857
|
+
return new NativeConstructor(a, b, c);
|
|
1858
|
+
}
|
|
1859
|
+
return apply(NativeConstructor, this, arguments);
|
|
1860
|
+
};
|
|
1861
|
+
return Wrapper.prototype = NativeConstructor.prototype, Wrapper;
|
|
1862
|
+
}, _export = function(options, source) {
|
|
1863
|
+
var FORCED, USE_NATIVE, VIRTUAL_PROTOTYPE, key, sourceProperty, targetProperty, nativeProperty, resultProperty, descriptor, TARGET = options.target, GLOBAL = options.global, STATIC = options.stat, PROTO = options.proto, nativeSource = GLOBAL ? globalThis$2 : STATIC ? globalThis$2[TARGET] : globalThis$2[TARGET] && globalThis$2[TARGET].prototype, target = GLOBAL ? path$1 : path$1[TARGET] || createNonEnumerableProperty(path$1, TARGET, {})[TARGET], targetPrototype = target.prototype;
|
|
1864
|
+
for (key in source)
|
|
1865
|
+
// contains in native
|
|
1866
|
+
USE_NATIVE = !(FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? "." : "#") + key, options.forced)) && nativeSource && hasOwn(nativeSource, key),
|
|
1867
|
+
targetProperty = target[key], USE_NATIVE && (nativeProperty = options.dontCallGetSet ? (descriptor = getOwnPropertyDescriptor(nativeSource, key)) && descriptor.value : nativeSource[key]),
|
|
1868
|
+
// export native or implementation
|
|
1869
|
+
sourceProperty = USE_NATIVE && nativeProperty ? nativeProperty : source[key], (FORCED || PROTO || typeof targetProperty != typeof sourceProperty) && (
|
|
1870
|
+
// bind methods to global for calling from export context
|
|
1871
|
+
resultProperty = options.bind && USE_NATIVE ? bind(sourceProperty, globalThis$2) : options.wrap && USE_NATIVE ? wrapConstructor(sourceProperty) : PROTO && isCallable$1(sourceProperty) ? uncurryThis$1(sourceProperty) : sourceProperty,
|
|
1872
|
+
// add a flag to not completely full polyfills
|
|
1873
|
+
(options.sham || sourceProperty && sourceProperty.sham || targetProperty && targetProperty.sham) && createNonEnumerableProperty(resultProperty, "sham", !0),
|
|
1874
|
+
createNonEnumerableProperty(target, key, resultProperty), PROTO && (hasOwn(path$1, VIRTUAL_PROTOTYPE = TARGET + "Prototype") || createNonEnumerableProperty(path$1, VIRTUAL_PROTOTYPE, {}),
|
|
1875
|
+
// export virtual prototype methods
|
|
1876
|
+
createNonEnumerableProperty(path$1[VIRTUAL_PROTOTYPE], key, sourceProperty),
|
|
1877
|
+
// export real prototype methods
|
|
1878
|
+
options.real && targetPrototype && (FORCED || !targetPrototype[key]) && createNonEnumerableProperty(targetPrototype, key, sourceProperty)));
|
|
1879
|
+
}, ceil = Math.ceil, floor = Math.floor, trunc = Math.trunc || function(x) {
|
|
1880
|
+
var n = +x;
|
|
1881
|
+
return (n > 0 ? floor : ceil)(n);
|
|
1882
|
+
}, toIntegerOrInfinity$2 = function(argument) {
|
|
1883
|
+
var number = +argument;
|
|
1884
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
1885
|
+
return number != number || 0 === number ? 0 : trunc(number);
|
|
1886
|
+
}, toIntegerOrInfinity$1 = toIntegerOrInfinity$2, max = Math.max, min$1 = Math.min, toIntegerOrInfinity = toIntegerOrInfinity$2, min = Math.min, toIndexedObject = toIndexedObject$2, lengthOfArrayLike = function(obj) {
|
|
1887
|
+
return argument = obj.length, (len = toIntegerOrInfinity(argument)) > 0 ? min(len, 9007199254740991) : 0;
|
|
1888
|
+
var argument, len;
|
|
1889
|
+
}, createMethod = function(IS_INCLUDES) {
|
|
1890
|
+
return function($this, el, fromIndex) {
|
|
1891
|
+
var O = toIndexedObject($this), length = lengthOfArrayLike(O);
|
|
1892
|
+
if (0 === length) return !IS_INCLUDES && -1;
|
|
1893
|
+
var value, index = function(index, length) {
|
|
1894
|
+
var integer = toIntegerOrInfinity$1(index);
|
|
1895
|
+
return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
|
|
1896
|
+
}(fromIndex, length);
|
|
1897
|
+
// Array#includes uses SameValueZero equality algorithm
|
|
1898
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
1899
|
+
if (IS_INCLUDES && el != el) {
|
|
1900
|
+
for (;length > index; )
|
|
1901
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
1902
|
+
if ((value = O[index++]) != value) return !0;
|
|
1903
|
+
// Array#indexOf ignores holes, Array#includes - not
|
|
1904
|
+
} else for (;length > index; index++) if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
|
1905
|
+
return !IS_INCLUDES && -1;
|
|
1906
|
+
};
|
|
1907
|
+
}, $includes = [ createMethod(!0), createMethod(!1) ][0];
|
|
1609
1908
|
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
})
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
const checkboxClass = `c-checkbox ${validationClass} ${disabled ? "is-disabled" : ""} ${indeterminate ? "c-checkbox--mixed" : ""} ${glass ? "c-checkbox--glass" : ""} ${className}`.trim(), inputElement = jsx("input", {
|
|
1623
|
-
ref: localRef,
|
|
1624
|
-
type: "checkbox",
|
|
1625
|
-
className: "c-checkbox__input",
|
|
1626
|
-
checked: checked,
|
|
1627
|
-
onChange: onChange,
|
|
1628
|
-
onClick: onClick,
|
|
1629
|
-
disabled: disabled,
|
|
1630
|
-
required: required,
|
|
1631
|
-
id: id,
|
|
1632
|
-
name: name,
|
|
1633
|
-
value: value,
|
|
1634
|
-
"aria-label": label ? void 0 : ariaLabel,
|
|
1635
|
-
"aria-describedby": ariaDescribedBy,
|
|
1636
|
-
"aria-invalid": invalid,
|
|
1637
|
-
...props
|
|
1638
|
-
});
|
|
1639
|
-
let content;
|
|
1640
|
-
if (content = id && label ? jsxs("div", {
|
|
1641
|
-
className: checkboxClass,
|
|
1642
|
-
style: style,
|
|
1643
|
-
children: [ inputElement, jsx("label", {
|
|
1644
|
-
className: "c-checkbox__label",
|
|
1645
|
-
htmlFor: id,
|
|
1646
|
-
children: label
|
|
1647
|
-
}) ]
|
|
1648
|
-
}) : label ? jsxs("label", {
|
|
1649
|
-
className: checkboxClass,
|
|
1650
|
-
style: style,
|
|
1651
|
-
children: [ inputElement, jsx("span", {
|
|
1652
|
-
className: "c-checkbox__label",
|
|
1653
|
-
children: label
|
|
1654
|
-
}) ]
|
|
1655
|
-
}) : jsx("div", {
|
|
1656
|
-
className: checkboxClass,
|
|
1657
|
-
style: style,
|
|
1658
|
-
children: inputElement
|
|
1659
|
-
}), glass) {
|
|
1660
|
-
const defaultGlassProps = {
|
|
1661
|
-
displacementScale: 40,
|
|
1662
|
-
blurAmount: 1,
|
|
1663
|
-
saturation: 160,
|
|
1664
|
-
aberrationIntensity: .3,
|
|
1665
|
-
borderRadius: 6,
|
|
1666
|
-
mode: "shader"
|
|
1667
|
-
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
1668
|
-
...defaultGlassProps,
|
|
1669
|
-
...glass
|
|
1670
|
-
};
|
|
1671
|
-
return jsx(AtomixGlass, {
|
|
1672
|
-
...glassProps,
|
|
1673
|
-
children: content
|
|
1674
|
-
});
|
|
1909
|
+
// `Array.prototype.includes` method
|
|
1910
|
+
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
1911
|
+
_export({
|
|
1912
|
+
target: "Array",
|
|
1913
|
+
proto: !0,
|
|
1914
|
+
forced: fails$8((function() {
|
|
1915
|
+
// eslint-disable-next-line es/no-array-prototype-includes -- detection
|
|
1916
|
+
return !Array(1).includes();
|
|
1917
|
+
}))
|
|
1918
|
+
}, {
|
|
1919
|
+
includes: function(el /* , fromIndex = 0 */) {
|
|
1920
|
+
return $includes(this, el, arguments.length > 1 ? arguments[1] : void 0);
|
|
1675
1921
|
}
|
|
1676
|
-
|
|
1677
|
-
})));
|
|
1922
|
+
});
|
|
1678
1923
|
|
|
1679
|
-
|
|
1924
|
+
var globalThis$1 = globalThis_1, path = path$3, getBuiltInPrototypeMethod$2 = function(CONSTRUCTOR, METHOD) {
|
|
1925
|
+
var Namespace = path[CONSTRUCTOR + "Prototype"], pureMethod = Namespace && Namespace[METHOD];
|
|
1926
|
+
if (pureMethod) return pureMethod;
|
|
1927
|
+
var NativeConstructor = globalThis$1[CONSTRUCTOR], NativePrototype = NativeConstructor && NativeConstructor.prototype;
|
|
1928
|
+
return NativePrototype && NativePrototype[METHOD];
|
|
1929
|
+
}, includes$4 = getBuiltInPrototypeMethod$2("Array", "includes"), isObject = isObject$5, classof$2 = classofRaw$2, MATCH$1 = wellKnownSymbol$5("match"), $TypeError = TypeError, test = {};
|
|
1680
1930
|
|
|
1681
|
-
|
|
1682
|
-
* Form - A component for creating form layouts
|
|
1683
|
-
*/
|
|
1684
|
-
const Form = ({children: children, onSubmit: onSubmit, onReset: onReset, className: className = "", style: style, disabled: disabled = !1, id: id, method: method = "post", encType: encType, noValidate: noValidate = !1, autoComplete: autoComplete = "on"}) => {
|
|
1685
|
-
const {generateFormClass: generateFormClass, handleSubmit: handleSubmit, handleReset: handleReset} =
|
|
1686
|
-
/**
|
|
1687
|
-
* Form state and functionality
|
|
1688
|
-
* @param initialProps - Initial form properties
|
|
1689
|
-
* @returns Form state and methods
|
|
1690
|
-
*/
|
|
1691
|
-
function(initialProps) {
|
|
1692
|
-
// Default form properties
|
|
1693
|
-
const defaultProps = {
|
|
1694
|
-
disabled: !1,
|
|
1695
|
-
...initialProps
|
|
1696
|
-
};
|
|
1697
|
-
/**
|
|
1698
|
-
* Generate form class based on properties
|
|
1699
|
-
* @param props - Form properties
|
|
1700
|
-
* @returns Class string
|
|
1701
|
-
*/ return {
|
|
1702
|
-
defaultProps: defaultProps,
|
|
1703
|
-
generateFormClass: props => {
|
|
1704
|
-
const {disabled: disabled = defaultProps.disabled, className: className = ""} = props;
|
|
1705
|
-
return `${FORM_CLASSES_BASE} ${disabled ? FORM_CLASSES_DISABLED : ""} ${className}`.trim();
|
|
1706
|
-
},
|
|
1707
|
-
handleSubmit: handler => event => {
|
|
1708
|
-
event.preventDefault(), !defaultProps.disabled && handler && handler(event);
|
|
1709
|
-
},
|
|
1710
|
-
handleReset: handler => event => {
|
|
1711
|
-
!defaultProps.disabled && handler && handler(event);
|
|
1712
|
-
}
|
|
1713
|
-
};
|
|
1714
|
-
}({
|
|
1715
|
-
disabled: disabled
|
|
1716
|
-
}), formClass = generateFormClass({
|
|
1717
|
-
className: className,
|
|
1718
|
-
disabled: disabled
|
|
1719
|
-
});
|
|
1720
|
-
return jsx("form", {
|
|
1721
|
-
id: id,
|
|
1722
|
-
className: formClass,
|
|
1723
|
-
style: style,
|
|
1724
|
-
onSubmit: handleSubmit(onSubmit),
|
|
1725
|
-
onReset: handleReset(onReset),
|
|
1726
|
-
method: method,
|
|
1727
|
-
encType: encType,
|
|
1728
|
-
noValidate: noValidate,
|
|
1729
|
-
autoComplete: autoComplete,
|
|
1730
|
-
children: children
|
|
1731
|
-
});
|
|
1732
|
-
};
|
|
1931
|
+
test[wellKnownSymbol$5("toStringTag")] = "z";
|
|
1733
1932
|
|
|
1734
|
-
|
|
1933
|
+
var TO_STRING_TAG_SUPPORT = "[object z]" === String(test), isCallable = isCallable$8, classofRaw = classofRaw$2, TO_STRING_TAG = wellKnownSymbol$5("toStringTag"), $Object = Object, CORRECT_ARGUMENTS = "Arguments" === classofRaw(function() {
|
|
1934
|
+
return arguments;
|
|
1935
|
+
}()), classof = TO_STRING_TAG_SUPPORT ? classofRaw : function(it) {
|
|
1936
|
+
var O, tag, result;
|
|
1937
|
+
return void 0 === it ? "Undefined" : null === it ? "Null" : "string" == typeof (tag = function(it, key) {
|
|
1938
|
+
try {
|
|
1939
|
+
return it[key];
|
|
1940
|
+
} catch (error) {/* empty */}
|
|
1941
|
+
}(O = $Object(it), TO_STRING_TAG)) ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : "Object" === (result = classofRaw(O)) && isCallable(O.callee) ? "Arguments" : result;
|
|
1942
|
+
}, $String = String, MATCH = wellKnownSymbol$5("match"), $ = _export, notARegExp = function(it) {
|
|
1943
|
+
if (function(it) {
|
|
1944
|
+
var isRegExp;
|
|
1945
|
+
return isObject(it) && (void 0 !== (isRegExp = it[MATCH$1]) ? !!isRegExp : "RegExp" === classof$2(it));
|
|
1946
|
+
}(it)) throw new $TypeError("The method doesn't accept regular expressions");
|
|
1947
|
+
return it;
|
|
1948
|
+
}, requireObjectCoercible = requireObjectCoercible$3, toString = function(argument) {
|
|
1949
|
+
if ("Symbol" === classof(argument)) throw new TypeError("Cannot convert a Symbol value to a string");
|
|
1950
|
+
return $String(argument);
|
|
1951
|
+
}, stringIndexOf = functionUncurryThis("".indexOf);
|
|
1952
|
+
|
|
1953
|
+
// `String.prototype.includes` method
|
|
1954
|
+
// https://tc39.es/ecma262/#sec-string.prototype.includes
|
|
1955
|
+
$({
|
|
1956
|
+
target: "String",
|
|
1957
|
+
proto: !0,
|
|
1958
|
+
forced: !function(METHOD_NAME) {
|
|
1959
|
+
var regexp = /./;
|
|
1960
|
+
try {
|
|
1961
|
+
"/./"[METHOD_NAME](regexp);
|
|
1962
|
+
} catch (error1) {
|
|
1963
|
+
try {
|
|
1964
|
+
return regexp[MATCH] = !1, "/./"[METHOD_NAME](regexp);
|
|
1965
|
+
} catch (error2) {/* empty */}
|
|
1966
|
+
}
|
|
1967
|
+
return !1;
|
|
1968
|
+
}("includes")
|
|
1969
|
+
}, {
|
|
1970
|
+
includes: function(searchString /* , position = 0 */) {
|
|
1971
|
+
return !!~stringIndexOf(toString(requireObjectCoercible(this)), toString(notARegExp(searchString)), arguments.length > 1 ? arguments[1] : void 0);
|
|
1972
|
+
}
|
|
1973
|
+
});
|
|
1974
|
+
|
|
1975
|
+
var includes$3 = getBuiltInPrototypeMethod$2("String", "includes"), isPrototypeOf = objectIsPrototypeOf, arrayMethod = includes$4, stringMethod = includes$3, ArrayPrototype = Array.prototype, StringPrototype = String.prototype;
|
|
1976
|
+
|
|
1977
|
+
const _includesInstanceProperty = getDefaultExportFromCjs((function(it) {
|
|
1978
|
+
var own = it.includes;
|
|
1979
|
+
return it === ArrayPrototype || isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.includes ? arrayMethod : "string" == typeof it || it === StringPrototype || isPrototypeOf(StringPrototype, it) && own === StringPrototype.includes ? stringMethod : own;
|
|
1980
|
+
}));
|
|
1735
1981
|
|
|
1736
1982
|
/**
|
|
1737
|
-
*
|
|
1983
|
+
* Get GPU memory info if available (Chrome DevTools only)
|
|
1738
1984
|
*/
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
*
|
|
1743
|
-
*
|
|
1744
|
-
*
|
|
1985
|
+
/**
|
|
1986
|
+
* PerformanceDashboard - Real-time performance monitoring overlay
|
|
1987
|
+
*
|
|
1988
|
+
* Displays:
|
|
1989
|
+
* - Current FPS with color coding
|
|
1990
|
+
* - Frame time statistics
|
|
1991
|
+
* - Quality level indicator
|
|
1992
|
+
* - GPU memory usage (if available)
|
|
1993
|
+
* - Auto-scaling status
|
|
1745
1994
|
*/
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1995
|
+
const PerformanceDashboard = ({metrics: metrics, isVisible: isVisible = !0, onClose: onClose}) => {
|
|
1996
|
+
// Get color for FPS display
|
|
1997
|
+
const getFpsColor = fps => fps >= 58 ? "#4ade80" : // Green - good
|
|
1998
|
+
fps >= 45 ? "#fbbf24" : "#ef4444" // Red - critical
|
|
1999
|
+
, dashboardStyle = useMemo((() => ({
|
|
2000
|
+
position: "fixed",
|
|
2001
|
+
top: "16px",
|
|
2002
|
+
right: "16px",
|
|
2003
|
+
padding: "12px 16px",
|
|
2004
|
+
backgroundColor: "rgba(17, 24, 39, 0.95)",
|
|
2005
|
+
borderRadius: "8px",
|
|
2006
|
+
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.15)",
|
|
2007
|
+
fontFamily: "monospace",
|
|
2008
|
+
fontSize: "12px",
|
|
2009
|
+
color: "#fff",
|
|
2010
|
+
zIndex: 9999,
|
|
2011
|
+
minWidth: "200px",
|
|
2012
|
+
backdropFilter: "blur(8px)",
|
|
2013
|
+
border: "1px solid rgba(255, 255, 255, 0.1)",
|
|
2014
|
+
transition: "opacity 0.3s ease",
|
|
2015
|
+
opacity: isVisible ? 1 : 0,
|
|
2016
|
+
pointerEvents: isVisible ? "auto" : "none"
|
|
2017
|
+
})), [ isVisible ]), headerStyle = useMemo((() => ({
|
|
2018
|
+
display: "flex",
|
|
2019
|
+
justifyContent: "space-between",
|
|
2020
|
+
alignItems: "center",
|
|
2021
|
+
marginBottom: "8px",
|
|
2022
|
+
paddingBottom: "8px",
|
|
2023
|
+
borderBottom: "1px solid rgba(255, 255, 255, 0.1)"
|
|
2024
|
+
})), []), titleStyle = useMemo((() => ({
|
|
2025
|
+
fontWeight: "bold",
|
|
2026
|
+
fontSize: "13px",
|
|
2027
|
+
color: "#fff"
|
|
2028
|
+
})), []), closeButtonStyle = useMemo((() => ({
|
|
2029
|
+
background: "transparent",
|
|
2030
|
+
border: "none",
|
|
2031
|
+
color: "#9ca3af",
|
|
2032
|
+
cursor: "pointer",
|
|
2033
|
+
fontSize: "16px",
|
|
2034
|
+
padding: "0",
|
|
2035
|
+
lineHeight: "1"
|
|
2036
|
+
})), []), metricRowStyle = useMemo((() => ({
|
|
2037
|
+
display: "flex",
|
|
2038
|
+
justifyContent: "space-between",
|
|
2039
|
+
alignItems: "center",
|
|
2040
|
+
marginBottom: "6px"
|
|
2041
|
+
})), []), labelStyle = useMemo((() => ({
|
|
2042
|
+
color: "#9ca3af",
|
|
2043
|
+
marginRight: "12px"
|
|
2044
|
+
})), []), valueStyle = useMemo((() => ({
|
|
2045
|
+
fontWeight: "bold"
|
|
2046
|
+
})), []);
|
|
2047
|
+
// Get quality level badge color
|
|
2048
|
+
return isVisible ? jsxs("div", {
|
|
2049
|
+
style: dashboardStyle,
|
|
2050
|
+
children: [ jsxs("div", {
|
|
2051
|
+
style: headerStyle,
|
|
2052
|
+
children: [ jsx("span", {
|
|
2053
|
+
style: titleStyle,
|
|
2054
|
+
children: "Performance Monitor"
|
|
2055
|
+
}), onClose && jsx("button", {
|
|
2056
|
+
style: closeButtonStyle,
|
|
2057
|
+
onClick: onClose,
|
|
2058
|
+
"aria-label": "Close performance dashboard",
|
|
2059
|
+
children: "×"
|
|
2060
|
+
}) ]
|
|
2061
|
+
}), jsxs("div", {
|
|
2062
|
+
style: metricRowStyle,
|
|
2063
|
+
children: [ jsx("span", {
|
|
2064
|
+
style: labelStyle,
|
|
2065
|
+
children: "FPS"
|
|
2066
|
+
}), jsx("span", {
|
|
2067
|
+
style: {
|
|
2068
|
+
...valueStyle,
|
|
2069
|
+
color: getFpsColor(metrics.fps)
|
|
2070
|
+
},
|
|
2071
|
+
children: Math.round(metrics.fps)
|
|
2072
|
+
}) ]
|
|
2073
|
+
}), jsxs("div", {
|
|
2074
|
+
style: metricRowStyle,
|
|
2075
|
+
children: [ jsx("span", {
|
|
2076
|
+
style: labelStyle,
|
|
2077
|
+
children: "Frame Time"
|
|
2078
|
+
}), jsxs("span", {
|
|
2079
|
+
style: valueStyle,
|
|
2080
|
+
children: [ metrics.frameTime.toFixed(2), "ms" ]
|
|
2081
|
+
}) ]
|
|
2082
|
+
}), jsxs("div", {
|
|
2083
|
+
style: metricRowStyle,
|
|
2084
|
+
children: [ jsx("span", {
|
|
2085
|
+
style: labelStyle,
|
|
2086
|
+
children: "Quality"
|
|
2087
|
+
}), jsx("span", {
|
|
2088
|
+
style: {
|
|
2089
|
+
...valueStyle,
|
|
2090
|
+
color: (quality => {
|
|
2091
|
+
switch (quality) {
|
|
2092
|
+
case "high":
|
|
2093
|
+
return "#4ade80";
|
|
2094
|
+
|
|
2095
|
+
case "medium":
|
|
2096
|
+
return "#fbbf24";
|
|
2097
|
+
|
|
2098
|
+
case "low":
|
|
2099
|
+
return "#ef4444";
|
|
2100
|
+
|
|
2101
|
+
default:
|
|
2102
|
+
return "#9ca3af";
|
|
2103
|
+
}
|
|
2104
|
+
})(metrics.qualityLevel),
|
|
2105
|
+
textTransform: "uppercase",
|
|
2106
|
+
fontSize: "11px"
|
|
2107
|
+
},
|
|
2108
|
+
children: metrics.qualityLevel
|
|
2109
|
+
}) ]
|
|
2110
|
+
}), metrics.gpuMemory && jsxs("div", {
|
|
2111
|
+
style: metricRowStyle,
|
|
2112
|
+
children: [ jsx("span", {
|
|
2113
|
+
style: labelStyle,
|
|
2114
|
+
children: "GPU Memory"
|
|
2115
|
+
}), jsxs("span", {
|
|
2116
|
+
style: valueStyle,
|
|
2117
|
+
children: [ "~", Math.round(metrics.gpuMemory / 1024), "MB" ]
|
|
2118
|
+
}) ]
|
|
2119
|
+
}), metrics.isAutoScaling && jsx("div", {
|
|
2120
|
+
style: {
|
|
2121
|
+
marginTop: "8px",
|
|
2122
|
+
paddingTop: "8px",
|
|
2123
|
+
borderTop: "1px solid rgba(255, 255, 255, 0.1)",
|
|
2124
|
+
fontSize: "10px",
|
|
2125
|
+
color: "#6b7280",
|
|
2126
|
+
textAlign: "center"
|
|
2127
|
+
},
|
|
2128
|
+
children: "Auto-scaling active"
|
|
2129
|
+
}), jsxs("div", {
|
|
2130
|
+
style: {
|
|
2131
|
+
marginTop: "8px",
|
|
2132
|
+
paddingTop: "8px",
|
|
2133
|
+
borderTop: "1px solid rgba(255, 255, 255, 0.1)",
|
|
2134
|
+
display: "flex",
|
|
2135
|
+
alignItems: "center",
|
|
2136
|
+
gap: "6px"
|
|
2137
|
+
},
|
|
2138
|
+
children: [ jsx("div", {
|
|
2139
|
+
style: {
|
|
2140
|
+
width: "8px",
|
|
2141
|
+
height: "8px",
|
|
2142
|
+
borderRadius: "50%",
|
|
2143
|
+
backgroundColor: getFpsColor(metrics.fps),
|
|
2144
|
+
animation: metrics.fps < 45 ? "pulse 1s infinite" : "none"
|
|
2145
|
+
}
|
|
2146
|
+
}), jsx("span", {
|
|
2147
|
+
style: {
|
|
2148
|
+
fontSize: "10px",
|
|
2149
|
+
color: metrics.fps >= 58 ? "#4ade80" : metrics.fps >= 45 ? "#fbbf24" : "#ef4444"
|
|
2150
|
+
},
|
|
2151
|
+
children: metrics.fps >= 58 ? "Optimal" : metrics.fps >= 45 ? "Warning" : "Critical"
|
|
1787
2152
|
}) ]
|
|
1788
|
-
}), jsx("div", {
|
|
1789
|
-
className: "c-form-group__field",
|
|
1790
|
-
children: children
|
|
1791
|
-
}), helperText && jsx("div", {
|
|
1792
|
-
className: "c-form-group__helper",
|
|
1793
|
-
children: helperText
|
|
1794
2153
|
}) ]
|
|
1795
|
-
});
|
|
2154
|
+
}) : null;
|
|
1796
2155
|
};
|
|
1797
2156
|
|
|
1798
|
-
|
|
2157
|
+
// Add pulse animation for critical FPS
|
|
2158
|
+
if ("undefined" != typeof document) {
|
|
2159
|
+
const styleSheet = document.createElement("style");
|
|
2160
|
+
styleSheet.textContent = "\n @keyframes pulse {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0.5; }\n }\n ",
|
|
2161
|
+
document.head.appendChild(styleSheet);
|
|
2162
|
+
}
|
|
1799
2163
|
|
|
1800
2164
|
/**
|
|
1801
|
-
*
|
|
2165
|
+
* Mobile optimization presets
|
|
2166
|
+
*
|
|
2167
|
+
* These presets adjust glass effect parameters based on device performance tier
|
|
2168
|
+
* to ensure smooth animations and responsive interactions.
|
|
1802
2169
|
*/
|
|
1803
|
-
|
|
1804
|
-
|
|
2170
|
+
/**
|
|
2171
|
+
* Performance preset - Maximum FPS, reduced quality
|
|
2172
|
+
* Best for low-end devices or when battery saving is priority
|
|
2173
|
+
*/ const PERFORMANCE_PRESET = {
|
|
2174
|
+
distortionOctaves: 2,
|
|
2175
|
+
// Minimal FBM layers
|
|
2176
|
+
displacementScale: 50,
|
|
2177
|
+
// Subtle displacement
|
|
2178
|
+
blurAmount: 5,
|
|
2179
|
+
// Light blur
|
|
2180
|
+
saturation: 80,
|
|
2181
|
+
// Reduced saturation
|
|
2182
|
+
aberrationIntensity: .3,
|
|
2183
|
+
// Minimal chromatic aberration
|
|
2184
|
+
animationSpeed: .8,
|
|
2185
|
+
// Slightly slower for performance
|
|
2186
|
+
chromaticIntensity: .3,
|
|
2187
|
+
// Low chromatic effect
|
|
2188
|
+
distortionLacunarity: 1.5,
|
|
2189
|
+
// Simpler noise pattern
|
|
2190
|
+
distortionGain: .3
|
|
2191
|
+
}, BALANCED_PRESET = {
|
|
2192
|
+
distortionOctaves: 3,
|
|
2193
|
+
// Moderate FBM layers
|
|
2194
|
+
displacementScale: 75,
|
|
2195
|
+
// Medium displacement
|
|
2196
|
+
blurAmount: 8,
|
|
2197
|
+
// Moderate blur
|
|
2198
|
+
saturation: 90,
|
|
2199
|
+
// Near-full saturation
|
|
2200
|
+
aberrationIntensity: .5,
|
|
2201
|
+
// Moderate chromatic aberration
|
|
2202
|
+
animationSpeed: 1,
|
|
2203
|
+
// Normal speed
|
|
2204
|
+
chromaticIntensity: .5,
|
|
2205
|
+
// Moderate chromatic effect
|
|
2206
|
+
distortionLacunarity: 2,
|
|
2207
|
+
// Standard noise pattern
|
|
2208
|
+
distortionGain: .4
|
|
2209
|
+
}, QUALITY_PRESET = {
|
|
2210
|
+
distortionOctaves: 4,
|
|
2211
|
+
// More FBM layers for detail
|
|
2212
|
+
displacementScale: 100,
|
|
2213
|
+
// Stronger displacement
|
|
2214
|
+
blurAmount: 12,
|
|
2215
|
+
// Smoother blur
|
|
2216
|
+
saturation: 100,
|
|
2217
|
+
// Full saturation
|
|
2218
|
+
aberrationIntensity: .7,
|
|
2219
|
+
// Pronounced chromatic aberration
|
|
2220
|
+
animationSpeed: 1.2,
|
|
2221
|
+
// Slightly faster for drama
|
|
2222
|
+
chromaticIntensity: .7,
|
|
2223
|
+
// Strong chromatic effect
|
|
2224
|
+
distortionLacunarity: 2.2,
|
|
2225
|
+
// Richer noise pattern
|
|
2226
|
+
distortionGain: .5
|
|
2227
|
+
}, MOBILE_OPTIMIZED_BREAKPOINTS = {
|
|
2228
|
+
/** Desktop - Full quality */
|
|
2229
|
+
desktop: {
|
|
2230
|
+
minWidth: 1024,
|
|
2231
|
+
params: {
|
|
2232
|
+
distortionOctaves: 6,
|
|
2233
|
+
displacementScale: 150,
|
|
2234
|
+
blurAmount: 15,
|
|
2235
|
+
saturation: 100,
|
|
2236
|
+
aberrationIntensity: 1,
|
|
2237
|
+
animationSpeed: 1,
|
|
2238
|
+
chromaticIntensity: 1,
|
|
2239
|
+
distortionLacunarity: 2.5,
|
|
2240
|
+
distortionGain: .6
|
|
2241
|
+
}
|
|
2242
|
+
},
|
|
2243
|
+
/** Laptop - High quality */
|
|
2244
|
+
laptop: {
|
|
2245
|
+
minWidth: 768,
|
|
2246
|
+
params: {
|
|
2247
|
+
...QUALITY_PRESET,
|
|
2248
|
+
distortionOctaves: 5,
|
|
2249
|
+
displacementScale: 120
|
|
2250
|
+
}
|
|
2251
|
+
},
|
|
2252
|
+
/** Tablet - Balanced quality */
|
|
2253
|
+
tablet: {
|
|
2254
|
+
minWidth: 640,
|
|
2255
|
+
params: {
|
|
2256
|
+
...BALANCED_PRESET,
|
|
2257
|
+
distortionOctaves: 4,
|
|
2258
|
+
displacementScale: 90
|
|
2259
|
+
}
|
|
2260
|
+
},
|
|
2261
|
+
/** Mobile - Performance optimized */
|
|
2262
|
+
mobile: {
|
|
2263
|
+
maxWidth: 639,
|
|
2264
|
+
params: {
|
|
2265
|
+
...PERFORMANCE_PRESET,
|
|
2266
|
+
distortionOctaves: 3,
|
|
2267
|
+
displacementScale: 75,
|
|
2268
|
+
blurAmount: 6
|
|
2269
|
+
}
|
|
2270
|
+
},
|
|
2271
|
+
/** Small mobile - Maximum performance */
|
|
2272
|
+
mobileSmall: {
|
|
2273
|
+
maxWidth: 375,
|
|
2274
|
+
params: {
|
|
2275
|
+
...PERFORMANCE_PRESET,
|
|
2276
|
+
distortionOctaves: 2,
|
|
2277
|
+
displacementScale: 50,
|
|
2278
|
+
blurAmount: 4,
|
|
2279
|
+
saturation: 70
|
|
2280
|
+
}
|
|
2281
|
+
}
|
|
2282
|
+
};
|
|
2283
|
+
|
|
2284
|
+
/**
|
|
2285
|
+
* Balanced preset - Good quality with reasonable performance
|
|
2286
|
+
* Default preset for most mobile devices
|
|
2287
|
+
*/
|
|
2288
|
+
/**
|
|
2289
|
+
* AtomixGlass - A high-performance glass morphism component with liquid distortion effects
|
|
2290
|
+
*
|
|
2291
|
+
* Features:
|
|
2292
|
+
* - Hardware-accelerated glass effects with SVG filters
|
|
2293
|
+
* - Mouse-responsive liquid distortion
|
|
2294
|
+
* - Dynamic border-radius extraction from children CSS properties
|
|
2295
|
+
* - Automatic light/dark theme detection via overLight prop
|
|
2296
|
+
* - Accessibility and performance optimizations
|
|
2297
|
+
* - Multiple displacement modes (standard, polar, prominent, shader)
|
|
2298
|
+
* - Design token integration for consistent theming
|
|
2299
|
+
* - Focus ring support for keyboard navigation
|
|
2300
|
+
* - Responsive breakpoints for mobile optimization
|
|
2301
|
+
* - Enhanced ARIA attributes for screen readers
|
|
2302
|
+
* - Time-based animation system with FBM distortion
|
|
2303
|
+
* - Device preset optimization for performance/quality balance
|
|
2304
|
+
*
|
|
2305
|
+
* Design System Compliance:
|
|
2306
|
+
* - Uses design tokens for opacity, spacing, and colors
|
|
2307
|
+
* - Follows BEM methodology for class naming
|
|
2308
|
+
* - Implements focus-ring mixin for accessibility
|
|
2309
|
+
* - Supports reduced motion and high contrast preferences
|
|
2310
|
+
*
|
|
2311
|
+
* @example
|
|
2312
|
+
* // Basic usage with dynamic border-radius extraction
|
|
2313
|
+
* <AtomixGlass>
|
|
2314
|
+
* <div style={{ borderRadius: '12px' }}>Content with 12px radius</div>
|
|
2315
|
+
* </AtomixGlass>
|
|
2316
|
+
*
|
|
2317
|
+
* @example
|
|
2318
|
+
* // Manual border-radius override
|
|
2319
|
+
* <AtomixGlass borderRadius={20}>
|
|
2320
|
+
* <div>Content with 20px glass radius</div>
|
|
2321
|
+
* </AtomixGlass>
|
|
2322
|
+
*
|
|
2323
|
+
* @example
|
|
2324
|
+
* // Interactive glass with click handler
|
|
2325
|
+
* <AtomixGlass onClick={() => console.log('Clicked')} aria-label="Glass card">
|
|
2326
|
+
* <div>Clickable content</div>
|
|
2327
|
+
* </AtomixGlass>
|
|
2328
|
+
*
|
|
2329
|
+
* @example
|
|
2330
|
+
* // OverLight - Boolean mode (explicit control)
|
|
2331
|
+
* <AtomixGlass overLight={true}>
|
|
2332
|
+
* <div>Content on light background</div>
|
|
2333
|
+
* </AtomixGlass>
|
|
2334
|
+
*
|
|
2335
|
+
* @example
|
|
2336
|
+
* // OverLight - Auto-detection mode
|
|
2337
|
+
* <AtomixGlass overLight="auto">
|
|
2338
|
+
* <div>Content with auto-detected background</div>
|
|
2339
|
+
* </AtomixGlass>
|
|
2340
|
+
*
|
|
2341
|
+
* @example
|
|
2342
|
+
* // OverLight - Object config with custom settings
|
|
2343
|
+
* <AtomixGlass
|
|
2344
|
+
* overLight={{
|
|
2345
|
+
* threshold: 0.8,
|
|
2346
|
+
* opacity: 0.6,
|
|
2347
|
+
* contrast: 1.8,
|
|
2348
|
+
* brightness: 1.0,
|
|
2349
|
+
* saturationBoost: 1.5
|
|
2350
|
+
* }}
|
|
2351
|
+
* >
|
|
2352
|
+
* <div>Content with custom overLight config</div>
|
|
2353
|
+
* </AtomixGlass>
|
|
2354
|
+
*
|
|
2355
|
+
* @example
|
|
2356
|
+
* // Debug mode for overLight detection
|
|
2357
|
+
* <AtomixGlass overLight="auto" debugOverLight={true}>
|
|
2358
|
+
* <div>Content with debug logging enabled</div>
|
|
2359
|
+
* </AtomixGlass>
|
|
2360
|
+
*
|
|
2361
|
+
* @example
|
|
2362
|
+
* // Performance-optimized for mobile devices
|
|
2363
|
+
* <AtomixGlass devicePreset="performance" disableResponsiveBreakpoints={false}>
|
|
2364
|
+
* <div>Mobile-optimized glass effect</div>
|
|
2365
|
+
* </AtomixGlass>
|
|
2366
|
+
*/
|
|
2367
|
+
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, debugOverLight: debugOverLight = !1, height: height, width: width, withTimeAnimation: withTimeAnimation = !1, animationSpeed: animationSpeed = 1, withMultiLayerDistortion: withMultiLayerDistortion = !1, distortionOctaves: distortionOctaves = 3, distortionLacunarity: distortionLacunarity = 2, distortionGain: distortionGain = .5, distortionQuality: distortionQuality = "medium", devicePreset: devicePreset = "balanced", disableResponsiveBreakpoints: disableResponsiveBreakpoints = !1, ...rest}) {
|
|
2368
|
+
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, getShaderTime: getShaderTime, applyTimeBasedDistortion: applyTimeBasedDistortion, handleMouseEnter: handleMouseEnter, handleMouseLeave: handleMouseLeave, handleMouseDown: handleMouseDown, handleMouseUp: handleMouseUp, handleKeyDown: handleKeyDown} = useAtomixGlass({
|
|
2369
|
+
glassRef: glassRef,
|
|
2370
|
+
contentRef: contentRef,
|
|
2371
|
+
borderRadius: borderRadius,
|
|
2372
|
+
globalMousePosition: externalGlobalMousePosition,
|
|
2373
|
+
mouseOffset: externalMouseOffset,
|
|
2374
|
+
mouseContainer: mouseContainer,
|
|
2375
|
+
overLight: overLight,
|
|
2376
|
+
reducedMotion: reducedMotion,
|
|
2377
|
+
highContrast: highContrast,
|
|
2378
|
+
withoutEffects: withoutEffects,
|
|
2379
|
+
elasticity: elasticity,
|
|
2380
|
+
onClick: onClick,
|
|
2381
|
+
debugOverLight: debugOverLight,
|
|
2382
|
+
debugPerformance: debugPerformance,
|
|
2383
|
+
children: children,
|
|
2384
|
+
blurAmount: blurAmount,
|
|
2385
|
+
saturation: saturation,
|
|
2386
|
+
withLiquidBlur: withLiquidBlur,
|
|
2387
|
+
padding: padding,
|
|
2388
|
+
style: style,
|
|
2389
|
+
isFixedOrSticky: isFixedOrSticky,
|
|
2390
|
+
// Phase 1: Animation System props
|
|
2391
|
+
withTimeAnimation: withTimeAnimation,
|
|
2392
|
+
animationSpeed: animationSpeed,
|
|
2393
|
+
withMultiLayerDistortion: withMultiLayerDistortion,
|
|
2394
|
+
distortionOctaves: distortionOctaves,
|
|
2395
|
+
distortionLacunarity: distortionLacunarity,
|
|
2396
|
+
distortionGain: distortionGain,
|
|
2397
|
+
distortionQuality: distortionQuality
|
|
2398
|
+
});
|
|
2399
|
+
// Re-calculate only when devicePreset changes
|
|
2400
|
+
// Responsive breakpoint system - automatically adjusts parameters based on viewport
|
|
2401
|
+
!
|
|
1805
2402
|
/**
|
|
1806
|
-
*
|
|
1807
|
-
*
|
|
1808
|
-
*
|
|
2403
|
+
* Responsive Glass Parameters Hook
|
|
2404
|
+
*
|
|
2405
|
+
* Automatically adjusts glass effect parameters based on:
|
|
2406
|
+
* 1. Screen size (mobile/tablet/desktop breakpoints)
|
|
2407
|
+
* 2. Device performance (RAM and CPU detection)
|
|
2408
|
+
* 3. Custom breakpoint configuration
|
|
2409
|
+
*
|
|
2410
|
+
* Features:
|
|
2411
|
+
* - Debounced resize handling
|
|
2412
|
+
* - Performance-based quality adjustment
|
|
2413
|
+
* - Smooth parameter transitions
|
|
2414
|
+
* - Debug mode for development
|
|
2415
|
+
*
|
|
2416
|
+
* @example
|
|
2417
|
+
* ```typescript
|
|
2418
|
+
* const { responsiveParams, currentBreakpoint } = useResponsiveGlass({
|
|
2419
|
+
* baseParams: {
|
|
2420
|
+
* distortionOctaves: 5,
|
|
2421
|
+
* displacementScale: 20,
|
|
2422
|
+
* blurAmount: 10,
|
|
2423
|
+
* },
|
|
2424
|
+
* debug: true,
|
|
2425
|
+
* });
|
|
2426
|
+
* ```
|
|
2427
|
+
*
|
|
2428
|
+
* @param options Hook configuration options
|
|
2429
|
+
* @returns Responsive parameters and metadata
|
|
1809
2430
|
*/
|
|
1810
|
-
function(
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
disabled: !1,
|
|
1815
|
-
invalid: !1,
|
|
1816
|
-
valid: !1,
|
|
1817
|
-
...initialProps
|
|
1818
|
-
};
|
|
2431
|
+
function({baseParams: baseParams, breakpoints: breakpoints = DEFAULT_BREAKPOINTS, enabled: enabled = !0, enablePerformanceAdjustment: enablePerformanceAdjustment = !0, debug: debug = !1}) {
|
|
2432
|
+
const [responsiveParams, setResponsiveParams] = useState(baseParams), [currentBreakpoint, setCurrentBreakpoint] = useState("desktop"), [performanceTier, setPerformanceTier] = useState("high"), [isActive, setIsActive] = useState(enabled), baseParamsRef = useRef(baseParams), breakpointsRef = useRef(breakpoints);
|
|
2433
|
+
// Update refs when props change
|
|
2434
|
+
baseParamsRef.current = baseParams, breakpointsRef.current = breakpoints;
|
|
1819
2435
|
/**
|
|
1820
|
-
*
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
2436
|
+
* Calculate and apply responsive parameters
|
|
2437
|
+
*/
|
|
2438
|
+
const calculateParams = useCallback((() => {
|
|
2439
|
+
if (!enabled || "undefined" == typeof window) return setIsActive(!1), setResponsiveParams(baseParamsRef.current),
|
|
2440
|
+
void setCurrentBreakpoint("disabled");
|
|
2441
|
+
setIsActive(!0);
|
|
2442
|
+
// Get current screen width
|
|
2443
|
+
const width = window.innerWidth, {name: name, params: breakpointParams} = ((width, breakpoints) => {
|
|
2444
|
+
// Convert breakpoints to array and sort by minWidth descending
|
|
2445
|
+
const sortedBreakpoints = Object.entries(breakpoints).filter((([_, bp]) => void 0 !== bp.minWidth)).sort(((a, b) => (b[1].minWidth || 0) - (a[1].minWidth || 0)));
|
|
2446
|
+
// Find first breakpoint where width >= minWidth
|
|
2447
|
+
for (const [name, bp] of sortedBreakpoints) if (width >= (bp.minWidth || 0)) return {
|
|
2448
|
+
name: name,
|
|
2449
|
+
params: bp.params
|
|
2450
|
+
};
|
|
2451
|
+
// If no minWidth matched, check maxWidth breakpoints
|
|
2452
|
+
const maxWidthBreakpoints = Object.entries(breakpoints).filter((([_, bp]) => void 0 !== bp.maxWidth)).sort(((a, b) => (a[1].maxWidth || 1 / 0) - (b[1].maxWidth || 1 / 0)));
|
|
2453
|
+
for (const [name, bp] of maxWidthBreakpoints) if (width <= (bp.maxWidth || 1 / 0)) return {
|
|
2454
|
+
name: name,
|
|
2455
|
+
params: bp.params
|
|
2456
|
+
};
|
|
2457
|
+
// Fallback to first available breakpoint
|
|
2458
|
+
const entries = Object.entries(breakpoints);
|
|
2459
|
+
if (0 === entries.length)
|
|
2460
|
+
// Ultimate fallback - return sensible defaults
|
|
2461
|
+
return {
|
|
2462
|
+
name: "desktop",
|
|
2463
|
+
params: {
|
|
2464
|
+
distortionOctaves: 5,
|
|
2465
|
+
displacementScale: 1,
|
|
2466
|
+
blurAmount: 1
|
|
2467
|
+
}
|
|
2468
|
+
};
|
|
2469
|
+
const firstEntry = entries[0];
|
|
2470
|
+
if (!firstEntry) return {
|
|
2471
|
+
name: "desktop",
|
|
2472
|
+
params: {
|
|
2473
|
+
distortionOctaves: 5,
|
|
2474
|
+
displacementScale: 1,
|
|
2475
|
+
blurAmount: 1
|
|
2476
|
+
}
|
|
2477
|
+
};
|
|
2478
|
+
const [fallbackName, fallbackBreakpoint] = firstEntry;
|
|
2479
|
+
return {
|
|
2480
|
+
name: fallbackName,
|
|
2481
|
+
params: fallbackBreakpoint.params
|
|
2482
|
+
};
|
|
2483
|
+
})(width, breakpointsRef.current);
|
|
2484
|
+
// Determine current breakpoint
|
|
2485
|
+
setCurrentBreakpoint(name);
|
|
2486
|
+
// Merge base params with breakpoint params
|
|
2487
|
+
let mergedParams = ((baseParams, breakpointParams) => {
|
|
2488
|
+
const result = {
|
|
2489
|
+
...baseParams
|
|
2490
|
+
}, scaleProperties = [ "displacementScale", "blurAmount", "saturation", "aberrationIntensity", "animationSpeed", "chromaticIntensity" ];
|
|
2491
|
+
// Apply scaling for specific properties
|
|
2492
|
+
for (const prop of scaleProperties) void 0 !== breakpointParams[prop] && void 0 !== baseParams[prop] && (result[prop] = baseParams[prop] * breakpointParams[prop]);
|
|
2493
|
+
// Override properties that should be set directly (not scaled)
|
|
2494
|
+
const overrideProperties = [ "distortionOctaves", "distortionLacunarity", "distortionGain" ];
|
|
2495
|
+
for (const prop of overrideProperties) void 0 !== breakpointParams[prop] && (result[prop] = breakpointParams[prop]);
|
|
2496
|
+
return result;
|
|
2497
|
+
})(baseParamsRef.current, breakpointParams);
|
|
2498
|
+
// Apply performance adjustments if enabled
|
|
2499
|
+
if (enablePerformanceAdjustment) {
|
|
2500
|
+
const tier = (() => {
|
|
2501
|
+
// Check if we're in a browser environment
|
|
2502
|
+
if ("undefined" == typeof window || "undefined" == typeof navigator) return "high"; // Default to high for SSR
|
|
2503
|
+
// Device Memory API (Chrome, Edge, Opera)
|
|
2504
|
+
// Returns RAM in GB: 0.25, 0.5, 1, 2, 4, 8
|
|
2505
|
+
const deviceMemory = navigator.deviceMemory || 4, hardwareConcurrency = navigator.hardwareConcurrency || 4;
|
|
2506
|
+
// Hardware Concurrency API (logical CPU cores)
|
|
2507
|
+
// Low-end: ≤2GB RAM OR ≤2 CPU cores
|
|
2508
|
+
return deviceMemory <= 2 || hardwareConcurrency <= 2 ? "low" :
|
|
2509
|
+
// High-end: ≥4GB RAM AND ≥4 CPU cores
|
|
2510
|
+
deviceMemory >= 4 && hardwareConcurrency >= 4 ? "high" : "medium";
|
|
2511
|
+
})();
|
|
2512
|
+
setPerformanceTier(tier), mergedParams = ((baseParams, performanceTier) => {
|
|
2513
|
+
if ("high" === performanceTier) return baseParams;
|
|
2514
|
+
// No adjustment needed
|
|
2515
|
+
const multiplier = "low" === performanceTier ? .7 : .85;
|
|
2516
|
+
return {
|
|
2517
|
+
...baseParams,
|
|
2518
|
+
distortionOctaves: Math.max(2, Math.round((baseParams.distortionOctaves || 5) * multiplier)),
|
|
2519
|
+
displacementScale: (baseParams.displacementScale || 1) * multiplier,
|
|
2520
|
+
blurAmount: (baseParams.blurAmount || 1) * multiplier,
|
|
2521
|
+
animationSpeed: (baseParams.animationSpeed || 1) * multiplier,
|
|
2522
|
+
chromaticIntensity: (baseParams.chromaticIntensity || 1) * multiplier
|
|
2523
|
+
};
|
|
2524
|
+
})(mergedParams, tier);
|
|
1837
2525
|
}
|
|
1838
|
-
|
|
2526
|
+
setResponsiveParams(mergedParams);
|
|
2527
|
+
}), [ enabled, enablePerformanceAdjustment, debug ]), debouncedCalculate = (func => {
|
|
2528
|
+
const timeoutRef = useRef(null);
|
|
2529
|
+
return useEffect((() => () => {
|
|
2530
|
+
timeoutRef.current && clearTimeout(timeoutRef.current);
|
|
2531
|
+
}), []), useCallback(((...args) => {
|
|
2532
|
+
timeoutRef.current && clearTimeout(timeoutRef.current), timeoutRef.current = setTimeout((() => {
|
|
2533
|
+
func(...args);
|
|
2534
|
+
}), 200);
|
|
2535
|
+
}), [ func, 200 ]);
|
|
2536
|
+
})(calculateParams);
|
|
2537
|
+
/**
|
|
2538
|
+
* Debounced parameter calculation for resize events
|
|
2539
|
+
*/
|
|
2540
|
+
/**
|
|
2541
|
+
* Handle window resize
|
|
2542
|
+
*/
|
|
2543
|
+
useEffect((() => {
|
|
2544
|
+
if (enabled)
|
|
2545
|
+
// Cleanup
|
|
2546
|
+
// Initial calculation
|
|
2547
|
+
return calculateParams(),
|
|
2548
|
+
// Listen for resize events
|
|
2549
|
+
window.addEventListener("resize", debouncedCalculate), () => {
|
|
2550
|
+
window.removeEventListener("resize", debouncedCalculate);
|
|
2551
|
+
};
|
|
2552
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2553
|
+
}), [ enabled ]), useCallback((() => {
|
|
2554
|
+
calculateParams();
|
|
2555
|
+
}), [ calculateParams ]);
|
|
1839
2556
|
}({
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
valid: valid
|
|
1845
|
-
}), inputClass = generateInputClass({
|
|
1846
|
-
className: `${className} ${glass ? "c-input--glass" : ""}`.trim(),
|
|
1847
|
-
size: size,
|
|
1848
|
-
variant: variant,
|
|
1849
|
-
disabled: disabled,
|
|
1850
|
-
invalid: invalid,
|
|
1851
|
-
valid: valid,
|
|
1852
|
-
type: type
|
|
1853
|
-
}), inputElement = jsx("input", {
|
|
1854
|
-
ref: ref,
|
|
1855
|
-
type: type,
|
|
1856
|
-
className: inputClass,
|
|
1857
|
-
value: value,
|
|
1858
|
-
defaultValue: defaultValue,
|
|
1859
|
-
onChange: onChange,
|
|
1860
|
-
onBlur: onBlur,
|
|
1861
|
-
onFocus: onFocus,
|
|
1862
|
-
placeholder: placeholder,
|
|
1863
|
-
disabled: disabled,
|
|
1864
|
-
required: required,
|
|
1865
|
-
readOnly: readOnly,
|
|
1866
|
-
id: id,
|
|
1867
|
-
name: name,
|
|
1868
|
-
autoComplete: autoComplete,
|
|
1869
|
-
autoFocus: autoFocus,
|
|
1870
|
-
maxLength: maxLength,
|
|
1871
|
-
minLength: minLength,
|
|
1872
|
-
pattern: pattern,
|
|
1873
|
-
min: min,
|
|
1874
|
-
max: max,
|
|
1875
|
-
step: step,
|
|
1876
|
-
"aria-label": ariaLabel,
|
|
1877
|
-
"aria-describedby": ariaDescribedBy,
|
|
1878
|
-
"aria-invalid": invalid,
|
|
1879
|
-
style: glass ? {
|
|
1880
|
-
...style
|
|
1881
|
-
} : style
|
|
1882
|
-
});
|
|
1883
|
-
if (glass) {
|
|
1884
|
-
// Default glass settings for inputs
|
|
1885
|
-
const defaultGlassProps = {
|
|
1886
|
-
displacementScale: 60,
|
|
1887
|
-
blurAmount: 1,
|
|
1888
|
-
saturation: 180,
|
|
1889
|
-
aberrationIntensity: .2,
|
|
1890
|
-
borderRadius: 12,
|
|
1891
|
-
mode: "shader"
|
|
1892
|
-
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
1893
|
-
...defaultGlassProps,
|
|
1894
|
-
...glass
|
|
1895
|
-
};
|
|
1896
|
-
return jsx(AtomixGlass, {
|
|
1897
|
-
...glassProps,
|
|
1898
|
-
children: inputElement
|
|
1899
|
-
});
|
|
1900
|
-
}
|
|
1901
|
-
return inputElement;
|
|
1902
|
-
})));
|
|
1903
|
-
|
|
1904
|
-
Input.displayName = "Input";
|
|
1905
|
-
|
|
1906
|
-
/**
|
|
1907
|
-
* Radio - A component for radio button inputs
|
|
2557
|
+
baseParams: {
|
|
2558
|
+
...useMemo((() =>
|
|
2559
|
+
/**
|
|
2560
|
+
* Get preset by name
|
|
1908
2561
|
*/
|
|
1909
|
-
|
|
1910
|
-
|
|
2562
|
+
function(presetName) {
|
|
2563
|
+
switch (presetName) {
|
|
2564
|
+
case "performance":
|
|
2565
|
+
return PERFORMANCE_PRESET;
|
|
2566
|
+
|
|
2567
|
+
case "balanced":
|
|
2568
|
+
default:
|
|
2569
|
+
return BALANCED_PRESET;
|
|
2570
|
+
|
|
2571
|
+
case "quality":
|
|
2572
|
+
return QUALITY_PRESET;
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
/**
|
|
2576
|
+
* Mobile-optimized responsive breakpoints
|
|
2577
|
+
* Automatically applies appropriate presets based on viewport size
|
|
2578
|
+
*/ (devicePreset)), [ devicePreset ]),
|
|
2579
|
+
distortionOctaves: Math.round((displacementScale || ATOMIX_GLASS.DEFAULTS.DISPLACEMENT_SCALE) / 25),
|
|
2580
|
+
displacementScale: displacementScale || ATOMIX_GLASS.DEFAULTS.DISPLACEMENT_SCALE,
|
|
2581
|
+
blurAmount: blurAmount || ATOMIX_GLASS.DEFAULTS.BLUR_AMOUNT,
|
|
2582
|
+
saturation: saturation || ATOMIX_GLASS.DEFAULTS.SATURATION,
|
|
2583
|
+
aberrationIntensity: aberrationIntensity || ATOMIX_GLASS.DEFAULTS.ABERRATION_INTENSITY,
|
|
2584
|
+
animationSpeed: 1,
|
|
2585
|
+
chromaticIntensity: aberrationIntensity || ATOMIX_GLASS.DEFAULTS.ABERRATION_INTENSITY
|
|
2586
|
+
},
|
|
2587
|
+
breakpoints: MOBILE_OPTIMIZED_BREAKPOINTS,
|
|
2588
|
+
enabled: !disableResponsiveBreakpoints && "undefined" != typeof window,
|
|
2589
|
+
// Enable unless disabled
|
|
2590
|
+
debug: !1
|
|
2591
|
+
});
|
|
2592
|
+
// Performance monitoring - tracks FPS, frame time, memory usage
|
|
2593
|
+
const {metrics: performanceMetrics, recommendedQuality: recommendedQuality, isUnderperforming: isUnderperforming, setQualityLevel: setQualityLevel, toggleMonitoring: toggleMonitoring} =
|
|
1911
2594
|
/**
|
|
1912
|
-
*
|
|
1913
|
-
*
|
|
1914
|
-
*
|
|
2595
|
+
* Performance Monitor Hook
|
|
2596
|
+
*
|
|
2597
|
+
* Real-time performance tracking with automatic quality scaling.
|
|
2598
|
+
* Monitors FPS, frame time, and GPU memory to optimize glass effects.
|
|
2599
|
+
*
|
|
2600
|
+
* Features:
|
|
2601
|
+
* - Real-time FPS measurement
|
|
2602
|
+
* - Frame timing analysis
|
|
2603
|
+
* - Automatic quality scaling
|
|
2604
|
+
* - Debug overlay option
|
|
2605
|
+
* - Manual override capability
|
|
2606
|
+
*
|
|
2607
|
+
* @example
|
|
2608
|
+
* ```typescript
|
|
2609
|
+
* const { metrics, recommendedQuality, setQualityLevel } = usePerformanceMonitor({
|
|
2610
|
+
* targetFps: 60,
|
|
2611
|
+
* minFps: 45,
|
|
2612
|
+
* debug: true,
|
|
2613
|
+
* });
|
|
2614
|
+
* ```
|
|
2615
|
+
*
|
|
2616
|
+
* @param config Monitor configuration
|
|
2617
|
+
* @returns Performance metrics and controls
|
|
1915
2618
|
*/
|
|
1916
|
-
function(
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
2619
|
+
function(config = {}) {
|
|
2620
|
+
const {enabled: enabled = !0, targetFps: targetFps = 60, minFps: minFps = 45, scaleUpThreshold: scaleUpThreshold = 58, lowFpsFrames: lowFpsFrames = 3, highFpsFrames: highFpsFrames = 10, debug: debug = !1, showOverlay: showOverlay = !1} = config, [metrics, setMetrics] = useState({
|
|
2621
|
+
fps: 0,
|
|
2622
|
+
frameTime: 0,
|
|
2623
|
+
gpuMemory: null,
|
|
2624
|
+
qualityLevel: "medium",
|
|
2625
|
+
timestamp: 0,
|
|
2626
|
+
isAutoScaling: !0,
|
|
2627
|
+
lowFpsCount: 0
|
|
2628
|
+
}), [manualOverride, setManualOverride] = useState(!1), [isEnabled, setIsEnabled] = useState(enabled), frameCountRef = useRef(0), lastFpsUpdateRef = useRef(0), lastFrameTimeRef = useRef(0), animationFrameRef = useRef(null), lowFpsCountRef = useRef(0), highFpsCountRef = useRef(0), qualityLevelRef = useRef("medium"), updateMetrics = useCallback((newMetrics => {
|
|
2629
|
+
setMetrics((prev => ({
|
|
2630
|
+
...prev,
|
|
2631
|
+
...newMetrics,
|
|
2632
|
+
timestamp: performance.now()
|
|
2633
|
+
})));
|
|
2634
|
+
}), []), applyAutoScaling = useCallback((currentFps => {
|
|
2635
|
+
if (manualOverride) return;
|
|
2636
|
+
const currentQuality = qualityLevelRef.current;
|
|
2637
|
+
// Check for low FPS
|
|
2638
|
+
if (currentFps < minFps) lowFpsCountRef.current++, highFpsCountRef.current = 0,
|
|
2639
|
+
// Scale down after N consecutive low-FPS frames
|
|
2640
|
+
lowFpsCountRef.current >= lowFpsFrames && "low" !== currentQuality && (qualityLevelRef.current = "low",
|
|
2641
|
+
updateMetrics({
|
|
2642
|
+
qualityLevel: "low",
|
|
2643
|
+
lowFpsCount: lowFpsCountRef.current
|
|
2644
|
+
})); else if (currentFps >= scaleUpThreshold) {
|
|
2645
|
+
// Scale up after N consecutive high-FPS frames
|
|
2646
|
+
if (highFpsCountRef.current++, lowFpsCountRef.current = 0, highFpsCountRef.current >= highFpsFrames) {
|
|
2647
|
+
const newQuality = "low" === currentQuality ? "medium" : "high";
|
|
2648
|
+
qualityLevelRef.current = newQuality, updateMetrics({
|
|
2649
|
+
qualityLevel: newQuality,
|
|
2650
|
+
lowFpsCount: 0
|
|
2651
|
+
}), highFpsCountRef.current = 0;
|
|
2652
|
+
}
|
|
2653
|
+
} else
|
|
2654
|
+
// FPS in normal range, reset counters
|
|
2655
|
+
lowFpsCountRef.current = 0, highFpsCountRef.current = 0;
|
|
2656
|
+
}), [ manualOverride, minFps, scaleUpThreshold, lowFpsFrames, highFpsFrames, debug, updateMetrics ]), measureFrame = useCallback((currentTime => {
|
|
2657
|
+
if (!isEnabled) return;
|
|
2658
|
+
frameCountRef.current++;
|
|
2659
|
+
// Calculate frame time
|
|
2660
|
+
const frameTime = currentTime - lastFrameTimeRef.current;
|
|
2661
|
+
// Update FPS every 100ms for responsiveness
|
|
2662
|
+
if (lastFrameTimeRef.current = currentTime, currentTime - lastFpsUpdateRef.current >= 100) {
|
|
2663
|
+
const elapsed = currentTime - lastFpsUpdateRef.current, fps = Math.round(1e3 * frameCountRef.current / elapsed);
|
|
2664
|
+
// Apply auto-scaling
|
|
2665
|
+
applyAutoScaling(fps), updateMetrics({
|
|
2666
|
+
fps: fps,
|
|
2667
|
+
frameTime: frameTime,
|
|
2668
|
+
qualityLevel: qualityLevelRef.current,
|
|
2669
|
+
lowFpsCount: lowFpsCountRef.current
|
|
2670
|
+
}),
|
|
2671
|
+
// Reset for next measurement period
|
|
2672
|
+
frameCountRef.current = 0, lastFpsUpdateRef.current = currentTime;
|
|
1935
2673
|
}
|
|
2674
|
+
// Continue measurement loop
|
|
2675
|
+
animationFrameRef.current = requestAnimationFrame(measureFrame);
|
|
2676
|
+
}), [ isEnabled, applyAutoScaling, updateMetrics ]);
|
|
2677
|
+
/**
|
|
2678
|
+
* Initialize GPU memory tracking
|
|
2679
|
+
*/
|
|
2680
|
+
useEffect((() => {
|
|
2681
|
+
if (!isEnabled || "undefined" == typeof window) return;
|
|
2682
|
+
let mounted = !0;
|
|
2683
|
+
return (async () => {
|
|
2684
|
+
const memory = await new Promise((resolve => {
|
|
2685
|
+
// Check for WebGL debug renderer info
|
|
2686
|
+
if ("undefined" != typeof window && "undefined" != typeof document) try {
|
|
2687
|
+
const canvas = document.createElement("canvas"), gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
|
|
2688
|
+
if (gl) {
|
|
2689
|
+
const debugInfo = gl.getExtension("WEBGL_debug_renderer_info");
|
|
2690
|
+
if (debugInfo) {
|
|
2691
|
+
var _context, _context2, _context3;
|
|
2692
|
+
// Note: Actual memory info is not directly available via WebGL
|
|
2693
|
+
// We estimate based on renderer
|
|
2694
|
+
const renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);
|
|
2695
|
+
// Rough estimation based on renderer type
|
|
2696
|
+
return void ((null == (_context = renderer) ? void 0 : Function.call.bind(_includesInstanceProperty(_context), _context))?.("Integrated") ? resolve(256) : (null == (_context2 = renderer) ? void 0 : Function.call.bind(_includesInstanceProperty(_context2), _context2))?.("AMD") || (null == (_context3 = renderer) ? void 0 : Function.call.bind(_includesInstanceProperty(_context3), _context3))?.("NVIDIA") ? resolve(512) : resolve(null));
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
} catch (e) {
|
|
2700
|
+
// WebGL not available or error occurred
|
|
2701
|
+
}
|
|
2702
|
+
resolve(null);
|
|
2703
|
+
}));
|
|
2704
|
+
mounted && updateMetrics({
|
|
2705
|
+
gpuMemory: memory
|
|
2706
|
+
});
|
|
2707
|
+
})(), () => {
|
|
2708
|
+
mounted = !1;
|
|
2709
|
+
};
|
|
2710
|
+
}), [ isEnabled, updateMetrics ]),
|
|
2711
|
+
/**
|
|
2712
|
+
* Start/stop monitoring based on enabled state
|
|
2713
|
+
*/
|
|
2714
|
+
useEffect((() => {
|
|
2715
|
+
if (isEnabled)
|
|
2716
|
+
// Cleanup
|
|
2717
|
+
// Initialize
|
|
2718
|
+
return lastFpsUpdateRef.current = performance.now(), lastFrameTimeRef.current = performance.now(),
|
|
2719
|
+
animationFrameRef.current = requestAnimationFrame(measureFrame), () => {
|
|
2720
|
+
null !== animationFrameRef.current && (cancelAnimationFrame(animationFrameRef.current),
|
|
2721
|
+
animationFrameRef.current = null);
|
|
2722
|
+
};
|
|
2723
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2724
|
+
null !== animationFrameRef.current && (cancelAnimationFrame(animationFrameRef.current),
|
|
2725
|
+
animationFrameRef.current = null);
|
|
2726
|
+
}), [ isEnabled ]);
|
|
2727
|
+
// measureFrame is stable via useCallback, avoid re-creating RAF loop
|
|
2728
|
+
/**
|
|
2729
|
+
* Manually set quality level (disables auto-scaling)
|
|
2730
|
+
*/
|
|
2731
|
+
const setQualityLevel = useCallback((level => {
|
|
2732
|
+
setManualOverride(!0), qualityLevelRef.current = level, updateMetrics({
|
|
2733
|
+
qualityLevel: level,
|
|
2734
|
+
isAutoScaling: !1
|
|
2735
|
+
});
|
|
2736
|
+
}), [ updateMetrics, debug ]), resetAutoScaling = useCallback((() => {
|
|
2737
|
+
setManualOverride(!1), lowFpsCountRef.current = 0, highFpsCountRef.current = 0,
|
|
2738
|
+
updateMetrics({
|
|
2739
|
+
isAutoScaling: !0,
|
|
2740
|
+
lowFpsCount: 0
|
|
2741
|
+
});
|
|
2742
|
+
}), [ updateMetrics, debug ]), toggleMonitoring = useCallback((() => {
|
|
2743
|
+
setIsEnabled((prev => !prev));
|
|
2744
|
+
}), []);
|
|
2745
|
+
/**
|
|
2746
|
+
* Reset to auto-scaling mode
|
|
2747
|
+
*/ var fps, currentQuality;
|
|
2748
|
+
return {
|
|
2749
|
+
metrics: metrics,
|
|
2750
|
+
recommendedQuality: (fps = metrics.fps, currentQuality = metrics.qualityLevel, fps >= 58 ? "high" : fps >= 45 ? "high" === currentQuality ? "high" : "medium" : "low"),
|
|
2751
|
+
isUnderperforming: metrics.fps < minFps,
|
|
2752
|
+
setQualityLevel: setQualityLevel,
|
|
2753
|
+
resetAutoScaling: resetAutoScaling,
|
|
2754
|
+
toggleMonitoring: toggleMonitoring
|
|
1936
2755
|
};
|
|
1937
2756
|
}({
|
|
2757
|
+
enabled: !1,
|
|
2758
|
+
// We'll toggle manually based on prop
|
|
2759
|
+
debug: !1,
|
|
2760
|
+
showOverlay: !1
|
|
2761
|
+
});
|
|
2762
|
+
// Auto-start performance monitoring if enabled (only in development)
|
|
2763
|
+
React.useEffect((() => {
|
|
2764
|
+
"development" === process.env.NODE_ENV && window?.enablePerformanceMonitoring && toggleMonitoring();
|
|
2765
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2766
|
+
}), []);
|
|
2767
|
+
// Only run once on mount
|
|
2768
|
+
const isOverLight = useMemo((() => overLightConfig.isOverLight), [ overLightConfig.isOverLight ]), shouldRenderOverLightLayers = withOverLightLayers && isOverLight, rootLayoutStyle = useMemo((() => {
|
|
2769
|
+
if (!isFixedOrSticky) return {};
|
|
2770
|
+
const {position: p, top: t, left: l, right: r, bottom: b} = restStyle;
|
|
2771
|
+
return {
|
|
2772
|
+
...p && {
|
|
2773
|
+
position: p
|
|
2774
|
+
},
|
|
2775
|
+
...void 0 !== t && {
|
|
2776
|
+
top: t
|
|
2777
|
+
},
|
|
2778
|
+
...void 0 !== l && {
|
|
2779
|
+
left: l
|
|
2780
|
+
},
|
|
2781
|
+
...void 0 !== r && {
|
|
2782
|
+
right: r
|
|
2783
|
+
},
|
|
2784
|
+
...void 0 !== b && {
|
|
2785
|
+
bottom: b
|
|
2786
|
+
}
|
|
2787
|
+
};
|
|
2788
|
+
}), [ isFixedOrSticky, restStyle ]);
|
|
2789
|
+
// Calculate base style with transforms
|
|
2790
|
+
// When layout is hoisted to the root, strip those props from the container
|
|
2791
|
+
useMemo((() => {
|
|
2792
|
+
if (isFixedOrSticky) {
|
|
2793
|
+
const {position: _p, top: _t, left: _l, right: _r, bottom: _b, ...visualStyle} = restStyle;
|
|
2794
|
+
return {
|
|
2795
|
+
...visualStyle,
|
|
2796
|
+
...!effectiveWithoutEffects && {
|
|
2797
|
+
transform: transformStyle
|
|
2798
|
+
}
|
|
2799
|
+
};
|
|
2800
|
+
}
|
|
2801
|
+
return {
|
|
2802
|
+
...restStyle,
|
|
2803
|
+
...!effectiveWithoutEffects && {
|
|
2804
|
+
transform: transformStyle
|
|
2805
|
+
}
|
|
2806
|
+
};
|
|
2807
|
+
}), [ isFixedOrSticky, restStyle, effectiveWithoutEffects, transformStyle ]);
|
|
2808
|
+
// Build className with state modifiers
|
|
2809
|
+
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((() => ({
|
|
2810
|
+
position: isFixedOrSticky ? "absolute" : restStyle.position || "absolute",
|
|
2811
|
+
top: isFixedOrSticky ? 0 : restStyle.top || 0,
|
|
2812
|
+
left: isFixedOrSticky ? 0 : restStyle.left || 0
|
|
2813
|
+
})), [ isFixedOrSticky, restStyle.position, restStyle.top, restStyle.left ]), adjustedSize = useMemo((() => {
|
|
2814
|
+
// Keep a reference to positionStyles to avoid unused-variable lint,
|
|
2815
|
+
// but sizing is driven by explicit width/height or measured size.
|
|
2816
|
+
positionStyles.position;
|
|
2817
|
+
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;
|
|
2818
|
+
return {
|
|
2819
|
+
width: resolveLength(effectiveWidth, glassSize.width),
|
|
2820
|
+
height: resolveLength(effectiveHeight, glassSize.height)
|
|
2821
|
+
};
|
|
2822
|
+
}), [ width, height, restStyle.width, restStyle.height, positionStyles.position, glassSize.width, glassSize.height ]), gradientValues = useMemo((() => {
|
|
2823
|
+
const mx = mouseOffset.x, my = mouseOffset.y, absMx = Math.abs(mx), absMy = Math.abs(my), GRADIENT = ATOMIX_GLASS.CONSTANTS.GRADIENT;
|
|
2824
|
+
return {
|
|
2825
|
+
borderGradientAngle: GRADIENT.BASE_ANGLE + mx * GRADIENT.ANGLE_MULTIPLIER,
|
|
2826
|
+
borderStop1: Math.max(GRADIENT.BORDER_STOP_1.MIN, GRADIENT.BORDER_STOP_1.BASE + my * GRADIENT.BORDER_STOP_1.MULTIPLIER),
|
|
2827
|
+
borderStop2: Math.min(GRADIENT.BORDER_STOP_2.MAX, GRADIENT.BORDER_STOP_2.BASE + my * GRADIENT.BORDER_STOP_2.MULTIPLIER),
|
|
2828
|
+
borderOpacities: [ GRADIENT.BORDER_OPACITY.BASE_1 + absMx * GRADIENT.BORDER_OPACITY.MULTIPLIER_LOW, GRADIENT.BORDER_OPACITY.BASE_2 + absMx * GRADIENT.BORDER_OPACITY.MULTIPLIER_HIGH, GRADIENT.BORDER_OPACITY.BASE_3 + absMx * GRADIENT.BORDER_OPACITY.MULTIPLIER_LOW, GRADIENT.BORDER_OPACITY.BASE_4 + absMx * GRADIENT.BORDER_OPACITY.MULTIPLIER_HIGH ],
|
|
2829
|
+
hoverPositions: {
|
|
2830
|
+
hover1: {
|
|
2831
|
+
x: GRADIENT.CENTER_POSITION + mx / GRADIENT.HOVER_POSITION.DIVISOR_1,
|
|
2832
|
+
y: GRADIENT.CENTER_POSITION + my / GRADIENT.HOVER_POSITION.DIVISOR_1
|
|
2833
|
+
},
|
|
2834
|
+
hover2: {
|
|
2835
|
+
x: GRADIENT.CENTER_POSITION + mx / GRADIENT.HOVER_POSITION.DIVISOR_2,
|
|
2836
|
+
y: GRADIENT.CENTER_POSITION + my / GRADIENT.HOVER_POSITION.DIVISOR_2
|
|
2837
|
+
},
|
|
2838
|
+
hover3: {
|
|
2839
|
+
x: GRADIENT.CENTER_POSITION + mx * GRADIENT.HOVER_POSITION.MULTIPLIER_3,
|
|
2840
|
+
y: GRADIENT.CENTER_POSITION + my * GRADIENT.HOVER_POSITION.MULTIPLIER_3
|
|
2841
|
+
}
|
|
2842
|
+
},
|
|
2843
|
+
basePosition: {
|
|
2844
|
+
x: GRADIENT.CENTER_POSITION + mx * GRADIENT.BASE_LAYER_MULTIPLIER,
|
|
2845
|
+
y: GRADIENT.CENTER_POSITION + my * GRADIENT.BASE_LAYER_MULTIPLIER
|
|
2846
|
+
},
|
|
2847
|
+
mx: mx,
|
|
2848
|
+
my: my,
|
|
2849
|
+
absMx: absMx,
|
|
2850
|
+
absMy: absMy
|
|
2851
|
+
};
|
|
2852
|
+
}), [ mouseOffset.x, mouseOffset.y ]), opacityValues = useMemo((() => {
|
|
2853
|
+
const overLightOpacity = overLightConfig.opacity;
|
|
2854
|
+
return {
|
|
2855
|
+
hover1: isHovered || isActive ? .5 : 0,
|
|
2856
|
+
hover2: isActive ? .5 : 0,
|
|
2857
|
+
hover3: isHovered ? .4 : isActive ? .8 : 0,
|
|
2858
|
+
base: isOverLight ? overLightOpacity || .4 : 0,
|
|
2859
|
+
over: isOverLight ? 1.1 * (overLightOpacity || .4) : 0
|
|
2860
|
+
};
|
|
2861
|
+
}), [ isHovered, isActive, isOverLight, overLightConfig.opacity ]), glassVars = useMemo((() => {
|
|
2862
|
+
const whiteColor = ATOMIX_GLASS.CONSTANTS.PALETTE.WHITE, blackColor = ATOMIX_GLASS.CONSTANTS.PALETTE.BLACK, {borderGradientAngle: borderGradientAngle, borderStop1: borderStop1, borderStop2: borderStop2, borderOpacities: borderOpacities, hoverPositions: hoverPositions, basePosition: basePosition, mx: mx, my: my, absMx: absMx, absMy: absMy} = gradientValues, configBorderOpacity = overLightConfig?.borderOpacity ?? 1;
|
|
2863
|
+
return {
|
|
2864
|
+
...void 0 !== customZIndex && {
|
|
2865
|
+
"--atomix-glass-base-z-index": customZIndex
|
|
2866
|
+
},
|
|
2867
|
+
"--atomix-glass-radius": `${effectiveBorderRadius}px`,
|
|
2868
|
+
"--atomix-glass-transform": transformStyle || "none",
|
|
2869
|
+
// Internal decorative layers are positioned relative to the root;
|
|
2870
|
+
"--atomix-glass-position": rootLayoutStyle.position,
|
|
2871
|
+
"--atomix-glass-top": `${isFixedOrSticky ? rootLayoutStyle.top : 0}px`,
|
|
2872
|
+
"--atomix-glass-left": `${isFixedOrSticky ? rootLayoutStyle.left : 0}px`,
|
|
2873
|
+
"--atomix-glass-width": adjustedSize.width,
|
|
2874
|
+
"--atomix-glass-height": adjustedSize.height,
|
|
2875
|
+
"--atomix-glass-border-width": "var(--atomix-spacing-0-5, 0.09375rem)",
|
|
2876
|
+
"--atomix-glass-blend-mode": isOverLight ? "multiply" : "overlay",
|
|
2877
|
+
"--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%)`,
|
|
2878
|
+
"--atomix-glass-border-gradient-2": `linear-gradient(${borderGradientAngle}deg, rgba(${whiteColor}, 0) 0%, rgba(${whiteColor}, ${(borderOpacities[2] ?? 1) * configBorderOpacity}) ${borderStop1}%, rgba(${whiteColor}, ${(borderOpacities[3] ?? 1) * configBorderOpacity}) ${borderStop2}%, rgba(${whiteColor}, 0) 100%)`,
|
|
2879
|
+
"--atomix-glass-hover-1-opacity": opacityValues.hover1,
|
|
2880
|
+
"--atomix-glass-hover-1-gradient": isOverLight ? `radial-gradient(circle at ${hoverPositions.hover1.x}% ${hoverPositions.hover1.y}%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_1.BLACK_START}) 0%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_1.BLACK_MID}) ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_1.BLACK_STOP}%, rgba(${blackColor}, 0) ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_1.BLACK_END}%)` : `radial-gradient(circle at ${hoverPositions.hover1.x}% ${hoverPositions.hover1.y}%, rgba(${whiteColor}, ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_1.WHITE_START}) 0%, rgba(${whiteColor}, 0) ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_1.WHITE_STOP}%)`,
|
|
2881
|
+
"--atomix-glass-hover-2-opacity": opacityValues.hover2,
|
|
2882
|
+
"--atomix-glass-hover-2-gradient": isOverLight ? `radial-gradient(circle at ${hoverPositions.hover2.x}% ${hoverPositions.hover2.y}%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_2.BLACK_START}) 0%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_2.BLACK_MID}) ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_2.BLACK_STOP}%, rgba(${blackColor}, 0) ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_2.BLACK_END}%)` : `radial-gradient(circle at ${hoverPositions.hover2.x}% ${hoverPositions.hover2.y}%, rgba(${whiteColor}, ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_2.WHITE_START}) 0%, rgba(${whiteColor}, 0) ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_2.WHITE_STOP}%)`,
|
|
2883
|
+
"--atomix-glass-hover-3-opacity": opacityValues.hover3,
|
|
2884
|
+
"--atomix-glass-hover-3-gradient": isOverLight ? `radial-gradient(circle at ${hoverPositions.hover3.x}% ${hoverPositions.hover3.y}%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_3.BLACK_START}) 0%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_3.BLACK_MID}) ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_3.BLACK_STOP}%, rgba(${blackColor}, 0) ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_3.BLACK_END}%)` : `radial-gradient(circle at ${hoverPositions.hover3.x}% ${hoverPositions.hover3.y}%, rgba(${whiteColor}, ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_3.WHITE_START}) 0%, rgba(${whiteColor}, 0) ${ATOMIX_GLASS.CONSTANTS.GRADIENT_OPACITY.HOVER_3.WHITE_STOP}%)`,
|
|
2885
|
+
"--atomix-glass-base-opacity": opacityValues.base,
|
|
2886
|
+
"--atomix-glass-base-gradient": isOverLight ? `linear-gradient(${ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.ANGLE}deg, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.BLACK_START_BASE + mx * ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.BLACK_START_MULTIPLIER}) 0%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.BLACK_MID_BASE + my * ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.BLACK_MID_MULTIPLIER}) ${ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.BLACK_MID_STOP}%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.BLACK_END_BASE + absMx * ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.BLACK_END_MULTIPLIER}) 100%)` : `rgba(${whiteColor}, ${ATOMIX_GLASS.CONSTANTS.BASE_GRADIENT.WHITE_OPACITY})`,
|
|
2887
|
+
"--atomix-glass-overlay-opacity": opacityValues.over,
|
|
2888
|
+
"--atomix-glass-overlay-gradient": isOverLight ? `radial-gradient(circle at ${basePosition.x}% ${basePosition.y}%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_START_BASE + absMx * ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_START_MULTIPLIER}) 0%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_MID}) ${ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_MID_STOP}%, rgba(${blackColor}, ${ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_END_BASE + absMy * ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.BLACK_END_MULTIPLIER}) 100%)` : `rgba(${whiteColor}, ${ATOMIX_GLASS.CONSTANTS.OVERLAY_GRADIENT.WHITE_OPACITY})`,
|
|
2889
|
+
"--atomix-glass-overlay-highlight-opacity": opacityValues.over * ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.OPACITY_MULTIPLIER,
|
|
2890
|
+
"--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}%)`
|
|
2891
|
+
};
|
|
2892
|
+
}), [ gradientValues, opacityValues, effectiveBorderRadius, transformStyle, adjustedSize, isOverLight, overLightConfig.borderOpacity, customZIndex, rootLayoutStyle, isFixedOrSticky ]), renderBackgroundLayer = layerType => jsx("div", {
|
|
2893
|
+
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(" ")
|
|
2894
|
+
});
|
|
2895
|
+
// Calculate position and size styles for internal layers
|
|
2896
|
+
// When root is fixed/sticky, internal layers use absolute (relative to root)
|
|
2897
|
+
return jsxs("div", {
|
|
2898
|
+
...rest,
|
|
2899
|
+
className: componentClassName,
|
|
2900
|
+
style: {
|
|
2901
|
+
...glassVars
|
|
2902
|
+
},
|
|
2903
|
+
role: role || (onClick ? "button" : void 0),
|
|
2904
|
+
tabIndex: onClick ? tabIndex ?? 0 : tabIndex,
|
|
2905
|
+
"aria-label": ariaLabel,
|
|
2906
|
+
"aria-describedby": ariaDescribedBy,
|
|
2907
|
+
"aria-disabled": !(!onClick || !effectiveWithoutEffects) || !onClick && void 0,
|
|
2908
|
+
"aria-pressed": !(!onClick || !isActive) || !onClick && void 0,
|
|
2909
|
+
onKeyDown: onClick ? handleKeyDown : void 0,
|
|
2910
|
+
children: [ jsx(AtomixGlassContainer, {
|
|
2911
|
+
ref: glassRef,
|
|
2912
|
+
contentRef: contentRef,
|
|
2913
|
+
className: className,
|
|
2914
|
+
style: {
|
|
2915
|
+
...restStyle,
|
|
2916
|
+
...!isFixedOrSticky && {
|
|
2917
|
+
position: "relative"
|
|
2918
|
+
}
|
|
2919
|
+
},
|
|
2920
|
+
borderRadius: effectiveBorderRadius,
|
|
2921
|
+
displacementScale: effectiveWithoutEffects ? 0 : "shader" === mode ? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.SHADER_DISPLACEMENT : isOverLight ? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.OVER_LIGHT_DISPLACEMENT : displacementScale,
|
|
2922
|
+
blurAmount: effectiveWithoutEffects ? 0 : blurAmount,
|
|
2923
|
+
saturation: effectiveHighContrast ? ATOMIX_GLASS.CONSTANTS.SATURATION.HIGH_CONTRAST : isOverLight ? saturation * overLightConfig.saturationBoost : saturation,
|
|
2924
|
+
aberrationIntensity: effectiveWithoutEffects ? 0 : "shader" === mode ? aberrationIntensity * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.SHADER_ABERRATION : aberrationIntensity,
|
|
2925
|
+
glassSize: glassSize,
|
|
2926
|
+
padding: padding,
|
|
2927
|
+
mouseOffset: effectiveWithoutEffects ? {
|
|
2928
|
+
x: 0,
|
|
2929
|
+
y: 0
|
|
2930
|
+
} : mouseOffset,
|
|
2931
|
+
globalMousePosition: effectiveWithoutEffects ? {
|
|
2932
|
+
x: 0,
|
|
2933
|
+
y: 0
|
|
2934
|
+
} : globalMousePosition,
|
|
2935
|
+
onMouseEnter: handleMouseEnter,
|
|
2936
|
+
onMouseLeave: handleMouseLeave,
|
|
2937
|
+
onMouseDown: handleMouseDown,
|
|
2938
|
+
onMouseUp: handleMouseUp,
|
|
2939
|
+
isHovered: isHovered,
|
|
2940
|
+
isActive: isActive,
|
|
2941
|
+
overLight: isOverLight,
|
|
2942
|
+
overLightConfig: {
|
|
2943
|
+
contrast: overLightConfig.contrast,
|
|
2944
|
+
brightness: overLightConfig.brightness,
|
|
2945
|
+
shadowIntensity: overLightConfig.shadowIntensity,
|
|
2946
|
+
borderOpacity: overLightConfig.borderOpacity
|
|
2947
|
+
},
|
|
2948
|
+
onClick: onClick,
|
|
2949
|
+
mode: mode,
|
|
2950
|
+
effectiveWithoutEffects: effectiveWithoutEffects,
|
|
2951
|
+
effectiveReducedMotion: effectiveReducedMotion,
|
|
2952
|
+
shaderVariant: shaderVariant,
|
|
2953
|
+
withLiquidBlur: withLiquidBlur,
|
|
2954
|
+
// Phase 1: Animation System props
|
|
2955
|
+
shaderTime: getShaderTime(),
|
|
2956
|
+
withTimeAnimation: withTimeAnimation,
|
|
2957
|
+
animationSpeed: animationSpeed,
|
|
2958
|
+
withMultiLayerDistortion: withMultiLayerDistortion,
|
|
2959
|
+
distortionOctaves: distortionOctaves,
|
|
2960
|
+
distortionLacunarity: distortionLacunarity,
|
|
2961
|
+
distortionGain: distortionGain,
|
|
2962
|
+
distortionQuality: distortionQuality,
|
|
2963
|
+
children: children
|
|
2964
|
+
}), Boolean(onClick) && jsxs(Fragment, {
|
|
2965
|
+
children: [ jsx("div", {
|
|
2966
|
+
className: ATOMIX_GLASS.HOVER_1_CLASS
|
|
2967
|
+
}), jsx("div", {
|
|
2968
|
+
className: ATOMIX_GLASS.HOVER_2_CLASS
|
|
2969
|
+
}), jsx("div", {
|
|
2970
|
+
className: ATOMIX_GLASS.HOVER_3_CLASS
|
|
2971
|
+
}) ]
|
|
2972
|
+
}), renderBackgroundLayer("dark"), renderBackgroundLayer("black"), shouldRenderOverLightLayers && jsxs(Fragment, {
|
|
2973
|
+
children: [ jsx("div", {
|
|
2974
|
+
className: ATOMIX_GLASS.BASE_LAYER_CLASS
|
|
2975
|
+
}), jsx("div", {
|
|
2976
|
+
className: ATOMIX_GLASS.OVERLAY_LAYER_CLASS
|
|
2977
|
+
}), jsx("div", {
|
|
2978
|
+
className: ATOMIX_GLASS.OVERLAY_HIGHLIGHT_CLASS
|
|
2979
|
+
}) ]
|
|
2980
|
+
}), withBorder && jsxs(Fragment, {
|
|
2981
|
+
children: [ jsx("span", {
|
|
2982
|
+
className: ATOMIX_GLASS.BORDER_1_CLASS
|
|
2983
|
+
}), jsx("span", {
|
|
2984
|
+
className: ATOMIX_GLASS.BORDER_2_CLASS
|
|
2985
|
+
}) ]
|
|
2986
|
+
}), debugPerformance && performanceMetrics && jsx(PerformanceDashboard, {
|
|
2987
|
+
metrics: performanceMetrics,
|
|
2988
|
+
isVisible: !0,
|
|
2989
|
+
onClose: () => {}
|
|
2990
|
+
}) ]
|
|
2991
|
+
});
|
|
2992
|
+
}
|
|
2993
|
+
|
|
2994
|
+
const Checkbox = React.memo( forwardRef((({label: label, checked: checked, onChange: onChange, className: className = "", style: style, disabled: disabled = !1, required: required = !1, id: id, name: name, value: value, invalid: invalid = !1, valid: valid = !1, indeterminate: indeterminate = !1, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, onClick: onClick, glass: glass, ...props}, ref) => {
|
|
2995
|
+
// Local ref to handle indeterminate state
|
|
2996
|
+
const localRef = useRef(null);
|
|
2997
|
+
// Merge refs
|
|
2998
|
+
useImperativeHandle(ref, (() => localRef.current)),
|
|
2999
|
+
// Handle indeterminate
|
|
3000
|
+
useEffect((() => {
|
|
3001
|
+
localRef.current && (localRef.current.indeterminate = Boolean(indeterminate));
|
|
3002
|
+
}), [ indeterminate ]);
|
|
3003
|
+
// Generate classes
|
|
3004
|
+
let validationClass = "";
|
|
3005
|
+
invalid ? validationClass = "is-error" : valid && (validationClass = "is-valid");
|
|
3006
|
+
const checkboxClass = `c-checkbox ${validationClass} ${disabled ? "is-disabled" : ""} ${indeterminate ? "c-checkbox--mixed" : ""} ${glass ? "c-checkbox--glass" : ""} ${className}`.trim(), inputElement = jsx("input", {
|
|
3007
|
+
ref: localRef,
|
|
3008
|
+
type: "checkbox",
|
|
3009
|
+
className: "c-checkbox__input",
|
|
3010
|
+
checked: checked,
|
|
3011
|
+
onChange: onChange,
|
|
3012
|
+
onClick: onClick,
|
|
1938
3013
|
disabled: disabled,
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
3014
|
+
required: required,
|
|
3015
|
+
id: id,
|
|
3016
|
+
name: name,
|
|
3017
|
+
value: value,
|
|
3018
|
+
"aria-label": label ? void 0 : ariaLabel,
|
|
3019
|
+
"aria-describedby": ariaDescribedBy,
|
|
3020
|
+
"aria-invalid": invalid,
|
|
3021
|
+
...props
|
|
3022
|
+
});
|
|
3023
|
+
let content;
|
|
3024
|
+
if (content = id && label ? jsxs("div", {
|
|
3025
|
+
className: checkboxClass,
|
|
1948
3026
|
style: style,
|
|
1949
|
-
children: [ jsx("
|
|
1950
|
-
|
|
1951
|
-
className: "c-radio__input",
|
|
1952
|
-
checked: checked,
|
|
1953
|
-
onChange: onChange,
|
|
1954
|
-
disabled: disabled,
|
|
1955
|
-
required: required,
|
|
1956
|
-
id: id,
|
|
1957
|
-
name: name,
|
|
1958
|
-
value: value,
|
|
1959
|
-
"aria-label": label ? void 0 : ariaLabel,
|
|
1960
|
-
"aria-describedby": ariaDescribedBy,
|
|
1961
|
-
"aria-invalid": invalid
|
|
1962
|
-
}), label && jsx("label", {
|
|
1963
|
-
className: "c-radio__label",
|
|
3027
|
+
children: [ inputElement, jsx("label", {
|
|
3028
|
+
className: "c-checkbox__label",
|
|
1964
3029
|
htmlFor: id,
|
|
1965
3030
|
children: label
|
|
1966
3031
|
}) ]
|
|
1967
|
-
})
|
|
1968
|
-
|
|
1969
|
-
|
|
3032
|
+
}) : label ? jsxs("label", {
|
|
3033
|
+
className: checkboxClass,
|
|
3034
|
+
style: style,
|
|
3035
|
+
children: [ inputElement, jsx("span", {
|
|
3036
|
+
className: "c-checkbox__label",
|
|
3037
|
+
children: label
|
|
3038
|
+
}) ]
|
|
3039
|
+
}) : jsx("div", {
|
|
3040
|
+
className: checkboxClass,
|
|
3041
|
+
style: style,
|
|
3042
|
+
children: inputElement
|
|
3043
|
+
}), glass) {
|
|
1970
3044
|
const defaultGlassProps = {
|
|
1971
3045
|
displacementScale: 40,
|
|
1972
|
-
blurAmount: 1,
|
|
1973
|
-
saturation: 160,
|
|
1974
|
-
aberrationIntensity: .3,
|
|
1975
|
-
borderRadius: 6,
|
|
1976
|
-
mode: "shader"
|
|
1977
|
-
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
1978
|
-
...defaultGlassProps,
|
|
1979
|
-
...glass
|
|
1980
|
-
};
|
|
1981
|
-
return jsx(AtomixGlass, {
|
|
1982
|
-
...glassProps,
|
|
1983
|
-
children:
|
|
1984
|
-
});
|
|
1985
|
-
}
|
|
1986
|
-
return radioContent;
|
|
1987
|
-
}));
|
|
1988
|
-
|
|
1989
|
-
Radio.displayName = "Radio";
|
|
1990
|
-
|
|
1991
|
-
var commonjsGlobal = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {};
|
|
1992
|
-
|
|
1993
|
-
function getDefaultExportFromCjs(x) {
|
|
1994
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x.default : x;
|
|
1995
|
-
}
|
|
1996
|
-
|
|
1997
|
-
var fails$8 = function(exec) {
|
|
1998
|
-
try {
|
|
1999
|
-
return !!exec();
|
|
2000
|
-
} catch (error) {
|
|
2001
|
-
return !0;
|
|
2002
|
-
}
|
|
2003
|
-
}, functionBindNative = !fails$8((function() {
|
|
2004
|
-
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
|
2005
|
-
var test = function() {/* empty */}.bind();
|
|
2006
|
-
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
2007
|
-
return "function" != typeof test || test.hasOwnProperty("prototype");
|
|
2008
|
-
})), NATIVE_BIND$3 = functionBindNative, FunctionPrototype$1 = Function.prototype, call$5 = FunctionPrototype$1.call, uncurryThisWithBind = NATIVE_BIND$3 && FunctionPrototype$1.bind.bind(call$5, call$5), functionUncurryThis = NATIVE_BIND$3 ? uncurryThisWithBind : function(fn) {
|
|
2009
|
-
return function() {
|
|
2010
|
-
return call$5.apply(fn, arguments);
|
|
2011
|
-
};
|
|
2012
|
-
}, objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf), check = function(it) {
|
|
2013
|
-
return it && it.Math === Math && it;
|
|
2014
|
-
}, globalThis_1 =
|
|
2015
|
-
// eslint-disable-next-line es/no-global-this -- safe
|
|
2016
|
-
check("object" == typeof globalThis && globalThis) || check("object" == typeof window && window) ||
|
|
2017
|
-
// eslint-disable-next-line no-restricted-globals -- safe
|
|
2018
|
-
check("object" == typeof self && self) || check("object" == typeof commonjsGlobal && commonjsGlobal) || check("object" == typeof commonjsGlobal && commonjsGlobal) ||
|
|
2019
|
-
// eslint-disable-next-line no-new-func -- fallback
|
|
2020
|
-
function() {
|
|
2021
|
-
return this;
|
|
2022
|
-
}() || Function("return this")(), NATIVE_BIND$2 = functionBindNative, FunctionPrototype = Function.prototype, apply$1 = FunctionPrototype.apply, call$4 = FunctionPrototype.call, functionApply = "object" == typeof Reflect && Reflect.apply || (NATIVE_BIND$2 ? call$4.bind(apply$1) : function() {
|
|
2023
|
-
return call$4.apply(apply$1, arguments);
|
|
2024
|
-
}), uncurryThis$7 = functionUncurryThis, toString$3 = uncurryThis$7({}.toString), stringSlice = uncurryThis$7("".slice), classofRaw$2 = function(it) {
|
|
2025
|
-
return stringSlice(toString$3(it), 8, -1);
|
|
2026
|
-
}, classofRaw$1 = classofRaw$2, uncurryThis$6 = functionUncurryThis, functionUncurryThisClause = function(fn) {
|
|
2027
|
-
// Nashorn bug:
|
|
2028
|
-
// https://github.com/zloirock/core-js/issues/1128
|
|
2029
|
-
// https://github.com/zloirock/core-js/issues/1130
|
|
2030
|
-
if ("Function" === classofRaw$1(fn)) return uncurryThis$6(fn);
|
|
2031
|
-
}, documentAll = "object" == typeof document && document.all, isCallable$8 = void 0 === documentAll && void 0 !== documentAll ? function(argument) {
|
|
2032
|
-
return "function" == typeof argument || argument === documentAll;
|
|
2033
|
-
} : function(argument) {
|
|
2034
|
-
return "function" == typeof argument;
|
|
2035
|
-
}, objectGetOwnPropertyDescriptor = {}, descriptors = !fails$8((function() {
|
|
2036
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
2037
|
-
return 7 !== Object.defineProperty({}, 1, {
|
|
2038
|
-
get: function() {
|
|
2039
|
-
return 7;
|
|
2040
|
-
}
|
|
2041
|
-
})[1];
|
|
2042
|
-
})), NATIVE_BIND$1 = functionBindNative, call$3 = Function.prototype.call, functionCall = NATIVE_BIND$1 ? call$3.bind(call$3) : function() {
|
|
2043
|
-
return call$3.apply(call$3, arguments);
|
|
2044
|
-
}, objectPropertyIsEnumerable = {}, $propertyIsEnumerable = {}.propertyIsEnumerable, getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor, NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({
|
|
2045
|
-
1: 2
|
|
2046
|
-
}, 1);
|
|
2047
|
-
|
|
2048
|
-
// `Object.prototype.propertyIsEnumerable` method implementation
|
|
2049
|
-
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
|
2050
|
-
objectPropertyIsEnumerable.f = NASHORN_BUG ? function(V) {
|
|
2051
|
-
var descriptor = getOwnPropertyDescriptor$1(this, V);
|
|
2052
|
-
return !!descriptor && descriptor.enumerable;
|
|
2053
|
-
} : $propertyIsEnumerable;
|
|
2054
|
-
|
|
2055
|
-
var match, version, createPropertyDescriptor$2 = function(bitmap, value) {
|
|
2056
|
-
return {
|
|
2057
|
-
enumerable: !(1 & bitmap),
|
|
2058
|
-
configurable: !(2 & bitmap),
|
|
2059
|
-
writable: !(4 & bitmap),
|
|
2060
|
-
value: value
|
|
2061
|
-
};
|
|
2062
|
-
}, fails$5 = fails$8, classof$3 = classofRaw$2, $Object$3 = Object, split = functionUncurryThis("".split), indexedObject = fails$5((function() {
|
|
2063
|
-
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
2064
|
-
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
2065
|
-
return !$Object$3("z").propertyIsEnumerable(0);
|
|
2066
|
-
})) ? function(it) {
|
|
2067
|
-
return "String" === classof$3(it) ? split(it, "") : $Object$3(it);
|
|
2068
|
-
} : $Object$3, isNullOrUndefined$2 = function(it) {
|
|
2069
|
-
return null == it;
|
|
2070
|
-
}, isNullOrUndefined$1 = isNullOrUndefined$2, $TypeError$6 = TypeError, requireObjectCoercible$3 = function(it) {
|
|
2071
|
-
if (isNullOrUndefined$1(it)) throw new $TypeError$6("Can't call method on " + it);
|
|
2072
|
-
return it;
|
|
2073
|
-
}, IndexedObject = indexedObject, requireObjectCoercible$2 = requireObjectCoercible$3, toIndexedObject$2 = function(it) {
|
|
2074
|
-
return IndexedObject(requireObjectCoercible$2(it));
|
|
2075
|
-
}, isCallable$7 = isCallable$8, isObject$5 = function(it) {
|
|
2076
|
-
return "object" == typeof it ? null !== it : isCallable$7(it);
|
|
2077
|
-
}, path$3 = {}, path$2 = path$3, globalThis$a = globalThis_1, isCallable$6 = isCallable$8, aFunction = function(variable) {
|
|
2078
|
-
return isCallable$6(variable) ? variable : void 0;
|
|
2079
|
-
}, navigator = globalThis_1.navigator, userAgent$1 = navigator && navigator.userAgent, globalThis$8 = globalThis_1, userAgent = userAgent$1 ? String(userAgent$1) : "", process$1 = globalThis$8.process, Deno = globalThis$8.Deno, versions = process$1 && process$1.versions || Deno && Deno.version, v8 = versions && versions.v8;
|
|
2080
|
-
|
|
2081
|
-
v8 && (
|
|
2082
|
-
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
|
2083
|
-
// but their correct versions are not interesting for us
|
|
2084
|
-
version = (match = v8.split("."))[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1])),
|
|
2085
|
-
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
|
2086
|
-
// so check `userAgent` even if `.v8` exists, but 0
|
|
2087
|
-
!version && userAgent && (!(match = userAgent.match(/Edge\/(\d+)/)) || match[1] >= 74) && (match = userAgent.match(/Chrome\/(\d+)/)) && (version = +match[1]);
|
|
2088
|
-
|
|
2089
|
-
var V8_VERSION = version, fails$4 = fails$8, $String$3 = globalThis_1.String, symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$4((function() {
|
|
2090
|
-
var symbol = Symbol("symbol detection");
|
|
2091
|
-
// Chrome 38 Symbol has incorrect toString conversion
|
|
2092
|
-
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
2093
|
-
// nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
|
|
2094
|
-
// of course, fail.
|
|
2095
|
-
return !$String$3(symbol) || !(Object(symbol) instanceof Symbol) ||
|
|
2096
|
-
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
|
2097
|
-
!Symbol.sham && V8_VERSION && V8_VERSION < 41;
|
|
2098
|
-
})), useSymbolAsUid = symbolConstructorDetection && !Symbol.sham && "symbol" == typeof Symbol.iterator, isCallable$5 = isCallable$8, isPrototypeOf$1 = objectIsPrototypeOf, $Object$2 = Object, isSymbol$2 = useSymbolAsUid ? function(it) {
|
|
2099
|
-
return "symbol" == typeof it;
|
|
2100
|
-
} : function(it) {
|
|
2101
|
-
var $Symbol = function(namespace, method) {
|
|
2102
|
-
return arguments.length < 2 ? aFunction(path$2[namespace]) || aFunction(globalThis$a[namespace]) : path$2[namespace] && path$2[namespace][method] || globalThis$a[namespace] && globalThis$a[namespace][method];
|
|
2103
|
-
}("Symbol");
|
|
2104
|
-
return isCallable$5($Symbol) && isPrototypeOf$1($Symbol.prototype, $Object$2(it));
|
|
2105
|
-
}, $String$2 = String, isCallable$4 = isCallable$8, $TypeError$5 = TypeError, aCallable$2 = function(argument) {
|
|
2106
|
-
if (isCallable$4(argument)) return argument;
|
|
2107
|
-
throw new $TypeError$5(function(argument) {
|
|
2108
|
-
try {
|
|
2109
|
-
return $String$2(argument);
|
|
2110
|
-
} catch (error) {
|
|
2111
|
-
return "Object";
|
|
2112
|
-
}
|
|
2113
|
-
}(argument) + " is not a function");
|
|
2114
|
-
}, aCallable$1 = aCallable$2, isNullOrUndefined = isNullOrUndefined$2, call$2 = functionCall, isCallable$3 = isCallable$8, isObject$4 = isObject$5, $TypeError$4 = TypeError, sharedStore = {
|
|
2115
|
-
exports: {}
|
|
2116
|
-
}, globalThis$6 = globalThis_1, defineProperty = Object.defineProperty, globalThis$5 = globalThis_1, store$1 = sharedStore.exports = globalThis$5["__core-js_shared__"] || function(key, value) {
|
|
2117
|
-
try {
|
|
2118
|
-
defineProperty(globalThis$6, key, {
|
|
2119
|
-
value: value,
|
|
2120
|
-
configurable: !0,
|
|
2121
|
-
writable: !0
|
|
2122
|
-
});
|
|
2123
|
-
} catch (error) {
|
|
2124
|
-
globalThis$6[key] = value;
|
|
2125
|
-
}
|
|
2126
|
-
return value;
|
|
2127
|
-
}("__core-js_shared__", {});
|
|
2128
|
-
|
|
2129
|
-
/* eslint-disable es/no-symbol -- required for testing */ (store$1.versions || (store$1.versions = [])).push({
|
|
2130
|
-
version: "3.43.0",
|
|
2131
|
-
mode: "pure",
|
|
2132
|
-
copyright: "© 2014-2025 Denis Pushkarev (zloirock.ru)",
|
|
2133
|
-
license: "https://github.com/zloirock/core-js/blob/v3.43.0/LICENSE",
|
|
2134
|
-
source: "https://github.com/zloirock/core-js"
|
|
2135
|
-
});
|
|
2136
|
-
|
|
2137
|
-
var key, value, store = sharedStore.exports, requireObjectCoercible$1 = requireObjectCoercible$3, $Object$1 = Object, hasOwnProperty = functionUncurryThis({}.hasOwnProperty), hasOwnProperty_1 = Object.hasOwn || function(it, key) {
|
|
2138
|
-
return hasOwnProperty($Object$1(requireObjectCoercible$1(it)), key);
|
|
2139
|
-
}, uncurryThis$3 = functionUncurryThis, id = 0, postfix = Math.random(), toString$2 = uncurryThis$3(1.1.toString), hasOwn$2 = hasOwnProperty_1, NATIVE_SYMBOL = symbolConstructorDetection, USE_SYMBOL_AS_UID = useSymbolAsUid, Symbol$1 = globalThis_1.Symbol, WellKnownSymbolsStore = store[key = "wks"] || (store[key] = value || {}), createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1.for || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || function(key) {
|
|
2140
|
-
return "Symbol(" + (void 0 === key ? "" : key) + ")_" + toString$2(++id + postfix, 36);
|
|
2141
|
-
}, wellKnownSymbol$5 = function(name) {
|
|
2142
|
-
return hasOwn$2(WellKnownSymbolsStore, name) || (WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$2(Symbol$1, name) ? Symbol$1[name] : createWellKnownSymbol("Symbol." + name)),
|
|
2143
|
-
WellKnownSymbolsStore[name];
|
|
2144
|
-
}, call$1 = functionCall, isObject$3 = isObject$5, isSymbol$1 = isSymbol$2, $TypeError$3 = TypeError, TO_PRIMITIVE = wellKnownSymbol$5("toPrimitive"), toPrimitive = function(input, pref) {
|
|
2145
|
-
if (!isObject$3(input) || isSymbol$1(input)) return input;
|
|
2146
|
-
var result, func, exoticToPrim = (func = input[TO_PRIMITIVE], isNullOrUndefined(func) ? void 0 : aCallable$1(func));
|
|
2147
|
-
if (exoticToPrim) {
|
|
2148
|
-
if (void 0 === pref && (pref = "default"), result = call$1(exoticToPrim, input, pref),
|
|
2149
|
-
!isObject$3(result) || isSymbol$1(result)) return result;
|
|
2150
|
-
throw new $TypeError$3("Can't convert object to primitive value");
|
|
3046
|
+
blurAmount: 1,
|
|
3047
|
+
saturation: 160,
|
|
3048
|
+
aberrationIntensity: .3,
|
|
3049
|
+
borderRadius: 6,
|
|
3050
|
+
mode: "shader"
|
|
3051
|
+
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
3052
|
+
...defaultGlassProps,
|
|
3053
|
+
...glass
|
|
3054
|
+
};
|
|
3055
|
+
return jsx(AtomixGlass, {
|
|
3056
|
+
...glassProps,
|
|
3057
|
+
children: content
|
|
3058
|
+
});
|
|
2151
3059
|
}
|
|
2152
|
-
return
|
|
2153
|
-
|
|
2154
|
-
if ("string" === pref && isCallable$3(fn = input.toString) && !isObject$4(val = call$2(fn, input))) return val;
|
|
2155
|
-
if (isCallable$3(fn = input.valueOf) && !isObject$4(val = call$2(fn, input))) return val;
|
|
2156
|
-
if ("string" !== pref && isCallable$3(fn = input.toString) && !isObject$4(val = call$2(fn, input))) return val;
|
|
2157
|
-
throw new $TypeError$4("Can't convert object to primitive value");
|
|
2158
|
-
}(input, pref);
|
|
2159
|
-
}, isSymbol = isSymbol$2, toPropertyKey$2 = function(argument) {
|
|
2160
|
-
var key = toPrimitive(argument, "string");
|
|
2161
|
-
return isSymbol(key) ? key : key + "";
|
|
2162
|
-
}, isObject$2 = isObject$5, document$1 = globalThis_1.document, EXISTS = isObject$2(document$1) && isObject$2(document$1.createElement), ie8DomDefine = !descriptors && !fails$8((function() {
|
|
2163
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
2164
|
-
return 7 !== Object.defineProperty((it = "div", EXISTS ? document$1.createElement(it) : {}), "a", {
|
|
2165
|
-
get: function() {
|
|
2166
|
-
return 7;
|
|
2167
|
-
}
|
|
2168
|
-
}).a;
|
|
2169
|
-
var it;
|
|
2170
|
-
})), DESCRIPTORS$3 = descriptors, call = functionCall, propertyIsEnumerableModule = objectPropertyIsEnumerable, createPropertyDescriptor$1 = createPropertyDescriptor$2, toIndexedObject$1 = toIndexedObject$2, toPropertyKey$1 = toPropertyKey$2, hasOwn$1 = hasOwnProperty_1, IE8_DOM_DEFINE$1 = ie8DomDefine, $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
3060
|
+
return content;
|
|
3061
|
+
})));
|
|
2171
3062
|
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
3063
|
+
Checkbox.displayName = "Checkbox";
|
|
3064
|
+
|
|
3065
|
+
/**
|
|
3066
|
+
* Form - A component for creating form layouts
|
|
3067
|
+
*/
|
|
3068
|
+
const Form = ({children: children, onSubmit: onSubmit, onReset: onReset, className: className = "", style: style, disabled: disabled = !1, id: id, method: method = "post", encType: encType, noValidate: noValidate = !1, autoComplete: autoComplete = "on"}) => {
|
|
3069
|
+
const {generateFormClass: generateFormClass, handleSubmit: handleSubmit, handleReset: handleReset} =
|
|
3070
|
+
/**
|
|
3071
|
+
* Form state and functionality
|
|
3072
|
+
* @param initialProps - Initial form properties
|
|
3073
|
+
* @returns Form state and methods
|
|
3074
|
+
*/
|
|
3075
|
+
function(initialProps) {
|
|
3076
|
+
// Default form properties
|
|
3077
|
+
const defaultProps = {
|
|
3078
|
+
disabled: !1,
|
|
3079
|
+
...initialProps
|
|
3080
|
+
};
|
|
3081
|
+
/**
|
|
3082
|
+
* Generate form class based on properties
|
|
3083
|
+
* @param props - Form properties
|
|
3084
|
+
* @returns Class string
|
|
3085
|
+
*/ return {
|
|
3086
|
+
defaultProps: defaultProps,
|
|
3087
|
+
generateFormClass: props => {
|
|
3088
|
+
const {disabled: disabled = defaultProps.disabled, className: className = ""} = props;
|
|
3089
|
+
return `${FORM_CLASSES_BASE} ${disabled ? FORM_CLASSES_DISABLED : ""} ${className}`.trim();
|
|
3090
|
+
},
|
|
3091
|
+
handleSubmit: handler => event => {
|
|
3092
|
+
event.preventDefault(), !defaultProps.disabled && handler && handler(event);
|
|
3093
|
+
},
|
|
3094
|
+
handleReset: handler => event => {
|
|
3095
|
+
!defaultProps.disabled && handler && handler(event);
|
|
3096
|
+
}
|
|
3097
|
+
};
|
|
3098
|
+
}({
|
|
3099
|
+
disabled: disabled
|
|
3100
|
+
}), formClass = generateFormClass({
|
|
3101
|
+
className: className,
|
|
3102
|
+
disabled: disabled
|
|
3103
|
+
});
|
|
3104
|
+
return jsx("form", {
|
|
3105
|
+
id: id,
|
|
3106
|
+
className: formClass,
|
|
3107
|
+
style: style,
|
|
3108
|
+
onSubmit: handleSubmit(onSubmit),
|
|
3109
|
+
onReset: handleReset(onReset),
|
|
3110
|
+
method: method,
|
|
3111
|
+
encType: encType,
|
|
3112
|
+
noValidate: noValidate,
|
|
3113
|
+
autoComplete: autoComplete,
|
|
3114
|
+
children: children
|
|
3115
|
+
});
|
|
2179
3116
|
};
|
|
2180
3117
|
|
|
2181
|
-
|
|
2182
|
-
var value = data[normalize(feature)];
|
|
2183
|
-
return value === POLYFILL || value !== NATIVE && (isCallable$2(detection) ? fails$2(detection) : !!detection);
|
|
2184
|
-
}, normalize = isForced$1.normalize = function(string) {
|
|
2185
|
-
return String(string).replace(replacement, ".").toLowerCase();
|
|
2186
|
-
}, data = isForced$1.data = {}, NATIVE = isForced$1.NATIVE = "N", POLYFILL = isForced$1.POLYFILL = "P", isForced_1 = isForced$1, aCallable = aCallable$2, NATIVE_BIND = functionBindNative, bind$1 = functionUncurryThisClause(functionUncurryThisClause.bind), objectDefineProperty = {}, v8PrototypeDefineBug = descriptors && fails$8((function() {
|
|
2187
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
2188
|
-
return 42 !== Object.defineProperty((function() {/* empty */}), "prototype", {
|
|
2189
|
-
value: 42,
|
|
2190
|
-
writable: !1
|
|
2191
|
-
}).prototype;
|
|
2192
|
-
})), isObject$1 = isObject$5, $String$1 = String, $TypeError$2 = TypeError, DESCRIPTORS$1 = descriptors, IE8_DOM_DEFINE = ie8DomDefine, V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug, anObject = function(argument) {
|
|
2193
|
-
if (isObject$1(argument)) return argument;
|
|
2194
|
-
throw new $TypeError$2($String$1(argument) + " is not an object");
|
|
2195
|
-
}, toPropertyKey = toPropertyKey$2, $TypeError$1 = TypeError, $defineProperty = Object.defineProperty, $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
3118
|
+
Form.displayName = "Form";
|
|
2196
3119
|
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
3120
|
+
/**
|
|
3121
|
+
* FormGroup - A component for grouping form controls with labels and help text
|
|
3122
|
+
*/
|
|
3123
|
+
const FormGroup = ({children: children, label: label, helperText: helperText, htmlFor: htmlFor, className: className = "", style: style, disabled: disabled = !1, required: required = !1, invalid: invalid = !1, valid: valid = !1, size: size = "md"}) => {
|
|
3124
|
+
const {generateFormGroupClass: generateFormGroupClass} =
|
|
3125
|
+
/**
|
|
3126
|
+
* Form Group state and functionality
|
|
3127
|
+
* @param initialProps - Initial form group properties
|
|
3128
|
+
* @returns Form Group state and methods
|
|
3129
|
+
*/
|
|
3130
|
+
function(initialProps) {
|
|
3131
|
+
// Default form group properties
|
|
3132
|
+
const defaultProps = {
|
|
3133
|
+
size: "md",
|
|
3134
|
+
disabled: !1,
|
|
3135
|
+
invalid: !1,
|
|
3136
|
+
valid: !1,
|
|
3137
|
+
...initialProps
|
|
3138
|
+
};
|
|
3139
|
+
/**
|
|
3140
|
+
* Generate form group class based on properties
|
|
3141
|
+
* @param props - Form group properties
|
|
3142
|
+
* @returns Class string
|
|
3143
|
+
*/ return {
|
|
3144
|
+
defaultProps: defaultProps,
|
|
3145
|
+
generateFormGroupClass: props => {
|
|
3146
|
+
const {size: size = defaultProps.size, disabled: disabled = defaultProps.disabled, invalid: invalid = defaultProps.invalid, valid: valid = defaultProps.valid, className: className = ""} = props;
|
|
3147
|
+
return `${FORM_GROUP_CLASSES_BASE} ${"md" === size ? "" : "sm" === size ? FORM_GROUP_CLASSES_SMALL : FORM_GROUP_CLASSES_LARGE} ${invalid ? FORM_GROUP_CLASSES_INVALID : valid ? FORM_GROUP_CLASSES_VALID : ""} ${disabled ? FORM_GROUP_CLASSES_DISABLED : ""} ${className}`.trim();
|
|
3148
|
+
}
|
|
3149
|
+
};
|
|
3150
|
+
}({
|
|
3151
|
+
size: size,
|
|
3152
|
+
disabled: disabled,
|
|
3153
|
+
invalid: invalid,
|
|
3154
|
+
valid: valid
|
|
3155
|
+
}), formGroupClass = generateFormGroupClass({
|
|
3156
|
+
className: className,
|
|
3157
|
+
disabled: disabled,
|
|
3158
|
+
invalid: invalid,
|
|
3159
|
+
valid: valid,
|
|
3160
|
+
size: size
|
|
3161
|
+
});
|
|
3162
|
+
return jsxs("div", {
|
|
3163
|
+
className: formGroupClass,
|
|
3164
|
+
style: style,
|
|
3165
|
+
children: [ label && jsxs("label", {
|
|
3166
|
+
className: "c-form-group__label",
|
|
3167
|
+
htmlFor: htmlFor,
|
|
3168
|
+
children: [ label, required && jsx("span", {
|
|
3169
|
+
className: "c-form-group__required",
|
|
3170
|
+
children: "*"
|
|
3171
|
+
}) ]
|
|
3172
|
+
}), jsx("div", {
|
|
3173
|
+
className: "c-form-group__field",
|
|
3174
|
+
children: children
|
|
3175
|
+
}), helperText && jsx("div", {
|
|
3176
|
+
className: "c-form-group__helper",
|
|
3177
|
+
children: helperText
|
|
3178
|
+
}) ]
|
|
3179
|
+
});
|
|
3180
|
+
};
|
|
3181
|
+
|
|
3182
|
+
FormGroup.displayName = "FormGroup";
|
|
3183
|
+
|
|
3184
|
+
/**
|
|
3185
|
+
* Input - A component for text input fields
|
|
3186
|
+
*/
|
|
3187
|
+
const Input = memo( forwardRef((({type: type = "text", value: value, defaultValue: defaultValue, onChange: onChange, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder, className: className = "", style: style, disabled: disabled = !1, required: required = !1, readOnly: readOnly = !1, id: id, name: name, autoComplete: autoComplete, autoFocus: autoFocus = !1, size: size = "md", variant: variant, invalid: invalid = !1, valid: valid = !1, maxLength: maxLength, minLength: minLength, pattern: pattern, min: min, max: max, step: step, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, glass: glass}, ref) => {
|
|
3188
|
+
const {generateInputClass: generateInputClass} =
|
|
3189
|
+
/**
|
|
3190
|
+
* Input state and functionality
|
|
3191
|
+
* @param initialProps - Initial input properties
|
|
3192
|
+
* @returns Input state and methods
|
|
3193
|
+
*/
|
|
3194
|
+
function(initialProps) {
|
|
3195
|
+
// Default input properties
|
|
3196
|
+
const defaultProps = {
|
|
3197
|
+
size: "md",
|
|
3198
|
+
disabled: !1,
|
|
3199
|
+
invalid: !1,
|
|
3200
|
+
valid: !1,
|
|
3201
|
+
...initialProps
|
|
3202
|
+
};
|
|
3203
|
+
/**
|
|
3204
|
+
* Generate input class based on properties
|
|
3205
|
+
* @param props - Input properties
|
|
3206
|
+
* @returns Class string
|
|
3207
|
+
*/ return {
|
|
3208
|
+
defaultProps: defaultProps,
|
|
3209
|
+
generateInputClass: props => {
|
|
3210
|
+
const {size: size = defaultProps.size, variant: variant = defaultProps.variant, disabled: disabled = defaultProps.disabled, invalid: invalid = defaultProps.invalid, valid: valid = defaultProps.valid, className: className = "", type: type} = props;
|
|
3211
|
+
let validationClass = "";
|
|
3212
|
+
invalid ? validationClass = INPUT_CLASSES_INVALID : valid && (validationClass = INPUT_CLASSES_VALID);
|
|
3213
|
+
return `${INPUT_CLASSES_BASE} ${"md" === size ? "" : "sm" === size ? INPUT_CLASSES_SMALL : INPUT_CLASSES_LARGE} ${variant ? `c-input--${variant}` : ""} ${"textarea" === type ? "c-input--textarea" : ""} ${validationClass} ${disabled ? INPUT_CLASSES_DISABLED : ""} ${className}`.trim();
|
|
3214
|
+
},
|
|
3215
|
+
generateWrapperClass: props => {
|
|
3216
|
+
const {className: className = ""} = props, {prefixIcon: prefixIcon = !1, suffixIcon: suffixIcon = !1, clearable: clearable = !1, showCounter: showCounter = !1, showPasswordToggle: showPasswordToggle = !1, fullWidth: fullWidth = !1} = initialProps || {}, classes = [ INPUT_ELEMENTS_WRAPPER ];
|
|
3217
|
+
return prefixIcon && classes.push(INPUT_CLASSES_PREFIX_ICON), (suffixIcon || clearable || showPasswordToggle) && classes.push(INPUT_CLASSES_SUFFIX_ICON),
|
|
3218
|
+
clearable && classes.push(INPUT_CLASSES_CLEARABLE), showCounter && classes.push(INPUT_CLASSES_WITH_COUNTER),
|
|
3219
|
+
showPasswordToggle && classes.push(INPUT_CLASSES_PASSWORD_TOGGLE), fullWidth && classes.push(INPUT_CLASSES_FULL_WIDTH),
|
|
3220
|
+
className && classes.push(className), classes.filter(Boolean).join(" ");
|
|
3221
|
+
}
|
|
3222
|
+
};
|
|
3223
|
+
}({
|
|
3224
|
+
size: size,
|
|
3225
|
+
variant: variant,
|
|
3226
|
+
disabled: disabled,
|
|
3227
|
+
invalid: invalid,
|
|
3228
|
+
valid: valid
|
|
3229
|
+
}), inputClass = generateInputClass({
|
|
3230
|
+
className: `${className} ${glass ? "c-input--glass" : ""}`.trim(),
|
|
3231
|
+
size: size,
|
|
3232
|
+
variant: variant,
|
|
3233
|
+
disabled: disabled,
|
|
3234
|
+
invalid: invalid,
|
|
3235
|
+
valid: valid,
|
|
3236
|
+
type: type
|
|
3237
|
+
}), inputElement = jsx("input", {
|
|
3238
|
+
ref: ref,
|
|
3239
|
+
type: type,
|
|
3240
|
+
className: inputClass,
|
|
3241
|
+
value: value,
|
|
3242
|
+
defaultValue: defaultValue,
|
|
3243
|
+
onChange: onChange,
|
|
3244
|
+
onBlur: onBlur,
|
|
3245
|
+
onFocus: onFocus,
|
|
3246
|
+
placeholder: placeholder,
|
|
3247
|
+
disabled: disabled,
|
|
3248
|
+
required: required,
|
|
3249
|
+
readOnly: readOnly,
|
|
3250
|
+
id: id,
|
|
3251
|
+
name: name,
|
|
3252
|
+
autoComplete: autoComplete,
|
|
3253
|
+
autoFocus: autoFocus,
|
|
3254
|
+
maxLength: maxLength,
|
|
3255
|
+
minLength: minLength,
|
|
3256
|
+
pattern: pattern,
|
|
3257
|
+
min: min,
|
|
3258
|
+
max: max,
|
|
3259
|
+
step: step,
|
|
3260
|
+
"aria-label": ariaLabel,
|
|
3261
|
+
"aria-describedby": ariaDescribedBy,
|
|
3262
|
+
"aria-invalid": invalid,
|
|
3263
|
+
style: glass ? {
|
|
3264
|
+
...style
|
|
3265
|
+
} : style
|
|
3266
|
+
});
|
|
3267
|
+
if (glass) {
|
|
3268
|
+
// Default glass settings for inputs
|
|
3269
|
+
const defaultGlassProps = {
|
|
3270
|
+
displacementScale: 60,
|
|
3271
|
+
blurAmount: 1,
|
|
3272
|
+
saturation: 180,
|
|
3273
|
+
aberrationIntensity: .2,
|
|
3274
|
+
borderRadius: 12,
|
|
3275
|
+
mode: "shader"
|
|
3276
|
+
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
3277
|
+
...defaultGlassProps,
|
|
3278
|
+
...glass
|
|
3279
|
+
};
|
|
3280
|
+
return jsx(AtomixGlass, {
|
|
3281
|
+
...glassProps,
|
|
3282
|
+
children: inputElement
|
|
2206
3283
|
});
|
|
2207
3284
|
}
|
|
2208
|
-
return
|
|
2209
|
-
}
|
|
2210
|
-
if (anObject(O), P = toPropertyKey(P), anObject(Attributes), IE8_DOM_DEFINE) try {
|
|
2211
|
-
return $defineProperty(O, P, Attributes);
|
|
2212
|
-
} catch (error) {/* empty */}
|
|
2213
|
-
if ("get" in Attributes || "set" in Attributes) throw new $TypeError$1("Accessors not supported");
|
|
2214
|
-
return "value" in Attributes && (O[P] = Attributes.value), O;
|
|
2215
|
-
};
|
|
2216
|
-
|
|
2217
|
-
var definePropertyModule = objectDefineProperty, createPropertyDescriptor = createPropertyDescriptor$2, createNonEnumerableProperty$1 = descriptors ? function(object, key, value) {
|
|
2218
|
-
return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
|
|
2219
|
-
} : function(object, key, value) {
|
|
2220
|
-
return object[key] = value, object;
|
|
2221
|
-
}, globalThis$2 = globalThis_1, apply = functionApply, uncurryThis$1 = functionUncurryThisClause, isCallable$1 = isCallable$8, getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f, isForced = isForced_1, path$1 = path$3, bind = function(fn, that) {
|
|
2222
|
-
return aCallable(fn), void 0 === that ? fn : NATIVE_BIND ? bind$1(fn, that) : function() {
|
|
2223
|
-
return fn.apply(that, arguments);
|
|
2224
|
-
};
|
|
2225
|
-
}, createNonEnumerableProperty = createNonEnumerableProperty$1, hasOwn = hasOwnProperty_1, wrapConstructor = function(NativeConstructor) {
|
|
2226
|
-
var Wrapper = function(a, b, c) {
|
|
2227
|
-
if (this instanceof Wrapper) {
|
|
2228
|
-
switch (arguments.length) {
|
|
2229
|
-
case 0:
|
|
2230
|
-
return new NativeConstructor;
|
|
3285
|
+
return inputElement;
|
|
3286
|
+
})));
|
|
2231
3287
|
|
|
2232
|
-
|
|
2233
|
-
return new NativeConstructor(a);
|
|
3288
|
+
Input.displayName = "Input";
|
|
2234
3289
|
|
|
2235
|
-
|
|
2236
|
-
|
|
3290
|
+
/**
|
|
3291
|
+
* Radio - A component for radio button inputs
|
|
3292
|
+
*/
|
|
3293
|
+
const Radio = memo((({label: label, checked: checked = !1, onChange: onChange, className: className = "", style: style, disabled: disabled = !1, required: required = !1, id: id, name: name, value: value, invalid: invalid = !1, valid: valid = !1, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, glass: glass}) => {
|
|
3294
|
+
const {generateRadioClass: generateRadioClass} =
|
|
3295
|
+
/**
|
|
3296
|
+
* Radio state and functionality
|
|
3297
|
+
* @param initialProps - Initial radio properties
|
|
3298
|
+
* @returns Radio state and methods
|
|
3299
|
+
*/
|
|
3300
|
+
function(initialProps) {
|
|
3301
|
+
// Default radio properties
|
|
3302
|
+
const defaultProps = {
|
|
3303
|
+
disabled: !1,
|
|
3304
|
+
invalid: !1,
|
|
3305
|
+
valid: !1,
|
|
3306
|
+
...initialProps
|
|
3307
|
+
};
|
|
3308
|
+
/**
|
|
3309
|
+
* Generate radio class based on properties
|
|
3310
|
+
* @param props - Radio properties
|
|
3311
|
+
* @returns Class string
|
|
3312
|
+
*/ return {
|
|
3313
|
+
defaultProps: defaultProps,
|
|
3314
|
+
generateRadioClass: props => {
|
|
3315
|
+
const {disabled: disabled = defaultProps.disabled, invalid: invalid = defaultProps.invalid, valid: valid = defaultProps.valid, className: className = ""} = props;
|
|
3316
|
+
let validationClass = "";
|
|
3317
|
+
invalid ? validationClass = RADIO_CLASSES_INVALID : valid && (validationClass = RADIO_CLASSES_VALID);
|
|
3318
|
+
return `${RADIO_CLASSES_BASE} ${validationClass} ${disabled ? RADIO_CLASSES_DISABLED : ""} ${className}`.trim();
|
|
2237
3319
|
}
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
},
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
}
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
// eslint-disable-next-line no-self-compare -- NaN check
|
|
2288
|
-
if ((value = O[index++]) != value) return !0;
|
|
2289
|
-
// Array#indexOf ignores holes, Array#includes - not
|
|
2290
|
-
} else for (;length > index; index++) if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
|
2291
|
-
return !IS_INCLUDES && -1;
|
|
2292
|
-
};
|
|
2293
|
-
}, $includes = [ createMethod(!0), createMethod(!1) ][0];
|
|
2294
|
-
|
|
2295
|
-
// `Array.prototype.includes` method
|
|
2296
|
-
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
2297
|
-
_export({
|
|
2298
|
-
target: "Array",
|
|
2299
|
-
proto: !0,
|
|
2300
|
-
forced: fails$8((function() {
|
|
2301
|
-
// eslint-disable-next-line es/no-array-prototype-includes -- detection
|
|
2302
|
-
return !Array(1).includes();
|
|
2303
|
-
}))
|
|
2304
|
-
}, {
|
|
2305
|
-
includes: function(el /* , fromIndex = 0 */) {
|
|
2306
|
-
return $includes(this, el, arguments.length > 1 ? arguments[1] : void 0);
|
|
2307
|
-
}
|
|
2308
|
-
});
|
|
2309
|
-
|
|
2310
|
-
var includes$4 = getBuiltInPrototypeMethod$2("Array", "includes"), isObject = isObject$5, classof$2 = classofRaw$2, MATCH$1 = wellKnownSymbol$5("match"), $TypeError = TypeError, test = {};
|
|
2311
|
-
|
|
2312
|
-
test[wellKnownSymbol$5("toStringTag")] = "z";
|
|
2313
|
-
|
|
2314
|
-
var TO_STRING_TAG_SUPPORT = "[object z]" === String(test), isCallable = isCallable$8, classofRaw = classofRaw$2, TO_STRING_TAG = wellKnownSymbol$5("toStringTag"), $Object = Object, CORRECT_ARGUMENTS = "Arguments" === classofRaw(function() {
|
|
2315
|
-
return arguments;
|
|
2316
|
-
}()), classof = TO_STRING_TAG_SUPPORT ? classofRaw : function(it) {
|
|
2317
|
-
var O, tag, result;
|
|
2318
|
-
return void 0 === it ? "Undefined" : null === it ? "Null" : "string" == typeof (tag = function(it, key) {
|
|
2319
|
-
try {
|
|
2320
|
-
return it[key];
|
|
2321
|
-
} catch (error) {/* empty */}
|
|
2322
|
-
}(O = $Object(it), TO_STRING_TAG)) ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : "Object" === (result = classofRaw(O)) && isCallable(O.callee) ? "Arguments" : result;
|
|
2323
|
-
}, $String = String, MATCH = wellKnownSymbol$5("match"), $ = _export, notARegExp = function(it) {
|
|
2324
|
-
if (function(it) {
|
|
2325
|
-
var isRegExp;
|
|
2326
|
-
return isObject(it) && (void 0 !== (isRegExp = it[MATCH$1]) ? !!isRegExp : "RegExp" === classof$2(it));
|
|
2327
|
-
}(it)) throw new $TypeError("The method doesn't accept regular expressions");
|
|
2328
|
-
return it;
|
|
2329
|
-
}, requireObjectCoercible = requireObjectCoercible$3, toString = function(argument) {
|
|
2330
|
-
if ("Symbol" === classof(argument)) throw new TypeError("Cannot convert a Symbol value to a string");
|
|
2331
|
-
return $String(argument);
|
|
2332
|
-
}, stringIndexOf = functionUncurryThis("".indexOf);
|
|
2333
|
-
|
|
2334
|
-
// `String.prototype.includes` method
|
|
2335
|
-
// https://tc39.es/ecma262/#sec-string.prototype.includes
|
|
2336
|
-
$({
|
|
2337
|
-
target: "String",
|
|
2338
|
-
proto: !0,
|
|
2339
|
-
forced: !function(METHOD_NAME) {
|
|
2340
|
-
var regexp = /./;
|
|
2341
|
-
try {
|
|
2342
|
-
"/./"[METHOD_NAME](regexp);
|
|
2343
|
-
} catch (error1) {
|
|
2344
|
-
try {
|
|
2345
|
-
return regexp[MATCH] = !1, "/./"[METHOD_NAME](regexp);
|
|
2346
|
-
} catch (error2) {/* empty */}
|
|
2347
|
-
}
|
|
2348
|
-
return !1;
|
|
2349
|
-
}("includes")
|
|
2350
|
-
}, {
|
|
2351
|
-
includes: function(searchString /* , position = 0 */) {
|
|
2352
|
-
return !!~stringIndexOf(toString(requireObjectCoercible(this)), toString(notARegExp(searchString)), arguments.length > 1 ? arguments[1] : void 0);
|
|
3320
|
+
};
|
|
3321
|
+
}({
|
|
3322
|
+
disabled: disabled,
|
|
3323
|
+
invalid: invalid,
|
|
3324
|
+
valid: valid
|
|
3325
|
+
}), radioClass = generateRadioClass({
|
|
3326
|
+
className: `${className} ${glass ? "c-radio--glass" : ""}`.trim(),
|
|
3327
|
+
disabled: disabled,
|
|
3328
|
+
invalid: invalid,
|
|
3329
|
+
valid: valid
|
|
3330
|
+
}), radioContent = jsxs("div", {
|
|
3331
|
+
className: radioClass,
|
|
3332
|
+
style: style,
|
|
3333
|
+
children: [ jsx("input", {
|
|
3334
|
+
type: "radio",
|
|
3335
|
+
className: "c-radio__input",
|
|
3336
|
+
checked: checked,
|
|
3337
|
+
onChange: onChange,
|
|
3338
|
+
disabled: disabled,
|
|
3339
|
+
required: required,
|
|
3340
|
+
id: id,
|
|
3341
|
+
name: name,
|
|
3342
|
+
value: value,
|
|
3343
|
+
"aria-label": label ? void 0 : ariaLabel,
|
|
3344
|
+
"aria-describedby": ariaDescribedBy,
|
|
3345
|
+
"aria-invalid": invalid
|
|
3346
|
+
}), label && jsx("label", {
|
|
3347
|
+
className: "c-radio__label",
|
|
3348
|
+
htmlFor: id,
|
|
3349
|
+
children: label
|
|
3350
|
+
}) ]
|
|
3351
|
+
});
|
|
3352
|
+
if (glass) {
|
|
3353
|
+
// Default glass settings for radio buttons
|
|
3354
|
+
const defaultGlassProps = {
|
|
3355
|
+
displacementScale: 40,
|
|
3356
|
+
blurAmount: 1,
|
|
3357
|
+
saturation: 160,
|
|
3358
|
+
aberrationIntensity: .3,
|
|
3359
|
+
borderRadius: 6,
|
|
3360
|
+
mode: "shader"
|
|
3361
|
+
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
3362
|
+
...defaultGlassProps,
|
|
3363
|
+
...glass
|
|
3364
|
+
};
|
|
3365
|
+
return jsx(AtomixGlass, {
|
|
3366
|
+
...glassProps,
|
|
3367
|
+
children: radioContent
|
|
3368
|
+
});
|
|
2353
3369
|
}
|
|
2354
|
-
|
|
3370
|
+
return radioContent;
|
|
3371
|
+
}));
|
|
2355
3372
|
|
|
2356
|
-
|
|
3373
|
+
Radio.displayName = "Radio";
|
|
2357
3374
|
|
|
2358
|
-
const
|
|
2359
|
-
var own = it.includes;
|
|
2360
|
-
return it === ArrayPrototype || isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.includes ? arrayMethod : "string" == typeof it || it === StringPrototype || isPrototypeOf(StringPrototype, it) && own === StringPrototype.includes ? stringMethod : own;
|
|
2361
|
-
})), SelectContext = createContext(null), SelectOption = memo((({value: value, children: children, disabled: disabled = !1, className: className = "", style: style}) => {
|
|
3375
|
+
const SelectContext = createContext(null), SelectOption = memo((({value: value, children: children, disabled: disabled = !1, className: className = "", style: style}) => {
|
|
2362
3376
|
const context = useContext(SelectContext), label = "string" == typeof children ? children : value;
|
|
2363
3377
|
// We assume children is the label if it's a string, or we need a way to get label.
|
|
2364
3378
|
// For simplicity, we use children as label for registration if it's a string.
|
|
@@ -2476,7 +3490,10 @@ const Select = memo((({options: options, value: value, onChange: onChange, onBl
|
|
|
2476
3490
|
};
|
|
2477
3491
|
}), []);
|
|
2478
3492
|
// Toggle dropdown
|
|
2479
|
-
const
|
|
3493
|
+
const handleToggle = () => {
|
|
3494
|
+
disabled || (!isOpen && bodyRef.current && panelRef.current ? bodyRef.current.style.height = `${panelRef.current.clientHeight}px` : bodyRef.current && (bodyRef.current.style.height = "0px"),
|
|
3495
|
+
setIsOpen(!isOpen));
|
|
3496
|
+
}, handleItemClick = useCallback((option => {
|
|
2480
3497
|
if (setSelectedLabel(option.label), setIsOpen(!1), bodyRef.current && (bodyRef.current.style.height = "0px"),
|
|
2481
3498
|
nativeSelectRef.current && (nativeSelectRef.current.value = option.value), onChange) {
|
|
2482
3499
|
// Create a synthetic event
|
|
@@ -2520,7 +3537,15 @@ const Select = memo((({options: options, value: value, onChange: onChange, onBl
|
|
|
2520
3537
|
"aria-describedby": ariaDescribedBy,
|
|
2521
3538
|
"aria-invalid": invalid,
|
|
2522
3539
|
style: {
|
|
2523
|
-
|
|
3540
|
+
position: "absolute",
|
|
3541
|
+
width: "1px",
|
|
3542
|
+
height: "1px",
|
|
3543
|
+
padding: "0",
|
|
3544
|
+
margin: "-1px",
|
|
3545
|
+
overflow: "hidden",
|
|
3546
|
+
clip: "rect(0, 0, 0, 0)",
|
|
3547
|
+
whiteSpace: "nowrap",
|
|
3548
|
+
border: "0"
|
|
2524
3549
|
},
|
|
2525
3550
|
children: [ placeholder && jsx("option", {
|
|
2526
3551
|
value: "",
|
|
@@ -2533,11 +3558,29 @@ const Select = memo((({options: options, value: value, onChange: onChange, onBl
|
|
|
2533
3558
|
}, option.value))) ]
|
|
2534
3559
|
}), jsx("div", {
|
|
2535
3560
|
className: SELECT_CLASSES_SELECTED,
|
|
2536
|
-
onClick:
|
|
2537
|
-
|
|
2538
|
-
|
|
3561
|
+
onClick: handleToggle,
|
|
3562
|
+
onKeyDown: event => {
|
|
3563
|
+
if (!disabled) switch (event.key) {
|
|
3564
|
+
case "Enter":
|
|
3565
|
+
case " ":
|
|
3566
|
+
event.preventDefault(), handleToggle();
|
|
3567
|
+
break;
|
|
3568
|
+
|
|
3569
|
+
case "Escape":
|
|
3570
|
+
isOpen && (event.preventDefault(), setIsOpen(!1), bodyRef.current && (bodyRef.current.style.height = "0px"));
|
|
3571
|
+
break;
|
|
3572
|
+
|
|
3573
|
+
case "ArrowDown":
|
|
3574
|
+
case "ArrowUp":
|
|
3575
|
+
isOpen || (event.preventDefault(), handleToggle());
|
|
3576
|
+
}
|
|
2539
3577
|
},
|
|
2540
3578
|
"aria-disabled": disabled,
|
|
3579
|
+
tabIndex: disabled ? -1 : 0,
|
|
3580
|
+
role: "combobox",
|
|
3581
|
+
"aria-haspopup": "listbox",
|
|
3582
|
+
"aria-expanded": isOpen,
|
|
3583
|
+
"aria-controls": id ? `${id}-listbox` : void 0,
|
|
2541
3584
|
children: selectedLabel
|
|
2542
3585
|
}), jsx("i", {
|
|
2543
3586
|
className: `${SELECT_CLASSES_ICON_CARET} ${SELECT_CLASSES_TOGGLE_ICON}`
|
|
@@ -2552,10 +3595,16 @@ const Select = memo((({options: options, value: value, onChange: onChange, onBl
|
|
|
2552
3595
|
ref: panelRef,
|
|
2553
3596
|
children: jsx("ul", {
|
|
2554
3597
|
className: SELECT_CLASSES_SELECT_ITEMS,
|
|
3598
|
+
role: "listbox",
|
|
3599
|
+
id: id ? `${id}-listbox` : void 0,
|
|
3600
|
+
"aria-labelledby": id,
|
|
2555
3601
|
children: hasOptionsProp ? options.map(((option, index) => jsx("li", {
|
|
2556
3602
|
className: SELECT_CLASSES_SELECT_ITEM,
|
|
2557
3603
|
"data-value": option.value,
|
|
2558
3604
|
onClick: () => !option.disabled && handleItemClick(option),
|
|
3605
|
+
role: "option",
|
|
3606
|
+
"aria-selected": value === option.value,
|
|
3607
|
+
"aria-disabled": option.disabled,
|
|
2559
3608
|
children: jsxs("label", {
|
|
2560
3609
|
htmlFor: `SelectItem${index}`,
|
|
2561
3610
|
className: "c-checkbox",
|
|
@@ -2979,7 +4028,9 @@ const smoothStep = (a, b, t) => {
|
|
|
2979
4028
|
return this.canvasDPI;
|
|
2980
4029
|
}
|
|
2981
4030
|
},
|
|
2982
|
-
|
|
4031
|
+
createFBMEngine: createFBMEngine,
|
|
4032
|
+
fragmentShaders: fragmentShaders,
|
|
4033
|
+
liquidGlassWithTime: liquidGlassWithTime
|
|
2983
4034
|
}, Symbol.toStringTag, {
|
|
2984
4035
|
value: "Module"
|
|
2985
4036
|
}));
|