@shohojdhara/atomix 0.4.7 → 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 +172 -157
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +4 -4
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.d.ts +33 -0
- package/dist/charts.js +1274 -164
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +33 -10
- package/dist/core.js +1099 -83
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +33 -0
- package/dist/forms.js +2106 -1050
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +42 -1
- package/dist/heavy.js +1663 -638
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +442 -270
- package/dist/index.esm.js +1947 -680
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1982 -712
- 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 +136 -1827
- 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 +115 -0
- package/scripts/cli/commands/clean.js +109 -0
- package/scripts/cli/commands/doctor.js +88 -0
- package/scripts/cli/commands/generate.js +218 -0
- package/scripts/cli/commands/init.js +73 -0
- 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/compiler.js +114 -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 +158 -0
- package/scripts/cli/internal/generator.js +430 -0
- 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 +115 -0
- 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 +89 -0
- package/scripts/cli/utils/helpers.js +67 -0
- package/scripts/cli/utils/logger.js +75 -0
- package/scripts/cli/utils/security.js +302 -0
- package/scripts/cli/utils/telemetry.js +115 -0
- package/scripts/cli/utils/validation.js +37 -0
- package/scripts/cli/utils.js +28 -341
- 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.test.tsx +37 -3
- package/src/components/AtomixGlass/AtomixGlass.tsx +143 -31
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +129 -31
- package/src/components/AtomixGlass/PerformanceDashboard.tsx +219 -0
- package/src/components/AtomixGlass/README.md +25 -10
- package/src/components/AtomixGlass/__snapshots__/AtomixGlass.test.tsx.snap +216 -0
- 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 +148 -6
- package/src/lib/composables/useAtomixGlassStyles.ts +9 -7
- 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 +62 -7
- 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.atomix-glass.scss +17 -21
- package/src/styles/06-components/_components.edge-panel.scss +1 -5
- package/src/styles/06-components/_components.modal.scss +1 -4
- package/src/styles/06-components/_components.navbar.scss +1 -1
- package/src/styles/06-components/_components.testbutton.scss +212 -0
- package/src/styles/06-components/_components.testtypecheck.scss +212 -0
- package/src/styles/06-components/_components.tooltip.scss +9 -5
- 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/scripts/cli/component-generator.js +0 -564
- package/scripts/cli/interactive-init.js +0 -357
- package/src/styles/06-components/old.chart.styles.scss +0 -2788
package/dist/forms.js
CHANGED
|
@@ -45,20 +45,29 @@ import React, { memo, forwardRef, useMemo, useState, useRef, useEffect, useCallb
|
|
|
45
45
|
SHADER: "c-atomix-glass--shader"
|
|
46
46
|
},
|
|
47
47
|
DEFAULTS: {
|
|
48
|
-
DISPLACEMENT_SCALE:
|
|
49
|
-
BLUR_AMOUNT:
|
|
48
|
+
DISPLACEMENT_SCALE: 70,
|
|
49
|
+
BLUR_AMOUNT: 0,
|
|
50
50
|
SATURATION: 140,
|
|
51
|
-
ABERRATION_INTENSITY: 2
|
|
52
|
-
ELASTICITY: .
|
|
53
|
-
CORNER_RADIUS:
|
|
51
|
+
ABERRATION_INTENSITY: 2,
|
|
52
|
+
ELASTICITY: .15,
|
|
53
|
+
CORNER_RADIUS: 20,
|
|
54
54
|
// Default border-radius matching design system
|
|
55
|
-
PADDING: "0
|
|
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
|
-
ACTIVATION_ZONE:
|
|
70
|
+
ACTIVATION_ZONE: 200,
|
|
62
71
|
LERP_FACTOR: .08,
|
|
63
72
|
SMOOTHSTEP_POWER: 2.5,
|
|
64
73
|
MIN_BLUR: .1,
|
|
@@ -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;
|
|
@@ -463,20 +510,19 @@ let idCounter = 0;
|
|
|
463
510
|
const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({children: children, className: className = "", style: style, displacementScale: displacementScale = 25, blurAmount: blurAmount = .0625, saturation: saturation = 180, aberrationIntensity: aberrationIntensity = 2, mouseOffset: mouseOffset = {
|
|
464
511
|
x: 0,
|
|
465
512
|
y: 0
|
|
466
|
-
},
|
|
467
|
-
x: 0,
|
|
468
|
-
y: 0
|
|
469
|
-
}, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onMouseDown: onMouseDown, onMouseUp: onMouseUp, isHovered: isHovered = !1, isActive: isActive = !1, overLight: overLight = !1, overLightConfig: overLightConfig = {}, borderRadius: borderRadius = 0, padding: padding = "0 0", glassSize: glassSize = {
|
|
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 = {
|
|
470
514
|
width: 0,
|
|
471
515
|
height: 0
|
|
472
|
-
}, 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) => {
|
|
473
519
|
// Generate a stable, deterministic ID for SSR compatibility
|
|
474
520
|
// Use a module-level counter that's consistent across server and client
|
|
475
|
-
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);
|
|
476
522
|
// Lazy load shader utilities only when shader mode is needed
|
|
477
523
|
useEffect((() => {
|
|
478
524
|
"shader" === mode ?
|
|
479
|
-
// Dynamic import shader utilities
|
|
525
|
+
// Dynamic import shader utilities with animation support
|
|
480
526
|
Promise.resolve().then((() => shaderUtils)).then((shaderUtils => {
|
|
481
527
|
shaderUtilsRef.current = {
|
|
482
528
|
ShaderDisplacementGenerator: shaderUtils.ShaderDisplacementGenerator,
|
|
@@ -491,7 +537,7 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
491
537
|
// Generate shader map with debouncing and caching
|
|
492
538
|
useEffect((() => {
|
|
493
539
|
// Enhanced validation for shader mode
|
|
494
|
-
if ("shader" === mode && glassSize && validateGlassSize(glassSize)
|
|
540
|
+
if ("shader" === mode && glassSize && validateGlassSize(glassSize)) {
|
|
495
541
|
// Create cache key from size and variant
|
|
496
542
|
const cacheKey = `${glassSize.width}x${glassSize.height}-${shaderVariant}`, cachedUrl = (key => {
|
|
497
543
|
const entry = sharedShaderCache.get(key);
|
|
@@ -513,11 +559,9 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
513
559
|
width: glassSize.width,
|
|
514
560
|
height: glassSize.height,
|
|
515
561
|
fragment: selectedShader
|
|
516
|
-
}),
|
|
517
|
-
// Defer shader generation with longer delay to avoid blocking
|
|
518
|
-
setTimeout((() => {
|
|
562
|
+
}), shaderUpdateTimeoutRef.current = setTimeout((() => {
|
|
519
563
|
const url = shaderGeneratorRef.current?.updateShader() || "";
|
|
520
|
-
((key, url) => {
|
|
564
|
+
url && ((key, url) => {
|
|
521
565
|
// Evict oldest entries if at capacity
|
|
522
566
|
if (sharedShaderCache.size >= 15) {
|
|
523
567
|
const entries = Array.from(sharedShaderCache.entries());
|
|
@@ -549,7 +593,8 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
549
593
|
// Cleanup function with error handling
|
|
550
594
|
return () => {
|
|
551
595
|
shaderDebounceTimeoutRef.current && (clearTimeout(shaderDebounceTimeoutRef.current),
|
|
552
|
-
shaderDebounceTimeoutRef.current = null)
|
|
596
|
+
shaderDebounceTimeoutRef.current = null), shaderUpdateTimeoutRef.current && (clearTimeout(shaderUpdateTimeoutRef.current),
|
|
597
|
+
shaderUpdateTimeoutRef.current = null);
|
|
553
598
|
try {
|
|
554
599
|
shaderGeneratorRef.current?.destroy();
|
|
555
600
|
} catch (error) {
|
|
@@ -558,7 +603,37 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
558
603
|
shaderGeneratorRef.current = null;
|
|
559
604
|
}
|
|
560
605
|
};
|
|
561
|
-
}), [ 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 ]);
|
|
562
637
|
// Removed forced reflow to avoid layout thrash and potential feedback sizing loops
|
|
563
638
|
const [rectCache, setRectCache] = useState(null);
|
|
564
639
|
useEffect((() => {
|
|
@@ -610,21 +685,18 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
610
685
|
backdropFilter: `blur(${blurAmount}px) saturate(${saturation}%) contrast(1.05) brightness(1.05)`
|
|
611
686
|
};
|
|
612
687
|
}
|
|
613
|
-
}), [ liquidBlur, saturation, blurAmount, rectCache, effectiveReducedMotion, effectiveWithoutEffects, withLiquidBlur ]), containerVars = useMemo((() => {
|
|
688
|
+
}), [ liquidBlur, saturation, blurAmount, rectCache, effectiveReducedMotion, effectiveWithoutEffects, withLiquidBlur, overLightConfig ]), containerVars = useMemo((() => {
|
|
614
689
|
try {
|
|
615
690
|
// Safe extraction of mouse offset values
|
|
616
691
|
const mx = mouseOffset && "number" == typeof mouseOffset.x && !isNaN(mouseOffset.x) ? mouseOffset.x : 0, my = mouseOffset && "number" == typeof mouseOffset.y && !isNaN(mouseOffset.y) ? mouseOffset.y : 0;
|
|
617
692
|
return {
|
|
618
|
-
"--atomix-glass-container-width": `${glassSize?.width}`,
|
|
619
|
-
"--atomix-glass-container-height": `${glassSize?.height}`,
|
|
620
|
-
"--atomix-glass-container-padding": padding || "0 0",
|
|
621
693
|
"--atomix-glass-container-radius": `${"number" != typeof borderRadius || isNaN(borderRadius) ? 0 : borderRadius}px`,
|
|
622
694
|
"--atomix-glass-container-backdrop": backdropStyle?.backdropFilter || "none",
|
|
623
695
|
"--atomix-glass-container-shadow": overLight ? [ `inset 0 1px 0 rgba(255, 255, 255, ${(.4 + .002 * mx) * (overLightConfig?.shadowIntensity || 1)})`, `inset 0 -1px 0 rgba(0, 0, 0, ${(.2 + .001 * Math.abs(my)) * (overLightConfig?.shadowIntensity || 1)})`, `inset 0 0 20px rgba(0, 0, 0, ${(.08 + .001 * Math.abs(mx + my)) * (overLightConfig?.shadowIntensity || 1)})`, `0 2px 12px rgba(0, 0, 0, ${(.12 + .002 * Math.abs(my)) * (overLightConfig?.shadowIntensity || 1)})` ].join(", ") : "0 0 20px rgba(0, 0, 0, 0.15) inset, 0 4px 8px rgba(0, 0, 0, 0.08) inset",
|
|
624
696
|
"--atomix-glass-container-shadow-opacity": effectiveWithoutEffects ? 0 : 1,
|
|
625
697
|
// Background and shadow values use design token-aligned RGB values
|
|
626
698
|
"--atomix-glass-container-bg": overLight ? `linear-gradient(${180 + .5 * mx}deg, rgba(255, 255, 255, 0.1) 0%, transparent 20%, transparent 80%, rgba(0, 0, 0, 0.05) 100%)` : "none",
|
|
627
|
-
"--atomix-glass-container-text-shadow": overLight ? "0px 2px
|
|
699
|
+
"--atomix-glass-container-text-shadow": overLight ? "0px 1px 2px rgba(255, 255, 255, 0.15)" : "0px 2px 12px rgba(0, 0, 0, 0.4)",
|
|
628
700
|
"--atomix-glass-container-box-shadow": overLight ? "0px 16px 70px rgba(0, 0, 0, 0.75)" : "0px 12px 40px rgba(0, 0, 0, 0.25)"
|
|
629
701
|
};
|
|
630
702
|
} catch (error) {
|
|
@@ -639,7 +711,7 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
639
711
|
"--atomix-glass-container-text-shadow": "none"
|
|
640
712
|
};
|
|
641
713
|
}
|
|
642
|
-
}), [
|
|
714
|
+
}), [ borderRadius, backdropStyle, mouseOffset, overLight, effectiveWithoutEffects, overLightConfig ]);
|
|
643
715
|
return jsx("div", {
|
|
644
716
|
ref: el => {
|
|
645
717
|
// Apply force no-transition
|
|
@@ -668,10 +740,6 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
668
740
|
aberrationIntensity: "number" != typeof aberrationIntensity || isNaN(aberrationIntensity) ? 0 : aberrationIntensity,
|
|
669
741
|
shaderMapUrl: shaderMapUrl
|
|
670
742
|
}), jsx("div", {
|
|
671
|
-
ref: el => {
|
|
672
|
-
el && (el.style.setProperty("transition-duration", "0s", "important"), el.style.setProperty("animation-duration", "0s", "important"),
|
|
673
|
-
el.style.setProperty("transition-delay", "0s", "important"));
|
|
674
|
-
},
|
|
675
743
|
className: ATOMIX_GLASS.FILTER_OVERLAY_CLASS,
|
|
676
744
|
style: {
|
|
677
745
|
filter: `url(#${filterId})`
|
|
@@ -776,7 +844,7 @@ class {
|
|
|
776
844
|
}
|
|
777
845
|
}, updateAtomixGlassStyles = (wrapperElement, containerElement, params) => {
|
|
778
846
|
if (!wrapperElement && !containerElement) return;
|
|
779
|
-
const {mouseOffset: mouseOffset, globalMousePosition: globalMousePosition, glassSize: glassSize, isHovered: isHovered, isActive: isActive, isOverLight: isOverLight, baseOverLightConfig: baseOverLightConfig, effectiveBorderRadius: effectiveBorderRadius, effectiveWithoutEffects: effectiveWithoutEffects, effectiveReducedMotion: effectiveReducedMotion, elasticity: elasticity, directionalScale: directionalScale, onClick: onClick, withLiquidBlur: withLiquidBlur, blurAmount: blurAmount = ATOMIX_GLASS.DEFAULTS.BLUR_AMOUNT, saturation: saturation = ATOMIX_GLASS.DEFAULTS.SATURATION, padding: padding = ATOMIX_GLASS.DEFAULTS.PADDING} = params, mouseInfluence = calculateMouseInfluence(mouseOffset), hoverIntensity = isHovered ? 1.4 : 1, activeIntensity = isActive ? 1.6 : 1, overLightConfig = {
|
|
847
|
+
const {mouseOffset: mouseOffset, globalMousePosition: globalMousePosition, glassSize: glassSize, isHovered: isHovered, isActive: isActive, isOverLight: isOverLight, baseOverLightConfig: baseOverLightConfig, effectiveBorderRadius: effectiveBorderRadius, effectiveWithoutEffects: effectiveWithoutEffects, effectiveReducedMotion: effectiveReducedMotion, elasticity: elasticity, directionalScale: directionalScale, onClick: onClick, withLiquidBlur: withLiquidBlur, blurAmount: blurAmount = ATOMIX_GLASS.DEFAULTS.BLUR_AMOUNT, saturation: saturation = ATOMIX_GLASS.DEFAULTS.SATURATION, padding: padding = ATOMIX_GLASS.DEFAULTS.PADDING, isFixedOrSticky: isFixedOrSticky = !1} = params, mouseInfluence = calculateMouseInfluence(mouseOffset), hoverIntensity = isHovered ? 1.4 : 1, activeIntensity = isActive ? 1.6 : 1, overLightConfig = {
|
|
780
848
|
opacity: baseOverLightConfig.opacity * hoverIntensity * activeIntensity,
|
|
781
849
|
contrast: Math.min(1.6, baseOverLightConfig.contrast + .1 * mouseInfluence),
|
|
782
850
|
brightness: Math.min(1.1, baseOverLightConfig.brightness + .05 * mouseInfluence),
|
|
@@ -866,7 +934,7 @@ class {
|
|
|
866
934
|
}
|
|
867
935
|
// Update Container Styles (containerVars)
|
|
868
936
|
if (containerElement) {
|
|
869
|
-
const mx = mouseOffset.x, my = mouseOffset.y, EDGE_BLUR_MULTIPLIER =
|
|
937
|
+
const mx = mouseOffset.x, my = mouseOffset.y, EDGE_BLUR_MULTIPLIER = .5, CENTER_BLUR_MULTIPLIER = .2, FLOW_BLUR_MULTIPLIER = .3, MOUSE_INFLUENCE_BLUR_FACTOR = .4, EDGE_INTENSITY_MOUSE_FACTOR = .15, CENTER_INTENSITY_MOUSE_FACTOR = .1, MAX_BLUR_RELATIVE = 2, rect = containerElement.getBoundingClientRect();
|
|
870
938
|
let liquidBlur = {
|
|
871
939
|
baseBlur: blurAmount,
|
|
872
940
|
edgeBlur: blurAmount * EDGE_BLUR_MULTIPLIER,
|
|
@@ -888,22 +956,155 @@ class {
|
|
|
888
956
|
backdropFilterString = !withLiquidBlur || effectiveReducedMotion || effectiveWithoutEffects || area > 18e4 ? `blur(${clampBlur(Math.max(liquidBlur.baseBlur, .8 * liquidBlur.edgeBlur, 1.1 * liquidBlur.centerBlur, .9 * liquidBlur.flowBlur))}px) saturate(${Math.min(dynamicSaturation, 200)}%) contrast(${overLightConfig.contrast}) brightness(${overLightConfig.brightness})` : `blur(${clampBlur(.4 * liquidBlur.baseBlur + .25 * liquidBlur.edgeBlur + .15 * liquidBlur.centerBlur + .2 * liquidBlur.flowBlur)}px) saturate(${Math.min(dynamicSaturation, 200)}%) contrast(${overLightConfig.contrast}) brightness(${overLightConfig.brightness})`;
|
|
889
957
|
// Container variables
|
|
890
958
|
const style = containerElement.style;
|
|
891
|
-
style.setProperty("--atomix-glass-container-width", `${glassSize.width}`
|
|
959
|
+
style.setProperty("--atomix-glass-container-width", isFixedOrSticky ? `${glassSize.width}` : "100%"),
|
|
960
|
+
style.setProperty("--atomix-glass-container-height", isFixedOrSticky ? `${glassSize.height}` : "100%"),
|
|
892
961
|
style.setProperty("--atomix-glass-container-padding", padding), style.setProperty("--atomix-glass-container-radius", `${effectiveBorderRadius}px`),
|
|
893
962
|
style.setProperty("--atomix-glass-container-backdrop", backdropFilterString),
|
|
894
963
|
// Shadows
|
|
895
964
|
style.setProperty("--atomix-glass-container-shadow", isOverLight ? [ `inset 0 1px 0 rgba(255, 255, 255, ${(.4 + .002 * mx) * (overLightConfig.shadowIntensity || 1)})`, `inset 0 -1px 0 rgba(0, 0, 0, ${(.2 + .001 * Math.abs(my)) * (overLightConfig.shadowIntensity || 1)})`, `inset 0 0 20px rgba(0, 0, 0, ${(.08 + .001 * Math.abs(mx + my)) * (overLightConfig.shadowIntensity || 1)})`, `0 2px 12px rgba(0, 0, 0, ${(.12 + .002 * Math.abs(my)) * (overLightConfig.shadowIntensity || 1)})` ].join(", ") : "0 0 20px rgba(0, 0, 0, 0.15) inset, 0 4px 8px rgba(0, 0, 0, 0.08) inset"),
|
|
896
965
|
style.setProperty("--atomix-glass-container-shadow-opacity", effectiveWithoutEffects ? "0" : "1"),
|
|
897
966
|
style.setProperty("--atomix-glass-container-bg", isOverLight ? `linear-gradient(${180 + .5 * mx}deg, rgba(255, 255, 255, 0.1) 0%, transparent 20%, transparent 80%, rgba(0, 0, 0, 0.05) 100%)` : "none"),
|
|
898
|
-
style.setProperty("--atomix-glass-container-text-shadow", isOverLight ? "0px 2px
|
|
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)"),
|
|
899
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)");
|
|
900
969
|
}
|
|
901
|
-
}
|
|
970
|
+
};
|
|
902
971
|
|
|
903
972
|
/**
|
|
904
973
|
* Updates the styles of the AtomixGlass wrapper and container elements imperatively
|
|
905
974
|
* to avoid React re-renders on mouse movement.
|
|
906
|
-
*/
|
|
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) => {
|
|
907
1108
|
parentElement && backgroundDetectionCache.set(parentElement, {
|
|
908
1109
|
result: result,
|
|
909
1110
|
timestamp: Date.now(),
|
|
@@ -916,7 +1117,9 @@ class {
|
|
|
916
1117
|
* Composable hook for AtomixGlass component logic
|
|
917
1118
|
* Manages all state, calculations, and event handlers
|
|
918
1119
|
*/
|
|
919
|
-
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,
|
|
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}) {
|
|
920
1123
|
// State
|
|
921
1124
|
const [isHovered, setIsHovered] = useState(!1), [isActive, setIsActive] = useState(!1), cachedRectRef = useRef(null), internalGlobalMousePositionRef = useRef({
|
|
922
1125
|
x: 0,
|
|
@@ -930,7 +1133,47 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
930
1133
|
}), targetGlobalMousePositionRef = useRef({
|
|
931
1134
|
x: 0,
|
|
932
1135
|
y: 0
|
|
933
|
-
}), 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}) {
|
|
934
1177
|
const [glassSize, setGlassSize] = useState({
|
|
935
1178
|
width: 270,
|
|
936
1179
|
height: 69
|
|
@@ -989,7 +1232,10 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
989
1232
|
glassRef: glassRef,
|
|
990
1233
|
effectiveBorderRadius: effectiveBorderRadius,
|
|
991
1234
|
cachedRectRef: cachedRectRef
|
|
992
|
-
}),
|
|
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
|
+
*/
|
|
993
1239
|
// Extract border-radius from children
|
|
994
1240
|
useEffect((() => {
|
|
995
1241
|
const extractRadius = () => {
|
|
@@ -1192,6 +1438,8 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1192
1438
|
lerpActiveRef.current = !0;
|
|
1193
1439
|
const LERP_T = CONSTANTS.LERP_FACTOR, tick = () => {
|
|
1194
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);
|
|
1195
1443
|
const cur = internalMouseOffsetRef.current, tgt = targetMouseOffsetRef.current, dx = tgt.x - cur.x, dy = tgt.y - cur.y;
|
|
1196
1444
|
// If we're close enough, snap and park
|
|
1197
1445
|
if (Math.abs(dx) < .05 && Math.abs(dy) < .05) internalMouseOffsetRef.current = {
|
|
@@ -1200,17 +1448,17 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1200
1448
|
...targetGlobalMousePositionRef.current
|
|
1201
1449
|
}; else {
|
|
1202
1450
|
internalMouseOffsetRef.current = {
|
|
1203
|
-
x: lerp(cur.x, tgt.x, LERP_T),
|
|
1204
|
-
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)
|
|
1205
1453
|
};
|
|
1206
1454
|
const curG = internalGlobalMousePositionRef.current, tgtG = targetGlobalMousePositionRef.current;
|
|
1207
1455
|
internalGlobalMousePositionRef.current = {
|
|
1208
|
-
x: lerp(curG.x, tgtG.x, LERP_T),
|
|
1209
|
-
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)
|
|
1210
1458
|
};
|
|
1211
1459
|
}
|
|
1212
1460
|
// Imperative style update with the smoothed values
|
|
1213
|
-
updateAtomixGlassStyles(wrapperRef
|
|
1461
|
+
updateAtomixGlassStyles(wrapperRef.current, glassRef.current, {
|
|
1214
1462
|
mouseOffset: internalMouseOffsetRef.current,
|
|
1215
1463
|
globalMousePosition: internalGlobalMousePositionRef.current,
|
|
1216
1464
|
glassSize: glassSize,
|
|
@@ -1227,12 +1475,13 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1227
1475
|
withLiquidBlur: withLiquidBlur,
|
|
1228
1476
|
blurAmount: blurAmount,
|
|
1229
1477
|
saturation: saturation,
|
|
1230
|
-
padding: padding
|
|
1478
|
+
padding: padding,
|
|
1479
|
+
isFixedOrSticky: isFixedOrSticky
|
|
1231
1480
|
}), lerpRafRef.current = requestAnimationFrame(tick);
|
|
1232
1481
|
};
|
|
1233
1482
|
// 0.08 – lower = more viscous
|
|
1234
1483
|
lerpRafRef.current = requestAnimationFrame(tick);
|
|
1235
|
-
}), [ glassRef, wrapperRef, glassSize, isHovered, isActive, overLightConfig, effectiveBorderRadius, effectiveWithoutEffects, effectiveReducedMotion, elasticity, onClick, withLiquidBlur, blurAmount, saturation, padding ]), stopLerpLoop = useCallback((() => {
|
|
1484
|
+
}), [ glassRef, wrapperRef, glassSize, isHovered, isActive, overLightConfig, effectiveBorderRadius, effectiveWithoutEffects, effectiveReducedMotion, elasticity, onClick, withLiquidBlur, blurAmount, saturation, padding, isFixedOrSticky ]), stopLerpLoop = useCallback((() => {
|
|
1236
1485
|
lerpActiveRef.current = !1, null !== lerpRafRef.current && (cancelAnimationFrame(lerpRafRef.current),
|
|
1237
1486
|
lerpRafRef.current = null);
|
|
1238
1487
|
}), []);
|
|
@@ -1300,6 +1549,8 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1300
1549
|
// This is now static (refs or props) unless prop changes
|
|
1301
1550
|
overLightConfig: overLightConfig,
|
|
1302
1551
|
transformStyle: transformStyle,
|
|
1552
|
+
getShaderTime: getShaderTime,
|
|
1553
|
+
applyTimeBasedDistortion: applyTimeBasedDistortion,
|
|
1303
1554
|
handleMouseEnter: handleMouseEnter,
|
|
1304
1555
|
handleMouseLeave: handleMouseLeave,
|
|
1305
1556
|
handleMouseDown: handleMouseDown,
|
|
@@ -1309,1051 +1560,1819 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, wrapperRef:
|
|
|
1309
1560
|
}
|
|
1310
1561
|
|
|
1311
1562
|
/**
|
|
1312
|
-
*
|
|
1313
|
-
*
|
|
1314
|
-
* Features:
|
|
1315
|
-
* - Hardware-accelerated glass effects with SVG filters
|
|
1316
|
-
* - Mouse-responsive liquid distortion
|
|
1317
|
-
* - Dynamic border-radius extraction from children CSS properties
|
|
1318
|
-
* - Automatic light/dark theme detection via overLight prop
|
|
1319
|
-
* - Accessibility and performance optimizations
|
|
1320
|
-
* - Multiple displacement modes (standard, polar, prominent, shader)
|
|
1321
|
-
* - Design token integration for consistent theming
|
|
1322
|
-
* - Focus ring support for keyboard navigation
|
|
1323
|
-
* - Responsive breakpoints for mobile optimization
|
|
1324
|
-
* - Enhanced ARIA attributes for screen readers
|
|
1325
|
-
*
|
|
1326
|
-
* Design System Compliance:
|
|
1327
|
-
* - Uses design tokens for opacity, spacing, and colors
|
|
1328
|
-
* - Follows BEM methodology for class naming
|
|
1329
|
-
* - Implements focus-ring mixin for accessibility
|
|
1330
|
-
* - Supports reduced motion and high contrast preferences
|
|
1331
|
-
*
|
|
1332
|
-
* @example
|
|
1333
|
-
* // Basic usage with dynamic border-radius extraction
|
|
1334
|
-
* <AtomixGlass>
|
|
1335
|
-
* <div style={{ borderRadius: '12px' }}>Content with 12px radius</div>
|
|
1336
|
-
* </AtomixGlass>
|
|
1563
|
+
* Default responsive breakpoints configuration
|
|
1337
1564
|
*
|
|
1338
|
-
*
|
|
1339
|
-
*
|
|
1340
|
-
*
|
|
1341
|
-
*
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
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
|
|
1361
1605
|
*
|
|
1362
|
-
*
|
|
1363
|
-
*
|
|
1364
|
-
* <AtomixGlass
|
|
1365
|
-
* overLight={{
|
|
1366
|
-
* threshold: 0.8,
|
|
1367
|
-
* opacity: 0.6,
|
|
1368
|
-
* contrast: 1.8,
|
|
1369
|
-
* brightness: 1.0,
|
|
1370
|
-
* saturationBoost: 1.5
|
|
1371
|
-
* }}
|
|
1372
|
-
* >
|
|
1373
|
-
* <div>Content with custom overLight config</div>
|
|
1374
|
-
* </AtomixGlass>
|
|
1606
|
+
* Uses Device Memory API and Hardware Concurrency API to classify devices
|
|
1607
|
+
* into performance tiers for automatic quality adjustment.
|
|
1375
1608
|
*
|
|
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
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
const {position: _p, top: _t, left: _l, right: _r, bottom: _b, ...visualStyle} = restStyle;
|
|
1427
|
-
return {
|
|
1428
|
-
...visualStyle,
|
|
1429
|
-
...!effectiveWithoutEffects && {
|
|
1430
|
-
transform: transformStyle
|
|
1431
|
-
}
|
|
1432
|
-
};
|
|
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;
|
|
1433
1659
|
}
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
}), [ isFixedOrSticky, restStyle, effectiveWithoutEffects, transformStyle ]), 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((() => ({
|
|
1441
|
-
position: isFixedOrSticky ? "absolute" : restStyle.position || "absolute",
|
|
1442
|
-
top: isFixedOrSticky ? 0 : restStyle.top || 0,
|
|
1443
|
-
left: isFixedOrSticky ? 0 : restStyle.left || 0
|
|
1444
|
-
})), [ isFixedOrSticky, restStyle.position, restStyle.top, restStyle.left ]), adjustedSize = useMemo((() => {
|
|
1445
|
-
const resolveSize = (propValue, styleValue, measuredSize) => {
|
|
1446
|
-
const explicitSize = propValue ?? styleValue;
|
|
1447
|
-
return void 0 !== explicitSize ? "number" == typeof explicitSize ? `${explicitSize}px` : explicitSize : "fixed" === positionStyles.position ? `${Math.max(measuredSize, 0)}px` : "100%";
|
|
1448
|
-
};
|
|
1449
|
-
return {
|
|
1450
|
-
width: resolveSize(width, restStyle.width, glassSize.width),
|
|
1451
|
-
height: resolveSize(height, restStyle.height, glassSize.height)
|
|
1452
|
-
};
|
|
1453
|
-
}), [ width, height, restStyle.width, restStyle.height, positionStyles.position, glassSize.width, glassSize.height ]), gradientValues = useMemo((() => {
|
|
1454
|
-
const mx = mouseOffset.x, my = mouseOffset.y, absMx = Math.abs(mx), absMy = Math.abs(my), GRADIENT = ATOMIX_GLASS.CONSTANTS.GRADIENT;
|
|
1455
|
-
return {
|
|
1456
|
-
borderGradientAngle: GRADIENT.BASE_ANGLE + mx * GRADIENT.ANGLE_MULTIPLIER,
|
|
1457
|
-
borderStop1: Math.max(GRADIENT.BORDER_STOP_1.MIN, GRADIENT.BORDER_STOP_1.BASE + my * GRADIENT.BORDER_STOP_1.MULTIPLIER),
|
|
1458
|
-
borderStop2: Math.min(GRADIENT.BORDER_STOP_2.MAX, GRADIENT.BORDER_STOP_2.BASE + my * GRADIENT.BORDER_STOP_2.MULTIPLIER),
|
|
1459
|
-
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 ],
|
|
1460
|
-
hoverPositions: {
|
|
1461
|
-
hover1: {
|
|
1462
|
-
x: GRADIENT.CENTER_POSITION + mx / GRADIENT.HOVER_POSITION.DIVISOR_1,
|
|
1463
|
-
y: GRADIENT.CENTER_POSITION + my / GRADIENT.HOVER_POSITION.DIVISOR_1
|
|
1464
|
-
},
|
|
1465
|
-
hover2: {
|
|
1466
|
-
x: GRADIENT.CENTER_POSITION + mx / GRADIENT.HOVER_POSITION.DIVISOR_2,
|
|
1467
|
-
y: GRADIENT.CENTER_POSITION + my / GRADIENT.HOVER_POSITION.DIVISOR_2
|
|
1468
|
-
},
|
|
1469
|
-
hover3: {
|
|
1470
|
-
x: GRADIENT.CENTER_POSITION + mx * GRADIENT.HOVER_POSITION.MULTIPLIER_3,
|
|
1471
|
-
y: GRADIENT.CENTER_POSITION + my * GRADIENT.HOVER_POSITION.MULTIPLIER_3
|
|
1472
|
-
}
|
|
1473
|
-
},
|
|
1474
|
-
basePosition: {
|
|
1475
|
-
x: GRADIENT.CENTER_POSITION + mx * GRADIENT.BASE_LAYER_MULTIPLIER,
|
|
1476
|
-
y: GRADIENT.CENTER_POSITION + my * GRADIENT.BASE_LAYER_MULTIPLIER
|
|
1477
|
-
},
|
|
1478
|
-
mx: mx,
|
|
1479
|
-
my: my,
|
|
1480
|
-
absMx: absMx,
|
|
1481
|
-
absMy: absMy
|
|
1482
|
-
};
|
|
1483
|
-
}), [ mouseOffset.x, mouseOffset.y ]), opacityValues = useMemo((() => {
|
|
1484
|
-
const overLightOpacity = overLightConfig.opacity;
|
|
1485
|
-
return {
|
|
1486
|
-
hover1: isHovered || isActive ? .5 : 0,
|
|
1487
|
-
hover2: isActive ? .5 : 0,
|
|
1488
|
-
hover3: isHovered ? .4 : isActive ? .8 : 0,
|
|
1489
|
-
base: isOverLight ? overLightOpacity || .4 : 0,
|
|
1490
|
-
over: isOverLight ? 1.1 * (overLightOpacity || .4) : 0
|
|
1491
|
-
};
|
|
1492
|
-
}), [ isHovered, isActive, isOverLight, overLightConfig.opacity ]), glassVars = useMemo((() => {
|
|
1493
|
-
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;
|
|
1494
|
-
return {
|
|
1495
|
-
...void 0 !== customZIndex && {
|
|
1496
|
-
"--atomix-glass-base-z-index": customZIndex
|
|
1497
|
-
},
|
|
1498
|
-
"--atomix-glass-radius": `${effectiveBorderRadius}px`,
|
|
1499
|
-
"--atomix-glass-transform": transformStyle || "none",
|
|
1500
|
-
"--atomix-glass-position": positionStyles.position,
|
|
1501
|
-
"--atomix-glass-top": "fixed" !== positionStyles.top ? `${positionStyles.top}px` : "0",
|
|
1502
|
-
"--atomix-glass-left": "fixed" !== positionStyles.left ? `${positionStyles.left}px` : "0",
|
|
1503
|
-
"--atomix-glass-width": adjustedSize.width,
|
|
1504
|
-
"--atomix-glass-height": adjustedSize.height,
|
|
1505
|
-
"--atomix-glass-border-width": "var(--atomix-spacing-0-5, 0.09375rem)",
|
|
1506
|
-
"--atomix-glass-blend-mode": isOverLight ? "multiply" : "overlay",
|
|
1507
|
-
"--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%)`,
|
|
1508
|
-
"--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%)`,
|
|
1509
|
-
"--atomix-glass-hover-1-opacity": opacityValues.hover1,
|
|
1510
|
-
"--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}%)`,
|
|
1511
|
-
"--atomix-glass-hover-2-opacity": opacityValues.hover2,
|
|
1512
|
-
"--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}%)`,
|
|
1513
|
-
"--atomix-glass-hover-3-opacity": opacityValues.hover3,
|
|
1514
|
-
"--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}%)`,
|
|
1515
|
-
"--atomix-glass-base-opacity": opacityValues.base,
|
|
1516
|
-
"--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})`,
|
|
1517
|
-
"--atomix-glass-overlay-opacity": opacityValues.over,
|
|
1518
|
-
"--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})`,
|
|
1519
|
-
"--atomix-glass-overlay-highlight-opacity": opacityValues.over * ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.OPACITY_MULTIPLIER,
|
|
1520
|
-
"--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}%)`
|
|
1521
|
-
};
|
|
1522
|
-
}), [ gradientValues, opacityValues, effectiveBorderRadius, transformStyle, positionStyles, adjustedSize, isOverLight, overLightConfig.borderOpacity, customZIndex ]), renderBackgroundLayer = layerType => jsx("div", {
|
|
1523
|
-
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(" ")
|
|
1524
|
-
});
|
|
1525
|
-
return jsxs("div", {
|
|
1526
|
-
...rest,
|
|
1527
|
-
className: componentClassName,
|
|
1528
|
-
style: {
|
|
1529
|
-
...glassVars
|
|
1530
|
-
},
|
|
1531
|
-
role: role || (onClick ? "button" : void 0),
|
|
1532
|
-
tabIndex: onClick ? tabIndex ?? 0 : tabIndex,
|
|
1533
|
-
"aria-label": ariaLabel,
|
|
1534
|
-
"aria-describedby": ariaDescribedBy,
|
|
1535
|
-
"aria-disabled": !(!onClick || !effectiveWithoutEffects) || !onClick && void 0,
|
|
1536
|
-
"aria-pressed": !(!onClick || !isActive) || !onClick && void 0,
|
|
1537
|
-
onKeyDown: onClick ? handleKeyDown : void 0,
|
|
1538
|
-
children: [ jsx(AtomixGlassContainer, {
|
|
1539
|
-
ref: glassRef,
|
|
1540
|
-
contentRef: contentRef,
|
|
1541
|
-
className: className,
|
|
1542
|
-
style: rootLayoutStyle,
|
|
1543
|
-
borderRadius: effectiveBorderRadius,
|
|
1544
|
-
displacementScale: effectiveWithoutEffects ? 0 : "shader" === mode ? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.SHADER_DISPLACEMENT : isOverLight ? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.OVER_LIGHT_DISPLACEMENT : displacementScale,
|
|
1545
|
-
blurAmount: effectiveWithoutEffects ? 0 : blurAmount,
|
|
1546
|
-
saturation: effectiveHighContrast ? ATOMIX_GLASS.CONSTANTS.SATURATION.HIGH_CONTRAST : isOverLight ? saturation * overLightConfig.saturationBoost : saturation,
|
|
1547
|
-
aberrationIntensity: effectiveWithoutEffects ? 0 : "shader" === mode ? aberrationIntensity * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.SHADER_ABERRATION : aberrationIntensity,
|
|
1548
|
-
glassSize: glassSize,
|
|
1549
|
-
padding: padding,
|
|
1550
|
-
mouseOffset: effectiveWithoutEffects ? {
|
|
1551
|
-
x: 0,
|
|
1552
|
-
y: 0
|
|
1553
|
-
} : mouseOffset,
|
|
1554
|
-
globalMousePosition: effectiveWithoutEffects ? {
|
|
1555
|
-
x: 0,
|
|
1556
|
-
y: 0
|
|
1557
|
-
} : globalMousePosition,
|
|
1558
|
-
onMouseEnter: handleMouseEnter,
|
|
1559
|
-
onMouseLeave: handleMouseLeave,
|
|
1560
|
-
onMouseDown: handleMouseDown,
|
|
1561
|
-
onMouseUp: handleMouseUp,
|
|
1562
|
-
isHovered: isHovered,
|
|
1563
|
-
isActive: isActive,
|
|
1564
|
-
overLight: isOverLight,
|
|
1565
|
-
overLightConfig: {
|
|
1566
|
-
contrast: overLightConfig.contrast,
|
|
1567
|
-
brightness: overLightConfig.brightness,
|
|
1568
|
-
shadowIntensity: overLightConfig.shadowIntensity,
|
|
1569
|
-
borderOpacity: overLightConfig.borderOpacity
|
|
1570
|
-
},
|
|
1571
|
-
onClick: onClick,
|
|
1572
|
-
mode: mode,
|
|
1573
|
-
transform: baseStyle.transform,
|
|
1574
|
-
effectiveWithoutEffects: effectiveWithoutEffects,
|
|
1575
|
-
effectiveReducedMotion: effectiveReducedMotion,
|
|
1576
|
-
shaderVariant: shaderVariant,
|
|
1577
|
-
withLiquidBlur: withLiquidBlur,
|
|
1578
|
-
children: children
|
|
1579
|
-
}), Boolean(onClick) && jsxs(Fragment, {
|
|
1580
|
-
children: [ jsx("div", {
|
|
1581
|
-
className: ATOMIX_GLASS.HOVER_1_CLASS
|
|
1582
|
-
}), jsx("div", {
|
|
1583
|
-
className: ATOMIX_GLASS.HOVER_2_CLASS
|
|
1584
|
-
}), jsx("div", {
|
|
1585
|
-
className: ATOMIX_GLASS.HOVER_3_CLASS
|
|
1586
|
-
}) ]
|
|
1587
|
-
}), renderBackgroundLayer("dark"), renderBackgroundLayer("black"), shouldRenderOverLightLayers && jsxs(Fragment, {
|
|
1588
|
-
children: [ jsx("div", {
|
|
1589
|
-
className: ATOMIX_GLASS.BASE_LAYER_CLASS
|
|
1590
|
-
}), jsx("div", {
|
|
1591
|
-
className: ATOMIX_GLASS.OVERLAY_LAYER_CLASS
|
|
1592
|
-
}), jsx("div", {
|
|
1593
|
-
className: ATOMIX_GLASS.OVERLAY_HIGHLIGHT_CLASS
|
|
1594
|
-
}) ]
|
|
1595
|
-
}), withBorder && jsxs(Fragment, {
|
|
1596
|
-
children: [ jsx("span", {
|
|
1597
|
-
className: ATOMIX_GLASS.BORDER_1_CLASS
|
|
1598
|
-
}), jsx("span", {
|
|
1599
|
-
className: ATOMIX_GLASS.BORDER_2_CLASS
|
|
1600
|
-
}) ]
|
|
1601
|
-
}) ]
|
|
1602
|
-
});
|
|
1603
|
-
}
|
|
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);
|
|
1604
1666
|
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
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
|
|
1669
1825
|
});
|
|
1670
1826
|
}
|
|
1671
|
-
return
|
|
1672
|
-
})
|
|
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
|
+
};
|
|
1673
1835
|
|
|
1674
|
-
|
|
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;
|
|
1675
1850
|
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
/**
|
|
1682
|
-
* Form state and functionality
|
|
1683
|
-
* @param initialProps - Initial form properties
|
|
1684
|
-
* @returns Form state and methods
|
|
1685
|
-
*/
|
|
1686
|
-
function(initialProps) {
|
|
1687
|
-
// Default form properties
|
|
1688
|
-
const defaultProps = {
|
|
1689
|
-
disabled: !1,
|
|
1690
|
-
...initialProps
|
|
1691
|
-
};
|
|
1692
|
-
/**
|
|
1693
|
-
* Generate form class based on properties
|
|
1694
|
-
* @param props - Form properties
|
|
1695
|
-
* @returns Class string
|
|
1696
|
-
*/ return {
|
|
1697
|
-
defaultProps: defaultProps,
|
|
1698
|
-
generateFormClass: props => {
|
|
1699
|
-
const {disabled: disabled = defaultProps.disabled, className: className = ""} = props;
|
|
1700
|
-
return `${FORM_CLASSES_BASE} ${disabled ? FORM_CLASSES_DISABLED : ""} ${className}`.trim();
|
|
1701
|
-
},
|
|
1702
|
-
handleSubmit: handler => event => {
|
|
1703
|
-
event.preventDefault(), !defaultProps.disabled && handler && handler(event);
|
|
1704
|
-
},
|
|
1705
|
-
handleReset: handler => event => {
|
|
1706
|
-
!defaultProps.disabled && handler && handler(event);
|
|
1851
|
+
case 1:
|
|
1852
|
+
return new NativeConstructor(a);
|
|
1853
|
+
|
|
1854
|
+
case 2:
|
|
1855
|
+
return new NativeConstructor(a, b);
|
|
1707
1856
|
}
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
}
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
});
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
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];
|
|
1728
1908
|
|
|
1729
|
-
|
|
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);
|
|
1921
|
+
}
|
|
1922
|
+
});
|
|
1923
|
+
|
|
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 = {};
|
|
1930
|
+
|
|
1931
|
+
test[wellKnownSymbol$5("toStringTag")] = "z";
|
|
1932
|
+
|
|
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
|
+
}));
|
|
1730
1981
|
|
|
1731
1982
|
/**
|
|
1732
|
-
*
|
|
1733
|
-
*/
|
|
1734
|
-
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"}) => {
|
|
1735
|
-
const {generateFormGroupClass: generateFormGroupClass} =
|
|
1736
|
-
/**
|
|
1737
|
-
* Form Group state and functionality
|
|
1738
|
-
* @param initialProps - Initial form group properties
|
|
1739
|
-
* @returns Form Group state and methods
|
|
1983
|
+
* Get GPU memory info if available (Chrome DevTools only)
|
|
1740
1984
|
*/
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
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
|
-
|
|
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
|
|
1994
|
+
*/
|
|
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"
|
|
1782
2152
|
}) ]
|
|
1783
|
-
}), jsx("div", {
|
|
1784
|
-
className: "c-form-group__field",
|
|
1785
|
-
children: children
|
|
1786
|
-
}), helperText && jsx("div", {
|
|
1787
|
-
className: "c-form-group__helper",
|
|
1788
|
-
children: helperText
|
|
1789
2153
|
}) ]
|
|
1790
|
-
});
|
|
2154
|
+
}) : null;
|
|
1791
2155
|
};
|
|
1792
2156
|
|
|
1793
|
-
|
|
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
|
+
}
|
|
1794
2163
|
|
|
1795
2164
|
/**
|
|
1796
|
-
*
|
|
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.
|
|
1797
2169
|
*/
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
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
|
|
1804
2287
|
*/
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
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
|
|
1877
2398
|
});
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
}
|
|
2399
|
+
// Re-calculate only when devicePreset changes
|
|
2400
|
+
// Responsive breakpoint system - automatically adjusts parameters based on viewport
|
|
2401
|
+
!
|
|
2402
|
+
/**
|
|
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
|
|
2430
|
+
*/
|
|
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;
|
|
2435
|
+
/**
|
|
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);
|
|
2525
|
+
}
|
|
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 ]);
|
|
2556
|
+
}({
|
|
2557
|
+
baseParams: {
|
|
2558
|
+
...useMemo((() =>
|
|
2559
|
+
/**
|
|
2560
|
+
* Get preset by name
|
|
2561
|
+
*/
|
|
2562
|
+
function(presetName) {
|
|
2563
|
+
switch (presetName) {
|
|
2564
|
+
case "performance":
|
|
2565
|
+
return PERFORMANCE_PRESET;
|
|
1898
2566
|
|
|
1899
|
-
|
|
2567
|
+
case "balanced":
|
|
2568
|
+
default:
|
|
2569
|
+
return BALANCED_PRESET;
|
|
1900
2570
|
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
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} =
|
|
1906
2594
|
/**
|
|
1907
|
-
*
|
|
1908
|
-
*
|
|
1909
|
-
*
|
|
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
|
|
1910
2618
|
*/
|
|
1911
|
-
function(
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
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;
|
|
1930
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
|
|
1931
2755
|
};
|
|
1932
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,
|
|
1933
3013
|
disabled: disabled,
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
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,
|
|
1943
3026
|
style: style,
|
|
1944
|
-
children: [ jsx("
|
|
1945
|
-
|
|
1946
|
-
className: "c-radio__input",
|
|
1947
|
-
checked: checked,
|
|
1948
|
-
onChange: onChange,
|
|
1949
|
-
disabled: disabled,
|
|
1950
|
-
required: required,
|
|
1951
|
-
id: id,
|
|
1952
|
-
name: name,
|
|
1953
|
-
value: value,
|
|
1954
|
-
"aria-label": label ? void 0 : ariaLabel,
|
|
1955
|
-
"aria-describedby": ariaDescribedBy,
|
|
1956
|
-
"aria-invalid": invalid
|
|
1957
|
-
}), label && jsx("label", {
|
|
1958
|
-
className: "c-radio__label",
|
|
3027
|
+
children: [ inputElement, jsx("label", {
|
|
3028
|
+
className: "c-checkbox__label",
|
|
1959
3029
|
htmlFor: id,
|
|
1960
3030
|
children: label
|
|
1961
3031
|
}) ]
|
|
1962
|
-
})
|
|
1963
|
-
|
|
1964
|
-
|
|
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) {
|
|
1965
3044
|
const defaultGlassProps = {
|
|
1966
3045
|
displacementScale: 40,
|
|
1967
|
-
blurAmount: 1,
|
|
1968
|
-
saturation: 160,
|
|
1969
|
-
aberrationIntensity: .3,
|
|
1970
|
-
borderRadius: 6,
|
|
1971
|
-
mode: "shader"
|
|
1972
|
-
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
1973
|
-
...defaultGlassProps,
|
|
1974
|
-
...glass
|
|
1975
|
-
};
|
|
1976
|
-
return jsx(AtomixGlass, {
|
|
1977
|
-
...glassProps,
|
|
1978
|
-
children:
|
|
1979
|
-
});
|
|
1980
|
-
}
|
|
1981
|
-
return radioContent;
|
|
1982
|
-
}));
|
|
1983
|
-
|
|
1984
|
-
Radio.displayName = "Radio";
|
|
1985
|
-
|
|
1986
|
-
var commonjsGlobal = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {};
|
|
1987
|
-
|
|
1988
|
-
function getDefaultExportFromCjs(x) {
|
|
1989
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x.default : x;
|
|
1990
|
-
}
|
|
1991
|
-
|
|
1992
|
-
var fails$8 = function(exec) {
|
|
1993
|
-
try {
|
|
1994
|
-
return !!exec();
|
|
1995
|
-
} catch (error) {
|
|
1996
|
-
return !0;
|
|
1997
|
-
}
|
|
1998
|
-
}, functionBindNative = !fails$8((function() {
|
|
1999
|
-
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
|
2000
|
-
var test = function() {/* empty */}.bind();
|
|
2001
|
-
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
2002
|
-
return "function" != typeof test || test.hasOwnProperty("prototype");
|
|
2003
|
-
})), 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) {
|
|
2004
|
-
return function() {
|
|
2005
|
-
return call$5.apply(fn, arguments);
|
|
2006
|
-
};
|
|
2007
|
-
}, objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf), check = function(it) {
|
|
2008
|
-
return it && it.Math === Math && it;
|
|
2009
|
-
}, globalThis_1 =
|
|
2010
|
-
// eslint-disable-next-line es/no-global-this -- safe
|
|
2011
|
-
check("object" == typeof globalThis && globalThis) || check("object" == typeof window && window) ||
|
|
2012
|
-
// eslint-disable-next-line no-restricted-globals -- safe
|
|
2013
|
-
check("object" == typeof self && self) || check("object" == typeof commonjsGlobal && commonjsGlobal) || check("object" == typeof commonjsGlobal && commonjsGlobal) ||
|
|
2014
|
-
// eslint-disable-next-line no-new-func -- fallback
|
|
2015
|
-
function() {
|
|
2016
|
-
return this;
|
|
2017
|
-
}() || 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() {
|
|
2018
|
-
return call$4.apply(apply$1, arguments);
|
|
2019
|
-
}), uncurryThis$7 = functionUncurryThis, toString$3 = uncurryThis$7({}.toString), stringSlice = uncurryThis$7("".slice), classofRaw$2 = function(it) {
|
|
2020
|
-
return stringSlice(toString$3(it), 8, -1);
|
|
2021
|
-
}, classofRaw$1 = classofRaw$2, uncurryThis$6 = functionUncurryThis, functionUncurryThisClause = function(fn) {
|
|
2022
|
-
// Nashorn bug:
|
|
2023
|
-
// https://github.com/zloirock/core-js/issues/1128
|
|
2024
|
-
// https://github.com/zloirock/core-js/issues/1130
|
|
2025
|
-
if ("Function" === classofRaw$1(fn)) return uncurryThis$6(fn);
|
|
2026
|
-
}, documentAll = "object" == typeof document && document.all, isCallable$8 = void 0 === documentAll && void 0 !== documentAll ? function(argument) {
|
|
2027
|
-
return "function" == typeof argument || argument === documentAll;
|
|
2028
|
-
} : function(argument) {
|
|
2029
|
-
return "function" == typeof argument;
|
|
2030
|
-
}, objectGetOwnPropertyDescriptor = {}, descriptors = !fails$8((function() {
|
|
2031
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
2032
|
-
return 7 !== Object.defineProperty({}, 1, {
|
|
2033
|
-
get: function() {
|
|
2034
|
-
return 7;
|
|
2035
|
-
}
|
|
2036
|
-
})[1];
|
|
2037
|
-
})), NATIVE_BIND$1 = functionBindNative, call$3 = Function.prototype.call, functionCall = NATIVE_BIND$1 ? call$3.bind(call$3) : function() {
|
|
2038
|
-
return call$3.apply(call$3, arguments);
|
|
2039
|
-
}, objectPropertyIsEnumerable = {}, $propertyIsEnumerable = {}.propertyIsEnumerable, getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor, NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({
|
|
2040
|
-
1: 2
|
|
2041
|
-
}, 1);
|
|
2042
|
-
|
|
2043
|
-
// `Object.prototype.propertyIsEnumerable` method implementation
|
|
2044
|
-
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
|
2045
|
-
objectPropertyIsEnumerable.f = NASHORN_BUG ? function(V) {
|
|
2046
|
-
var descriptor = getOwnPropertyDescriptor$1(this, V);
|
|
2047
|
-
return !!descriptor && descriptor.enumerable;
|
|
2048
|
-
} : $propertyIsEnumerable;
|
|
2049
|
-
|
|
2050
|
-
var match, version, createPropertyDescriptor$2 = function(bitmap, value) {
|
|
2051
|
-
return {
|
|
2052
|
-
enumerable: !(1 & bitmap),
|
|
2053
|
-
configurable: !(2 & bitmap),
|
|
2054
|
-
writable: !(4 & bitmap),
|
|
2055
|
-
value: value
|
|
2056
|
-
};
|
|
2057
|
-
}, fails$5 = fails$8, classof$3 = classofRaw$2, $Object$3 = Object, split = functionUncurryThis("".split), indexedObject = fails$5((function() {
|
|
2058
|
-
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
2059
|
-
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
2060
|
-
return !$Object$3("z").propertyIsEnumerable(0);
|
|
2061
|
-
})) ? function(it) {
|
|
2062
|
-
return "String" === classof$3(it) ? split(it, "") : $Object$3(it);
|
|
2063
|
-
} : $Object$3, isNullOrUndefined$2 = function(it) {
|
|
2064
|
-
return null == it;
|
|
2065
|
-
}, isNullOrUndefined$1 = isNullOrUndefined$2, $TypeError$6 = TypeError, requireObjectCoercible$3 = function(it) {
|
|
2066
|
-
if (isNullOrUndefined$1(it)) throw new $TypeError$6("Can't call method on " + it);
|
|
2067
|
-
return it;
|
|
2068
|
-
}, IndexedObject = indexedObject, requireObjectCoercible$2 = requireObjectCoercible$3, toIndexedObject$2 = function(it) {
|
|
2069
|
-
return IndexedObject(requireObjectCoercible$2(it));
|
|
2070
|
-
}, isCallable$7 = isCallable$8, isObject$5 = function(it) {
|
|
2071
|
-
return "object" == typeof it ? null !== it : isCallable$7(it);
|
|
2072
|
-
}, path$3 = {}, path$2 = path$3, globalThis$a = globalThis_1, isCallable$6 = isCallable$8, aFunction = function(variable) {
|
|
2073
|
-
return isCallable$6(variable) ? variable : void 0;
|
|
2074
|
-
}, 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;
|
|
2075
|
-
|
|
2076
|
-
v8 && (
|
|
2077
|
-
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
|
2078
|
-
// but their correct versions are not interesting for us
|
|
2079
|
-
version = (match = v8.split("."))[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1])),
|
|
2080
|
-
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
|
2081
|
-
// so check `userAgent` even if `.v8` exists, but 0
|
|
2082
|
-
!version && userAgent && (!(match = userAgent.match(/Edge\/(\d+)/)) || match[1] >= 74) && (match = userAgent.match(/Chrome\/(\d+)/)) && (version = +match[1]);
|
|
2083
|
-
|
|
2084
|
-
var V8_VERSION = version, fails$4 = fails$8, $String$3 = globalThis_1.String, symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$4((function() {
|
|
2085
|
-
var symbol = Symbol("symbol detection");
|
|
2086
|
-
// Chrome 38 Symbol has incorrect toString conversion
|
|
2087
|
-
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
2088
|
-
// nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
|
|
2089
|
-
// of course, fail.
|
|
2090
|
-
return !$String$3(symbol) || !(Object(symbol) instanceof Symbol) ||
|
|
2091
|
-
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
|
2092
|
-
!Symbol.sham && V8_VERSION && V8_VERSION < 41;
|
|
2093
|
-
})), useSymbolAsUid = symbolConstructorDetection && !Symbol.sham && "symbol" == typeof Symbol.iterator, isCallable$5 = isCallable$8, isPrototypeOf$1 = objectIsPrototypeOf, $Object$2 = Object, isSymbol$2 = useSymbolAsUid ? function(it) {
|
|
2094
|
-
return "symbol" == typeof it;
|
|
2095
|
-
} : function(it) {
|
|
2096
|
-
var $Symbol = function(namespace, method) {
|
|
2097
|
-
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];
|
|
2098
|
-
}("Symbol");
|
|
2099
|
-
return isCallable$5($Symbol) && isPrototypeOf$1($Symbol.prototype, $Object$2(it));
|
|
2100
|
-
}, $String$2 = String, isCallable$4 = isCallable$8, $TypeError$5 = TypeError, aCallable$2 = function(argument) {
|
|
2101
|
-
if (isCallable$4(argument)) return argument;
|
|
2102
|
-
throw new $TypeError$5(function(argument) {
|
|
2103
|
-
try {
|
|
2104
|
-
return $String$2(argument);
|
|
2105
|
-
} catch (error) {
|
|
2106
|
-
return "Object";
|
|
2107
|
-
}
|
|
2108
|
-
}(argument) + " is not a function");
|
|
2109
|
-
}, aCallable$1 = aCallable$2, isNullOrUndefined = isNullOrUndefined$2, call$2 = functionCall, isCallable$3 = isCallable$8, isObject$4 = isObject$5, $TypeError$4 = TypeError, sharedStore = {
|
|
2110
|
-
exports: {}
|
|
2111
|
-
}, globalThis$6 = globalThis_1, defineProperty = Object.defineProperty, globalThis$5 = globalThis_1, store$1 = sharedStore.exports = globalThis$5["__core-js_shared__"] || function(key, value) {
|
|
2112
|
-
try {
|
|
2113
|
-
defineProperty(globalThis$6, key, {
|
|
2114
|
-
value: value,
|
|
2115
|
-
configurable: !0,
|
|
2116
|
-
writable: !0
|
|
2117
|
-
});
|
|
2118
|
-
} catch (error) {
|
|
2119
|
-
globalThis$6[key] = value;
|
|
2120
|
-
}
|
|
2121
|
-
return value;
|
|
2122
|
-
}("__core-js_shared__", {});
|
|
2123
|
-
|
|
2124
|
-
/* eslint-disable es/no-symbol -- required for testing */ (store$1.versions || (store$1.versions = [])).push({
|
|
2125
|
-
version: "3.43.0",
|
|
2126
|
-
mode: "pure",
|
|
2127
|
-
copyright: "© 2014-2025 Denis Pushkarev (zloirock.ru)",
|
|
2128
|
-
license: "https://github.com/zloirock/core-js/blob/v3.43.0/LICENSE",
|
|
2129
|
-
source: "https://github.com/zloirock/core-js"
|
|
2130
|
-
});
|
|
2131
|
-
|
|
2132
|
-
var key, value, store = sharedStore.exports, requireObjectCoercible$1 = requireObjectCoercible$3, $Object$1 = Object, hasOwnProperty = functionUncurryThis({}.hasOwnProperty), hasOwnProperty_1 = Object.hasOwn || function(it, key) {
|
|
2133
|
-
return hasOwnProperty($Object$1(requireObjectCoercible$1(it)), key);
|
|
2134
|
-
}, 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) {
|
|
2135
|
-
return "Symbol(" + (void 0 === key ? "" : key) + ")_" + toString$2(++id + postfix, 36);
|
|
2136
|
-
}, wellKnownSymbol$5 = function(name) {
|
|
2137
|
-
return hasOwn$2(WellKnownSymbolsStore, name) || (WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$2(Symbol$1, name) ? Symbol$1[name] : createWellKnownSymbol("Symbol." + name)),
|
|
2138
|
-
WellKnownSymbolsStore[name];
|
|
2139
|
-
}, call$1 = functionCall, isObject$3 = isObject$5, isSymbol$1 = isSymbol$2, $TypeError$3 = TypeError, TO_PRIMITIVE = wellKnownSymbol$5("toPrimitive"), toPrimitive = function(input, pref) {
|
|
2140
|
-
if (!isObject$3(input) || isSymbol$1(input)) return input;
|
|
2141
|
-
var result, func, exoticToPrim = (func = input[TO_PRIMITIVE], isNullOrUndefined(func) ? void 0 : aCallable$1(func));
|
|
2142
|
-
if (exoticToPrim) {
|
|
2143
|
-
if (void 0 === pref && (pref = "default"), result = call$1(exoticToPrim, input, pref),
|
|
2144
|
-
!isObject$3(result) || isSymbol$1(result)) return result;
|
|
2145
|
-
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
|
+
});
|
|
2146
3059
|
}
|
|
2147
|
-
return
|
|
2148
|
-
|
|
2149
|
-
if ("string" === pref && isCallable$3(fn = input.toString) && !isObject$4(val = call$2(fn, input))) return val;
|
|
2150
|
-
if (isCallable$3(fn = input.valueOf) && !isObject$4(val = call$2(fn, input))) return val;
|
|
2151
|
-
if ("string" !== pref && isCallable$3(fn = input.toString) && !isObject$4(val = call$2(fn, input))) return val;
|
|
2152
|
-
throw new $TypeError$4("Can't convert object to primitive value");
|
|
2153
|
-
}(input, pref);
|
|
2154
|
-
}, isSymbol = isSymbol$2, toPropertyKey$2 = function(argument) {
|
|
2155
|
-
var key = toPrimitive(argument, "string");
|
|
2156
|
-
return isSymbol(key) ? key : key + "";
|
|
2157
|
-
}, isObject$2 = isObject$5, document$1 = globalThis_1.document, EXISTS = isObject$2(document$1) && isObject$2(document$1.createElement), ie8DomDefine = !descriptors && !fails$8((function() {
|
|
2158
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
2159
|
-
return 7 !== Object.defineProperty((it = "div", EXISTS ? document$1.createElement(it) : {}), "a", {
|
|
2160
|
-
get: function() {
|
|
2161
|
-
return 7;
|
|
2162
|
-
}
|
|
2163
|
-
}).a;
|
|
2164
|
-
var it;
|
|
2165
|
-
})), 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
|
+
})));
|
|
2166
3062
|
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
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
|
+
});
|
|
2174
3116
|
};
|
|
2175
3117
|
|
|
2176
|
-
|
|
2177
|
-
var value = data[normalize(feature)];
|
|
2178
|
-
return value === POLYFILL || value !== NATIVE && (isCallable$2(detection) ? fails$2(detection) : !!detection);
|
|
2179
|
-
}, normalize = isForced$1.normalize = function(string) {
|
|
2180
|
-
return String(string).replace(replacement, ".").toLowerCase();
|
|
2181
|
-
}, 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() {
|
|
2182
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
2183
|
-
return 42 !== Object.defineProperty((function() {/* empty */}), "prototype", {
|
|
2184
|
-
value: 42,
|
|
2185
|
-
writable: !1
|
|
2186
|
-
}).prototype;
|
|
2187
|
-
})), 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) {
|
|
2188
|
-
if (isObject$1(argument)) return argument;
|
|
2189
|
-
throw new $TypeError$2($String$1(argument) + " is not an object");
|
|
2190
|
-
}, toPropertyKey = toPropertyKey$2, $TypeError$1 = TypeError, $defineProperty = Object.defineProperty, $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
3118
|
+
Form.displayName = "Form";
|
|
2191
3119
|
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
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
|
|
2201
3283
|
});
|
|
2202
3284
|
}
|
|
2203
|
-
return
|
|
2204
|
-
}
|
|
2205
|
-
if (anObject(O), P = toPropertyKey(P), anObject(Attributes), IE8_DOM_DEFINE) try {
|
|
2206
|
-
return $defineProperty(O, P, Attributes);
|
|
2207
|
-
} catch (error) {/* empty */}
|
|
2208
|
-
if ("get" in Attributes || "set" in Attributes) throw new $TypeError$1("Accessors not supported");
|
|
2209
|
-
return "value" in Attributes && (O[P] = Attributes.value), O;
|
|
2210
|
-
};
|
|
2211
|
-
|
|
2212
|
-
var definePropertyModule = objectDefineProperty, createPropertyDescriptor = createPropertyDescriptor$2, createNonEnumerableProperty$1 = descriptors ? function(object, key, value) {
|
|
2213
|
-
return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
|
|
2214
|
-
} : function(object, key, value) {
|
|
2215
|
-
return object[key] = value, object;
|
|
2216
|
-
}, 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) {
|
|
2217
|
-
return aCallable(fn), void 0 === that ? fn : NATIVE_BIND ? bind$1(fn, that) : function() {
|
|
2218
|
-
return fn.apply(that, arguments);
|
|
2219
|
-
};
|
|
2220
|
-
}, createNonEnumerableProperty = createNonEnumerableProperty$1, hasOwn = hasOwnProperty_1, wrapConstructor = function(NativeConstructor) {
|
|
2221
|
-
var Wrapper = function(a, b, c) {
|
|
2222
|
-
if (this instanceof Wrapper) {
|
|
2223
|
-
switch (arguments.length) {
|
|
2224
|
-
case 0:
|
|
2225
|
-
return new NativeConstructor;
|
|
3285
|
+
return inputElement;
|
|
3286
|
+
})));
|
|
2226
3287
|
|
|
2227
|
-
|
|
2228
|
-
return new NativeConstructor(a);
|
|
3288
|
+
Input.displayName = "Input";
|
|
2229
3289
|
|
|
2230
|
-
|
|
2231
|
-
|
|
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();
|
|
2232
3319
|
}
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
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
|
-
// eslint-disable-next-line no-self-compare -- NaN check
|
|
2283
|
-
if ((value = O[index++]) != value) return !0;
|
|
2284
|
-
// Array#indexOf ignores holes, Array#includes - not
|
|
2285
|
-
} else for (;length > index; index++) if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
|
2286
|
-
return !IS_INCLUDES && -1;
|
|
2287
|
-
};
|
|
2288
|
-
}, $includes = [ createMethod(!0), createMethod(!1) ][0];
|
|
2289
|
-
|
|
2290
|
-
// `Array.prototype.includes` method
|
|
2291
|
-
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
2292
|
-
_export({
|
|
2293
|
-
target: "Array",
|
|
2294
|
-
proto: !0,
|
|
2295
|
-
forced: fails$8((function() {
|
|
2296
|
-
// eslint-disable-next-line es/no-array-prototype-includes -- detection
|
|
2297
|
-
return !Array(1).includes();
|
|
2298
|
-
}))
|
|
2299
|
-
}, {
|
|
2300
|
-
includes: function(el /* , fromIndex = 0 */) {
|
|
2301
|
-
return $includes(this, el, arguments.length > 1 ? arguments[1] : void 0);
|
|
2302
|
-
}
|
|
2303
|
-
});
|
|
2304
|
-
|
|
2305
|
-
var includes$4 = getBuiltInPrototypeMethod$2("Array", "includes"), isObject = isObject$5, classof$2 = classofRaw$2, MATCH$1 = wellKnownSymbol$5("match"), $TypeError = TypeError, test = {};
|
|
2306
|
-
|
|
2307
|
-
test[wellKnownSymbol$5("toStringTag")] = "z";
|
|
2308
|
-
|
|
2309
|
-
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() {
|
|
2310
|
-
return arguments;
|
|
2311
|
-
}()), classof = TO_STRING_TAG_SUPPORT ? classofRaw : function(it) {
|
|
2312
|
-
var O, tag, result;
|
|
2313
|
-
return void 0 === it ? "Undefined" : null === it ? "Null" : "string" == typeof (tag = function(it, key) {
|
|
2314
|
-
try {
|
|
2315
|
-
return it[key];
|
|
2316
|
-
} catch (error) {/* empty */}
|
|
2317
|
-
}(O = $Object(it), TO_STRING_TAG)) ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : "Object" === (result = classofRaw(O)) && isCallable(O.callee) ? "Arguments" : result;
|
|
2318
|
-
}, $String = String, MATCH = wellKnownSymbol$5("match"), $ = _export, notARegExp = function(it) {
|
|
2319
|
-
if (function(it) {
|
|
2320
|
-
var isRegExp;
|
|
2321
|
-
return isObject(it) && (void 0 !== (isRegExp = it[MATCH$1]) ? !!isRegExp : "RegExp" === classof$2(it));
|
|
2322
|
-
}(it)) throw new $TypeError("The method doesn't accept regular expressions");
|
|
2323
|
-
return it;
|
|
2324
|
-
}, requireObjectCoercible = requireObjectCoercible$3, toString = function(argument) {
|
|
2325
|
-
if ("Symbol" === classof(argument)) throw new TypeError("Cannot convert a Symbol value to a string");
|
|
2326
|
-
return $String(argument);
|
|
2327
|
-
}, stringIndexOf = functionUncurryThis("".indexOf);
|
|
2328
|
-
|
|
2329
|
-
// `String.prototype.includes` method
|
|
2330
|
-
// https://tc39.es/ecma262/#sec-string.prototype.includes
|
|
2331
|
-
$({
|
|
2332
|
-
target: "String",
|
|
2333
|
-
proto: !0,
|
|
2334
|
-
forced: !function(METHOD_NAME) {
|
|
2335
|
-
var regexp = /./;
|
|
2336
|
-
try {
|
|
2337
|
-
"/./"[METHOD_NAME](regexp);
|
|
2338
|
-
} catch (error1) {
|
|
2339
|
-
try {
|
|
2340
|
-
return regexp[MATCH] = !1, "/./"[METHOD_NAME](regexp);
|
|
2341
|
-
} catch (error2) {/* empty */}
|
|
2342
|
-
}
|
|
2343
|
-
return !1;
|
|
2344
|
-
}("includes")
|
|
2345
|
-
}, {
|
|
2346
|
-
includes: function(searchString /* , position = 0 */) {
|
|
2347
|
-
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
|
+
});
|
|
2348
3369
|
}
|
|
2349
|
-
|
|
3370
|
+
return radioContent;
|
|
3371
|
+
}));
|
|
2350
3372
|
|
|
2351
|
-
|
|
3373
|
+
Radio.displayName = "Radio";
|
|
2352
3374
|
|
|
2353
|
-
const
|
|
2354
|
-
var own = it.includes;
|
|
2355
|
-
return it === ArrayPrototype || isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.includes ? arrayMethod : "string" == typeof it || it === StringPrototype || isPrototypeOf(StringPrototype, it) && own === StringPrototype.includes ? stringMethod : own;
|
|
2356
|
-
})), 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}) => {
|
|
2357
3376
|
const context = useContext(SelectContext), label = "string" == typeof children ? children : value;
|
|
2358
3377
|
// We assume children is the label if it's a string, or we need a way to get label.
|
|
2359
3378
|
// For simplicity, we use children as label for registration if it's a string.
|
|
@@ -2471,7 +3490,10 @@ const Select = memo((({options: options, value: value, onChange: onChange, onBl
|
|
|
2471
3490
|
};
|
|
2472
3491
|
}), []);
|
|
2473
3492
|
// Toggle dropdown
|
|
2474
|
-
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 => {
|
|
2475
3497
|
if (setSelectedLabel(option.label), setIsOpen(!1), bodyRef.current && (bodyRef.current.style.height = "0px"),
|
|
2476
3498
|
nativeSelectRef.current && (nativeSelectRef.current.value = option.value), onChange) {
|
|
2477
3499
|
// Create a synthetic event
|
|
@@ -2515,7 +3537,15 @@ const Select = memo((({options: options, value: value, onChange: onChange, onBl
|
|
|
2515
3537
|
"aria-describedby": ariaDescribedBy,
|
|
2516
3538
|
"aria-invalid": invalid,
|
|
2517
3539
|
style: {
|
|
2518
|
-
|
|
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"
|
|
2519
3549
|
},
|
|
2520
3550
|
children: [ placeholder && jsx("option", {
|
|
2521
3551
|
value: "",
|
|
@@ -2528,11 +3558,29 @@ const Select = memo((({options: options, value: value, onChange: onChange, onBl
|
|
|
2528
3558
|
}, option.value))) ]
|
|
2529
3559
|
}), jsx("div", {
|
|
2530
3560
|
className: SELECT_CLASSES_SELECTED,
|
|
2531
|
-
onClick:
|
|
2532
|
-
|
|
2533
|
-
|
|
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
|
+
}
|
|
2534
3577
|
},
|
|
2535
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,
|
|
2536
3584
|
children: selectedLabel
|
|
2537
3585
|
}), jsx("i", {
|
|
2538
3586
|
className: `${SELECT_CLASSES_ICON_CARET} ${SELECT_CLASSES_TOGGLE_ICON}`
|
|
@@ -2547,10 +3595,16 @@ const Select = memo((({options: options, value: value, onChange: onChange, onBl
|
|
|
2547
3595
|
ref: panelRef,
|
|
2548
3596
|
children: jsx("ul", {
|
|
2549
3597
|
className: SELECT_CLASSES_SELECT_ITEMS,
|
|
3598
|
+
role: "listbox",
|
|
3599
|
+
id: id ? `${id}-listbox` : void 0,
|
|
3600
|
+
"aria-labelledby": id,
|
|
2550
3601
|
children: hasOptionsProp ? options.map(((option, index) => jsx("li", {
|
|
2551
3602
|
className: SELECT_CLASSES_SELECT_ITEM,
|
|
2552
3603
|
"data-value": option.value,
|
|
2553
3604
|
onClick: () => !option.disabled && handleItemClick(option),
|
|
3605
|
+
role: "option",
|
|
3606
|
+
"aria-selected": value === option.value,
|
|
3607
|
+
"aria-disabled": option.disabled,
|
|
2554
3608
|
children: jsxs("label", {
|
|
2555
3609
|
htmlFor: `SelectItem${index}`,
|
|
2556
3610
|
className: "c-checkbox",
|
|
@@ -2974,7 +4028,9 @@ const smoothStep = (a, b, t) => {
|
|
|
2974
4028
|
return this.canvasDPI;
|
|
2975
4029
|
}
|
|
2976
4030
|
},
|
|
2977
|
-
|
|
4031
|
+
createFBMEngine: createFBMEngine,
|
|
4032
|
+
fragmentShaders: fragmentShaders,
|
|
4033
|
+
liquidGlassWithTime: liquidGlassWithTime
|
|
2978
4034
|
}, Symbol.toStringTag, {
|
|
2979
4035
|
value: "Module"
|
|
2980
4036
|
}));
|