@shohojdhara/atomix 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/atomix.css +0 -14
- package/dist/atomix.css.map +1 -1
- package/dist/atomix.min.css +4 -4
- package/dist/atomix.min.css.map +1 -1
- package/dist/charts.d.ts +12 -19
- package/dist/charts.js +555 -359
- package/dist/charts.js.map +1 -1
- package/dist/core.d.ts +98 -28
- package/dist/core.js +1082 -733
- package/dist/core.js.map +1 -1
- package/dist/forms.d.ts +26 -21
- package/dist/forms.js +937 -350
- package/dist/forms.js.map +1 -1
- package/dist/heavy.d.ts +14 -21
- package/dist/heavy.js +409 -256
- package/dist/heavy.js.map +1 -1
- package/dist/index.d.ts +518 -284
- package/dist/index.esm.js +1993 -1237
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1994 -1237
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +2 -2
- package/scripts/atomix-cli.js +43 -1
- package/scripts/cli/__tests__/utils.test.js +6 -2
- package/scripts/cli/migration-tools.js +2 -2
- package/scripts/cli/theme-bridge.js +7 -9
- package/scripts/cli/utils.js +2 -1
- package/src/components/Accordion/Accordion.stories.tsx +40 -0
- package/src/components/Accordion/Accordion.tsx +174 -56
- package/src/components/Accordion/AccordionCompound.test.tsx +70 -0
- package/src/components/AtomixGlass/AtomixGlass.tsx +82 -54
- package/src/components/AtomixGlass/AtomixGlassContainer.tsx +17 -18
- package/src/components/AtomixGlass/README.md +5 -5
- package/src/components/AtomixGlass/stories/Customization.stories.tsx +2 -2
- package/src/components/AtomixGlass/stories/Examples.stories.tsx +42 -42
- package/src/components/AtomixGlass/stories/Modes.stories.tsx +5 -5
- package/src/components/AtomixGlass/stories/Overview.stories.tsx +3 -3
- package/src/components/AtomixGlass/stories/Performance.stories.tsx +2 -2
- package/src/components/AtomixGlass/stories/Playground.stories.tsx +45 -45
- package/src/components/AtomixGlass/stories/Shaders.stories.tsx +3 -3
- package/src/components/Badge/Badge.stories.tsx +1 -1
- package/src/components/Badge/Badge.tsx +1 -1
- package/src/components/Breadcrumb/Breadcrumb.tsx +185 -65
- package/src/components/Breadcrumb/BreadcrumbCompound.test.tsx +84 -0
- package/src/components/Breadcrumb/index.ts +2 -2
- package/src/components/Button/Button.stories.tsx +1 -1
- package/src/components/Button/README.md +2 -2
- package/src/components/Callout/Callout.stories.tsx +166 -1011
- package/src/components/Callout/Callout.test.tsx +3 -3
- package/src/components/Callout/Callout.tsx +196 -84
- package/src/components/Callout/CalloutCompound.test.tsx +72 -0
- package/src/components/Callout/README.md +2 -2
- package/src/components/Chart/Chart.stories.tsx +1 -1
- package/src/components/Chart/Chart.tsx +5 -5
- package/src/components/Chart/TreemapChart.tsx +37 -29
- package/src/components/DatePicker/readme.md +3 -3
- package/src/components/Dropdown/Dropdown.stories.tsx +1 -1
- package/src/components/Dropdown/Dropdown.tsx +133 -20
- package/src/components/Dropdown/DropdownCompound.test.tsx +64 -0
- package/src/components/EdgePanel/EdgePanel.stories.tsx +7 -7
- package/src/components/EdgePanel/EdgePanel.tsx +164 -112
- package/src/components/EdgePanel/EdgePanelCompound.test.tsx +53 -0
- package/src/components/Form/Checkbox.stories.tsx +1 -1
- package/src/components/Form/Checkbox.tsx +1 -1
- package/src/components/Form/Input.stories.tsx +1 -1
- package/src/components/Form/Input.tsx +1 -1
- package/src/components/Form/Radio.stories.tsx +1 -1
- package/src/components/Form/Radio.tsx +1 -1
- package/src/components/Form/Select.stories.tsx +24 -1
- package/src/components/Form/Select.test.tsx +99 -0
- package/src/components/Form/Select.tsx +145 -94
- package/src/components/Form/SelectOption.tsx +88 -0
- package/src/components/Form/Textarea.stories.tsx +1 -1
- package/src/components/Form/Textarea.tsx +1 -1
- package/src/components/Hero/Hero.stories.tsx +39 -2
- package/src/components/Hero/Hero.test.tsx +142 -0
- package/src/components/Hero/Hero.tsx +143 -4
- package/src/components/List/List.test.tsx +62 -0
- package/src/components/List/List.tsx +16 -5
- package/src/components/List/ListItem.tsx +20 -0
- package/src/components/Messages/Messages.stories.tsx +1 -1
- package/src/components/Messages/Messages.tsx +2 -2
- package/src/components/Modal/Modal.stories.tsx +66 -2
- package/src/components/Modal/Modal.tsx +115 -35
- package/src/components/Modal/ModalCompound.test.tsx +94 -0
- package/src/components/Navigation/Nav/Nav.stories.tsx +2 -2
- package/src/components/Navigation/Nav/Nav.tsx +1 -1
- package/src/components/Navigation/Navbar/Navbar.stories.tsx +3 -3
- package/src/components/Navigation/Navbar/Navbar.tsx +1 -1
- package/src/components/Navigation/SideMenu/SideMenu.stories.tsx +2 -2
- package/src/components/Navigation/SideMenu/SideMenu.tsx +1 -1
- package/src/components/Pagination/Pagination.stories.tsx +1 -1
- package/src/components/Pagination/Pagination.tsx +1 -1
- package/src/components/Popover/Popover.stories.tsx +1 -1
- package/src/components/Popover/Popover.tsx +1 -1
- package/src/components/Progress/Progress.tsx +1 -1
- package/src/components/Rating/Rating.stories.tsx +1 -1
- package/src/components/Rating/Rating.test.tsx +73 -0
- package/src/components/Rating/Rating.tsx +25 -37
- package/src/components/Spinner/Spinner.tsx +1 -1
- package/src/components/Steps/Steps.stories.tsx +1 -1
- package/src/components/Steps/Steps.tsx +125 -22
- package/src/components/Steps/StepsCompound.test.tsx +81 -0
- package/src/components/Tabs/Tabs.stories.tsx +1 -1
- package/src/components/Tabs/Tabs.tsx +198 -45
- package/src/components/Tabs/TabsCompound.test.tsx +64 -0
- package/src/components/Todo/Todo.tsx +0 -1
- package/src/components/Toggle/Toggle.stories.tsx +1 -1
- package/src/components/Toggle/Toggle.tsx +1 -1
- package/src/components/Tooltip/Tooltip.stories.tsx +1 -1
- package/src/components/VideoPlayer/VideoPlayer.stories.tsx +2 -2
- package/src/lib/composables/__tests__/useAtomixGlassPerf.test.tsx +88 -0
- package/src/lib/composables/__tests__/useChart.test.ts +50 -0
- package/src/lib/composables/__tests__/useChart.test.tsx +139 -0
- package/src/lib/composables/__tests__/useHeroBackgroundSlider.test.tsx +59 -0
- package/src/lib/composables/__tests__/useSliderAutoplay.test.tsx +68 -0
- package/src/lib/composables/atomix-glass/useGlassBackgroundDetection.ts +329 -0
- package/src/lib/composables/atomix-glass/useGlassCornerRadius.ts +82 -0
- package/src/lib/composables/atomix-glass/useGlassMouseTracking.ts +153 -0
- package/src/lib/composables/atomix-glass/useGlassOverLight.ts +198 -0
- package/src/lib/composables/atomix-glass/useGlassSize.ts +117 -0
- package/src/lib/composables/atomix-glass/useGlassState.ts +112 -0
- package/src/lib/composables/atomix-glass/useGlassTransforms.ts +160 -0
- package/src/lib/composables/glass-styles.ts +302 -0
- package/src/lib/composables/index.ts +0 -8
- package/src/lib/composables/useAtomixGlass.ts +331 -537
- package/src/lib/composables/useAtomixGlassStyles.ts +307 -0
- package/src/lib/composables/useBarChart.ts +1 -1
- package/src/lib/composables/useBreadcrumb.ts +6 -6
- package/src/lib/composables/useChart.ts +104 -21
- package/src/lib/composables/useHeroBackgroundSlider.ts +16 -7
- package/src/lib/composables/useSlider.ts +66 -34
- package/src/lib/theme/devtools/CLI.ts +2 -10
- package/src/lib/theme/utils/__tests__/themeUtils.test.ts +213 -0
- package/src/lib/types/components.ts +21 -23
- package/src/lib/utils/__tests__/componentUtils.test.ts +57 -2
- package/src/lib/utils/__tests__/dom.test.ts +100 -0
- package/src/lib/utils/__tests__/fontPreloader.test.ts +102 -0
- package/src/lib/utils/__tests__/themeNaming.test.ts +117 -0
- package/src/lib/utils/themeNaming.ts +1 -1
- package/src/styles/06-components/_components.accordion.scss +0 -2
- package/src/styles/06-components/_components.chart.scss +0 -1
- package/src/styles/06-components/_components.dropdown.scss +0 -1
- package/src/styles/06-components/_components.edge-panel.scss +0 -2
- package/src/styles/06-components/_components.photoviewer.scss +0 -1
- package/src/styles/06-components/_components.river.scss +0 -1
- package/src/styles/06-components/_components.slider.scss +0 -3
- package/src/styles/99-utilities/_utilities.glass-fixes.scss +0 -1
package/dist/core.js
CHANGED
|
@@ -1,15 +1,380 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
|
|
3
|
-
import React, { useState, useRef, useEffect, memo, forwardRef, useMemo, useCallback, useId } from "react";
|
|
3
|
+
import React, { useState, useRef, useEffect, memo, forwardRef, useMemo, useCallback, useId, Children, isValidElement, cloneElement } from "react";
|
|
4
4
|
|
|
5
5
|
import * as PhosphorIcons from "@phosphor-icons/react";
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
var commonjsGlobal = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {};
|
|
8
|
+
|
|
9
|
+
function getDefaultExportFromCjs(x) {
|
|
10
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x.default : x;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
var fails$8 = function(exec) {
|
|
14
|
+
try {
|
|
15
|
+
return !!exec();
|
|
16
|
+
} catch (error) {
|
|
17
|
+
return !0;
|
|
18
|
+
}
|
|
19
|
+
}, functionBindNative = !fails$8((function() {
|
|
20
|
+
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
|
21
|
+
var test = function() {/* empty */}.bind();
|
|
22
|
+
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
23
|
+
return "function" != typeof test || test.hasOwnProperty("prototype");
|
|
24
|
+
})), 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) {
|
|
25
|
+
return function() {
|
|
26
|
+
return call$5.apply(fn, arguments);
|
|
27
|
+
};
|
|
28
|
+
}, objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf), check = function(it) {
|
|
29
|
+
return it && it.Math === Math && it;
|
|
30
|
+
}, globalThis_1 =
|
|
31
|
+
// eslint-disable-next-line es/no-global-this -- safe
|
|
32
|
+
check("object" == typeof globalThis && globalThis) || check("object" == typeof window && window) ||
|
|
33
|
+
// eslint-disable-next-line no-restricted-globals -- safe
|
|
34
|
+
check("object" == typeof self && self) || check("object" == typeof commonjsGlobal && commonjsGlobal) || check("object" == typeof commonjsGlobal && commonjsGlobal) ||
|
|
35
|
+
// eslint-disable-next-line no-new-func -- fallback
|
|
36
|
+
function() {
|
|
37
|
+
return this;
|
|
38
|
+
}() || 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() {
|
|
39
|
+
return call$4.apply(apply$1, arguments);
|
|
40
|
+
}), uncurryThis$7 = functionUncurryThis, toString$3 = uncurryThis$7({}.toString), stringSlice = uncurryThis$7("".slice), classofRaw$2 = function(it) {
|
|
41
|
+
return stringSlice(toString$3(it), 8, -1);
|
|
42
|
+
}, classofRaw$1 = classofRaw$2, uncurryThis$6 = functionUncurryThis, functionUncurryThisClause = function(fn) {
|
|
43
|
+
// Nashorn bug:
|
|
44
|
+
// https://github.com/zloirock/core-js/issues/1128
|
|
45
|
+
// https://github.com/zloirock/core-js/issues/1130
|
|
46
|
+
if ("Function" === classofRaw$1(fn)) return uncurryThis$6(fn);
|
|
47
|
+
}, documentAll = "object" == typeof document && document.all, isCallable$8 = void 0 === documentAll && void 0 !== documentAll ? function(argument) {
|
|
48
|
+
return "function" == typeof argument || argument === documentAll;
|
|
49
|
+
} : function(argument) {
|
|
50
|
+
return "function" == typeof argument;
|
|
51
|
+
}, objectGetOwnPropertyDescriptor = {}, descriptors = !fails$8((function() {
|
|
52
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
53
|
+
return 7 !== Object.defineProperty({}, 1, {
|
|
54
|
+
get: function() {
|
|
55
|
+
return 7;
|
|
56
|
+
}
|
|
57
|
+
})[1];
|
|
58
|
+
})), NATIVE_BIND$1 = functionBindNative, call$3 = Function.prototype.call, functionCall = NATIVE_BIND$1 ? call$3.bind(call$3) : function() {
|
|
59
|
+
return call$3.apply(call$3, arguments);
|
|
60
|
+
}, objectPropertyIsEnumerable = {}, $propertyIsEnumerable = {}.propertyIsEnumerable, getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor, NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({
|
|
61
|
+
1: 2
|
|
62
|
+
}, 1);
|
|
63
|
+
|
|
64
|
+
// `Object.prototype.propertyIsEnumerable` method implementation
|
|
65
|
+
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
|
66
|
+
objectPropertyIsEnumerable.f = NASHORN_BUG ? function(V) {
|
|
67
|
+
var descriptor = getOwnPropertyDescriptor$1(this, V);
|
|
68
|
+
return !!descriptor && descriptor.enumerable;
|
|
69
|
+
} : $propertyIsEnumerable;
|
|
70
|
+
|
|
71
|
+
var match, version, createPropertyDescriptor$2 = function(bitmap, value) {
|
|
72
|
+
return {
|
|
73
|
+
enumerable: !(1 & bitmap),
|
|
74
|
+
configurable: !(2 & bitmap),
|
|
75
|
+
writable: !(4 & bitmap),
|
|
76
|
+
value: value
|
|
77
|
+
};
|
|
78
|
+
}, fails$5 = fails$8, classof$3 = classofRaw$2, $Object$3 = Object, split = functionUncurryThis("".split), indexedObject = fails$5((function() {
|
|
79
|
+
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
80
|
+
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
81
|
+
return !$Object$3("z").propertyIsEnumerable(0);
|
|
82
|
+
})) ? function(it) {
|
|
83
|
+
return "String" === classof$3(it) ? split(it, "") : $Object$3(it);
|
|
84
|
+
} : $Object$3, isNullOrUndefined$2 = function(it) {
|
|
85
|
+
return null == it;
|
|
86
|
+
}, isNullOrUndefined$1 = isNullOrUndefined$2, $TypeError$6 = TypeError, requireObjectCoercible$3 = function(it) {
|
|
87
|
+
if (isNullOrUndefined$1(it)) throw new $TypeError$6("Can't call method on " + it);
|
|
88
|
+
return it;
|
|
89
|
+
}, IndexedObject = indexedObject, requireObjectCoercible$2 = requireObjectCoercible$3, toIndexedObject$2 = function(it) {
|
|
90
|
+
return IndexedObject(requireObjectCoercible$2(it));
|
|
91
|
+
}, isCallable$7 = isCallable$8, isObject$5 = function(it) {
|
|
92
|
+
return "object" == typeof it ? null !== it : isCallable$7(it);
|
|
93
|
+
}, path$3 = {}, path$2 = path$3, globalThis$a = globalThis_1, isCallable$6 = isCallable$8, aFunction = function(variable) {
|
|
94
|
+
return isCallable$6(variable) ? variable : void 0;
|
|
95
|
+
}, 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;
|
|
96
|
+
|
|
97
|
+
v8 && (
|
|
98
|
+
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
|
99
|
+
// but their correct versions are not interesting for us
|
|
100
|
+
version = (match = v8.split("."))[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1])),
|
|
101
|
+
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
|
102
|
+
// so check `userAgent` even if `.v8` exists, but 0
|
|
103
|
+
!version && userAgent && (!(match = userAgent.match(/Edge\/(\d+)/)) || match[1] >= 74) && (match = userAgent.match(/Chrome\/(\d+)/)) && (version = +match[1]);
|
|
104
|
+
|
|
105
|
+
var V8_VERSION = version, fails$4 = fails$8, $String$3 = globalThis_1.String, symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$4((function() {
|
|
106
|
+
var symbol = Symbol("symbol detection");
|
|
107
|
+
// Chrome 38 Symbol has incorrect toString conversion
|
|
108
|
+
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
109
|
+
// nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
|
|
110
|
+
// of course, fail.
|
|
111
|
+
return !$String$3(symbol) || !(Object(symbol) instanceof Symbol) ||
|
|
112
|
+
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
|
113
|
+
!Symbol.sham && V8_VERSION && V8_VERSION < 41;
|
|
114
|
+
})), useSymbolAsUid = symbolConstructorDetection && !Symbol.sham && "symbol" == typeof Symbol.iterator, isCallable$5 = isCallable$8, isPrototypeOf$1 = objectIsPrototypeOf, $Object$2 = Object, isSymbol$2 = useSymbolAsUid ? function(it) {
|
|
115
|
+
return "symbol" == typeof it;
|
|
116
|
+
} : function(it) {
|
|
117
|
+
var $Symbol = function(namespace, method) {
|
|
118
|
+
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];
|
|
119
|
+
}("Symbol");
|
|
120
|
+
return isCallable$5($Symbol) && isPrototypeOf$1($Symbol.prototype, $Object$2(it));
|
|
121
|
+
}, $String$2 = String, isCallable$4 = isCallable$8, $TypeError$5 = TypeError, aCallable$2 = function(argument) {
|
|
122
|
+
if (isCallable$4(argument)) return argument;
|
|
123
|
+
throw new $TypeError$5(function(argument) {
|
|
124
|
+
try {
|
|
125
|
+
return $String$2(argument);
|
|
126
|
+
} catch (error) {
|
|
127
|
+
return "Object";
|
|
128
|
+
}
|
|
129
|
+
}(argument) + " is not a function");
|
|
130
|
+
}, aCallable$1 = aCallable$2, isNullOrUndefined = isNullOrUndefined$2, call$2 = functionCall, isCallable$3 = isCallable$8, isObject$4 = isObject$5, $TypeError$4 = TypeError, sharedStore = {
|
|
131
|
+
exports: {}
|
|
132
|
+
}, globalThis$6 = globalThis_1, defineProperty = Object.defineProperty, globalThis$5 = globalThis_1, store$1 = sharedStore.exports = globalThis$5["__core-js_shared__"] || function(key, value) {
|
|
133
|
+
try {
|
|
134
|
+
defineProperty(globalThis$6, key, {
|
|
135
|
+
value: value,
|
|
136
|
+
configurable: !0,
|
|
137
|
+
writable: !0
|
|
138
|
+
});
|
|
139
|
+
} catch (error) {
|
|
140
|
+
globalThis$6[key] = value;
|
|
141
|
+
}
|
|
142
|
+
return value;
|
|
143
|
+
}("__core-js_shared__", {});
|
|
144
|
+
|
|
145
|
+
/* eslint-disable es/no-symbol -- required for testing */ (store$1.versions || (store$1.versions = [])).push({
|
|
146
|
+
version: "3.43.0",
|
|
147
|
+
mode: "pure",
|
|
148
|
+
copyright: "© 2014-2025 Denis Pushkarev (zloirock.ru)",
|
|
149
|
+
license: "https://github.com/zloirock/core-js/blob/v3.43.0/LICENSE",
|
|
150
|
+
source: "https://github.com/zloirock/core-js"
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
var key, value, store = sharedStore.exports, requireObjectCoercible$1 = requireObjectCoercible$3, $Object$1 = Object, hasOwnProperty = functionUncurryThis({}.hasOwnProperty), hasOwnProperty_1 = Object.hasOwn || function(it, key) {
|
|
154
|
+
return hasOwnProperty($Object$1(requireObjectCoercible$1(it)), key);
|
|
155
|
+
}, 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) {
|
|
156
|
+
return "Symbol(" + (void 0 === key ? "" : key) + ")_" + toString$2(++id + postfix, 36);
|
|
157
|
+
}, wellKnownSymbol$5 = function(name) {
|
|
158
|
+
return hasOwn$2(WellKnownSymbolsStore, name) || (WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$2(Symbol$1, name) ? Symbol$1[name] : createWellKnownSymbol("Symbol." + name)),
|
|
159
|
+
WellKnownSymbolsStore[name];
|
|
160
|
+
}, call$1 = functionCall, isObject$3 = isObject$5, isSymbol$1 = isSymbol$2, $TypeError$3 = TypeError, TO_PRIMITIVE = wellKnownSymbol$5("toPrimitive"), toPrimitive = function(input, pref) {
|
|
161
|
+
if (!isObject$3(input) || isSymbol$1(input)) return input;
|
|
162
|
+
var result, func, exoticToPrim = (func = input[TO_PRIMITIVE], isNullOrUndefined(func) ? void 0 : aCallable$1(func));
|
|
163
|
+
if (exoticToPrim) {
|
|
164
|
+
if (void 0 === pref && (pref = "default"), result = call$1(exoticToPrim, input, pref),
|
|
165
|
+
!isObject$3(result) || isSymbol$1(result)) return result;
|
|
166
|
+
throw new $TypeError$3("Can't convert object to primitive value");
|
|
167
|
+
}
|
|
168
|
+
return void 0 === pref && (pref = "number"), function(input, pref) {
|
|
169
|
+
var fn, val;
|
|
170
|
+
if ("string" === pref && isCallable$3(fn = input.toString) && !isObject$4(val = call$2(fn, input))) return val;
|
|
171
|
+
if (isCallable$3(fn = input.valueOf) && !isObject$4(val = call$2(fn, input))) return val;
|
|
172
|
+
if ("string" !== pref && isCallable$3(fn = input.toString) && !isObject$4(val = call$2(fn, input))) return val;
|
|
173
|
+
throw new $TypeError$4("Can't convert object to primitive value");
|
|
174
|
+
}(input, pref);
|
|
175
|
+
}, isSymbol = isSymbol$2, toPropertyKey$2 = function(argument) {
|
|
176
|
+
var key = toPrimitive(argument, "string");
|
|
177
|
+
return isSymbol(key) ? key : key + "";
|
|
178
|
+
}, isObject$2 = isObject$5, document$1 = globalThis_1.document, EXISTS = isObject$2(document$1) && isObject$2(document$1.createElement), ie8DomDefine = !descriptors && !fails$8((function() {
|
|
179
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
180
|
+
return 7 !== Object.defineProperty((it = "div", EXISTS ? document$1.createElement(it) : {}), "a", {
|
|
181
|
+
get: function() {
|
|
182
|
+
return 7;
|
|
183
|
+
}
|
|
184
|
+
}).a;
|
|
185
|
+
var it;
|
|
186
|
+
})), 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;
|
|
187
|
+
|
|
188
|
+
// `Object.getOwnPropertyDescriptor` method
|
|
189
|
+
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
|
190
|
+
objectGetOwnPropertyDescriptor.f = DESCRIPTORS$3 ? $getOwnPropertyDescriptor$1 : function(O, P) {
|
|
191
|
+
if (O = toIndexedObject$1(O), P = toPropertyKey$1(P), IE8_DOM_DEFINE$1) try {
|
|
192
|
+
return $getOwnPropertyDescriptor$1(O, P);
|
|
193
|
+
} catch (error) {/* empty */}
|
|
194
|
+
if (hasOwn$1(O, P)) return createPropertyDescriptor$1(!call(propertyIsEnumerableModule.f, O, P), O[P]);
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
var fails$2 = fails$8, isCallable$2 = isCallable$8, replacement = /#|\.prototype\./, isForced$1 = function(feature, detection) {
|
|
198
|
+
var value = data[normalize(feature)];
|
|
199
|
+
return value === POLYFILL || value !== NATIVE && (isCallable$2(detection) ? fails$2(detection) : !!detection);
|
|
200
|
+
}, normalize = isForced$1.normalize = function(string) {
|
|
201
|
+
return String(string).replace(replacement, ".").toLowerCase();
|
|
202
|
+
}, 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() {
|
|
203
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
204
|
+
return 42 !== Object.defineProperty((function() {/* empty */}), "prototype", {
|
|
205
|
+
value: 42,
|
|
206
|
+
writable: !1
|
|
207
|
+
}).prototype;
|
|
208
|
+
})), 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) {
|
|
209
|
+
if (isObject$1(argument)) return argument;
|
|
210
|
+
throw new $TypeError$2($String$1(argument) + " is not an object");
|
|
211
|
+
}, toPropertyKey = toPropertyKey$2, $TypeError$1 = TypeError, $defineProperty = Object.defineProperty, $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
212
|
+
|
|
213
|
+
// `Object.defineProperty` method
|
|
214
|
+
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
215
|
+
objectDefineProperty.f = DESCRIPTORS$1 ? V8_PROTOTYPE_DEFINE_BUG ? function(O, P, Attributes) {
|
|
216
|
+
if (anObject(O), P = toPropertyKey(P), anObject(Attributes), "function" == typeof O && "prototype" === P && "value" in Attributes && "writable" in Attributes && !Attributes.writable) {
|
|
217
|
+
var current = $getOwnPropertyDescriptor(O, P);
|
|
218
|
+
current && current.writable && (O[P] = Attributes.value, Attributes = {
|
|
219
|
+
configurable: "configurable" in Attributes ? Attributes.configurable : current.configurable,
|
|
220
|
+
enumerable: "enumerable" in Attributes ? Attributes.enumerable : current.enumerable,
|
|
221
|
+
writable: !1
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
return $defineProperty(O, P, Attributes);
|
|
225
|
+
} : $defineProperty : function(O, P, Attributes) {
|
|
226
|
+
if (anObject(O), P = toPropertyKey(P), anObject(Attributes), IE8_DOM_DEFINE) try {
|
|
227
|
+
return $defineProperty(O, P, Attributes);
|
|
228
|
+
} catch (error) {/* empty */}
|
|
229
|
+
if ("get" in Attributes || "set" in Attributes) throw new $TypeError$1("Accessors not supported");
|
|
230
|
+
return "value" in Attributes && (O[P] = Attributes.value), O;
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
var definePropertyModule = objectDefineProperty, createPropertyDescriptor = createPropertyDescriptor$2, createNonEnumerableProperty$1 = descriptors ? function(object, key, value) {
|
|
234
|
+
return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
|
|
235
|
+
} : function(object, key, value) {
|
|
236
|
+
return object[key] = value, object;
|
|
237
|
+
}, 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) {
|
|
238
|
+
return aCallable(fn), void 0 === that ? fn : NATIVE_BIND ? bind$1(fn, that) : function() {
|
|
239
|
+
return fn.apply(that, arguments);
|
|
240
|
+
};
|
|
241
|
+
}, createNonEnumerableProperty = createNonEnumerableProperty$1, hasOwn = hasOwnProperty_1, wrapConstructor = function(NativeConstructor) {
|
|
242
|
+
var Wrapper = function(a, b, c) {
|
|
243
|
+
if (this instanceof Wrapper) {
|
|
244
|
+
switch (arguments.length) {
|
|
245
|
+
case 0:
|
|
246
|
+
return new NativeConstructor;
|
|
247
|
+
|
|
248
|
+
case 1:
|
|
249
|
+
return new NativeConstructor(a);
|
|
250
|
+
|
|
251
|
+
case 2:
|
|
252
|
+
return new NativeConstructor(a, b);
|
|
253
|
+
}
|
|
254
|
+
return new NativeConstructor(a, b, c);
|
|
255
|
+
}
|
|
256
|
+
return apply(NativeConstructor, this, arguments);
|
|
257
|
+
};
|
|
258
|
+
return Wrapper.prototype = NativeConstructor.prototype, Wrapper;
|
|
259
|
+
}, _export = function(options, source) {
|
|
260
|
+
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;
|
|
261
|
+
for (key in source)
|
|
262
|
+
// contains in native
|
|
263
|
+
USE_NATIVE = !(FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? "." : "#") + key, options.forced)) && nativeSource && hasOwn(nativeSource, key),
|
|
264
|
+
targetProperty = target[key], USE_NATIVE && (nativeProperty = options.dontCallGetSet ? (descriptor = getOwnPropertyDescriptor(nativeSource, key)) && descriptor.value : nativeSource[key]),
|
|
265
|
+
// export native or implementation
|
|
266
|
+
sourceProperty = USE_NATIVE && nativeProperty ? nativeProperty : source[key], (FORCED || PROTO || typeof targetProperty != typeof sourceProperty) && (
|
|
267
|
+
// bind methods to global for calling from export context
|
|
268
|
+
resultProperty = options.bind && USE_NATIVE ? bind(sourceProperty, globalThis$2) : options.wrap && USE_NATIVE ? wrapConstructor(sourceProperty) : PROTO && isCallable$1(sourceProperty) ? uncurryThis$1(sourceProperty) : sourceProperty,
|
|
269
|
+
// add a flag to not completely full polyfills
|
|
270
|
+
(options.sham || sourceProperty && sourceProperty.sham || targetProperty && targetProperty.sham) && createNonEnumerableProperty(resultProperty, "sham", !0),
|
|
271
|
+
createNonEnumerableProperty(target, key, resultProperty), PROTO && (hasOwn(path$1, VIRTUAL_PROTOTYPE = TARGET + "Prototype") || createNonEnumerableProperty(path$1, VIRTUAL_PROTOTYPE, {}),
|
|
272
|
+
// export virtual prototype methods
|
|
273
|
+
createNonEnumerableProperty(path$1[VIRTUAL_PROTOTYPE], key, sourceProperty),
|
|
274
|
+
// export real prototype methods
|
|
275
|
+
options.real && targetPrototype && (FORCED || !targetPrototype[key]) && createNonEnumerableProperty(targetPrototype, key, sourceProperty)));
|
|
276
|
+
}, ceil = Math.ceil, floor = Math.floor, trunc = Math.trunc || function(x) {
|
|
277
|
+
var n = +x;
|
|
278
|
+
return (n > 0 ? floor : ceil)(n);
|
|
279
|
+
}, toIntegerOrInfinity$2 = function(argument) {
|
|
280
|
+
var number = +argument;
|
|
281
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
282
|
+
return number != number || 0 === number ? 0 : trunc(number);
|
|
283
|
+
}, toIntegerOrInfinity$1 = toIntegerOrInfinity$2, max = Math.max, min$1 = Math.min, toIntegerOrInfinity = toIntegerOrInfinity$2, min = Math.min, toIndexedObject = toIndexedObject$2, lengthOfArrayLike = function(obj) {
|
|
284
|
+
return argument = obj.length, (len = toIntegerOrInfinity(argument)) > 0 ? min(len, 9007199254740991) : 0;
|
|
285
|
+
var argument, len;
|
|
286
|
+
}, createMethod = function(IS_INCLUDES) {
|
|
287
|
+
return function($this, el, fromIndex) {
|
|
288
|
+
var O = toIndexedObject($this), length = lengthOfArrayLike(O);
|
|
289
|
+
if (0 === length) return !IS_INCLUDES && -1;
|
|
290
|
+
var value, index = function(index, length) {
|
|
291
|
+
var integer = toIntegerOrInfinity$1(index);
|
|
292
|
+
return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
|
|
293
|
+
}(fromIndex, length);
|
|
294
|
+
// Array#includes uses SameValueZero equality algorithm
|
|
295
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
296
|
+
if (IS_INCLUDES && el != el) {
|
|
297
|
+
for (;length > index; )
|
|
298
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
299
|
+
if ((value = O[index++]) != value) return !0;
|
|
300
|
+
// Array#indexOf ignores holes, Array#includes - not
|
|
301
|
+
} else for (;length > index; index++) if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
|
302
|
+
return !IS_INCLUDES && -1;
|
|
303
|
+
};
|
|
304
|
+
}, $includes = [ createMethod(!0), createMethod(!1) ][0];
|
|
305
|
+
|
|
306
|
+
// `Array.prototype.includes` method
|
|
307
|
+
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
308
|
+
_export({
|
|
309
|
+
target: "Array",
|
|
310
|
+
proto: !0,
|
|
311
|
+
forced: fails$8((function() {
|
|
312
|
+
// eslint-disable-next-line es/no-array-prototype-includes -- detection
|
|
313
|
+
return !Array(1).includes();
|
|
314
|
+
}))
|
|
315
|
+
}, {
|
|
316
|
+
includes: function(el /* , fromIndex = 0 */) {
|
|
317
|
+
return $includes(this, el, arguments.length > 1 ? arguments[1] : void 0);
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
var globalThis$1 = globalThis_1, path = path$3, getBuiltInPrototypeMethod$2 = function(CONSTRUCTOR, METHOD) {
|
|
322
|
+
var Namespace = path[CONSTRUCTOR + "Prototype"], pureMethod = Namespace && Namespace[METHOD];
|
|
323
|
+
if (pureMethod) return pureMethod;
|
|
324
|
+
var NativeConstructor = globalThis$1[CONSTRUCTOR], NativePrototype = NativeConstructor && NativeConstructor.prototype;
|
|
325
|
+
return NativePrototype && NativePrototype[METHOD];
|
|
326
|
+
}, includes$4 = getBuiltInPrototypeMethod$2("Array", "includes"), isObject = isObject$5, classof$2 = classofRaw$2, MATCH$1 = wellKnownSymbol$5("match"), $TypeError = TypeError, test = {};
|
|
327
|
+
|
|
328
|
+
test[wellKnownSymbol$5("toStringTag")] = "z";
|
|
329
|
+
|
|
330
|
+
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() {
|
|
331
|
+
return arguments;
|
|
332
|
+
}()), classof = TO_STRING_TAG_SUPPORT ? classofRaw : function(it) {
|
|
333
|
+
var O, tag, result;
|
|
334
|
+
return void 0 === it ? "Undefined" : null === it ? "Null" : "string" == typeof (tag = function(it, key) {
|
|
335
|
+
try {
|
|
336
|
+
return it[key];
|
|
337
|
+
} catch (error) {/* empty */}
|
|
338
|
+
}(O = $Object(it), TO_STRING_TAG)) ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : "Object" === (result = classofRaw(O)) && isCallable(O.callee) ? "Arguments" : result;
|
|
339
|
+
}, $String = String, MATCH = wellKnownSymbol$5("match"), $ = _export, notARegExp = function(it) {
|
|
340
|
+
if (function(it) {
|
|
341
|
+
var isRegExp;
|
|
342
|
+
return isObject(it) && (void 0 !== (isRegExp = it[MATCH$1]) ? !!isRegExp : "RegExp" === classof$2(it));
|
|
343
|
+
}(it)) throw new $TypeError("The method doesn't accept regular expressions");
|
|
344
|
+
return it;
|
|
345
|
+
}, requireObjectCoercible = requireObjectCoercible$3, toString = function(argument) {
|
|
346
|
+
if ("Symbol" === classof(argument)) throw new TypeError("Cannot convert a Symbol value to a string");
|
|
347
|
+
return $String(argument);
|
|
348
|
+
}, stringIndexOf = functionUncurryThis("".indexOf);
|
|
349
|
+
|
|
350
|
+
// `String.prototype.includes` method
|
|
351
|
+
// https://tc39.es/ecma262/#sec-string.prototype.includes
|
|
352
|
+
$({
|
|
353
|
+
target: "String",
|
|
354
|
+
proto: !0,
|
|
355
|
+
forced: !function(METHOD_NAME) {
|
|
356
|
+
var regexp = /./;
|
|
357
|
+
try {
|
|
358
|
+
"/./"[METHOD_NAME](regexp);
|
|
359
|
+
} catch (error1) {
|
|
360
|
+
try {
|
|
361
|
+
return regexp[MATCH] = !1, "/./"[METHOD_NAME](regexp);
|
|
362
|
+
} catch (error2) {/* empty */}
|
|
363
|
+
}
|
|
364
|
+
return !1;
|
|
365
|
+
}("includes")
|
|
366
|
+
}, {
|
|
367
|
+
includes: function(searchString /* , position = 0 */) {
|
|
368
|
+
return !!~stringIndexOf(toString(requireObjectCoercible(this)), toString(notARegExp(searchString)), arguments.length > 1 ? arguments[1] : void 0);
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
var includes$3 = getBuiltInPrototypeMethod$2("String", "includes"), isPrototypeOf = objectIsPrototypeOf, arrayMethod = includes$4, stringMethod = includes$3, ArrayPrototype = Array.prototype, StringPrototype = String.prototype;
|
|
373
|
+
|
|
374
|
+
const _includesInstanceProperty = getDefaultExportFromCjs((function(it) {
|
|
375
|
+
var own = it.includes;
|
|
376
|
+
return it === ArrayPrototype || isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.includes ? arrayMethod : "string" == typeof it || it === StringPrototype || isPrototypeOf(StringPrototype, it) && own === StringPrototype.includes ? stringMethod : own;
|
|
377
|
+
})), BUTTON = {
|
|
13
378
|
BASE_CLASS: "c-btn",
|
|
14
379
|
ICON_CLASS: "c-btn__icon",
|
|
15
380
|
LABEL_CLASS: "c-btn__label",
|
|
@@ -362,7 +727,7 @@ import * as PhosphorIcons from "@phosphor-icons/react";
|
|
|
362
727
|
HIGH_CONTRAST: 200
|
|
363
728
|
}
|
|
364
729
|
}
|
|
365
|
-
}, {CONSTANTS: CONSTANTS$
|
|
730
|
+
}, {CONSTANTS: CONSTANTS$2} = ATOMIX_GLASS, calculateDistance = (pos1, pos2) => {
|
|
366
731
|
if (!pos1 || !pos2 || "number" != typeof pos1.x || "number" != typeof pos1.y || "number" != typeof pos2.x || "number" != typeof pos2.y) return 0;
|
|
367
732
|
const deltaX = pos1.x - pos2.x, deltaY = pos1.y - pos2.y;
|
|
368
733
|
return Math.sqrt(deltaX * deltaX + deltaY * deltaY);
|
|
@@ -375,36 +740,36 @@ import * as PhosphorIcons from "@phosphor-icons/react";
|
|
|
375
740
|
}, calculateMouseInfluence = mouseOffset => {
|
|
376
741
|
if (!mouseOffset || "number" != typeof mouseOffset.x || "number" != typeof mouseOffset.y) return 0;
|
|
377
742
|
// Bounded calculation — keeps the glass effect subtle and stable
|
|
378
|
-
const influence = Math.sqrt(mouseOffset.x * mouseOffset.x + mouseOffset.y * mouseOffset.y) / CONSTANTS$
|
|
743
|
+
const influence = Math.sqrt(mouseOffset.x * mouseOffset.x + mouseOffset.y * mouseOffset.y) / CONSTANTS$2.MOUSE_INFLUENCE_DIVISOR;
|
|
379
744
|
return Math.min(.8, influence);
|
|
380
745
|
// Tighter cap to prevent blur/filter blow-out
|
|
381
|
-
}, clampBlur = value => "number" != typeof value || isNaN(value) ? CONSTANTS$
|
|
746
|
+
}, clampBlur = value => "number" != typeof value || isNaN(value) ? CONSTANTS$2.MIN_BLUR : Math.max(CONSTANTS$2.MIN_BLUR, Math.min(50, value)), validateGlassSize = size => size && "number" == typeof size.width && "number" == typeof size.height && size.width > 0 && size.height > 0 && size.width <= CONSTANTS$2.MAX_SIZE && size.height <= CONSTANTS$2.MAX_SIZE, parseBorderRadiusValue = value => {
|
|
382
747
|
if ("number" == typeof value) return Math.max(0, value);
|
|
383
|
-
if ("string" != typeof value || !value.trim()) return CONSTANTS$
|
|
748
|
+
if ("string" != typeof value || !value.trim()) return CONSTANTS$2.DEFAULT_CORNER_RADIUS;
|
|
384
749
|
const trimmedValue = value.trim();
|
|
385
750
|
// Handle px values
|
|
386
751
|
if (trimmedValue.endsWith("px")) {
|
|
387
752
|
const parsed = parseFloat(trimmedValue);
|
|
388
|
-
return isNaN(parsed) ? CONSTANTS$
|
|
753
|
+
return isNaN(parsed) ? CONSTANTS$2.DEFAULT_CORNER_RADIUS : Math.max(0, parsed);
|
|
389
754
|
}
|
|
390
755
|
// Handle rem values (assume 16px = 1rem)
|
|
391
756
|
if (trimmedValue.endsWith("rem")) {
|
|
392
757
|
const parsed = parseFloat(trimmedValue);
|
|
393
|
-
return isNaN(parsed) ? CONSTANTS$
|
|
758
|
+
return isNaN(parsed) ? CONSTANTS$2.DEFAULT_CORNER_RADIUS : Math.max(0, 16 * parsed);
|
|
394
759
|
}
|
|
395
760
|
// Handle em values (assume 16px = 1em for simplicity)
|
|
396
761
|
if (trimmedValue.endsWith("em")) {
|
|
397
762
|
const parsed = parseFloat(trimmedValue);
|
|
398
|
-
return isNaN(parsed) ? CONSTANTS$
|
|
763
|
+
return isNaN(parsed) ? CONSTANTS$2.DEFAULT_CORNER_RADIUS : Math.max(0, 16 * parsed);
|
|
399
764
|
}
|
|
400
765
|
// Handle percentage (convert to approximate px value, assuming 200px container)
|
|
401
766
|
if (trimmedValue.endsWith("%")) {
|
|
402
767
|
const parsed = parseFloat(trimmedValue);
|
|
403
|
-
return isNaN(parsed) ? CONSTANTS$
|
|
768
|
+
return isNaN(parsed) ? CONSTANTS$2.DEFAULT_CORNER_RADIUS : Math.max(0, parsed / 100 * 200);
|
|
404
769
|
}
|
|
405
770
|
// Handle unitless numbers
|
|
406
771
|
const numValue = parseFloat(trimmedValue);
|
|
407
|
-
return isNaN(numValue) ? CONSTANTS$
|
|
772
|
+
return isNaN(numValue) ? CONSTANTS$2.DEFAULT_CORNER_RADIUS : Math.max(0, numValue);
|
|
408
773
|
}, extractBorderRadiusFromElement = element => {
|
|
409
774
|
if (!element || !element.props) return null;
|
|
410
775
|
// Check inline styles first (highest priority)
|
|
@@ -420,11 +785,11 @@ import * as PhosphorIcons from "@phosphor-icons/react";
|
|
|
420
785
|
// If element has children, recursively check them
|
|
421
786
|
if (element.props.children) {
|
|
422
787
|
const childRadius = extractBorderRadiusFromChildren(element.props.children);
|
|
423
|
-
if (childRadius > 0 && childRadius !== CONSTANTS$
|
|
788
|
+
if (childRadius > 0 && childRadius !== CONSTANTS$2.DEFAULT_CORNER_RADIUS) return childRadius;
|
|
424
789
|
}
|
|
425
790
|
return null;
|
|
426
791
|
}, extractBorderRadiusFromChildren = children => {
|
|
427
|
-
if (!children) return CONSTANTS$
|
|
792
|
+
if (!children) return CONSTANTS$2.DEFAULT_CORNER_RADIUS;
|
|
428
793
|
try {
|
|
429
794
|
const childArray = React.Children.toArray(children);
|
|
430
795
|
for (let i = 0; i < childArray.length; i++) {
|
|
@@ -437,7 +802,7 @@ import * as PhosphorIcons from "@phosphor-icons/react";
|
|
|
437
802
|
} catch (error) {
|
|
438
803
|
// Silently handle errors
|
|
439
804
|
}
|
|
440
|
-
return CONSTANTS$
|
|
805
|
+
return CONSTANTS$2.DEFAULT_CORNER_RADIUS;
|
|
441
806
|
}, getDisplacementMap = (mode, displacementMap, polarDisplacementMap, prominentDisplacementMap, shaderMapUrl) => {
|
|
442
807
|
switch (mode) {
|
|
443
808
|
case "standard":
|
|
@@ -591,7 +956,12 @@ import * as PhosphorIcons from "@phosphor-icons/react";
|
|
|
591
956
|
})
|
|
592
957
|
});
|
|
593
958
|
|
|
594
|
-
|
|
959
|
+
/**
|
|
960
|
+
* Default theme colors for components
|
|
961
|
+
*/
|
|
962
|
+
/**
|
|
963
|
+
* Button-specific constants
|
|
964
|
+
*/ GlassFilterComponent.displayName = "GlassFilter";
|
|
595
965
|
|
|
596
966
|
// Memoize component to prevent unnecessary re-renders
|
|
597
967
|
const GlassFilter = memo(GlassFilterComponent, ((prevProps, nextProps) => prevProps.id === nextProps.id && prevProps.displacementScale === nextProps.displacementScale && prevProps.aberrationIntensity === nextProps.aberrationIntensity && prevProps.mode === nextProps.mode && prevProps.shaderMapUrl === nextProps.shaderMapUrl && prevProps.blurAmount === nextProps.blurAmount));
|
|
@@ -606,10 +976,10 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
606
976
|
}, globalMousePosition: globalMousePosition = {
|
|
607
977
|
x: 0,
|
|
608
978
|
y: 0
|
|
609
|
-
}, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onMouseDown: onMouseDown, onMouseUp: onMouseUp, isHovered: isHovered = !1, isActive: isActive = !1, overLight: overLight = !1, overLightConfig: overLightConfig = {},
|
|
979
|
+
}, 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 = {
|
|
610
980
|
width: 0,
|
|
611
981
|
height: 0
|
|
612
|
-
}, onClick: onClick, mode: mode = "standard",
|
|
982
|
+
}, onClick: onClick, mode: mode = "standard", effectiveWithoutEffects: effectiveWithoutEffects = !1, effectiveReducedMotion: effectiveReducedMotion = !1, shaderVariant: shaderVariant = "liquidGlass", withLiquidBlur: withLiquidBlur = !1, elasticity: elasticity = 0, contentRef: contentRef}, ref) => {
|
|
613
983
|
// Generate a stable, deterministic ID for SSR compatibility
|
|
614
984
|
// Use a module-level counter that's consistent across server and client
|
|
615
985
|
const filterId = useMemo((() => "atomix-glass-filter-" + ++idCounter), []), [shaderMapUrl, setShaderMapUrl] = useState(""), shaderGeneratorRef = useRef(null), shaderUtilsRef = useRef(null), shaderDebounceTimeoutRef = useRef(null);
|
|
@@ -719,7 +1089,7 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
719
1089
|
flowBlur: 1.2 * blurAmount
|
|
720
1090
|
};
|
|
721
1091
|
// Enhanced validation for liquid blur
|
|
722
|
-
if (!
|
|
1092
|
+
if (!withLiquidBlur || !rectCache || !mouseOffset || "number" != typeof mouseOffset.x || "number" != typeof mouseOffset.y || isNaN(mouseOffset.x) || isNaN(mouseOffset.y)) return defaultBlur;
|
|
723
1093
|
try {
|
|
724
1094
|
const mouseInfluence = calculateMouseInfluence(mouseOffset), maxBlur = 2 * blurAmount, baseBlur = Math.min(maxBlur, blurAmount + mouseInfluence * blurAmount * .15), edgeIntensity = .15 * mouseInfluence, edgeBlur = Math.min(maxBlur, baseBlur * (.8 + .4 * edgeIntensity)), centerIntensity = .1 * mouseInfluence, centerBlur = Math.min(maxBlur, baseBlur * (.3 + .3 * centerIntensity)), flowBlur = Math.min(maxBlur, 1.2 * baseBlur);
|
|
725
1095
|
// NOTE: hover/active multipliers intentionally omitted here —
|
|
@@ -734,14 +1104,14 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
734
1104
|
return console.warn("AtomixGlassContainer: Error calculating liquid blur", error),
|
|
735
1105
|
defaultBlur;
|
|
736
1106
|
}
|
|
737
|
-
}), [
|
|
1107
|
+
}), [ withLiquidBlur, blurAmount, mouseOffset, rectCache ]), backdropStyle = useMemo((() => {
|
|
738
1108
|
try {
|
|
739
1109
|
const dynamicSaturation = saturation + 20 * (liquidBlur.baseBlur || 0), validatedBaseBlur = "number" != typeof liquidBlur.baseBlur || isNaN(liquidBlur.baseBlur) ? 0 : liquidBlur.baseBlur, validatedEdgeBlur = "number" != typeof liquidBlur.edgeBlur || isNaN(liquidBlur.edgeBlur) ? 0 : liquidBlur.edgeBlur, validatedCenterBlur = "number" != typeof liquidBlur.centerBlur || isNaN(liquidBlur.centerBlur) ? 0 : liquidBlur.centerBlur, validatedFlowBlur = "number" != typeof liquidBlur.flowBlur || isNaN(liquidBlur.flowBlur) ? 0 : liquidBlur.flowBlur, area = rectCache ? rectCache.width * rectCache.height : 0;
|
|
740
1110
|
// Validate blur values before using them
|
|
741
|
-
return !
|
|
1111
|
+
return !withLiquidBlur || effectiveReducedMotion || effectiveWithoutEffects || area > 18e4 ? {
|
|
742
1112
|
backdropFilter: `blur(${clampBlur(Math.max(validatedBaseBlur, .8 * validatedEdgeBlur, 1.1 * validatedCenterBlur, .9 * validatedFlowBlur))}px) saturate(${Math.min(dynamicSaturation, 200)}%) contrast(${overLightConfig?.contrast || 1.05}) brightness(${overLightConfig?.brightness || 1.05})`
|
|
743
1113
|
} : {
|
|
744
|
-
backdropFilter: `blur(${clampBlur(.4 * validatedBaseBlur + .25 * validatedEdgeBlur + .15 * validatedCenterBlur + .2 * validatedFlowBlur)}px) saturate(${Math.min(dynamicSaturation, 200)}%) contrast(${overLightConfig?.contrast || 1
|
|
1114
|
+
backdropFilter: `blur(${clampBlur(.4 * validatedBaseBlur + .25 * validatedEdgeBlur + .15 * validatedCenterBlur + .2 * validatedFlowBlur)}px) saturate(${Math.min(dynamicSaturation, 200)}%) contrast(${overLightConfig?.contrast || 1}) brightness(${overLightConfig?.brightness || 1})`
|
|
745
1115
|
};
|
|
746
1116
|
// Single-pass fallback: stronger radius to match perceived blur of multi-pass
|
|
747
1117
|
} catch (error) {
|
|
@@ -750,7 +1120,7 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
750
1120
|
backdropFilter: `blur(${blurAmount}px) saturate(${saturation}%) contrast(1.05) brightness(1.05)`
|
|
751
1121
|
};
|
|
752
1122
|
}
|
|
753
|
-
}), [ liquidBlur, saturation, blurAmount, rectCache, effectiveReducedMotion,
|
|
1123
|
+
}), [ liquidBlur, saturation, blurAmount, rectCache, effectiveReducedMotion, effectiveWithoutEffects, withLiquidBlur ]), containerVars = useMemo((() => {
|
|
754
1124
|
try {
|
|
755
1125
|
// Safe extraction of mouse offset values
|
|
756
1126
|
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;
|
|
@@ -758,10 +1128,10 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
758
1128
|
"--atomix-glass-container-width": `${glassSize?.width}`,
|
|
759
1129
|
"--atomix-glass-container-height": `${glassSize?.height}`,
|
|
760
1130
|
"--atomix-glass-container-padding": padding || "0 0",
|
|
761
|
-
"--atomix-glass-container-radius": `${"number" != typeof
|
|
1131
|
+
"--atomix-glass-container-radius": `${"number" != typeof borderRadius || isNaN(borderRadius) ? 0 : borderRadius}px`,
|
|
762
1132
|
"--atomix-glass-container-backdrop": backdropStyle?.backdropFilter || "none",
|
|
763
1133
|
"--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",
|
|
764
|
-
"--atomix-glass-container-shadow-opacity":
|
|
1134
|
+
"--atomix-glass-container-shadow-opacity": effectiveWithoutEffects ? 0 : 1,
|
|
765
1135
|
// Background and shadow values use design token-aligned RGB values
|
|
766
1136
|
"--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",
|
|
767
1137
|
"--atomix-glass-container-text-shadow": overLight ? "0px 2px 12px rgba(0, 0, 0, 0)" : "0px 2px 12px rgba(0, 0, 0, 0.4)",
|
|
@@ -779,14 +1149,10 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
779
1149
|
"--atomix-glass-container-text-shadow": "none"
|
|
780
1150
|
};
|
|
781
1151
|
}
|
|
782
|
-
}), [ glassSize, padding,
|
|
783
|
-
el && (el.style.setProperty("transition-duration", "0s", "important"), el.style.setProperty("animation-duration", "0s", "important"),
|
|
784
|
-
el.style.setProperty("transition-delay", "0s", "important"));
|
|
785
|
-
};
|
|
1152
|
+
}), [ glassSize, padding, borderRadius, backdropStyle, mouseOffset, overLight, effectiveWithoutEffects ]);
|
|
786
1153
|
return jsx("div", {
|
|
787
1154
|
ref: el => {
|
|
788
1155
|
// Apply force no-transition
|
|
789
|
-
setForceNoTransition(el),
|
|
790
1156
|
// Handle forwarded ref
|
|
791
1157
|
"function" == typeof ref ? ref(el) : ref && (ref.current = el);
|
|
792
1158
|
},
|
|
@@ -821,7 +1187,10 @@ const sharedShaderCache = new Map, AtomixGlassContainer = forwardRef((({childre
|
|
|
821
1187
|
aberrationIntensity: "number" != typeof aberrationIntensity || isNaN(aberrationIntensity) ? 0 : aberrationIntensity,
|
|
822
1188
|
shaderMapUrl: shaderMapUrl
|
|
823
1189
|
}), jsx("div", {
|
|
824
|
-
ref:
|
|
1190
|
+
ref: el => {
|
|
1191
|
+
el && (el.style.setProperty("transition-duration", "0s", "important"), el.style.setProperty("animation-duration", "0s", "important"),
|
|
1192
|
+
el.style.setProperty("transition-delay", "0s", "important"));
|
|
1193
|
+
},
|
|
825
1194
|
className: ATOMIX_GLASS.FILTER_OVERLAY_CLASS,
|
|
826
1195
|
style: {
|
|
827
1196
|
filter: `url(#${filterId})`,
|
|
@@ -938,7 +1307,128 @@ class {
|
|
|
938
1307
|
*/ getSubscriberCount() {
|
|
939
1308
|
return this.listeners.size;
|
|
940
1309
|
}
|
|
941
|
-
},
|
|
1310
|
+
}, updateAtomixGlassStyles = (wrapperElement, containerElement, params) => {
|
|
1311
|
+
if (!wrapperElement && !containerElement) return;
|
|
1312
|
+
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 = {
|
|
1313
|
+
opacity: baseOverLightConfig.opacity * hoverIntensity * activeIntensity,
|
|
1314
|
+
contrast: Math.min(1.6, baseOverLightConfig.contrast + .1 * mouseInfluence),
|
|
1315
|
+
brightness: Math.min(1.1, baseOverLightConfig.brightness + .05 * mouseInfluence),
|
|
1316
|
+
shadowIntensity: Math.min(1.2, Math.max(.5, baseOverLightConfig.shadowIntensity + .2 * mouseInfluence)),
|
|
1317
|
+
borderOpacity: Math.min(1, Math.max(.3, baseOverLightConfig.borderOpacity + .1 * mouseInfluence)),
|
|
1318
|
+
saturationBoost: baseOverLightConfig.saturationBoost
|
|
1319
|
+
};
|
|
1320
|
+
// Calculate mouse influence
|
|
1321
|
+
// Calculate elastic translation
|
|
1322
|
+
let elasticTranslation = {
|
|
1323
|
+
x: 0,
|
|
1324
|
+
y: 0
|
|
1325
|
+
};
|
|
1326
|
+
if (!effectiveWithoutEffects && wrapperElement) {
|
|
1327
|
+
const rect = wrapperElement.getBoundingClientRect(), center = calculateElementCenter(rect);
|
|
1328
|
+
// Calculate fade in factor
|
|
1329
|
+
let fadeInFactor = 0;
|
|
1330
|
+
if (globalMousePosition.x && globalMousePosition.y && validateGlassSize(glassSize)) {
|
|
1331
|
+
const edgeDistanceX = Math.max(0, Math.abs(globalMousePosition.x - center.x) - glassSize.width / 2), edgeDistanceY = Math.max(0, Math.abs(globalMousePosition.y - center.y) - glassSize.height / 2), edgeDistance = calculateDistance({
|
|
1332
|
+
x: edgeDistanceX,
|
|
1333
|
+
y: edgeDistanceY
|
|
1334
|
+
}, {
|
|
1335
|
+
x: 0,
|
|
1336
|
+
y: 0
|
|
1337
|
+
});
|
|
1338
|
+
fadeInFactor = edgeDistance > ATOMIX_GLASS.CONSTANTS.ACTIVATION_ZONE ? 0 : 1 - edgeDistance / ATOMIX_GLASS.CONSTANTS.ACTIVATION_ZONE;
|
|
1339
|
+
}
|
|
1340
|
+
elasticTranslation = {
|
|
1341
|
+
x: (globalMousePosition.x - center.x) * elasticity * .1 * fadeInFactor,
|
|
1342
|
+
y: (globalMousePosition.y - center.y) * elasticity * .1 * fadeInFactor
|
|
1343
|
+
};
|
|
1344
|
+
}
|
|
1345
|
+
const transformStyle = effectiveWithoutEffects ? isActive && Boolean(onClick) ? "scale(0.98)" : "scale(1)" : `translate(${elasticTranslation.x}px, ${elasticTranslation.y}px) ${isActive && Boolean(onClick) ? "scale(0.96)" : directionalScale}`;
|
|
1346
|
+
// Update Wrapper Styles (glassVars)
|
|
1347
|
+
if (wrapperElement) {
|
|
1348
|
+
const mx = mouseOffset.x, my = mouseOffset.y, absMx = Math.abs(mx), absMy = Math.abs(my), GRADIENT = ATOMIX_GLASS.CONSTANTS.GRADIENT, borderGradientAngle = GRADIENT.BASE_ANGLE + mx * GRADIENT.ANGLE_MULTIPLIER, borderStop1 = Math.max(GRADIENT.BORDER_STOP_1.MIN, GRADIENT.BORDER_STOP_1.BASE + my * GRADIENT.BORDER_STOP_1.MULTIPLIER), borderStop2 = Math.min(GRADIENT.BORDER_STOP_2.MAX, GRADIENT.BORDER_STOP_2.BASE + my * GRADIENT.BORDER_STOP_2.MULTIPLIER), 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 ], configBorderOpacity = overLightConfig.borderOpacity, whiteColor = ATOMIX_GLASS.CONSTANTS.PALETTE.WHITE, blackColor = ATOMIX_GLASS.CONSTANTS.PALETTE.BLACK, hoverPositions = {
|
|
1349
|
+
hover1: {
|
|
1350
|
+
x: GRADIENT.CENTER_POSITION + mx / GRADIENT.HOVER_POSITION.DIVISOR_1,
|
|
1351
|
+
y: GRADIENT.CENTER_POSITION + my / GRADIENT.HOVER_POSITION.DIVISOR_1
|
|
1352
|
+
},
|
|
1353
|
+
hover2: {
|
|
1354
|
+
x: GRADIENT.CENTER_POSITION + mx / GRADIENT.HOVER_POSITION.DIVISOR_2,
|
|
1355
|
+
y: GRADIENT.CENTER_POSITION + my / GRADIENT.HOVER_POSITION.DIVISOR_2
|
|
1356
|
+
},
|
|
1357
|
+
hover3: {
|
|
1358
|
+
x: GRADIENT.CENTER_POSITION + mx * GRADIENT.HOVER_POSITION.MULTIPLIER_3,
|
|
1359
|
+
y: GRADIENT.CENTER_POSITION + my * GRADIENT.HOVER_POSITION.MULTIPLIER_3
|
|
1360
|
+
}
|
|
1361
|
+
}, basePosition = {
|
|
1362
|
+
x: GRADIENT.CENTER_POSITION + mx * GRADIENT.BASE_LAYER_MULTIPLIER,
|
|
1363
|
+
y: GRADIENT.CENTER_POSITION + my * GRADIENT.BASE_LAYER_MULTIPLIER
|
|
1364
|
+
}, opacityValues = {
|
|
1365
|
+
hover1: isHovered || isActive ? .5 : 0,
|
|
1366
|
+
hover2: isActive ? .5 : 0,
|
|
1367
|
+
hover3: isHovered ? .4 : isActive ? .8 : 0,
|
|
1368
|
+
base: isOverLight ? overLightConfig.opacity : 0,
|
|
1369
|
+
over: isOverLight ? 1.1 * overLightConfig.opacity : 0
|
|
1370
|
+
}, style = wrapperElement.style;
|
|
1371
|
+
style.setProperty("--atomix-glass-transform", transformStyle || "none"),
|
|
1372
|
+
// Gradients
|
|
1373
|
+
style.setProperty("--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%)`),
|
|
1374
|
+
style.setProperty("--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%)`),
|
|
1375
|
+
// Hover gradients
|
|
1376
|
+
style.setProperty("--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}%)`),
|
|
1377
|
+
style.setProperty("--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}%)`),
|
|
1378
|
+
style.setProperty("--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}%)`),
|
|
1379
|
+
style.setProperty("--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})`),
|
|
1380
|
+
style.setProperty("--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})`),
|
|
1381
|
+
// Opacities
|
|
1382
|
+
style.setProperty("--atomix-glass-hover-1-opacity", opacityValues.hover1.toString()),
|
|
1383
|
+
style.setProperty("--atomix-glass-hover-2-opacity", opacityValues.hover2.toString()),
|
|
1384
|
+
style.setProperty("--atomix-glass-hover-3-opacity", opacityValues.hover3.toString()),
|
|
1385
|
+
style.setProperty("--atomix-glass-base-opacity", opacityValues.base.toString()),
|
|
1386
|
+
style.setProperty("--atomix-glass-overlay-opacity", opacityValues.over.toString()),
|
|
1387
|
+
style.setProperty("--atomix-glass-overlay-highlight-opacity", (opacityValues.over * ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.OPACITY_MULTIPLIER).toString()),
|
|
1388
|
+
// Other
|
|
1389
|
+
style.setProperty("--atomix-glass-blend-mode", isOverLight ? "multiply" : "overlay"),
|
|
1390
|
+
style.setProperty("--atomix-glass-radius", `${effectiveBorderRadius}px`);
|
|
1391
|
+
}
|
|
1392
|
+
// Update Container Styles (containerVars)
|
|
1393
|
+
if (containerElement) {
|
|
1394
|
+
const mx = mouseOffset.x, my = mouseOffset.y, EDGE_BLUR_MULTIPLIER = 1.25, CENTER_BLUR_MULTIPLIER = 1.1, FLOW_BLUR_MULTIPLIER = 1.2, MOUSE_INFLUENCE_BLUR_FACTOR = .15, EDGE_INTENSITY_MOUSE_FACTOR = .15, CENTER_INTENSITY_MOUSE_FACTOR = .1, MAX_BLUR_RELATIVE = 2, rect = containerElement.getBoundingClientRect();
|
|
1395
|
+
let liquidBlur = {
|
|
1396
|
+
baseBlur: blurAmount,
|
|
1397
|
+
edgeBlur: blurAmount * EDGE_BLUR_MULTIPLIER,
|
|
1398
|
+
centerBlur: blurAmount * CENTER_BLUR_MULTIPLIER,
|
|
1399
|
+
flowBlur: blurAmount * FLOW_BLUR_MULTIPLIER
|
|
1400
|
+
};
|
|
1401
|
+
if (withLiquidBlur && rect) {
|
|
1402
|
+
const mouseInfluence = calculateMouseInfluence(mouseOffset), maxBlur = blurAmount * MAX_BLUR_RELATIVE, baseBlur = Math.min(maxBlur, blurAmount + mouseInfluence * blurAmount * MOUSE_INFLUENCE_BLUR_FACTOR), edgeIntensity = mouseInfluence * EDGE_INTENSITY_MOUSE_FACTOR, edgeBlur = Math.min(maxBlur, baseBlur * (.8 + .4 * edgeIntensity)), centerIntensity = mouseInfluence * CENTER_INTENSITY_MOUSE_FACTOR, centerBlur = Math.min(maxBlur, baseBlur * (.3 + .3 * centerIntensity)), flowBlur = Math.min(maxBlur, baseBlur * FLOW_BLUR_MULTIPLIER);
|
|
1403
|
+
liquidBlur = {
|
|
1404
|
+
baseBlur: clampBlur(baseBlur),
|
|
1405
|
+
edgeBlur: clampBlur(edgeBlur),
|
|
1406
|
+
centerBlur: clampBlur(centerBlur),
|
|
1407
|
+
flowBlur: clampBlur(flowBlur)
|
|
1408
|
+
};
|
|
1409
|
+
}
|
|
1410
|
+
// Backdrop filter
|
|
1411
|
+
let backdropFilterString = `blur(${blurAmount}px) saturate(${saturation}%) contrast(1.05) brightness(1.05)`;
|
|
1412
|
+
const dynamicSaturation = saturation + 20 * (liquidBlur.baseBlur || 0), area = rect ? rect.width * rect.height : 0;
|
|
1413
|
+
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})`;
|
|
1414
|
+
// Container variables
|
|
1415
|
+
const style = containerElement.style;
|
|
1416
|
+
style.setProperty("--atomix-glass-container-width", `${glassSize.width}`), style.setProperty("--atomix-glass-container-height", `${glassSize.height}`),
|
|
1417
|
+
style.setProperty("--atomix-glass-container-padding", padding), style.setProperty("--atomix-glass-container-radius", `${effectiveBorderRadius}px`),
|
|
1418
|
+
style.setProperty("--atomix-glass-container-backdrop", backdropFilterString),
|
|
1419
|
+
// Shadows
|
|
1420
|
+
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"),
|
|
1421
|
+
style.setProperty("--atomix-glass-container-shadow-opacity", effectiveWithoutEffects ? "0" : "1"),
|
|
1422
|
+
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"),
|
|
1423
|
+
style.setProperty("--atomix-glass-container-text-shadow", isOverLight ? "0px 2px 12px rgba(0, 0, 0, 0)" : "0px 2px 12px rgba(0, 0, 0, 0.4)"),
|
|
1424
|
+
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)");
|
|
1425
|
+
}
|
|
1426
|
+
}, {CONSTANTS: CONSTANTS$1} = ATOMIX_GLASS;
|
|
1427
|
+
|
|
1428
|
+
/**
|
|
1429
|
+
* Updates the styles of the AtomixGlass wrapper and container elements imperatively
|
|
1430
|
+
* to avoid React re-renders on mouse movement.
|
|
1431
|
+
*/ const {CONSTANTS: CONSTANTS} = ATOMIX_GLASS, backgroundDetectionCache = new WeakMap, setCachedBackgroundDetection = (parentElement, overLightConfig, result, threshold) => {
|
|
942
1432
|
parentElement && backgroundDetectionCache.set(parentElement, {
|
|
943
1433
|
result: result,
|
|
944
1434
|
timestamp: Date.now(),
|
|
@@ -951,18 +1441,74 @@ class {
|
|
|
951
1441
|
* Composable hook for AtomixGlass component logic
|
|
952
1442
|
* Manages all state, calculations, and event handlers
|
|
953
1443
|
*/
|
|
954
|
-
function useAtomixGlass({glassRef: glassRef, contentRef: contentRef,
|
|
1444
|
+
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, debugPerformance: debugPerformance = !1, children: children, blurAmount: blurAmount, saturation: saturation, padding: padding, withLiquidBlur: withLiquidBlur}) {
|
|
955
1445
|
// State
|
|
956
|
-
const [isHovered, setIsHovered] = useState(!1), [isActive, setIsActive] = useState(!1),
|
|
957
|
-
width: 270,
|
|
958
|
-
height: 69
|
|
959
|
-
}), [internalGlobalMousePosition, setInternalGlobalMousePosition] = useState({
|
|
1446
|
+
const [isHovered, setIsHovered] = useState(!1), [isActive, setIsActive] = useState(!1), cachedRectRef = useRef(null), internalGlobalMousePositionRef = useRef({
|
|
960
1447
|
x: 0,
|
|
961
1448
|
y: 0
|
|
962
|
-
}),
|
|
1449
|
+
}), internalMouseOffsetRef = useRef({
|
|
963
1450
|
x: 0,
|
|
964
1451
|
y: 0
|
|
965
|
-
}), [
|
|
1452
|
+
}), [dynamicBorderRadius, setDynamicCornerRadius] = useState(CONSTANTS.DEFAULT_CORNER_RADIUS), [userPrefersReducedMotion, setUserPrefersReducedMotion] = useState(!1), [userPrefersHighContrast, setUserPrefersHighContrast] = useState(!1), [detectedOverLight, setDetectedOverLight] = useState(!1), effectiveBorderRadius = useMemo((() => void 0 !== borderRadius ? Math.max(0, borderRadius) : Math.max(0, dynamicBorderRadius)), [ borderRadius, dynamicBorderRadius ]), {glassSize: glassSize} = function({glassRef: glassRef, effectiveBorderRadius: effectiveBorderRadius, cachedRectRef: cachedRectRef}) {
|
|
1453
|
+
const [glassSize, setGlassSize] = useState({
|
|
1454
|
+
width: 270,
|
|
1455
|
+
height: 69
|
|
1456
|
+
});
|
|
1457
|
+
return useEffect((() => {
|
|
1458
|
+
const isValidElement = element => null !== element && element instanceof HTMLElement && element.isConnected;
|
|
1459
|
+
let rafId = null, lastSize = {
|
|
1460
|
+
width: 0,
|
|
1461
|
+
height: 0
|
|
1462
|
+
}, lastCornerRadius = effectiveBorderRadius;
|
|
1463
|
+
const updateGlassSize = (forceUpdate = !1) => {
|
|
1464
|
+
null !== rafId && cancelAnimationFrame(rafId), rafId = requestAnimationFrame((() => {
|
|
1465
|
+
if (!isValidElement(glassRef.current)) return void (rafId = null);
|
|
1466
|
+
const rect = glassRef.current.getBoundingClientRect();
|
|
1467
|
+
if (rect.width <= 0 || rect.height <= 0) return void (rafId = null);
|
|
1468
|
+
// Measure actual rendered size without artificial offsets to avoid feedback loops
|
|
1469
|
+
const newSize = {
|
|
1470
|
+
width: Math.round(rect.width),
|
|
1471
|
+
height: Math.round(rect.height)
|
|
1472
|
+
}, cornerRadiusChanged = lastCornerRadius !== effectiveBorderRadius, dimensionsChanged = Math.abs(newSize.width - lastSize.width) > 1 || Math.abs(newSize.height - lastSize.height) > 1;
|
|
1473
|
+
var size;
|
|
1474
|
+
(forceUpdate || cornerRadiusChanged || dimensionsChanged) && validateGlassSize(size = newSize) && size.width <= CONSTANTS$1.MAX_SIZE && size.height <= CONSTANTS$1.MAX_SIZE && (lastSize = newSize,
|
|
1475
|
+
lastCornerRadius = effectiveBorderRadius, setGlassSize(newSize)), rafId = null;
|
|
1476
|
+
}));
|
|
1477
|
+
};
|
|
1478
|
+
let resizeTimeoutId = null;
|
|
1479
|
+
const debouncedResizeHandler = () => {
|
|
1480
|
+
resizeTimeoutId && clearTimeout(resizeTimeoutId), resizeTimeoutId = setTimeout((() => updateGlassSize(!1)), 16);
|
|
1481
|
+
}, initialTimeoutId = setTimeout((() => updateGlassSize(!0)), 0);
|
|
1482
|
+
let resizeObserver = null, resizeDebounceTimeout = null;
|
|
1483
|
+
// ResizeObserver has 98%+ browser support, no need for fallback
|
|
1484
|
+
if ("undefined" != typeof ResizeObserver && isValidElement(glassRef.current)) try {
|
|
1485
|
+
resizeObserver = new ResizeObserver((entries => {
|
|
1486
|
+
for (const entry of entries) if (entry.target === glassRef.current) {
|
|
1487
|
+
// Update cached rect when size changes
|
|
1488
|
+
glassRef.current && cachedRectRef && (cachedRectRef.current = glassRef.current.getBoundingClientRect()),
|
|
1489
|
+
// Debounce resize updates to match RAF timing (16ms)
|
|
1490
|
+
resizeDebounceTimeout && clearTimeout(resizeDebounceTimeout), resizeDebounceTimeout = setTimeout((() => updateGlassSize(!1)), 16);
|
|
1491
|
+
break;
|
|
1492
|
+
}
|
|
1493
|
+
})), resizeObserver.observe(glassRef.current);
|
|
1494
|
+
} catch (error) {
|
|
1495
|
+
console.warn("AtomixGlass: ResizeObserver not available, using window resize only", error);
|
|
1496
|
+
}
|
|
1497
|
+
return window.addEventListener("resize", debouncedResizeHandler, {
|
|
1498
|
+
passive: !0
|
|
1499
|
+
}), () => {
|
|
1500
|
+
clearTimeout(initialTimeoutId), null !== rafId && cancelAnimationFrame(rafId), resizeTimeoutId && clearTimeout(resizeTimeoutId),
|
|
1501
|
+
resizeDebounceTimeout && clearTimeout(resizeDebounceTimeout), window.removeEventListener("resize", debouncedResizeHandler),
|
|
1502
|
+
resizeObserver?.disconnect();
|
|
1503
|
+
};
|
|
1504
|
+
}), [ effectiveBorderRadius, glassRef, cachedRectRef ]), {
|
|
1505
|
+
glassSize: glassSize
|
|
1506
|
+
};
|
|
1507
|
+
}({
|
|
1508
|
+
glassRef: glassRef,
|
|
1509
|
+
effectiveBorderRadius: effectiveBorderRadius,
|
|
1510
|
+
cachedRectRef: cachedRectRef
|
|
1511
|
+
}), effectiveReducedMotion = useMemo((() => reducedMotion || userPrefersReducedMotion), [ reducedMotion, userPrefersReducedMotion ]), effectiveHighContrast = useMemo((() => highContrast || userPrefersHighContrast), [ highContrast, userPrefersHighContrast ]), effectiveWithoutEffects = useMemo((() => withoutEffects || effectiveReducedMotion), [ withoutEffects, effectiveReducedMotion ]), globalMousePosition = externalGlobalMousePosition || internalGlobalMousePositionRef.current, mouseOffset = externalMouseOffset || internalMouseOffsetRef.current;
|
|
966
1512
|
// Extract border-radius from children
|
|
967
1513
|
useEffect((() => {
|
|
968
1514
|
const extractRadius = () => {
|
|
@@ -993,13 +1539,13 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
993
1539
|
}
|
|
994
1540
|
null !== extractedRadius && extractedRadius > 0 && setDynamicCornerRadius(extractedRadius);
|
|
995
1541
|
} catch (error) {
|
|
996
|
-
"undefined" != typeof process && "production" === process.env?.NODE_ENV || !
|
|
1542
|
+
"undefined" != typeof process && "production" === process.env?.NODE_ENV || !debugBorderRadius || console.error("[AtomixGlass] Error extracting corner radius:", error);
|
|
997
1543
|
}
|
|
998
1544
|
};
|
|
999
1545
|
extractRadius();
|
|
1000
1546
|
const timeoutId = setTimeout(extractRadius, 100);
|
|
1001
1547
|
return () => clearTimeout(timeoutId);
|
|
1002
|
-
}), [ children,
|
|
1548
|
+
}), [ children, debugBorderRadius, contentRef ]),
|
|
1003
1549
|
// Media query handlers and background detection
|
|
1004
1550
|
useEffect((() => {
|
|
1005
1551
|
if (("auto" === overLight || "object" == typeof overLight && null !== overLight) && glassRef.current) {
|
|
@@ -1055,72 +1601,52 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
1055
1601
|
const rgb = bgColor.match(/\d+/g);
|
|
1056
1602
|
if (rgb && rgb.length >= 3) {
|
|
1057
1603
|
const r = Number(rgb[0]), g = Number(rgb[1]), b = Number(rgb[2]);
|
|
1058
|
-
|
|
1059
|
-
if (!isNaN(r) && !isNaN(g) && !isNaN(b) && isFinite(r) && isFinite(g) && isFinite(b) && r >= 0 && r <= 255 && g >= 0 && g <= 255 && b >= 0 && b <= 255 && (r > 10 || g > 10 || b > 10)) {
|
|
1604
|
+
if (!isNaN(r) && !isNaN(g) && !isNaN(b) && (r > 10 || g > 10 || b > 10)) {
|
|
1060
1605
|
const luminance = (.299 * r + .587 * g + .114 * b) / 255;
|
|
1061
1606
|
!isNaN(luminance) && isFinite(luminance) && (totalLuminance += luminance, validSamples++,
|
|
1062
1607
|
hasValidBackground = !0);
|
|
1063
1608
|
}
|
|
1064
1609
|
}
|
|
1065
1610
|
}
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
// For image backgrounds, assume medium luminance
|
|
1069
|
-
totalLuminance += .5, validSamples++, hasValidBackground = !0);
|
|
1611
|
+
bgImage && "none" !== bgImage && "initial" !== bgImage && (totalLuminance += .5,
|
|
1612
|
+
validSamples++, hasValidBackground = !0);
|
|
1070
1613
|
} catch (styleError) {
|
|
1071
|
-
|
|
1614
|
+
// Silently continue
|
|
1072
1615
|
}
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
// Exit loop if currentElement becomes null
|
|
1076
|
-
currentElement = currentElement.parentElement, depth++;
|
|
1616
|
+
if (!currentElement) break;
|
|
1617
|
+
currentElement = currentElement.parentElement, depth++;
|
|
1077
1618
|
}
|
|
1078
|
-
|
|
1079
|
-
if (hasValidBackground && validSamples > 0) {
|
|
1619
|
+
if (hasValidBackground && validSamples > 0) {
|
|
1080
1620
|
const avgLuminance = totalLuminance / validSamples;
|
|
1081
1621
|
if (!isNaN(avgLuminance) && isFinite(avgLuminance)) {
|
|
1082
1622
|
let threshold = .7;
|
|
1083
|
-
|
|
1084
|
-
// If overLight is an object, use its threshold property with validation
|
|
1085
|
-
if ("object" == typeof overLight && null !== overLight) {
|
|
1623
|
+
if ("object" == typeof overLight && null !== overLight) {
|
|
1086
1624
|
const objConfig = overLight;
|
|
1087
1625
|
if (void 0 !== objConfig.threshold) {
|
|
1088
|
-
const configThreshold = "number"
|
|
1626
|
+
const configThreshold = "number" != typeof objConfig.threshold || isNaN(objConfig.threshold) ? .7 : objConfig.threshold;
|
|
1089
1627
|
threshold = Math.min(.9, Math.max(.1, configThreshold));
|
|
1090
1628
|
}
|
|
1091
1629
|
}
|
|
1092
1630
|
const isOverLightDetected = avgLuminance > threshold;
|
|
1093
|
-
|
|
1094
|
-
setCachedBackgroundDetection(element.parentElement, overLight, isOverLightDetected, threshold),
|
|
1631
|
+
setCachedBackgroundDetection(element.parentElement, overLight, isOverLightDetected, threshold),
|
|
1095
1632
|
setDetectedOverLight(isOverLightDetected);
|
|
1096
1633
|
} else {
|
|
1097
|
-
// Invalid luminance calculation, default to false
|
|
1098
1634
|
const result = !1, threshold = "object" == typeof overLight && null !== overLight && overLight.threshold || .7;
|
|
1099
1635
|
setCachedBackgroundDetection(element.parentElement, overLight, result, threshold),
|
|
1100
1636
|
setDetectedOverLight(result);
|
|
1101
1637
|
}
|
|
1102
1638
|
} else {
|
|
1103
|
-
// Default to false if no valid background found
|
|
1104
1639
|
const result = !1, threshold = "object" == typeof overLight && null !== overLight && overLight.threshold || .7;
|
|
1105
1640
|
setCachedBackgroundDetection(element.parentElement, overLight, result, threshold),
|
|
1106
1641
|
setDetectedOverLight(result);
|
|
1107
1642
|
}
|
|
1108
1643
|
} catch (error) {
|
|
1109
|
-
|
|
1110
|
-
"undefined" != typeof process && "development" !== process.env?.NODE_ENV || console.warn("AtomixGlass: Error detecting background brightness:", error);
|
|
1111
|
-
const result = !1;
|
|
1112
|
-
if (element && element.parentElement) {
|
|
1113
|
-
const threshold = "object" == typeof overLight && null !== overLight && overLight.threshold || .7;
|
|
1114
|
-
setCachedBackgroundDetection(element.parentElement, overLight, result, threshold);
|
|
1115
|
-
}
|
|
1116
|
-
setDetectedOverLight(result);
|
|
1644
|
+
setDetectedOverLight(!1);
|
|
1117
1645
|
}
|
|
1118
1646
|
}), 150);
|
|
1119
1647
|
return () => clearTimeout(timeoutId);
|
|
1120
1648
|
}
|
|
1121
|
-
if ("boolean" == typeof overLight &&
|
|
1122
|
-
// For boolean values, disable auto-detection
|
|
1123
|
-
setDetectedOverLight(!1), "function" == typeof window.matchMedia) try {
|
|
1649
|
+
if ("boolean" == typeof overLight && setDetectedOverLight(!1), "function" == typeof window.matchMedia) try {
|
|
1124
1650
|
const mediaQueryReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)"), mediaQueryHighContrast = window.matchMedia("(prefers-contrast: high)");
|
|
1125
1651
|
setUserPrefersReducedMotion(mediaQueryReducedMotion.matches), setUserPrefersHighContrast(mediaQueryHighContrast.matches);
|
|
1126
1652
|
const handleReducedMotionChange = e => {
|
|
@@ -1131,65 +1657,54 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
1131
1657
|
return mediaQueryReducedMotion.addEventListener ? (mediaQueryReducedMotion.addEventListener("change", handleReducedMotionChange),
|
|
1132
1658
|
mediaQueryHighContrast.addEventListener("change", handleHighContrastChange)) : mediaQueryReducedMotion.addListener && (mediaQueryReducedMotion.addListener(handleReducedMotionChange),
|
|
1133
1659
|
mediaQueryHighContrast.addListener(handleHighContrastChange)), () => {
|
|
1134
|
-
|
|
1135
|
-
mediaQueryReducedMotion.removeEventListener ? (mediaQueryReducedMotion.removeEventListener("change", handleReducedMotionChange),
|
|
1136
|
-
mediaQueryHighContrast.removeEventListener("change", handleHighContrastChange)) : mediaQueryReducedMotion.removeListener && (mediaQueryReducedMotion.removeListener(handleReducedMotionChange),
|
|
1137
|
-
mediaQueryHighContrast.removeListener(handleHighContrastChange));
|
|
1138
|
-
} catch (cleanupError) {
|
|
1139
|
-
console.error("AtomixGlass: Error cleaning up media query listeners:", cleanupError);
|
|
1140
|
-
}
|
|
1660
|
+
// ignore
|
|
1141
1661
|
};
|
|
1142
1662
|
} catch (error) {
|
|
1143
|
-
return
|
|
1663
|
+
return;
|
|
1144
1664
|
}
|
|
1145
1665
|
}), [ overLight, glassRef, debugOverLight ]);
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
x: (globalPos.x - center.x) / rect.width * 100,
|
|
1162
|
-
y: (globalPos.y - center.y) / rect.height * 100
|
|
1666
|
+
/**
|
|
1667
|
+
* Get effective overLight value based on configuration
|
|
1668
|
+
*/
|
|
1669
|
+
const getEffectiveOverLight = useCallback((() => "boolean" == typeof overLight ? overLight : ("auto" === overLight || "object" == typeof overLight && null !== overLight) && detectedOverLight), [ overLight, detectedOverLight ]), validateConfigValue = useCallback(((value, min, max, defaultValue) => "number" != typeof value || isNaN(value) || !isFinite(value) ? defaultValue : Math.min(max, Math.max(min, value))), []), baseOverLightConfig = useMemo((() => {
|
|
1670
|
+
const isOverLight = getEffectiveOverLight(), baseConfig = {
|
|
1671
|
+
isOverLight: isOverLight,
|
|
1672
|
+
threshold: .7,
|
|
1673
|
+
opacity: isOverLight ? Math.min(.6, Math.max(.2, .5)) : 0,
|
|
1674
|
+
contrast: 1,
|
|
1675
|
+
// Base contrast
|
|
1676
|
+
brightness: 1,
|
|
1677
|
+
// Base brightness
|
|
1678
|
+
saturationBoost: 1.3,
|
|
1679
|
+
shadowIntensity: .9,
|
|
1680
|
+
borderOpacity: .7
|
|
1163
1681
|
};
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
return;
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
updateRectRef.current = null), resizeObserver && resizeObserver.disconnect();
|
|
1682
|
+
if ("object" == typeof overLight && null !== overLight) {
|
|
1683
|
+
const objConfig = overLight, validatedThreshold = validateConfigValue(objConfig.threshold, .1, 1, baseConfig.threshold), validatedOpacity = validateConfigValue(objConfig.opacity, .1, 1, baseConfig.opacity), validatedContrast = validateConfigValue(objConfig.contrast, .5, 2.5, baseConfig.contrast), validatedBrightness = validateConfigValue(objConfig.brightness, .5, 2, baseConfig.brightness), validatedSaturationBoost = validateConfigValue(objConfig.saturationBoost, .5, 3, baseConfig.saturationBoost);
|
|
1684
|
+
return {
|
|
1685
|
+
...baseConfig,
|
|
1686
|
+
threshold: validatedThreshold,
|
|
1687
|
+
opacity: validatedOpacity,
|
|
1688
|
+
contrast: validatedContrast,
|
|
1689
|
+
brightness: validatedBrightness,
|
|
1690
|
+
saturationBoost: validatedSaturationBoost
|
|
1691
|
+
};
|
|
1692
|
+
}
|
|
1693
|
+
return baseConfig;
|
|
1694
|
+
}), [ overLight, getEffectiveOverLight, validateConfigValue ]), overLightConfig = useMemo((() => {
|
|
1695
|
+
const mouseInfluence = calculateMouseInfluence(mouseOffset), hoverIntensity = isHovered ? 1.4 : 1, activeIntensity = isActive ? 1.6 : 1;
|
|
1696
|
+
return {
|
|
1697
|
+
isOverLight: baseOverLightConfig.isOverLight,
|
|
1698
|
+
threshold: baseOverLightConfig.threshold,
|
|
1699
|
+
opacity: baseOverLightConfig.opacity * hoverIntensity * activeIntensity,
|
|
1700
|
+
contrast: Math.min(1.6, baseOverLightConfig.contrast + .1 * mouseInfluence),
|
|
1701
|
+
brightness: Math.min(1.1, baseOverLightConfig.brightness + .05 * mouseInfluence),
|
|
1702
|
+
saturationBoost: baseOverLightConfig.saturationBoost,
|
|
1703
|
+
shadowIntensity: Math.min(1.2, Math.max(.5, baseOverLightConfig.shadowIntensity + .2 * mouseInfluence)),
|
|
1704
|
+
borderOpacity: Math.min(1, Math.max(.3, baseOverLightConfig.borderOpacity + .1 * mouseInfluence))
|
|
1188
1705
|
};
|
|
1189
|
-
}), [
|
|
1190
|
-
|
|
1191
|
-
const calculateDirectionalScale = useCallback((() => {
|
|
1192
|
-
if (!0 === overLight || "auto" === overLight && detectedOverLight || "object" == typeof overLight && null !== overLight && detectedOverLight) return "scale(1)";
|
|
1706
|
+
}), [ baseOverLightConfig, mouseOffset, isHovered, isActive ]), updateRectRef = useRef(null), calculateDirectionalScale = useCallback((() => {
|
|
1707
|
+
if (baseOverLightConfig.isOverLight) return "scale(1)";
|
|
1193
1708
|
if (!(globalMousePosition.x && globalMousePosition.y && glassRef.current && validateGlassSize(glassSize))) return "scale(1)";
|
|
1194
1709
|
const rect = glassRef.current.getBoundingClientRect(), center = calculateElementCenter(rect), deltaX = globalMousePosition.x - center.x, deltaY = globalMousePosition.y - center.y, edgeDistanceX = Math.max(0, Math.abs(deltaX) - glassSize.width / 2), edgeDistanceY = Math.max(0, Math.abs(deltaY) - glassSize.height / 2), edgeDistance = calculateDistance({
|
|
1195
1710
|
x: edgeDistanceX,
|
|
@@ -1203,7 +1718,7 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
1203
1718
|
if (0 === centerDistance) return "scale(1)";
|
|
1204
1719
|
const normalizedX = deltaX / centerDistance, normalizedY = deltaY / centerDistance, stretchIntensity = Math.min(centerDistance / 300, 1) * elasticity * fadeInFactor, scaleX = 1 + Math.abs(normalizedX) * stretchIntensity * .3 - Math.abs(normalizedY) * stretchIntensity * .15, scaleY = 1 + Math.abs(normalizedY) * stretchIntensity * .3 - Math.abs(normalizedX) * stretchIntensity * .15;
|
|
1205
1720
|
return `scaleX(${Math.max(.8, scaleX)}) scaleY(${Math.max(.8, scaleY)})`;
|
|
1206
|
-
}), [ globalMousePosition, elasticity, glassSize, glassRef,
|
|
1721
|
+
}), [ globalMousePosition, elasticity, glassSize, glassRef, baseOverLightConfig ]), calculateFadeInFactor = useCallback((() => {
|
|
1207
1722
|
if (!(globalMousePosition.x && globalMousePosition.y && glassRef.current && validateGlassSize(glassSize))) return 0;
|
|
1208
1723
|
const rect = glassRef.current.getBoundingClientRect(), center = calculateElementCenter(rect), edgeDistanceX = Math.max(0, Math.abs(globalMousePosition.x - center.x) - glassSize.width / 2), edgeDistanceY = Math.max(0, Math.abs(globalMousePosition.y - center.y) - glassSize.height / 2), edgeDistance = calculateDistance({
|
|
1209
1724
|
x: edgeDistanceX,
|
|
@@ -1223,122 +1738,110 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
1223
1738
|
x: (globalMousePosition.x - center.x) * elasticity * .1 * fadeInFactor,
|
|
1224
1739
|
y: (globalMousePosition.y - center.y) * elasticity * .1 * fadeInFactor
|
|
1225
1740
|
};
|
|
1226
|
-
}), [ globalMousePosition, elasticity, calculateFadeInFactor, glassRef ]), elasticTranslation = useMemo((() =>
|
|
1741
|
+
}), [ globalMousePosition, elasticity, calculateFadeInFactor, glassRef ]), elasticTranslation = useMemo((() => effectiveWithoutEffects ? {
|
|
1227
1742
|
x: 0,
|
|
1228
1743
|
y: 0
|
|
1229
|
-
} : calculateElasticTranslation()), [ calculateElasticTranslation,
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
const
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
if (rect.width <= 0 || rect.height <= 0) return void (rafId = null);
|
|
1242
|
-
// Measure actual rendered size without artificial offsets to avoid feedback loops
|
|
1243
|
-
const newSize = {
|
|
1244
|
-
width: Math.round(rect.width),
|
|
1245
|
-
height: Math.round(rect.height)
|
|
1246
|
-
}, cornerRadiusChanged = lastCornerRadius !== effectiveCornerRadius, dimensionsChanged = Math.abs(newSize.width - lastSize.width) > 1 || Math.abs(newSize.height - lastSize.height) > 1;
|
|
1247
|
-
var size;
|
|
1248
|
-
(forceUpdate || cornerRadiusChanged || dimensionsChanged) && validateGlassSize(size = newSize) && size.width <= CONSTANTS.MAX_SIZE && size.height <= CONSTANTS.MAX_SIZE && (lastSize = newSize,
|
|
1249
|
-
lastCornerRadius = effectiveCornerRadius, setGlassSize(newSize)), rafId = null;
|
|
1250
|
-
}));
|
|
1251
|
-
};
|
|
1252
|
-
let resizeTimeoutId = null;
|
|
1253
|
-
const debouncedResizeHandler = () => {
|
|
1254
|
-
resizeTimeoutId && clearTimeout(resizeTimeoutId), resizeTimeoutId = setTimeout((() => updateGlassSize(!1)), 16);
|
|
1255
|
-
}, initialTimeoutId = setTimeout((() => updateGlassSize(!0)), 0);
|
|
1256
|
-
let resizeObserver = null, resizeDebounceTimeout = null;
|
|
1257
|
-
// ResizeObserver has 98%+ browser support, no need for fallback
|
|
1258
|
-
if ("undefined" != typeof ResizeObserver && isValidElement(glassRef.current)) try {
|
|
1259
|
-
resizeObserver = new ResizeObserver((entries => {
|
|
1260
|
-
for (const entry of entries) if (entry.target === glassRef.current) {
|
|
1261
|
-
// Update cached rect when size changes
|
|
1262
|
-
glassRef.current && (cachedRectRef.current = glassRef.current.getBoundingClientRect()),
|
|
1263
|
-
// Debounce resize updates to match RAF timing (16ms)
|
|
1264
|
-
resizeDebounceTimeout && clearTimeout(resizeDebounceTimeout), resizeDebounceTimeout = setTimeout((() => updateGlassSize(!1)), 16);
|
|
1265
|
-
break;
|
|
1266
|
-
}
|
|
1267
|
-
})), resizeObserver.observe(glassRef.current);
|
|
1268
|
-
} catch (error) {
|
|
1269
|
-
console.warn("AtomixGlass: ResizeObserver not available, using window resize only", error);
|
|
1270
|
-
}
|
|
1271
|
-
return window.addEventListener("resize", debouncedResizeHandler, {
|
|
1272
|
-
passive: !0
|
|
1273
|
-
}), () => {
|
|
1274
|
-
clearTimeout(initialTimeoutId), null !== rafId && cancelAnimationFrame(rafId), resizeTimeoutId && clearTimeout(resizeTimeoutId),
|
|
1275
|
-
resizeDebounceTimeout && clearTimeout(resizeDebounceTimeout), window.removeEventListener("resize", debouncedResizeHandler),
|
|
1276
|
-
resizeObserver?.disconnect();
|
|
1277
|
-
};
|
|
1278
|
-
}), [ effectiveCornerRadius, glassRef ]);
|
|
1279
|
-
// OverLight config
|
|
1280
|
-
/**
|
|
1281
|
-
* Get effective overLight value based on configuration
|
|
1282
|
-
* - boolean: returns the boolean value directly
|
|
1283
|
-
* - 'auto': returns detectedOverLight (auto-detected from background)
|
|
1284
|
-
* - object: returns detectedOverLight (auto-detected, but config object provides customization)
|
|
1285
|
-
*/
|
|
1286
|
-
const getEffectiveOverLight = useCallback((() => "boolean" == typeof overLight ? overLight : ("auto" === overLight || "object" == typeof overLight && null !== overLight) && detectedOverLight), [ overLight, detectedOverLight ]), validateConfigValue = useCallback(((value, min, max, defaultValue) => "number" != typeof value || isNaN(value) || !isFinite(value) ? defaultValue : Math.min(max, Math.max(min, value))), []), overLightConfig = useMemo((() => {
|
|
1287
|
-
const isOverLight = getEffectiveOverLight(), mouseInfluence = calculateMouseInfluence(mouseOffset), hoverIntensity = isHovered ? 1.4 : 1, activeIntensity = isActive ? 1.6 : 1, baseConfig = {
|
|
1288
|
-
isOverLight: isOverLight,
|
|
1289
|
-
threshold: .7,
|
|
1290
|
-
opacity: isOverLight ? Math.min(.6, Math.max(.2, .5 * hoverIntensity * activeIntensity)) : 0,
|
|
1291
|
-
contrast: Math.min(1.6, Math.max(1, 1.4 + .1 * mouseInfluence)),
|
|
1292
|
-
brightness: Math.min(1.1, Math.max(.8, .9 + .05 * mouseInfluence)),
|
|
1293
|
-
saturationBoost: 1.3,
|
|
1294
|
-
// Fixed value — dynamic saturation amplifies perceived displacement
|
|
1295
|
-
shadowIntensity: Math.min(1.2, Math.max(.5, .9 + .2 * mouseInfluence)),
|
|
1296
|
-
borderOpacity: Math.min(1, Math.max(.3, .7 + .1 * mouseInfluence))
|
|
1744
|
+
} : calculateElasticTranslation()), [ calculateElasticTranslation, effectiveWithoutEffects ]), directionalScale = useMemo((() => effectiveWithoutEffects ? "scale(1)" : calculateDirectionalScale()), [ calculateDirectionalScale, effectiveWithoutEffects ]), transformStyle = useMemo((() => effectiveWithoutEffects ? isActive && Boolean(onClick) ? "scale(0.98)" : "scale(1)" : `translate(${elasticTranslation.x}px, ${elasticTranslation.y}px) ${isActive && Boolean(onClick) ? "scale(0.96)" : directionalScale}`), [ elasticTranslation, isActive, onClick, directionalScale, effectiveWithoutEffects ]), handleGlobalMousePosition = useCallback((globalPos => {
|
|
1745
|
+
if (externalGlobalMousePosition && externalMouseOffset) return;
|
|
1746
|
+
if (effectiveWithoutEffects) return;
|
|
1747
|
+
const container = mouseContainer?.current || glassRef.current;
|
|
1748
|
+
if (!container) return;
|
|
1749
|
+
// Use cached rect if available, otherwise get new one
|
|
1750
|
+
let rect = cachedRectRef.current;
|
|
1751
|
+
if (rect && 0 !== rect.width && 0 !== rect.height || (rect = container.getBoundingClientRect(),
|
|
1752
|
+
cachedRectRef.current = rect), 0 === rect.width || 0 === rect.height) return;
|
|
1753
|
+
const center = calculateElementCenter(rect), newOffset = {
|
|
1754
|
+
x: (globalPos.x - center.x) / rect.width * 100,
|
|
1755
|
+
y: (globalPos.y - center.y) / rect.height * 100
|
|
1297
1756
|
};
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1757
|
+
// Calculate offset relative to this container
|
|
1758
|
+
// Store in refs instead of state
|
|
1759
|
+
internalMouseOffsetRef.current = newOffset, internalGlobalMousePositionRef.current = globalPos,
|
|
1760
|
+
// Imperative style update
|
|
1761
|
+
updateAtomixGlassStyles(wrapperRef?.current || null, glassRef.current, {
|
|
1762
|
+
mouseOffset: newOffset,
|
|
1763
|
+
globalMousePosition: globalPos,
|
|
1764
|
+
glassSize: glassSize,
|
|
1765
|
+
isHovered: isHovered,
|
|
1766
|
+
isActive: isActive,
|
|
1767
|
+
isOverLight: baseOverLightConfig.isOverLight,
|
|
1768
|
+
baseOverLightConfig: baseOverLightConfig,
|
|
1769
|
+
effectiveBorderRadius: effectiveBorderRadius,
|
|
1770
|
+
effectiveWithoutEffects: effectiveWithoutEffects,
|
|
1771
|
+
effectiveReducedMotion: effectiveReducedMotion,
|
|
1772
|
+
elasticity: elasticity,
|
|
1773
|
+
directionalScale: isActive && Boolean(onClick) ? "scale(0.96)" : "scale(1)",
|
|
1774
|
+
// Simplified directional scale for fast path
|
|
1775
|
+
onClick: onClick,
|
|
1776
|
+
withLiquidBlur: withLiquidBlur,
|
|
1777
|
+
blurAmount: blurAmount,
|
|
1778
|
+
saturation: saturation,
|
|
1779
|
+
padding: padding
|
|
1780
|
+
});
|
|
1781
|
+
}), [ mouseContainer, glassRef, wrapperRef, externalGlobalMousePosition, externalMouseOffset, effectiveWithoutEffects, glassSize, isHovered, isActive, baseOverLightConfig, effectiveBorderRadius, effectiveReducedMotion, elasticity, onClick, withLiquidBlur, blurAmount, saturation, padding ]);
|
|
1315
1782
|
/**
|
|
1316
1783
|
* Validate and clamp a numeric config value
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1784
|
+
*/
|
|
1785
|
+
// Subscribe to shared mouse tracker
|
|
1786
|
+
useEffect((() => {
|
|
1787
|
+
if (externalGlobalMousePosition && externalMouseOffset) return;
|
|
1788
|
+
if (effectiveWithoutEffects) return;
|
|
1789
|
+
const unsubscribe = globalMouseTracker.subscribe(handleGlobalMousePosition), container = mouseContainer?.current || glassRef.current;
|
|
1790
|
+
let resizeObserver = null;
|
|
1791
|
+
return container && "undefined" != typeof ResizeObserver && (resizeObserver = new ResizeObserver((() => {
|
|
1792
|
+
null !== updateRectRef.current && cancelAnimationFrame(updateRectRef.current), updateRectRef.current = requestAnimationFrame((() => {
|
|
1793
|
+
const container = mouseContainer?.current || glassRef.current;
|
|
1794
|
+
container && (cachedRectRef.current = container.getBoundingClientRect()), updateRectRef.current = null;
|
|
1795
|
+
}));
|
|
1796
|
+
})), resizeObserver.observe(container)), () => {
|
|
1797
|
+
unsubscribe(), null !== updateRectRef.current && (cancelAnimationFrame(updateRectRef.current),
|
|
1798
|
+
updateRectRef.current = null), resizeObserver && resizeObserver.disconnect();
|
|
1799
|
+
};
|
|
1800
|
+
}), [ handleGlobalMousePosition, mouseContainer, glassRef, externalGlobalMousePosition, externalMouseOffset, effectiveWithoutEffects ]),
|
|
1801
|
+
// Also call updateStyles on other state changes (hover, active, etc)
|
|
1802
|
+
useEffect((() => {
|
|
1803
|
+
updateAtomixGlassStyles(wrapperRef?.current || null, glassRef.current, {
|
|
1804
|
+
mouseOffset: externalMouseOffset || internalMouseOffsetRef.current,
|
|
1805
|
+
globalMousePosition: externalGlobalMousePosition || internalGlobalMousePositionRef.current,
|
|
1806
|
+
glassSize: glassSize,
|
|
1807
|
+
isHovered: isHovered,
|
|
1808
|
+
isActive: isActive,
|
|
1809
|
+
isOverLight: baseOverLightConfig.isOverLight,
|
|
1810
|
+
baseOverLightConfig: baseOverLightConfig,
|
|
1811
|
+
effectiveBorderRadius: effectiveBorderRadius,
|
|
1812
|
+
effectiveWithoutEffects: effectiveWithoutEffects,
|
|
1813
|
+
effectiveReducedMotion: effectiveReducedMotion,
|
|
1814
|
+
elasticity: elasticity,
|
|
1815
|
+
directionalScale: directionalScale,
|
|
1816
|
+
onClick: onClick,
|
|
1817
|
+
withLiquidBlur: withLiquidBlur,
|
|
1818
|
+
blurAmount: blurAmount,
|
|
1819
|
+
saturation: saturation,
|
|
1820
|
+
padding: padding
|
|
1821
|
+
});
|
|
1822
|
+
}), [ isHovered, isActive, glassSize, baseOverLightConfig, effectiveBorderRadius, effectiveWithoutEffects, effectiveReducedMotion, elasticity, directionalScale, wrapperRef, glassRef, externalMouseOffset, externalGlobalMousePosition, withLiquidBlur, blurAmount, saturation, padding, onClick ]);
|
|
1823
|
+
// Event handlers
|
|
1824
|
+
const handleMouseEnter = useCallback((() => setIsHovered(!0)), []), handleMouseLeave = useCallback((() => setIsHovered(!1)), []), handleMouseDown = useCallback((() => setIsActive(!0)), []), handleMouseUp = useCallback((() => setIsActive(!1)), []), handleMouseMove = useCallback((_e => {}), []), handleKeyDown = useCallback((e => {
|
|
1825
|
+
!onClick || "Enter" !== e.key && " " !== e.key || (e.preventDefault(), onClick());
|
|
1826
|
+
}), [ onClick ]);
|
|
1827
|
+
return {
|
|
1324
1828
|
isHovered: isHovered,
|
|
1325
1829
|
isActive: isActive,
|
|
1326
1830
|
glassSize: glassSize,
|
|
1327
|
-
|
|
1328
|
-
|
|
1831
|
+
dynamicBorderRadius: dynamicBorderRadius,
|
|
1832
|
+
effectiveBorderRadius: effectiveBorderRadius,
|
|
1329
1833
|
effectiveReducedMotion: effectiveReducedMotion,
|
|
1330
1834
|
effectiveHighContrast: effectiveHighContrast,
|
|
1331
|
-
|
|
1835
|
+
effectiveWithoutEffects: effectiveWithoutEffects,
|
|
1332
1836
|
detectedOverLight: detectedOverLight,
|
|
1333
1837
|
globalMousePosition: globalMousePosition,
|
|
1838
|
+
// This is now static (refs or props) unless prop changes
|
|
1334
1839
|
mouseOffset: mouseOffset,
|
|
1335
|
-
//
|
|
1840
|
+
// This is now static (refs or props) unless prop changes
|
|
1336
1841
|
overLightConfig: overLightConfig,
|
|
1337
|
-
// Transform calculations
|
|
1338
1842
|
elasticTranslation: elasticTranslation,
|
|
1339
1843
|
directionalScale: directionalScale,
|
|
1340
1844
|
transformStyle: transformStyle,
|
|
1341
|
-
// Event handlers
|
|
1342
1845
|
handleMouseEnter: handleMouseEnter,
|
|
1343
1846
|
handleMouseLeave: handleMouseLeave,
|
|
1344
1847
|
handleMouseDown: handleMouseDown,
|
|
@@ -1377,7 +1880,7 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
1377
1880
|
*
|
|
1378
1881
|
* @example
|
|
1379
1882
|
* // Manual border-radius override
|
|
1380
|
-
* <AtomixGlass
|
|
1883
|
+
* <AtomixGlass borderRadius={20}>
|
|
1381
1884
|
* <div>Content with 20px glass radius</div>
|
|
1382
1885
|
* </AtomixGlass>
|
|
1383
1886
|
*
|
|
@@ -1418,37 +1921,48 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
1418
1921
|
* <AtomixGlass overLight="auto" debugOverLight={true}>
|
|
1419
1922
|
* <div>Content with debug logging enabled</div>
|
|
1420
1923
|
* </AtomixGlass>
|
|
1421
|
-
*/ 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,
|
|
1422
|
-
const glassRef = useRef(null), contentRef = useRef(null), {isHovered: isHovered, isActive: isActive, glassSize: glassSize,
|
|
1924
|
+
*/ function AtomixGlass({children: children, displacementScale: displacementScale = ATOMIX_GLASS.DEFAULTS.DISPLACEMENT_SCALE, blurAmount: blurAmount = ATOMIX_GLASS.DEFAULTS.BLUR_AMOUNT, saturation: saturation = ATOMIX_GLASS.DEFAULTS.SATURATION, aberrationIntensity: aberrationIntensity = ATOMIX_GLASS.DEFAULTS.ABERRATION_INTENSITY, elasticity: elasticity = ATOMIX_GLASS.DEFAULTS.ELASTICITY, borderRadius: borderRadius, globalMousePosition: externalGlobalMousePosition, mouseOffset: externalMouseOffset, mouseContainer: mouseContainer = null, className: className = "", padding: padding = ATOMIX_GLASS.DEFAULTS.PADDING, overLight: overLight = ATOMIX_GLASS.DEFAULTS.OVER_LIGHT, style: style = {}, mode: mode = ATOMIX_GLASS.DEFAULTS.MODE, onClick: onClick, shaderVariant: shaderVariant = "liquidGlass", "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, role: role, tabIndex: tabIndex, reducedMotion: reducedMotion = !1, highContrast: highContrast = !1, withoutEffects: withoutEffects = !1, withLiquidBlur: withLiquidBlur = !1, withBorder: withBorder = !0, withOverLightLayers: withOverLightLayers = ATOMIX_GLASS.DEFAULTS.ENABLE_OVER_LIGHT_LAYERS, debugPerformance: debugPerformance = !1, debugBorderRadius: debugBorderRadius = !1, debugOverLight: debugOverLight = !1, height: height, width: width, ...rest}) {
|
|
1925
|
+
const glassRef = useRef(null), contentRef = useRef(null), {isHovered: isHovered, isActive: isActive, glassSize: glassSize, effectiveBorderRadius: effectiveBorderRadius, effectiveReducedMotion: effectiveReducedMotion, effectiveHighContrast: effectiveHighContrast, effectiveWithoutEffects: effectiveWithoutEffects, overLightConfig: overLightConfig, globalMousePosition: globalMousePosition, mouseOffset: mouseOffset, transformStyle: transformStyle, handleMouseEnter: handleMouseEnter, handleMouseLeave: handleMouseLeave, handleMouseDown: handleMouseDown, handleMouseUp: handleMouseUp, handleKeyDown: handleKeyDown} = useAtomixGlass({
|
|
1423
1926
|
glassRef: glassRef,
|
|
1424
1927
|
contentRef: contentRef,
|
|
1425
|
-
|
|
1928
|
+
borderRadius: borderRadius,
|
|
1426
1929
|
globalMousePosition: externalGlobalMousePosition,
|
|
1427
1930
|
mouseOffset: externalMouseOffset,
|
|
1428
1931
|
mouseContainer: mouseContainer,
|
|
1429
1932
|
overLight: overLight,
|
|
1430
1933
|
reducedMotion: reducedMotion,
|
|
1431
1934
|
highContrast: highContrast,
|
|
1432
|
-
|
|
1935
|
+
withoutEffects: withoutEffects,
|
|
1433
1936
|
elasticity: elasticity,
|
|
1434
1937
|
onClick: onClick,
|
|
1435
|
-
|
|
1938
|
+
debugBorderRadius: debugBorderRadius,
|
|
1436
1939
|
debugOverLight: debugOverLight,
|
|
1437
|
-
|
|
1438
|
-
children: children
|
|
1439
|
-
|
|
1940
|
+
debugPerformance: debugPerformance,
|
|
1941
|
+
children: children,
|
|
1942
|
+
blurAmount: blurAmount,
|
|
1943
|
+
saturation: saturation,
|
|
1944
|
+
withLiquidBlur: withLiquidBlur,
|
|
1945
|
+
padding: padding,
|
|
1946
|
+
style: style
|
|
1947
|
+
}), isOverLight = useMemo((() => overLightConfig?.isOverLight), [ overLight ]), shouldRenderOverLightLayers = withOverLightLayers && isOverLight, baseStyle = {
|
|
1440
1948
|
...style,
|
|
1441
|
-
...!
|
|
1949
|
+
...!effectiveWithoutEffects && {
|
|
1442
1950
|
transform: transformStyle
|
|
1443
1951
|
}
|
|
1444
|
-
}, componentClassName = [ ATOMIX_GLASS.BASE_CLASS, effectiveReducedMotion && `${ATOMIX_GLASS.BASE_CLASS}--reduced-motion`, effectiveHighContrast && `${ATOMIX_GLASS.BASE_CLASS}--high-contrast`,
|
|
1952
|
+
}, 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((() => ({
|
|
1445
1953
|
position: style.position || "absolute",
|
|
1446
1954
|
top: style.top || 0,
|
|
1447
1955
|
left: style.left || 0
|
|
1448
|
-
})), [ style.position, style.top, style.left ]), adjustedSize = useMemo((() =>
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1956
|
+
})), [ style.position, style.top, style.left ]), adjustedSize = useMemo((() => {
|
|
1957
|
+
const resolveSize = (propValue, styleValue, measuredSize) => {
|
|
1958
|
+
const explicitSize = propValue ?? styleValue;
|
|
1959
|
+
return void 0 !== explicitSize ? "number" == typeof explicitSize ? `${explicitSize}px` : explicitSize : "fixed" === positionStyles.position ? `${Math.max(measuredSize, 0)}px` : "100%";
|
|
1960
|
+
};
|
|
1961
|
+
return {
|
|
1962
|
+
width: resolveSize(width, style.width, glassSize.width),
|
|
1963
|
+
height: resolveSize(height, style.height, glassSize.height)
|
|
1964
|
+
};
|
|
1965
|
+
}), [ width, height, style.width, style.height, positionStyles.position, glassSize.width, glassSize.height ]), gradientValues = useMemo((() => {
|
|
1452
1966
|
const mx = mouseOffset.x, my = mouseOffset.y, absMx = Math.abs(mx), absMy = Math.abs(my), GRADIENT = ATOMIX_GLASS.CONSTANTS.GRADIENT;
|
|
1453
1967
|
return {
|
|
1454
1968
|
borderGradientAngle: GRADIENT.BASE_ANGLE + mx * GRADIENT.ANGLE_MULTIPLIER,
|
|
@@ -1490,13 +2004,13 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
1490
2004
|
}), [ isHovered, isActive, isOverLight, overLightConfig.opacity ]), glassVars = useMemo((() => {
|
|
1491
2005
|
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;
|
|
1492
2006
|
return {
|
|
1493
|
-
"--atomix-glass-radius": `${
|
|
2007
|
+
"--atomix-glass-radius": `${effectiveBorderRadius}px`,
|
|
1494
2008
|
"--atomix-glass-transform": transformStyle || "none",
|
|
1495
2009
|
"--atomix-glass-position": positionStyles.position,
|
|
1496
2010
|
"--atomix-glass-top": "fixed" !== positionStyles.top ? `${positionStyles.top}px` : "0",
|
|
1497
2011
|
"--atomix-glass-left": "fixed" !== positionStyles.left ? `${positionStyles.left}px` : "0",
|
|
1498
|
-
"--atomix-glass-width":
|
|
1499
|
-
"--atomix-glass-height":
|
|
2012
|
+
"--atomix-glass-width": adjustedSize.width,
|
|
2013
|
+
"--atomix-glass-height": adjustedSize.height,
|
|
1500
2014
|
"--atomix-glass-border-width": "var(--atomix-spacing-0-5, 0.09375rem)",
|
|
1501
2015
|
"--atomix-glass-blend-mode": isOverLight ? "multiply" : "overlay",
|
|
1502
2016
|
"--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%)`,
|
|
@@ -1512,24 +2026,25 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
1512
2026
|
"--atomix-glass-overlay-opacity": opacityValues.over,
|
|
1513
2027
|
"--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})`
|
|
1514
2028
|
};
|
|
1515
|
-
}), [ gradientValues, opacityValues,
|
|
2029
|
+
}), [ gradientValues, opacityValues, effectiveBorderRadius, transformStyle, positionStyles, adjustedSize, isOverLight, overLightConfig.borderOpacity ]), renderBackgroundLayer = layerType => jsx("div", {
|
|
1516
2030
|
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(" "),
|
|
1517
2031
|
style: {
|
|
1518
2032
|
...positionStyles,
|
|
1519
2033
|
height: adjustedSize.height,
|
|
1520
2034
|
width: adjustedSize.width,
|
|
1521
|
-
borderRadius: `${
|
|
2035
|
+
borderRadius: `${effectiveBorderRadius}px`,
|
|
1522
2036
|
transform: baseStyle.transform
|
|
1523
2037
|
}
|
|
1524
2038
|
});
|
|
1525
2039
|
return jsxs("div", {
|
|
2040
|
+
...rest,
|
|
1526
2041
|
className: componentClassName,
|
|
1527
2042
|
style: glassVars,
|
|
1528
2043
|
role: role || (onClick ? "button" : void 0),
|
|
1529
2044
|
tabIndex: onClick ? tabIndex ?? 0 : tabIndex,
|
|
1530
2045
|
"aria-label": ariaLabel,
|
|
1531
2046
|
"aria-describedby": ariaDescribedBy,
|
|
1532
|
-
"aria-disabled": !(!onClick || !
|
|
2047
|
+
"aria-disabled": !(!onClick || !effectiveWithoutEffects) || !onClick && void 0,
|
|
1533
2048
|
"aria-pressed": !(!onClick || !isActive) || !onClick && void 0,
|
|
1534
2049
|
onKeyDown: onClick ? handleKeyDown : void 0,
|
|
1535
2050
|
children: [ jsx(AtomixGlassContainer, {
|
|
@@ -1537,18 +2052,18 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
1537
2052
|
contentRef: contentRef,
|
|
1538
2053
|
className: className,
|
|
1539
2054
|
style: baseStyle,
|
|
1540
|
-
|
|
1541
|
-
displacementScale:
|
|
1542
|
-
blurAmount:
|
|
2055
|
+
borderRadius: effectiveBorderRadius,
|
|
2056
|
+
displacementScale: effectiveWithoutEffects ? 0 : "shader" === mode ? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.SHADER_DISPLACEMENT : isOverLight ? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.OVER_LIGHT_DISPLACEMENT : displacementScale,
|
|
2057
|
+
blurAmount: effectiveWithoutEffects ? 0 : blurAmount,
|
|
1543
2058
|
saturation: effectiveHighContrast ? ATOMIX_GLASS.CONSTANTS.SATURATION.HIGH_CONTRAST : isOverLight ? saturation * overLightConfig.saturationBoost : saturation,
|
|
1544
|
-
aberrationIntensity:
|
|
2059
|
+
aberrationIntensity: effectiveWithoutEffects ? 0 : "shader" === mode ? aberrationIntensity * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.SHADER_ABERRATION : aberrationIntensity,
|
|
1545
2060
|
glassSize: glassSize,
|
|
1546
2061
|
padding: padding,
|
|
1547
|
-
mouseOffset:
|
|
2062
|
+
mouseOffset: effectiveWithoutEffects ? {
|
|
1548
2063
|
x: 0,
|
|
1549
2064
|
y: 0
|
|
1550
2065
|
} : mouseOffset,
|
|
1551
|
-
globalMousePosition:
|
|
2066
|
+
globalMousePosition: effectiveWithoutEffects ? {
|
|
1552
2067
|
x: 0,
|
|
1553
2068
|
y: 0
|
|
1554
2069
|
} : globalMousePosition,
|
|
@@ -1568,11 +2083,11 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
1568
2083
|
onClick: onClick,
|
|
1569
2084
|
mode: mode,
|
|
1570
2085
|
transform: baseStyle.transform,
|
|
1571
|
-
|
|
2086
|
+
effectiveWithoutEffects: effectiveWithoutEffects,
|
|
1572
2087
|
effectiveReducedMotion: effectiveReducedMotion,
|
|
1573
2088
|
shaderVariant: shaderVariant,
|
|
1574
2089
|
elasticity: elasticity,
|
|
1575
|
-
|
|
2090
|
+
withLiquidBlur: withLiquidBlur,
|
|
1576
2091
|
children: children
|
|
1577
2092
|
}), Boolean(onClick) && jsxs(Fragment, {
|
|
1578
2093
|
children: [ jsx("div", {
|
|
@@ -1594,17 +2109,87 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
1594
2109
|
background: `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}%)`
|
|
1595
2110
|
}
|
|
1596
2111
|
}) ]
|
|
1597
|
-
}),
|
|
2112
|
+
}), withBorder && jsxs(Fragment, {
|
|
1598
2113
|
children: [ jsx("span", {
|
|
1599
|
-
className: ATOMIX_GLASS.BORDER_1_CLASS
|
|
2114
|
+
className: ATOMIX_GLASS.BORDER_1_CLASS,
|
|
2115
|
+
style: {
|
|
2116
|
+
width: glassSize.width,
|
|
2117
|
+
height: glassSize.height
|
|
2118
|
+
}
|
|
1600
2119
|
}), jsx("span", {
|
|
1601
|
-
className: ATOMIX_GLASS.BORDER_2_CLASS
|
|
2120
|
+
className: ATOMIX_GLASS.BORDER_2_CLASS,
|
|
2121
|
+
style: {
|
|
2122
|
+
width: glassSize.width,
|
|
2123
|
+
height: glassSize.height
|
|
2124
|
+
}
|
|
1602
2125
|
}) ]
|
|
1603
2126
|
}) ]
|
|
1604
2127
|
});
|
|
1605
2128
|
}
|
|
1606
2129
|
|
|
1607
|
-
|
|
2130
|
+
// Default icon
|
|
2131
|
+
const DefaultIcon = () => jsx("i", {
|
|
2132
|
+
className: "c-accordion__icon",
|
|
2133
|
+
"aria-hidden": "true",
|
|
2134
|
+
children: jsx("svg", {
|
|
2135
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2136
|
+
width: "24",
|
|
2137
|
+
height: "24",
|
|
2138
|
+
viewBox: "0 0 24 24",
|
|
2139
|
+
fill: "none",
|
|
2140
|
+
stroke: "currentColor",
|
|
2141
|
+
strokeWidth: "2",
|
|
2142
|
+
strokeLinecap: "round",
|
|
2143
|
+
strokeLinejoin: "round",
|
|
2144
|
+
"aria-hidden": "true",
|
|
2145
|
+
focusable: "false",
|
|
2146
|
+
children: jsx("polyline", {
|
|
2147
|
+
points: "6 9 12 15 18 9"
|
|
2148
|
+
})
|
|
2149
|
+
})
|
|
2150
|
+
}), AccordionHeader = forwardRef((({title: title, icon: icon, iconPosition: iconPosition = "right", isOpen: isOpen, children: children, className: className = "", ...props}, ref) => {
|
|
2151
|
+
// Determine icon to render. Explicit check for undefined to allow null/false to hide icon.
|
|
2152
|
+
const iconElement = void 0 === icon ? jsx(DefaultIcon, {}) : icon;
|
|
2153
|
+
return jsxs("button", {
|
|
2154
|
+
ref: ref,
|
|
2155
|
+
type: "button",
|
|
2156
|
+
className: className,
|
|
2157
|
+
...props,
|
|
2158
|
+
children: [ title && jsx("span", {
|
|
2159
|
+
className: "c-accordion__title",
|
|
2160
|
+
children: title
|
|
2161
|
+
}), children, iconElement ]
|
|
2162
|
+
});
|
|
2163
|
+
}));
|
|
2164
|
+
|
|
2165
|
+
AccordionHeader.displayName = "AccordionHeader";
|
|
2166
|
+
|
|
2167
|
+
const AccordionBody = forwardRef((({children: children, className: className = "", panelRef: panelRef, contentRef: contentRef, ...props}, ref) => {
|
|
2168
|
+
const mergedPanelRef = React.useMemo((() =>
|
|
2169
|
+
// Helper to merge refs
|
|
2170
|
+
function(...refs) {
|
|
2171
|
+
return node => {
|
|
2172
|
+
refs.forEach((ref => {
|
|
2173
|
+
"function" == typeof ref ? ref(node) : null != ref && (ref.current = node);
|
|
2174
|
+
}));
|
|
2175
|
+
};
|
|
2176
|
+
}(ref, panelRef)), [ ref, panelRef ]);
|
|
2177
|
+
return jsx("div", {
|
|
2178
|
+
ref: mergedPanelRef,
|
|
2179
|
+
className: className,
|
|
2180
|
+
role: "region",
|
|
2181
|
+
...props,
|
|
2182
|
+
children: jsx("div", {
|
|
2183
|
+
className: ACCORDION.SELECTORS.BODY.replace(".", ""),
|
|
2184
|
+
ref: contentRef,
|
|
2185
|
+
children: children
|
|
2186
|
+
})
|
|
2187
|
+
});
|
|
2188
|
+
}));
|
|
2189
|
+
|
|
2190
|
+
AccordionBody.displayName = "AccordionBody";
|
|
2191
|
+
|
|
2192
|
+
const AccordionImpl = memo((({title: title, children: children, defaultOpen: defaultOpen = !1, isOpen: controlledOpen, onOpenChange: onOpenChange, onOpen: onOpen, onClose: onClose, disabled: disabled = !1, iconPosition: iconPosition = "right", icon: icon, className: className = "", style: style, glass: glass}) => {
|
|
1608
2193
|
// Generate unique IDs for accessibility
|
|
1609
2194
|
const instanceId = useId(), buttonId = `accordion-header-${instanceId}`, panelId = `accordion-panel-${instanceId}`, {state: state, toggle: toggle, updatePanelHeight: updatePanelHeight, panelRef: panelRef, contentRef: contentRef, generateClassNames: generateClassNames, generateHeaderClassNames: generateHeaderClassNames} =
|
|
1610
2195
|
/**
|
|
@@ -1667,53 +2252,59 @@ const Accordion = memo((({title: title, children: children, defaultOpen: defaul
|
|
|
1667
2252
|
onOpenChange: onOpenChange,
|
|
1668
2253
|
onOpen: onOpen,
|
|
1669
2254
|
onClose: onClose
|
|
1670
|
-
}),
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
width: "24",
|
|
1676
|
-
height: "24",
|
|
1677
|
-
viewBox: "0 0 24 24",
|
|
1678
|
-
fill: "none",
|
|
1679
|
-
stroke: "currentColor",
|
|
1680
|
-
strokeWidth: "2",
|
|
1681
|
-
strokeLinecap: "round",
|
|
1682
|
-
strokeLinejoin: "round",
|
|
1683
|
-
"aria-hidden": "true",
|
|
1684
|
-
focusable: "false",
|
|
1685
|
-
children: jsx("polyline", {
|
|
1686
|
-
points: "6 9 12 15 18 9"
|
|
1687
|
-
})
|
|
1688
|
-
})
|
|
1689
|
-
}), accordionContent = jsxs("div", {
|
|
2255
|
+
}), headerClassNames = generateHeaderClassNames(), panelClassNames = ACCORDION.SELECTORS.PANEL.replace(".", ""), hasCompoundComponents = React.Children.toArray(children).some((child => {
|
|
2256
|
+
var _context;
|
|
2257
|
+
|
|
2258
|
+
return React.isValidElement(child) && _includesInstanceProperty(_context = [ "AccordionHeader", "AccordionBody" ]).call(_context, child.type.displayName);
|
|
2259
|
+
})), content = jsx("div", {
|
|
1690
2260
|
className: generateClassNames(className) + (glass ? " c-accordion--glass" : ""),
|
|
1691
2261
|
style: style,
|
|
1692
|
-
children:
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
2262
|
+
children: hasCompoundComponents ? React.Children.map(children, (child => {
|
|
2263
|
+
if ( React.isValidElement(child)) {
|
|
2264
|
+
if ("AccordionHeader" === child.type.displayName)
|
|
2265
|
+
return React.cloneElement(child, {
|
|
2266
|
+
id: buttonId,
|
|
2267
|
+
className: `${headerClassNames} ${child.props.className || ""}`.trim(),
|
|
2268
|
+
onClick: e => {
|
|
2269
|
+
toggle(), child.props.onClick?.(e);
|
|
2270
|
+
},
|
|
2271
|
+
"aria-expanded": state.isOpen,
|
|
2272
|
+
"aria-controls": panelId,
|
|
2273
|
+
"aria-disabled": disabled,
|
|
2274
|
+
disabled: disabled,
|
|
2275
|
+
iconPosition: child.props.iconPosition || iconPosition
|
|
2276
|
+
});
|
|
2277
|
+
if ("AccordionBody" === child.type.displayName)
|
|
2278
|
+
return React.cloneElement(child, {
|
|
2279
|
+
id: panelId,
|
|
2280
|
+
className: `${panelClassNames} ${child.props.className || ""}`.trim(),
|
|
2281
|
+
"aria-labelledby": buttonId,
|
|
2282
|
+
panelRef: panelRef,
|
|
2283
|
+
contentRef: contentRef
|
|
2284
|
+
});
|
|
2285
|
+
}
|
|
2286
|
+
return child;
|
|
2287
|
+
})) : jsxs(Fragment, {
|
|
2288
|
+
children: [ jsx(AccordionHeader, {
|
|
2289
|
+
id: buttonId,
|
|
2290
|
+
className: headerClassNames,
|
|
2291
|
+
onClick: toggle,
|
|
2292
|
+
"aria-expanded": state.isOpen,
|
|
2293
|
+
"aria-controls": panelId,
|
|
2294
|
+
"aria-disabled": disabled,
|
|
2295
|
+
disabled: disabled,
|
|
2296
|
+
title: title,
|
|
2297
|
+
icon: icon,
|
|
2298
|
+
iconPosition: iconPosition
|
|
2299
|
+
}), jsx(AccordionBody, {
|
|
2300
|
+
id: panelId,
|
|
2301
|
+
className: panelClassNames,
|
|
2302
|
+
"aria-labelledby": buttonId,
|
|
2303
|
+
panelRef: panelRef,
|
|
2304
|
+
contentRef: contentRef,
|
|
1714
2305
|
children: children
|
|
1715
|
-
})
|
|
1716
|
-
})
|
|
2306
|
+
}) ]
|
|
2307
|
+
})
|
|
1717
2308
|
});
|
|
1718
2309
|
if (glass) {
|
|
1719
2310
|
// Default glass settings for accordions
|
|
@@ -1726,16 +2317,20 @@ const Accordion = memo((({title: title, children: children, defaultOpen: defaul
|
|
|
1726
2317
|
};
|
|
1727
2318
|
return jsx(AtomixGlass, {
|
|
1728
2319
|
...glassProps,
|
|
1729
|
-
children:
|
|
2320
|
+
children: content
|
|
1730
2321
|
});
|
|
1731
2322
|
}
|
|
1732
|
-
return
|
|
2323
|
+
return content;
|
|
1733
2324
|
}));
|
|
1734
2325
|
|
|
1735
|
-
|
|
1736
|
-
|
|
2326
|
+
AccordionImpl.displayName = "Accordion";
|
|
2327
|
+
|
|
2328
|
+
// Attach subcomponents
|
|
2329
|
+
const AccordionWithSubcomponents = AccordionImpl;
|
|
1737
2330
|
|
|
1738
|
-
|
|
2331
|
+
AccordionWithSubcomponents.Header = AccordionHeader, AccordionWithSubcomponents.Body = AccordionBody;
|
|
2332
|
+
|
|
2333
|
+
const Accordion = AccordionWithSubcomponents, Badge = memo((({label: label, variant: variant = "primary", size: size = "md", disabled: disabled = !1, icon: icon, onRemove: onRemove, "aria-label": ariaLabel, className: className = "", glass: glass, style: style}) => {
|
|
1739
2334
|
const {generateBadgeClass: generateBadgeClass} =
|
|
1740
2335
|
/**
|
|
1741
2336
|
* Badge state and functionality
|
|
@@ -1794,7 +2389,7 @@ const Badge = memo((({label: label, variant: variant = "primary", size: size =
|
|
|
1794
2389
|
// Default glass settings for badges
|
|
1795
2390
|
const defaultGlassProps = {
|
|
1796
2391
|
displacementScale: 20,
|
|
1797
|
-
|
|
2392
|
+
borderRadius: ref.current?.getBoundingClientRect().width ? ref.current?.getBoundingClientRect().width / 2 : 16,
|
|
1798
2393
|
className: "c-badge--glass",
|
|
1799
2394
|
elasticity: 0
|
|
1800
2395
|
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
@@ -1915,42 +2510,82 @@ const Block = forwardRef((({children: children, as: Component = "section", spac
|
|
|
1915
2510
|
* ```
|
|
1916
2511
|
*/ Block.displayName = "Block";
|
|
1917
2512
|
|
|
1918
|
-
const
|
|
2513
|
+
const BreadcrumbItem = forwardRef((({children: children, href: href, active: active, icon: icon, onClick: onClick, className: className = "", style: style, linkAs: linkAs, linkProps: linkProps = {}, ...props}, ref) => {
|
|
2514
|
+
const itemClasses = [ BREADCRUMB.CLASSES.ITEM, active ? BREADCRUMB.CLASSES.ACTIVE : "", className ].filter(Boolean).join(" "), linkContent = jsxs(Fragment, {
|
|
2515
|
+
children: [ icon && jsx("span", {
|
|
2516
|
+
className: "c-breadcrumb__icon",
|
|
2517
|
+
children: icon
|
|
2518
|
+
}), children ]
|
|
2519
|
+
}), commonLinkProps = {
|
|
2520
|
+
className: BREADCRUMB.CLASSES.LINK,
|
|
2521
|
+
onClick: onClick,
|
|
2522
|
+
style: style,
|
|
2523
|
+
// Apply style to the link as per legacy behavior
|
|
2524
|
+
...linkProps
|
|
2525
|
+
};
|
|
2526
|
+
return jsx("li", {
|
|
2527
|
+
ref: ref,
|
|
2528
|
+
className: itemClasses,
|
|
2529
|
+
style: style,
|
|
2530
|
+
...props,
|
|
2531
|
+
children: href && !active ?
|
|
2532
|
+
// @ts-ignore - Dynamic components are tricky in TS without stricter types
|
|
2533
|
+
jsx(linkAs || "a", {
|
|
2534
|
+
href: href,
|
|
2535
|
+
...commonLinkProps,
|
|
2536
|
+
children: linkContent
|
|
2537
|
+
}) : jsx("span", {
|
|
2538
|
+
className: BREADCRUMB.CLASSES.LINK,
|
|
2539
|
+
children: linkContent
|
|
2540
|
+
})
|
|
2541
|
+
});
|
|
2542
|
+
}));
|
|
2543
|
+
|
|
2544
|
+
BreadcrumbItem.displayName = "BreadcrumbItem";
|
|
2545
|
+
|
|
2546
|
+
const Breadcrumb = memo((function({items: items, divider: divider, className: className = "", "aria-label": ariaLabel = "Breadcrumb", LinkComponent: LinkComponent, style: style, children: children}) {
|
|
1919
2547
|
const breadcrumbClasses = [ BREADCRUMB.CLASSES.BASE, className ].filter(Boolean).join(" ");
|
|
2548
|
+
let content;
|
|
2549
|
+
if (items && items.length > 0)
|
|
2550
|
+
// Legacy rendering
|
|
2551
|
+
content = items.map(((item, index) => {
|
|
2552
|
+
const isLast = index === items.length - 1;
|
|
2553
|
+
return jsx(BreadcrumbItem, {
|
|
2554
|
+
href: item.href,
|
|
2555
|
+
active: item.active || isLast,
|
|
2556
|
+
icon: item.icon,
|
|
2557
|
+
onClick: item.onClick,
|
|
2558
|
+
className: item.className,
|
|
2559
|
+
style: item.style,
|
|
2560
|
+
linkAs: LinkComponent,
|
|
2561
|
+
children: item.label
|
|
2562
|
+
}, index);
|
|
2563
|
+
})); else {
|
|
2564
|
+
// Compound rendering
|
|
2565
|
+
const childrenCount = Children.count(children);
|
|
2566
|
+
content = Children.map(children, ((child, index) => {
|
|
2567
|
+
if ( isValidElement(child)) {
|
|
2568
|
+
const isLast = index === childrenCount - 1, childProps = child.props, {active: active, linkAs: linkAs, ...otherProps} = childProps;
|
|
2569
|
+
|
|
2570
|
+
return cloneElement(child, {
|
|
2571
|
+
active: active ?? (!!isLast || void 0),
|
|
2572
|
+
linkAs: linkAs ?? LinkComponent
|
|
2573
|
+
});
|
|
2574
|
+
}
|
|
2575
|
+
return child;
|
|
2576
|
+
}));
|
|
2577
|
+
}
|
|
1920
2578
|
return jsx("nav", {
|
|
1921
2579
|
"aria-label": ariaLabel,
|
|
1922
2580
|
style: style,
|
|
1923
2581
|
children: jsx("ol", {
|
|
1924
2582
|
className: breadcrumbClasses,
|
|
1925
|
-
children:
|
|
1926
|
-
const isLast = index === items.length - 1, itemClasses = [ BREADCRUMB.CLASSES.ITEM, item.active || isLast ? BREADCRUMB.CLASSES.ACTIVE : "" ].filter(Boolean).join(" "), linkContent = jsxs(Fragment, {
|
|
1927
|
-
children: [ item.icon && jsx("span", {
|
|
1928
|
-
className: "c-breadcrumb__icon",
|
|
1929
|
-
children: item.icon
|
|
1930
|
-
}), item.label ]
|
|
1931
|
-
}), linkProps = {
|
|
1932
|
-
href: item.href,
|
|
1933
|
-
className: BREADCRUMB.CLASSES.LINK,
|
|
1934
|
-
onClick: item.onClick,
|
|
1935
|
-
style: item.style
|
|
1936
|
-
};
|
|
1937
|
-
return jsx("li", {
|
|
1938
|
-
className: itemClasses,
|
|
1939
|
-
style: item.style,
|
|
1940
|
-
children: item.href && !item.active ? jsx(LinkComponent || "a", {
|
|
1941
|
-
...linkProps,
|
|
1942
|
-
children: linkContent
|
|
1943
|
-
}) : jsx("span", {
|
|
1944
|
-
className: BREADCRUMB.CLASSES.LINK,
|
|
1945
|
-
children: linkContent
|
|
1946
|
-
})
|
|
1947
|
-
}, index);
|
|
1948
|
-
}))
|
|
2583
|
+
children: content
|
|
1949
2584
|
})
|
|
1950
2585
|
});
|
|
1951
2586
|
}));
|
|
1952
2587
|
|
|
1953
|
-
Breadcrumb.displayName = "Breadcrumb";
|
|
2588
|
+
Breadcrumb.displayName = "Breadcrumb", Breadcrumb.Item = BreadcrumbItem;
|
|
1954
2589
|
|
|
1955
2590
|
const Spinner = memo((({size: size = "md", variant: variant = "primary", fullscreen: fullscreen = !1, className: className = "", style: style, glass: glass, "aria-label": ariaLabel, role: role = "status"}) => {
|
|
1956
2591
|
const {generateSpinnerClass: generateSpinnerClass} =
|
|
@@ -2001,7 +2636,7 @@ const Spinner = memo((({size: size = "md", variant: variant = "primary", fullsc
|
|
|
2001
2636
|
const defaultGlassProps = {
|
|
2002
2637
|
displacementScale: 20,
|
|
2003
2638
|
blurAmount: 1,
|
|
2004
|
-
|
|
2639
|
+
borderRadius: 999,
|
|
2005
2640
|
mode: "shader"
|
|
2006
2641
|
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
2007
2642
|
...defaultGlassProps,
|
|
@@ -2069,7 +2704,7 @@ class ThemeNaming {
|
|
|
2069
2704
|
* Convert camelCase to kebab-case for CSS variables
|
|
2070
2705
|
* @param str - String to convert
|
|
2071
2706
|
*/ static camelToKebab(str) {
|
|
2072
|
-
return str.replace(/([a-z0-9]
|
|
2707
|
+
return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
2073
2708
|
}
|
|
2074
2709
|
/**
|
|
2075
2710
|
* Convert kebab-case to camelCase for JavaScript properties
|
|
@@ -2477,402 +3112,102 @@ const ElevationCard = ({elevationClass: elevationClass = "is-elevated", classNam
|
|
|
2477
3112
|
elevationClass: elevationClass,
|
|
2478
3113
|
clickable: Boolean(onClick),
|
|
2479
3114
|
onClick: onClick,
|
|
2480
|
-
focusEffect: !0
|
|
2481
|
-
}), cardProps = getCardProps();
|
|
2482
|
-
return jsx("div", {
|
|
2483
|
-
className: `${className} ${cardProps.className}`,
|
|
2484
|
-
ref: cardProps.ref,
|
|
2485
|
-
style: style,
|
|
2486
|
-
tabIndex: cardProps.tabIndex,
|
|
2487
|
-
role: cardProps.role,
|
|
2488
|
-
onMouseEnter: cardProps.onMouseEnter,
|
|
2489
|
-
onMouseLeave: cardProps.onMouseLeave,
|
|
2490
|
-
onFocus: cardProps.onFocus,
|
|
2491
|
-
onBlur: cardProps.onBlur,
|
|
2492
|
-
onClick: cardProps.onClick,
|
|
2493
|
-
onKeyDown: cardProps.onKeyDown,
|
|
2494
|
-
children: jsx(Card, {
|
|
2495
|
-
...props,
|
|
2496
|
-
className: "",
|
|
2497
|
-
onClick: void 0,
|
|
2498
|
-
children: children
|
|
2499
|
-
})
|
|
2500
|
-
});
|
|
2501
|
-
};
|
|
2502
|
-
|
|
2503
|
-
ElevationCard.displayName = "ElevationCard";
|
|
2504
|
-
|
|
2505
|
-
var commonjsGlobal = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {};
|
|
2506
|
-
|
|
2507
|
-
function getDefaultExportFromCjs(x) {
|
|
2508
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x.default : x;
|
|
2509
|
-
}
|
|
2510
|
-
|
|
2511
|
-
var fails$8 = function(exec) {
|
|
2512
|
-
try {
|
|
2513
|
-
return !!exec();
|
|
2514
|
-
} catch (error) {
|
|
2515
|
-
return !0;
|
|
2516
|
-
}
|
|
2517
|
-
}, functionBindNative = !fails$8((function() {
|
|
2518
|
-
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
|
2519
|
-
var test = function() {/* empty */}.bind();
|
|
2520
|
-
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
2521
|
-
return "function" != typeof test || test.hasOwnProperty("prototype");
|
|
2522
|
-
})), 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) {
|
|
2523
|
-
return function() {
|
|
2524
|
-
return call$5.apply(fn, arguments);
|
|
2525
|
-
};
|
|
2526
|
-
}, objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf), check = function(it) {
|
|
2527
|
-
return it && it.Math === Math && it;
|
|
2528
|
-
}, globalThis_1 =
|
|
2529
|
-
// eslint-disable-next-line es/no-global-this -- safe
|
|
2530
|
-
check("object" == typeof globalThis && globalThis) || check("object" == typeof window && window) ||
|
|
2531
|
-
// eslint-disable-next-line no-restricted-globals -- safe
|
|
2532
|
-
check("object" == typeof self && self) || check("object" == typeof commonjsGlobal && commonjsGlobal) || check("object" == typeof commonjsGlobal && commonjsGlobal) ||
|
|
2533
|
-
// eslint-disable-next-line no-new-func -- fallback
|
|
2534
|
-
function() {
|
|
2535
|
-
return this;
|
|
2536
|
-
}() || 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() {
|
|
2537
|
-
return call$4.apply(apply$1, arguments);
|
|
2538
|
-
}), uncurryThis$7 = functionUncurryThis, toString$3 = uncurryThis$7({}.toString), stringSlice = uncurryThis$7("".slice), classofRaw$2 = function(it) {
|
|
2539
|
-
return stringSlice(toString$3(it), 8, -1);
|
|
2540
|
-
}, classofRaw$1 = classofRaw$2, uncurryThis$6 = functionUncurryThis, functionUncurryThisClause = function(fn) {
|
|
2541
|
-
// Nashorn bug:
|
|
2542
|
-
// https://github.com/zloirock/core-js/issues/1128
|
|
2543
|
-
// https://github.com/zloirock/core-js/issues/1130
|
|
2544
|
-
if ("Function" === classofRaw$1(fn)) return uncurryThis$6(fn);
|
|
2545
|
-
}, documentAll = "object" == typeof document && document.all, isCallable$8 = void 0 === documentAll && void 0 !== documentAll ? function(argument) {
|
|
2546
|
-
return "function" == typeof argument || argument === documentAll;
|
|
2547
|
-
} : function(argument) {
|
|
2548
|
-
return "function" == typeof argument;
|
|
2549
|
-
}, objectGetOwnPropertyDescriptor = {}, descriptors = !fails$8((function() {
|
|
2550
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
2551
|
-
return 7 !== Object.defineProperty({}, 1, {
|
|
2552
|
-
get: function() {
|
|
2553
|
-
return 7;
|
|
2554
|
-
}
|
|
2555
|
-
})[1];
|
|
2556
|
-
})), NATIVE_BIND$1 = functionBindNative, call$3 = Function.prototype.call, functionCall = NATIVE_BIND$1 ? call$3.bind(call$3) : function() {
|
|
2557
|
-
return call$3.apply(call$3, arguments);
|
|
2558
|
-
}, objectPropertyIsEnumerable = {}, $propertyIsEnumerable = {}.propertyIsEnumerable, getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor, NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({
|
|
2559
|
-
1: 2
|
|
2560
|
-
}, 1);
|
|
2561
|
-
|
|
2562
|
-
// `Object.prototype.propertyIsEnumerable` method implementation
|
|
2563
|
-
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
|
2564
|
-
objectPropertyIsEnumerable.f = NASHORN_BUG ? function(V) {
|
|
2565
|
-
var descriptor = getOwnPropertyDescriptor$1(this, V);
|
|
2566
|
-
return !!descriptor && descriptor.enumerable;
|
|
2567
|
-
} : $propertyIsEnumerable;
|
|
2568
|
-
|
|
2569
|
-
var match, version, createPropertyDescriptor$2 = function(bitmap, value) {
|
|
2570
|
-
return {
|
|
2571
|
-
enumerable: !(1 & bitmap),
|
|
2572
|
-
configurable: !(2 & bitmap),
|
|
2573
|
-
writable: !(4 & bitmap),
|
|
2574
|
-
value: value
|
|
2575
|
-
};
|
|
2576
|
-
}, fails$5 = fails$8, classof$3 = classofRaw$2, $Object$3 = Object, split = functionUncurryThis("".split), indexedObject = fails$5((function() {
|
|
2577
|
-
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
2578
|
-
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
2579
|
-
return !$Object$3("z").propertyIsEnumerable(0);
|
|
2580
|
-
})) ? function(it) {
|
|
2581
|
-
return "String" === classof$3(it) ? split(it, "") : $Object$3(it);
|
|
2582
|
-
} : $Object$3, isNullOrUndefined$2 = function(it) {
|
|
2583
|
-
return null == it;
|
|
2584
|
-
}, isNullOrUndefined$1 = isNullOrUndefined$2, $TypeError$6 = TypeError, requireObjectCoercible$3 = function(it) {
|
|
2585
|
-
if (isNullOrUndefined$1(it)) throw new $TypeError$6("Can't call method on " + it);
|
|
2586
|
-
return it;
|
|
2587
|
-
}, IndexedObject = indexedObject, requireObjectCoercible$2 = requireObjectCoercible$3, toIndexedObject$2 = function(it) {
|
|
2588
|
-
return IndexedObject(requireObjectCoercible$2(it));
|
|
2589
|
-
}, isCallable$7 = isCallable$8, isObject$5 = function(it) {
|
|
2590
|
-
return "object" == typeof it ? null !== it : isCallable$7(it);
|
|
2591
|
-
}, path$3 = {}, path$2 = path$3, globalThis$a = globalThis_1, isCallable$6 = isCallable$8, aFunction = function(variable) {
|
|
2592
|
-
return isCallable$6(variable) ? variable : void 0;
|
|
2593
|
-
}, 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;
|
|
2594
|
-
|
|
2595
|
-
v8 && (
|
|
2596
|
-
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
|
2597
|
-
// but their correct versions are not interesting for us
|
|
2598
|
-
version = (match = v8.split("."))[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1])),
|
|
2599
|
-
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
|
2600
|
-
// so check `userAgent` even if `.v8` exists, but 0
|
|
2601
|
-
!version && userAgent && (!(match = userAgent.match(/Edge\/(\d+)/)) || match[1] >= 74) && (match = userAgent.match(/Chrome\/(\d+)/)) && (version = +match[1]);
|
|
2602
|
-
|
|
2603
|
-
var V8_VERSION = version, fails$4 = fails$8, $String$3 = globalThis_1.String, symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$4((function() {
|
|
2604
|
-
var symbol = Symbol("symbol detection");
|
|
2605
|
-
// Chrome 38 Symbol has incorrect toString conversion
|
|
2606
|
-
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
2607
|
-
// nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
|
|
2608
|
-
// of course, fail.
|
|
2609
|
-
return !$String$3(symbol) || !(Object(symbol) instanceof Symbol) ||
|
|
2610
|
-
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
|
2611
|
-
!Symbol.sham && V8_VERSION && V8_VERSION < 41;
|
|
2612
|
-
})), useSymbolAsUid = symbolConstructorDetection && !Symbol.sham && "symbol" == typeof Symbol.iterator, isCallable$5 = isCallable$8, isPrototypeOf$1 = objectIsPrototypeOf, $Object$2 = Object, isSymbol$2 = useSymbolAsUid ? function(it) {
|
|
2613
|
-
return "symbol" == typeof it;
|
|
2614
|
-
} : function(it) {
|
|
2615
|
-
var $Symbol = function(namespace, method) {
|
|
2616
|
-
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];
|
|
2617
|
-
}("Symbol");
|
|
2618
|
-
return isCallable$5($Symbol) && isPrototypeOf$1($Symbol.prototype, $Object$2(it));
|
|
2619
|
-
}, $String$2 = String, isCallable$4 = isCallable$8, $TypeError$5 = TypeError, aCallable$2 = function(argument) {
|
|
2620
|
-
if (isCallable$4(argument)) return argument;
|
|
2621
|
-
throw new $TypeError$5(function(argument) {
|
|
2622
|
-
try {
|
|
2623
|
-
return $String$2(argument);
|
|
2624
|
-
} catch (error) {
|
|
2625
|
-
return "Object";
|
|
2626
|
-
}
|
|
2627
|
-
}(argument) + " is not a function");
|
|
2628
|
-
}, aCallable$1 = aCallable$2, isNullOrUndefined = isNullOrUndefined$2, call$2 = functionCall, isCallable$3 = isCallable$8, isObject$4 = isObject$5, $TypeError$4 = TypeError, sharedStore = {
|
|
2629
|
-
exports: {}
|
|
2630
|
-
}, globalThis$6 = globalThis_1, defineProperty = Object.defineProperty, globalThis$5 = globalThis_1, store$1 = sharedStore.exports = globalThis$5["__core-js_shared__"] || function(key, value) {
|
|
2631
|
-
try {
|
|
2632
|
-
defineProperty(globalThis$6, key, {
|
|
2633
|
-
value: value,
|
|
2634
|
-
configurable: !0,
|
|
2635
|
-
writable: !0
|
|
2636
|
-
});
|
|
2637
|
-
} catch (error) {
|
|
2638
|
-
globalThis$6[key] = value;
|
|
2639
|
-
}
|
|
2640
|
-
return value;
|
|
2641
|
-
}("__core-js_shared__", {});
|
|
3115
|
+
focusEffect: !0
|
|
3116
|
+
}), cardProps = getCardProps();
|
|
3117
|
+
return jsx("div", {
|
|
3118
|
+
className: `${className} ${cardProps.className}`,
|
|
3119
|
+
ref: cardProps.ref,
|
|
3120
|
+
style: style,
|
|
3121
|
+
tabIndex: cardProps.tabIndex,
|
|
3122
|
+
role: cardProps.role,
|
|
3123
|
+
onMouseEnter: cardProps.onMouseEnter,
|
|
3124
|
+
onMouseLeave: cardProps.onMouseLeave,
|
|
3125
|
+
onFocus: cardProps.onFocus,
|
|
3126
|
+
onBlur: cardProps.onBlur,
|
|
3127
|
+
onClick: cardProps.onClick,
|
|
3128
|
+
onKeyDown: cardProps.onKeyDown,
|
|
3129
|
+
children: jsx(Card, {
|
|
3130
|
+
...props,
|
|
3131
|
+
className: "",
|
|
3132
|
+
onClick: void 0,
|
|
3133
|
+
children: children
|
|
3134
|
+
})
|
|
3135
|
+
});
|
|
3136
|
+
};
|
|
2642
3137
|
|
|
2643
|
-
|
|
2644
|
-
version: "3.43.0",
|
|
2645
|
-
mode: "pure",
|
|
2646
|
-
copyright: "© 2014-2025 Denis Pushkarev (zloirock.ru)",
|
|
2647
|
-
license: "https://github.com/zloirock/core-js/blob/v3.43.0/LICENSE",
|
|
2648
|
-
source: "https://github.com/zloirock/core-js"
|
|
2649
|
-
});
|
|
3138
|
+
ElevationCard.displayName = "ElevationCard";
|
|
2650
3139
|
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
}, call$1 = functionCall, isObject$3 = isObject$5, isSymbol$1 = isSymbol$2, $TypeError$3 = TypeError, TO_PRIMITIVE = wellKnownSymbol$5("toPrimitive"), toPrimitive = function(input, pref) {
|
|
2659
|
-
if (!isObject$3(input) || isSymbol$1(input)) return input;
|
|
2660
|
-
var result, func, exoticToPrim = (func = input[TO_PRIMITIVE], isNullOrUndefined(func) ? void 0 : aCallable$1(func));
|
|
2661
|
-
if (exoticToPrim) {
|
|
2662
|
-
if (void 0 === pref && (pref = "default"), result = call$1(exoticToPrim, input, pref),
|
|
2663
|
-
!isObject$3(result) || isSymbol$1(result)) return result;
|
|
2664
|
-
throw new $TypeError$3("Can't convert object to primitive value");
|
|
2665
|
-
}
|
|
2666
|
-
return void 0 === pref && (pref = "number"), function(input, pref) {
|
|
2667
|
-
var fn, val;
|
|
2668
|
-
if ("string" === pref && isCallable$3(fn = input.toString) && !isObject$4(val = call$2(fn, input))) return val;
|
|
2669
|
-
if (isCallable$3(fn = input.valueOf) && !isObject$4(val = call$2(fn, input))) return val;
|
|
2670
|
-
if ("string" !== pref && isCallable$3(fn = input.toString) && !isObject$4(val = call$2(fn, input))) return val;
|
|
2671
|
-
throw new $TypeError$4("Can't convert object to primitive value");
|
|
2672
|
-
}(input, pref);
|
|
2673
|
-
}, isSymbol = isSymbol$2, toPropertyKey$2 = function(argument) {
|
|
2674
|
-
var key = toPrimitive(argument, "string");
|
|
2675
|
-
return isSymbol(key) ? key : key + "";
|
|
2676
|
-
}, isObject$2 = isObject$5, document$1 = globalThis_1.document, EXISTS = isObject$2(document$1) && isObject$2(document$1.createElement), ie8DomDefine = !descriptors && !fails$8((function() {
|
|
2677
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
2678
|
-
return 7 !== Object.defineProperty((it = "div", EXISTS ? document$1.createElement(it) : {}), "a", {
|
|
2679
|
-
get: function() {
|
|
2680
|
-
return 7;
|
|
2681
|
-
}
|
|
2682
|
-
}).a;
|
|
2683
|
-
var it;
|
|
2684
|
-
})), 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;
|
|
3140
|
+
// Subcomponents
|
|
3141
|
+
const CalloutIcon = forwardRef((({children: children, className: className = "", ...props}, ref) => jsx("div", {
|
|
3142
|
+
ref: ref,
|
|
3143
|
+
className: `c-callout__icon ${className}`.trim(),
|
|
3144
|
+
...props,
|
|
3145
|
+
children: children
|
|
3146
|
+
})));
|
|
2685
3147
|
|
|
2686
|
-
|
|
2687
|
-
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
|
2688
|
-
objectGetOwnPropertyDescriptor.f = DESCRIPTORS$3 ? $getOwnPropertyDescriptor$1 : function(O, P) {
|
|
2689
|
-
if (O = toIndexedObject$1(O), P = toPropertyKey$1(P), IE8_DOM_DEFINE$1) try {
|
|
2690
|
-
return $getOwnPropertyDescriptor$1(O, P);
|
|
2691
|
-
} catch (error) {/* empty */}
|
|
2692
|
-
if (hasOwn$1(O, P)) return createPropertyDescriptor$1(!call(propertyIsEnumerableModule.f, O, P), O[P]);
|
|
2693
|
-
};
|
|
3148
|
+
CalloutIcon.displayName = "CalloutIcon";
|
|
2694
3149
|
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
}
|
|
2701
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
2702
|
-
return 42 !== Object.defineProperty((function() {/* empty */}), "prototype", {
|
|
2703
|
-
value: 42,
|
|
2704
|
-
writable: !1
|
|
2705
|
-
}).prototype;
|
|
2706
|
-
})), 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) {
|
|
2707
|
-
if (isObject$1(argument)) return argument;
|
|
2708
|
-
throw new $TypeError$2($String$1(argument) + " is not an object");
|
|
2709
|
-
}, toPropertyKey = toPropertyKey$2, $TypeError$1 = TypeError, $defineProperty = Object.defineProperty, $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
3150
|
+
const CalloutMessage = forwardRef((({children: children, className: className = "", ...props}, ref) => jsx("div", {
|
|
3151
|
+
ref: ref,
|
|
3152
|
+
className: `c-callout__message ${className}`.trim(),
|
|
3153
|
+
...props,
|
|
3154
|
+
children: children
|
|
3155
|
+
})));
|
|
2710
3156
|
|
|
2711
|
-
|
|
2712
|
-
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
2713
|
-
objectDefineProperty.f = DESCRIPTORS$1 ? V8_PROTOTYPE_DEFINE_BUG ? function(O, P, Attributes) {
|
|
2714
|
-
if (anObject(O), P = toPropertyKey(P), anObject(Attributes), "function" == typeof O && "prototype" === P && "value" in Attributes && "writable" in Attributes && !Attributes.writable) {
|
|
2715
|
-
var current = $getOwnPropertyDescriptor(O, P);
|
|
2716
|
-
current && current.writable && (O[P] = Attributes.value, Attributes = {
|
|
2717
|
-
configurable: "configurable" in Attributes ? Attributes.configurable : current.configurable,
|
|
2718
|
-
enumerable: "enumerable" in Attributes ? Attributes.enumerable : current.enumerable,
|
|
2719
|
-
writable: !1
|
|
2720
|
-
});
|
|
2721
|
-
}
|
|
2722
|
-
return $defineProperty(O, P, Attributes);
|
|
2723
|
-
} : $defineProperty : function(O, P, Attributes) {
|
|
2724
|
-
if (anObject(O), P = toPropertyKey(P), anObject(Attributes), IE8_DOM_DEFINE) try {
|
|
2725
|
-
return $defineProperty(O, P, Attributes);
|
|
2726
|
-
} catch (error) {/* empty */}
|
|
2727
|
-
if ("get" in Attributes || "set" in Attributes) throw new $TypeError$1("Accessors not supported");
|
|
2728
|
-
return "value" in Attributes && (O[P] = Attributes.value), O;
|
|
2729
|
-
};
|
|
3157
|
+
CalloutMessage.displayName = "CalloutMessage";
|
|
2730
3158
|
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
return fn.apply(that, arguments);
|
|
2738
|
-
};
|
|
2739
|
-
}, createNonEnumerableProperty = createNonEnumerableProperty$1, hasOwn = hasOwnProperty_1, wrapConstructor = function(NativeConstructor) {
|
|
2740
|
-
var Wrapper = function(a, b, c) {
|
|
2741
|
-
if (this instanceof Wrapper) {
|
|
2742
|
-
switch (arguments.length) {
|
|
2743
|
-
case 0:
|
|
2744
|
-
return new NativeConstructor;
|
|
3159
|
+
const CalloutTitle = forwardRef((({children: children, className: className = "", ...props}, ref) => jsx("div", {
|
|
3160
|
+
ref: ref,
|
|
3161
|
+
className: `c-callout__title ${className}`.trim(),
|
|
3162
|
+
...props,
|
|
3163
|
+
children: children
|
|
3164
|
+
})));
|
|
2745
3165
|
|
|
2746
|
-
|
|
2747
|
-
return new NativeConstructor(a);
|
|
3166
|
+
CalloutTitle.displayName = "CalloutTitle";
|
|
2748
3167
|
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
};
|
|
2756
|
-
return Wrapper.prototype = NativeConstructor.prototype, Wrapper;
|
|
2757
|
-
}, _export = function(options, source) {
|
|
2758
|
-
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;
|
|
2759
|
-
for (key in source)
|
|
2760
|
-
// contains in native
|
|
2761
|
-
USE_NATIVE = !(FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? "." : "#") + key, options.forced)) && nativeSource && hasOwn(nativeSource, key),
|
|
2762
|
-
targetProperty = target[key], USE_NATIVE && (nativeProperty = options.dontCallGetSet ? (descriptor = getOwnPropertyDescriptor(nativeSource, key)) && descriptor.value : nativeSource[key]),
|
|
2763
|
-
// export native or implementation
|
|
2764
|
-
sourceProperty = USE_NATIVE && nativeProperty ? nativeProperty : source[key], (FORCED || PROTO || typeof targetProperty != typeof sourceProperty) && (
|
|
2765
|
-
// bind methods to global for calling from export context
|
|
2766
|
-
resultProperty = options.bind && USE_NATIVE ? bind(sourceProperty, globalThis$2) : options.wrap && USE_NATIVE ? wrapConstructor(sourceProperty) : PROTO && isCallable$1(sourceProperty) ? uncurryThis$1(sourceProperty) : sourceProperty,
|
|
2767
|
-
// add a flag to not completely full polyfills
|
|
2768
|
-
(options.sham || sourceProperty && sourceProperty.sham || targetProperty && targetProperty.sham) && createNonEnumerableProperty(resultProperty, "sham", !0),
|
|
2769
|
-
createNonEnumerableProperty(target, key, resultProperty), PROTO && (hasOwn(path$1, VIRTUAL_PROTOTYPE = TARGET + "Prototype") || createNonEnumerableProperty(path$1, VIRTUAL_PROTOTYPE, {}),
|
|
2770
|
-
// export virtual prototype methods
|
|
2771
|
-
createNonEnumerableProperty(path$1[VIRTUAL_PROTOTYPE], key, sourceProperty),
|
|
2772
|
-
// export real prototype methods
|
|
2773
|
-
options.real && targetPrototype && (FORCED || !targetPrototype[key]) && createNonEnumerableProperty(targetPrototype, key, sourceProperty)));
|
|
2774
|
-
}, ceil = Math.ceil, floor = Math.floor, trunc = Math.trunc || function(x) {
|
|
2775
|
-
var n = +x;
|
|
2776
|
-
return (n > 0 ? floor : ceil)(n);
|
|
2777
|
-
}, toIntegerOrInfinity$2 = function(argument) {
|
|
2778
|
-
var number = +argument;
|
|
2779
|
-
// eslint-disable-next-line no-self-compare -- NaN check
|
|
2780
|
-
return number != number || 0 === number ? 0 : trunc(number);
|
|
2781
|
-
}, toIntegerOrInfinity$1 = toIntegerOrInfinity$2, max = Math.max, min$1 = Math.min, toIntegerOrInfinity = toIntegerOrInfinity$2, min = Math.min, toIndexedObject = toIndexedObject$2, lengthOfArrayLike = function(obj) {
|
|
2782
|
-
return argument = obj.length, (len = toIntegerOrInfinity(argument)) > 0 ? min(len, 9007199254740991) : 0;
|
|
2783
|
-
var argument, len;
|
|
2784
|
-
}, createMethod = function(IS_INCLUDES) {
|
|
2785
|
-
return function($this, el, fromIndex) {
|
|
2786
|
-
var O = toIndexedObject($this), length = lengthOfArrayLike(O);
|
|
2787
|
-
if (0 === length) return !IS_INCLUDES && -1;
|
|
2788
|
-
var value, index = function(index, length) {
|
|
2789
|
-
var integer = toIntegerOrInfinity$1(index);
|
|
2790
|
-
return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
|
|
2791
|
-
}(fromIndex, length);
|
|
2792
|
-
// Array#includes uses SameValueZero equality algorithm
|
|
2793
|
-
// eslint-disable-next-line no-self-compare -- NaN check
|
|
2794
|
-
if (IS_INCLUDES && el != el) {
|
|
2795
|
-
for (;length > index; )
|
|
2796
|
-
// eslint-disable-next-line no-self-compare -- NaN check
|
|
2797
|
-
if ((value = O[index++]) != value) return !0;
|
|
2798
|
-
// Array#indexOf ignores holes, Array#includes - not
|
|
2799
|
-
} else for (;length > index; index++) if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
|
2800
|
-
return !IS_INCLUDES && -1;
|
|
2801
|
-
};
|
|
2802
|
-
}, $includes = [ createMethod(!0), createMethod(!1) ][0];
|
|
3168
|
+
const CalloutText = forwardRef((({children: children, className: className = "", ...props}, ref) => jsx("div", {
|
|
3169
|
+
ref: ref,
|
|
3170
|
+
className: `c-callout__text ${className}`.trim(),
|
|
3171
|
+
...props,
|
|
3172
|
+
children: children
|
|
3173
|
+
})));
|
|
2803
3174
|
|
|
2804
|
-
|
|
2805
|
-
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
2806
|
-
_export({
|
|
2807
|
-
target: "Array",
|
|
2808
|
-
proto: !0,
|
|
2809
|
-
forced: fails$8((function() {
|
|
2810
|
-
// eslint-disable-next-line es/no-array-prototype-includes -- detection
|
|
2811
|
-
return !Array(1).includes();
|
|
2812
|
-
}))
|
|
2813
|
-
}, {
|
|
2814
|
-
includes: function(el /* , fromIndex = 0 */) {
|
|
2815
|
-
return $includes(this, el, arguments.length > 1 ? arguments[1] : void 0);
|
|
2816
|
-
}
|
|
2817
|
-
});
|
|
3175
|
+
CalloutText.displayName = "CalloutText";
|
|
2818
3176
|
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
}
|
|
3177
|
+
const CalloutActions = forwardRef((({children: children, className: className = "", ...props}, ref) => jsx("div", {
|
|
3178
|
+
ref: ref,
|
|
3179
|
+
className: `c-callout__actions ${className}`.trim(),
|
|
3180
|
+
...props,
|
|
3181
|
+
children: children
|
|
3182
|
+
})));
|
|
2825
3183
|
|
|
2826
|
-
|
|
3184
|
+
CalloutActions.displayName = "CalloutActions";
|
|
3185
|
+
|
|
3186
|
+
const CalloutCloseButton = forwardRef((({onClick: onClick, className: className = "", ...props}, ref) => jsx("button", {
|
|
3187
|
+
ref: ref,
|
|
3188
|
+
className: `c-callout__close-btn ${className}`.trim(),
|
|
3189
|
+
onClick: onClick,
|
|
3190
|
+
"aria-label": "Close",
|
|
3191
|
+
...props,
|
|
3192
|
+
children: jsx(Icon, {
|
|
3193
|
+
name: "X",
|
|
3194
|
+
size: "md"
|
|
3195
|
+
})
|
|
3196
|
+
})));
|
|
2827
3197
|
|
|
2828
|
-
|
|
2829
|
-
return arguments;
|
|
2830
|
-
}()), classof = TO_STRING_TAG_SUPPORT ? classofRaw : function(it) {
|
|
2831
|
-
var O, tag, result;
|
|
2832
|
-
return void 0 === it ? "Undefined" : null === it ? "Null" : "string" == typeof (tag = function(it, key) {
|
|
2833
|
-
try {
|
|
2834
|
-
return it[key];
|
|
2835
|
-
} catch (error) {/* empty */}
|
|
2836
|
-
}(O = $Object(it), TO_STRING_TAG)) ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : "Object" === (result = classofRaw(O)) && isCallable(O.callee) ? "Arguments" : result;
|
|
2837
|
-
}, $String = String, MATCH = wellKnownSymbol$5("match"), $ = _export, notARegExp = function(it) {
|
|
2838
|
-
if (function(it) {
|
|
2839
|
-
var isRegExp;
|
|
2840
|
-
return isObject(it) && (void 0 !== (isRegExp = it[MATCH$1]) ? !!isRegExp : "RegExp" === classof$2(it));
|
|
2841
|
-
}(it)) throw new $TypeError("The method doesn't accept regular expressions");
|
|
2842
|
-
return it;
|
|
2843
|
-
}, requireObjectCoercible = requireObjectCoercible$3, toString = function(argument) {
|
|
2844
|
-
if ("Symbol" === classof(argument)) throw new TypeError("Cannot convert a Symbol value to a string");
|
|
2845
|
-
return $String(argument);
|
|
2846
|
-
}, stringIndexOf = functionUncurryThis("".indexOf);
|
|
3198
|
+
CalloutCloseButton.displayName = "CalloutCloseButton";
|
|
2847
3199
|
|
|
2848
|
-
//
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
try {
|
|
2856
|
-
"/./"[METHOD_NAME](regexp);
|
|
2857
|
-
} catch (error1) {
|
|
2858
|
-
try {
|
|
2859
|
-
return regexp[MATCH] = !1, "/./"[METHOD_NAME](regexp);
|
|
2860
|
-
} catch (error2) {/* empty */}
|
|
2861
|
-
}
|
|
2862
|
-
return !1;
|
|
2863
|
-
}("includes")
|
|
2864
|
-
}, {
|
|
2865
|
-
includes: function(searchString /* , position = 0 */) {
|
|
2866
|
-
return !!~stringIndexOf(toString(requireObjectCoercible(this)), toString(notARegExp(searchString)), arguments.length > 1 ? arguments[1] : void 0);
|
|
2867
|
-
}
|
|
2868
|
-
});
|
|
3200
|
+
// Wrapper for content (icon + message)
|
|
3201
|
+
const CalloutContent = forwardRef((({children: children, className: className = "", ...props}, ref) => jsx("div", {
|
|
3202
|
+
ref: ref,
|
|
3203
|
+
className: `c-callout__content ${className}`.trim(),
|
|
3204
|
+
...props,
|
|
3205
|
+
children: children
|
|
3206
|
+
})));
|
|
2869
3207
|
|
|
2870
|
-
|
|
3208
|
+
CalloutContent.displayName = "CalloutContent";
|
|
2871
3209
|
|
|
2872
|
-
const
|
|
2873
|
-
var own = it.includes;
|
|
2874
|
-
return it === ArrayPrototype || isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.includes ? arrayMethod : "string" == typeof it || it === StringPrototype || isPrototypeOf(StringPrototype, it) && own === StringPrototype.includes ? stringMethod : own;
|
|
2875
|
-
})), Callout = ({title: title, children: children, icon: icon, variant: variant = "primary", onClose: onClose, actions: actions, compact: compact = !1, isToast: isToast = !1, glass: glass, className: className, style: style, ...props}) => {
|
|
3210
|
+
const Callout = memo((({title: title, children: children, icon: icon, variant: variant = "primary", onClose: onClose, actions: actions, compact: compact = !1, isToast: isToast = !1, glass: glass, className: className, style: style, ...props}) => {
|
|
2876
3211
|
const {generateCalloutClass: generateCalloutClass, handleClose: handleClose} =
|
|
2877
3212
|
/**
|
|
2878
3213
|
* Callout state and functionality
|
|
@@ -2902,10 +3237,7 @@ const _includesInstanceProperty = getDefaultExportFromCjs((function(it) {
|
|
|
2902
3237
|
handler && handler();
|
|
2903
3238
|
}
|
|
2904
3239
|
};
|
|
2905
|
-
}
|
|
2906
|
-
/**
|
|
2907
|
-
* Callout component for displaying important messages, notifications, or alerts
|
|
2908
|
-
*/ ({
|
|
3240
|
+
}({
|
|
2909
3241
|
variant: variant,
|
|
2910
3242
|
compact: compact,
|
|
2911
3243
|
isToast: isToast,
|
|
@@ -2921,7 +3253,11 @@ const _includesInstanceProperty = getDefaultExportFromCjs((function(it) {
|
|
|
2921
3253
|
return isToast ? (baseAttributes.role = "alert", baseAttributes["aria-live"] = "polite") : _includesInstanceProperty(_context = [ "warning", "error" ]).call(_context, variant) ? (baseAttributes.role = "alert",
|
|
2922
3254
|
baseAttributes["aria-live"] = "assertive") : _includesInstanceProperty(_context2 = [ "info", "success" ]).call(_context2, variant) && (baseAttributes.role = "status",
|
|
2923
3255
|
baseAttributes["aria-live"] = "polite"), baseAttributes;
|
|
2924
|
-
}, calloutContent =
|
|
3256
|
+
}, calloutContent = React.Children.toArray(children).some((child => {
|
|
3257
|
+
var _context3;
|
|
3258
|
+
|
|
3259
|
+
return React.isValidElement(child) && _includesInstanceProperty(_context3 = [ "CalloutIcon", "CalloutMessage", "CalloutTitle", "CalloutText", "CalloutActions", "CalloutContent" ]).call(_context3, child.type.displayName);
|
|
3260
|
+
})) ? children : jsxs(Fragment, {
|
|
2925
3261
|
children: [ jsxs("div", {
|
|
2926
3262
|
className: "c-callout__content",
|
|
2927
3263
|
children: [ icon && jsx("div", {
|
|
@@ -2955,7 +3291,7 @@ const _includesInstanceProperty = getDefaultExportFromCjs((function(it) {
|
|
|
2955
3291
|
// Default glass settings for callouts
|
|
2956
3292
|
const defaultGlassProps = {
|
|
2957
3293
|
displacementScale: 30,
|
|
2958
|
-
|
|
3294
|
+
borderRadius: 8,
|
|
2959
3295
|
elasticity: 0
|
|
2960
3296
|
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
2961
3297
|
...defaultGlassProps,
|
|
@@ -2977,7 +3313,7 @@ const _includesInstanceProperty = getDefaultExportFromCjs((function(it) {
|
|
|
2977
3313
|
children: jsx("div", {
|
|
2978
3314
|
className: "c-callout__glass-content",
|
|
2979
3315
|
style: {
|
|
2980
|
-
borderRadius: glassProps.
|
|
3316
|
+
borderRadius: glassProps.borderRadius
|
|
2981
3317
|
},
|
|
2982
3318
|
children: calloutContent
|
|
2983
3319
|
})
|
|
@@ -2997,9 +3333,22 @@ const _includesInstanceProperty = getDefaultExportFromCjs((function(it) {
|
|
|
2997
3333
|
style: style,
|
|
2998
3334
|
children: calloutContent
|
|
2999
3335
|
});
|
|
3000
|
-
};
|
|
3336
|
+
}));
|
|
3337
|
+
|
|
3338
|
+
Callout.displayName = "Callout",
|
|
3339
|
+
// Attach subcomponents
|
|
3340
|
+
Callout.Icon = CalloutIcon, Callout.Message = CalloutMessage, Callout.Title = CalloutTitle,
|
|
3341
|
+
Callout.Text = CalloutText, Callout.Actions = CalloutActions, Callout.CloseButton = CalloutCloseButton,
|
|
3342
|
+
Callout.Content = CalloutContent;
|
|
3343
|
+
|
|
3344
|
+
const ListItem = forwardRef((({children: children, className: className = "", ...props}, ref) => jsx("li", {
|
|
3345
|
+
ref: ref,
|
|
3346
|
+
className: `${LIST.ITEM_CLASS} ${className}`.trim(),
|
|
3347
|
+
...props,
|
|
3348
|
+
children: children
|
|
3349
|
+
})));
|
|
3001
3350
|
|
|
3002
|
-
|
|
3351
|
+
ListItem.displayName = "ListItem";
|
|
3003
3352
|
|
|
3004
3353
|
const List = memo((({children: children, variant: variant = "default", className: className = "", style: style, ...props}) => {
|
|
3005
3354
|
var _context;
|
|
@@ -3010,14 +3359,14 @@ const List = memo((({children: children, variant: variant = "default", classNam
|
|
|
3010
3359
|
className: listClasses,
|
|
3011
3360
|
style: style,
|
|
3012
3361
|
...props,
|
|
3013
|
-
children: React.Children.map(children, (child => jsx("li", {
|
|
3362
|
+
children: React.Children.map(children, (child => React.isValidElement(child) && child.type === ListItem ? child : jsx("li", {
|
|
3014
3363
|
className: "c-list__item",
|
|
3015
3364
|
children: child
|
|
3016
3365
|
})))
|
|
3017
3366
|
});
|
|
3018
3367
|
}));
|
|
3019
3368
|
|
|
3020
|
-
List.displayName = "List";
|
|
3369
|
+
List.displayName = "List", List.Item = ListItem;
|
|
3021
3370
|
|
|
3022
3371
|
const ListGroup = ({children: children, className: className = "", style: style, variant: variant = "default"}) => {
|
|
3023
3372
|
// Generate CSS classes
|