@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/index.js
CHANGED
|
@@ -28,7 +28,377 @@ function _interopNamespaceCompat(e) {
|
|
|
28
28
|
})), n.default = e, Object.freeze(n);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
var React__default = _interopDefaultCompat(React), PhosphorIcons__namespace = _interopNamespaceCompat(PhosphorIcons);
|
|
31
|
+
var React__default = _interopDefaultCompat(React), PhosphorIcons__namespace = _interopNamespaceCompat(PhosphorIcons), commonjsGlobal = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {};
|
|
32
|
+
|
|
33
|
+
function getDefaultExportFromCjs(x) {
|
|
34
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x.default : x;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var fails$9 = function(exec) {
|
|
38
|
+
try {
|
|
39
|
+
return !!exec();
|
|
40
|
+
} catch (error) {
|
|
41
|
+
return !0;
|
|
42
|
+
}
|
|
43
|
+
}, functionBindNative = !fails$9((function() {
|
|
44
|
+
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
|
45
|
+
var test = function() {/* empty */}.bind();
|
|
46
|
+
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
47
|
+
return "function" != typeof test || test.hasOwnProperty("prototype");
|
|
48
|
+
})), 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) {
|
|
49
|
+
return function() {
|
|
50
|
+
return call$5.apply(fn, arguments);
|
|
51
|
+
};
|
|
52
|
+
}, objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf), check = function(it) {
|
|
53
|
+
return it && it.Math === Math && it;
|
|
54
|
+
}, globalThis_1 =
|
|
55
|
+
// eslint-disable-next-line es/no-global-this -- safe
|
|
56
|
+
check("object" == typeof globalThis && globalThis) || check("object" == typeof window && window) ||
|
|
57
|
+
// eslint-disable-next-line no-restricted-globals -- safe
|
|
58
|
+
check("object" == typeof self && self) || check("object" == typeof commonjsGlobal && commonjsGlobal) || check("object" == typeof commonjsGlobal && commonjsGlobal) ||
|
|
59
|
+
// eslint-disable-next-line no-new-func -- fallback
|
|
60
|
+
function() {
|
|
61
|
+
return this;
|
|
62
|
+
}() || 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() {
|
|
63
|
+
return call$4.apply(apply$1, arguments);
|
|
64
|
+
}), uncurryThis$7 = functionUncurryThis, toString$3 = uncurryThis$7({}.toString), stringSlice = uncurryThis$7("".slice), classofRaw$2 = function(it) {
|
|
65
|
+
return stringSlice(toString$3(it), 8, -1);
|
|
66
|
+
}, classofRaw$1 = classofRaw$2, uncurryThis$6 = functionUncurryThis, functionUncurryThisClause = function(fn) {
|
|
67
|
+
// Nashorn bug:
|
|
68
|
+
// https://github.com/zloirock/core-js/issues/1128
|
|
69
|
+
// https://github.com/zloirock/core-js/issues/1130
|
|
70
|
+
if ("Function" === classofRaw$1(fn)) return uncurryThis$6(fn);
|
|
71
|
+
}, documentAll = "object" == typeof document && document.all, isCallable$8 = void 0 === documentAll && void 0 !== documentAll ? function(argument) {
|
|
72
|
+
return "function" == typeof argument || argument === documentAll;
|
|
73
|
+
} : function(argument) {
|
|
74
|
+
return "function" == typeof argument;
|
|
75
|
+
}, objectGetOwnPropertyDescriptor = {}, descriptors = !fails$9((function() {
|
|
76
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
77
|
+
return 7 !== Object.defineProperty({}, 1, {
|
|
78
|
+
get: function() {
|
|
79
|
+
return 7;
|
|
80
|
+
}
|
|
81
|
+
})[1];
|
|
82
|
+
})), NATIVE_BIND$1 = functionBindNative, call$3 = Function.prototype.call, functionCall = NATIVE_BIND$1 ? call$3.bind(call$3) : function() {
|
|
83
|
+
return call$3.apply(call$3, arguments);
|
|
84
|
+
}, objectPropertyIsEnumerable = {}, $propertyIsEnumerable = {}.propertyIsEnumerable, getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor, NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({
|
|
85
|
+
1: 2
|
|
86
|
+
}, 1);
|
|
87
|
+
|
|
88
|
+
// `Object.prototype.propertyIsEnumerable` method implementation
|
|
89
|
+
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
|
90
|
+
objectPropertyIsEnumerable.f = NASHORN_BUG ? function(V) {
|
|
91
|
+
var descriptor = getOwnPropertyDescriptor$1(this, V);
|
|
92
|
+
return !!descriptor && descriptor.enumerable;
|
|
93
|
+
} : $propertyIsEnumerable;
|
|
94
|
+
|
|
95
|
+
var match, version, createPropertyDescriptor$2 = function(bitmap, value) {
|
|
96
|
+
return {
|
|
97
|
+
enumerable: !(1 & bitmap),
|
|
98
|
+
configurable: !(2 & bitmap),
|
|
99
|
+
writable: !(4 & bitmap),
|
|
100
|
+
value: value
|
|
101
|
+
};
|
|
102
|
+
}, fails$6 = fails$9, classof$4 = classofRaw$2, $Object$3 = Object, split = functionUncurryThis("".split), indexedObject = fails$6((function() {
|
|
103
|
+
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
104
|
+
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
105
|
+
return !$Object$3("z").propertyIsEnumerable(0);
|
|
106
|
+
})) ? function(it) {
|
|
107
|
+
return "String" === classof$4(it) ? split(it, "") : $Object$3(it);
|
|
108
|
+
} : $Object$3, isNullOrUndefined$2 = function(it) {
|
|
109
|
+
return null == it;
|
|
110
|
+
}, isNullOrUndefined$1 = isNullOrUndefined$2, $TypeError$7 = TypeError, requireObjectCoercible$3 = function(it) {
|
|
111
|
+
if (isNullOrUndefined$1(it)) throw new $TypeError$7("Can't call method on " + it);
|
|
112
|
+
return it;
|
|
113
|
+
}, IndexedObject$1 = indexedObject, requireObjectCoercible$2 = requireObjectCoercible$3, toIndexedObject$2 = function(it) {
|
|
114
|
+
return IndexedObject$1(requireObjectCoercible$2(it));
|
|
115
|
+
}, isCallable$7 = isCallable$8, isObject$6 = function(it) {
|
|
116
|
+
return "object" == typeof it ? null !== it : isCallable$7(it);
|
|
117
|
+
}, path$3 = {}, path$2 = path$3, globalThis$b = globalThis_1, isCallable$6 = isCallable$8, aFunction = function(variable) {
|
|
118
|
+
return isCallable$6(variable) ? variable : void 0;
|
|
119
|
+
}, navigator$1 = globalThis_1.navigator, userAgent$2 = navigator$1 && navigator$1.userAgent, environmentUserAgent = userAgent$2 ? String(userAgent$2) : "", globalThis$9 = globalThis_1, userAgent$1 = environmentUserAgent, process$1 = globalThis$9.process, Deno$1 = globalThis$9.Deno, versions = process$1 && process$1.versions || Deno$1 && Deno$1.version, v8 = versions && versions.v8;
|
|
120
|
+
|
|
121
|
+
v8 && (
|
|
122
|
+
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
|
123
|
+
// but their correct versions are not interesting for us
|
|
124
|
+
version = (match = v8.split("."))[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1])),
|
|
125
|
+
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
|
126
|
+
// so check `userAgent` even if `.v8` exists, but 0
|
|
127
|
+
!version && userAgent$1 && (!(match = userAgent$1.match(/Edge\/(\d+)/)) || match[1] >= 74) && (match = userAgent$1.match(/Chrome\/(\d+)/)) && (version = +match[1]);
|
|
128
|
+
|
|
129
|
+
var environmentV8Version = version, V8_VERSION = environmentV8Version, fails$5 = fails$9, $String$3 = globalThis_1.String, symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$5((function() {
|
|
130
|
+
var symbol = Symbol("symbol detection");
|
|
131
|
+
// Chrome 38 Symbol has incorrect toString conversion
|
|
132
|
+
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
133
|
+
// nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
|
|
134
|
+
// of course, fail.
|
|
135
|
+
return !$String$3(symbol) || !(Object(symbol) instanceof Symbol) ||
|
|
136
|
+
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
|
137
|
+
!Symbol.sham && V8_VERSION && V8_VERSION < 41;
|
|
138
|
+
})), useSymbolAsUid = symbolConstructorDetection && !Symbol.sham && "symbol" == typeof Symbol.iterator, isCallable$5 = isCallable$8, isPrototypeOf$2 = objectIsPrototypeOf, $Object$2 = Object, isSymbol$2 = useSymbolAsUid ? function(it) {
|
|
139
|
+
return "symbol" == typeof it;
|
|
140
|
+
} : function(it) {
|
|
141
|
+
var $Symbol = function(namespace, method) {
|
|
142
|
+
return arguments.length < 2 ? aFunction(path$2[namespace]) || aFunction(globalThis$b[namespace]) : path$2[namespace] && path$2[namespace][method] || globalThis$b[namespace] && globalThis$b[namespace][method];
|
|
143
|
+
}("Symbol");
|
|
144
|
+
return isCallable$5($Symbol) && isPrototypeOf$2($Symbol.prototype, $Object$2(it));
|
|
145
|
+
}, $String$2 = String, isCallable$4 = isCallable$8, $TypeError$6 = TypeError, aCallable$3 = function(argument) {
|
|
146
|
+
if (isCallable$4(argument)) return argument;
|
|
147
|
+
throw new $TypeError$6(function(argument) {
|
|
148
|
+
try {
|
|
149
|
+
return $String$2(argument);
|
|
150
|
+
} catch (error) {
|
|
151
|
+
return "Object";
|
|
152
|
+
}
|
|
153
|
+
}(argument) + " is not a function");
|
|
154
|
+
}, aCallable$2 = aCallable$3, isNullOrUndefined = isNullOrUndefined$2, call$2 = functionCall, isCallable$3 = isCallable$8, isObject$5 = isObject$6, $TypeError$5 = TypeError, sharedStore = {
|
|
155
|
+
exports: {}
|
|
156
|
+
}, globalThis$7 = globalThis_1, defineProperty = Object.defineProperty, globalThis$6 = globalThis_1, store$1 = sharedStore.exports = globalThis$6["__core-js_shared__"] || function(key, value) {
|
|
157
|
+
try {
|
|
158
|
+
defineProperty(globalThis$7, key, {
|
|
159
|
+
value: value,
|
|
160
|
+
configurable: !0,
|
|
161
|
+
writable: !0
|
|
162
|
+
});
|
|
163
|
+
} catch (error) {
|
|
164
|
+
globalThis$7[key] = value;
|
|
165
|
+
}
|
|
166
|
+
return value;
|
|
167
|
+
}("__core-js_shared__", {});
|
|
168
|
+
|
|
169
|
+
/* eslint-disable es/no-symbol -- required for testing */ (store$1.versions || (store$1.versions = [])).push({
|
|
170
|
+
version: "3.43.0",
|
|
171
|
+
mode: "pure",
|
|
172
|
+
copyright: "© 2014-2025 Denis Pushkarev (zloirock.ru)",
|
|
173
|
+
license: "https://github.com/zloirock/core-js/blob/v3.43.0/LICENSE",
|
|
174
|
+
source: "https://github.com/zloirock/core-js"
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
var key, value, store = sharedStore.exports, requireObjectCoercible$1 = requireObjectCoercible$3, $Object$1 = Object, toObject$2 = function(argument) {
|
|
178
|
+
return $Object$1(requireObjectCoercible$1(argument));
|
|
179
|
+
}, toObject$1 = toObject$2, hasOwnProperty = functionUncurryThis({}.hasOwnProperty), hasOwnProperty_1 = Object.hasOwn || function(it, key) {
|
|
180
|
+
return hasOwnProperty(toObject$1(it), key);
|
|
181
|
+
}, 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) {
|
|
182
|
+
return "Symbol(" + (void 0 === key ? "" : key) + ")_" + toString$2(++id + postfix, 36);
|
|
183
|
+
}, wellKnownSymbol$5 = function(name) {
|
|
184
|
+
return hasOwn$2(WellKnownSymbolsStore, name) || (WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$2(Symbol$1, name) ? Symbol$1[name] : createWellKnownSymbol("Symbol." + name)),
|
|
185
|
+
WellKnownSymbolsStore[name];
|
|
186
|
+
}, call$1 = functionCall, isObject$4 = isObject$6, isSymbol$1 = isSymbol$2, $TypeError$4 = TypeError, TO_PRIMITIVE = wellKnownSymbol$5("toPrimitive"), toPrimitive = function(input, pref) {
|
|
187
|
+
if (!isObject$4(input) || isSymbol$1(input)) return input;
|
|
188
|
+
var result, func, exoticToPrim = (func = input[TO_PRIMITIVE], isNullOrUndefined(func) ? void 0 : aCallable$2(func));
|
|
189
|
+
if (exoticToPrim) {
|
|
190
|
+
if (void 0 === pref && (pref = "default"), result = call$1(exoticToPrim, input, pref),
|
|
191
|
+
!isObject$4(result) || isSymbol$1(result)) return result;
|
|
192
|
+
throw new $TypeError$4("Can't convert object to primitive value");
|
|
193
|
+
}
|
|
194
|
+
return void 0 === pref && (pref = "number"), function(input, pref) {
|
|
195
|
+
var fn, val;
|
|
196
|
+
if ("string" === pref && isCallable$3(fn = input.toString) && !isObject$5(val = call$2(fn, input))) return val;
|
|
197
|
+
if (isCallable$3(fn = input.valueOf) && !isObject$5(val = call$2(fn, input))) return val;
|
|
198
|
+
if ("string" !== pref && isCallable$3(fn = input.toString) && !isObject$5(val = call$2(fn, input))) return val;
|
|
199
|
+
throw new $TypeError$5("Can't convert object to primitive value");
|
|
200
|
+
}(input, pref);
|
|
201
|
+
}, isSymbol = isSymbol$2, toPropertyKey$2 = function(argument) {
|
|
202
|
+
var key = toPrimitive(argument, "string");
|
|
203
|
+
return isSymbol(key) ? key : key + "";
|
|
204
|
+
}, isObject$3 = isObject$6, document$1 = globalThis_1.document, EXISTS = isObject$3(document$1) && isObject$3(document$1.createElement), ie8DomDefine = !descriptors && !fails$9((function() {
|
|
205
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
206
|
+
return 7 !== Object.defineProperty((it = "div", EXISTS ? document$1.createElement(it) : {}), "a", {
|
|
207
|
+
get: function() {
|
|
208
|
+
return 7;
|
|
209
|
+
}
|
|
210
|
+
}).a;
|
|
211
|
+
var it;
|
|
212
|
+
})), 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;
|
|
213
|
+
|
|
214
|
+
// `Object.getOwnPropertyDescriptor` method
|
|
215
|
+
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
|
216
|
+
objectGetOwnPropertyDescriptor.f = DESCRIPTORS$3 ? $getOwnPropertyDescriptor$1 : function(O, P) {
|
|
217
|
+
if (O = toIndexedObject$1(O), P = toPropertyKey$1(P), IE8_DOM_DEFINE$1) try {
|
|
218
|
+
return $getOwnPropertyDescriptor$1(O, P);
|
|
219
|
+
} catch (error) {/* empty */}
|
|
220
|
+
if (hasOwn$1(O, P)) return createPropertyDescriptor$1(!call(propertyIsEnumerableModule.f, O, P), O[P]);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
var fails$3 = fails$9, isCallable$2 = isCallable$8, replacement = /#|\.prototype\./, isForced$1 = function(feature, detection) {
|
|
224
|
+
var value = data[normalize(feature)];
|
|
225
|
+
return value === POLYFILL || value !== NATIVE && (isCallable$2(detection) ? fails$3(detection) : !!detection);
|
|
226
|
+
}, normalize = isForced$1.normalize = function(string) {
|
|
227
|
+
return String(string).replace(replacement, ".").toLowerCase();
|
|
228
|
+
}, data = isForced$1.data = {}, NATIVE = isForced$1.NATIVE = "N", POLYFILL = isForced$1.POLYFILL = "P", isForced_1 = isForced$1, aCallable$1 = aCallable$3, NATIVE_BIND = functionBindNative, bind$1 = functionUncurryThisClause(functionUncurryThisClause.bind), objectDefineProperty = {}, v8PrototypeDefineBug = descriptors && fails$9((function() {
|
|
229
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
230
|
+
return 42 !== Object.defineProperty((function() {/* empty */}), "prototype", {
|
|
231
|
+
value: 42,
|
|
232
|
+
writable: !1
|
|
233
|
+
}).prototype;
|
|
234
|
+
})), isObject$2 = isObject$6, $String$1 = String, $TypeError$3 = TypeError, DESCRIPTORS$1 = descriptors, IE8_DOM_DEFINE = ie8DomDefine, V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug, anObject = function(argument) {
|
|
235
|
+
if (isObject$2(argument)) return argument;
|
|
236
|
+
throw new $TypeError$3($String$1(argument) + " is not an object");
|
|
237
|
+
}, toPropertyKey = toPropertyKey$2, $TypeError$2 = TypeError, $defineProperty = Object.defineProperty, $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
238
|
+
|
|
239
|
+
// `Object.defineProperty` method
|
|
240
|
+
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
241
|
+
objectDefineProperty.f = DESCRIPTORS$1 ? V8_PROTOTYPE_DEFINE_BUG ? function(O, P, Attributes) {
|
|
242
|
+
if (anObject(O), P = toPropertyKey(P), anObject(Attributes), "function" == typeof O && "prototype" === P && "value" in Attributes && "writable" in Attributes && !Attributes.writable) {
|
|
243
|
+
var current = $getOwnPropertyDescriptor(O, P);
|
|
244
|
+
current && current.writable && (O[P] = Attributes.value, Attributes = {
|
|
245
|
+
configurable: "configurable" in Attributes ? Attributes.configurable : current.configurable,
|
|
246
|
+
enumerable: "enumerable" in Attributes ? Attributes.enumerable : current.enumerable,
|
|
247
|
+
writable: !1
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
return $defineProperty(O, P, Attributes);
|
|
251
|
+
} : $defineProperty : function(O, P, Attributes) {
|
|
252
|
+
if (anObject(O), P = toPropertyKey(P), anObject(Attributes), IE8_DOM_DEFINE) try {
|
|
253
|
+
return $defineProperty(O, P, Attributes);
|
|
254
|
+
} catch (error) {/* empty */}
|
|
255
|
+
if ("get" in Attributes || "set" in Attributes) throw new $TypeError$2("Accessors not supported");
|
|
256
|
+
return "value" in Attributes && (O[P] = Attributes.value), O;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
var definePropertyModule = objectDefineProperty, createPropertyDescriptor = createPropertyDescriptor$2, createNonEnumerableProperty$1 = descriptors ? function(object, key, value) {
|
|
260
|
+
return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
|
|
261
|
+
} : function(object, key, value) {
|
|
262
|
+
return object[key] = value, object;
|
|
263
|
+
}, globalThis$3 = 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) {
|
|
264
|
+
return aCallable$1(fn), void 0 === that ? fn : NATIVE_BIND ? bind$1(fn, that) : function() {
|
|
265
|
+
return fn.apply(that, arguments);
|
|
266
|
+
};
|
|
267
|
+
}, createNonEnumerableProperty = createNonEnumerableProperty$1, hasOwn = hasOwnProperty_1, wrapConstructor = function(NativeConstructor) {
|
|
268
|
+
var Wrapper = function(a, b, c) {
|
|
269
|
+
if (this instanceof Wrapper) {
|
|
270
|
+
switch (arguments.length) {
|
|
271
|
+
case 0:
|
|
272
|
+
return new NativeConstructor;
|
|
273
|
+
|
|
274
|
+
case 1:
|
|
275
|
+
return new NativeConstructor(a);
|
|
276
|
+
|
|
277
|
+
case 2:
|
|
278
|
+
return new NativeConstructor(a, b);
|
|
279
|
+
}
|
|
280
|
+
return new NativeConstructor(a, b, c);
|
|
281
|
+
}
|
|
282
|
+
return apply(NativeConstructor, this, arguments);
|
|
283
|
+
};
|
|
284
|
+
return Wrapper.prototype = NativeConstructor.prototype, Wrapper;
|
|
285
|
+
}, _export = function(options, source) {
|
|
286
|
+
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$3 : STATIC ? globalThis$3[TARGET] : globalThis$3[TARGET] && globalThis$3[TARGET].prototype, target = GLOBAL ? path$1 : path$1[TARGET] || createNonEnumerableProperty(path$1, TARGET, {})[TARGET], targetPrototype = target.prototype;
|
|
287
|
+
for (key in source)
|
|
288
|
+
// contains in native
|
|
289
|
+
USE_NATIVE = !(FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? "." : "#") + key, options.forced)) && nativeSource && hasOwn(nativeSource, key),
|
|
290
|
+
targetProperty = target[key], USE_NATIVE && (nativeProperty = options.dontCallGetSet ? (descriptor = getOwnPropertyDescriptor(nativeSource, key)) && descriptor.value : nativeSource[key]),
|
|
291
|
+
// export native or implementation
|
|
292
|
+
sourceProperty = USE_NATIVE && nativeProperty ? nativeProperty : source[key], (FORCED || PROTO || typeof targetProperty != typeof sourceProperty) && (
|
|
293
|
+
// bind methods to global for calling from export context
|
|
294
|
+
resultProperty = options.bind && USE_NATIVE ? bind(sourceProperty, globalThis$3) : options.wrap && USE_NATIVE ? wrapConstructor(sourceProperty) : PROTO && isCallable$1(sourceProperty) ? uncurryThis$1(sourceProperty) : sourceProperty,
|
|
295
|
+
// add a flag to not completely full polyfills
|
|
296
|
+
(options.sham || sourceProperty && sourceProperty.sham || targetProperty && targetProperty.sham) && createNonEnumerableProperty(resultProperty, "sham", !0),
|
|
297
|
+
createNonEnumerableProperty(target, key, resultProperty), PROTO && (hasOwn(path$1, VIRTUAL_PROTOTYPE = TARGET + "Prototype") || createNonEnumerableProperty(path$1, VIRTUAL_PROTOTYPE, {}),
|
|
298
|
+
// export virtual prototype methods
|
|
299
|
+
createNonEnumerableProperty(path$1[VIRTUAL_PROTOTYPE], key, sourceProperty),
|
|
300
|
+
// export real prototype methods
|
|
301
|
+
options.real && targetPrototype && (FORCED || !targetPrototype[key]) && createNonEnumerableProperty(targetPrototype, key, sourceProperty)));
|
|
302
|
+
}, ceil = Math.ceil, floor = Math.floor, trunc = Math.trunc || function(x) {
|
|
303
|
+
var n = +x;
|
|
304
|
+
return (n > 0 ? floor : ceil)(n);
|
|
305
|
+
}, toIntegerOrInfinity$2 = function(argument) {
|
|
306
|
+
var number = +argument;
|
|
307
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
308
|
+
return number != number || 0 === number ? 0 : trunc(number);
|
|
309
|
+
}, toIntegerOrInfinity$1 = toIntegerOrInfinity$2, max = Math.max, min$1 = Math.min, toIntegerOrInfinity = toIntegerOrInfinity$2, min = Math.min, lengthOfArrayLike$2 = function(obj) {
|
|
310
|
+
return argument = obj.length, (len = toIntegerOrInfinity(argument)) > 0 ? min(len, 9007199254740991) : 0;
|
|
311
|
+
var argument, len;
|
|
312
|
+
}, toIndexedObject = toIndexedObject$2, lengthOfArrayLike$1 = lengthOfArrayLike$2, createMethod$1 = function(IS_INCLUDES) {
|
|
313
|
+
return function($this, el, fromIndex) {
|
|
314
|
+
var O = toIndexedObject($this), length = lengthOfArrayLike$1(O);
|
|
315
|
+
if (0 === length) return !IS_INCLUDES && -1;
|
|
316
|
+
var value, index = function(index, length) {
|
|
317
|
+
var integer = toIntegerOrInfinity$1(index);
|
|
318
|
+
return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
|
|
319
|
+
}(fromIndex, length);
|
|
320
|
+
// Array#includes uses SameValueZero equality algorithm
|
|
321
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
322
|
+
if (IS_INCLUDES && el != el) {
|
|
323
|
+
for (;length > index; )
|
|
324
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
325
|
+
if ((value = O[index++]) != value) return !0;
|
|
326
|
+
// Array#indexOf ignores holes, Array#includes - not
|
|
327
|
+
} else for (;length > index; index++) if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
|
328
|
+
return !IS_INCLUDES && -1;
|
|
329
|
+
};
|
|
330
|
+
}, $includes = [ createMethod$1(!0), createMethod$1(!1) ][0];
|
|
331
|
+
|
|
332
|
+
// `Array.prototype.includes` method
|
|
333
|
+
// https://tc39.es/ecma262/#sec-array.prototype.includes
|
|
334
|
+
_export({
|
|
335
|
+
target: "Array",
|
|
336
|
+
proto: !0,
|
|
337
|
+
forced: fails$9((function() {
|
|
338
|
+
// eslint-disable-next-line es/no-array-prototype-includes -- detection
|
|
339
|
+
return !Array(1).includes();
|
|
340
|
+
}))
|
|
341
|
+
}, {
|
|
342
|
+
includes: function(el /* , fromIndex = 0 */) {
|
|
343
|
+
return $includes(this, el, arguments.length > 1 ? arguments[1] : void 0);
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
var globalThis$2 = globalThis_1, path = path$3, getBuiltInPrototypeMethod$3 = function(CONSTRUCTOR, METHOD) {
|
|
348
|
+
var Namespace = path[CONSTRUCTOR + "Prototype"], pureMethod = Namespace && Namespace[METHOD];
|
|
349
|
+
if (pureMethod) return pureMethod;
|
|
350
|
+
var NativeConstructor = globalThis$2[CONSTRUCTOR], NativePrototype = NativeConstructor && NativeConstructor.prototype;
|
|
351
|
+
return NativePrototype && NativePrototype[METHOD];
|
|
352
|
+
}, includes$4 = getBuiltInPrototypeMethod$3("Array", "includes"), isObject$1 = isObject$6, classof$3 = classofRaw$2, MATCH$1 = wellKnownSymbol$5("match"), $TypeError$1 = TypeError, test = {};
|
|
353
|
+
|
|
354
|
+
test[wellKnownSymbol$5("toStringTag")] = "z";
|
|
355
|
+
|
|
356
|
+
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() {
|
|
357
|
+
return arguments;
|
|
358
|
+
}()), classof$1 = TO_STRING_TAG_SUPPORT ? classofRaw : function(it) {
|
|
359
|
+
var O, tag, result;
|
|
360
|
+
return void 0 === it ? "Undefined" : null === it ? "Null" : "string" == typeof (tag = function(it, key) {
|
|
361
|
+
try {
|
|
362
|
+
return it[key];
|
|
363
|
+
} catch (error) {/* empty */}
|
|
364
|
+
}(O = $Object(it), TO_STRING_TAG)) ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : "Object" === (result = classofRaw(O)) && isCallable(O.callee) ? "Arguments" : result;
|
|
365
|
+
}, $String = String, MATCH = wellKnownSymbol$5("match"), $$1 = _export, notARegExp = function(it) {
|
|
366
|
+
if (function(it) {
|
|
367
|
+
var isRegExp;
|
|
368
|
+
return isObject$1(it) && (void 0 !== (isRegExp = it[MATCH$1]) ? !!isRegExp : "RegExp" === classof$3(it));
|
|
369
|
+
}(it)) throw new $TypeError$1("The method doesn't accept regular expressions");
|
|
370
|
+
return it;
|
|
371
|
+
}, requireObjectCoercible = requireObjectCoercible$3, toString = function(argument) {
|
|
372
|
+
if ("Symbol" === classof$1(argument)) throw new TypeError("Cannot convert a Symbol value to a string");
|
|
373
|
+
return $String(argument);
|
|
374
|
+
}, stringIndexOf = functionUncurryThis("".indexOf);
|
|
375
|
+
|
|
376
|
+
// `String.prototype.includes` method
|
|
377
|
+
// https://tc39.es/ecma262/#sec-string.prototype.includes
|
|
378
|
+
$$1({
|
|
379
|
+
target: "String",
|
|
380
|
+
proto: !0,
|
|
381
|
+
forced: !function(METHOD_NAME) {
|
|
382
|
+
var regexp = /./;
|
|
383
|
+
try {
|
|
384
|
+
"/./"[METHOD_NAME](regexp);
|
|
385
|
+
} catch (error1) {
|
|
386
|
+
try {
|
|
387
|
+
return regexp[MATCH] = !1, "/./"[METHOD_NAME](regexp);
|
|
388
|
+
} catch (error2) {/* empty */}
|
|
389
|
+
}
|
|
390
|
+
return !1;
|
|
391
|
+
}("includes")
|
|
392
|
+
}, {
|
|
393
|
+
includes: function(searchString /* , position = 0 */) {
|
|
394
|
+
return !!~stringIndexOf(toString(requireObjectCoercible(this)), toString(notARegExp(searchString)), arguments.length > 1 ? arguments[1] : void 0);
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
var includes$3 = getBuiltInPrototypeMethod$3("String", "includes"), isPrototypeOf$1 = objectIsPrototypeOf, arrayMethod = includes$4, stringMethod = includes$3, ArrayPrototype$1 = Array.prototype, StringPrototype = String.prototype, _includesInstanceProperty = getDefaultExportFromCjs((function(it) {
|
|
399
|
+
var own = it.includes;
|
|
400
|
+
return it === ArrayPrototype$1 || isPrototypeOf$1(ArrayPrototype$1, it) && own === ArrayPrototype$1.includes ? arrayMethod : "string" == typeof it || it === StringPrototype || isPrototypeOf$1(StringPrototype, it) && own === StringPrototype.includes ? stringMethod : own;
|
|
401
|
+
}));
|
|
32
402
|
|
|
33
403
|
/**
|
|
34
404
|
* Default theme colors for components
|
|
@@ -1602,7 +1972,7 @@ function useAccordion(initialProps) {
|
|
|
1602
1972
|
};
|
|
1603
1973
|
}
|
|
1604
1974
|
|
|
1605
|
-
const {CONSTANTS: CONSTANTS$
|
|
1975
|
+
const {CONSTANTS: CONSTANTS$2} = ATOMIX_GLASS, calculateDistance = (pos1, pos2) => {
|
|
1606
1976
|
if (!pos1 || !pos2 || "number" != typeof pos1.x || "number" != typeof pos1.y || "number" != typeof pos2.x || "number" != typeof pos2.y) return 0;
|
|
1607
1977
|
const deltaX = pos1.x - pos2.x, deltaY = pos1.y - pos2.y;
|
|
1608
1978
|
return Math.sqrt(deltaX * deltaX + deltaY * deltaY);
|
|
@@ -1615,36 +1985,36 @@ const {CONSTANTS: CONSTANTS$1} = ATOMIX_GLASS, calculateDistance = (pos1, pos2)
|
|
|
1615
1985
|
}, calculateMouseInfluence = mouseOffset => {
|
|
1616
1986
|
if (!mouseOffset || "number" != typeof mouseOffset.x || "number" != typeof mouseOffset.y) return 0;
|
|
1617
1987
|
// Bounded calculation — keeps the glass effect subtle and stable
|
|
1618
|
-
const influence = Math.sqrt(mouseOffset.x * mouseOffset.x + mouseOffset.y * mouseOffset.y) / CONSTANTS$
|
|
1988
|
+
const influence = Math.sqrt(mouseOffset.x * mouseOffset.x + mouseOffset.y * mouseOffset.y) / CONSTANTS$2.MOUSE_INFLUENCE_DIVISOR;
|
|
1619
1989
|
return Math.min(.8, influence);
|
|
1620
1990
|
// Tighter cap to prevent blur/filter blow-out
|
|
1621
|
-
}, clampBlur = value => "number" != typeof value || isNaN(value) ? CONSTANTS$
|
|
1991
|
+
}, 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 => {
|
|
1622
1992
|
if ("number" == typeof value) return Math.max(0, value);
|
|
1623
|
-
if ("string" != typeof value || !value.trim()) return CONSTANTS$
|
|
1993
|
+
if ("string" != typeof value || !value.trim()) return CONSTANTS$2.DEFAULT_CORNER_RADIUS;
|
|
1624
1994
|
const trimmedValue = value.trim();
|
|
1625
1995
|
// Handle px values
|
|
1626
1996
|
if (trimmedValue.endsWith("px")) {
|
|
1627
1997
|
const parsed = parseFloat(trimmedValue);
|
|
1628
|
-
return isNaN(parsed) ? CONSTANTS$
|
|
1998
|
+
return isNaN(parsed) ? CONSTANTS$2.DEFAULT_CORNER_RADIUS : Math.max(0, parsed);
|
|
1629
1999
|
}
|
|
1630
2000
|
// Handle rem values (assume 16px = 1rem)
|
|
1631
2001
|
if (trimmedValue.endsWith("rem")) {
|
|
1632
2002
|
const parsed = parseFloat(trimmedValue);
|
|
1633
|
-
return isNaN(parsed) ? CONSTANTS$
|
|
2003
|
+
return isNaN(parsed) ? CONSTANTS$2.DEFAULT_CORNER_RADIUS : Math.max(0, 16 * parsed);
|
|
1634
2004
|
}
|
|
1635
2005
|
// Handle em values (assume 16px = 1em for simplicity)
|
|
1636
2006
|
if (trimmedValue.endsWith("em")) {
|
|
1637
2007
|
const parsed = parseFloat(trimmedValue);
|
|
1638
|
-
return isNaN(parsed) ? CONSTANTS$
|
|
2008
|
+
return isNaN(parsed) ? CONSTANTS$2.DEFAULT_CORNER_RADIUS : Math.max(0, 16 * parsed);
|
|
1639
2009
|
}
|
|
1640
2010
|
// Handle percentage (convert to approximate px value, assuming 200px container)
|
|
1641
2011
|
if (trimmedValue.endsWith("%")) {
|
|
1642
2012
|
const parsed = parseFloat(trimmedValue);
|
|
1643
|
-
return isNaN(parsed) ? CONSTANTS$
|
|
2013
|
+
return isNaN(parsed) ? CONSTANTS$2.DEFAULT_CORNER_RADIUS : Math.max(0, parsed / 100 * 200);
|
|
1644
2014
|
}
|
|
1645
2015
|
// Handle unitless numbers
|
|
1646
2016
|
const numValue = parseFloat(trimmedValue);
|
|
1647
|
-
return isNaN(numValue) ? CONSTANTS$
|
|
2017
|
+
return isNaN(numValue) ? CONSTANTS$2.DEFAULT_CORNER_RADIUS : Math.max(0, numValue);
|
|
1648
2018
|
}, extractBorderRadiusFromElement = element => {
|
|
1649
2019
|
if (!element || !element.props) return null;
|
|
1650
2020
|
// Check inline styles first (highest priority)
|
|
@@ -1660,11 +2030,11 @@ const {CONSTANTS: CONSTANTS$1} = ATOMIX_GLASS, calculateDistance = (pos1, pos2)
|
|
|
1660
2030
|
// If element has children, recursively check them
|
|
1661
2031
|
if (element.props.children) {
|
|
1662
2032
|
const childRadius = extractBorderRadiusFromChildren(element.props.children);
|
|
1663
|
-
if (childRadius > 0 && childRadius !== CONSTANTS$
|
|
2033
|
+
if (childRadius > 0 && childRadius !== CONSTANTS$2.DEFAULT_CORNER_RADIUS) return childRadius;
|
|
1664
2034
|
}
|
|
1665
2035
|
return null;
|
|
1666
2036
|
}, extractBorderRadiusFromChildren = children => {
|
|
1667
|
-
if (!children) return CONSTANTS$
|
|
2037
|
+
if (!children) return CONSTANTS$2.DEFAULT_CORNER_RADIUS;
|
|
1668
2038
|
try {
|
|
1669
2039
|
const childArray = React__default.default.Children.toArray(children);
|
|
1670
2040
|
for (let i = 0; i < childArray.length; i++) {
|
|
@@ -1677,7 +2047,7 @@ const {CONSTANTS: CONSTANTS$1} = ATOMIX_GLASS, calculateDistance = (pos1, pos2)
|
|
|
1677
2047
|
} catch (error) {
|
|
1678
2048
|
// Silently handle errors
|
|
1679
2049
|
}
|
|
1680
|
-
return CONSTANTS$
|
|
2050
|
+
return CONSTANTS$2.DEFAULT_CORNER_RADIUS;
|
|
1681
2051
|
}, getDisplacementMap = (mode, displacementMap, polarDisplacementMap, prominentDisplacementMap, shaderMapUrl) => {
|
|
1682
2052
|
switch (mode) {
|
|
1683
2053
|
case "standard":
|
|
@@ -1848,10 +2218,10 @@ const sharedShaderCache = new Map, AtomixGlassContainer = React.forwardRef((({c
|
|
|
1848
2218
|
}, globalMousePosition: globalMousePosition = {
|
|
1849
2219
|
x: 0,
|
|
1850
2220
|
y: 0
|
|
1851
|
-
}, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onMouseDown: onMouseDown, onMouseUp: onMouseUp, isHovered: isHovered = !1, isActive: isActive = !1, overLight: overLight = !1, overLightConfig: overLightConfig = {},
|
|
2221
|
+
}, 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 = {
|
|
1852
2222
|
width: 0,
|
|
1853
2223
|
height: 0
|
|
1854
|
-
}, onClick: onClick, mode: mode = "standard",
|
|
2224
|
+
}, onClick: onClick, mode: mode = "standard", effectiveWithoutEffects: effectiveWithoutEffects = !1, effectiveReducedMotion: effectiveReducedMotion = !1, shaderVariant: shaderVariant = "liquidGlass", withLiquidBlur: withLiquidBlur = !1, elasticity: elasticity = 0, contentRef: contentRef}, ref) => {
|
|
1855
2225
|
// Generate a stable, deterministic ID for SSR compatibility
|
|
1856
2226
|
// Use a module-level counter that's consistent across server and client
|
|
1857
2227
|
const filterId = React.useMemo((() => "atomix-glass-filter-" + ++idCounter), []), [shaderMapUrl, setShaderMapUrl] = React.useState(""), shaderGeneratorRef = React.useRef(null), shaderUtilsRef = React.useRef(null), shaderDebounceTimeoutRef = React.useRef(null);
|
|
@@ -1963,7 +2333,7 @@ const sharedShaderCache = new Map, AtomixGlassContainer = React.forwardRef((({c
|
|
|
1963
2333
|
flowBlur: 1.2 * blurAmount
|
|
1964
2334
|
};
|
|
1965
2335
|
// Enhanced validation for liquid blur
|
|
1966
|
-
if (!
|
|
2336
|
+
if (!withLiquidBlur || !rectCache || !mouseOffset || "number" != typeof mouseOffset.x || "number" != typeof mouseOffset.y || isNaN(mouseOffset.x) || isNaN(mouseOffset.y)) return defaultBlur;
|
|
1967
2337
|
try {
|
|
1968
2338
|
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);
|
|
1969
2339
|
// NOTE: hover/active multipliers intentionally omitted here —
|
|
@@ -1978,14 +2348,14 @@ const sharedShaderCache = new Map, AtomixGlassContainer = React.forwardRef((({c
|
|
|
1978
2348
|
return console.warn("AtomixGlassContainer: Error calculating liquid blur", error),
|
|
1979
2349
|
defaultBlur;
|
|
1980
2350
|
}
|
|
1981
|
-
}), [
|
|
2351
|
+
}), [ withLiquidBlur, blurAmount, mouseOffset, rectCache ]), backdropStyle = React.useMemo((() => {
|
|
1982
2352
|
try {
|
|
1983
2353
|
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;
|
|
1984
2354
|
// Validate blur values before using them
|
|
1985
|
-
return !
|
|
2355
|
+
return !withLiquidBlur || effectiveReducedMotion || effectiveWithoutEffects || area > 18e4 ? {
|
|
1986
2356
|
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})`
|
|
1987
2357
|
} : {
|
|
1988
|
-
backdropFilter: `blur(${clampBlur(.4 * validatedBaseBlur + .25 * validatedEdgeBlur + .15 * validatedCenterBlur + .2 * validatedFlowBlur)}px) saturate(${Math.min(dynamicSaturation, 200)}%) contrast(${overLightConfig?.contrast || 1
|
|
2358
|
+
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})`
|
|
1989
2359
|
};
|
|
1990
2360
|
// Single-pass fallback: stronger radius to match perceived blur of multi-pass
|
|
1991
2361
|
} catch (error) {
|
|
@@ -1994,7 +2364,7 @@ const sharedShaderCache = new Map, AtomixGlassContainer = React.forwardRef((({c
|
|
|
1994
2364
|
backdropFilter: `blur(${blurAmount}px) saturate(${saturation}%) contrast(1.05) brightness(1.05)`
|
|
1995
2365
|
};
|
|
1996
2366
|
}
|
|
1997
|
-
}), [ liquidBlur, saturation, blurAmount, rectCache, effectiveReducedMotion,
|
|
2367
|
+
}), [ liquidBlur, saturation, blurAmount, rectCache, effectiveReducedMotion, effectiveWithoutEffects, withLiquidBlur ]), containerVars = React.useMemo((() => {
|
|
1998
2368
|
try {
|
|
1999
2369
|
// Safe extraction of mouse offset values
|
|
2000
2370
|
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;
|
|
@@ -2002,10 +2372,10 @@ const sharedShaderCache = new Map, AtomixGlassContainer = React.forwardRef((({c
|
|
|
2002
2372
|
"--atomix-glass-container-width": `${glassSize?.width}`,
|
|
2003
2373
|
"--atomix-glass-container-height": `${glassSize?.height}`,
|
|
2004
2374
|
"--atomix-glass-container-padding": padding || "0 0",
|
|
2005
|
-
"--atomix-glass-container-radius": `${"number" != typeof
|
|
2375
|
+
"--atomix-glass-container-radius": `${"number" != typeof borderRadius || isNaN(borderRadius) ? 0 : borderRadius}px`,
|
|
2006
2376
|
"--atomix-glass-container-backdrop": backdropStyle?.backdropFilter || "none",
|
|
2007
2377
|
"--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",
|
|
2008
|
-
"--atomix-glass-container-shadow-opacity":
|
|
2378
|
+
"--atomix-glass-container-shadow-opacity": effectiveWithoutEffects ? 0 : 1,
|
|
2009
2379
|
// Background and shadow values use design token-aligned RGB values
|
|
2010
2380
|
"--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",
|
|
2011
2381
|
"--atomix-glass-container-text-shadow": overLight ? "0px 2px 12px rgba(0, 0, 0, 0)" : "0px 2px 12px rgba(0, 0, 0, 0.4)",
|
|
@@ -2023,14 +2393,10 @@ const sharedShaderCache = new Map, AtomixGlassContainer = React.forwardRef((({c
|
|
|
2023
2393
|
"--atomix-glass-container-text-shadow": "none"
|
|
2024
2394
|
};
|
|
2025
2395
|
}
|
|
2026
|
-
}), [ glassSize, padding,
|
|
2027
|
-
el && (el.style.setProperty("transition-duration", "0s", "important"), el.style.setProperty("animation-duration", "0s", "important"),
|
|
2028
|
-
el.style.setProperty("transition-delay", "0s", "important"));
|
|
2029
|
-
};
|
|
2396
|
+
}), [ glassSize, padding, borderRadius, backdropStyle, mouseOffset, overLight, effectiveWithoutEffects ]);
|
|
2030
2397
|
return jsxRuntime.jsx("div", {
|
|
2031
2398
|
ref: el => {
|
|
2032
2399
|
// Apply force no-transition
|
|
2033
|
-
setForceNoTransition(el),
|
|
2034
2400
|
// Handle forwarded ref
|
|
2035
2401
|
"function" == typeof ref ? ref(el) : ref && (ref.current = el);
|
|
2036
2402
|
},
|
|
@@ -2065,7 +2431,10 @@ const sharedShaderCache = new Map, AtomixGlassContainer = React.forwardRef((({c
|
|
|
2065
2431
|
aberrationIntensity: "number" != typeof aberrationIntensity || isNaN(aberrationIntensity) ? 0 : aberrationIntensity,
|
|
2066
2432
|
shaderMapUrl: shaderMapUrl
|
|
2067
2433
|
}), jsxRuntime.jsx("div", {
|
|
2068
|
-
ref:
|
|
2434
|
+
ref: el => {
|
|
2435
|
+
el && (el.style.setProperty("transition-duration", "0s", "important"), el.style.setProperty("animation-duration", "0s", "important"),
|
|
2436
|
+
el.style.setProperty("transition-delay", "0s", "important"));
|
|
2437
|
+
},
|
|
2069
2438
|
className: ATOMIX_GLASS.FILTER_OVERLAY_CLASS,
|
|
2070
2439
|
style: {
|
|
2071
2440
|
filter: `url(#${filterId})`,
|
|
@@ -2182,7 +2551,128 @@ class {
|
|
|
2182
2551
|
*/ getSubscriberCount() {
|
|
2183
2552
|
return this.listeners.size;
|
|
2184
2553
|
}
|
|
2185
|
-
},
|
|
2554
|
+
}, updateAtomixGlassStyles = (wrapperElement, containerElement, params) => {
|
|
2555
|
+
if (!wrapperElement && !containerElement) return;
|
|
2556
|
+
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 = {
|
|
2557
|
+
opacity: baseOverLightConfig.opacity * hoverIntensity * activeIntensity,
|
|
2558
|
+
contrast: Math.min(1.6, baseOverLightConfig.contrast + .1 * mouseInfluence),
|
|
2559
|
+
brightness: Math.min(1.1, baseOverLightConfig.brightness + .05 * mouseInfluence),
|
|
2560
|
+
shadowIntensity: Math.min(1.2, Math.max(.5, baseOverLightConfig.shadowIntensity + .2 * mouseInfluence)),
|
|
2561
|
+
borderOpacity: Math.min(1, Math.max(.3, baseOverLightConfig.borderOpacity + .1 * mouseInfluence)),
|
|
2562
|
+
saturationBoost: baseOverLightConfig.saturationBoost
|
|
2563
|
+
};
|
|
2564
|
+
// Calculate mouse influence
|
|
2565
|
+
// Calculate elastic translation
|
|
2566
|
+
let elasticTranslation = {
|
|
2567
|
+
x: 0,
|
|
2568
|
+
y: 0
|
|
2569
|
+
};
|
|
2570
|
+
if (!effectiveWithoutEffects && wrapperElement) {
|
|
2571
|
+
const rect = wrapperElement.getBoundingClientRect(), center = calculateElementCenter(rect);
|
|
2572
|
+
// Calculate fade in factor
|
|
2573
|
+
let fadeInFactor = 0;
|
|
2574
|
+
if (globalMousePosition.x && globalMousePosition.y && validateGlassSize(glassSize)) {
|
|
2575
|
+
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({
|
|
2576
|
+
x: edgeDistanceX,
|
|
2577
|
+
y: edgeDistanceY
|
|
2578
|
+
}, {
|
|
2579
|
+
x: 0,
|
|
2580
|
+
y: 0
|
|
2581
|
+
});
|
|
2582
|
+
fadeInFactor = edgeDistance > ATOMIX_GLASS.CONSTANTS.ACTIVATION_ZONE ? 0 : 1 - edgeDistance / ATOMIX_GLASS.CONSTANTS.ACTIVATION_ZONE;
|
|
2583
|
+
}
|
|
2584
|
+
elasticTranslation = {
|
|
2585
|
+
x: (globalMousePosition.x - center.x) * elasticity * .1 * fadeInFactor,
|
|
2586
|
+
y: (globalMousePosition.y - center.y) * elasticity * .1 * fadeInFactor
|
|
2587
|
+
};
|
|
2588
|
+
}
|
|
2589
|
+
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}`;
|
|
2590
|
+
// Update Wrapper Styles (glassVars)
|
|
2591
|
+
if (wrapperElement) {
|
|
2592
|
+
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 = {
|
|
2593
|
+
hover1: {
|
|
2594
|
+
x: GRADIENT.CENTER_POSITION + mx / GRADIENT.HOVER_POSITION.DIVISOR_1,
|
|
2595
|
+
y: GRADIENT.CENTER_POSITION + my / GRADIENT.HOVER_POSITION.DIVISOR_1
|
|
2596
|
+
},
|
|
2597
|
+
hover2: {
|
|
2598
|
+
x: GRADIENT.CENTER_POSITION + mx / GRADIENT.HOVER_POSITION.DIVISOR_2,
|
|
2599
|
+
y: GRADIENT.CENTER_POSITION + my / GRADIENT.HOVER_POSITION.DIVISOR_2
|
|
2600
|
+
},
|
|
2601
|
+
hover3: {
|
|
2602
|
+
x: GRADIENT.CENTER_POSITION + mx * GRADIENT.HOVER_POSITION.MULTIPLIER_3,
|
|
2603
|
+
y: GRADIENT.CENTER_POSITION + my * GRADIENT.HOVER_POSITION.MULTIPLIER_3
|
|
2604
|
+
}
|
|
2605
|
+
}, basePosition = {
|
|
2606
|
+
x: GRADIENT.CENTER_POSITION + mx * GRADIENT.BASE_LAYER_MULTIPLIER,
|
|
2607
|
+
y: GRADIENT.CENTER_POSITION + my * GRADIENT.BASE_LAYER_MULTIPLIER
|
|
2608
|
+
}, opacityValues = {
|
|
2609
|
+
hover1: isHovered || isActive ? .5 : 0,
|
|
2610
|
+
hover2: isActive ? .5 : 0,
|
|
2611
|
+
hover3: isHovered ? .4 : isActive ? .8 : 0,
|
|
2612
|
+
base: isOverLight ? overLightConfig.opacity : 0,
|
|
2613
|
+
over: isOverLight ? 1.1 * overLightConfig.opacity : 0
|
|
2614
|
+
}, style = wrapperElement.style;
|
|
2615
|
+
style.setProperty("--atomix-glass-transform", transformStyle || "none"),
|
|
2616
|
+
// Gradients
|
|
2617
|
+
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%)`),
|
|
2618
|
+
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%)`),
|
|
2619
|
+
// Hover gradients
|
|
2620
|
+
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}%)`),
|
|
2621
|
+
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}%)`),
|
|
2622
|
+
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}%)`),
|
|
2623
|
+
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})`),
|
|
2624
|
+
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})`),
|
|
2625
|
+
// Opacities
|
|
2626
|
+
style.setProperty("--atomix-glass-hover-1-opacity", opacityValues.hover1.toString()),
|
|
2627
|
+
style.setProperty("--atomix-glass-hover-2-opacity", opacityValues.hover2.toString()),
|
|
2628
|
+
style.setProperty("--atomix-glass-hover-3-opacity", opacityValues.hover3.toString()),
|
|
2629
|
+
style.setProperty("--atomix-glass-base-opacity", opacityValues.base.toString()),
|
|
2630
|
+
style.setProperty("--atomix-glass-overlay-opacity", opacityValues.over.toString()),
|
|
2631
|
+
style.setProperty("--atomix-glass-overlay-highlight-opacity", (opacityValues.over * ATOMIX_GLASS.CONSTANTS.OVERLAY_HIGHLIGHT.OPACITY_MULTIPLIER).toString()),
|
|
2632
|
+
// Other
|
|
2633
|
+
style.setProperty("--atomix-glass-blend-mode", isOverLight ? "multiply" : "overlay"),
|
|
2634
|
+
style.setProperty("--atomix-glass-radius", `${effectiveBorderRadius}px`);
|
|
2635
|
+
}
|
|
2636
|
+
// Update Container Styles (containerVars)
|
|
2637
|
+
if (containerElement) {
|
|
2638
|
+
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();
|
|
2639
|
+
let liquidBlur = {
|
|
2640
|
+
baseBlur: blurAmount,
|
|
2641
|
+
edgeBlur: blurAmount * EDGE_BLUR_MULTIPLIER,
|
|
2642
|
+
centerBlur: blurAmount * CENTER_BLUR_MULTIPLIER,
|
|
2643
|
+
flowBlur: blurAmount * FLOW_BLUR_MULTIPLIER
|
|
2644
|
+
};
|
|
2645
|
+
if (withLiquidBlur && rect) {
|
|
2646
|
+
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);
|
|
2647
|
+
liquidBlur = {
|
|
2648
|
+
baseBlur: clampBlur(baseBlur),
|
|
2649
|
+
edgeBlur: clampBlur(edgeBlur),
|
|
2650
|
+
centerBlur: clampBlur(centerBlur),
|
|
2651
|
+
flowBlur: clampBlur(flowBlur)
|
|
2652
|
+
};
|
|
2653
|
+
}
|
|
2654
|
+
// Backdrop filter
|
|
2655
|
+
let backdropFilterString = `blur(${blurAmount}px) saturate(${saturation}%) contrast(1.05) brightness(1.05)`;
|
|
2656
|
+
const dynamicSaturation = saturation + 20 * (liquidBlur.baseBlur || 0), area = rect ? rect.width * rect.height : 0;
|
|
2657
|
+
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})`;
|
|
2658
|
+
// Container variables
|
|
2659
|
+
const style = containerElement.style;
|
|
2660
|
+
style.setProperty("--atomix-glass-container-width", `${glassSize.width}`), style.setProperty("--atomix-glass-container-height", `${glassSize.height}`),
|
|
2661
|
+
style.setProperty("--atomix-glass-container-padding", padding), style.setProperty("--atomix-glass-container-radius", `${effectiveBorderRadius}px`),
|
|
2662
|
+
style.setProperty("--atomix-glass-container-backdrop", backdropFilterString),
|
|
2663
|
+
// Shadows
|
|
2664
|
+
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"),
|
|
2665
|
+
style.setProperty("--atomix-glass-container-shadow-opacity", effectiveWithoutEffects ? "0" : "1"),
|
|
2666
|
+
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"),
|
|
2667
|
+
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)"),
|
|
2668
|
+
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)");
|
|
2669
|
+
}
|
|
2670
|
+
}, {CONSTANTS: CONSTANTS$1} = ATOMIX_GLASS;
|
|
2671
|
+
|
|
2672
|
+
/**
|
|
2673
|
+
* Updates the styles of the AtomixGlass wrapper and container elements imperatively
|
|
2674
|
+
* to avoid React re-renders on mouse movement.
|
|
2675
|
+
*/ const {CONSTANTS: CONSTANTS} = ATOMIX_GLASS, backgroundDetectionCache = new WeakMap, setCachedBackgroundDetection = (parentElement, overLightConfig, result, threshold) => {
|
|
2186
2676
|
parentElement && backgroundDetectionCache.set(parentElement, {
|
|
2187
2677
|
result: result,
|
|
2188
2678
|
timestamp: Date.now(),
|
|
@@ -2195,18 +2685,74 @@ class {
|
|
|
2195
2685
|
* Composable hook for AtomixGlass component logic
|
|
2196
2686
|
* Manages all state, calculations, and event handlers
|
|
2197
2687
|
*/
|
|
2198
|
-
function useAtomixGlass({glassRef: glassRef, contentRef: contentRef,
|
|
2688
|
+
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}) {
|
|
2199
2689
|
// State
|
|
2200
|
-
const [isHovered, setIsHovered] = React.useState(!1), [isActive, setIsActive] = React.useState(!1),
|
|
2201
|
-
width: 270,
|
|
2202
|
-
height: 69
|
|
2203
|
-
}), [internalGlobalMousePosition, setInternalGlobalMousePosition] = React.useState({
|
|
2690
|
+
const [isHovered, setIsHovered] = React.useState(!1), [isActive, setIsActive] = React.useState(!1), cachedRectRef = React.useRef(null), internalGlobalMousePositionRef = React.useRef({
|
|
2204
2691
|
x: 0,
|
|
2205
2692
|
y: 0
|
|
2206
|
-
}),
|
|
2693
|
+
}), internalMouseOffsetRef = React.useRef({
|
|
2207
2694
|
x: 0,
|
|
2208
2695
|
y: 0
|
|
2209
|
-
}), [
|
|
2696
|
+
}), [dynamicBorderRadius, setDynamicCornerRadius] = React.useState(CONSTANTS.DEFAULT_CORNER_RADIUS), [userPrefersReducedMotion, setUserPrefersReducedMotion] = React.useState(!1), [userPrefersHighContrast, setUserPrefersHighContrast] = React.useState(!1), [detectedOverLight, setDetectedOverLight] = React.useState(!1), effectiveBorderRadius = React.useMemo((() => void 0 !== borderRadius ? Math.max(0, borderRadius) : Math.max(0, dynamicBorderRadius)), [ borderRadius, dynamicBorderRadius ]), {glassSize: glassSize} = function({glassRef: glassRef, effectiveBorderRadius: effectiveBorderRadius, cachedRectRef: cachedRectRef}) {
|
|
2697
|
+
const [glassSize, setGlassSize] = React.useState({
|
|
2698
|
+
width: 270,
|
|
2699
|
+
height: 69
|
|
2700
|
+
});
|
|
2701
|
+
return React.useEffect((() => {
|
|
2702
|
+
const isValidElement = element => null !== element && element instanceof HTMLElement && element.isConnected;
|
|
2703
|
+
let rafId = null, lastSize = {
|
|
2704
|
+
width: 0,
|
|
2705
|
+
height: 0
|
|
2706
|
+
}, lastCornerRadius = effectiveBorderRadius;
|
|
2707
|
+
const updateGlassSize = (forceUpdate = !1) => {
|
|
2708
|
+
null !== rafId && cancelAnimationFrame(rafId), rafId = requestAnimationFrame((() => {
|
|
2709
|
+
if (!isValidElement(glassRef.current)) return void (rafId = null);
|
|
2710
|
+
const rect = glassRef.current.getBoundingClientRect();
|
|
2711
|
+
if (rect.width <= 0 || rect.height <= 0) return void (rafId = null);
|
|
2712
|
+
// Measure actual rendered size without artificial offsets to avoid feedback loops
|
|
2713
|
+
const newSize = {
|
|
2714
|
+
width: Math.round(rect.width),
|
|
2715
|
+
height: Math.round(rect.height)
|
|
2716
|
+
}, cornerRadiusChanged = lastCornerRadius !== effectiveBorderRadius, dimensionsChanged = Math.abs(newSize.width - lastSize.width) > 1 || Math.abs(newSize.height - lastSize.height) > 1;
|
|
2717
|
+
var size;
|
|
2718
|
+
(forceUpdate || cornerRadiusChanged || dimensionsChanged) && validateGlassSize(size = newSize) && size.width <= CONSTANTS$1.MAX_SIZE && size.height <= CONSTANTS$1.MAX_SIZE && (lastSize = newSize,
|
|
2719
|
+
lastCornerRadius = effectiveBorderRadius, setGlassSize(newSize)), rafId = null;
|
|
2720
|
+
}));
|
|
2721
|
+
};
|
|
2722
|
+
let resizeTimeoutId = null;
|
|
2723
|
+
const debouncedResizeHandler = () => {
|
|
2724
|
+
resizeTimeoutId && clearTimeout(resizeTimeoutId), resizeTimeoutId = setTimeout((() => updateGlassSize(!1)), 16);
|
|
2725
|
+
}, initialTimeoutId = setTimeout((() => updateGlassSize(!0)), 0);
|
|
2726
|
+
let resizeObserver = null, resizeDebounceTimeout = null;
|
|
2727
|
+
// ResizeObserver has 98%+ browser support, no need for fallback
|
|
2728
|
+
if ("undefined" != typeof ResizeObserver && isValidElement(glassRef.current)) try {
|
|
2729
|
+
resizeObserver = new ResizeObserver((entries => {
|
|
2730
|
+
for (const entry of entries) if (entry.target === glassRef.current) {
|
|
2731
|
+
// Update cached rect when size changes
|
|
2732
|
+
glassRef.current && cachedRectRef && (cachedRectRef.current = glassRef.current.getBoundingClientRect()),
|
|
2733
|
+
// Debounce resize updates to match RAF timing (16ms)
|
|
2734
|
+
resizeDebounceTimeout && clearTimeout(resizeDebounceTimeout), resizeDebounceTimeout = setTimeout((() => updateGlassSize(!1)), 16);
|
|
2735
|
+
break;
|
|
2736
|
+
}
|
|
2737
|
+
})), resizeObserver.observe(glassRef.current);
|
|
2738
|
+
} catch (error) {
|
|
2739
|
+
console.warn("AtomixGlass: ResizeObserver not available, using window resize only", error);
|
|
2740
|
+
}
|
|
2741
|
+
return window.addEventListener("resize", debouncedResizeHandler, {
|
|
2742
|
+
passive: !0
|
|
2743
|
+
}), () => {
|
|
2744
|
+
clearTimeout(initialTimeoutId), null !== rafId && cancelAnimationFrame(rafId), resizeTimeoutId && clearTimeout(resizeTimeoutId),
|
|
2745
|
+
resizeDebounceTimeout && clearTimeout(resizeDebounceTimeout), window.removeEventListener("resize", debouncedResizeHandler),
|
|
2746
|
+
resizeObserver?.disconnect();
|
|
2747
|
+
};
|
|
2748
|
+
}), [ effectiveBorderRadius, glassRef, cachedRectRef ]), {
|
|
2749
|
+
glassSize: glassSize
|
|
2750
|
+
};
|
|
2751
|
+
}({
|
|
2752
|
+
glassRef: glassRef,
|
|
2753
|
+
effectiveBorderRadius: effectiveBorderRadius,
|
|
2754
|
+
cachedRectRef: cachedRectRef
|
|
2755
|
+
}), effectiveReducedMotion = React.useMemo((() => reducedMotion || userPrefersReducedMotion), [ reducedMotion, userPrefersReducedMotion ]), effectiveHighContrast = React.useMemo((() => highContrast || userPrefersHighContrast), [ highContrast, userPrefersHighContrast ]), effectiveWithoutEffects = React.useMemo((() => withoutEffects || effectiveReducedMotion), [ withoutEffects, effectiveReducedMotion ]), globalMousePosition = externalGlobalMousePosition || internalGlobalMousePositionRef.current, mouseOffset = externalMouseOffset || internalMouseOffsetRef.current;
|
|
2210
2756
|
// Extract border-radius from children
|
|
2211
2757
|
React.useEffect((() => {
|
|
2212
2758
|
const extractRadius = () => {
|
|
@@ -2237,13 +2783,13 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
2237
2783
|
}
|
|
2238
2784
|
null !== extractedRadius && extractedRadius > 0 && setDynamicCornerRadius(extractedRadius);
|
|
2239
2785
|
} catch (error) {
|
|
2240
|
-
"undefined" != typeof process && "production" === process.env?.NODE_ENV || !
|
|
2786
|
+
"undefined" != typeof process && "production" === process.env?.NODE_ENV || !debugBorderRadius || console.error("[AtomixGlass] Error extracting corner radius:", error);
|
|
2241
2787
|
}
|
|
2242
2788
|
};
|
|
2243
2789
|
extractRadius();
|
|
2244
2790
|
const timeoutId = setTimeout(extractRadius, 100);
|
|
2245
2791
|
return () => clearTimeout(timeoutId);
|
|
2246
|
-
}), [ children,
|
|
2792
|
+
}), [ children, debugBorderRadius, contentRef ]),
|
|
2247
2793
|
// Media query handlers and background detection
|
|
2248
2794
|
React.useEffect((() => {
|
|
2249
2795
|
if (("auto" === overLight || "object" == typeof overLight && null !== overLight) && glassRef.current) {
|
|
@@ -2299,72 +2845,52 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
2299
2845
|
const rgb = bgColor.match(/\d+/g);
|
|
2300
2846
|
if (rgb && rgb.length >= 3) {
|
|
2301
2847
|
const r = Number(rgb[0]), g = Number(rgb[1]), b = Number(rgb[2]);
|
|
2302
|
-
|
|
2303
|
-
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)) {
|
|
2848
|
+
if (!isNaN(r) && !isNaN(g) && !isNaN(b) && (r > 10 || g > 10 || b > 10)) {
|
|
2304
2849
|
const luminance = (.299 * r + .587 * g + .114 * b) / 255;
|
|
2305
2850
|
!isNaN(luminance) && isFinite(luminance) && (totalLuminance += luminance, validSamples++,
|
|
2306
2851
|
hasValidBackground = !0);
|
|
2307
2852
|
}
|
|
2308
2853
|
}
|
|
2309
2854
|
}
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
// For image backgrounds, assume medium luminance
|
|
2313
|
-
totalLuminance += .5, validSamples++, hasValidBackground = !0);
|
|
2855
|
+
bgImage && "none" !== bgImage && "initial" !== bgImage && (totalLuminance += .5,
|
|
2856
|
+
validSamples++, hasValidBackground = !0);
|
|
2314
2857
|
} catch (styleError) {
|
|
2315
|
-
|
|
2858
|
+
// Silently continue
|
|
2316
2859
|
}
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
// Exit loop if currentElement becomes null
|
|
2320
|
-
currentElement = currentElement.parentElement, depth++;
|
|
2860
|
+
if (!currentElement) break;
|
|
2861
|
+
currentElement = currentElement.parentElement, depth++;
|
|
2321
2862
|
}
|
|
2322
|
-
|
|
2323
|
-
if (hasValidBackground && validSamples > 0) {
|
|
2863
|
+
if (hasValidBackground && validSamples > 0) {
|
|
2324
2864
|
const avgLuminance = totalLuminance / validSamples;
|
|
2325
2865
|
if (!isNaN(avgLuminance) && isFinite(avgLuminance)) {
|
|
2326
2866
|
let threshold = .7;
|
|
2327
|
-
|
|
2328
|
-
// If overLight is an object, use its threshold property with validation
|
|
2329
|
-
if ("object" == typeof overLight && null !== overLight) {
|
|
2867
|
+
if ("object" == typeof overLight && null !== overLight) {
|
|
2330
2868
|
const objConfig = overLight;
|
|
2331
2869
|
if (void 0 !== objConfig.threshold) {
|
|
2332
|
-
const configThreshold = "number"
|
|
2870
|
+
const configThreshold = "number" != typeof objConfig.threshold || isNaN(objConfig.threshold) ? .7 : objConfig.threshold;
|
|
2333
2871
|
threshold = Math.min(.9, Math.max(.1, configThreshold));
|
|
2334
2872
|
}
|
|
2335
2873
|
}
|
|
2336
2874
|
const isOverLightDetected = avgLuminance > threshold;
|
|
2337
|
-
|
|
2338
|
-
setCachedBackgroundDetection(element.parentElement, overLight, isOverLightDetected, threshold),
|
|
2875
|
+
setCachedBackgroundDetection(element.parentElement, overLight, isOverLightDetected, threshold),
|
|
2339
2876
|
setDetectedOverLight(isOverLightDetected);
|
|
2340
2877
|
} else {
|
|
2341
|
-
// Invalid luminance calculation, default to false
|
|
2342
2878
|
const result = !1, threshold = "object" == typeof overLight && null !== overLight && overLight.threshold || .7;
|
|
2343
2879
|
setCachedBackgroundDetection(element.parentElement, overLight, result, threshold),
|
|
2344
2880
|
setDetectedOverLight(result);
|
|
2345
2881
|
}
|
|
2346
2882
|
} else {
|
|
2347
|
-
// Default to false if no valid background found
|
|
2348
2883
|
const result = !1, threshold = "object" == typeof overLight && null !== overLight && overLight.threshold || .7;
|
|
2349
2884
|
setCachedBackgroundDetection(element.parentElement, overLight, result, threshold),
|
|
2350
2885
|
setDetectedOverLight(result);
|
|
2351
2886
|
}
|
|
2352
2887
|
} catch (error) {
|
|
2353
|
-
|
|
2354
|
-
"undefined" != typeof process && "development" !== process.env?.NODE_ENV || console.warn("AtomixGlass: Error detecting background brightness:", error);
|
|
2355
|
-
const result = !1;
|
|
2356
|
-
if (element && element.parentElement) {
|
|
2357
|
-
const threshold = "object" == typeof overLight && null !== overLight && overLight.threshold || .7;
|
|
2358
|
-
setCachedBackgroundDetection(element.parentElement, overLight, result, threshold);
|
|
2359
|
-
}
|
|
2360
|
-
setDetectedOverLight(result);
|
|
2888
|
+
setDetectedOverLight(!1);
|
|
2361
2889
|
}
|
|
2362
2890
|
}), 150);
|
|
2363
2891
|
return () => clearTimeout(timeoutId);
|
|
2364
2892
|
}
|
|
2365
|
-
if ("boolean" == typeof overLight &&
|
|
2366
|
-
// For boolean values, disable auto-detection
|
|
2367
|
-
setDetectedOverLight(!1), "function" == typeof window.matchMedia) try {
|
|
2893
|
+
if ("boolean" == typeof overLight && setDetectedOverLight(!1), "function" == typeof window.matchMedia) try {
|
|
2368
2894
|
const mediaQueryReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)"), mediaQueryHighContrast = window.matchMedia("(prefers-contrast: high)");
|
|
2369
2895
|
setUserPrefersReducedMotion(mediaQueryReducedMotion.matches), setUserPrefersHighContrast(mediaQueryHighContrast.matches);
|
|
2370
2896
|
const handleReducedMotionChange = e => {
|
|
@@ -2375,65 +2901,54 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
2375
2901
|
return mediaQueryReducedMotion.addEventListener ? (mediaQueryReducedMotion.addEventListener("change", handleReducedMotionChange),
|
|
2376
2902
|
mediaQueryHighContrast.addEventListener("change", handleHighContrastChange)) : mediaQueryReducedMotion.addListener && (mediaQueryReducedMotion.addListener(handleReducedMotionChange),
|
|
2377
2903
|
mediaQueryHighContrast.addListener(handleHighContrastChange)), () => {
|
|
2378
|
-
|
|
2379
|
-
mediaQueryReducedMotion.removeEventListener ? (mediaQueryReducedMotion.removeEventListener("change", handleReducedMotionChange),
|
|
2380
|
-
mediaQueryHighContrast.removeEventListener("change", handleHighContrastChange)) : mediaQueryReducedMotion.removeListener && (mediaQueryReducedMotion.removeListener(handleReducedMotionChange),
|
|
2381
|
-
mediaQueryHighContrast.removeListener(handleHighContrastChange));
|
|
2382
|
-
} catch (cleanupError) {
|
|
2383
|
-
console.error("AtomixGlass: Error cleaning up media query listeners:", cleanupError);
|
|
2384
|
-
}
|
|
2904
|
+
// ignore
|
|
2385
2905
|
};
|
|
2386
2906
|
} catch (error) {
|
|
2387
|
-
return
|
|
2907
|
+
return;
|
|
2388
2908
|
}
|
|
2389
2909
|
}), [ overLight, glassRef, debugOverLight ]);
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
x: (globalPos.x - center.x) / rect.width * 100,
|
|
2406
|
-
y: (globalPos.y - center.y) / rect.height * 100
|
|
2910
|
+
/**
|
|
2911
|
+
* Get effective overLight value based on configuration
|
|
2912
|
+
*/
|
|
2913
|
+
const getEffectiveOverLight = React.useCallback((() => "boolean" == typeof overLight ? overLight : ("auto" === overLight || "object" == typeof overLight && null !== overLight) && detectedOverLight), [ overLight, detectedOverLight ]), validateConfigValue = React.useCallback(((value, min, max, defaultValue) => "number" != typeof value || isNaN(value) || !isFinite(value) ? defaultValue : Math.min(max, Math.max(min, value))), []), baseOverLightConfig = React.useMemo((() => {
|
|
2914
|
+
const isOverLight = getEffectiveOverLight(), baseConfig = {
|
|
2915
|
+
isOverLight: isOverLight,
|
|
2916
|
+
threshold: .7,
|
|
2917
|
+
opacity: isOverLight ? Math.min(.6, Math.max(.2, .5)) : 0,
|
|
2918
|
+
contrast: 1,
|
|
2919
|
+
// Base contrast
|
|
2920
|
+
brightness: 1,
|
|
2921
|
+
// Base brightness
|
|
2922
|
+
saturationBoost: 1.3,
|
|
2923
|
+
shadowIntensity: .9,
|
|
2924
|
+
borderOpacity: .7
|
|
2407
2925
|
};
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
return;
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
updateRectRef.current = null), resizeObserver && resizeObserver.disconnect();
|
|
2926
|
+
if ("object" == typeof overLight && null !== overLight) {
|
|
2927
|
+
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);
|
|
2928
|
+
return {
|
|
2929
|
+
...baseConfig,
|
|
2930
|
+
threshold: validatedThreshold,
|
|
2931
|
+
opacity: validatedOpacity,
|
|
2932
|
+
contrast: validatedContrast,
|
|
2933
|
+
brightness: validatedBrightness,
|
|
2934
|
+
saturationBoost: validatedSaturationBoost
|
|
2935
|
+
};
|
|
2936
|
+
}
|
|
2937
|
+
return baseConfig;
|
|
2938
|
+
}), [ overLight, getEffectiveOverLight, validateConfigValue ]), overLightConfig = React.useMemo((() => {
|
|
2939
|
+
const mouseInfluence = calculateMouseInfluence(mouseOffset), hoverIntensity = isHovered ? 1.4 : 1, activeIntensity = isActive ? 1.6 : 1;
|
|
2940
|
+
return {
|
|
2941
|
+
isOverLight: baseOverLightConfig.isOverLight,
|
|
2942
|
+
threshold: baseOverLightConfig.threshold,
|
|
2943
|
+
opacity: baseOverLightConfig.opacity * hoverIntensity * activeIntensity,
|
|
2944
|
+
contrast: Math.min(1.6, baseOverLightConfig.contrast + .1 * mouseInfluence),
|
|
2945
|
+
brightness: Math.min(1.1, baseOverLightConfig.brightness + .05 * mouseInfluence),
|
|
2946
|
+
saturationBoost: baseOverLightConfig.saturationBoost,
|
|
2947
|
+
shadowIntensity: Math.min(1.2, Math.max(.5, baseOverLightConfig.shadowIntensity + .2 * mouseInfluence)),
|
|
2948
|
+
borderOpacity: Math.min(1, Math.max(.3, baseOverLightConfig.borderOpacity + .1 * mouseInfluence))
|
|
2432
2949
|
};
|
|
2433
|
-
}), [
|
|
2434
|
-
|
|
2435
|
-
const calculateDirectionalScale = React.useCallback((() => {
|
|
2436
|
-
if (!0 === overLight || "auto" === overLight && detectedOverLight || "object" == typeof overLight && null !== overLight && detectedOverLight) return "scale(1)";
|
|
2950
|
+
}), [ baseOverLightConfig, mouseOffset, isHovered, isActive ]), updateRectRef = React.useRef(null), calculateDirectionalScale = React.useCallback((() => {
|
|
2951
|
+
if (baseOverLightConfig.isOverLight) return "scale(1)";
|
|
2437
2952
|
if (!(globalMousePosition.x && globalMousePosition.y && glassRef.current && validateGlassSize(glassSize))) return "scale(1)";
|
|
2438
2953
|
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({
|
|
2439
2954
|
x: edgeDistanceX,
|
|
@@ -2447,7 +2962,7 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
2447
2962
|
if (0 === centerDistance) return "scale(1)";
|
|
2448
2963
|
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;
|
|
2449
2964
|
return `scaleX(${Math.max(.8, scaleX)}) scaleY(${Math.max(.8, scaleY)})`;
|
|
2450
|
-
}), [ globalMousePosition, elasticity, glassSize, glassRef,
|
|
2965
|
+
}), [ globalMousePosition, elasticity, glassSize, glassRef, baseOverLightConfig ]), calculateFadeInFactor = React.useCallback((() => {
|
|
2451
2966
|
if (!(globalMousePosition.x && globalMousePosition.y && glassRef.current && validateGlassSize(glassSize))) return 0;
|
|
2452
2967
|
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({
|
|
2453
2968
|
x: edgeDistanceX,
|
|
@@ -2467,122 +2982,110 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
2467
2982
|
x: (globalMousePosition.x - center.x) * elasticity * .1 * fadeInFactor,
|
|
2468
2983
|
y: (globalMousePosition.y - center.y) * elasticity * .1 * fadeInFactor
|
|
2469
2984
|
};
|
|
2470
|
-
}), [ globalMousePosition, elasticity, calculateFadeInFactor, glassRef ]), elasticTranslation = React.useMemo((() =>
|
|
2985
|
+
}), [ globalMousePosition, elasticity, calculateFadeInFactor, glassRef ]), elasticTranslation = React.useMemo((() => effectiveWithoutEffects ? {
|
|
2471
2986
|
x: 0,
|
|
2472
2987
|
y: 0
|
|
2473
|
-
} : calculateElasticTranslation()), [ calculateElasticTranslation,
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
const
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
if (rect.width <= 0 || rect.height <= 0) return void (rafId = null);
|
|
2486
|
-
// Measure actual rendered size without artificial offsets to avoid feedback loops
|
|
2487
|
-
const newSize = {
|
|
2488
|
-
width: Math.round(rect.width),
|
|
2489
|
-
height: Math.round(rect.height)
|
|
2490
|
-
}, cornerRadiusChanged = lastCornerRadius !== effectiveCornerRadius, dimensionsChanged = Math.abs(newSize.width - lastSize.width) > 1 || Math.abs(newSize.height - lastSize.height) > 1;
|
|
2491
|
-
var size;
|
|
2492
|
-
(forceUpdate || cornerRadiusChanged || dimensionsChanged) && validateGlassSize(size = newSize) && size.width <= CONSTANTS.MAX_SIZE && size.height <= CONSTANTS.MAX_SIZE && (lastSize = newSize,
|
|
2493
|
-
lastCornerRadius = effectiveCornerRadius, setGlassSize(newSize)), rafId = null;
|
|
2494
|
-
}));
|
|
2495
|
-
};
|
|
2496
|
-
let resizeTimeoutId = null;
|
|
2497
|
-
const debouncedResizeHandler = () => {
|
|
2498
|
-
resizeTimeoutId && clearTimeout(resizeTimeoutId), resizeTimeoutId = setTimeout((() => updateGlassSize(!1)), 16);
|
|
2499
|
-
}, initialTimeoutId = setTimeout((() => updateGlassSize(!0)), 0);
|
|
2500
|
-
let resizeObserver = null, resizeDebounceTimeout = null;
|
|
2501
|
-
// ResizeObserver has 98%+ browser support, no need for fallback
|
|
2502
|
-
if ("undefined" != typeof ResizeObserver && isValidElement(glassRef.current)) try {
|
|
2503
|
-
resizeObserver = new ResizeObserver((entries => {
|
|
2504
|
-
for (const entry of entries) if (entry.target === glassRef.current) {
|
|
2505
|
-
// Update cached rect when size changes
|
|
2506
|
-
glassRef.current && (cachedRectRef.current = glassRef.current.getBoundingClientRect()),
|
|
2507
|
-
// Debounce resize updates to match RAF timing (16ms)
|
|
2508
|
-
resizeDebounceTimeout && clearTimeout(resizeDebounceTimeout), resizeDebounceTimeout = setTimeout((() => updateGlassSize(!1)), 16);
|
|
2509
|
-
break;
|
|
2510
|
-
}
|
|
2511
|
-
})), resizeObserver.observe(glassRef.current);
|
|
2512
|
-
} catch (error) {
|
|
2513
|
-
console.warn("AtomixGlass: ResizeObserver not available, using window resize only", error);
|
|
2514
|
-
}
|
|
2515
|
-
return window.addEventListener("resize", debouncedResizeHandler, {
|
|
2516
|
-
passive: !0
|
|
2517
|
-
}), () => {
|
|
2518
|
-
clearTimeout(initialTimeoutId), null !== rafId && cancelAnimationFrame(rafId), resizeTimeoutId && clearTimeout(resizeTimeoutId),
|
|
2519
|
-
resizeDebounceTimeout && clearTimeout(resizeDebounceTimeout), window.removeEventListener("resize", debouncedResizeHandler),
|
|
2520
|
-
resizeObserver?.disconnect();
|
|
2988
|
+
} : calculateElasticTranslation()), [ calculateElasticTranslation, effectiveWithoutEffects ]), directionalScale = React.useMemo((() => effectiveWithoutEffects ? "scale(1)" : calculateDirectionalScale()), [ calculateDirectionalScale, effectiveWithoutEffects ]), transformStyle = React.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 = React.useCallback((globalPos => {
|
|
2989
|
+
if (externalGlobalMousePosition && externalMouseOffset) return;
|
|
2990
|
+
if (effectiveWithoutEffects) return;
|
|
2991
|
+
const container = mouseContainer?.current || glassRef.current;
|
|
2992
|
+
if (!container) return;
|
|
2993
|
+
// Use cached rect if available, otherwise get new one
|
|
2994
|
+
let rect = cachedRectRef.current;
|
|
2995
|
+
if (rect && 0 !== rect.width && 0 !== rect.height || (rect = container.getBoundingClientRect(),
|
|
2996
|
+
cachedRectRef.current = rect), 0 === rect.width || 0 === rect.height) return;
|
|
2997
|
+
const center = calculateElementCenter(rect), newOffset = {
|
|
2998
|
+
x: (globalPos.x - center.x) / rect.width * 100,
|
|
2999
|
+
y: (globalPos.y - center.y) / rect.height * 100
|
|
2521
3000
|
};
|
|
2522
|
-
|
|
2523
|
-
|
|
3001
|
+
// Calculate offset relative to this container
|
|
3002
|
+
// Store in refs instead of state
|
|
3003
|
+
internalMouseOffsetRef.current = newOffset, internalGlobalMousePositionRef.current = globalPos,
|
|
3004
|
+
// Imperative style update
|
|
3005
|
+
updateAtomixGlassStyles(wrapperRef?.current || null, glassRef.current, {
|
|
3006
|
+
mouseOffset: newOffset,
|
|
3007
|
+
globalMousePosition: globalPos,
|
|
3008
|
+
glassSize: glassSize,
|
|
3009
|
+
isHovered: isHovered,
|
|
3010
|
+
isActive: isActive,
|
|
3011
|
+
isOverLight: baseOverLightConfig.isOverLight,
|
|
3012
|
+
baseOverLightConfig: baseOverLightConfig,
|
|
3013
|
+
effectiveBorderRadius: effectiveBorderRadius,
|
|
3014
|
+
effectiveWithoutEffects: effectiveWithoutEffects,
|
|
3015
|
+
effectiveReducedMotion: effectiveReducedMotion,
|
|
3016
|
+
elasticity: elasticity,
|
|
3017
|
+
directionalScale: isActive && Boolean(onClick) ? "scale(0.96)" : "scale(1)",
|
|
3018
|
+
// Simplified directional scale for fast path
|
|
3019
|
+
onClick: onClick,
|
|
3020
|
+
withLiquidBlur: withLiquidBlur,
|
|
3021
|
+
blurAmount: blurAmount,
|
|
3022
|
+
saturation: saturation,
|
|
3023
|
+
padding: padding
|
|
3024
|
+
});
|
|
3025
|
+
}), [ mouseContainer, glassRef, wrapperRef, externalGlobalMousePosition, externalMouseOffset, effectiveWithoutEffects, glassSize, isHovered, isActive, baseOverLightConfig, effectiveBorderRadius, effectiveReducedMotion, elasticity, onClick, withLiquidBlur, blurAmount, saturation, padding ]);
|
|
2524
3026
|
/**
|
|
2525
|
-
*
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
const
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
3027
|
+
* Validate and clamp a numeric config value
|
|
3028
|
+
*/
|
|
3029
|
+
// Subscribe to shared mouse tracker
|
|
3030
|
+
React.useEffect((() => {
|
|
3031
|
+
if (externalGlobalMousePosition && externalMouseOffset) return;
|
|
3032
|
+
if (effectiveWithoutEffects) return;
|
|
3033
|
+
const unsubscribe = globalMouseTracker.subscribe(handleGlobalMousePosition), container = mouseContainer?.current || glassRef.current;
|
|
3034
|
+
let resizeObserver = null;
|
|
3035
|
+
return container && "undefined" != typeof ResizeObserver && (resizeObserver = new ResizeObserver((() => {
|
|
3036
|
+
null !== updateRectRef.current && cancelAnimationFrame(updateRectRef.current), updateRectRef.current = requestAnimationFrame((() => {
|
|
3037
|
+
const container = mouseContainer?.current || glassRef.current;
|
|
3038
|
+
container && (cachedRectRef.current = container.getBoundingClientRect()), updateRectRef.current = null;
|
|
3039
|
+
}));
|
|
3040
|
+
})), resizeObserver.observe(container)), () => {
|
|
3041
|
+
unsubscribe(), null !== updateRectRef.current && (cancelAnimationFrame(updateRectRef.current),
|
|
3042
|
+
updateRectRef.current = null), resizeObserver && resizeObserver.disconnect();
|
|
2541
3043
|
};
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
3044
|
+
}), [ handleGlobalMousePosition, mouseContainer, glassRef, externalGlobalMousePosition, externalMouseOffset, effectiveWithoutEffects ]),
|
|
3045
|
+
// Also call updateStyles on other state changes (hover, active, etc)
|
|
3046
|
+
React.useEffect((() => {
|
|
3047
|
+
updateAtomixGlassStyles(wrapperRef?.current || null, glassRef.current, {
|
|
3048
|
+
mouseOffset: externalMouseOffset || internalMouseOffsetRef.current,
|
|
3049
|
+
globalMousePosition: externalGlobalMousePosition || internalGlobalMousePositionRef.current,
|
|
3050
|
+
glassSize: glassSize,
|
|
3051
|
+
isHovered: isHovered,
|
|
3052
|
+
isActive: isActive,
|
|
3053
|
+
isOverLight: baseOverLightConfig.isOverLight,
|
|
3054
|
+
baseOverLightConfig: baseOverLightConfig,
|
|
3055
|
+
effectiveBorderRadius: effectiveBorderRadius,
|
|
3056
|
+
effectiveWithoutEffects: effectiveWithoutEffects,
|
|
3057
|
+
effectiveReducedMotion: effectiveReducedMotion,
|
|
3058
|
+
elasticity: elasticity,
|
|
3059
|
+
directionalScale: directionalScale,
|
|
3060
|
+
onClick: onClick,
|
|
3061
|
+
withLiquidBlur: withLiquidBlur,
|
|
3062
|
+
blurAmount: blurAmount,
|
|
3063
|
+
saturation: saturation,
|
|
3064
|
+
padding: padding
|
|
3065
|
+
});
|
|
3066
|
+
}), [ isHovered, isActive, glassSize, baseOverLightConfig, effectiveBorderRadius, effectiveWithoutEffects, effectiveReducedMotion, elasticity, directionalScale, wrapperRef, glassRef, externalMouseOffset, externalGlobalMousePosition, withLiquidBlur, blurAmount, saturation, padding, onClick ]);
|
|
3067
|
+
// Event handlers
|
|
3068
|
+
const handleMouseEnter = React.useCallback((() => setIsHovered(!0)), []), handleMouseLeave = React.useCallback((() => setIsHovered(!1)), []), handleMouseDown = React.useCallback((() => setIsActive(!0)), []), handleMouseUp = React.useCallback((() => setIsActive(!1)), []), handleMouseMove = React.useCallback((_e => {}), []), handleKeyDown = React.useCallback((e => {
|
|
2557
3069
|
!onClick || "Enter" !== e.key && " " !== e.key || (e.preventDefault(), onClick());
|
|
2558
|
-
}), [ onClick ])
|
|
2559
|
-
|
|
2560
|
-
* Validate and clamp a numeric config value
|
|
2561
|
-
* @param value - The value to validate
|
|
2562
|
-
* @param min - Minimum allowed value
|
|
2563
|
-
* @param max - Maximum allowed value
|
|
2564
|
-
* @param defaultValue - Default value if validation fails
|
|
2565
|
-
* @returns Validated and clamped value
|
|
2566
|
-
*/ return {
|
|
2567
|
-
// State
|
|
3070
|
+
}), [ onClick ]);
|
|
3071
|
+
return {
|
|
2568
3072
|
isHovered: isHovered,
|
|
2569
3073
|
isActive: isActive,
|
|
2570
3074
|
glassSize: glassSize,
|
|
2571
|
-
|
|
2572
|
-
|
|
3075
|
+
dynamicBorderRadius: dynamicBorderRadius,
|
|
3076
|
+
effectiveBorderRadius: effectiveBorderRadius,
|
|
2573
3077
|
effectiveReducedMotion: effectiveReducedMotion,
|
|
2574
3078
|
effectiveHighContrast: effectiveHighContrast,
|
|
2575
|
-
|
|
3079
|
+
effectiveWithoutEffects: effectiveWithoutEffects,
|
|
2576
3080
|
detectedOverLight: detectedOverLight,
|
|
2577
3081
|
globalMousePosition: globalMousePosition,
|
|
3082
|
+
// This is now static (refs or props) unless prop changes
|
|
2578
3083
|
mouseOffset: mouseOffset,
|
|
2579
|
-
//
|
|
3084
|
+
// This is now static (refs or props) unless prop changes
|
|
2580
3085
|
overLightConfig: overLightConfig,
|
|
2581
|
-
// Transform calculations
|
|
2582
3086
|
elasticTranslation: elasticTranslation,
|
|
2583
3087
|
directionalScale: directionalScale,
|
|
2584
3088
|
transformStyle: transformStyle,
|
|
2585
|
-
// Event handlers
|
|
2586
3089
|
handleMouseEnter: handleMouseEnter,
|
|
2587
3090
|
handleMouseLeave: handleMouseLeave,
|
|
2588
3091
|
handleMouseDown: handleMouseDown,
|
|
@@ -2621,7 +3124,7 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
2621
3124
|
*
|
|
2622
3125
|
* @example
|
|
2623
3126
|
* // Manual border-radius override
|
|
2624
|
-
* <AtomixGlass
|
|
3127
|
+
* <AtomixGlass borderRadius={20}>
|
|
2625
3128
|
* <div>Content with 20px glass radius</div>
|
|
2626
3129
|
* </AtomixGlass>
|
|
2627
3130
|
*
|
|
@@ -2662,37 +3165,48 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
2662
3165
|
* <AtomixGlass overLight="auto" debugOverLight={true}>
|
|
2663
3166
|
* <div>Content with debug logging enabled</div>
|
|
2664
3167
|
* </AtomixGlass>
|
|
2665
|
-
*/ 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,
|
|
2666
|
-
const glassRef = React.useRef(null), contentRef = React.useRef(null), {isHovered: isHovered, isActive: isActive, glassSize: glassSize,
|
|
3168
|
+
*/ 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}) {
|
|
3169
|
+
const glassRef = React.useRef(null), contentRef = React.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({
|
|
2667
3170
|
glassRef: glassRef,
|
|
2668
3171
|
contentRef: contentRef,
|
|
2669
|
-
|
|
3172
|
+
borderRadius: borderRadius,
|
|
2670
3173
|
globalMousePosition: externalGlobalMousePosition,
|
|
2671
3174
|
mouseOffset: externalMouseOffset,
|
|
2672
3175
|
mouseContainer: mouseContainer,
|
|
2673
3176
|
overLight: overLight,
|
|
2674
3177
|
reducedMotion: reducedMotion,
|
|
2675
3178
|
highContrast: highContrast,
|
|
2676
|
-
|
|
3179
|
+
withoutEffects: withoutEffects,
|
|
2677
3180
|
elasticity: elasticity,
|
|
2678
3181
|
onClick: onClick,
|
|
2679
|
-
|
|
3182
|
+
debugBorderRadius: debugBorderRadius,
|
|
2680
3183
|
debugOverLight: debugOverLight,
|
|
2681
|
-
|
|
2682
|
-
children: children
|
|
2683
|
-
|
|
3184
|
+
debugPerformance: debugPerformance,
|
|
3185
|
+
children: children,
|
|
3186
|
+
blurAmount: blurAmount,
|
|
3187
|
+
saturation: saturation,
|
|
3188
|
+
withLiquidBlur: withLiquidBlur,
|
|
3189
|
+
padding: padding,
|
|
3190
|
+
style: style
|
|
3191
|
+
}), isOverLight = React.useMemo((() => overLightConfig?.isOverLight), [ overLight ]), shouldRenderOverLightLayers = withOverLightLayers && isOverLight, baseStyle = {
|
|
2684
3192
|
...style,
|
|
2685
|
-
...!
|
|
3193
|
+
...!effectiveWithoutEffects && {
|
|
2686
3194
|
transform: transformStyle
|
|
2687
3195
|
}
|
|
2688
|
-
}, componentClassName = [ ATOMIX_GLASS.BASE_CLASS, effectiveReducedMotion && `${ATOMIX_GLASS.BASE_CLASS}--reduced-motion`, effectiveHighContrast && `${ATOMIX_GLASS.BASE_CLASS}--high-contrast`,
|
|
3196
|
+
}, 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 = React.useMemo((() => ({
|
|
2689
3197
|
position: style.position || "absolute",
|
|
2690
3198
|
top: style.top || 0,
|
|
2691
3199
|
left: style.left || 0
|
|
2692
|
-
})), [ style.position, style.top, style.left ]), adjustedSize = React.useMemo((() =>
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
3200
|
+
})), [ style.position, style.top, style.left ]), adjustedSize = React.useMemo((() => {
|
|
3201
|
+
const resolveSize = (propValue, styleValue, measuredSize) => {
|
|
3202
|
+
const explicitSize = propValue ?? styleValue;
|
|
3203
|
+
return void 0 !== explicitSize ? "number" == typeof explicitSize ? `${explicitSize}px` : explicitSize : "fixed" === positionStyles.position ? `${Math.max(measuredSize, 0)}px` : "100%";
|
|
3204
|
+
};
|
|
3205
|
+
return {
|
|
3206
|
+
width: resolveSize(width, style.width, glassSize.width),
|
|
3207
|
+
height: resolveSize(height, style.height, glassSize.height)
|
|
3208
|
+
};
|
|
3209
|
+
}), [ width, height, style.width, style.height, positionStyles.position, glassSize.width, glassSize.height ]), gradientValues = React.useMemo((() => {
|
|
2696
3210
|
const mx = mouseOffset.x, my = mouseOffset.y, absMx = Math.abs(mx), absMy = Math.abs(my), GRADIENT = ATOMIX_GLASS.CONSTANTS.GRADIENT;
|
|
2697
3211
|
return {
|
|
2698
3212
|
borderGradientAngle: GRADIENT.BASE_ANGLE + mx * GRADIENT.ANGLE_MULTIPLIER,
|
|
@@ -2734,13 +3248,13 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
2734
3248
|
}), [ isHovered, isActive, isOverLight, overLightConfig.opacity ]), glassVars = React.useMemo((() => {
|
|
2735
3249
|
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;
|
|
2736
3250
|
return {
|
|
2737
|
-
"--atomix-glass-radius": `${
|
|
3251
|
+
"--atomix-glass-radius": `${effectiveBorderRadius}px`,
|
|
2738
3252
|
"--atomix-glass-transform": transformStyle || "none",
|
|
2739
3253
|
"--atomix-glass-position": positionStyles.position,
|
|
2740
3254
|
"--atomix-glass-top": "fixed" !== positionStyles.top ? `${positionStyles.top}px` : "0",
|
|
2741
3255
|
"--atomix-glass-left": "fixed" !== positionStyles.left ? `${positionStyles.left}px` : "0",
|
|
2742
|
-
"--atomix-glass-width":
|
|
2743
|
-
"--atomix-glass-height":
|
|
3256
|
+
"--atomix-glass-width": adjustedSize.width,
|
|
3257
|
+
"--atomix-glass-height": adjustedSize.height,
|
|
2744
3258
|
"--atomix-glass-border-width": "var(--atomix-spacing-0-5, 0.09375rem)",
|
|
2745
3259
|
"--atomix-glass-blend-mode": isOverLight ? "multiply" : "overlay",
|
|
2746
3260
|
"--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%)`,
|
|
@@ -2756,24 +3270,25 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
2756
3270
|
"--atomix-glass-overlay-opacity": opacityValues.over,
|
|
2757
3271
|
"--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})`
|
|
2758
3272
|
};
|
|
2759
|
-
}), [ gradientValues, opacityValues,
|
|
3273
|
+
}), [ gradientValues, opacityValues, effectiveBorderRadius, transformStyle, positionStyles, adjustedSize, isOverLight, overLightConfig.borderOpacity ]), renderBackgroundLayer = layerType => jsxRuntime.jsx("div", {
|
|
2760
3274
|
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(" "),
|
|
2761
3275
|
style: {
|
|
2762
3276
|
...positionStyles,
|
|
2763
3277
|
height: adjustedSize.height,
|
|
2764
3278
|
width: adjustedSize.width,
|
|
2765
|
-
borderRadius: `${
|
|
3279
|
+
borderRadius: `${effectiveBorderRadius}px`,
|
|
2766
3280
|
transform: baseStyle.transform
|
|
2767
3281
|
}
|
|
2768
3282
|
});
|
|
2769
3283
|
return jsxRuntime.jsxs("div", {
|
|
3284
|
+
...rest,
|
|
2770
3285
|
className: componentClassName,
|
|
2771
3286
|
style: glassVars,
|
|
2772
3287
|
role: role || (onClick ? "button" : void 0),
|
|
2773
3288
|
tabIndex: onClick ? tabIndex ?? 0 : tabIndex,
|
|
2774
3289
|
"aria-label": ariaLabel,
|
|
2775
3290
|
"aria-describedby": ariaDescribedBy,
|
|
2776
|
-
"aria-disabled": !(!onClick || !
|
|
3291
|
+
"aria-disabled": !(!onClick || !effectiveWithoutEffects) || !onClick && void 0,
|
|
2777
3292
|
"aria-pressed": !(!onClick || !isActive) || !onClick && void 0,
|
|
2778
3293
|
onKeyDown: onClick ? handleKeyDown : void 0,
|
|
2779
3294
|
children: [ jsxRuntime.jsx(AtomixGlassContainer, {
|
|
@@ -2781,18 +3296,18 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
2781
3296
|
contentRef: contentRef,
|
|
2782
3297
|
className: className,
|
|
2783
3298
|
style: baseStyle,
|
|
2784
|
-
|
|
2785
|
-
displacementScale:
|
|
2786
|
-
blurAmount:
|
|
3299
|
+
borderRadius: effectiveBorderRadius,
|
|
3300
|
+
displacementScale: effectiveWithoutEffects ? 0 : "shader" === mode ? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.SHADER_DISPLACEMENT : isOverLight ? displacementScale * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.OVER_LIGHT_DISPLACEMENT : displacementScale,
|
|
3301
|
+
blurAmount: effectiveWithoutEffects ? 0 : blurAmount,
|
|
2787
3302
|
saturation: effectiveHighContrast ? ATOMIX_GLASS.CONSTANTS.SATURATION.HIGH_CONTRAST : isOverLight ? saturation * overLightConfig.saturationBoost : saturation,
|
|
2788
|
-
aberrationIntensity:
|
|
3303
|
+
aberrationIntensity: effectiveWithoutEffects ? 0 : "shader" === mode ? aberrationIntensity * ATOMIX_GLASS.CONSTANTS.MULTIPLIERS.SHADER_ABERRATION : aberrationIntensity,
|
|
2789
3304
|
glassSize: glassSize,
|
|
2790
3305
|
padding: padding,
|
|
2791
|
-
mouseOffset:
|
|
3306
|
+
mouseOffset: effectiveWithoutEffects ? {
|
|
2792
3307
|
x: 0,
|
|
2793
3308
|
y: 0
|
|
2794
3309
|
} : mouseOffset,
|
|
2795
|
-
globalMousePosition:
|
|
3310
|
+
globalMousePosition: effectiveWithoutEffects ? {
|
|
2796
3311
|
x: 0,
|
|
2797
3312
|
y: 0
|
|
2798
3313
|
} : globalMousePosition,
|
|
@@ -2812,11 +3327,11 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
2812
3327
|
onClick: onClick,
|
|
2813
3328
|
mode: mode,
|
|
2814
3329
|
transform: baseStyle.transform,
|
|
2815
|
-
|
|
3330
|
+
effectiveWithoutEffects: effectiveWithoutEffects,
|
|
2816
3331
|
effectiveReducedMotion: effectiveReducedMotion,
|
|
2817
3332
|
shaderVariant: shaderVariant,
|
|
2818
3333
|
elasticity: elasticity,
|
|
2819
|
-
|
|
3334
|
+
withLiquidBlur: withLiquidBlur,
|
|
2820
3335
|
children: children
|
|
2821
3336
|
}), Boolean(onClick) && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2822
3337
|
children: [ jsxRuntime.jsx("div", {
|
|
@@ -2838,17 +3353,87 @@ function useAtomixGlass({glassRef: glassRef, contentRef: contentRef, cornerRadiu
|
|
|
2838
3353
|
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}%)`
|
|
2839
3354
|
}
|
|
2840
3355
|
}) ]
|
|
2841
|
-
}),
|
|
3356
|
+
}), withBorder && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
2842
3357
|
children: [ jsxRuntime.jsx("span", {
|
|
2843
|
-
className: ATOMIX_GLASS.BORDER_1_CLASS
|
|
3358
|
+
className: ATOMIX_GLASS.BORDER_1_CLASS,
|
|
3359
|
+
style: {
|
|
3360
|
+
width: glassSize.width,
|
|
3361
|
+
height: glassSize.height
|
|
3362
|
+
}
|
|
2844
3363
|
}), jsxRuntime.jsx("span", {
|
|
2845
|
-
className: ATOMIX_GLASS.BORDER_2_CLASS
|
|
3364
|
+
className: ATOMIX_GLASS.BORDER_2_CLASS,
|
|
3365
|
+
style: {
|
|
3366
|
+
width: glassSize.width,
|
|
3367
|
+
height: glassSize.height
|
|
3368
|
+
}
|
|
2846
3369
|
}) ]
|
|
2847
3370
|
}) ]
|
|
2848
3371
|
});
|
|
2849
3372
|
}
|
|
2850
3373
|
|
|
2851
|
-
|
|
3374
|
+
// Default icon
|
|
3375
|
+
const DefaultIcon = () => jsxRuntime.jsx("i", {
|
|
3376
|
+
className: "c-accordion__icon",
|
|
3377
|
+
"aria-hidden": "true",
|
|
3378
|
+
children: jsxRuntime.jsx("svg", {
|
|
3379
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
3380
|
+
width: "24",
|
|
3381
|
+
height: "24",
|
|
3382
|
+
viewBox: "0 0 24 24",
|
|
3383
|
+
fill: "none",
|
|
3384
|
+
stroke: "currentColor",
|
|
3385
|
+
strokeWidth: "2",
|
|
3386
|
+
strokeLinecap: "round",
|
|
3387
|
+
strokeLinejoin: "round",
|
|
3388
|
+
"aria-hidden": "true",
|
|
3389
|
+
focusable: "false",
|
|
3390
|
+
children: jsxRuntime.jsx("polyline", {
|
|
3391
|
+
points: "6 9 12 15 18 9"
|
|
3392
|
+
})
|
|
3393
|
+
})
|
|
3394
|
+
}), AccordionHeader = React.forwardRef((({title: title, icon: icon, iconPosition: iconPosition = "right", isOpen: isOpen, children: children, className: className = "", ...props}, ref) => {
|
|
3395
|
+
// Determine icon to render. Explicit check for undefined to allow null/false to hide icon.
|
|
3396
|
+
const iconElement = void 0 === icon ? jsxRuntime.jsx(DefaultIcon, {}) : icon;
|
|
3397
|
+
return jsxRuntime.jsxs("button", {
|
|
3398
|
+
ref: ref,
|
|
3399
|
+
type: "button",
|
|
3400
|
+
className: className,
|
|
3401
|
+
...props,
|
|
3402
|
+
children: [ title && jsxRuntime.jsx("span", {
|
|
3403
|
+
className: "c-accordion__title",
|
|
3404
|
+
children: title
|
|
3405
|
+
}), children, iconElement ]
|
|
3406
|
+
});
|
|
3407
|
+
}));
|
|
3408
|
+
|
|
3409
|
+
AccordionHeader.displayName = "AccordionHeader";
|
|
3410
|
+
|
|
3411
|
+
const AccordionBody = React.forwardRef((({children: children, className: className = "", panelRef: panelRef, contentRef: contentRef, ...props}, ref) => {
|
|
3412
|
+
const mergedPanelRef = React__default.default.useMemo((() =>
|
|
3413
|
+
// Helper to merge refs
|
|
3414
|
+
function(...refs) {
|
|
3415
|
+
return node => {
|
|
3416
|
+
refs.forEach((ref => {
|
|
3417
|
+
"function" == typeof ref ? ref(node) : null != ref && (ref.current = node);
|
|
3418
|
+
}));
|
|
3419
|
+
};
|
|
3420
|
+
}(ref, panelRef)), [ ref, panelRef ]);
|
|
3421
|
+
return jsxRuntime.jsx("div", {
|
|
3422
|
+
ref: mergedPanelRef,
|
|
3423
|
+
className: className,
|
|
3424
|
+
role: "region",
|
|
3425
|
+
...props,
|
|
3426
|
+
children: jsxRuntime.jsx("div", {
|
|
3427
|
+
className: ACCORDION.SELECTORS.BODY.replace(".", ""),
|
|
3428
|
+
ref: contentRef,
|
|
3429
|
+
children: children
|
|
3430
|
+
})
|
|
3431
|
+
});
|
|
3432
|
+
}));
|
|
3433
|
+
|
|
3434
|
+
AccordionBody.displayName = "AccordionBody";
|
|
3435
|
+
|
|
3436
|
+
const AccordionImpl = React.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}) => {
|
|
2852
3437
|
// Generate unique IDs for accessibility
|
|
2853
3438
|
const instanceId = React.useId(), buttonId = `accordion-header-${instanceId}`, panelId = `accordion-panel-${instanceId}`, {state: state, toggle: toggle, updatePanelHeight: updatePanelHeight, panelRef: panelRef, contentRef: contentRef, generateClassNames: generateClassNames, generateHeaderClassNames: generateHeaderClassNames} = useAccordion({
|
|
2854
3439
|
defaultOpen: defaultOpen,
|
|
@@ -2858,53 +3443,59 @@ const Accordion = React.memo((({title: title, children: children, defaultOpen:
|
|
|
2858
3443
|
onOpenChange: onOpenChange,
|
|
2859
3444
|
onOpen: onOpen,
|
|
2860
3445
|
onClose: onClose
|
|
2861
|
-
}),
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
width: "24",
|
|
2867
|
-
height: "24",
|
|
2868
|
-
viewBox: "0 0 24 24",
|
|
2869
|
-
fill: "none",
|
|
2870
|
-
stroke: "currentColor",
|
|
2871
|
-
strokeWidth: "2",
|
|
2872
|
-
strokeLinecap: "round",
|
|
2873
|
-
strokeLinejoin: "round",
|
|
2874
|
-
"aria-hidden": "true",
|
|
2875
|
-
focusable: "false",
|
|
2876
|
-
children: jsxRuntime.jsx("polyline", {
|
|
2877
|
-
points: "6 9 12 15 18 9"
|
|
2878
|
-
})
|
|
2879
|
-
})
|
|
2880
|
-
}), accordionContent = jsxRuntime.jsxs("div", {
|
|
3446
|
+
}), headerClassNames = generateHeaderClassNames(), panelClassNames = ACCORDION.SELECTORS.PANEL.replace(".", ""), hasCompoundComponents = React__default.default.Children.toArray(children).some((child => {
|
|
3447
|
+
var _context;
|
|
3448
|
+
|
|
3449
|
+
return React__default.default.isValidElement(child) && _includesInstanceProperty(_context = [ "AccordionHeader", "AccordionBody" ]).call(_context, child.type.displayName);
|
|
3450
|
+
})), content = jsxRuntime.jsx("div", {
|
|
2881
3451
|
className: generateClassNames(className) + (glass ? " c-accordion--glass" : ""),
|
|
2882
3452
|
style: style,
|
|
2883
|
-
children:
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
3453
|
+
children: hasCompoundComponents ? React__default.default.Children.map(children, (child => {
|
|
3454
|
+
if ( React__default.default.isValidElement(child)) {
|
|
3455
|
+
if ("AccordionHeader" === child.type.displayName)
|
|
3456
|
+
return React__default.default.cloneElement(child, {
|
|
3457
|
+
id: buttonId,
|
|
3458
|
+
className: `${headerClassNames} ${child.props.className || ""}`.trim(),
|
|
3459
|
+
onClick: e => {
|
|
3460
|
+
toggle(), child.props.onClick?.(e);
|
|
3461
|
+
},
|
|
3462
|
+
"aria-expanded": state.isOpen,
|
|
3463
|
+
"aria-controls": panelId,
|
|
3464
|
+
"aria-disabled": disabled,
|
|
3465
|
+
disabled: disabled,
|
|
3466
|
+
iconPosition: child.props.iconPosition || iconPosition
|
|
3467
|
+
});
|
|
3468
|
+
if ("AccordionBody" === child.type.displayName)
|
|
3469
|
+
return React__default.default.cloneElement(child, {
|
|
3470
|
+
id: panelId,
|
|
3471
|
+
className: `${panelClassNames} ${child.props.className || ""}`.trim(),
|
|
3472
|
+
"aria-labelledby": buttonId,
|
|
3473
|
+
panelRef: panelRef,
|
|
3474
|
+
contentRef: contentRef
|
|
3475
|
+
});
|
|
3476
|
+
}
|
|
3477
|
+
return child;
|
|
3478
|
+
})) : jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3479
|
+
children: [ jsxRuntime.jsx(AccordionHeader, {
|
|
3480
|
+
id: buttonId,
|
|
3481
|
+
className: headerClassNames,
|
|
3482
|
+
onClick: toggle,
|
|
3483
|
+
"aria-expanded": state.isOpen,
|
|
3484
|
+
"aria-controls": panelId,
|
|
3485
|
+
"aria-disabled": disabled,
|
|
3486
|
+
disabled: disabled,
|
|
3487
|
+
title: title,
|
|
3488
|
+
icon: icon,
|
|
3489
|
+
iconPosition: iconPosition
|
|
3490
|
+
}), jsxRuntime.jsx(AccordionBody, {
|
|
3491
|
+
id: panelId,
|
|
3492
|
+
className: panelClassNames,
|
|
3493
|
+
"aria-labelledby": buttonId,
|
|
3494
|
+
panelRef: panelRef,
|
|
3495
|
+
contentRef: contentRef,
|
|
2905
3496
|
children: children
|
|
2906
|
-
})
|
|
2907
|
-
})
|
|
3497
|
+
}) ]
|
|
3498
|
+
})
|
|
2908
3499
|
});
|
|
2909
3500
|
if (glass) {
|
|
2910
3501
|
// Default glass settings for accordions
|
|
@@ -2917,16 +3508,20 @@ const Accordion = React.memo((({title: title, children: children, defaultOpen:
|
|
|
2917
3508
|
};
|
|
2918
3509
|
return jsxRuntime.jsx(AtomixGlass, {
|
|
2919
3510
|
...glassProps,
|
|
2920
|
-
children:
|
|
3511
|
+
children: content
|
|
2921
3512
|
});
|
|
2922
3513
|
}
|
|
2923
|
-
return
|
|
3514
|
+
return content;
|
|
2924
3515
|
}));
|
|
2925
3516
|
|
|
2926
|
-
|
|
2927
|
-
|
|
3517
|
+
AccordionImpl.displayName = "Accordion";
|
|
3518
|
+
|
|
3519
|
+
// Attach subcomponents
|
|
3520
|
+
const AccordionWithSubcomponents = AccordionImpl;
|
|
3521
|
+
|
|
3522
|
+
AccordionWithSubcomponents.Header = AccordionHeader, AccordionWithSubcomponents.Body = AccordionBody;
|
|
2928
3523
|
|
|
2929
|
-
const AtomixLogo = ({height: height = 24, width: width = 24, color: color = "currentColor", ...props}) => jsxRuntime.jsxs("svg", {
|
|
3524
|
+
const Accordion = AccordionWithSubcomponents, AtomixLogo = ({height: height = 24, width: width = 24, color: color = "currentColor", ...props}) => jsxRuntime.jsxs("svg", {
|
|
2930
3525
|
width: width,
|
|
2931
3526
|
height: height,
|
|
2932
3527
|
viewBox: "0 0 24 24",
|
|
@@ -3153,8 +3748,6 @@ const AtomixLogo = ({height: height = 24, width: width = 24, color: color = "cur
|
|
|
3153
3748
|
noise: (uv, mousePosition) => fragmentShaders.appleFluid(uv, mousePosition)
|
|
3154
3749
|
};
|
|
3155
3750
|
|
|
3156
|
-
// Adapted from https://github.com/shuding/liquid-glass
|
|
3157
|
-
// Constants
|
|
3158
3751
|
var shaderUtils = Object.freeze({
|
|
3159
3752
|
__proto__: null,
|
|
3160
3753
|
ShaderDisplacementGenerator: class {
|
|
@@ -3382,7 +3975,7 @@ const Badge = React.memo((({label: label, variant: variant = "primary", size: s
|
|
|
3382
3975
|
// Default glass settings for badges
|
|
3383
3976
|
const defaultGlassProps = {
|
|
3384
3977
|
displacementScale: 20,
|
|
3385
|
-
|
|
3978
|
+
borderRadius: ref.current?.getBoundingClientRect().width ? ref.current?.getBoundingClientRect().width / 2 : 16,
|
|
3386
3979
|
className: "c-badge--glass",
|
|
3387
3980
|
elasticity: 0
|
|
3388
3981
|
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
@@ -3503,43 +4096,81 @@ const useBlock = () => ({
|
|
|
3503
4096
|
* ```
|
|
3504
4097
|
*/ Block.displayName = "Block";
|
|
3505
4098
|
|
|
3506
|
-
const
|
|
4099
|
+
const BreadcrumbItem = React.forwardRef((({children: children, href: href, active: active, icon: icon, onClick: onClick, className: className = "", style: style, linkAs: linkAs, linkProps: linkProps = {}, ...props}, ref) => {
|
|
4100
|
+
const itemClasses = [ BREADCRUMB.CLASSES.ITEM, active ? BREADCRUMB.CLASSES.ACTIVE : "", className ].filter(Boolean).join(" "), linkContent = jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
4101
|
+
children: [ icon && jsxRuntime.jsx("span", {
|
|
4102
|
+
className: "c-breadcrumb__icon",
|
|
4103
|
+
children: icon
|
|
4104
|
+
}), children ]
|
|
4105
|
+
}), commonLinkProps = {
|
|
4106
|
+
className: BREADCRUMB.CLASSES.LINK,
|
|
4107
|
+
onClick: onClick,
|
|
4108
|
+
style: style,
|
|
4109
|
+
// Apply style to the link as per legacy behavior
|
|
4110
|
+
...linkProps
|
|
4111
|
+
}, LinkComponent = linkAs;
|
|
4112
|
+
return jsxRuntime.jsx("li", {
|
|
4113
|
+
ref: ref,
|
|
4114
|
+
className: itemClasses,
|
|
4115
|
+
style: style,
|
|
4116
|
+
...props,
|
|
4117
|
+
children: href && !active ? LinkComponent ?
|
|
4118
|
+
// @ts-ignore - Dynamic components are tricky in TS without stricter types
|
|
4119
|
+
jsxRuntime.jsx(LinkComponent, {
|
|
4120
|
+
href: href,
|
|
4121
|
+
...commonLinkProps,
|
|
4122
|
+
children: linkContent
|
|
4123
|
+
}) : jsxRuntime.jsx("a", {
|
|
4124
|
+
href: href,
|
|
4125
|
+
...commonLinkProps,
|
|
4126
|
+
children: linkContent
|
|
4127
|
+
}) : jsxRuntime.jsx("span", {
|
|
4128
|
+
className: BREADCRUMB.CLASSES.LINK,
|
|
4129
|
+
children: linkContent
|
|
4130
|
+
})
|
|
4131
|
+
});
|
|
4132
|
+
}));
|
|
4133
|
+
|
|
4134
|
+
BreadcrumbItem.displayName = "BreadcrumbItem";
|
|
4135
|
+
|
|
4136
|
+
const Breadcrumb = React.memo((function({items: items, divider: divider, className: className = "", "aria-label": ariaLabel = "Breadcrumb", LinkComponent: LinkComponent, style: style, children: children}) {
|
|
3507
4137
|
const breadcrumbClasses = [ BREADCRUMB.CLASSES.BASE, className ].filter(Boolean).join(" ");
|
|
4138
|
+
let content;
|
|
4139
|
+
if (items && items.length > 0)
|
|
4140
|
+
// Legacy rendering
|
|
4141
|
+
content = items.map(((item, index) => {
|
|
4142
|
+
const isLast = index === items.length - 1;
|
|
4143
|
+
return jsxRuntime.jsx(BreadcrumbItem, {
|
|
4144
|
+
href: item.href,
|
|
4145
|
+
active: item.active || isLast,
|
|
4146
|
+
icon: item.icon,
|
|
4147
|
+
onClick: item.onClick,
|
|
4148
|
+
className: item.className,
|
|
4149
|
+
style: item.style,
|
|
4150
|
+
linkAs: LinkComponent,
|
|
4151
|
+
children: item.label
|
|
4152
|
+
}, index);
|
|
4153
|
+
})); else {
|
|
4154
|
+
// Compound rendering
|
|
4155
|
+
const childrenCount = React.Children.count(children);
|
|
4156
|
+
content = React.Children.map(children, ((child, index) => {
|
|
4157
|
+
if ( React.isValidElement(child)) {
|
|
4158
|
+
const isLast = index === childrenCount - 1, childProps = child.props, {active: active, linkAs: linkAs, ...otherProps} = childProps, newProps = {
|
|
4159
|
+
active: active ?? (!!isLast || void 0),
|
|
4160
|
+
linkAs: linkAs ?? LinkComponent
|
|
4161
|
+
};
|
|
4162
|
+
|
|
4163
|
+
return React.cloneElement(child, newProps);
|
|
4164
|
+
}
|
|
4165
|
+
return child;
|
|
4166
|
+
}));
|
|
4167
|
+
}
|
|
3508
4168
|
return jsxRuntime.jsx("nav", {
|
|
3509
4169
|
"aria-label": ariaLabel,
|
|
3510
4170
|
style: style,
|
|
3511
4171
|
children: jsxRuntime.jsx("ol", {
|
|
3512
4172
|
className: breadcrumbClasses,
|
|
3513
|
-
children:
|
|
3514
|
-
const isLast = index === items.length - 1, itemClasses = [ BREADCRUMB.CLASSES.ITEM, item.active || isLast ? BREADCRUMB.CLASSES.ACTIVE : "" ].filter(Boolean).join(" "), linkContent = jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3515
|
-
children: [ item.icon && jsxRuntime.jsx("span", {
|
|
3516
|
-
className: "c-breadcrumb__icon",
|
|
3517
|
-
children: item.icon
|
|
3518
|
-
}), item.label ]
|
|
3519
|
-
}), linkProps = {
|
|
3520
|
-
href: item.href,
|
|
3521
|
-
className: BREADCRUMB.CLASSES.LINK,
|
|
3522
|
-
onClick: item.onClick,
|
|
3523
|
-
style: item.style
|
|
3524
|
-
};
|
|
3525
|
-
return jsxRuntime.jsx("li", {
|
|
3526
|
-
className: itemClasses,
|
|
3527
|
-
style: item.style,
|
|
3528
|
-
children: item.href && !item.active ? LinkComponent ? (() => {
|
|
3529
|
-
const Component = LinkComponent;
|
|
3530
|
-
return jsxRuntime.jsx(Component, {
|
|
3531
|
-
...linkProps,
|
|
3532
|
-
children: linkContent
|
|
3533
|
-
});
|
|
3534
|
-
})() : jsxRuntime.jsx("a", {
|
|
3535
|
-
...linkProps,
|
|
3536
|
-
children: linkContent
|
|
3537
|
-
}) : jsxRuntime.jsx("span", {
|
|
3538
|
-
className: BREADCRUMB.CLASSES.LINK,
|
|
3539
|
-
children: linkContent
|
|
3540
|
-
})
|
|
3541
|
-
}, index);
|
|
3542
|
-
}))
|
|
4173
|
+
children: content
|
|
3543
4174
|
})
|
|
3544
4175
|
});
|
|
3545
4176
|
}));
|
|
@@ -3570,7 +4201,7 @@ function useSpinner(initialProps) {
|
|
|
3570
4201
|
};
|
|
3571
4202
|
}
|
|
3572
4203
|
|
|
3573
|
-
Breadcrumb.displayName = "Breadcrumb";
|
|
4204
|
+
Breadcrumb.displayName = "Breadcrumb", Breadcrumb.Item = BreadcrumbItem;
|
|
3574
4205
|
|
|
3575
4206
|
const Spinner = React.memo((({size: size = "md", variant: variant = "primary", fullscreen: fullscreen = !1, className: className = "", style: style, glass: glass, "aria-label": ariaLabel, role: role = "status"}) => {
|
|
3576
4207
|
const {generateSpinnerClass: generateSpinnerClass} = useSpinner({
|
|
@@ -3596,7 +4227,7 @@ const Spinner = React.memo((({size: size = "md", variant: variant = "primary",
|
|
|
3596
4227
|
const defaultGlassProps = {
|
|
3597
4228
|
displacementScale: 20,
|
|
3598
4229
|
blurAmount: 1,
|
|
3599
|
-
|
|
4230
|
+
borderRadius: 999,
|
|
3600
4231
|
mode: "shader"
|
|
3601
4232
|
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
3602
4233
|
...defaultGlassProps,
|
|
@@ -3635,7 +4266,7 @@ class ThemeNaming {
|
|
|
3635
4266
|
* Convert camelCase to kebab-case for CSS variables
|
|
3636
4267
|
* @param str - String to convert
|
|
3637
4268
|
*/ static camelToKebab(str) {
|
|
3638
|
-
return str.replace(/([a-z0-9]
|
|
4269
|
+
return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
3639
4270
|
}
|
|
3640
4271
|
/**
|
|
3641
4272
|
* Convert kebab-case to camelCase for JavaScript properties
|
|
@@ -3783,438 +4414,133 @@ const Button = React__default.default.memo( React.forwardRef((({label: label, c
|
|
|
3783
4414
|
ref: ref,
|
|
3784
4415
|
type: "button" === Component ? type : void 0,
|
|
3785
4416
|
disabled: isDisabled,
|
|
3786
|
-
children: buttonContent
|
|
3787
|
-
});
|
|
3788
|
-
if (glass) {
|
|
3789
|
-
// Default glass props
|
|
3790
|
-
const defaultGlassProps = {
|
|
3791
|
-
displacementScale: 20,
|
|
3792
|
-
blurAmount: 0,
|
|
3793
|
-
saturation: 200,
|
|
3794
|
-
elasticity: 0
|
|
3795
|
-
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
3796
|
-
...defaultGlassProps,
|
|
3797
|
-
...glass
|
|
3798
|
-
};
|
|
3799
|
-
return jsxRuntime.jsx(AtomixGlass, {
|
|
3800
|
-
...glassProps,
|
|
3801
|
-
children: content
|
|
3802
|
-
});
|
|
3803
|
-
}
|
|
3804
|
-
return content;
|
|
3805
|
-
})));
|
|
3806
|
-
|
|
3807
|
-
Button.displayName = "Button";
|
|
3808
|
-
|
|
3809
|
-
/**
|
|
3810
|
-
* ButtonGroup - A component for grouping buttons together
|
|
3811
|
-
*
|
|
3812
|
-
* Groups buttons together with proper border radius handling and spacing.
|
|
3813
|
-
* The buttons will be visually connected with shared borders.
|
|
3814
|
-
*
|
|
3815
|
-
* @example
|
|
3816
|
-
* ```tsx
|
|
3817
|
-
* <ButtonGroup>
|
|
3818
|
-
* <Button label="Left" />
|
|
3819
|
-
* <Button label="Middle" />
|
|
3820
|
-
* <Button label="Right" />
|
|
3821
|
-
* </ButtonGroup>
|
|
3822
|
-
* ```
|
|
3823
|
-
*/
|
|
3824
|
-
const ButtonGroup = ({children: children, className: className = "", style: style, "aria-label": ariaLabel, role: role = "group"}) => {
|
|
3825
|
-
// Generate CSS classes
|
|
3826
|
-
const buttonGroupClasses = [ BUTTON_GROUP.CLASSES.BASE, className ].filter(Boolean).join(" "), buttonChildren = React.Children.toArray(children).filter((child => React.isValidElement(child) && child.type === Button));
|
|
3827
|
-
// Get valid Button children
|
|
3828
|
-
return jsxRuntime.jsx("div", {
|
|
3829
|
-
className: buttonGroupClasses,
|
|
3830
|
-
style: style,
|
|
3831
|
-
role: role,
|
|
3832
|
-
"aria-label": ariaLabel,
|
|
3833
|
-
children: buttonChildren.map(((child, index) => React.isValidElement(child) ? React.cloneElement(child, {
|
|
3834
|
-
key: index,
|
|
3835
|
-
...child.props
|
|
3836
|
-
}) : null))
|
|
3837
|
-
});
|
|
3838
|
-
};
|
|
3839
|
-
|
|
3840
|
-
ButtonGroup.displayName = "ButtonGroup";
|
|
3841
|
-
|
|
3842
|
-
var commonjsGlobal = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {};
|
|
3843
|
-
|
|
3844
|
-
function getDefaultExportFromCjs(x) {
|
|
3845
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x.default : x;
|
|
3846
|
-
}
|
|
3847
|
-
|
|
3848
|
-
var fails$9 = function(exec) {
|
|
3849
|
-
try {
|
|
3850
|
-
return !!exec();
|
|
3851
|
-
} catch (error) {
|
|
3852
|
-
return !0;
|
|
3853
|
-
}
|
|
3854
|
-
}, functionBindNative = !fails$9((function() {
|
|
3855
|
-
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
|
3856
|
-
var test = function() {/* empty */}.bind();
|
|
3857
|
-
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
3858
|
-
return "function" != typeof test || test.hasOwnProperty("prototype");
|
|
3859
|
-
})), 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) {
|
|
3860
|
-
return function() {
|
|
3861
|
-
return call$5.apply(fn, arguments);
|
|
3862
|
-
};
|
|
3863
|
-
}, objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf), check = function(it) {
|
|
3864
|
-
return it && it.Math === Math && it;
|
|
3865
|
-
}, globalThis_1 =
|
|
3866
|
-
// eslint-disable-next-line es/no-global-this -- safe
|
|
3867
|
-
check("object" == typeof globalThis && globalThis) || check("object" == typeof window && window) ||
|
|
3868
|
-
// eslint-disable-next-line no-restricted-globals -- safe
|
|
3869
|
-
check("object" == typeof self && self) || check("object" == typeof commonjsGlobal && commonjsGlobal) || check("object" == typeof commonjsGlobal && commonjsGlobal) ||
|
|
3870
|
-
// eslint-disable-next-line no-new-func -- fallback
|
|
3871
|
-
function() {
|
|
3872
|
-
return this;
|
|
3873
|
-
}() || 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() {
|
|
3874
|
-
return call$4.apply(apply$1, arguments);
|
|
3875
|
-
}), uncurryThis$7 = functionUncurryThis, toString$3 = uncurryThis$7({}.toString), stringSlice = uncurryThis$7("".slice), classofRaw$2 = function(it) {
|
|
3876
|
-
return stringSlice(toString$3(it), 8, -1);
|
|
3877
|
-
}, classofRaw$1 = classofRaw$2, uncurryThis$6 = functionUncurryThis, functionUncurryThisClause = function(fn) {
|
|
3878
|
-
// Nashorn bug:
|
|
3879
|
-
// https://github.com/zloirock/core-js/issues/1128
|
|
3880
|
-
// https://github.com/zloirock/core-js/issues/1130
|
|
3881
|
-
if ("Function" === classofRaw$1(fn)) return uncurryThis$6(fn);
|
|
3882
|
-
}, documentAll = "object" == typeof document && document.all, isCallable$8 = void 0 === documentAll && void 0 !== documentAll ? function(argument) {
|
|
3883
|
-
return "function" == typeof argument || argument === documentAll;
|
|
3884
|
-
} : function(argument) {
|
|
3885
|
-
return "function" == typeof argument;
|
|
3886
|
-
}, objectGetOwnPropertyDescriptor = {}, descriptors = !fails$9((function() {
|
|
3887
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
3888
|
-
return 7 !== Object.defineProperty({}, 1, {
|
|
3889
|
-
get: function() {
|
|
3890
|
-
return 7;
|
|
3891
|
-
}
|
|
3892
|
-
})[1];
|
|
3893
|
-
})), NATIVE_BIND$1 = functionBindNative, call$3 = Function.prototype.call, functionCall = NATIVE_BIND$1 ? call$3.bind(call$3) : function() {
|
|
3894
|
-
return call$3.apply(call$3, arguments);
|
|
3895
|
-
}, objectPropertyIsEnumerable = {}, $propertyIsEnumerable = {}.propertyIsEnumerable, getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor, NASHORN_BUG = getOwnPropertyDescriptor$1 && !$propertyIsEnumerable.call({
|
|
3896
|
-
1: 2
|
|
3897
|
-
}, 1);
|
|
3898
|
-
|
|
3899
|
-
// `Object.prototype.propertyIsEnumerable` method implementation
|
|
3900
|
-
// https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
|
|
3901
|
-
objectPropertyIsEnumerable.f = NASHORN_BUG ? function(V) {
|
|
3902
|
-
var descriptor = getOwnPropertyDescriptor$1(this, V);
|
|
3903
|
-
return !!descriptor && descriptor.enumerable;
|
|
3904
|
-
} : $propertyIsEnumerable;
|
|
3905
|
-
|
|
3906
|
-
var match, version, createPropertyDescriptor$2 = function(bitmap, value) {
|
|
3907
|
-
return {
|
|
3908
|
-
enumerable: !(1 & bitmap),
|
|
3909
|
-
configurable: !(2 & bitmap),
|
|
3910
|
-
writable: !(4 & bitmap),
|
|
3911
|
-
value: value
|
|
3912
|
-
};
|
|
3913
|
-
}, fails$6 = fails$9, classof$4 = classofRaw$2, $Object$3 = Object, split = functionUncurryThis("".split), indexedObject = fails$6((function() {
|
|
3914
|
-
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
3915
|
-
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
3916
|
-
return !$Object$3("z").propertyIsEnumerable(0);
|
|
3917
|
-
})) ? function(it) {
|
|
3918
|
-
return "String" === classof$4(it) ? split(it, "") : $Object$3(it);
|
|
3919
|
-
} : $Object$3, isNullOrUndefined$2 = function(it) {
|
|
3920
|
-
return null == it;
|
|
3921
|
-
}, isNullOrUndefined$1 = isNullOrUndefined$2, $TypeError$7 = TypeError, requireObjectCoercible$3 = function(it) {
|
|
3922
|
-
if (isNullOrUndefined$1(it)) throw new $TypeError$7("Can't call method on " + it);
|
|
3923
|
-
return it;
|
|
3924
|
-
}, IndexedObject$1 = indexedObject, requireObjectCoercible$2 = requireObjectCoercible$3, toIndexedObject$2 = function(it) {
|
|
3925
|
-
return IndexedObject$1(requireObjectCoercible$2(it));
|
|
3926
|
-
}, isCallable$7 = isCallable$8, isObject$6 = function(it) {
|
|
3927
|
-
return "object" == typeof it ? null !== it : isCallable$7(it);
|
|
3928
|
-
}, path$3 = {}, path$2 = path$3, globalThis$b = globalThis_1, isCallable$6 = isCallable$8, aFunction = function(variable) {
|
|
3929
|
-
return isCallable$6(variable) ? variable : void 0;
|
|
3930
|
-
}, navigator$1 = globalThis_1.navigator, userAgent$2 = navigator$1 && navigator$1.userAgent, environmentUserAgent = userAgent$2 ? String(userAgent$2) : "", globalThis$9 = globalThis_1, userAgent$1 = environmentUserAgent, process$1 = globalThis$9.process, Deno$1 = globalThis$9.Deno, versions = process$1 && process$1.versions || Deno$1 && Deno$1.version, v8 = versions && versions.v8;
|
|
3931
|
-
|
|
3932
|
-
v8 && (
|
|
3933
|
-
// in old Chrome, versions of V8 isn't V8 = Chrome / 10
|
|
3934
|
-
// but their correct versions are not interesting for us
|
|
3935
|
-
version = (match = v8.split("."))[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1])),
|
|
3936
|
-
// BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0`
|
|
3937
|
-
// so check `userAgent` even if `.v8` exists, but 0
|
|
3938
|
-
!version && userAgent$1 && (!(match = userAgent$1.match(/Edge\/(\d+)/)) || match[1] >= 74) && (match = userAgent$1.match(/Chrome\/(\d+)/)) && (version = +match[1]);
|
|
3939
|
-
|
|
3940
|
-
var environmentV8Version = version, V8_VERSION = environmentV8Version, fails$5 = fails$9, $String$3 = globalThis_1.String, symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$5((function() {
|
|
3941
|
-
var symbol = Symbol("symbol detection");
|
|
3942
|
-
// Chrome 38 Symbol has incorrect toString conversion
|
|
3943
|
-
// `get-own-property-symbols` polyfill symbols converted to object are not Symbol instances
|
|
3944
|
-
// nb: Do not call `String` directly to avoid this being optimized out to `symbol+''` which will,
|
|
3945
|
-
// of course, fail.
|
|
3946
|
-
return !$String$3(symbol) || !(Object(symbol) instanceof Symbol) ||
|
|
3947
|
-
// Chrome 38-40 symbols are not inherited from DOM collections prototypes to instances
|
|
3948
|
-
!Symbol.sham && V8_VERSION && V8_VERSION < 41;
|
|
3949
|
-
})), useSymbolAsUid = symbolConstructorDetection && !Symbol.sham && "symbol" == typeof Symbol.iterator, isCallable$5 = isCallable$8, isPrototypeOf$2 = objectIsPrototypeOf, $Object$2 = Object, isSymbol$2 = useSymbolAsUid ? function(it) {
|
|
3950
|
-
return "symbol" == typeof it;
|
|
3951
|
-
} : function(it) {
|
|
3952
|
-
var $Symbol = function(namespace, method) {
|
|
3953
|
-
return arguments.length < 2 ? aFunction(path$2[namespace]) || aFunction(globalThis$b[namespace]) : path$2[namespace] && path$2[namespace][method] || globalThis$b[namespace] && globalThis$b[namespace][method];
|
|
3954
|
-
}("Symbol");
|
|
3955
|
-
return isCallable$5($Symbol) && isPrototypeOf$2($Symbol.prototype, $Object$2(it));
|
|
3956
|
-
}, $String$2 = String, isCallable$4 = isCallable$8, $TypeError$6 = TypeError, aCallable$3 = function(argument) {
|
|
3957
|
-
if (isCallable$4(argument)) return argument;
|
|
3958
|
-
throw new $TypeError$6(function(argument) {
|
|
3959
|
-
try {
|
|
3960
|
-
return $String$2(argument);
|
|
3961
|
-
} catch (error) {
|
|
3962
|
-
return "Object";
|
|
3963
|
-
}
|
|
3964
|
-
}(argument) + " is not a function");
|
|
3965
|
-
}, aCallable$2 = aCallable$3, isNullOrUndefined = isNullOrUndefined$2, call$2 = functionCall, isCallable$3 = isCallable$8, isObject$5 = isObject$6, $TypeError$5 = TypeError, sharedStore = {
|
|
3966
|
-
exports: {}
|
|
3967
|
-
}, globalThis$7 = globalThis_1, defineProperty = Object.defineProperty, globalThis$6 = globalThis_1, store$1 = sharedStore.exports = globalThis$6["__core-js_shared__"] || function(key, value) {
|
|
3968
|
-
try {
|
|
3969
|
-
defineProperty(globalThis$7, key, {
|
|
3970
|
-
value: value,
|
|
3971
|
-
configurable: !0,
|
|
3972
|
-
writable: !0
|
|
3973
|
-
});
|
|
3974
|
-
} catch (error) {
|
|
3975
|
-
globalThis$7[key] = value;
|
|
3976
|
-
}
|
|
3977
|
-
return value;
|
|
3978
|
-
}("__core-js_shared__", {});
|
|
3979
|
-
|
|
3980
|
-
/* eslint-disable es/no-symbol -- required for testing */ (store$1.versions || (store$1.versions = [])).push({
|
|
3981
|
-
version: "3.43.0",
|
|
3982
|
-
mode: "pure",
|
|
3983
|
-
copyright: "© 2014-2025 Denis Pushkarev (zloirock.ru)",
|
|
3984
|
-
license: "https://github.com/zloirock/core-js/blob/v3.43.0/LICENSE",
|
|
3985
|
-
source: "https://github.com/zloirock/core-js"
|
|
3986
|
-
});
|
|
3987
|
-
|
|
3988
|
-
var key, value, store = sharedStore.exports, requireObjectCoercible$1 = requireObjectCoercible$3, $Object$1 = Object, toObject$2 = function(argument) {
|
|
3989
|
-
return $Object$1(requireObjectCoercible$1(argument));
|
|
3990
|
-
}, toObject$1 = toObject$2, hasOwnProperty = functionUncurryThis({}.hasOwnProperty), hasOwnProperty_1 = Object.hasOwn || function(it, key) {
|
|
3991
|
-
return hasOwnProperty(toObject$1(it), key);
|
|
3992
|
-
}, 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) {
|
|
3993
|
-
return "Symbol(" + (void 0 === key ? "" : key) + ")_" + toString$2(++id + postfix, 36);
|
|
3994
|
-
}, wellKnownSymbol$5 = function(name) {
|
|
3995
|
-
return hasOwn$2(WellKnownSymbolsStore, name) || (WellKnownSymbolsStore[name] = NATIVE_SYMBOL && hasOwn$2(Symbol$1, name) ? Symbol$1[name] : createWellKnownSymbol("Symbol." + name)),
|
|
3996
|
-
WellKnownSymbolsStore[name];
|
|
3997
|
-
}, call$1 = functionCall, isObject$4 = isObject$6, isSymbol$1 = isSymbol$2, $TypeError$4 = TypeError, TO_PRIMITIVE = wellKnownSymbol$5("toPrimitive"), toPrimitive = function(input, pref) {
|
|
3998
|
-
if (!isObject$4(input) || isSymbol$1(input)) return input;
|
|
3999
|
-
var result, func, exoticToPrim = (func = input[TO_PRIMITIVE], isNullOrUndefined(func) ? void 0 : aCallable$2(func));
|
|
4000
|
-
if (exoticToPrim) {
|
|
4001
|
-
if (void 0 === pref && (pref = "default"), result = call$1(exoticToPrim, input, pref),
|
|
4002
|
-
!isObject$4(result) || isSymbol$1(result)) return result;
|
|
4003
|
-
throw new $TypeError$4("Can't convert object to primitive value");
|
|
4417
|
+
children: buttonContent
|
|
4418
|
+
});
|
|
4419
|
+
if (glass) {
|
|
4420
|
+
// Default glass props
|
|
4421
|
+
const defaultGlassProps = {
|
|
4422
|
+
displacementScale: 20,
|
|
4423
|
+
blurAmount: 0,
|
|
4424
|
+
saturation: 200,
|
|
4425
|
+
elasticity: 0
|
|
4426
|
+
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
4427
|
+
...defaultGlassProps,
|
|
4428
|
+
...glass
|
|
4429
|
+
};
|
|
4430
|
+
return jsxRuntime.jsx(AtomixGlass, {
|
|
4431
|
+
...glassProps,
|
|
4432
|
+
children: content
|
|
4433
|
+
});
|
|
4004
4434
|
}
|
|
4005
|
-
return
|
|
4006
|
-
|
|
4007
|
-
if ("string" === pref && isCallable$3(fn = input.toString) && !isObject$5(val = call$2(fn, input))) return val;
|
|
4008
|
-
if (isCallable$3(fn = input.valueOf) && !isObject$5(val = call$2(fn, input))) return val;
|
|
4009
|
-
if ("string" !== pref && isCallable$3(fn = input.toString) && !isObject$5(val = call$2(fn, input))) return val;
|
|
4010
|
-
throw new $TypeError$5("Can't convert object to primitive value");
|
|
4011
|
-
}(input, pref);
|
|
4012
|
-
}, isSymbol = isSymbol$2, toPropertyKey$2 = function(argument) {
|
|
4013
|
-
var key = toPrimitive(argument, "string");
|
|
4014
|
-
return isSymbol(key) ? key : key + "";
|
|
4015
|
-
}, isObject$3 = isObject$6, document$1 = globalThis_1.document, EXISTS = isObject$3(document$1) && isObject$3(document$1.createElement), ie8DomDefine = !descriptors && !fails$9((function() {
|
|
4016
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
4017
|
-
return 7 !== Object.defineProperty((it = "div", EXISTS ? document$1.createElement(it) : {}), "a", {
|
|
4018
|
-
get: function() {
|
|
4019
|
-
return 7;
|
|
4020
|
-
}
|
|
4021
|
-
}).a;
|
|
4022
|
-
var it;
|
|
4023
|
-
})), 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;
|
|
4024
|
-
|
|
4025
|
-
// `Object.getOwnPropertyDescriptor` method
|
|
4026
|
-
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
|
4027
|
-
objectGetOwnPropertyDescriptor.f = DESCRIPTORS$3 ? $getOwnPropertyDescriptor$1 : function(O, P) {
|
|
4028
|
-
if (O = toIndexedObject$1(O), P = toPropertyKey$1(P), IE8_DOM_DEFINE$1) try {
|
|
4029
|
-
return $getOwnPropertyDescriptor$1(O, P);
|
|
4030
|
-
} catch (error) {/* empty */}
|
|
4031
|
-
if (hasOwn$1(O, P)) return createPropertyDescriptor$1(!call(propertyIsEnumerableModule.f, O, P), O[P]);
|
|
4032
|
-
};
|
|
4435
|
+
return content;
|
|
4436
|
+
})));
|
|
4033
4437
|
|
|
4034
|
-
|
|
4035
|
-
var value = data[normalize(feature)];
|
|
4036
|
-
return value === POLYFILL || value !== NATIVE && (isCallable$2(detection) ? fails$3(detection) : !!detection);
|
|
4037
|
-
}, normalize = isForced$1.normalize = function(string) {
|
|
4038
|
-
return String(string).replace(replacement, ".").toLowerCase();
|
|
4039
|
-
}, data = isForced$1.data = {}, NATIVE = isForced$1.NATIVE = "N", POLYFILL = isForced$1.POLYFILL = "P", isForced_1 = isForced$1, aCallable$1 = aCallable$3, NATIVE_BIND = functionBindNative, bind$1 = functionUncurryThisClause(functionUncurryThisClause.bind), objectDefineProperty = {}, v8PrototypeDefineBug = descriptors && fails$9((function() {
|
|
4040
|
-
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
4041
|
-
return 42 !== Object.defineProperty((function() {/* empty */}), "prototype", {
|
|
4042
|
-
value: 42,
|
|
4043
|
-
writable: !1
|
|
4044
|
-
}).prototype;
|
|
4045
|
-
})), isObject$2 = isObject$6, $String$1 = String, $TypeError$3 = TypeError, DESCRIPTORS$1 = descriptors, IE8_DOM_DEFINE = ie8DomDefine, V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug, anObject = function(argument) {
|
|
4046
|
-
if (isObject$2(argument)) return argument;
|
|
4047
|
-
throw new $TypeError$3($String$1(argument) + " is not an object");
|
|
4048
|
-
}, toPropertyKey = toPropertyKey$2, $TypeError$2 = TypeError, $defineProperty = Object.defineProperty, $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
4438
|
+
Button.displayName = "Button";
|
|
4049
4439
|
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4440
|
+
/**
|
|
4441
|
+
* ButtonGroup - A component for grouping buttons together
|
|
4442
|
+
*
|
|
4443
|
+
* Groups buttons together with proper border radius handling and spacing.
|
|
4444
|
+
* The buttons will be visually connected with shared borders.
|
|
4445
|
+
*
|
|
4446
|
+
* @example
|
|
4447
|
+
* ```tsx
|
|
4448
|
+
* <ButtonGroup>
|
|
4449
|
+
* <Button label="Left" />
|
|
4450
|
+
* <Button label="Middle" />
|
|
4451
|
+
* <Button label="Right" />
|
|
4452
|
+
* </ButtonGroup>
|
|
4453
|
+
* ```
|
|
4454
|
+
*/
|
|
4455
|
+
const ButtonGroup = ({children: children, className: className = "", style: style, "aria-label": ariaLabel, role: role = "group"}) => {
|
|
4456
|
+
// Generate CSS classes
|
|
4457
|
+
const buttonGroupClasses = [ BUTTON_GROUP.CLASSES.BASE, className ].filter(Boolean).join(" "), buttonChildren = React.Children.toArray(children).filter((child => React.isValidElement(child) && child.type === Button));
|
|
4458
|
+
// Get valid Button children
|
|
4459
|
+
return jsxRuntime.jsx("div", {
|
|
4460
|
+
className: buttonGroupClasses,
|
|
4461
|
+
style: style,
|
|
4462
|
+
role: role,
|
|
4463
|
+
"aria-label": ariaLabel,
|
|
4464
|
+
children: buttonChildren.map(((child, index) => React.isValidElement(child) ? React.cloneElement(child, {
|
|
4465
|
+
key: index,
|
|
4466
|
+
...child.props
|
|
4467
|
+
}) : null))
|
|
4468
|
+
});
|
|
4068
4469
|
};
|
|
4069
4470
|
|
|
4070
|
-
|
|
4071
|
-
return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
|
|
4072
|
-
} : function(object, key, value) {
|
|
4073
|
-
return object[key] = value, object;
|
|
4074
|
-
}, globalThis$3 = 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) {
|
|
4075
|
-
return aCallable$1(fn), void 0 === that ? fn : NATIVE_BIND ? bind$1(fn, that) : function() {
|
|
4076
|
-
return fn.apply(that, arguments);
|
|
4077
|
-
};
|
|
4078
|
-
}, createNonEnumerableProperty = createNonEnumerableProperty$1, hasOwn = hasOwnProperty_1, wrapConstructor = function(NativeConstructor) {
|
|
4079
|
-
var Wrapper = function(a, b, c) {
|
|
4080
|
-
if (this instanceof Wrapper) {
|
|
4081
|
-
switch (arguments.length) {
|
|
4082
|
-
case 0:
|
|
4083
|
-
return new NativeConstructor;
|
|
4471
|
+
ButtonGroup.displayName = "ButtonGroup";
|
|
4084
4472
|
|
|
4085
|
-
|
|
4086
|
-
|
|
4473
|
+
// Subcomponents
|
|
4474
|
+
const CalloutIcon = React.forwardRef((({children: children, className: className = "", ...props}, ref) => jsxRuntime.jsx("div", {
|
|
4475
|
+
ref: ref,
|
|
4476
|
+
className: `c-callout__icon ${className}`.trim(),
|
|
4477
|
+
...props,
|
|
4478
|
+
children: children
|
|
4479
|
+
})));
|
|
4087
4480
|
|
|
4088
|
-
|
|
4089
|
-
return new NativeConstructor(a, b);
|
|
4090
|
-
}
|
|
4091
|
-
return new NativeConstructor(a, b, c);
|
|
4092
|
-
}
|
|
4093
|
-
return apply(NativeConstructor, this, arguments);
|
|
4094
|
-
};
|
|
4095
|
-
return Wrapper.prototype = NativeConstructor.prototype, Wrapper;
|
|
4096
|
-
}, _export = function(options, source) {
|
|
4097
|
-
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$3 : STATIC ? globalThis$3[TARGET] : globalThis$3[TARGET] && globalThis$3[TARGET].prototype, target = GLOBAL ? path$1 : path$1[TARGET] || createNonEnumerableProperty(path$1, TARGET, {})[TARGET], targetPrototype = target.prototype;
|
|
4098
|
-
for (key in source)
|
|
4099
|
-
// contains in native
|
|
4100
|
-
USE_NATIVE = !(FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? "." : "#") + key, options.forced)) && nativeSource && hasOwn(nativeSource, key),
|
|
4101
|
-
targetProperty = target[key], USE_NATIVE && (nativeProperty = options.dontCallGetSet ? (descriptor = getOwnPropertyDescriptor(nativeSource, key)) && descriptor.value : nativeSource[key]),
|
|
4102
|
-
// export native or implementation
|
|
4103
|
-
sourceProperty = USE_NATIVE && nativeProperty ? nativeProperty : source[key], (FORCED || PROTO || typeof targetProperty != typeof sourceProperty) && (
|
|
4104
|
-
// bind methods to global for calling from export context
|
|
4105
|
-
resultProperty = options.bind && USE_NATIVE ? bind(sourceProperty, globalThis$3) : options.wrap && USE_NATIVE ? wrapConstructor(sourceProperty) : PROTO && isCallable$1(sourceProperty) ? uncurryThis$1(sourceProperty) : sourceProperty,
|
|
4106
|
-
// add a flag to not completely full polyfills
|
|
4107
|
-
(options.sham || sourceProperty && sourceProperty.sham || targetProperty && targetProperty.sham) && createNonEnumerableProperty(resultProperty, "sham", !0),
|
|
4108
|
-
createNonEnumerableProperty(target, key, resultProperty), PROTO && (hasOwn(path$1, VIRTUAL_PROTOTYPE = TARGET + "Prototype") || createNonEnumerableProperty(path$1, VIRTUAL_PROTOTYPE, {}),
|
|
4109
|
-
// export virtual prototype methods
|
|
4110
|
-
createNonEnumerableProperty(path$1[VIRTUAL_PROTOTYPE], key, sourceProperty),
|
|
4111
|
-
// export real prototype methods
|
|
4112
|
-
options.real && targetPrototype && (FORCED || !targetPrototype[key]) && createNonEnumerableProperty(targetPrototype, key, sourceProperty)));
|
|
4113
|
-
}, ceil = Math.ceil, floor = Math.floor, trunc = Math.trunc || function(x) {
|
|
4114
|
-
var n = +x;
|
|
4115
|
-
return (n > 0 ? floor : ceil)(n);
|
|
4116
|
-
}, toIntegerOrInfinity$2 = function(argument) {
|
|
4117
|
-
var number = +argument;
|
|
4118
|
-
// eslint-disable-next-line no-self-compare -- NaN check
|
|
4119
|
-
return number != number || 0 === number ? 0 : trunc(number);
|
|
4120
|
-
}, toIntegerOrInfinity$1 = toIntegerOrInfinity$2, max = Math.max, min$1 = Math.min, toIntegerOrInfinity = toIntegerOrInfinity$2, min = Math.min, lengthOfArrayLike$2 = function(obj) {
|
|
4121
|
-
return argument = obj.length, (len = toIntegerOrInfinity(argument)) > 0 ? min(len, 9007199254740991) : 0;
|
|
4122
|
-
var argument, len;
|
|
4123
|
-
}, toIndexedObject = toIndexedObject$2, lengthOfArrayLike$1 = lengthOfArrayLike$2, createMethod$1 = function(IS_INCLUDES) {
|
|
4124
|
-
return function($this, el, fromIndex) {
|
|
4125
|
-
var O = toIndexedObject($this), length = lengthOfArrayLike$1(O);
|
|
4126
|
-
if (0 === length) return !IS_INCLUDES && -1;
|
|
4127
|
-
var value, index = function(index, length) {
|
|
4128
|
-
var integer = toIntegerOrInfinity$1(index);
|
|
4129
|
-
return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
|
|
4130
|
-
}(fromIndex, length);
|
|
4131
|
-
// Array#includes uses SameValueZero equality algorithm
|
|
4132
|
-
// eslint-disable-next-line no-self-compare -- NaN check
|
|
4133
|
-
if (IS_INCLUDES && el != el) {
|
|
4134
|
-
for (;length > index; )
|
|
4135
|
-
// eslint-disable-next-line no-self-compare -- NaN check
|
|
4136
|
-
if ((value = O[index++]) != value) return !0;
|
|
4137
|
-
// Array#indexOf ignores holes, Array#includes - not
|
|
4138
|
-
} else for (;length > index; index++) if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
|
|
4139
|
-
return !IS_INCLUDES && -1;
|
|
4140
|
-
};
|
|
4141
|
-
}, $includes = [ createMethod$1(!0), createMethod$1(!1) ][0];
|
|
4481
|
+
CalloutIcon.displayName = "CalloutIcon";
|
|
4142
4482
|
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
// eslint-disable-next-line es/no-array-prototype-includes -- detection
|
|
4150
|
-
return !Array(1).includes();
|
|
4151
|
-
}))
|
|
4152
|
-
}, {
|
|
4153
|
-
includes: function(el /* , fromIndex = 0 */) {
|
|
4154
|
-
return $includes(this, el, arguments.length > 1 ? arguments[1] : void 0);
|
|
4155
|
-
}
|
|
4156
|
-
});
|
|
4483
|
+
const CalloutMessage = React.forwardRef((({children: children, className: className = "", ...props}, ref) => jsxRuntime.jsx("div", {
|
|
4484
|
+
ref: ref,
|
|
4485
|
+
className: `c-callout__message ${className}`.trim(),
|
|
4486
|
+
...props,
|
|
4487
|
+
children: children
|
|
4488
|
+
})));
|
|
4157
4489
|
|
|
4158
|
-
|
|
4159
|
-
var Namespace = path[CONSTRUCTOR + "Prototype"], pureMethod = Namespace && Namespace[METHOD];
|
|
4160
|
-
if (pureMethod) return pureMethod;
|
|
4161
|
-
var NativeConstructor = globalThis$2[CONSTRUCTOR], NativePrototype = NativeConstructor && NativeConstructor.prototype;
|
|
4162
|
-
return NativePrototype && NativePrototype[METHOD];
|
|
4163
|
-
}, includes$4 = getBuiltInPrototypeMethod$3("Array", "includes"), isObject$1 = isObject$6, classof$3 = classofRaw$2, MATCH$1 = wellKnownSymbol$5("match"), $TypeError$1 = TypeError, test = {};
|
|
4490
|
+
CalloutMessage.displayName = "CalloutMessage";
|
|
4164
4491
|
|
|
4165
|
-
|
|
4492
|
+
const CalloutTitle = React.forwardRef((({children: children, className: className = "", ...props}, ref) => jsxRuntime.jsx("div", {
|
|
4493
|
+
ref: ref,
|
|
4494
|
+
className: `c-callout__title ${className}`.trim(),
|
|
4495
|
+
...props,
|
|
4496
|
+
children: children
|
|
4497
|
+
})));
|
|
4166
4498
|
|
|
4167
|
-
|
|
4168
|
-
return arguments;
|
|
4169
|
-
}()), classof$1 = TO_STRING_TAG_SUPPORT ? classofRaw : function(it) {
|
|
4170
|
-
var O, tag, result;
|
|
4171
|
-
return void 0 === it ? "Undefined" : null === it ? "Null" : "string" == typeof (tag = function(it, key) {
|
|
4172
|
-
try {
|
|
4173
|
-
return it[key];
|
|
4174
|
-
} catch (error) {/* empty */}
|
|
4175
|
-
}(O = $Object(it), TO_STRING_TAG)) ? tag : CORRECT_ARGUMENTS ? classofRaw(O) : "Object" === (result = classofRaw(O)) && isCallable(O.callee) ? "Arguments" : result;
|
|
4176
|
-
}, $String = String, MATCH = wellKnownSymbol$5("match"), $$1 = _export, notARegExp = function(it) {
|
|
4177
|
-
if (function(it) {
|
|
4178
|
-
var isRegExp;
|
|
4179
|
-
return isObject$1(it) && (void 0 !== (isRegExp = it[MATCH$1]) ? !!isRegExp : "RegExp" === classof$3(it));
|
|
4180
|
-
}(it)) throw new $TypeError$1("The method doesn't accept regular expressions");
|
|
4181
|
-
return it;
|
|
4182
|
-
}, requireObjectCoercible = requireObjectCoercible$3, toString = function(argument) {
|
|
4183
|
-
if ("Symbol" === classof$1(argument)) throw new TypeError("Cannot convert a Symbol value to a string");
|
|
4184
|
-
return $String(argument);
|
|
4185
|
-
}, stringIndexOf = functionUncurryThis("".indexOf);
|
|
4499
|
+
CalloutTitle.displayName = "CalloutTitle";
|
|
4186
4500
|
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
var regexp = /./;
|
|
4194
|
-
try {
|
|
4195
|
-
"/./"[METHOD_NAME](regexp);
|
|
4196
|
-
} catch (error1) {
|
|
4197
|
-
try {
|
|
4198
|
-
return regexp[MATCH] = !1, "/./"[METHOD_NAME](regexp);
|
|
4199
|
-
} catch (error2) {/* empty */}
|
|
4200
|
-
}
|
|
4201
|
-
return !1;
|
|
4202
|
-
}("includes")
|
|
4203
|
-
}, {
|
|
4204
|
-
includes: function(searchString /* , position = 0 */) {
|
|
4205
|
-
return !!~stringIndexOf(toString(requireObjectCoercible(this)), toString(notARegExp(searchString)), arguments.length > 1 ? arguments[1] : void 0);
|
|
4206
|
-
}
|
|
4207
|
-
});
|
|
4501
|
+
const CalloutText = React.forwardRef((({children: children, className: className = "", ...props}, ref) => jsxRuntime.jsx("div", {
|
|
4502
|
+
ref: ref,
|
|
4503
|
+
className: `c-callout__text ${className}`.trim(),
|
|
4504
|
+
...props,
|
|
4505
|
+
children: children
|
|
4506
|
+
})));
|
|
4208
4507
|
|
|
4209
|
-
|
|
4210
|
-
var own = it.includes;
|
|
4211
|
-
return it === ArrayPrototype$1 || isPrototypeOf$1(ArrayPrototype$1, it) && own === ArrayPrototype$1.includes ? arrayMethod : "string" == typeof it || it === StringPrototype || isPrototypeOf$1(StringPrototype, it) && own === StringPrototype.includes ? stringMethod : own;
|
|
4212
|
-
}));
|
|
4508
|
+
CalloutText.displayName = "CalloutText";
|
|
4213
4509
|
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4510
|
+
const CalloutActions = React.forwardRef((({children: children, className: className = "", ...props}, ref) => jsxRuntime.jsx("div", {
|
|
4511
|
+
ref: ref,
|
|
4512
|
+
className: `c-callout__actions ${className}`.trim(),
|
|
4513
|
+
...props,
|
|
4514
|
+
children: children
|
|
4515
|
+
})));
|
|
4516
|
+
|
|
4517
|
+
CalloutActions.displayName = "CalloutActions";
|
|
4518
|
+
|
|
4519
|
+
const CalloutCloseButton = React.forwardRef((({onClick: onClick, className: className = "", ...props}, ref) => jsxRuntime.jsx("button", {
|
|
4520
|
+
ref: ref,
|
|
4521
|
+
className: `c-callout__close-btn ${className}`.trim(),
|
|
4522
|
+
onClick: onClick,
|
|
4523
|
+
"aria-label": "Close",
|
|
4524
|
+
...props,
|
|
4525
|
+
children: jsxRuntime.jsx(Icon, {
|
|
4526
|
+
name: "X",
|
|
4527
|
+
size: "md"
|
|
4528
|
+
})
|
|
4529
|
+
})));
|
|
4530
|
+
|
|
4531
|
+
CalloutCloseButton.displayName = "CalloutCloseButton";
|
|
4532
|
+
|
|
4533
|
+
// Wrapper for content (icon + message)
|
|
4534
|
+
const CalloutContent = React.forwardRef((({children: children, className: className = "", ...props}, ref) => jsxRuntime.jsx("div", {
|
|
4535
|
+
ref: ref,
|
|
4536
|
+
className: `c-callout__content ${className}`.trim(),
|
|
4537
|
+
...props,
|
|
4538
|
+
children: children
|
|
4539
|
+
})));
|
|
4540
|
+
|
|
4541
|
+
CalloutContent.displayName = "CalloutContent";
|
|
4542
|
+
|
|
4543
|
+
const Callout = React.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}) => {
|
|
4218
4544
|
const {generateCalloutClass: generateCalloutClass, handleClose: handleClose} =
|
|
4219
4545
|
/**
|
|
4220
4546
|
* Callout state and functionality
|
|
@@ -4260,7 +4586,11 @@ const Callout = ({title: title, children: children, icon: icon, variant: variant
|
|
|
4260
4586
|
return isToast ? (baseAttributes.role = "alert", baseAttributes["aria-live"] = "polite") : _includesInstanceProperty(_context = [ "warning", "error" ]).call(_context, variant) ? (baseAttributes.role = "alert",
|
|
4261
4587
|
baseAttributes["aria-live"] = "assertive") : _includesInstanceProperty(_context2 = [ "info", "success" ]).call(_context2, variant) && (baseAttributes.role = "status",
|
|
4262
4588
|
baseAttributes["aria-live"] = "polite"), baseAttributes;
|
|
4263
|
-
}, calloutContent =
|
|
4589
|
+
}, calloutContent = React__default.default.Children.toArray(children).some((child => {
|
|
4590
|
+
var _context3;
|
|
4591
|
+
|
|
4592
|
+
return React__default.default.isValidElement(child) && _includesInstanceProperty(_context3 = [ "CalloutIcon", "CalloutMessage", "CalloutTitle", "CalloutText", "CalloutActions", "CalloutContent" ]).call(_context3, child.type.displayName);
|
|
4593
|
+
})) ? children : jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
4264
4594
|
children: [ jsxRuntime.jsxs("div", {
|
|
4265
4595
|
className: "c-callout__content",
|
|
4266
4596
|
children: [ icon && jsxRuntime.jsx("div", {
|
|
@@ -4294,7 +4624,7 @@ const Callout = ({title: title, children: children, icon: icon, variant: variant
|
|
|
4294
4624
|
// Default glass settings for callouts
|
|
4295
4625
|
const defaultGlassProps = {
|
|
4296
4626
|
displacementScale: 30,
|
|
4297
|
-
|
|
4627
|
+
borderRadius: 8,
|
|
4298
4628
|
elasticity: 0
|
|
4299
4629
|
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
4300
4630
|
...defaultGlassProps,
|
|
@@ -4316,7 +4646,7 @@ const Callout = ({title: title, children: children, icon: icon, variant: variant
|
|
|
4316
4646
|
children: jsxRuntime.jsx("div", {
|
|
4317
4647
|
className: "c-callout__glass-content",
|
|
4318
4648
|
style: {
|
|
4319
|
-
borderRadius: glassProps.
|
|
4649
|
+
borderRadius: glassProps.borderRadius
|
|
4320
4650
|
},
|
|
4321
4651
|
children: calloutContent
|
|
4322
4652
|
})
|
|
@@ -4336,9 +4666,13 @@ const Callout = ({title: title, children: children, icon: icon, variant: variant
|
|
|
4336
4666
|
style: style,
|
|
4337
4667
|
children: calloutContent
|
|
4338
4668
|
});
|
|
4339
|
-
};
|
|
4669
|
+
}));
|
|
4340
4670
|
|
|
4341
|
-
Callout.displayName = "Callout"
|
|
4671
|
+
Callout.displayName = "Callout",
|
|
4672
|
+
// Attach subcomponents
|
|
4673
|
+
Callout.Icon = CalloutIcon, Callout.Message = CalloutMessage, Callout.Title = CalloutTitle,
|
|
4674
|
+
Callout.Text = CalloutText, Callout.Actions = CalloutActions, Callout.CloseButton = CalloutCloseButton,
|
|
4675
|
+
Callout.Content = CalloutContent;
|
|
4342
4676
|
|
|
4343
4677
|
const Card = React__default.default.memo( React.forwardRef((({
|
|
4344
4678
|
// Variants
|
|
@@ -4998,12 +5332,22 @@ function useChart(initialProps) {
|
|
|
4998
5332
|
left: 40
|
|
4999
5333
|
}, config) => {
|
|
5000
5334
|
if (!datasets || 0 === datasets.length) return null;
|
|
5001
|
-
//
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5335
|
+
// Calculate total points and min/max values efficiently avoiding spread operator
|
|
5336
|
+
let totalPoints = 0, minValue = 1 / 0, maxValue = -1 / 0, hasValidData = !1;
|
|
5337
|
+
for (const dataset of datasets) if (dataset.data) {
|
|
5338
|
+
totalPoints += dataset.data.length;
|
|
5339
|
+
const {min: min, max: max, hasValid: hasValid} = getDatasetBounds(dataset.data);
|
|
5340
|
+
hasValid && (min < minValue && (minValue = min), max > maxValue && (maxValue = max),
|
|
5341
|
+
hasValidData = !0);
|
|
5342
|
+
}
|
|
5343
|
+
if (0 === totalPoints) return null;
|
|
5344
|
+
// Handle case with no valid numeric data
|
|
5345
|
+
hasValidData || (minValue = 0, maxValue = 0);
|
|
5346
|
+
const valueRange = maxValue - minValue || 1, innerWidth = width - padding.left - padding.right, innerHeight = height - padding.top - padding.bottom;
|
|
5347
|
+
// Avoid division by zero
|
|
5348
|
+
// Apply padding
|
|
5349
|
+
return {
|
|
5350
|
+
xScale: (index, dataLength = totalPoints) => dataLength <= 1 ? padding.left + innerWidth / 2 : padding.left + index / (dataLength - 1) * innerWidth,
|
|
5007
5351
|
yScale: value => padding.top + innerHeight - (value - minValue) / valueRange * innerHeight,
|
|
5008
5352
|
minValue: minValue,
|
|
5009
5353
|
maxValue: maxValue,
|
|
@@ -5058,6 +5402,29 @@ function useChart(initialProps) {
|
|
|
5058
5402
|
|
|
5059
5403
|
/**
|
|
5060
5404
|
* Hook for chart data processing and transformation
|
|
5405
|
+
*/
|
|
5406
|
+
/**
|
|
5407
|
+
* Helper to calculate min/max values from a dataset efficiently
|
|
5408
|
+
* avoiding spread operator which can cause stack overflow on large arrays
|
|
5409
|
+
*/
|
|
5410
|
+
function getDatasetBounds(data) {
|
|
5411
|
+
let min = 1 / 0, max = -1 / 0, hasValid = !1;
|
|
5412
|
+
if (data && data.length > 0) for (let i = 0; i < data.length; i++) {
|
|
5413
|
+
const point = data[i];
|
|
5414
|
+
if (point && "number" == typeof point.value) {
|
|
5415
|
+
const val = point.value;
|
|
5416
|
+
val < min && (min = val), val > max && (max = val), hasValid = !0;
|
|
5417
|
+
}
|
|
5418
|
+
}
|
|
5419
|
+
return {
|
|
5420
|
+
min: min,
|
|
5421
|
+
max: max,
|
|
5422
|
+
hasValid: hasValid
|
|
5423
|
+
};
|
|
5424
|
+
}
|
|
5425
|
+
|
|
5426
|
+
/**
|
|
5427
|
+
* Hook for managing chart toolbar state and generating chart-specific configurations
|
|
5061
5428
|
*/ const ChartToolbar = React.memo( React.forwardRef((({chartType: chartType = "line", groups: groups = [], enableDefaults: enableDefaults = !0, defaults: defaults = {
|
|
5062
5429
|
refresh: !0,
|
|
5063
5430
|
export: !0,
|
|
@@ -5478,11 +5845,7 @@ toolbarConfig: toolbarConfig, customToolbarActions: customToolbarActions, custom
|
|
|
5478
5845
|
onZoomReset: handleZoomReset,
|
|
5479
5846
|
onPanToggle: handlePanToggle,
|
|
5480
5847
|
onReset: handleReset
|
|
5481
|
-
})), [ onRefresh, onExport, handleFullscreenChange, handleZoomIn, handleZoomOut, handleZoomReset, handlePanToggle, handleReset ]), {state: toolbarState, handlers: toolbarHandlers, toolbarGroups: toolbarGroups} =
|
|
5482
|
-
/**
|
|
5483
|
-
* Hook for managing chart toolbar state and generating chart-specific configurations
|
|
5484
|
-
*/
|
|
5485
|
-
function(chartType, config = {}, handlers = {}) {
|
|
5848
|
+
})), [ onRefresh, onExport, handleFullscreenChange, handleZoomIn, handleZoomOut, handleZoomReset, handlePanToggle, handleReset ]), {state: toolbarState, handlers: toolbarHandlers, toolbarGroups: toolbarGroups} = function(chartType, config = {}, handlers = {}) {
|
|
5486
5849
|
const [state, setState] = React.useState({
|
|
5487
5850
|
isFullscreen: !1,
|
|
5488
5851
|
isExporting: !1,
|
|
@@ -5867,16 +6230,16 @@ toolbarConfig: toolbarConfig, customToolbarActions: customToolbarActions, custom
|
|
|
5867
6230
|
aberrationIntensity: 1.5,
|
|
5868
6231
|
elasticity: 0,
|
|
5869
6232
|
// No elastic effect for charts
|
|
5870
|
-
|
|
6233
|
+
withLiquidBlur: !1,
|
|
5871
6234
|
// Keep it simple
|
|
5872
|
-
|
|
6235
|
+
withBorder: !0,
|
|
5873
6236
|
mode: "standard",
|
|
5874
6237
|
mouseContainer: chartContainerRef,
|
|
5875
6238
|
reducedMotion: !1
|
|
5876
6239
|
})), []), glassProps = React.useMemo((() => glass ? !0 === glass ? defaultChartGlassProps : {
|
|
5877
6240
|
...defaultChartGlassProps,
|
|
5878
6241
|
...glass
|
|
5879
|
-
} : null), [ glass, defaultChartGlassProps ]), chartBorderRadius = React.useMemo((() => glassProps?.
|
|
6242
|
+
} : null), [ glass, defaultChartGlassProps ]), chartBorderRadius = React.useMemo((() => glassProps?.borderRadius || void 0), [ glassProps?.borderRadius ]), chartContextValue = React.useMemo((() => ({
|
|
5880
6243
|
zoomLevel: zoomLevel,
|
|
5881
6244
|
panOffset: panOffset,
|
|
5882
6245
|
panEnabled: panEnabled,
|
|
@@ -6007,7 +6370,7 @@ toolbarConfig: toolbarConfig, customToolbarActions: customToolbarActions, custom
|
|
|
6007
6370
|
}) ]
|
|
6008
6371
|
}), wrappedChart = glassProps ? jsxRuntime.jsx(AtomixGlass, {
|
|
6009
6372
|
...glassProps,
|
|
6010
|
-
|
|
6373
|
+
borderRadius: chartBorderRadius,
|
|
6011
6374
|
style: {
|
|
6012
6375
|
width: "100%",
|
|
6013
6376
|
height: "100%",
|
|
@@ -6060,7 +6423,13 @@ const ChartRenderer = React.memo( React.forwardRef((({datasets: datasets = [],
|
|
|
6060
6423
|
// Get chart context (zoom/pan state from toolbar) - optional
|
|
6061
6424
|
// Always call useContext to maintain consistent hook order
|
|
6062
6425
|
const chartContext = React.useContext(ChartContext), {calculateScales: calculateScales, getChartColors: getChartColors} = useChart(), {processedData: processedData, isProcessing: isProcessing} = function(datasets, options) {
|
|
6063
|
-
const [processedData, setProcessedData] = React.useState(datasets), [isProcessing, setIsProcessing] = React.useState(!1), {enableDecimation: enableDecimation = !1, maxDataPoints: maxDataPoints = 1e3, enableRealTime: enableRealTime = !1, realTimeInterval: realTimeInterval = 1e3} = options || {},
|
|
6426
|
+
const [processedData, setProcessedData] = React.useState(datasets), [isProcessing, setIsProcessing] = React.useState(!1), {enableDecimation: enableDecimation = !1, maxDataPoints: maxDataPoints = 1e3, enableRealTime: enableRealTime = !1, realTimeInterval: realTimeInterval = 1e3} = options || {}, lastDataSignature = React.useRef(""), getDatasetSignature = React.useCallback((data => data.map((d => `${d.label}:${JSON.stringify(d.data)}`)).join("|")), []);
|
|
6427
|
+
// Update signature when processedData changes (e.g. via props)
|
|
6428
|
+
React.useEffect((() => {
|
|
6429
|
+
lastDataSignature.current = getDatasetSignature(processedData);
|
|
6430
|
+
}), [ processedData, getDatasetSignature ]);
|
|
6431
|
+
// Data decimation for performance
|
|
6432
|
+
const decimateData = React.useCallback(((data, maxPoints) => {
|
|
6064
6433
|
if (!enableDecimation || !data.length) return data;
|
|
6065
6434
|
const dataLength = data[0]?.data?.length || 0;
|
|
6066
6435
|
if (dataLength <= maxPoints) return data;
|
|
@@ -6080,10 +6449,17 @@ const ChartRenderer = React.memo( React.forwardRef((({datasets: datasets = [],
|
|
|
6080
6449
|
}), []), calculateTrendLine = React.useCallback((values => {
|
|
6081
6450
|
const n = values.length;
|
|
6082
6451
|
if (n < 2) return values.map((() => null));
|
|
6083
|
-
|
|
6452
|
+
let xSum = 0, ySum = 0, xySum = 0, x2Sum = 0;
|
|
6453
|
+
for (let i = 0; i < n; i++) {
|
|
6454
|
+
const val = values[i], safeVal = "number" == typeof val ? val : 0;
|
|
6455
|
+
// Treat null/undefined as 0 to match original reduce behavior
|
|
6456
|
+
xSum += i, ySum += safeVal, xySum += i * safeVal, x2Sum += i * i;
|
|
6457
|
+
}
|
|
6458
|
+
const slope = (n * xySum - xSum * ySum) / (n * x2Sum - xSum * xSum), intercept = (ySum - slope * xSum) / n;
|
|
6084
6459
|
return values.map(((_, i) => slope * i + intercept));
|
|
6085
6460
|
}), []);
|
|
6086
|
-
//
|
|
6461
|
+
// Moving average calculation
|
|
6462
|
+
// Process data when datasets change
|
|
6087
6463
|
return React.useEffect((() => {
|
|
6088
6464
|
setIsProcessing(!0), (async () => {
|
|
6089
6465
|
let processed = [ ...datasets ];
|
|
@@ -6095,11 +6471,12 @@ const ChartRenderer = React.memo( React.forwardRef((({datasets: datasets = [],
|
|
|
6095
6471
|
React.useEffect((() => {
|
|
6096
6472
|
if (!enableRealTime) return;
|
|
6097
6473
|
const interval = setInterval((() => {
|
|
6098
|
-
setProcessedData((prev =>
|
|
6099
|
-
|
|
6100
|
-
|
|
6474
|
+
setProcessedData((prev =>
|
|
6475
|
+
// Only trigger update if signature changed
|
|
6476
|
+
getDatasetSignature(prev) === lastDataSignature.current ? prev : [ ...prev ]));
|
|
6477
|
+
}), realTimeInterval);
|
|
6101
6478
|
return () => clearInterval(interval);
|
|
6102
|
-
}), [ enableRealTime, realTimeInterval ]), {
|
|
6479
|
+
}), [ enableRealTime, realTimeInterval, getDatasetSignature ]), {
|
|
6103
6480
|
processedData: processedData,
|
|
6104
6481
|
isProcessing: isProcessing,
|
|
6105
6482
|
decimateData: decimateData,
|
|
@@ -6120,12 +6497,12 @@ const ChartRenderer = React.memo( React.forwardRef((({datasets: datasets = [],
|
|
|
6120
6497
|
*/
|
|
6121
6498
|
function(datasets, options) {
|
|
6122
6499
|
const {enableVirtualization: enableVirtualization = !1, enableMemoization: enableMemoization = !0, debounceMs: debounceMs = 100} = options || {}, [isOptimizing, setIsOptimizing] = React.useState(!1), debounceRef = React.useRef(null), memoizedScales = React.useMemo((() => enableMemoization ? datasets.map((dataset => {
|
|
6123
|
-
const
|
|
6500
|
+
const {min: min, max: max, hasValid: hasValid} = getDatasetBounds(dataset.data);
|
|
6124
6501
|
return {
|
|
6125
6502
|
label: dataset.label,
|
|
6126
6503
|
dataLength: dataset.data?.length || 0,
|
|
6127
|
-
minValue:
|
|
6128
|
-
maxValue:
|
|
6504
|
+
minValue: hasValid ? min : 0,
|
|
6505
|
+
maxValue: hasValid ? max : 0
|
|
6129
6506
|
};
|
|
6130
6507
|
})) : null), [ datasets, enableMemoization ]), debouncedUpdate = React.useCallback((callback => {
|
|
6131
6508
|
debounceRef.current && clearTimeout(debounceRef.current), debounceRef.current = setTimeout((() => {
|
|
@@ -6224,8 +6601,8 @@ const ChartRenderer = React.memo( React.forwardRef((({datasets: datasets = [],
|
|
|
6224
6601
|
const getAccessibleDescription = React.useCallback((() => {
|
|
6225
6602
|
if (!datasets.length) return "Empty chart";
|
|
6226
6603
|
const datasetDescriptions = datasets.map(((dataset, i) => {
|
|
6227
|
-
const dataCount = dataset.data?.length || 0,
|
|
6228
|
-
return `Dataset ${i + 1}: ${dataset.label}, ${dataCount} points, range ${
|
|
6604
|
+
const dataCount = dataset.data?.length || 0, {min: min, max: max, hasValid: hasValid} = getDatasetBounds(dataset.data), minVal = hasValid ? min : 0, maxVal = hasValid ? max : 0;
|
|
6605
|
+
return `Dataset ${i + 1}: ${dataset.label}, ${dataCount} points, range ${minVal} to ${maxVal}`;
|
|
6229
6606
|
})).join(". ");
|
|
6230
6607
|
return `Chart with ${datasets.length} datasets. ${datasetDescriptions}`;
|
|
6231
6608
|
}), [ datasets ]);
|
|
@@ -8475,14 +8852,14 @@ const ScatterChart = React.memo( React.forwardRef((({datasets: datasets = [], c
|
|
|
8475
8852
|
|
|
8476
8853
|
ScatterChart.displayName = "ScatterChart";
|
|
8477
8854
|
|
|
8478
|
-
const
|
|
8855
|
+
const DEFAULT_COLOR_CONFIG = {
|
|
8479
8856
|
scheme: "category"
|
|
8480
|
-
},
|
|
8857
|
+
}, DEFAULT_LABEL_CONFIG = {
|
|
8481
8858
|
showLabels: !0,
|
|
8482
8859
|
minSize: 1e3,
|
|
8483
8860
|
fontSize: 12,
|
|
8484
8861
|
textColor: "white"
|
|
8485
|
-
}, onDataPointClick: onDataPointClick, config: config =
|
|
8862
|
+
}, DEFAULT_CONFIG = {}, TreemapChart = React.memo( React.forwardRef((({data: data = [], algorithm: algorithm = "squarified", colorConfig: colorConfig = DEFAULT_COLOR_CONFIG, labelConfig: labelConfig = DEFAULT_LABEL_CONFIG, onDataPointClick: onDataPointClick, config: config = DEFAULT_CONFIG, ...props}, ref) => {
|
|
8486
8863
|
const [hoveredNode, setHoveredNode] = React.useState(null), [selectedNode, setSelectedNode] = React.useState(null);
|
|
8487
8864
|
React.useState({
|
|
8488
8865
|
x: 0,
|
|
@@ -8594,87 +8971,87 @@ const TreemapChart = React.memo( React.forwardRef((({data: data = [], algorithm
|
|
|
8594
8971
|
remainingHeight -= rowHeight), currentRow = [];
|
|
8595
8972
|
}
|
|
8596
8973
|
}
|
|
8597
|
-
}), []),
|
|
8974
|
+
}), []), renderContent = React.useCallback((({scales: scales, colors: colors, datasets: renderedDatasets, handlers: handlers, hoveredPoint: hoveredPoint}) => {
|
|
8975
|
+
if (!data.length) return null;
|
|
8976
|
+
// Calculate available space with padding
|
|
8977
|
+
const availableWidth = scales.width - 40, availableHeight = scales.height - 40, leafNodes = data.filter((item => !item.children || 0 === item.children.length));
|
|
8978
|
+
if (!leafNodes.length) return null;
|
|
8979
|
+
const totalValue = _reduceInstanceProperty(leafNodes).call(leafNodes, ((sum, node) => sum + node.value), 0), treemapNodes = leafNodes.map(((item, index) => ({
|
|
8980
|
+
id: item.id,
|
|
8981
|
+
label: item.label,
|
|
8982
|
+
value: item.value,
|
|
8983
|
+
color: generateColor(item, 0, index) || "transparent",
|
|
8984
|
+
x: 0,
|
|
8985
|
+
// Will be calculated by squarify
|
|
8986
|
+
y: 0,
|
|
8987
|
+
// Will be calculated by squarify
|
|
8988
|
+
width: 0,
|
|
8989
|
+
// Will be calculated by squarify
|
|
8990
|
+
height: 0,
|
|
8991
|
+
// Will be calculated by squarify
|
|
8992
|
+
depth: 0,
|
|
8993
|
+
children: [],
|
|
8994
|
+
originalData: item
|
|
8995
|
+
})));
|
|
8996
|
+
// Create treemap nodes with proper dimensions
|
|
8997
|
+
// Apply squarified algorithm to layout nodes proportionally by value
|
|
8998
|
+
if ("squarified" === algorithm && totalValue > 0) squarify(treemapNodes, 20, 20, availableWidth, availableHeight); else {
|
|
8999
|
+
// Fallback: simple grid layout (equal sizes)
|
|
9000
|
+
const cols = Math.ceil(Math.sqrt(leafNodes.length)), rows = Math.ceil(leafNodes.length / cols), nodeWidth = availableWidth / cols, nodeHeight = availableHeight / rows;
|
|
9001
|
+
treemapNodes.forEach(((node, index) => {
|
|
9002
|
+
const col = index % cols, row = Math.floor(index / cols);
|
|
9003
|
+
node.x = 20 + col * nodeWidth, node.y = 20 + row * nodeHeight, node.width = nodeWidth,
|
|
9004
|
+
node.height = nodeHeight;
|
|
9005
|
+
}));
|
|
9006
|
+
}
|
|
9007
|
+
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
9008
|
+
children: treemapNodes.map((node => {
|
|
9009
|
+
const isHovered = hoveredNode === node, isSelected = selectedNode === node, area = node.width * node.height, showLabel = labelConfig.showLabels && area >= (labelConfig.minSize || 1e3);
|
|
9010
|
+
return jsxRuntime.jsxs("g", {
|
|
9011
|
+
children: [ jsxRuntime.jsx("rect", {
|
|
9012
|
+
x: node.x,
|
|
9013
|
+
y: node.y,
|
|
9014
|
+
width: node.width,
|
|
9015
|
+
height: node.height,
|
|
9016
|
+
fill: node.color,
|
|
9017
|
+
className: `c-chart__treemap-node ${isHovered ? "c-chart__treemap-node--hovered" : ""} ${isSelected ? "c-chart__treemap-node--selected" : ""}`,
|
|
9018
|
+
onClick: () => {
|
|
9019
|
+
setSelectedNode(node), handlers.onDataPointClick?.(node.originalData, 0, 0);
|
|
9020
|
+
},
|
|
9021
|
+
onMouseEnter: e => {
|
|
9022
|
+
setHoveredNode(node);
|
|
9023
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
9024
|
+
handlers.onPointHover(0, 0, node.x, node.y, rect.left + rect.width / 2, rect.top + rect.height / 2);
|
|
9025
|
+
},
|
|
9026
|
+
onMouseLeave: () => {
|
|
9027
|
+
setHoveredNode(null), handlers.onPointLeave();
|
|
9028
|
+
}
|
|
9029
|
+
}), showLabel && jsxRuntime.jsx("text", {
|
|
9030
|
+
x: node.x + node.width / 2,
|
|
9031
|
+
y: node.y + node.height / 2,
|
|
9032
|
+
textAnchor: "middle",
|
|
9033
|
+
dominantBaseline: "middle",
|
|
9034
|
+
className: "c-chart__treemap-label",
|
|
9035
|
+
style: {
|
|
9036
|
+
fontSize: labelConfig.fontSize,
|
|
9037
|
+
fill: labelConfig.textColor
|
|
9038
|
+
},
|
|
9039
|
+
children: node.label
|
|
9040
|
+
}) ]
|
|
9041
|
+
}, node.id);
|
|
9042
|
+
}))
|
|
9043
|
+
});
|
|
9044
|
+
}), [ data, algorithm, generateColor, squarify, labelConfig, hoveredNode, selectedNode ]), datasets = React.useMemo((() => [ {
|
|
8598
9045
|
label: "Treemap Data",
|
|
8599
9046
|
data: data
|
|
8600
|
-
} ];
|
|
9047
|
+
} ]), [ data ]);
|
|
8601
9048
|
// Squarified treemap algorithm
|
|
8602
9049
|
return jsxRuntime.jsx(BaseChart, {
|
|
8603
9050
|
ref: ref,
|
|
8604
9051
|
type: "treemap",
|
|
8605
9052
|
datasets: datasets,
|
|
8606
9053
|
config: config,
|
|
8607
|
-
renderContent:
|
|
8608
|
-
if (!data.length) return null;
|
|
8609
|
-
// Calculate available space with padding
|
|
8610
|
-
const availableWidth = scales.width - 40, availableHeight = scales.height - 40, leafNodes = data.filter((item => !item.children || 0 === item.children.length));
|
|
8611
|
-
if (!leafNodes.length) return null;
|
|
8612
|
-
const totalValue = _reduceInstanceProperty(leafNodes).call(leafNodes, ((sum, node) => sum + node.value), 0), treemapNodes = leafNodes.map(((item, index) => ({
|
|
8613
|
-
id: item.id,
|
|
8614
|
-
label: item.label,
|
|
8615
|
-
value: item.value,
|
|
8616
|
-
color: generateColor(item, 0, index) || "transparent",
|
|
8617
|
-
x: 0,
|
|
8618
|
-
// Will be calculated by squarify
|
|
8619
|
-
y: 0,
|
|
8620
|
-
// Will be calculated by squarify
|
|
8621
|
-
width: 0,
|
|
8622
|
-
// Will be calculated by squarify
|
|
8623
|
-
height: 0,
|
|
8624
|
-
// Will be calculated by squarify
|
|
8625
|
-
depth: 0,
|
|
8626
|
-
children: [],
|
|
8627
|
-
originalData: item
|
|
8628
|
-
})));
|
|
8629
|
-
// Create treemap nodes with proper dimensions
|
|
8630
|
-
// Apply squarified algorithm to layout nodes proportionally by value
|
|
8631
|
-
if ("squarified" === algorithm && totalValue > 0) squarify(treemapNodes, 20, 20, availableWidth, availableHeight); else {
|
|
8632
|
-
// Fallback: simple grid layout (equal sizes)
|
|
8633
|
-
const cols = Math.ceil(Math.sqrt(leafNodes.length)), rows = Math.ceil(leafNodes.length / cols), nodeWidth = availableWidth / cols, nodeHeight = availableHeight / rows;
|
|
8634
|
-
treemapNodes.forEach(((node, index) => {
|
|
8635
|
-
const col = index % cols, row = Math.floor(index / cols);
|
|
8636
|
-
node.x = 20 + col * nodeWidth, node.y = 20 + row * nodeHeight, node.width = nodeWidth,
|
|
8637
|
-
node.height = nodeHeight;
|
|
8638
|
-
}));
|
|
8639
|
-
}
|
|
8640
|
-
return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
8641
|
-
children: treemapNodes.map((node => {
|
|
8642
|
-
const isHovered = hoveredNode === node, isSelected = selectedNode === node, area = node.width * node.height, showLabel = labelConfig.showLabels && area >= (labelConfig.minSize || 1e3);
|
|
8643
|
-
return jsxRuntime.jsxs("g", {
|
|
8644
|
-
children: [ jsxRuntime.jsx("rect", {
|
|
8645
|
-
x: node.x,
|
|
8646
|
-
y: node.y,
|
|
8647
|
-
width: node.width,
|
|
8648
|
-
height: node.height,
|
|
8649
|
-
fill: node.color,
|
|
8650
|
-
className: `c-chart__treemap-node ${isHovered ? "c-chart__treemap-node--hovered" : ""} ${isSelected ? "c-chart__treemap-node--selected" : ""}`,
|
|
8651
|
-
onClick: () => {
|
|
8652
|
-
setSelectedNode(node), handlers.onDataPointClick?.(node.originalData, 0, 0);
|
|
8653
|
-
},
|
|
8654
|
-
onMouseEnter: e => {
|
|
8655
|
-
setHoveredNode(node);
|
|
8656
|
-
const rect = e.currentTarget.getBoundingClientRect();
|
|
8657
|
-
handlers.onPointHover(0, 0, node.x, node.y, rect.left + rect.width / 2, rect.top + rect.height / 2);
|
|
8658
|
-
},
|
|
8659
|
-
onMouseLeave: () => {
|
|
8660
|
-
setHoveredNode(null), handlers.onPointLeave();
|
|
8661
|
-
}
|
|
8662
|
-
}), showLabel && jsxRuntime.jsx("text", {
|
|
8663
|
-
x: node.x + node.width / 2,
|
|
8664
|
-
y: node.y + node.height / 2,
|
|
8665
|
-
textAnchor: "middle",
|
|
8666
|
-
dominantBaseline: "middle",
|
|
8667
|
-
className: "c-chart__treemap-label",
|
|
8668
|
-
style: {
|
|
8669
|
-
fontSize: labelConfig.fontSize,
|
|
8670
|
-
fill: labelConfig.textColor
|
|
8671
|
-
},
|
|
8672
|
-
children: node.label
|
|
8673
|
-
}) ]
|
|
8674
|
-
}, node.id);
|
|
8675
|
-
}))
|
|
8676
|
-
});
|
|
8677
|
-
},
|
|
9054
|
+
renderContent: renderContent,
|
|
8678
9055
|
onDataPointClick: onDataPointClick,
|
|
8679
9056
|
interactive: !0,
|
|
8680
9057
|
...props
|
|
@@ -9362,7 +9739,7 @@ const range = (start, end) => {
|
|
|
9362
9739
|
blurAmount: 1,
|
|
9363
9740
|
saturation: 160,
|
|
9364
9741
|
aberrationIntensity: .5,
|
|
9365
|
-
|
|
9742
|
+
borderRadius: 8,
|
|
9366
9743
|
mode: "shader"
|
|
9367
9744
|
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
9368
9745
|
...defaultGlassProps,
|
|
@@ -9433,7 +9810,7 @@ const Checkbox = React__default.default.memo( React.forwardRef((({label: label,
|
|
|
9433
9810
|
blurAmount: 1,
|
|
9434
9811
|
saturation: 160,
|
|
9435
9812
|
aberrationIntensity: .3,
|
|
9436
|
-
|
|
9813
|
+
borderRadius: 6,
|
|
9437
9814
|
mode: "shader"
|
|
9438
9815
|
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
9439
9816
|
...defaultGlassProps,
|
|
@@ -9455,7 +9832,38 @@ const DropdownContext = React.createContext({
|
|
|
9455
9832
|
close: () => {},
|
|
9456
9833
|
id: "",
|
|
9457
9834
|
trigger: "click"
|
|
9458
|
-
}),
|
|
9835
|
+
}), DropdownMenu = React.forwardRef((({children: children, className: className = "", ...props}, ref) => {
|
|
9836
|
+
const {glass: glass} = React.useContext(DropdownStyleContext);
|
|
9837
|
+
// We need to access glass prop here?
|
|
9838
|
+
// Wait, the original code wrapped <ul> in Context Provider.
|
|
9839
|
+
// And applied glass wrapper around <ul>.
|
|
9840
|
+
// If we use Compound Component, DropdownMenu should be the list.
|
|
9841
|
+
return jsxRuntime.jsx("ul", {
|
|
9842
|
+
ref: ref,
|
|
9843
|
+
className: `c-dropdown__menu ${glass ? "c-dropdown__menu--glass" : ""} ${className}`.trim(),
|
|
9844
|
+
...props,
|
|
9845
|
+
children: children
|
|
9846
|
+
});
|
|
9847
|
+
}));
|
|
9848
|
+
|
|
9849
|
+
// Compound Components
|
|
9850
|
+
DropdownMenu.displayName = "DropdownMenu";
|
|
9851
|
+
|
|
9852
|
+
const DropdownTrigger = React.forwardRef((({children: children, className: className = "", onClick: onClick, onKeyDown: onKeyDown, ...props}, ref) => jsxRuntime.jsx("div", {
|
|
9853
|
+
ref: ref,
|
|
9854
|
+
className: `c-dropdown__toggle ${className}`.trim(),
|
|
9855
|
+
onClick: onClick,
|
|
9856
|
+
onKeyDown: onKeyDown,
|
|
9857
|
+
...props,
|
|
9858
|
+
children: children
|
|
9859
|
+
})));
|
|
9860
|
+
|
|
9861
|
+
DropdownTrigger.displayName = "DropdownTrigger";
|
|
9862
|
+
|
|
9863
|
+
/**
|
|
9864
|
+
* DropdownItem component for menu items
|
|
9865
|
+
*/
|
|
9866
|
+
const DropdownItem = React.memo((({children: children, href: href, active: active = !1, disabled: disabled = !1, icon: icon, onClick: onClick, className: className = "", LinkComponent: LinkComponent, ...props}) => {
|
|
9459
9867
|
const {close: close} = React.useContext(DropdownContext), handleClick = e => {
|
|
9460
9868
|
disabled ? e.preventDefault() : (onClick && onClick(e),
|
|
9461
9869
|
// Always close the dropdown when an item is clicked
|
|
@@ -9506,7 +9914,7 @@ const DropdownContext = React.createContext({
|
|
|
9506
9914
|
}))), DropdownHeader = React.memo((({children: children, className: className = ""}) => jsxRuntime.jsx("li", {
|
|
9507
9915
|
className: `c-dropdown__header ${className}`,
|
|
9508
9916
|
children: children
|
|
9509
|
-
}))), Dropdown = React.memo((({children: children, menu: menu, placement: placement = "bottom-start", trigger: trigger = "click", offset: offset = DROPDOWN.DEFAULTS.OFFSET, isOpen: controlledIsOpen, onOpenChange: onOpenChange, closeOnClickOutside: closeOnClickOutside = !0, closeOnEscape: closeOnEscape = !0, maxHeight: maxHeight, minWidth: minWidth = DROPDOWN.DEFAULTS.MIN_WIDTH, variant: variant, className: className = "", style: style, glass: glass, ...props}) => {
|
|
9917
|
+
}))), DropdownStyleContext = React.createContext({}), Dropdown = React.memo((({children: children, menu: menu, placement: placement = "bottom-start", trigger: trigger = "click", offset: offset = DROPDOWN.DEFAULTS.OFFSET, isOpen: controlledIsOpen, onOpenChange: onOpenChange, closeOnClickOutside: closeOnClickOutside = !0, closeOnEscape: closeOnEscape = !0, maxHeight: maxHeight, minWidth: minWidth = DROPDOWN.DEFAULTS.MIN_WIDTH, variant: variant, className: className = "", style: style, glass: glass, ...props}) => {
|
|
9510
9918
|
// Set up controlled vs uncontrolled state
|
|
9511
9919
|
const [uncontrolledIsOpen, setUncontrolledIsOpen] = React.useState(!1), isControlled = void 0 !== controlledIsOpen, isOpen = isControlled ? controlledIsOpen : uncontrolledIsOpen, dropdownRef = React.useRef(null), toggleRef = React.useRef(null), menuRef = React.useRef(null), dropdownId = React.useRef(`dropdown-${Math.random().toString(36).substring(2, 9)}`).current, setIsOpen = React.useCallback((nextIsOpen => {
|
|
9512
9920
|
isControlled || setUncontrolledIsOpen(nextIsOpen), onOpenChange && onOpenChange(nextIsOpen);
|
|
@@ -9569,20 +9977,59 @@ const DropdownContext = React.createContext({
|
|
|
9569
9977
|
"hover" === trigger && setIsOpen(!0);
|
|
9570
9978
|
}), [ trigger, setIsOpen ]), dropdownClasses = [ "c-dropdown", "click" === trigger ? "c-dropdown--onclick" : "", variant ? `c-dropdown--${variant}` : "", isOpen ? "is-open" : "", glass ? "c-dropdown--glass" : "", className ].filter(Boolean).join(" "), menuStyleProps = {};
|
|
9571
9979
|
// Event handlers
|
|
9572
|
-
|
|
9980
|
+
let triggerContent, menuContentNode;
|
|
9981
|
+
maxHeight && (menuStyleProps.maxHeight = maxHeight), void 0 !== minWidth && (menuStyleProps.minWidth = "number" == typeof minWidth ? `${minWidth}px` : minWidth),
|
|
9982
|
+
React__default.default.Children.toArray(children).some((child => {
|
|
9983
|
+
var _context;
|
|
9984
|
+
|
|
9985
|
+
return React__default.default.isValidElement(child) && _includesInstanceProperty(_context = [ "DropdownTrigger", "DropdownMenu" ]).call(_context, child.type.displayName);
|
|
9986
|
+
})) ?
|
|
9987
|
+
// Find Trigger and Menu in children
|
|
9988
|
+
React__default.default.Children.forEach(children, (child => {
|
|
9989
|
+
React__default.default.isValidElement(child) && ("DropdownTrigger" === child.type.displayName ? triggerContent = React__default.default.cloneElement(child, {
|
|
9990
|
+
ref: toggleRef,
|
|
9991
|
+
onClick: e => {
|
|
9992
|
+
handleToggleClick(e), child.props.onClick?.(e);
|
|
9993
|
+
},
|
|
9994
|
+
onKeyDown: e => {
|
|
9995
|
+
handleToggleKeyDown(e), child.props.onKeyDown?.(e);
|
|
9996
|
+
},
|
|
9997
|
+
"aria-haspopup": "menu",
|
|
9998
|
+
"aria-expanded": isOpen,
|
|
9999
|
+
"aria-controls": dropdownId,
|
|
10000
|
+
tabIndex: 0
|
|
10001
|
+
}) : "DropdownMenu" === child.type.displayName && (menuContentNode = child));
|
|
10002
|
+
})) : (
|
|
10003
|
+
// Legacy mode
|
|
10004
|
+
triggerContent = jsxRuntime.jsx("div", {
|
|
10005
|
+
ref: toggleRef,
|
|
10006
|
+
className: "c-dropdown__toggle",
|
|
10007
|
+
onClick: handleToggleClick,
|
|
10008
|
+
onKeyDown: handleToggleKeyDown,
|
|
10009
|
+
"aria-haspopup": "menu",
|
|
10010
|
+
"aria-expanded": isOpen,
|
|
10011
|
+
"aria-controls": dropdownId,
|
|
10012
|
+
tabIndex: 0,
|
|
10013
|
+
children: children
|
|
10014
|
+
}), menuContentNode = jsxRuntime.jsx("ul", {
|
|
10015
|
+
className: "c-dropdown__menu " + (glass ? "c-dropdown__menu--glass" : ""),
|
|
10016
|
+
children: menu
|
|
10017
|
+
}));
|
|
9573
10018
|
const menuContent = jsxRuntime.jsx("div", {
|
|
9574
10019
|
className: "c-dropdown__menu-inner",
|
|
9575
10020
|
style: menuStyleProps,
|
|
9576
|
-
children: jsxRuntime.jsx(
|
|
10021
|
+
children: jsxRuntime.jsx(DropdownStyleContext.Provider, {
|
|
9577
10022
|
value: {
|
|
9578
|
-
|
|
9579
|
-
close: close,
|
|
9580
|
-
id: dropdownId,
|
|
9581
|
-
trigger: trigger
|
|
10023
|
+
glass: glass
|
|
9582
10024
|
},
|
|
9583
|
-
children: jsxRuntime.jsx(
|
|
9584
|
-
|
|
9585
|
-
|
|
10025
|
+
children: jsxRuntime.jsx(DropdownContext.Provider, {
|
|
10026
|
+
value: {
|
|
10027
|
+
isOpen: isOpen,
|
|
10028
|
+
close: close,
|
|
10029
|
+
id: dropdownId,
|
|
10030
|
+
trigger: trigger
|
|
10031
|
+
},
|
|
10032
|
+
children: menuContentNode
|
|
9586
10033
|
})
|
|
9587
10034
|
})
|
|
9588
10035
|
});
|
|
@@ -9592,17 +10039,7 @@ const DropdownContext = React.createContext({
|
|
|
9592
10039
|
style: style,
|
|
9593
10040
|
onMouseEnter: "hover" === trigger ? handleHoverOpen : void 0,
|
|
9594
10041
|
...props,
|
|
9595
|
-
children: [ jsxRuntime.jsx("div", {
|
|
9596
|
-
ref: toggleRef,
|
|
9597
|
-
className: "c-dropdown__toggle",
|
|
9598
|
-
onClick: handleToggleClick,
|
|
9599
|
-
onKeyDown: handleToggleKeyDown,
|
|
9600
|
-
"aria-haspopup": "menu",
|
|
9601
|
-
"aria-expanded": isOpen,
|
|
9602
|
-
"aria-controls": dropdownId,
|
|
9603
|
-
tabIndex: 0,
|
|
9604
|
-
children: children
|
|
9605
|
-
}), jsxRuntime.jsx("div", {
|
|
10042
|
+
children: [ triggerContent, jsxRuntime.jsx("div", {
|
|
9606
10043
|
ref: menuRef,
|
|
9607
10044
|
id: dropdownId,
|
|
9608
10045
|
className: `c-dropdown__menu-wrapper c-dropdown__menu-wrapper--${placement} ${isOpen ? "is-open" : ""} ${glass ? "is-glass" : ""}`,
|
|
@@ -9630,9 +10067,9 @@ const DropdownContext = React.createContext({
|
|
|
9630
10067
|
}));
|
|
9631
10068
|
|
|
9632
10069
|
/**
|
|
9633
|
-
*
|
|
9634
|
-
*/ Dropdown.displayName = "Dropdown",
|
|
9635
|
-
|
|
10070
|
+
* DropdownDivider component for separating groups of items
|
|
10071
|
+
*/ Dropdown.displayName = "Dropdown", Dropdown.Trigger = DropdownTrigger, Dropdown.Menu = DropdownMenu,
|
|
10072
|
+
Dropdown.Item = DropdownItem, Dropdown.Divider = DropdownDivider, Dropdown.Header = DropdownHeader;
|
|
9636
10073
|
|
|
9637
10074
|
/**
|
|
9638
10075
|
* DataTable - A flexible and accessible data table component with advanced features
|
|
@@ -10721,53 +11158,50 @@ function useEdgePanel(initialProps) {
|
|
|
10721
11158
|
};
|
|
10722
11159
|
}
|
|
10723
11160
|
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
10729
|
-
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10733
|
-
|
|
10734
|
-
|
|
10735
|
-
|
|
10736
|
-
|
|
10737
|
-
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10741
|
-
|
|
10742
|
-
|
|
10743
|
-
|
|
10744
|
-
|
|
10745
|
-
|
|
10746
|
-
|
|
10747
|
-
|
|
10748
|
-
|
|
10749
|
-
|
|
10750
|
-
|
|
10751
|
-
* // With custom glass configuration
|
|
10752
|
-
* <EdgePanel
|
|
10753
|
-
* title="Custom Glass"
|
|
10754
|
-
* isOpen={isOpen}
|
|
10755
|
-
* onOpenChange={setIsOpen}
|
|
10756
|
-
* position="start"
|
|
10757
|
-
* glass={{
|
|
10758
|
-
* mode: 'shader',
|
|
10759
|
-
* shaderVariant: 'liquidGlass',
|
|
10760
|
-
* displacementScale: 70,
|
|
10761
|
-
* blurAmount: 1.8,
|
|
10762
|
-
* saturation: 170,
|
|
10763
|
-
* }}
|
|
10764
|
-
* >
|
|
10765
|
-
* <p>Panel with custom glass effect</p>
|
|
10766
|
-
* </EdgePanel>
|
|
10767
|
-
* ```
|
|
10768
|
-
*/ DatePicker.displayName = "DatePicker";
|
|
11161
|
+
// Subcomponents
|
|
11162
|
+
DatePicker.displayName = "DatePicker";
|
|
11163
|
+
|
|
11164
|
+
const EdgePanelHeader = React.forwardRef((({children: children, className: className = "", ...props}, ref) => jsxRuntime.jsx("div", {
|
|
11165
|
+
ref: ref,
|
|
11166
|
+
className: `c-edge-panel__header ${className}`.trim(),
|
|
11167
|
+
...props,
|
|
11168
|
+
children: children
|
|
11169
|
+
})));
|
|
11170
|
+
|
|
11171
|
+
EdgePanelHeader.displayName = "EdgePanelHeader";
|
|
11172
|
+
|
|
11173
|
+
const EdgePanelBody = React.forwardRef((({children: children, className: className = "", ...props}, ref) => jsxRuntime.jsx("div", {
|
|
11174
|
+
ref: ref,
|
|
11175
|
+
className: `c-edge-panel__body ${className}`.trim(),
|
|
11176
|
+
...props,
|
|
11177
|
+
children: children
|
|
11178
|
+
})));
|
|
11179
|
+
|
|
11180
|
+
EdgePanelBody.displayName = "EdgePanelBody";
|
|
11181
|
+
|
|
11182
|
+
const EdgePanelFooter = React.forwardRef((({children: children, className: className = "", ...props}, ref) => jsxRuntime.jsx("div", {
|
|
11183
|
+
ref: ref,
|
|
11184
|
+
className: `c-edge-panel__footer ${className}`.trim(),
|
|
11185
|
+
...props,
|
|
11186
|
+
children: children
|
|
11187
|
+
})));
|
|
10769
11188
|
|
|
10770
|
-
|
|
11189
|
+
EdgePanelFooter.displayName = "EdgePanelFooter";
|
|
11190
|
+
|
|
11191
|
+
const EdgePanelCloseButton = React.forwardRef((({className: className = "", onClick: onClick, ...props}, ref) => jsxRuntime.jsx("button", {
|
|
11192
|
+
ref: ref,
|
|
11193
|
+
className: `c-edge-panel__close c-btn c-btn--icon ${className}`.trim(),
|
|
11194
|
+
onClick: onClick,
|
|
11195
|
+
"aria-label": "Close panel",
|
|
11196
|
+
...props,
|
|
11197
|
+
children: jsxRuntime.jsx(Icon, {
|
|
11198
|
+
name: "X"
|
|
11199
|
+
})
|
|
11200
|
+
})));
|
|
11201
|
+
|
|
11202
|
+
EdgePanelCloseButton.displayName = "EdgePanelCloseButton";
|
|
11203
|
+
|
|
11204
|
+
const EdgePanel = React.memo((({title: title, children: children, position: position = "start", mode: mode = "slide", isOpen: isOpen = !1, onOpenChange: onOpenChange, backdrop: backdrop = !0, closeOnBackdropClick: closeOnBackdropClick = !0, closeOnEscape: closeOnEscape = !0, className: className = "", style: style, glass: glass}) => {
|
|
10771
11205
|
const {isOpen: isOpenState, containerRef: containerRef, backdropRef: backdropRef, generateEdgePanelClass: generateEdgePanelClass, closePanel: closePanel, handleBackdropClick: handleBackdropClick} = useEdgePanel({
|
|
10772
11206
|
position: position,
|
|
10773
11207
|
mode: mode,
|
|
@@ -10784,13 +11218,23 @@ const EdgePanel = ({title: title, children: children, position: position = "star
|
|
|
10784
11218
|
});
|
|
10785
11219
|
// Moved useRef outside of conditional rendering to fix hook order issue
|
|
10786
11220
|
// If not open and not controlled by parent, don't render
|
|
11221
|
+
// Note: useEdgePanel manages internal state if onOpenChange is not provided?
|
|
11222
|
+
// Looking at useEdgePanel (implied): it seems to return isOpenState.
|
|
11223
|
+
// If we return null here, animations might be cut off.
|
|
11224
|
+
// Usually EdgePanel/Drawer should stay mounted but hidden or conditionally mounted.
|
|
11225
|
+
// The original code returned null if !isOpenState && isOpen === false.
|
|
11226
|
+
// Let's keep that logic.
|
|
10787
11227
|
if (!isOpenState && !1 === isOpen) return null;
|
|
10788
11228
|
const defaultGlassProps = {
|
|
10789
11229
|
elasticity: 0
|
|
10790
11230
|
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
10791
11231
|
...defaultGlassProps,
|
|
10792
11232
|
...glass
|
|
10793
|
-
}, panelContent =
|
|
11233
|
+
}, panelContent = React__default.default.Children.toArray(children).some((child => {
|
|
11234
|
+
var _context;
|
|
11235
|
+
|
|
11236
|
+
return React__default.default.isValidElement(child) && _includesInstanceProperty(_context = [ "EdgePanelHeader", "EdgePanelBody", "EdgePanelFooter" ]).call(_context, child.type.displayName);
|
|
11237
|
+
})) ? children : jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
10794
11238
|
children: [ jsxRuntime.jsxs("div", {
|
|
10795
11239
|
className: "c-edge-panel__header",
|
|
10796
11240
|
children: [ jsxRuntime.jsx("h4", {
|
|
@@ -10833,7 +11277,7 @@ const EdgePanel = ({title: title, children: children, position: position = "star
|
|
|
10833
11277
|
}) : panelContent
|
|
10834
11278
|
}) ]
|
|
10835
11279
|
});
|
|
10836
|
-
};
|
|
11280
|
+
}));
|
|
10837
11281
|
|
|
10838
11282
|
/**
|
|
10839
11283
|
* Form state and functionality
|
|
@@ -10867,7 +11311,8 @@ function useForm(initialProps) {
|
|
|
10867
11311
|
|
|
10868
11312
|
/**
|
|
10869
11313
|
* Form - A component for creating form layouts
|
|
10870
|
-
*/ EdgePanel.displayName = "EdgePanel"
|
|
11314
|
+
*/ EdgePanel.displayName = "EdgePanel", EdgePanel.Header = EdgePanelHeader, EdgePanel.Body = EdgePanelBody,
|
|
11315
|
+
EdgePanel.Footer = EdgePanelFooter, EdgePanel.CloseButton = EdgePanelCloseButton;
|
|
10871
11316
|
|
|
10872
11317
|
const Form = ({children: children, onSubmit: onSubmit, onReset: onReset, className: className = "", style: style, disabled: disabled = !1, id: id, method: method = "post", encType: encType, noValidate: noValidate = !1, autoComplete: autoComplete = "on"}) => {
|
|
10873
11318
|
const {generateFormClass: generateFormClass, handleSubmit: handleSubmit, handleReset: handleReset} = useForm({
|
|
@@ -11047,7 +11492,7 @@ const Input = React.memo( React.forwardRef((({type: type = "text", value: value
|
|
|
11047
11492
|
blurAmount: 1,
|
|
11048
11493
|
saturation: 180,
|
|
11049
11494
|
aberrationIntensity: .2,
|
|
11050
|
-
|
|
11495
|
+
borderRadius: 12,
|
|
11051
11496
|
mode: "shader"
|
|
11052
11497
|
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
11053
11498
|
...defaultGlassProps,
|
|
@@ -11087,7 +11532,7 @@ function useHero(initialProps) {
|
|
|
11087
11532
|
* @returns Slider state and methods
|
|
11088
11533
|
*/
|
|
11089
11534
|
function(config) {
|
|
11090
|
-
const {slides: slides, autoplay: autoplay, loop: loop = !0, transition: transition = "fade", transitionDuration: transitionDuration = 1e3} = config, [currentIndex, setCurrentIndex] = React.useState(0), [isTransitioning, setIsTransitioning] = React.useState(!1), autoplayRef = React.useRef(null), isPausedRef = React.useRef(!1), slideRefs = React.useMemo((() => slides.map((() => React__default.default.createRef()))), [ slides.length ]), videoRefs = React.useMemo((() => slides.map((() => React__default.default.createRef()))), [ slides.length ]), handleSlideTransition = React.useCallback((nextIndex => {
|
|
11535
|
+
const {slides: slides, autoplay: autoplay, loop: loop = !0, transition: transition = "fade", transitionDuration: transitionDuration = 1e3} = config, [currentIndex, setCurrentIndex] = React.useState(0), [isTransitioning, setIsTransitioning] = React.useState(!1), autoplayRef = React.useRef(null), isPausedRef = React.useRef(!1), callbackRef = React.useRef(), slideRefs = React.useMemo((() => slides.map((() => React__default.default.createRef()))), [ slides.length ]), videoRefs = React.useMemo((() => slides.map((() => React__default.default.createRef()))), [ slides.length ]), handleSlideTransition = React.useCallback((nextIndex => {
|
|
11091
11536
|
if (nextIndex === currentIndex || isTransitioning) return;
|
|
11092
11537
|
if (nextIndex < 0 || nextIndex >= slides.length) return;
|
|
11093
11538
|
setIsTransitioning(!0),
|
|
@@ -11108,7 +11553,17 @@ function useHero(initialProps) {
|
|
|
11108
11553
|
let nextIndex;
|
|
11109
11554
|
nextIndex = loop ? (currentIndex + 1) % slides.length : Math.min(currentIndex + 1, slides.length - 1),
|
|
11110
11555
|
handleSlideTransition(nextIndex);
|
|
11111
|
-
}), [ currentIndex, slides.length, loop, handleSlideTransition ])
|
|
11556
|
+
}), [ currentIndex, slides.length, loop, handleSlideTransition ]);
|
|
11557
|
+
// Update callbackRef whenever nextSlide or isTransitioning changes
|
|
11558
|
+
React.useEffect((() => {
|
|
11559
|
+
callbackRef.current = () => {
|
|
11560
|
+
isPausedRef.current || isTransitioning || nextSlide();
|
|
11561
|
+
};
|
|
11562
|
+
}), [ nextSlide, isTransitioning ]);
|
|
11563
|
+
/**
|
|
11564
|
+
* Pause autoplay
|
|
11565
|
+
*/
|
|
11566
|
+
const pauseAutoplay = React.useCallback((() => {
|
|
11112
11567
|
isPausedRef.current = !0, autoplayRef.current && (clearInterval(autoplayRef.current),
|
|
11113
11568
|
autoplayRef.current = null);
|
|
11114
11569
|
}), []), resumeAutoplay = React.useCallback((() => {
|
|
@@ -11117,24 +11572,26 @@ function useHero(initialProps) {
|
|
|
11117
11572
|
const delay = "object" == typeof autoplay ? autoplay.delay : 3e3;
|
|
11118
11573
|
// Restart autoplay
|
|
11119
11574
|
autoplayRef.current || (autoplayRef.current = setInterval((() => {
|
|
11120
|
-
|
|
11575
|
+
callbackRef.current && callbackRef.current();
|
|
11121
11576
|
}), delay));
|
|
11122
11577
|
}
|
|
11123
|
-
}), [ autoplay, slides.length
|
|
11578
|
+
}), [ autoplay, slides.length ]);
|
|
11579
|
+
/**
|
|
11580
|
+
* Resume autoplay
|
|
11581
|
+
*/
|
|
11124
11582
|
// Autoplay effect
|
|
11125
11583
|
return React.useEffect((() => {
|
|
11126
11584
|
if (!autoplay || slides.length <= 1) return;
|
|
11127
11585
|
const delay = "object" == typeof autoplay ? autoplay.delay : 3e3;
|
|
11128
|
-
return "object" == typeof autoplay && autoplay.pauseOnHover,
|
|
11129
11586
|
// Clear any existing interval
|
|
11130
|
-
|
|
11587
|
+
return autoplayRef.current && (clearInterval(autoplayRef.current), autoplayRef.current = null),
|
|
11131
11588
|
// Start autoplay if not paused
|
|
11132
11589
|
isPausedRef.current || (autoplayRef.current = setInterval((() => {
|
|
11133
|
-
|
|
11590
|
+
callbackRef.current && callbackRef.current();
|
|
11134
11591
|
}), delay)), () => {
|
|
11135
11592
|
autoplayRef.current && (clearInterval(autoplayRef.current), autoplayRef.current = null);
|
|
11136
11593
|
};
|
|
11137
|
-
}), [ autoplay, slides.length
|
|
11594
|
+
}), [ autoplay, slides.length ]),
|
|
11138
11595
|
// Initialize first video if needed
|
|
11139
11596
|
React.useEffect((() => {
|
|
11140
11597
|
if (slides.length > 0 && "video" === slides[currentIndex]?.type) {
|
|
@@ -12133,7 +12590,14 @@ const DEFAULT_ATOMIX_FONTS = [ {
|
|
|
12133
12590
|
}
|
|
12134
12591
|
|
|
12135
12592
|
function useSlider(options) {
|
|
12136
|
-
const {slides: slides, slidesToShow: slidesToShow = 1, spaceBetween: spaceBetween = 0, loop: loop = !1, initialSlide: initialSlide = 0, direction: direction = "horizontal", speed: speed = 300, allowTouchMove: allowTouchMove = !0, threshold: threshold = 50, autoplay: autoplay, onSlideChange: onSlideChange} = options, containerRef = React.useRef(null), wrapperRef = React.useRef(null), repositioningRef = React.useRef(!1), autoplayRef = React.useRef(null), [autoplayRunning, setAutoplayRunning] = React.useState(!1),
|
|
12593
|
+
const {slides: slides, slidesToShow: slidesToShow = 1, spaceBetween: spaceBetween = 0, loop: loop = !1, initialSlide: initialSlide = 0, direction: direction = "horizontal", speed: speed = 300, allowTouchMove: allowTouchMove = !0, threshold: threshold = 50, autoplay: autoplay, onSlideChange: onSlideChange} = options, containerRef = React.useRef(null), wrapperRef = React.useRef(null), repositioningRef = React.useRef(!1), autoplayRef = React.useRef(null), [autoplayRunning, setAutoplayRunning] = React.useState(!1), sliderStateRef = React.useRef({
|
|
12594
|
+
isTransitioning: !1,
|
|
12595
|
+
loop: loop,
|
|
12596
|
+
slides: slides,
|
|
12597
|
+
slidesToShow: slidesToShow,
|
|
12598
|
+
speed: speed,
|
|
12599
|
+
onSlideChange: onSlideChange
|
|
12600
|
+
}), [realIndex, setRealIndex] = React.useState(initialSlide), [internalIndex, setInternalIndex] = React.useState(0), [isTransitioning, setIsTransitioning] = React.useState(!1), [containerSize, setContainerSize] = React.useState(0), [touching, setTouching] = React.useState(!1), [touchStart, setTouchStart] = React.useState(0), [dragOffset, setDragOffset] = React.useState(0), slideWidth = React.useMemo((() => 0 === containerSize ? 0 : (containerSize - spaceBetween * (slidesToShow - 1)) / slidesToShow), [ containerSize, spaceBetween, slidesToShow ]), allSlides = React.useMemo((() => loop && 0 !== slides.length ? [ ...slides.map(((slide, i) => ({
|
|
12137
12601
|
...slide,
|
|
12138
12602
|
id: `set1-${slide.id || i}`
|
|
12139
12603
|
}))), ...slides.map(((slide, i) => ({
|
|
@@ -12143,6 +12607,17 @@ function useSlider(options) {
|
|
|
12143
12607
|
...slide,
|
|
12144
12608
|
id: `set3-${slide.id || i}`
|
|
12145
12609
|
}))) ] : slides), [ slides, loop ]), loopedSlides = slides.length, translateValue = React.useMemo((() => 0 === slideWidth ? 0 : -internalIndex * slideWidth + dragOffset), [ slideWidth, internalIndex, dragOffset ]);
|
|
12610
|
+
// Update the ref whenever the relevant state/props change
|
|
12611
|
+
React.useEffect((() => {
|
|
12612
|
+
sliderStateRef.current = {
|
|
12613
|
+
isTransitioning: isTransitioning,
|
|
12614
|
+
loop: loop,
|
|
12615
|
+
slides: slides,
|
|
12616
|
+
slidesToShow: slidesToShow,
|
|
12617
|
+
speed: speed,
|
|
12618
|
+
onSlideChange: onSlideChange
|
|
12619
|
+
};
|
|
12620
|
+
}), [ isTransitioning, loop, slides, slidesToShow, speed, onSlideChange ]),
|
|
12146
12621
|
// Autoplay effect
|
|
12147
12622
|
React.useEffect((() => {
|
|
12148
12623
|
if (!autoplay) return autoplayRef.current && (clearInterval(autoplayRef.current),
|
|
@@ -12154,32 +12629,34 @@ function useSlider(options) {
|
|
|
12154
12629
|
autoplayRef.current && clearInterval(autoplayRef.current),
|
|
12155
12630
|
// Create new interval
|
|
12156
12631
|
autoplayRef.current = setInterval((() => {
|
|
12632
|
+
// Use ref to get the latest state without resetting the interval
|
|
12633
|
+
const {isTransitioning: currentIsTransitioning, loop: currentLoop, slides: currentSlides, slidesToShow: currentSlidesToShow, speed: currentSpeed, onSlideChange: currentOnSlideChange} = sliderStateRef.current;
|
|
12157
12634
|
// We need to use a functional update to get the latest values
|
|
12158
|
-
|
|
12159
|
-
if (
|
|
12635
|
+
setRealIndex((prevRealIndex => {
|
|
12636
|
+
if (currentIsTransitioning) return prevRealIndex;
|
|
12160
12637
|
// Stop autoplay on interaction if disableOnInteraction is true
|
|
12161
12638
|
let nextIndex;
|
|
12162
12639
|
// Trigger the slide change
|
|
12163
12640
|
if (disableOnInteraction && autoplayRef.current && (clearInterval(autoplayRef.current),
|
|
12164
|
-
autoplayRef.current = null, setAutoplayRunning(!1)), nextIndex =
|
|
12641
|
+
autoplayRef.current = null, setAutoplayRunning(!1)), nextIndex = currentLoop ? (prevRealIndex + 1) % currentSlides.length : Math.min(prevRealIndex + 1, currentSlides.length - currentSlidesToShow),
|
|
12165
12642
|
reverseDirection) {
|
|
12166
12643
|
// For reverse direction, we would go to previous slide
|
|
12167
|
-
const prevIndex =
|
|
12168
|
-
return setInternalIndex(
|
|
12169
|
-
setDragOffset(0), setTimeout((() => {
|
|
12170
|
-
setIsTransitioning(!1),
|
|
12171
|
-
}),
|
|
12644
|
+
const prevIndex = currentLoop ? 0 === prevRealIndex ? currentSlides.length - 1 : prevRealIndex - 1 : Math.max(prevRealIndex - 1, 0);
|
|
12645
|
+
return setInternalIndex(currentLoop ? currentSlides.length + prevIndex : prevIndex),
|
|
12646
|
+
setIsTransitioning(!0), setDragOffset(0), setTimeout((() => {
|
|
12647
|
+
setIsTransitioning(!1), currentOnSlideChange?.(prevIndex);
|
|
12648
|
+
}), currentSpeed), prevIndex;
|
|
12172
12649
|
}
|
|
12173
12650
|
// Normal direction
|
|
12174
|
-
return setInternalIndex(
|
|
12175
|
-
setDragOffset(0), setTimeout((() => {
|
|
12176
|
-
setIsTransitioning(!1),
|
|
12651
|
+
return setInternalIndex(currentLoop ? currentSlides.length + nextIndex : nextIndex),
|
|
12652
|
+
setIsTransitioning(!0), setDragOffset(0), setTimeout((() => {
|
|
12653
|
+
setIsTransitioning(!1), currentOnSlideChange?.(nextIndex),
|
|
12177
12654
|
// Reposition after transition ends for looped sliders
|
|
12178
|
-
|
|
12179
|
-
setTimeout((() => {
|
|
12655
|
+
currentLoop && nextIndex >= 2 * currentSlides.length && (repositioningRef.current = !0,
|
|
12656
|
+
setInternalIndex(currentSlides.length + nextIndex), setTimeout((() => {
|
|
12180
12657
|
repositioningRef.current = !1;
|
|
12181
12658
|
}), 0));
|
|
12182
|
-
}),
|
|
12659
|
+
}), currentSpeed), nextIndex;
|
|
12183
12660
|
}));
|
|
12184
12661
|
}), delay), setAutoplayRunning(!0);
|
|
12185
12662
|
// Handle pause on mouse enter/leave if enabled
|
|
@@ -12190,17 +12667,18 @@ function useSlider(options) {
|
|
|
12190
12667
|
}, handleMouseLeave = () => {
|
|
12191
12668
|
// Restart autoplay
|
|
12192
12669
|
autoplayRef.current && clearInterval(autoplayRef.current), autoplayRef.current = setInterval((() => {
|
|
12670
|
+
const {isTransitioning: currentIsTransitioning, loop: currentLoop, slides: currentSlides, slidesToShow: currentSlidesToShow, speed: currentSpeed, onSlideChange: currentOnSlideChange} = sliderStateRef.current;
|
|
12193
12671
|
setRealIndex((prevRealIndex => {
|
|
12194
|
-
if (
|
|
12672
|
+
if (currentIsTransitioning) return prevRealIndex;
|
|
12195
12673
|
let nextIndex;
|
|
12196
|
-
return nextIndex =
|
|
12197
|
-
setInternalIndex(
|
|
12674
|
+
return nextIndex = currentLoop ? (prevRealIndex + 1) % currentSlides.length : Math.min(prevRealIndex + 1, currentSlides.length - currentSlidesToShow),
|
|
12675
|
+
setInternalIndex(currentLoop ? currentSlides.length + nextIndex : nextIndex), setIsTransitioning(!0),
|
|
12198
12676
|
setDragOffset(0), setTimeout((() => {
|
|
12199
|
-
setIsTransitioning(!1),
|
|
12200
|
-
setInternalIndex(
|
|
12677
|
+
setIsTransitioning(!1), currentOnSlideChange?.(nextIndex), currentLoop && nextIndex >= 2 * currentSlides.length && (repositioningRef.current = !0,
|
|
12678
|
+
setInternalIndex(currentSlides.length + nextIndex), setTimeout((() => {
|
|
12201
12679
|
repositioningRef.current = !1;
|
|
12202
12680
|
}), 0));
|
|
12203
|
-
}),
|
|
12681
|
+
}), currentSpeed), nextIndex;
|
|
12204
12682
|
}));
|
|
12205
12683
|
}), delay), setAutoplayRunning(!0);
|
|
12206
12684
|
};
|
|
@@ -12212,7 +12690,7 @@ function useSlider(options) {
|
|
|
12212
12690
|
containerElement && (containerElement.removeEventListener("mouseenter", handleMouseEnter),
|
|
12213
12691
|
containerElement.removeEventListener("mouseleave", handleMouseLeave)), setAutoplayRunning(!1);
|
|
12214
12692
|
};
|
|
12215
|
-
}), [ autoplay,
|
|
12693
|
+
}), [ autoplay, repositioningRef ]),
|
|
12216
12694
|
// Initialize
|
|
12217
12695
|
React.useEffect((() => {
|
|
12218
12696
|
setInternalIndex(loop ? slides.length + initialSlide : initialSlide);
|
|
@@ -12438,8 +12916,6 @@ function useSlider(options) {
|
|
|
12438
12916
|
};
|
|
12439
12917
|
}
|
|
12440
12918
|
|
|
12441
|
-
// Button composables
|
|
12442
|
-
// export * from './useButton';
|
|
12443
12919
|
// Accordion composables
|
|
12444
12920
|
var composablesImport = Object.freeze({
|
|
12445
12921
|
__proto__: null,
|
|
@@ -12480,9 +12956,57 @@ var composablesImport = Object.freeze({
|
|
|
12480
12956
|
useTodo: useTodo
|
|
12481
12957
|
});
|
|
12482
12958
|
|
|
12959
|
+
const SelectContext = React.createContext(null), SelectOption = React.memo((({value: value, children: children, disabled: disabled = !1, className: className = "", style: style}) => {
|
|
12960
|
+
const context = React.useContext(SelectContext), label = "string" == typeof children ? children : value;
|
|
12961
|
+
// We assume children is the label if it's a string, or we need a way to get label.
|
|
12962
|
+
// For simplicity, we use children as label for registration if it's a string.
|
|
12963
|
+
if (React.useEffect((() => {
|
|
12964
|
+
if (context) return context.registerOption({
|
|
12965
|
+
value: value,
|
|
12966
|
+
label: label,
|
|
12967
|
+
disabled: disabled
|
|
12968
|
+
}), () => {
|
|
12969
|
+
context.unregisterOption(value);
|
|
12970
|
+
};
|
|
12971
|
+
}), [ context, value, label, disabled ]), !context) return console.warn("SelectOption must be used within a Select component"),
|
|
12972
|
+
null;
|
|
12973
|
+
const {selectedValue: selectedValue, onSelect: onSelect} = context, isSelected = Array.isArray(selectedValue) ? _includesInstanceProperty(selectedValue).call(selectedValue, value) : selectedValue === value;
|
|
12974
|
+
return jsxRuntime.jsx("li", {
|
|
12975
|
+
className: `${SELECT.CLASSES.SELECT_ITEM} ${className}`.trim(),
|
|
12976
|
+
"data-value": value,
|
|
12977
|
+
onClick: e => {
|
|
12978
|
+
e.preventDefault(), e.stopPropagation(), disabled || onSelect(value, label);
|
|
12979
|
+
},
|
|
12980
|
+
style: style,
|
|
12981
|
+
role: "option",
|
|
12982
|
+
"aria-selected": isSelected,
|
|
12983
|
+
"aria-disabled": disabled,
|
|
12984
|
+
children: jsxRuntime.jsxs("label", {
|
|
12985
|
+
className: "c-checkbox",
|
|
12986
|
+
style: {
|
|
12987
|
+
pointerEvents: "none"
|
|
12988
|
+
},
|
|
12989
|
+
children: [ jsxRuntime.jsx("input", {
|
|
12990
|
+
type: "checkbox",
|
|
12991
|
+
className: "c-checkbox__input c-select__item-input",
|
|
12992
|
+
checked: isSelected,
|
|
12993
|
+
readOnly: !0,
|
|
12994
|
+
disabled: disabled,
|
|
12995
|
+
tabIndex: -1
|
|
12996
|
+
}), jsxRuntime.jsx("div", {
|
|
12997
|
+
className: "c-select__item-label",
|
|
12998
|
+
children: children
|
|
12999
|
+
}) ]
|
|
13000
|
+
})
|
|
13001
|
+
});
|
|
13002
|
+
}));
|
|
13003
|
+
|
|
13004
|
+
SelectOption.displayName = "SelectOption";
|
|
13005
|
+
|
|
12483
13006
|
/**
|
|
12484
13007
|
* Select - A component for dropdown selection
|
|
12485
|
-
*/
|
|
13008
|
+
*/
|
|
13009
|
+
const Select = React.memo((({options: options, value: value, onChange: onChange, onBlur: onBlur, onFocus: onFocus, placeholder: placeholder = "Select an option", className: className = "", style: style, disabled: disabled = !1, required: required = !1, id: id, name: name, size: size = "md", invalid: invalid = !1, valid: valid = !1, multiple: multiple = !1, "aria-label": ariaLabel, "aria-describedby": ariaDescribedBy, glass: glass, children: children}) => {
|
|
12486
13010
|
const {generateSelectClass: generateSelectClass} = useSelect({
|
|
12487
13011
|
size: size,
|
|
12488
13012
|
disabled: disabled,
|
|
@@ -12491,115 +13015,132 @@ var composablesImport = Object.freeze({
|
|
|
12491
13015
|
}), selectClass = generateSelectClass({
|
|
12492
13016
|
className: `${className} ${glass ? "c-select--glass" : ""}`.trim(),
|
|
12493
13017
|
size: size,
|
|
12494
|
-
disabled: disabled,
|
|
12495
|
-
invalid: invalid,
|
|
12496
|
-
valid: valid
|
|
12497
|
-
}), [isOpen, setIsOpen] = React.useState(!1), [selectedLabel, setSelectedLabel] = React.useState(placeholder), dropdownRef = React.useRef(null), panelRef = React.useRef(null), bodyRef = React.useRef(null), nativeSelectRef = React.useRef(null)
|
|
12498
|
-
|
|
12499
|
-
React.
|
|
12500
|
-
|
|
12501
|
-
|
|
12502
|
-
|
|
12503
|
-
|
|
12504
|
-
|
|
12505
|
-
|
|
12506
|
-
|
|
12507
|
-
|
|
12508
|
-
|
|
12509
|
-
|
|
12510
|
-
|
|
12511
|
-
|
|
12512
|
-
|
|
12513
|
-
|
|
12514
|
-
|
|
12515
|
-
|
|
12516
|
-
|
|
12517
|
-
|
|
12518
|
-
|
|
12519
|
-
|
|
12520
|
-
|
|
12521
|
-
|
|
12522
|
-
|
|
12523
|
-
|
|
12524
|
-
|
|
12525
|
-
|
|
12526
|
-
|
|
12527
|
-
|
|
12528
|
-
|
|
12529
|
-
|
|
12530
|
-
|
|
12531
|
-
|
|
12532
|
-
|
|
12533
|
-
|
|
12534
|
-
|
|
12535
|
-
|
|
12536
|
-
|
|
12537
|
-
|
|
12538
|
-
|
|
12539
|
-
|
|
12540
|
-
|
|
12541
|
-
|
|
12542
|
-
|
|
12543
|
-
|
|
12544
|
-
|
|
12545
|
-
|
|
12546
|
-
|
|
12547
|
-
|
|
12548
|
-
|
|
12549
|
-
|
|
12550
|
-
|
|
12551
|
-
|
|
12552
|
-
|
|
12553
|
-
|
|
12554
|
-
|
|
12555
|
-
|
|
12556
|
-
|
|
12557
|
-
|
|
12558
|
-
|
|
12559
|
-
|
|
12560
|
-
|
|
12561
|
-
|
|
12562
|
-
|
|
12563
|
-
|
|
12564
|
-
|
|
12565
|
-
|
|
12566
|
-
children: jsxRuntime.jsx("
|
|
12567
|
-
|
|
12568
|
-
|
|
12569
|
-
|
|
12570
|
-
|
|
12571
|
-
|
|
12572
|
-
|
|
12573
|
-
|
|
12574
|
-
|
|
12575
|
-
|
|
12576
|
-
|
|
12577
|
-
|
|
12578
|
-
|
|
12579
|
-
|
|
12580
|
-
|
|
12581
|
-
|
|
12582
|
-
|
|
12583
|
-
|
|
12584
|
-
|
|
12585
|
-
|
|
12586
|
-
|
|
12587
|
-
|
|
12588
|
-
|
|
12589
|
-
|
|
12590
|
-
|
|
12591
|
-
|
|
12592
|
-
|
|
12593
|
-
|
|
12594
|
-
|
|
12595
|
-
|
|
12596
|
-
|
|
12597
|
-
|
|
12598
|
-
|
|
12599
|
-
|
|
13018
|
+
disabled: disabled,
|
|
13019
|
+
invalid: invalid,
|
|
13020
|
+
valid: valid
|
|
13021
|
+
}), [isOpen, setIsOpen] = React.useState(!1), [selectedLabel, setSelectedLabel] = React.useState(placeholder), dropdownRef = React.useRef(null), panelRef = React.useRef(null), bodyRef = React.useRef(null), nativeSelectRef = React.useRef(null), [registeredOptions, setRegisteredOptions] = React.useState([]), registerOption = React.useCallback((option => {
|
|
13022
|
+
setRegisteredOptions((prev => prev.some((o => o.value === option.value)) ? prev : [ ...prev, option ]));
|
|
13023
|
+
}), []), unregisterOption = React.useCallback((value => {
|
|
13024
|
+
setRegisteredOptions((prev => prev.filter((o => o.value !== value))));
|
|
13025
|
+
}), []), hasOptionsProp = options && options.length > 0, activeOptions = hasOptionsProp ? options : registeredOptions;
|
|
13026
|
+
// Update selected label when value changes
|
|
13027
|
+
React.useEffect((() => {
|
|
13028
|
+
if (value) {
|
|
13029
|
+
const selectedOption = activeOptions.find((opt => opt.value === value));
|
|
13030
|
+
selectedOption && setSelectedLabel(selectedOption.label);
|
|
13031
|
+
} else setSelectedLabel(placeholder);
|
|
13032
|
+
}), [ value, activeOptions, placeholder ]),
|
|
13033
|
+
// Handle click outside to close dropdown
|
|
13034
|
+
React.useEffect((() => {
|
|
13035
|
+
const handleClickOutside = event => {
|
|
13036
|
+
dropdownRef.current && !dropdownRef.current.contains(event.target) && (setIsOpen(!1),
|
|
13037
|
+
bodyRef.current && (bodyRef.current.style.height = "0px"));
|
|
13038
|
+
};
|
|
13039
|
+
return document.addEventListener("mousedown", handleClickOutside), () => {
|
|
13040
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
13041
|
+
};
|
|
13042
|
+
}), []);
|
|
13043
|
+
// Toggle dropdown
|
|
13044
|
+
const handleItemClick = React.useCallback((option => {
|
|
13045
|
+
if (setSelectedLabel(option.label), setIsOpen(!1), bodyRef.current && (bodyRef.current.style.height = "0px"),
|
|
13046
|
+
nativeSelectRef.current && (nativeSelectRef.current.value = option.value), onChange) {
|
|
13047
|
+
// Create a synthetic event
|
|
13048
|
+
const event = {
|
|
13049
|
+
target: {
|
|
13050
|
+
name: name,
|
|
13051
|
+
value: option.value
|
|
13052
|
+
}
|
|
13053
|
+
};
|
|
13054
|
+
onChange(event);
|
|
13055
|
+
}
|
|
13056
|
+
}), [ onChange, name ]), onSelect = React.useCallback(((val, label) => {
|
|
13057
|
+
handleItemClick({
|
|
13058
|
+
value: val,
|
|
13059
|
+
label: label
|
|
13060
|
+
});
|
|
13061
|
+
}), [ handleItemClick ]), contextValue = React__default.default.useMemo((() => ({
|
|
13062
|
+
registerOption: registerOption,
|
|
13063
|
+
unregisterOption: unregisterOption,
|
|
13064
|
+
selectedValue: value,
|
|
13065
|
+
onSelect: onSelect
|
|
13066
|
+
})), [ registerOption, unregisterOption, value, onSelect ]), selectContent = jsxRuntime.jsx(SelectContext.Provider, {
|
|
13067
|
+
value: contextValue,
|
|
13068
|
+
children: jsxRuntime.jsxs("div", {
|
|
13069
|
+
className: `${selectClass} ${isOpen ? SELECT.CLASSES.IS_OPEN : ""}`,
|
|
13070
|
+
ref: dropdownRef,
|
|
13071
|
+
style: style,
|
|
13072
|
+
"aria-expanded": isOpen,
|
|
13073
|
+
children: [ jsxRuntime.jsxs("select", {
|
|
13074
|
+
ref: nativeSelectRef,
|
|
13075
|
+
value: value,
|
|
13076
|
+
onChange: onChange,
|
|
13077
|
+
onBlur: onBlur,
|
|
13078
|
+
onFocus: onFocus,
|
|
13079
|
+
disabled: disabled,
|
|
13080
|
+
required: required,
|
|
13081
|
+
id: id,
|
|
13082
|
+
name: name,
|
|
13083
|
+
multiple: multiple,
|
|
13084
|
+
"aria-label": ariaLabel,
|
|
13085
|
+
"aria-describedby": ariaDescribedBy,
|
|
13086
|
+
"aria-invalid": invalid,
|
|
13087
|
+
style: {
|
|
13088
|
+
display: "none"
|
|
13089
|
+
},
|
|
13090
|
+
children: [ placeholder && jsxRuntime.jsx("option", {
|
|
13091
|
+
value: "",
|
|
13092
|
+
disabled: !0,
|
|
13093
|
+
children: placeholder
|
|
13094
|
+
}), activeOptions.map((option => jsxRuntime.jsx("option", {
|
|
13095
|
+
value: option.value,
|
|
13096
|
+
disabled: option.disabled,
|
|
13097
|
+
children: option.label
|
|
13098
|
+
}, option.value))) ]
|
|
13099
|
+
}), jsxRuntime.jsx("div", {
|
|
13100
|
+
className: SELECT.CLASSES.SELECTED,
|
|
13101
|
+
onClick: () => {
|
|
13102
|
+
disabled || (!isOpen && bodyRef.current && panelRef.current ? bodyRef.current.style.height = `${panelRef.current.clientHeight}px` : bodyRef.current && (bodyRef.current.style.height = "0px"),
|
|
13103
|
+
setIsOpen(!isOpen));
|
|
13104
|
+
},
|
|
13105
|
+
"aria-disabled": disabled,
|
|
13106
|
+
children: selectedLabel
|
|
13107
|
+
}), jsxRuntime.jsx("i", {
|
|
13108
|
+
className: `${SELECT.CLASSES.ICON_CARET} ${SELECT.CLASSES.TOGGLE_ICON}`
|
|
13109
|
+
}), jsxRuntime.jsx("div", {
|
|
13110
|
+
className: SELECT.CLASSES.SELECT_BODY,
|
|
13111
|
+
ref: bodyRef,
|
|
13112
|
+
style: {
|
|
13113
|
+
height: 0
|
|
13114
|
+
},
|
|
13115
|
+
children: jsxRuntime.jsx("div", {
|
|
13116
|
+
className: SELECT.CLASSES.SELECT_PANEL,
|
|
13117
|
+
ref: panelRef,
|
|
13118
|
+
children: jsxRuntime.jsx("ul", {
|
|
13119
|
+
className: SELECT.CLASSES.SELECT_ITEMS,
|
|
13120
|
+
children: hasOptionsProp ? options.map(((option, index) => jsxRuntime.jsx("li", {
|
|
13121
|
+
className: SELECT.CLASSES.SELECT_ITEM,
|
|
13122
|
+
"data-value": option.value,
|
|
13123
|
+
onClick: () => !option.disabled && handleItemClick(option),
|
|
13124
|
+
children: jsxRuntime.jsxs("label", {
|
|
13125
|
+
htmlFor: `SelectItem${index}`,
|
|
13126
|
+
className: "c-checkbox",
|
|
13127
|
+
children: [ jsxRuntime.jsx("input", {
|
|
13128
|
+
type: "checkbox",
|
|
13129
|
+
id: `SelectItem${index}`,
|
|
13130
|
+
className: "c-checkbox__input c-select__item-input",
|
|
13131
|
+
checked: value === option.value,
|
|
13132
|
+
readOnly: !0,
|
|
13133
|
+
disabled: option.disabled
|
|
13134
|
+
}), jsxRuntime.jsx("div", {
|
|
13135
|
+
className: "c-select__item-label",
|
|
13136
|
+
children: option.label
|
|
13137
|
+
}) ]
|
|
13138
|
+
})
|
|
13139
|
+
}, option.value))) : children
|
|
13140
|
+
})
|
|
12600
13141
|
})
|
|
12601
|
-
})
|
|
12602
|
-
})
|
|
13142
|
+
}) ]
|
|
13143
|
+
})
|
|
12603
13144
|
});
|
|
12604
13145
|
// Handle item selection
|
|
12605
13146
|
if (glass) {
|
|
@@ -12609,7 +13150,7 @@ var composablesImport = Object.freeze({
|
|
|
12609
13150
|
blurAmount: 1,
|
|
12610
13151
|
saturation: 180,
|
|
12611
13152
|
aberrationIntensity: .2,
|
|
12612
|
-
|
|
13153
|
+
borderRadius: 12,
|
|
12613
13154
|
mode: "shader"
|
|
12614
13155
|
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
12615
13156
|
...defaultGlassProps,
|
|
@@ -12623,7 +13164,7 @@ var composablesImport = Object.freeze({
|
|
|
12623
13164
|
return selectContent;
|
|
12624
13165
|
}));
|
|
12625
13166
|
|
|
12626
|
-
Select.displayName = "Select";
|
|
13167
|
+
Select.displayName = "Select", Select.Option = SelectOption;
|
|
12627
13168
|
|
|
12628
13169
|
/**
|
|
12629
13170
|
* Radio - A component for radio button inputs
|
|
@@ -12667,7 +13208,7 @@ const Radio = React.memo((({label: label, checked: checked = !1, onChange: onCh
|
|
|
12667
13208
|
blurAmount: 1,
|
|
12668
13209
|
saturation: 160,
|
|
12669
13210
|
aberrationIntensity: .3,
|
|
12670
|
-
|
|
13211
|
+
borderRadius: 6,
|
|
12671
13212
|
mode: "shader"
|
|
12672
13213
|
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
12673
13214
|
...defaultGlassProps,
|
|
@@ -12733,7 +13274,7 @@ const Textarea = React.memo( React.forwardRef((({value: value, defaultValue: de
|
|
|
12733
13274
|
blurAmount: 1,
|
|
12734
13275
|
saturation: 180,
|
|
12735
13276
|
aberrationIntensity: 1,
|
|
12736
|
-
|
|
13277
|
+
borderRadius: 8,
|
|
12737
13278
|
mode: "shader"
|
|
12738
13279
|
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
12739
13280
|
...defaultGlassProps,
|
|
@@ -13501,7 +14042,7 @@ const Hero = ({title: title, subtitle: subtitle, text: text, imageSrc: imageSrc,
|
|
|
13501
14042
|
autoplay: !0,
|
|
13502
14043
|
loop: !0,
|
|
13503
14044
|
muted: !0
|
|
13504
|
-
}, backgroundSlider: backgroundSlider, headingLevel: headingLevel = "h1", reverseOnMobile: reverseOnMobile = !1, parts: parts, ...rest}) => {
|
|
14045
|
+
}, backgroundSlider: backgroundSlider, headingLevel: headingLevel = "h1", reverseOnMobile: reverseOnMobile = !1, parts: parts, backgroundElement: backgroundElement, ...rest}) => {
|
|
13505
14046
|
// Define dynamic heading tag
|
|
13506
14047
|
const HeadingTag = headingLevel, {generateHeroClassNames: generateHeroClassNames, generateImageColClass: generateImageColClass, generateContentColClass: generateContentColClass, hasBackgroundImage: hasBackgroundImage, hasForegroundImage: hasForegroundImage, useGridLayout: useGridLayout, heroRef: heroRef, videoRef: videoRef, backgroundSlider: sliderHook, hasBackgroundSlider: hasBackgroundSlider} = useHero({
|
|
13507
14048
|
title: title,
|
|
@@ -13574,7 +14115,7 @@ const Hero = ({title: title, subtitle: subtitle, text: text, imageSrc: imageSrc,
|
|
|
13574
14115
|
blurAmount: 3,
|
|
13575
14116
|
saturation: 180,
|
|
13576
14117
|
aberrationIntensity: 0,
|
|
13577
|
-
|
|
14118
|
+
borderRadius: 8,
|
|
13578
14119
|
overLight: !1,
|
|
13579
14120
|
mode: "standard",
|
|
13580
14121
|
children: jsxRuntime.jsxs("div", {
|
|
@@ -13660,7 +14201,7 @@ const Hero = ({title: title, subtitle: subtitle, text: text, imageSrc: imageSrc,
|
|
|
13660
14201
|
"data-parallax": parallax ? "true" : void 0,
|
|
13661
14202
|
"data-parallax-intensity": parallax ? parallaxIntensity : void 0,
|
|
13662
14203
|
...rest,
|
|
13663
|
-
children: [ (() => {
|
|
14204
|
+
children: [ backgroundElement, (() => {
|
|
13664
14205
|
// Render background slider if configured
|
|
13665
14206
|
if (hasBackgroundSlider && backgroundSlider && sliderHook) {
|
|
13666
14207
|
const {slides: slides, transition: transition = "fade", transitionDuration: transitionDuration = 1e3} = backgroundSlider, {currentIndex: currentIndex, slideRefs: slideRefs, videoRefs: videoRefs} = sliderHook;
|
|
@@ -13755,7 +14296,84 @@ const Hero = ({title: title, subtitle: subtitle, text: text, imageSrc: imageSrc,
|
|
|
13755
14296
|
});
|
|
13756
14297
|
};
|
|
13757
14298
|
|
|
13758
|
-
Hero.
|
|
14299
|
+
Hero.Title = ({children: children, className: className, level: level = "h1", ...props}) => {
|
|
14300
|
+
const Tag = level;
|
|
14301
|
+
return jsxRuntime.jsx(Tag, {
|
|
14302
|
+
className: `${HERO.SELECTORS.TITLE.replace(".", "")} ${className || ""}`.trim(),
|
|
14303
|
+
...props,
|
|
14304
|
+
children: children
|
|
14305
|
+
});
|
|
14306
|
+
}, Hero.Subtitle = ({children: children, className: className, ...props}) => jsxRuntime.jsx("p", {
|
|
14307
|
+
className: `${HERO.SELECTORS.SUBTITLE.replace(".", "")} ${className || ""}`.trim(),
|
|
14308
|
+
...props,
|
|
14309
|
+
children: children
|
|
14310
|
+
}), Hero.Text = ({children: children, className: className, ...props}) => jsxRuntime.jsx("p", {
|
|
14311
|
+
className: `${HERO.SELECTORS.TEXT.replace(".", "")} ${className || ""}`.trim(),
|
|
14312
|
+
...props,
|
|
14313
|
+
children: children
|
|
14314
|
+
}), Hero.Actions = ({children: children, className: className, ...props}) => jsxRuntime.jsx("div", {
|
|
14315
|
+
className: `${HERO.SELECTORS.ACTIONS.replace(".", "")} ${className || ""}`.trim(),
|
|
14316
|
+
...props,
|
|
14317
|
+
children: children
|
|
14318
|
+
}), Hero.Content = ({children: children, className: className, style: style, glass: glass, ...props}) => {
|
|
14319
|
+
const contentClass = `${HERO.SELECTORS.CONTENT.replace(".", "")} ${className || ""}`.trim();
|
|
14320
|
+
if (glass) {
|
|
14321
|
+
const glassProps = "boolean" == typeof glass ? {
|
|
14322
|
+
displacementScale: 60,
|
|
14323
|
+
blurAmount: 3,
|
|
14324
|
+
saturation: 180,
|
|
14325
|
+
aberrationIntensity: 0,
|
|
14326
|
+
borderRadius: 8,
|
|
14327
|
+
overLight: !1,
|
|
14328
|
+
mode: "standard"
|
|
14329
|
+
} : glass;
|
|
14330
|
+
return jsxRuntime.jsx("div", {
|
|
14331
|
+
className: contentClass,
|
|
14332
|
+
style: style,
|
|
14333
|
+
...props,
|
|
14334
|
+
children: jsxRuntime.jsx(AtomixGlass, {
|
|
14335
|
+
...glassProps,
|
|
14336
|
+
children: jsxRuntime.jsx("div", {
|
|
14337
|
+
className: "u-p-4",
|
|
14338
|
+
children: children
|
|
14339
|
+
})
|
|
14340
|
+
})
|
|
14341
|
+
});
|
|
14342
|
+
}
|
|
14343
|
+
return jsxRuntime.jsx("div", {
|
|
14344
|
+
className: contentClass,
|
|
14345
|
+
style: style,
|
|
14346
|
+
...props,
|
|
14347
|
+
children: children
|
|
14348
|
+
});
|
|
14349
|
+
}, Hero.Image = ({src: src, alt: alt = "", className: className, wrapperClassName: wrapperClassName, wrapperStyle: wrapperStyle, ...props}) => jsxRuntime.jsx("div", {
|
|
14350
|
+
className: `${HERO.SELECTORS.IMAGE_WRAPPER.replace(".", "")} ${wrapperClassName || ""}`.trim(),
|
|
14351
|
+
style: wrapperStyle,
|
|
14352
|
+
children: jsxRuntime.jsx("img", {
|
|
14353
|
+
src: src,
|
|
14354
|
+
alt: alt,
|
|
14355
|
+
className: `${HERO.SELECTORS.IMAGE.replace(".", "")} ${className || ""}`.trim(),
|
|
14356
|
+
...props
|
|
14357
|
+
})
|
|
14358
|
+
}), Hero.Background = ({className: className, style: style, src: src, children: children, ...props}) => jsxRuntime.jsxs("div", {
|
|
14359
|
+
className: `${HERO.SELECTORS.BG.replace(".", "")} ${className || ""}`.trim(),
|
|
14360
|
+
style: style,
|
|
14361
|
+
...props,
|
|
14362
|
+
children: [ src && jsxRuntime.jsx("img", {
|
|
14363
|
+
src: src,
|
|
14364
|
+
alt: "Background",
|
|
14365
|
+
className: HERO.SELECTORS.BG_IMAGE.replace(".", "")
|
|
14366
|
+
}), children ]
|
|
14367
|
+
}), Hero.displayName = "Hero";
|
|
14368
|
+
|
|
14369
|
+
const ListItem = React.forwardRef((({children: children, className: className = "", ...props}, ref) => jsxRuntime.jsx("li", {
|
|
14370
|
+
ref: ref,
|
|
14371
|
+
className: `${LIST.ITEM_CLASS} ${className}`.trim(),
|
|
14372
|
+
...props,
|
|
14373
|
+
children: children
|
|
14374
|
+
})));
|
|
14375
|
+
|
|
14376
|
+
ListItem.displayName = "ListItem";
|
|
13759
14377
|
|
|
13760
14378
|
const List = React.memo((({children: children, variant: variant = "default", className: className = "", style: style, ...props}) => {
|
|
13761
14379
|
var _context;
|
|
@@ -13766,14 +14384,14 @@ const List = React.memo((({children: children, variant: variant = "default", cl
|
|
|
13766
14384
|
className: listClasses,
|
|
13767
14385
|
style: style,
|
|
13768
14386
|
...props,
|
|
13769
|
-
children: React__default.default.Children.map(children, (child => jsxRuntime.jsx("li", {
|
|
14387
|
+
children: React__default.default.Children.map(children, (child => React__default.default.isValidElement(child) && child.type === ListItem ? child : jsxRuntime.jsx("li", {
|
|
13770
14388
|
className: "c-list__item",
|
|
13771
14389
|
children: child
|
|
13772
14390
|
})))
|
|
13773
14391
|
});
|
|
13774
14392
|
}));
|
|
13775
14393
|
|
|
13776
|
-
List.displayName = "List";
|
|
14394
|
+
List.displayName = "List", List.Item = ListItem;
|
|
13777
14395
|
|
|
13778
14396
|
const ListGroup = ({children: children, className: className = "", style: style, variant: variant = "default"}) => {
|
|
13779
14397
|
// Generate CSS classes
|
|
@@ -13819,7 +14437,7 @@ const Messages = ({messages: messages = [], otherAvatar: otherAvatar, selfAvatar
|
|
|
13819
14437
|
onSendMessage: onSendMessage
|
|
13820
14438
|
}), messagesId = id || `messages-${Math.random().toString(36).substr(2, 9)}`, inputId = `${messagesId}-input`, defaultGlassProps = {
|
|
13821
14439
|
displacementScale: 150,
|
|
13822
|
-
|
|
14440
|
+
borderRadius: 12,
|
|
13823
14441
|
elasticity: 0,
|
|
13824
14442
|
aberrationIntensity: 2
|
|
13825
14443
|
}, messagesClasses = `${MESSAGES.CLASSES.BASE} ${glass ? "c-messages--glass" : ""} ${disabled ? "is-disabled" : ""} ${className}`, messagesContent = jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
@@ -13965,7 +14583,7 @@ const Messages = ({messages: messages = [], otherAvatar: otherAvatar, selfAvatar
|
|
|
13965
14583
|
children: jsxRuntime.jsx("div", {
|
|
13966
14584
|
className: "c-messages__glass-content",
|
|
13967
14585
|
style: {
|
|
13968
|
-
borderRadius: glassProps.
|
|
14586
|
+
borderRadius: glassProps.borderRadius
|
|
13969
14587
|
},
|
|
13970
14588
|
children: messagesContent
|
|
13971
14589
|
})
|
|
@@ -13990,10 +14608,59 @@ const Messages = ({messages: messages = [], otherAvatar: otherAvatar, selfAvatar
|
|
|
13990
14608
|
* Messages component for displaying a chat interface with messages, images, and file attachments
|
|
13991
14609
|
*/ Messages.displayName = "Messages";
|
|
13992
14610
|
|
|
13993
|
-
|
|
13994
|
-
|
|
13995
|
-
|
|
13996
|
-
|
|
14611
|
+
const ModalHeader = React.forwardRef((({title: title, subtitle: subtitle, closeButton: closeButton, onClose: onClose, children: children, className: className = "", ...props}, ref) => jsxRuntime.jsxs("div", {
|
|
14612
|
+
ref: ref,
|
|
14613
|
+
className: `c-modal__header ${className}`.trim(),
|
|
14614
|
+
...props,
|
|
14615
|
+
children: [ jsxRuntime.jsxs("div", {
|
|
14616
|
+
className: "c-modal__header-content",
|
|
14617
|
+
children: [ title && jsxRuntime.jsx("h3", {
|
|
14618
|
+
className: "c-modal__title",
|
|
14619
|
+
children: title
|
|
14620
|
+
}), subtitle && jsxRuntime.jsx("p", {
|
|
14621
|
+
className: "c-modal__sub",
|
|
14622
|
+
children: subtitle
|
|
14623
|
+
}), children ]
|
|
14624
|
+
}), closeButton && jsxRuntime.jsx("button", {
|
|
14625
|
+
type: "button",
|
|
14626
|
+
className: "c-modal__close c-btn js-modal-close",
|
|
14627
|
+
onClick: onClose,
|
|
14628
|
+
"aria-label": "Close modal",
|
|
14629
|
+
children: jsxRuntime.jsx("svg", {
|
|
14630
|
+
width: "20",
|
|
14631
|
+
height: "20",
|
|
14632
|
+
viewBox: "0 0 20 20",
|
|
14633
|
+
fill: "none",
|
|
14634
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14635
|
+
children: jsxRuntime.jsx("path", {
|
|
14636
|
+
d: "M16.0672 15.1828C16.1253 15.2409 16.1713 15.3098 16.2028 15.3857C16.2342 15.4615 16.2504 15.5429 16.2504 15.625C16.2504 15.7071 16.2342 15.7884 16.2028 15.8643C16.1713 15.9402 16.1253 16.0091 16.0672 16.0672C16.0091 16.1252 15.9402 16.1713 15.8643 16.2027C15.7885 16.2342 15.7071 16.2503 15.625 16.2503C15.5429 16.2503 15.4616 16.2342 15.3857 16.2027C15.3098 16.1713 15.2409 16.1252 15.1828 16.0672L10 10.8836L4.8172 16.0672C4.69992 16.1844 4.54086 16.2503 4.37501 16.2503C4.20916 16.2503 4.0501 16.1844 3.93282 16.0672C3.81555 15.9499 3.74966 15.7908 3.74966 15.625C3.74966 15.4591 3.81555 15.3001 3.93282 15.1828L9.11642 9.99998L3.93282 4.81717C3.81555 4.69989 3.74966 4.54083 3.74966 4.37498C3.74966 4.20913 3.81555 4.05007 3.93282 3.93279C4.0501 3.81552 4.20916 3.74963 4.37501 3.74963C4.54086 3.74963 4.69992 3.81552 4.8172 3.93279L10 9.11639L15.1828 3.93279C15.3001 3.81552 15.4592 3.74963 15.625 3.74963C15.7909 3.74963 15.9499 3.81552 16.0672 3.93279C16.1845 4.05007 16.2504 4.20913 16.2504 4.37498C16.2504 4.54083 16.1845 4.69989 16.0672 4.81717L10.8836 9.99998L16.0672 15.1828Z",
|
|
14637
|
+
fill: "#141414"
|
|
14638
|
+
})
|
|
14639
|
+
})
|
|
14640
|
+
}) ]
|
|
14641
|
+
})));
|
|
14642
|
+
|
|
14643
|
+
ModalHeader.displayName = "ModalHeader";
|
|
14644
|
+
|
|
14645
|
+
const ModalBody = React.forwardRef((({children: children, className: className = "", ...props}, ref) => jsxRuntime.jsx("div", {
|
|
14646
|
+
ref: ref,
|
|
14647
|
+
className: `c-modal__body ${className}`.trim(),
|
|
14648
|
+
...props,
|
|
14649
|
+
children: children
|
|
14650
|
+
})));
|
|
14651
|
+
|
|
14652
|
+
ModalBody.displayName = "ModalBody";
|
|
14653
|
+
|
|
14654
|
+
const ModalFooter = React.forwardRef((({children: children, className: className = "", ...props}, ref) => jsxRuntime.jsx("div", {
|
|
14655
|
+
ref: ref,
|
|
14656
|
+
className: `c-modal__footer ${className}`.trim(),
|
|
14657
|
+
...props,
|
|
14658
|
+
children: children
|
|
14659
|
+
})));
|
|
14660
|
+
|
|
14661
|
+
ModalFooter.displayName = "ModalFooter";
|
|
14662
|
+
|
|
14663
|
+
const ModalImpl = React.memo((({children: children, isOpen: isOpen = !1, onOpenChange: onOpenChange, onClose: onClose, onOpen: onOpen, title: title, subtitle: subtitle, size: size = "md", backdrop: backdrop = !0, keyboard: keyboard = !0, className: className = "", style: style, closeButton: closeButton = !0, footer: footer, glass: glass, ...props}) => {
|
|
13997
14664
|
const modalRef = React.useRef(null), dialogRef = React.useRef(null), backdropRef = React.useRef(null), {isOpen: isOpenState, open: open, close: close} =
|
|
13998
14665
|
/**
|
|
13999
14666
|
* Hook for managing modal state
|
|
@@ -14043,43 +14710,26 @@ const Modal = React.memo((({children: children, isOpen: isOpen = !1, onOpenChan
|
|
|
14043
14710
|
};
|
|
14044
14711
|
}), [ isOpenState, close, keyboard ]);
|
|
14045
14712
|
// Handle backdrop click
|
|
14046
|
-
const modalClasses = [ "c-modal", isOpenState ? MODAL.CLASSES.IS_OPEN : "", size ? `c-modal--${size}` : "", glass ? "c-modal--glass" : "", className ].filter(Boolean).join(" "),
|
|
14713
|
+
const modalClasses = [ "c-modal", isOpenState ? MODAL.CLASSES.IS_OPEN : "", size ? `c-modal--${size}` : "", glass ? "c-modal--glass" : "", className ].filter(Boolean).join(" "), hasCompoundComponents = React__default.default.Children.toArray(children).some((child => {
|
|
14714
|
+
var _context;
|
|
14715
|
+
|
|
14716
|
+
return React__default.default.isValidElement(child) && _includesInstanceProperty(_context = [ "ModalHeader", "ModalBody", "ModalFooter" ]).call(_context, child.type.displayName);
|
|
14717
|
+
})), modalContent = jsxRuntime.jsx("div", {
|
|
14047
14718
|
className: "c-modal__content",
|
|
14048
|
-
children:
|
|
14049
|
-
|
|
14050
|
-
|
|
14051
|
-
|
|
14052
|
-
|
|
14053
|
-
|
|
14054
|
-
|
|
14055
|
-
|
|
14056
|
-
|
|
14057
|
-
|
|
14058
|
-
|
|
14059
|
-
|
|
14060
|
-
type: "button",
|
|
14061
|
-
className: "c-modal__close c-btn js-modal-close",
|
|
14062
|
-
onClick: close,
|
|
14063
|
-
"aria-label": "Close modal",
|
|
14064
|
-
children: jsxRuntime.jsx("svg", {
|
|
14065
|
-
width: "20",
|
|
14066
|
-
height: "20",
|
|
14067
|
-
viewBox: "0 0 20 20",
|
|
14068
|
-
fill: "none",
|
|
14069
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
14070
|
-
children: jsxRuntime.jsx("path", {
|
|
14071
|
-
d: "M16.0672 15.1828C16.1253 15.2409 16.1713 15.3098 16.2028 15.3857C16.2342 15.4615 16.2504 15.5429 16.2504 15.625C16.2504 15.7071 16.2342 15.7884 16.2028 15.8643C16.1713 15.9402 16.1253 16.0091 16.0672 16.0672C16.0091 16.1252 15.9402 16.1713 15.8643 16.2027C15.7885 16.2342 15.7071 16.2503 15.625 16.2503C15.5429 16.2503 15.4616 16.2342 15.3857 16.2027C15.3098 16.1713 15.2409 16.1252 15.1828 16.0672L10 10.8836L4.8172 16.0672C4.69992 16.1844 4.54086 16.2503 4.37501 16.2503C4.20916 16.2503 4.0501 16.1844 3.93282 16.0672C3.81555 15.9499 3.74966 15.7908 3.74966 15.625C3.74966 15.4591 3.81555 15.3001 3.93282 15.1828L9.11642 9.99998L3.93282 4.81717C3.81555 4.69989 3.74966 4.54083 3.74966 4.37498C3.74966 4.20913 3.81555 4.05007 3.93282 3.93279C4.0501 3.81552 4.20916 3.74963 4.37501 3.74963C4.54086 3.74963 4.69992 3.81552 4.8172 3.93279L10 9.11639L15.1828 3.93279C15.3001 3.81552 15.4592 3.74963 15.625 3.74963C15.7909 3.74963 15.9499 3.81552 16.0672 3.93279C16.1845 4.05007 16.2504 4.20913 16.2504 4.37498C16.2504 4.54083 16.1845 4.69989 16.0672 4.81717L10.8836 9.99998L16.0672 15.1828Z",
|
|
14072
|
-
fill: "#141414"
|
|
14073
|
-
})
|
|
14074
|
-
})
|
|
14719
|
+
children: hasCompoundComponents ? React__default.default.Children.map(children, (child => React__default.default.isValidElement(child) && "ModalHeader" === child.type.displayName ? React__default.default.cloneElement(child, {
|
|
14720
|
+
onClose: child.props.onClose || close
|
|
14721
|
+
}) : child)) : jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
14722
|
+
children: [ (title || closeButton) && jsxRuntime.jsx(ModalHeader, {
|
|
14723
|
+
title: title,
|
|
14724
|
+
subtitle: subtitle,
|
|
14725
|
+
closeButton: closeButton,
|
|
14726
|
+
onClose: close
|
|
14727
|
+
}), jsxRuntime.jsx(ModalBody, {
|
|
14728
|
+
children: children
|
|
14729
|
+
}), footer && jsxRuntime.jsx(ModalFooter, {
|
|
14730
|
+
children: footer
|
|
14075
14731
|
}) ]
|
|
14076
|
-
})
|
|
14077
|
-
className: "c-modal__body",
|
|
14078
|
-
children: children
|
|
14079
|
-
}), footer && jsxRuntime.jsx("div", {
|
|
14080
|
-
className: "c-modal__footer",
|
|
14081
|
-
children: footer
|
|
14082
|
-
}) ]
|
|
14732
|
+
})
|
|
14083
14733
|
});
|
|
14084
14734
|
// Assemble classes
|
|
14085
14735
|
return jsxRuntime.jsxs("div", {
|
|
@@ -14124,24 +14774,15 @@ const Modal = React.memo((({children: children, isOpen: isOpen = !1, onOpenChan
|
|
|
14124
14774
|
});
|
|
14125
14775
|
}));
|
|
14126
14776
|
|
|
14127
|
-
|
|
14777
|
+
ModalImpl.displayName = "Modal";
|
|
14128
14778
|
|
|
14129
|
-
|
|
14130
|
-
|
|
14131
|
-
|
|
14132
|
-
|
|
14133
|
-
|
|
14134
|
-
|
|
14135
|
-
|
|
14136
|
-
* <NavItem href="/about">About</NavItem>
|
|
14137
|
-
* <NavDropdown title="Services">
|
|
14138
|
-
* <MenuItem href="/web">Web Design</MenuItem>
|
|
14139
|
-
* <MenuItem href="/mobile">Mobile Apps</MenuItem>
|
|
14140
|
-
* </NavDropdown>
|
|
14141
|
-
* </Nav>
|
|
14142
|
-
* ```
|
|
14143
|
-
*/
|
|
14144
|
-
const Nav = React.forwardRef((({children: children, alignment: alignment = "start", variant: variant = "default", className: className = "", disabled: disabled = !1, glass: glass}, ref) => {
|
|
14779
|
+
// Attach subcomponents
|
|
14780
|
+
const ModalWithSubcomponents = ModalImpl;
|
|
14781
|
+
|
|
14782
|
+
ModalWithSubcomponents.Header = ModalHeader, ModalWithSubcomponents.Body = ModalBody,
|
|
14783
|
+
ModalWithSubcomponents.Footer = ModalFooter;
|
|
14784
|
+
|
|
14785
|
+
const Modal = ModalWithSubcomponents, Nav = React.forwardRef((({children: children, alignment: alignment = "start", variant: variant = "default", className: className = "", disabled: disabled = !1, glass: glass}, ref) => {
|
|
14145
14786
|
const {generateNavClass: generateNavClass} = useNav({
|
|
14146
14787
|
alignment: alignment,
|
|
14147
14788
|
variant: variant
|
|
@@ -14170,7 +14811,7 @@ const Nav = React.forwardRef((({children: children, alignment: alignment = "sta
|
|
|
14170
14811
|
const defaultGlassProps = {
|
|
14171
14812
|
displacementScale: 60,
|
|
14172
14813
|
blurAmount: 1.5,
|
|
14173
|
-
|
|
14814
|
+
borderRadius: 8,
|
|
14174
14815
|
mode: "shader"
|
|
14175
14816
|
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
14176
14817
|
...defaultGlassProps,
|
|
@@ -14184,7 +14825,21 @@ const Nav = React.forwardRef((({children: children, alignment: alignment = "sta
|
|
|
14184
14825
|
return navContent;
|
|
14185
14826
|
}));
|
|
14186
14827
|
|
|
14187
|
-
|
|
14828
|
+
/**
|
|
14829
|
+
* Nav component provides a container for navigation items with proper alignment and accessibility.
|
|
14830
|
+
*
|
|
14831
|
+
* @example
|
|
14832
|
+
* ```tsx
|
|
14833
|
+
* <Nav alignment="center">
|
|
14834
|
+
* <NavItem href="/">Home</NavItem>
|
|
14835
|
+
* <NavItem href="/about">About</NavItem>
|
|
14836
|
+
* <NavDropdown title="Services">
|
|
14837
|
+
* <MenuItem href="/web">Web Design</MenuItem>
|
|
14838
|
+
* <MenuItem href="/mobile">Mobile Apps</MenuItem>
|
|
14839
|
+
* </NavDropdown>
|
|
14840
|
+
* </Nav>
|
|
14841
|
+
* ```
|
|
14842
|
+
*/ Nav.displayName = "Nav";
|
|
14188
14843
|
|
|
14189
14844
|
/**
|
|
14190
14845
|
* NavItem component represents a single navigation item that can be a link, dropdown trigger, or mega menu trigger.
|
|
@@ -14368,7 +15023,7 @@ const Navbar = React.forwardRef((({brand: brand, children: children, variant: v
|
|
|
14368
15023
|
const defaultGlassProps = {
|
|
14369
15024
|
displacementScale: 30,
|
|
14370
15025
|
blurAmount: 2,
|
|
14371
|
-
|
|
15026
|
+
borderRadius: 0,
|
|
14372
15027
|
elasticity: 0,
|
|
14373
15028
|
mode: "shader",
|
|
14374
15029
|
shaderVariant: "premiumGlass"
|
|
@@ -14749,7 +15404,7 @@ const SideMenu = React.forwardRef((({title: title, children: children, menuItem
|
|
|
14749
15404
|
const defaultGlassProps = {
|
|
14750
15405
|
displacementScale: 70,
|
|
14751
15406
|
blurAmount: 2,
|
|
14752
|
-
|
|
15407
|
+
borderRadius: 12,
|
|
14753
15408
|
mode: "shader"
|
|
14754
15409
|
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
14755
15410
|
...defaultGlassProps,
|
|
@@ -16328,7 +16983,7 @@ const PopoverContext = React.createContext({
|
|
|
16328
16983
|
blurAmount: 1,
|
|
16329
16984
|
saturation: 160,
|
|
16330
16985
|
aberrationIntensity: .5,
|
|
16331
|
-
|
|
16986
|
+
borderRadius: 8,
|
|
16332
16987
|
mode: "shader"
|
|
16333
16988
|
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
16334
16989
|
...defaultGlassProps,
|
|
@@ -16379,7 +17034,14 @@ const PopoverContext = React.createContext({
|
|
|
16379
17034
|
/**
|
|
16380
17035
|
* Hook for managing rating component state and interactions
|
|
16381
17036
|
*/
|
|
16382
|
-
const
|
|
17037
|
+
const calculateStarValue = (e, starValue, allowHalf) => {
|
|
17038
|
+
if (!allowHalf) return starValue;
|
|
17039
|
+
// Get the star element's bounding rectangle
|
|
17040
|
+
const starRect = e.currentTarget.getBoundingClientRect(), starCenterX = starRect.left + starRect.width / 2, adjustedValue = e.clientX < starCenterX ? starValue - .5 : starValue;
|
|
17041
|
+
// Calculate the x position within the star
|
|
17042
|
+
return Math.max(.5, adjustedValue);
|
|
17043
|
+
// Ensure minimum of 0.5
|
|
17044
|
+
}, Rating = React.forwardRef((({value: valueProp = 0, defaultValue: defaultValue, maxValue: maxValue = 5, allowHalf: allowHalf = !1, readOnly: readOnly = !1, size: size = "md", variant: variant, onChange: onChange, className: className = "", style: style, label: label, id: id, useVanillaJS: useVanillaJS = !1, glass: glass, ...restProps}, ref) => {
|
|
16383
17045
|
const internalRef = React.useRef(null), ratingInstance = React.useRef(null), {currentValue: currentValue, hoverValue: hoverValue, focusedIndex: focusedIndex, setHoverValue: setHoverValue, setFocused: setFocused, handleKeyDown: handleKeyDown} = (({value: value = 0, maxValue: maxValue = 5, allowHalf: allowHalf = !1, readOnly: readOnly = !1, onChange: onChange}) => {
|
|
16384
17046
|
// Determine if component is in controlled mode
|
|
16385
17047
|
const isControlled = void 0 !== onChange, [internalValue, setInternalValue] = React.useState(value), [hoverValue, setHoverValue] = React.useState(null), [focusedIndex, setFocusedIndex] = React.useState(null), currentValue = isControlled ? value : internalValue, handleMouseEnter = React.useCallback((starValue => {
|
|
@@ -16441,30 +17103,14 @@ const Rating = React.forwardRef((({value: valueProp = 0, defaultValue: defaultV
|
|
|
16441
17103
|
readOnly: readOnly,
|
|
16442
17104
|
onChange: onChange
|
|
16443
17105
|
}), forkedRef = useForkRef(internalRef, ref), handleMouseEnter = React.useCallback(((e, starValue) => {
|
|
16444
|
-
|
|
16445
|
-
// Get the star element's bounding rectangle
|
|
16446
|
-
const starRect = e.currentTarget.getBoundingClientRect(), starCenterX = starRect.left + starRect.width / 2, adjustedValue = e.clientX < starCenterX ? starValue - .5 : starValue;
|
|
16447
|
-
// Calculate the x position within the star
|
|
16448
|
-
setHoverValue(Math.max(.5, adjustedValue));
|
|
16449
|
-
} else setHoverValue(starValue);
|
|
17106
|
+
readOnly || setHoverValue(calculateStarValue(e, starValue, !!allowHalf));
|
|
16450
17107
|
}), [ readOnly, allowHalf, setHoverValue ]), handleMouseMove = React.useCallback(((e, starValue) => {
|
|
16451
|
-
|
|
16452
|
-
|
|
16453
|
-
const starRect = e.currentTarget.getBoundingClientRect(), starCenterX = starRect.left + starRect.width / 2, adjustedValue = e.clientX < starCenterX ? starValue - .5 : starValue;
|
|
16454
|
-
// Calculate the x position within the star
|
|
16455
|
-
setHoverValue(Math.max(.5, adjustedValue));
|
|
16456
|
-
} // Ensure minimum of 0.5
|
|
16457
|
-
), [ readOnly, allowHalf, setHoverValue ]), handleMouseLeave = React.useCallback((() => {
|
|
17108
|
+
!readOnly && allowHalf && setHoverValue(calculateStarValue(e, starValue, !!allowHalf));
|
|
17109
|
+
}), [ readOnly, allowHalf, setHoverValue ]), handleMouseLeave = React.useCallback((() => {
|
|
16458
17110
|
readOnly || setHoverValue(null);
|
|
16459
17111
|
}), [ readOnly, setHoverValue ]), handleClick = React.useCallback(((e, starValue) => {
|
|
16460
17112
|
if (readOnly) return;
|
|
16461
|
-
|
|
16462
|
-
if (allowHalf) {
|
|
16463
|
-
// Get the star element's bounding rectangle
|
|
16464
|
-
const starRect = e.currentTarget.getBoundingClientRect(), starCenterX = starRect.left + starRect.width / 2;
|
|
16465
|
-
// Calculate the x position within the star
|
|
16466
|
-
newValue = e.clientX < starCenterX ? starValue - .5 : starValue, newValue = Math.max(.5, newValue);
|
|
16467
|
-
}
|
|
17113
|
+
const newValue = calculateStarValue(e, starValue, !!allowHalf);
|
|
16468
17114
|
onChange?.(newValue);
|
|
16469
17115
|
}), [ readOnly, onChange, allowHalf ]);
|
|
16470
17116
|
// Use vanilla JS implementation if specified
|
|
@@ -16569,7 +17215,7 @@ const Rating = React.forwardRef((({value: valueProp = 0, defaultValue: defaultV
|
|
|
16569
17215
|
blurAmount: 1,
|
|
16570
17216
|
saturation: 160,
|
|
16571
17217
|
aberrationIntensity: .5,
|
|
16572
|
-
|
|
17218
|
+
borderRadius: 8,
|
|
16573
17219
|
mode: "shader"
|
|
16574
17220
|
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
16575
17221
|
...defaultGlassProps,
|
|
@@ -16583,21 +17229,8 @@ const Rating = React.forwardRef((({value: valueProp = 0, defaultValue: defaultV
|
|
|
16583
17229
|
return ratingContent;
|
|
16584
17230
|
}));
|
|
16585
17231
|
|
|
16586
|
-
|
|
16587
|
-
|
|
16588
|
-
*
|
|
16589
|
-
* @example
|
|
16590
|
-
* // Basic usage
|
|
16591
|
-
* <Rating value={3} onChange={handleRatingChange} />
|
|
16592
|
-
*
|
|
16593
|
-
* @example
|
|
16594
|
-
* // Read-only with custom variant
|
|
16595
|
-
* <Rating value={4.5} readOnly variant="warning" />
|
|
16596
|
-
*
|
|
16597
|
-
* @example
|
|
16598
|
-
* // With half-star support
|
|
16599
|
-
* <Rating value={3.5} allowHalf maxValue={5} />
|
|
16600
|
-
*/ Rating.displayName = "Rating";
|
|
17232
|
+
// Helper function to calculate star value based on mouse position
|
|
17233
|
+
Rating.displayName = "Rating";
|
|
16601
17234
|
|
|
16602
17235
|
/**
|
|
16603
17236
|
* ProductReview component for collecting user ratings and feedback
|
|
@@ -16742,7 +17375,7 @@ const Progress = React.memo( React.forwardRef((({value: value, variant: variant
|
|
|
16742
17375
|
const defaultGlassProps = {
|
|
16743
17376
|
displacementScale: 30,
|
|
16744
17377
|
blurAmount: .5,
|
|
16745
|
-
|
|
17378
|
+
borderRadius: 8,
|
|
16746
17379
|
mode: "shader"
|
|
16747
17380
|
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
16748
17381
|
...defaultGlassProps,
|
|
@@ -17072,39 +17705,72 @@ const Slider = React.forwardRef(((props, ref) => {
|
|
|
17072
17705
|
|
|
17073
17706
|
Slider.displayName = "Slider";
|
|
17074
17707
|
|
|
17708
|
+
const StepsItem = React.forwardRef((({children: children, className: className = "", number: number, title: title, active: active, completed: completed, index: index, ...props}, ref) => {
|
|
17709
|
+
const itemClasses = [ "c-steps__item", active ? STEPS.CLASSES.ACTIVE : "", completed ? STEPS.CLASSES.COMPLETED : "", className ].filter(Boolean).join(" ");
|
|
17710
|
+
return jsxRuntime.jsxs("div", {
|
|
17711
|
+
ref: ref,
|
|
17712
|
+
className: itemClasses,
|
|
17713
|
+
"aria-current": active ? "step" : void 0,
|
|
17714
|
+
"data-index": index,
|
|
17715
|
+
...props,
|
|
17716
|
+
children: [ jsxRuntime.jsx("div", {
|
|
17717
|
+
className: "c-steps__line"
|
|
17718
|
+
}), jsxRuntime.jsxs("div", {
|
|
17719
|
+
className: "c-steps__content",
|
|
17720
|
+
children: [ null != number && jsxRuntime.jsx("div", {
|
|
17721
|
+
className: "c-steps__number",
|
|
17722
|
+
children: number
|
|
17723
|
+
}), title && jsxRuntime.jsx("div", {
|
|
17724
|
+
className: "c-steps__text",
|
|
17725
|
+
children: title
|
|
17726
|
+
}), children && jsxRuntime.jsx("div", {
|
|
17727
|
+
className: "c-steps__custom-content",
|
|
17728
|
+
children: children
|
|
17729
|
+
}) ]
|
|
17730
|
+
}) ]
|
|
17731
|
+
});
|
|
17732
|
+
}));
|
|
17733
|
+
|
|
17734
|
+
StepsItem.displayName = "StepsItem";
|
|
17735
|
+
|
|
17075
17736
|
/**
|
|
17076
17737
|
* Steps component for displaying a sequence of steps
|
|
17077
17738
|
*/
|
|
17078
|
-
const Steps = ({items: items, activeIndex: activeIndex = 0, vertical: vertical = !1, onStepChange: onStepChange, className: className = "", style: style, glass: glass}) => {
|
|
17739
|
+
const Steps = ({items: items, activeIndex: activeIndex = 0, vertical: vertical = !1, onStepChange: onStepChange, className: className = "", style: style, glass: glass, children: children}) => {
|
|
17079
17740
|
const [currentStep, setCurrentStep] = React.useState(activeIndex);
|
|
17080
17741
|
// Update steps when activeIndex prop changes
|
|
17081
|
-
|
|
17742
|
+
let content;
|
|
17743
|
+
React.useEffect((() => {
|
|
17082
17744
|
currentStep !== activeIndex && setCurrentStep(activeIndex);
|
|
17083
|
-
}), [ activeIndex ])
|
|
17745
|
+
}), [ activeIndex ]),
|
|
17746
|
+
// Legacy rendering
|
|
17747
|
+
content = items && items.length > 0 ? items.map(((item, index) => jsxRuntime.jsx(StepsItem, {
|
|
17748
|
+
index: index,
|
|
17749
|
+
number: item.number,
|
|
17750
|
+
title: item.text,
|
|
17751
|
+
active: index <= currentStep,
|
|
17752
|
+
completed: index < currentStep,
|
|
17753
|
+
children: item.content
|
|
17754
|
+
}, `step-${index}`))) : React.Children.map(children, ((child, index) => {
|
|
17755
|
+
if ( React.isValidElement(child)) {
|
|
17756
|
+
const childProps = child.props, isActive = childProps.active ?? index <= currentStep, isCompleted = childProps.completed ?? index < currentStep, number = childProps.number ?? index + 1;
|
|
17757
|
+
// Inject active/completed based on index if not explicitly provided
|
|
17758
|
+
|
|
17759
|
+
return React.cloneElement(child, {
|
|
17760
|
+
index: index,
|
|
17761
|
+
active: isActive,
|
|
17762
|
+
completed: isCompleted,
|
|
17763
|
+
number: number
|
|
17764
|
+
});
|
|
17765
|
+
}
|
|
17766
|
+
return child;
|
|
17767
|
+
}));
|
|
17084
17768
|
const stepsContent = jsxRuntime.jsx("div", {
|
|
17085
17769
|
className: `c-steps ${vertical ? STEPS.CLASSES.VERTICAL : ""} ${className}`,
|
|
17086
17770
|
style: style,
|
|
17087
17771
|
role: "navigation",
|
|
17088
17772
|
"aria-label": "Steps",
|
|
17089
|
-
children:
|
|
17090
|
-
className: `c-steps__item ${index <= currentStep ? STEPS.CLASSES.ACTIVE : ""} ${index < currentStep ? STEPS.CLASSES.COMPLETED : ""}`,
|
|
17091
|
-
"aria-current": index === currentStep ? "step" : void 0,
|
|
17092
|
-
children: [ jsxRuntime.jsx("div", {
|
|
17093
|
-
className: "c-steps__line"
|
|
17094
|
-
}), jsxRuntime.jsxs("div", {
|
|
17095
|
-
className: "c-steps__content",
|
|
17096
|
-
children: [ jsxRuntime.jsx("div", {
|
|
17097
|
-
className: "c-steps__number",
|
|
17098
|
-
children: item.number
|
|
17099
|
-
}), jsxRuntime.jsx("div", {
|
|
17100
|
-
className: "c-steps__text",
|
|
17101
|
-
children: item.text
|
|
17102
|
-
}), item.content && jsxRuntime.jsx("div", {
|
|
17103
|
-
className: "c-steps__custom-content",
|
|
17104
|
-
children: item.content
|
|
17105
|
-
}) ]
|
|
17106
|
-
}) ]
|
|
17107
|
-
}, `step-${index}`)))
|
|
17773
|
+
children: content
|
|
17108
17774
|
});
|
|
17109
17775
|
if (glass) {
|
|
17110
17776
|
// Default glass settings for steps
|
|
@@ -17113,7 +17779,7 @@ const Steps = ({items: items, activeIndex: activeIndex = 0, vertical: vertical =
|
|
|
17113
17779
|
blurAmount: 1,
|
|
17114
17780
|
saturation: 160,
|
|
17115
17781
|
aberrationIntensity: .5,
|
|
17116
|
-
|
|
17782
|
+
borderRadius: 8,
|
|
17117
17783
|
mode: "shader"
|
|
17118
17784
|
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
17119
17785
|
...defaultGlassProps,
|
|
@@ -17127,24 +17793,104 @@ const Steps = ({items: items, activeIndex: activeIndex = 0, vertical: vertical =
|
|
|
17127
17793
|
return stepsContent;
|
|
17128
17794
|
};
|
|
17129
17795
|
|
|
17130
|
-
Steps.displayName = "Steps";
|
|
17796
|
+
Steps.displayName = "Steps", Steps.Item = StepsItem, Steps.Step = StepsItem;
|
|
17131
17797
|
|
|
17132
|
-
|
|
17133
|
-
|
|
17134
|
-
|
|
17135
|
-
|
|
17136
|
-
|
|
17137
|
-
|
|
17138
|
-
|
|
17798
|
+
// Context for compound usage
|
|
17799
|
+
const TabsContext = React.createContext({
|
|
17800
|
+
currentTab: 0,
|
|
17801
|
+
handleTabClick: () => {}
|
|
17802
|
+
}), TabsList = React.forwardRef((({children: children, className: className = "", ...props}, ref) => jsxRuntime.jsx("ul", {
|
|
17803
|
+
ref: ref,
|
|
17804
|
+
className: `c-tabs__nav ${className}`.trim(),
|
|
17805
|
+
...props,
|
|
17806
|
+
children: React__default.default.Children.map(children, ((child, index) => React__default.default.isValidElement(child) ? React__default.default.cloneElement(child, {
|
|
17807
|
+
index: index
|
|
17808
|
+
}) : child))
|
|
17809
|
+
})));
|
|
17810
|
+
|
|
17811
|
+
// Compound components
|
|
17812
|
+
TabsList.displayName = "TabsList";
|
|
17813
|
+
|
|
17814
|
+
const TabsTrigger = React.forwardRef((({children: children, className: className = "", index: index, onClick: onClick, ...props}, ref) => {
|
|
17815
|
+
const {currentTab: currentTab, handleTabClick: handleTabClick} = React.useContext(TabsContext);
|
|
17816
|
+
// Safety check if used outside context or without index
|
|
17817
|
+
void 0 === index && console.warn("TabsTrigger requires an index prop or must be a direct child of TabsList");
|
|
17818
|
+
const isActive = void 0 !== index && currentTab === index;
|
|
17819
|
+
return jsxRuntime.jsx("li", {
|
|
17820
|
+
className: "c-tabs__nav-item",
|
|
17821
|
+
children: jsxRuntime.jsx("button", {
|
|
17822
|
+
ref: ref,
|
|
17823
|
+
className: `c-tabs__nav-btn ${isActive ? TAB.CLASSES.ACTIVE : ""} ${className}`.trim(),
|
|
17824
|
+
onClick: e => {
|
|
17825
|
+
void 0 !== index && handleTabClick(index), onClick?.(e);
|
|
17826
|
+
},
|
|
17827
|
+
"data-tabindex": index,
|
|
17828
|
+
role: "tab",
|
|
17829
|
+
"aria-selected": isActive,
|
|
17830
|
+
"aria-controls": `tab-panel-${index}`,
|
|
17831
|
+
type: "button",
|
|
17832
|
+
...props,
|
|
17833
|
+
children: children
|
|
17834
|
+
})
|
|
17835
|
+
});
|
|
17836
|
+
}));
|
|
17837
|
+
|
|
17838
|
+
TabsTrigger.displayName = "TabsTrigger";
|
|
17839
|
+
|
|
17840
|
+
const TabsPanels = React.forwardRef((({children: children, className: className = "", ...props}, ref) => jsxRuntime.jsx("div", {
|
|
17841
|
+
ref: ref,
|
|
17842
|
+
className: `c-tabs__panels ${className}`.trim(),
|
|
17843
|
+
...props,
|
|
17844
|
+
children: React__default.default.Children.map(children, ((child, index) => React__default.default.isValidElement(child) ? React__default.default.cloneElement(child, {
|
|
17845
|
+
index: index
|
|
17846
|
+
}) : child))
|
|
17847
|
+
})));
|
|
17848
|
+
|
|
17849
|
+
TabsPanels.displayName = "TabsPanels";
|
|
17850
|
+
|
|
17851
|
+
const TabsPanel = React.forwardRef((({children: children, className: className = "", index: index, style: style, ...props}, ref) => {
|
|
17852
|
+
const {currentTab: currentTab} = React.useContext(TabsContext), isActive = void 0 !== index && currentTab === index;
|
|
17853
|
+
return jsxRuntime.jsx("div", {
|
|
17854
|
+
ref: ref,
|
|
17855
|
+
className: `c-tabs__panel ${isActive ? TAB.CLASSES.ACTIVE : ""} ${className}`.trim(),
|
|
17856
|
+
"data-tabindex": index,
|
|
17857
|
+
id: `tab-panel-${index}`,
|
|
17858
|
+
role: "tabpanel",
|
|
17859
|
+
"aria-labelledby": `tab-nav-${index}`,
|
|
17860
|
+
style: {
|
|
17861
|
+
height: isActive ? "auto" : "0px",
|
|
17862
|
+
opacity: isActive ? 1 : 0,
|
|
17863
|
+
overflow: "hidden",
|
|
17864
|
+
transition: "height 0.3s ease, opacity 0.3s ease",
|
|
17865
|
+
...style
|
|
17866
|
+
},
|
|
17867
|
+
...props,
|
|
17868
|
+
children: jsxRuntime.jsx("div", {
|
|
17869
|
+
className: "c-tabs__panel-body",
|
|
17870
|
+
children: children
|
|
17871
|
+
})
|
|
17872
|
+
});
|
|
17873
|
+
}));
|
|
17874
|
+
|
|
17875
|
+
TabsPanel.displayName = "TabsPanel";
|
|
17876
|
+
|
|
17877
|
+
const Tabs = React.memo((({items: items, activeIndex: activeIndex = TAB.DEFAULTS.ACTIVE_INDEX, onTabChange: onTabChange, className: className = "", style: style, glass: glass, children: children}) => {
|
|
17878
|
+
const [currentTab, setCurrentTab] = React.useState(activeIndex), handleTabClick = index => {
|
|
17879
|
+
setCurrentTab(index), onTabChange && onTabChange(index);
|
|
17880
|
+
};
|
|
17881
|
+
// Handle tab change
|
|
17882
|
+
// Determine content based on mode (legacy items vs compound children)
|
|
17883
|
+
let content;
|
|
17884
|
+
// Use items prop if provided
|
|
17885
|
+
// Legacy mode
|
|
17886
|
+
content = items && items.length > 0 ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
17139
17887
|
children: [ jsxRuntime.jsx("ul", {
|
|
17140
17888
|
className: "c-tabs__nav",
|
|
17141
17889
|
children: items.map(((item, index) => jsxRuntime.jsx("li", {
|
|
17142
17890
|
className: "c-tabs__nav-item",
|
|
17143
17891
|
children: jsxRuntime.jsx("button", {
|
|
17144
17892
|
className: `c-tabs__nav-btn ${index === currentTab ? TAB.CLASSES.ACTIVE : ""}`,
|
|
17145
|
-
onClick: () => (index
|
|
17146
|
-
setCurrentTab(index), onTabChange && onTabChange(index);
|
|
17147
|
-
})(index),
|
|
17893
|
+
onClick: () => handleTabClick(index),
|
|
17148
17894
|
"data-tabindex": index,
|
|
17149
17895
|
role: "tab",
|
|
17150
17896
|
"aria-selected": index === currentTab,
|
|
@@ -17172,16 +17918,26 @@ const Tabs = React.memo((({items: items, activeIndex: activeIndex = TAB.DEFAULT
|
|
|
17172
17918
|
})
|
|
17173
17919
|
}, `tab-panel-${index}`)))
|
|
17174
17920
|
}) ]
|
|
17921
|
+
}) : jsxRuntime.jsx(TabsContext.Provider, {
|
|
17922
|
+
value: {
|
|
17923
|
+
currentTab: currentTab,
|
|
17924
|
+
handleTabClick: handleTabClick
|
|
17925
|
+
},
|
|
17926
|
+
children: children
|
|
17175
17927
|
});
|
|
17176
|
-
|
|
17177
|
-
|
|
17928
|
+
const wrapper = jsxRuntime.jsx("div", {
|
|
17929
|
+
className: `c-tabs js-atomix-tab ${className}`,
|
|
17930
|
+
style: style,
|
|
17931
|
+
children: content
|
|
17932
|
+
});
|
|
17933
|
+
if (glass) {
|
|
17178
17934
|
// Default glass settings for tabs
|
|
17179
17935
|
const defaultGlassProps = {
|
|
17180
17936
|
displacementScale: 60,
|
|
17181
17937
|
blurAmount: 1,
|
|
17182
17938
|
saturation: 160,
|
|
17183
17939
|
aberrationIntensity: .5,
|
|
17184
|
-
|
|
17940
|
+
borderRadius: 8,
|
|
17185
17941
|
mode: "shader"
|
|
17186
17942
|
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
17187
17943
|
...defaultGlassProps,
|
|
@@ -17189,13 +17945,14 @@ const Tabs = React.memo((({items: items, activeIndex: activeIndex = TAB.DEFAULT
|
|
|
17189
17945
|
};
|
|
17190
17946
|
return jsxRuntime.jsx(AtomixGlass, {
|
|
17191
17947
|
...glassProps,
|
|
17192
|
-
children:
|
|
17948
|
+
children: wrapper
|
|
17193
17949
|
});
|
|
17194
17950
|
}
|
|
17195
|
-
return
|
|
17951
|
+
return wrapper;
|
|
17196
17952
|
}));
|
|
17197
17953
|
|
|
17198
|
-
Tabs.displayName = "Tabs"
|
|
17954
|
+
Tabs.displayName = "Tabs", Tabs.List = TabsList, Tabs.Trigger = TabsTrigger, Tabs.Panels = TabsPanels,
|
|
17955
|
+
Tabs.Panel = TabsPanel;
|
|
17199
17956
|
|
|
17200
17957
|
/**
|
|
17201
17958
|
* Testimonial component for displaying customer quotes and feedback
|
|
@@ -17423,7 +18180,7 @@ const Toggle = ({checked: controlledChecked, defaultChecked: defaultChecked = !1
|
|
|
17423
18180
|
blurAmount: 1,
|
|
17424
18181
|
saturation: 160,
|
|
17425
18182
|
aberrationIntensity: .5,
|
|
17426
|
-
|
|
18183
|
+
borderRadius: 8,
|
|
17427
18184
|
mode: "shader"
|
|
17428
18185
|
}, glassProps = !0 === glass ? defaultGlassProps : {
|
|
17429
18186
|
...defaultGlassProps,
|