@nation-a/ui 0.11.4 → 0.11.7
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/index.cjs +1274 -2101
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1266 -2093
- package/dist/index.js.map +1 -1
- package/dist/styled-system/styles.css +10 -46
- package/dist/types/components/Toast/index.d.ts +48 -26
- package/dist/types/components/Toast/toast.recipe.d.ts +1 -1
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/contexts/index.d.ts +1 -1
- package/dist/types/utils/index.d.ts +1 -1
- package/package.json +2 -1
- package/dist/types/contexts/ToastProvider.d.ts +0 -9
- package/dist/types/hooks/useBottomSheet.d.ts +0 -20
- package/dist/types/utils/toast.d.ts +0 -57
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import
|
|
3
|
+
import { forwardRef, useMemo, createElement, createContext as createContext$1, useContext, useRef, useLayoutEffect, useEffect, useState, memo as memo$2, Children, isValidElement, cloneElement, useCallback, useId, useSyncExternalStore, useInsertionEffect, Fragment as Fragment$1, Component, useImperativeHandle } from "react";
|
|
4
4
|
import { flushSync, createPortal } from "react-dom";
|
|
5
5
|
function withPolymorphicComponent(Component2) {
|
|
6
6
|
const PolymorphicComponent = React.forwardRef(
|
|
@@ -17,27 +17,27 @@ function isObject$1(value) {
|
|
|
17
17
|
}
|
|
18
18
|
var isObjectOrArray = (obj) => typeof obj === "object" && obj !== null;
|
|
19
19
|
function compact$1(value) {
|
|
20
|
-
return Object.fromEntries(Object.entries(value ?? {}).filter(([
|
|
20
|
+
return Object.fromEntries(Object.entries(value ?? {}).filter(([_2, value2]) => value2 !== void 0));
|
|
21
21
|
}
|
|
22
22
|
var isBaseCondition = (v2) => v2 === "base";
|
|
23
|
-
function filterBaseConditions(
|
|
24
|
-
return
|
|
23
|
+
function filterBaseConditions(c2) {
|
|
24
|
+
return c2.slice().filter((v2) => !isBaseCondition(v2));
|
|
25
25
|
}
|
|
26
26
|
function toChar(code) {
|
|
27
27
|
return String.fromCharCode(code + (code > 25 ? 39 : 97));
|
|
28
28
|
}
|
|
29
29
|
function toName(code) {
|
|
30
30
|
let name = "";
|
|
31
|
-
let
|
|
32
|
-
for (
|
|
33
|
-
name = toChar(
|
|
34
|
-
return toChar(
|
|
31
|
+
let x2;
|
|
32
|
+
for (x2 = Math.abs(code); x2 > 52; x2 = x2 / 52 | 0)
|
|
33
|
+
name = toChar(x2 % 52) + name;
|
|
34
|
+
return toChar(x2 % 52) + name;
|
|
35
35
|
}
|
|
36
|
-
function toPhash(
|
|
37
|
-
let
|
|
38
|
-
while (
|
|
39
|
-
|
|
40
|
-
return
|
|
36
|
+
function toPhash(h2, x2) {
|
|
37
|
+
let i2 = x2.length;
|
|
38
|
+
while (i2)
|
|
39
|
+
h2 = h2 * 33 ^ x2.charCodeAt(--i2);
|
|
40
|
+
return h2;
|
|
41
41
|
}
|
|
42
42
|
function toHash(value) {
|
|
43
43
|
return toName(toPhash(5381, value) >>> 0);
|
|
@@ -249,10 +249,10 @@ var getSlotCompoundVariant = (compoundVariants, slotName) => compoundVariants.fi
|
|
|
249
249
|
function splitProps(props, ...keys) {
|
|
250
250
|
const descriptors = Object.getOwnPropertyDescriptors(props);
|
|
251
251
|
const dKeys = Object.keys(descriptors);
|
|
252
|
-
const split = (
|
|
252
|
+
const split = (k2) => {
|
|
253
253
|
const clone = {};
|
|
254
|
-
for (let
|
|
255
|
-
const key =
|
|
254
|
+
for (let i2 = 0; i2 < k2.length; i2++) {
|
|
255
|
+
const key = k2[i2];
|
|
256
256
|
if (descriptors[key]) {
|
|
257
257
|
Object.defineProperty(clone, key, descriptors[key]);
|
|
258
258
|
delete descriptors[key];
|
|
@@ -300,9 +300,9 @@ function finalizeConditions(paths) {
|
|
|
300
300
|
});
|
|
301
301
|
}
|
|
302
302
|
function sortConditions(paths) {
|
|
303
|
-
return paths.sort((
|
|
304
|
-
const aa = isCondition(
|
|
305
|
-
const bb = isCondition(
|
|
303
|
+
return paths.sort((a2, b2) => {
|
|
304
|
+
const aa = isCondition(a2);
|
|
305
|
+
const bb = isCondition(b2);
|
|
306
306
|
if (aa && !bb) return 1;
|
|
307
307
|
if (!aa && bb) return -1;
|
|
308
308
|
return 0;
|
|
@@ -344,9 +344,9 @@ const css$1 = (...styles2) => cssFn(mergeCss(...styles2));
|
|
|
344
344
|
css$1.raw = (...styles2) => mergeCss(...styles2);
|
|
345
345
|
const { mergeCss } = createMergeCss(context);
|
|
346
346
|
function cx() {
|
|
347
|
-
let str = "",
|
|
348
|
-
for (;
|
|
349
|
-
if ((arg = arguments[
|
|
347
|
+
let str = "", i2 = 0, arg;
|
|
348
|
+
for (; i2 < arguments.length; ) {
|
|
349
|
+
if ((arg = arguments[i2++]) && typeof arg === "string") {
|
|
350
350
|
str && (str += " ");
|
|
351
351
|
str += arg;
|
|
352
352
|
}
|
|
@@ -521,10 +521,10 @@ function styledFn(Dynamic, configOrCva = {}, options = {}) {
|
|
|
521
521
|
function createJsxFactory() {
|
|
522
522
|
const cache = /* @__PURE__ */ new Map();
|
|
523
523
|
return new Proxy(styledFn, {
|
|
524
|
-
apply(
|
|
524
|
+
apply(_2, __, args) {
|
|
525
525
|
return styledFn(...args);
|
|
526
526
|
},
|
|
527
|
-
get(
|
|
527
|
+
get(_2, el) {
|
|
528
528
|
if (!cache.has(el)) {
|
|
529
529
|
cache.set(el, styledFn(el));
|
|
530
530
|
}
|
|
@@ -772,23 +772,12 @@ var isString = (v2) => typeof v2 === "string";
|
|
|
772
772
|
var isFunction = (v2) => typeof v2 === "function";
|
|
773
773
|
var fnToString = Function.prototype.toString;
|
|
774
774
|
fnToString.call(Object);
|
|
775
|
-
var runIfFn = (v2, ...a) => {
|
|
776
|
-
const res = typeof v2 === "function" ? v2(...a) : v2;
|
|
777
|
-
return res ?? void 0;
|
|
778
|
-
};
|
|
779
775
|
var identity = (v2) => v2();
|
|
780
|
-
var callAll = (...fns2) => (...
|
|
776
|
+
var callAll = (...fns2) => (...a2) => {
|
|
781
777
|
fns2.forEach(function(fn) {
|
|
782
|
-
fn == null ? void 0 : fn(...
|
|
778
|
+
fn == null ? void 0 : fn(...a2);
|
|
783
779
|
});
|
|
784
780
|
};
|
|
785
|
-
var uuid = /* @__PURE__ */ (() => {
|
|
786
|
-
let id2 = 0;
|
|
787
|
-
return () => {
|
|
788
|
-
id2++;
|
|
789
|
-
return id2.toString(36);
|
|
790
|
-
};
|
|
791
|
-
})();
|
|
792
781
|
function compact(obj) {
|
|
793
782
|
if (!isPlainObject2(obj) || obj === void 0) return obj;
|
|
794
783
|
const keys = Reflect.ownKeys(obj).filter((key) => typeof key === "string");
|
|
@@ -804,39 +793,17 @@ function compact(obj) {
|
|
|
804
793
|
var isPlainObject2 = (v2) => {
|
|
805
794
|
return v2 && typeof v2 === "object" && v2.constructor === Object;
|
|
806
795
|
};
|
|
807
|
-
function
|
|
808
|
-
const
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
handle = requestAnimationFrame(loop);
|
|
812
|
-
const delta = now2 - start;
|
|
813
|
-
if (delta >= delay2) {
|
|
814
|
-
callback();
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
handle = requestAnimationFrame(loop);
|
|
818
|
-
return () => cancelAnimationFrame(handle);
|
|
819
|
-
}
|
|
820
|
-
function warn(...a) {
|
|
821
|
-
const m2 = a.length === 1 ? a[0] : a[1];
|
|
822
|
-
const c = a.length === 2 ? a[0] : true;
|
|
823
|
-
if (c && process.env.NODE_ENV !== "production") {
|
|
796
|
+
function warn(...a2) {
|
|
797
|
+
const m2 = a2.length === 1 ? a2[0] : a2[1];
|
|
798
|
+
const c2 = a2.length === 2 ? a2[0] : true;
|
|
799
|
+
if (c2 && process.env.NODE_ENV !== "production") {
|
|
824
800
|
console.warn(m2);
|
|
825
801
|
}
|
|
826
802
|
}
|
|
827
|
-
function ensure(
|
|
828
|
-
if (
|
|
829
|
-
}
|
|
830
|
-
function ensureProps(props, keys, scope) {
|
|
831
|
-
let missingKeys = [];
|
|
832
|
-
for (const key of keys) {
|
|
833
|
-
if (props[key] == null) missingKeys.push(key);
|
|
834
|
-
}
|
|
835
|
-
if (missingKeys.length > 0)
|
|
836
|
-
throw new Error(`[zag-js${` > ${scope}`}] missing required props: ${missingKeys.join(", ")}`);
|
|
803
|
+
function ensure(c2, m2) {
|
|
804
|
+
if (c2 == null) throw new Error(m2);
|
|
837
805
|
}
|
|
838
806
|
var isObject = (v2) => typeof v2 === "object" && v2 !== null;
|
|
839
|
-
var MAX_Z_INDEX = 2147483647;
|
|
840
807
|
var dataAttr = (guard) => guard ? "" : void 0;
|
|
841
808
|
var ELEMENT_NODE = 1;
|
|
842
809
|
var DOCUMENT_NODE = 9;
|
|
@@ -954,8 +921,8 @@ var isSelfTarget = (event) => {
|
|
|
954
921
|
function isComposingEvent(event) {
|
|
955
922
|
return getNativeEvent(event).isComposing;
|
|
956
923
|
}
|
|
957
|
-
var isContextMenuEvent = (
|
|
958
|
-
return
|
|
924
|
+
var isContextMenuEvent = (e2) => {
|
|
925
|
+
return e2.button === 2 || isMac$1() && e2.ctrlKey && e2.button === 0;
|
|
959
926
|
};
|
|
960
927
|
var keyMap = {
|
|
961
928
|
Up: "ArrowUp",
|
|
@@ -1000,10 +967,10 @@ var getFocusables = (container, includeContainer = false) => {
|
|
|
1000
967
|
elements.unshift(container);
|
|
1001
968
|
}
|
|
1002
969
|
const focusableElements2 = elements.filter(isFocusable);
|
|
1003
|
-
focusableElements2.forEach((element,
|
|
970
|
+
focusableElements2.forEach((element, i2) => {
|
|
1004
971
|
if (isFrame(element) && element.contentDocument) {
|
|
1005
972
|
const frameBody = element.contentDocument.body;
|
|
1006
|
-
focusableElements2.splice(
|
|
973
|
+
focusableElements2.splice(i2, 1, ...getFocusables(frameBody));
|
|
1007
974
|
}
|
|
1008
975
|
});
|
|
1009
976
|
return focusableElements2;
|
|
@@ -1016,11 +983,11 @@ function getTabbables(container, includeContainer) {
|
|
|
1016
983
|
if (!container) return [];
|
|
1017
984
|
const elements = Array.from(container.querySelectorAll(focusableSelector));
|
|
1018
985
|
const tabbableElements = elements.filter(isTabbable);
|
|
1019
|
-
tabbableElements.forEach((element,
|
|
986
|
+
tabbableElements.forEach((element, i2) => {
|
|
1020
987
|
if (isFrame(element) && element.contentDocument) {
|
|
1021
988
|
const frameBody = element.contentDocument.body;
|
|
1022
989
|
const allFrameTabbable = getTabbables(frameBody);
|
|
1023
|
-
tabbableElements.splice(
|
|
990
|
+
tabbableElements.splice(i2, 1, ...allFrameTabbable);
|
|
1024
991
|
}
|
|
1025
992
|
});
|
|
1026
993
|
if (!tabbableElements.length && includeContainer) ;
|
|
@@ -1194,14 +1161,14 @@ var serialize = (style) => {
|
|
|
1194
1161
|
}
|
|
1195
1162
|
return res;
|
|
1196
1163
|
};
|
|
1197
|
-
var css = (
|
|
1198
|
-
if (isString(
|
|
1199
|
-
if (isString(
|
|
1200
|
-
|
|
1201
|
-
} else if (isString(
|
|
1202
|
-
|
|
1203
|
-
}
|
|
1204
|
-
return Object.assign({},
|
|
1164
|
+
var css = (a2, b2) => {
|
|
1165
|
+
if (isString(a2)) {
|
|
1166
|
+
if (isString(b2)) return `${a2};${b2}`;
|
|
1167
|
+
a2 = serialize(a2);
|
|
1168
|
+
} else if (isString(b2)) {
|
|
1169
|
+
b2 = serialize(b2);
|
|
1170
|
+
}
|
|
1171
|
+
return Object.assign({}, a2 ?? {}, b2 ?? {});
|
|
1205
1172
|
};
|
|
1206
1173
|
function mergeProps(...args) {
|
|
1207
1174
|
let result = {};
|
|
@@ -1348,7 +1315,7 @@ var useTrack = (deps, effect) => {
|
|
|
1348
1315
|
const run = mounted && called.current;
|
|
1349
1316
|
if (run) return effect();
|
|
1350
1317
|
called.current = true;
|
|
1351
|
-
}, [...(deps ?? []).map((
|
|
1318
|
+
}, [...(deps ?? []).map((d2) => typeof d2 === "function" ? d2() : d2)]);
|
|
1352
1319
|
useEffect(() => {
|
|
1353
1320
|
render.current = true;
|
|
1354
1321
|
return () => {
|
|
@@ -1441,10 +1408,10 @@ function useMachine(machine2, userProps = {}) {
|
|
|
1441
1408
|
const action = (keys) => {
|
|
1442
1409
|
const strs = isFunction(keys) ? keys(getParams()) : keys;
|
|
1443
1410
|
if (!strs) return;
|
|
1444
|
-
const fns2 = strs.map((
|
|
1411
|
+
const fns2 = strs.map((s2) => {
|
|
1445
1412
|
var _a2, _b2;
|
|
1446
|
-
const fn = (_b2 = (_a2 = machine2.implementations) == null ? void 0 : _a2.actions) == null ? void 0 : _b2[
|
|
1447
|
-
if (!fn) warn(`[zag-js] No implementation found for action "${JSON.stringify(
|
|
1413
|
+
const fn = (_b2 = (_a2 = machine2.implementations) == null ? void 0 : _a2.actions) == null ? void 0 : _b2[s2];
|
|
1414
|
+
if (!fn) warn(`[zag-js] No implementation found for action "${JSON.stringify(s2)}"`);
|
|
1448
1415
|
return fn;
|
|
1449
1416
|
});
|
|
1450
1417
|
for (const fn of fns2) {
|
|
@@ -1459,10 +1426,10 @@ function useMachine(machine2, userProps = {}) {
|
|
|
1459
1426
|
const effect = (keys) => {
|
|
1460
1427
|
const strs = isFunction(keys) ? keys(getParams()) : keys;
|
|
1461
1428
|
if (!strs) return;
|
|
1462
|
-
const fns2 = strs.map((
|
|
1429
|
+
const fns2 = strs.map((s2) => {
|
|
1463
1430
|
var _a2, _b2;
|
|
1464
|
-
const fn = (_b2 = (_a2 = machine2.implementations) == null ? void 0 : _a2.effects) == null ? void 0 : _b2[
|
|
1465
|
-
if (!fn) warn(`[zag-js] No implementation found for effect "${JSON.stringify(
|
|
1431
|
+
const fn = (_b2 = (_a2 = machine2.implementations) == null ? void 0 : _a2.effects) == null ? void 0 : _b2[s2];
|
|
1432
|
+
if (!fn) warn(`[zag-js] No implementation found for effect "${JSON.stringify(s2)}"`);
|
|
1466
1433
|
return fn;
|
|
1467
1434
|
});
|
|
1468
1435
|
const cleanups2 = [];
|
|
@@ -1473,10 +1440,10 @@ function useMachine(machine2, userProps = {}) {
|
|
|
1473
1440
|
return () => cleanups2.forEach((fn) => fn == null ? void 0 : fn());
|
|
1474
1441
|
};
|
|
1475
1442
|
const choose = (transitions) => {
|
|
1476
|
-
return toArray(transitions).find((
|
|
1477
|
-
let result = !
|
|
1478
|
-
if (isString(
|
|
1479
|
-
else if (isFunction(
|
|
1443
|
+
return toArray(transitions).find((t2) => {
|
|
1444
|
+
let result = !t2.guard;
|
|
1445
|
+
if (isString(t2.guard)) result = !!guard(t2.guard);
|
|
1446
|
+
else if (isFunction(t2.guard)) result = t2.guard(getParams());
|
|
1480
1447
|
return result;
|
|
1481
1448
|
});
|
|
1482
1449
|
};
|
|
@@ -1655,7 +1622,7 @@ const jsxFactory = () => {
|
|
|
1655
1622
|
apply(_target, _thisArg, argArray) {
|
|
1656
1623
|
return withAsChild(argArray[0]);
|
|
1657
1624
|
},
|
|
1658
|
-
get(
|
|
1625
|
+
get(_2, element) {
|
|
1659
1626
|
const asElement = element;
|
|
1660
1627
|
if (!cache.has(asElement)) {
|
|
1661
1628
|
cache.set(asElement, withAsChild(asElement));
|
|
@@ -1724,8 +1691,8 @@ function getWindowFrames(win) {
|
|
|
1724
1691
|
const frames = {
|
|
1725
1692
|
each(cb) {
|
|
1726
1693
|
var _a;
|
|
1727
|
-
for (let
|
|
1728
|
-
const frame2 = win.frames[
|
|
1694
|
+
for (let i2 = 0; i2 < ((_a = win.frames) == null ? void 0 : _a.length); i2 += 1) {
|
|
1695
|
+
const frame2 = win.frames[i2];
|
|
1729
1696
|
if (frame2) cb(frame2);
|
|
1730
1697
|
}
|
|
1731
1698
|
},
|
|
@@ -2111,27 +2078,6 @@ function trackDismissableElement(nodeOrFn, options) {
|
|
|
2111
2078
|
cleanups2.forEach((fn) => fn == null ? void 0 : fn());
|
|
2112
2079
|
};
|
|
2113
2080
|
}
|
|
2114
|
-
function trackDismissableBranch(nodeOrFn, options = {}) {
|
|
2115
|
-
const { defer } = options;
|
|
2116
|
-
const func = defer ? raf$1 : (v2) => v2();
|
|
2117
|
-
const cleanups2 = [];
|
|
2118
|
-
cleanups2.push(
|
|
2119
|
-
func(() => {
|
|
2120
|
-
const node = isFunction(nodeOrFn) ? nodeOrFn() : nodeOrFn;
|
|
2121
|
-
if (!node) {
|
|
2122
|
-
warn("[@zag-js/dismissable] branch node is `null` or `undefined`");
|
|
2123
|
-
return;
|
|
2124
|
-
}
|
|
2125
|
-
layerStack.addBranch(node);
|
|
2126
|
-
cleanups2.push(() => {
|
|
2127
|
-
layerStack.removeBranch(node);
|
|
2128
|
-
});
|
|
2129
|
-
})
|
|
2130
|
-
);
|
|
2131
|
-
return () => {
|
|
2132
|
-
cleanups2.forEach((fn) => fn == null ? void 0 : fn());
|
|
2133
|
-
};
|
|
2134
|
-
}
|
|
2135
2081
|
const [RenderStrategyPropsProvider, useRenderStrategyPropsContext] = createContext({
|
|
2136
2082
|
name: "RenderStrategyContext",
|
|
2137
2083
|
hookName: "useRenderStrategyContext",
|
|
@@ -2165,7 +2111,7 @@ const [PresenceProvider, usePresenceContext] = createContext({
|
|
|
2165
2111
|
providerName: "<PresenceProvider />"
|
|
2166
2112
|
});
|
|
2167
2113
|
const splitPresenceProps = (props) => createSplitProps()(props, ["immediate", "lazyMount", "onExitComplete", "present", "unmountOnExit"]);
|
|
2168
|
-
function connect$
|
|
2114
|
+
function connect$2(service, _normalize) {
|
|
2169
2115
|
const { state, send, context: context2 } = service;
|
|
2170
2116
|
const present = state.matches("mounted", "unmountSuspended");
|
|
2171
2117
|
return {
|
|
@@ -2180,7 +2126,7 @@ function connect$3(service, _normalize) {
|
|
|
2180
2126
|
}
|
|
2181
2127
|
};
|
|
2182
2128
|
}
|
|
2183
|
-
var machine$
|
|
2129
|
+
var machine$2 = createMachine({
|
|
2184
2130
|
props({ props: props2 }) {
|
|
2185
2131
|
return { ...props2, present: !!props2.present };
|
|
2186
2132
|
},
|
|
@@ -2347,8 +2293,8 @@ const usePresence$1 = (props = {}) => {
|
|
|
2347
2293
|
present,
|
|
2348
2294
|
onExitComplete: useEvent(props.onExitComplete)
|
|
2349
2295
|
};
|
|
2350
|
-
const service = useMachine(machine$
|
|
2351
|
-
const api = connect$
|
|
2296
|
+
const service = useMachine(machine$2, machineProps);
|
|
2297
|
+
const api = connect$2(service);
|
|
2352
2298
|
if (api.present) {
|
|
2353
2299
|
wasEverPresent.current = true;
|
|
2354
2300
|
}
|
|
@@ -2377,7 +2323,7 @@ var correctTargets = (parent, targets) => targets.map((target) => {
|
|
|
2377
2323
|
}
|
|
2378
2324
|
console.error("[zag-js > ariaHidden] target", target, "in not contained inside", parent, ". Doing nothing");
|
|
2379
2325
|
return null;
|
|
2380
|
-
}).filter((
|
|
2326
|
+
}).filter((x2) => Boolean(x2));
|
|
2381
2327
|
var isIgnoredNode = (node) => {
|
|
2382
2328
|
if (node.localName === "next-route-announcer") return true;
|
|
2383
2329
|
if (node.localName === "script") return true;
|
|
@@ -2424,8 +2370,8 @@ var walkTreeOutside = (originalTarget, props) => {
|
|
|
2424
2370
|
if (!alreadyHidden) {
|
|
2425
2371
|
node.setAttribute(controlAttribute, "true");
|
|
2426
2372
|
}
|
|
2427
|
-
} catch (
|
|
2428
|
-
console.error("[zag-js > ariaHidden] cannot operate on ", node,
|
|
2373
|
+
} catch (e2) {
|
|
2374
|
+
console.error("[zag-js > ariaHidden] cannot operate on ", node, e2);
|
|
2429
2375
|
}
|
|
2430
2376
|
}
|
|
2431
2377
|
});
|
|
@@ -2617,7 +2563,7 @@ var FocusTrap = class {
|
|
|
2617
2563
|
}
|
|
2618
2564
|
}
|
|
2619
2565
|
} else {
|
|
2620
|
-
if (!this.state.containerGroups.some((g2) => g2.tabbableNodes.some((
|
|
2566
|
+
if (!this.state.containerGroups.some((g2) => g2.tabbableNodes.some((n2) => getTabIndex(n2) > 0))) {
|
|
2621
2567
|
navAcrossContainers = false;
|
|
2622
2568
|
}
|
|
2623
2569
|
}
|
|
@@ -2908,11 +2854,11 @@ var FocusTrap = class {
|
|
|
2908
2854
|
returnFocusOnDeactivate: true,
|
|
2909
2855
|
escapeDeactivates: true,
|
|
2910
2856
|
delayInitialFocus: true,
|
|
2911
|
-
isKeyForward(
|
|
2912
|
-
return isTabEvent(
|
|
2857
|
+
isKeyForward(e2) {
|
|
2858
|
+
return isTabEvent(e2) && !e2.shiftKey;
|
|
2913
2859
|
},
|
|
2914
|
-
isKeyBackward(
|
|
2915
|
-
return isTabEvent(
|
|
2860
|
+
isKeyBackward(e2) {
|
|
2861
|
+
return isTabEvent(e2) && e2.shiftKey;
|
|
2916
2862
|
},
|
|
2917
2863
|
...options
|
|
2918
2864
|
};
|
|
@@ -2964,7 +2910,7 @@ var FocusTrap = class {
|
|
|
2964
2910
|
nextTabbableNode
|
|
2965
2911
|
};
|
|
2966
2912
|
});
|
|
2967
|
-
this.state.tabbableGroups = this.state.containerGroups.filter((
|
|
2913
|
+
this.state.tabbableGroups = this.state.containerGroups.filter((group) => group.tabbableNodes.length > 0);
|
|
2968
2914
|
if (this.state.tabbableGroups.length <= 0 && !this.getNodeForOption("fallbackFocus")) {
|
|
2969
2915
|
throw new Error(
|
|
2970
2916
|
"Your focus-trap must have at least one container with at least one tabbable node in it at all times"
|
|
@@ -3127,7 +3073,7 @@ function preventBodyScroll(_document) {
|
|
|
3127
3073
|
body.removeAttribute(LOCK_CLASSNAME);
|
|
3128
3074
|
};
|
|
3129
3075
|
}
|
|
3130
|
-
var anatomy$
|
|
3076
|
+
var anatomy$1 = createAnatomy("dialog").parts(
|
|
3131
3077
|
"trigger",
|
|
3132
3078
|
"backdrop",
|
|
3133
3079
|
"positioner",
|
|
@@ -3136,7 +3082,7 @@ var anatomy$2 = createAnatomy("dialog").parts(
|
|
|
3136
3082
|
"description",
|
|
3137
3083
|
"closeTrigger"
|
|
3138
3084
|
);
|
|
3139
|
-
var parts$
|
|
3085
|
+
var parts$1 = anatomy$1.build();
|
|
3140
3086
|
var getPositionerId = (ctx) => {
|
|
3141
3087
|
var _a;
|
|
3142
3088
|
return ((_a = ctx.ids) == null ? void 0 : _a.positioner) ?? `dialog:${ctx.id}:positioner`;
|
|
@@ -3153,15 +3099,15 @@ var getTriggerId$1 = (ctx) => {
|
|
|
3153
3099
|
var _a;
|
|
3154
3100
|
return ((_a = ctx.ids) == null ? void 0 : _a.trigger) ?? `dialog:${ctx.id}:trigger`;
|
|
3155
3101
|
};
|
|
3156
|
-
var getTitleId
|
|
3102
|
+
var getTitleId = (ctx) => {
|
|
3157
3103
|
var _a;
|
|
3158
3104
|
return ((_a = ctx.ids) == null ? void 0 : _a.title) ?? `dialog:${ctx.id}:title`;
|
|
3159
3105
|
};
|
|
3160
|
-
var getDescriptionId
|
|
3106
|
+
var getDescriptionId = (ctx) => {
|
|
3161
3107
|
var _a;
|
|
3162
3108
|
return ((_a = ctx.ids) == null ? void 0 : _a.description) ?? `dialog:${ctx.id}:description`;
|
|
3163
3109
|
};
|
|
3164
|
-
var getCloseTriggerId
|
|
3110
|
+
var getCloseTriggerId = (ctx) => {
|
|
3165
3111
|
var _a;
|
|
3166
3112
|
return ((_a = ctx.ids) == null ? void 0 : _a.closeTrigger) ?? `dialog:${ctx.id}:close`;
|
|
3167
3113
|
};
|
|
@@ -3169,10 +3115,10 @@ var getContentEl$1 = (ctx) => ctx.getById(getContentId$1(ctx));
|
|
|
3169
3115
|
var getPositionerEl = (ctx) => ctx.getById(getPositionerId(ctx));
|
|
3170
3116
|
var getBackdropEl = (ctx) => ctx.getById(getBackdropId(ctx));
|
|
3171
3117
|
var getTriggerEl$1 = (ctx) => ctx.getById(getTriggerId$1(ctx));
|
|
3172
|
-
var getTitleEl = (ctx) => ctx.getById(getTitleId
|
|
3173
|
-
var getDescriptionEl = (ctx) => ctx.getById(getDescriptionId
|
|
3174
|
-
var getCloseTriggerEl = (ctx) => ctx.getById(getCloseTriggerId
|
|
3175
|
-
function connect$
|
|
3118
|
+
var getTitleEl = (ctx) => ctx.getById(getTitleId(ctx));
|
|
3119
|
+
var getDescriptionEl = (ctx) => ctx.getById(getDescriptionId(ctx));
|
|
3120
|
+
var getCloseTriggerEl = (ctx) => ctx.getById(getCloseTriggerId(ctx));
|
|
3121
|
+
function connect$1(service, normalize) {
|
|
3176
3122
|
const { state, send, context: context2, prop, scope } = service;
|
|
3177
3123
|
const ariaLabel = prop("aria-label");
|
|
3178
3124
|
const open = state.matches("open");
|
|
@@ -3185,7 +3131,7 @@ function connect$2(service, normalize) {
|
|
|
3185
3131
|
},
|
|
3186
3132
|
getTriggerProps() {
|
|
3187
3133
|
return normalize.button({
|
|
3188
|
-
...parts$
|
|
3134
|
+
...parts$1.trigger.attrs,
|
|
3189
3135
|
dir: prop("dir"),
|
|
3190
3136
|
id: getTriggerId$1(scope),
|
|
3191
3137
|
"aria-haspopup": "dialog",
|
|
@@ -3201,7 +3147,7 @@ function connect$2(service, normalize) {
|
|
|
3201
3147
|
},
|
|
3202
3148
|
getBackdropProps() {
|
|
3203
3149
|
return normalize.element({
|
|
3204
|
-
...parts$
|
|
3150
|
+
...parts$1.backdrop.attrs,
|
|
3205
3151
|
dir: prop("dir"),
|
|
3206
3152
|
hidden: !open,
|
|
3207
3153
|
id: getBackdropId(scope),
|
|
@@ -3210,7 +3156,7 @@ function connect$2(service, normalize) {
|
|
|
3210
3156
|
},
|
|
3211
3157
|
getPositionerProps() {
|
|
3212
3158
|
return normalize.element({
|
|
3213
|
-
...parts$
|
|
3159
|
+
...parts$1.positioner.attrs,
|
|
3214
3160
|
dir: prop("dir"),
|
|
3215
3161
|
id: getPositionerId(scope),
|
|
3216
3162
|
style: {
|
|
@@ -3221,7 +3167,7 @@ function connect$2(service, normalize) {
|
|
|
3221
3167
|
getContentProps() {
|
|
3222
3168
|
const rendered = context2.get("rendered");
|
|
3223
3169
|
return normalize.element({
|
|
3224
|
-
...parts$
|
|
3170
|
+
...parts$1.content.attrs,
|
|
3225
3171
|
dir: prop("dir"),
|
|
3226
3172
|
role: prop("role"),
|
|
3227
3173
|
hidden: !open,
|
|
@@ -3230,29 +3176,29 @@ function connect$2(service, normalize) {
|
|
|
3230
3176
|
"data-state": open ? "open" : "closed",
|
|
3231
3177
|
"aria-modal": true,
|
|
3232
3178
|
"aria-label": ariaLabel || void 0,
|
|
3233
|
-
"aria-labelledby": ariaLabel || !rendered.title ? void 0 : getTitleId
|
|
3234
|
-
"aria-describedby": rendered.description ? getDescriptionId
|
|
3179
|
+
"aria-labelledby": ariaLabel || !rendered.title ? void 0 : getTitleId(scope),
|
|
3180
|
+
"aria-describedby": rendered.description ? getDescriptionId(scope) : void 0
|
|
3235
3181
|
});
|
|
3236
3182
|
},
|
|
3237
3183
|
getTitleProps() {
|
|
3238
3184
|
return normalize.element({
|
|
3239
|
-
...parts$
|
|
3185
|
+
...parts$1.title.attrs,
|
|
3240
3186
|
dir: prop("dir"),
|
|
3241
|
-
id: getTitleId
|
|
3187
|
+
id: getTitleId(scope)
|
|
3242
3188
|
});
|
|
3243
3189
|
},
|
|
3244
3190
|
getDescriptionProps() {
|
|
3245
3191
|
return normalize.element({
|
|
3246
|
-
...parts$
|
|
3192
|
+
...parts$1.description.attrs,
|
|
3247
3193
|
dir: prop("dir"),
|
|
3248
|
-
id: getDescriptionId
|
|
3194
|
+
id: getDescriptionId(scope)
|
|
3249
3195
|
});
|
|
3250
3196
|
},
|
|
3251
3197
|
getCloseTriggerProps() {
|
|
3252
3198
|
return normalize.button({
|
|
3253
|
-
...parts$
|
|
3199
|
+
...parts$1.closeTrigger.attrs,
|
|
3254
3200
|
dir: prop("dir"),
|
|
3255
|
-
id: getCloseTriggerId
|
|
3201
|
+
id: getCloseTriggerId(scope),
|
|
3256
3202
|
type: "button",
|
|
3257
3203
|
onClick(event) {
|
|
3258
3204
|
if (event.defaultPrevented) return;
|
|
@@ -3263,7 +3209,7 @@ function connect$2(service, normalize) {
|
|
|
3263
3209
|
}
|
|
3264
3210
|
};
|
|
3265
3211
|
}
|
|
3266
|
-
var machine$
|
|
3212
|
+
var machine$1 = createMachine({
|
|
3267
3213
|
props({ props: props2, scope }) {
|
|
3268
3214
|
const alertDialog = props2.role === "alertdialog";
|
|
3269
3215
|
const initialFocusEl = alertDialog ? () => getCloseTriggerEl(scope) : void 0;
|
|
@@ -3482,8 +3428,8 @@ const useDialog = (props) => {
|
|
|
3482
3428
|
dir,
|
|
3483
3429
|
...props
|
|
3484
3430
|
};
|
|
3485
|
-
const service = useMachine(machine$
|
|
3486
|
-
return connect$
|
|
3431
|
+
const service = useMachine(machine$1, machineProps);
|
|
3432
|
+
return connect$1(service, normalizeProps);
|
|
3487
3433
|
};
|
|
3488
3434
|
const DialogRoot = (props) => {
|
|
3489
3435
|
const [presenceProps, { children, ...localProps }] = splitPresenceProps(props);
|
|
@@ -3588,9 +3534,9 @@ const TabTrigger = forwardRef((props, ref) => {
|
|
|
3588
3534
|
return /* @__PURE__ */ jsx(ark.button, { ...mergedProps, ref });
|
|
3589
3535
|
});
|
|
3590
3536
|
TabTrigger.displayName = "TabTrigger";
|
|
3591
|
-
var anatomy
|
|
3592
|
-
var parts
|
|
3593
|
-
var getRootId
|
|
3537
|
+
var anatomy = createAnatomy("tabs").parts("root", "list", "trigger", "content", "indicator");
|
|
3538
|
+
var parts = anatomy.build();
|
|
3539
|
+
var getRootId = (ctx) => {
|
|
3594
3540
|
var _a;
|
|
3595
3541
|
return ((_a = ctx.ids) == null ? void 0 : _a.root) ?? `tabs:${ctx.id}`;
|
|
3596
3542
|
};
|
|
@@ -3641,7 +3587,7 @@ var resolveRect = (rect) => ({
|
|
|
3641
3587
|
left: `${rect.left}px`,
|
|
3642
3588
|
top: `${rect.top}px`
|
|
3643
3589
|
});
|
|
3644
|
-
function connect
|
|
3590
|
+
function connect(service, normalize) {
|
|
3645
3591
|
const { state, send, context: context2, prop, scope } = service;
|
|
3646
3592
|
const translations = prop("translations");
|
|
3647
3593
|
const focused = state.matches("focused");
|
|
@@ -3687,8 +3633,8 @@ function connect$1(service, normalize) {
|
|
|
3687
3633
|
},
|
|
3688
3634
|
getRootProps() {
|
|
3689
3635
|
return normalize.element({
|
|
3690
|
-
...parts
|
|
3691
|
-
id: getRootId
|
|
3636
|
+
...parts.root.attrs,
|
|
3637
|
+
id: getRootId(scope),
|
|
3692
3638
|
"data-orientation": prop("orientation"),
|
|
3693
3639
|
"data-focus": dataAttr(focused),
|
|
3694
3640
|
dir: prop("dir")
|
|
@@ -3696,7 +3642,7 @@ function connect$1(service, normalize) {
|
|
|
3696
3642
|
},
|
|
3697
3643
|
getListProps() {
|
|
3698
3644
|
return normalize.element({
|
|
3699
|
-
...parts
|
|
3645
|
+
...parts.list.attrs,
|
|
3700
3646
|
id: getListId(scope),
|
|
3701
3647
|
role: "tablist",
|
|
3702
3648
|
dir: prop("dir"),
|
|
@@ -3752,7 +3698,7 @@ function connect$1(service, normalize) {
|
|
|
3752
3698
|
const { value, disabled } = props2;
|
|
3753
3699
|
const triggerState = getTriggerState(props2);
|
|
3754
3700
|
return normalize.button({
|
|
3755
|
-
...parts
|
|
3701
|
+
...parts.trigger.attrs,
|
|
3756
3702
|
role: "tab",
|
|
3757
3703
|
type: "button",
|
|
3758
3704
|
disabled,
|
|
@@ -3792,7 +3738,7 @@ function connect$1(service, normalize) {
|
|
|
3792
3738
|
const { value } = props2;
|
|
3793
3739
|
const selected = context2.get("value") === value;
|
|
3794
3740
|
return normalize.element({
|
|
3795
|
-
...parts
|
|
3741
|
+
...parts.content.attrs,
|
|
3796
3742
|
dir: prop("dir"),
|
|
3797
3743
|
id: getContentId(scope, value),
|
|
3798
3744
|
tabIndex: composite ? 0 : -1,
|
|
@@ -3809,7 +3755,7 @@ function connect$1(service, normalize) {
|
|
|
3809
3755
|
const indicatorTransition = context2.get("indicatorTransition");
|
|
3810
3756
|
return normalize.element({
|
|
3811
3757
|
id: getIndicatorId(scope),
|
|
3812
|
-
...parts
|
|
3758
|
+
...parts.indicator.attrs,
|
|
3813
3759
|
dir: prop("dir"),
|
|
3814
3760
|
"data-orientation": prop("orientation"),
|
|
3815
3761
|
style: {
|
|
@@ -3829,8 +3775,8 @@ function connect$1(service, normalize) {
|
|
|
3829
3775
|
}
|
|
3830
3776
|
};
|
|
3831
3777
|
}
|
|
3832
|
-
var { not
|
|
3833
|
-
var machine
|
|
3778
|
+
var { not } = createGuards();
|
|
3779
|
+
var machine = createMachine({
|
|
3834
3780
|
props({ props: props2 }) {
|
|
3835
3781
|
return {
|
|
3836
3782
|
dir: "ltr",
|
|
@@ -3953,7 +3899,7 @@ var machine$1 = createMachine({
|
|
|
3953
3899
|
}
|
|
3954
3900
|
],
|
|
3955
3901
|
ENTER: {
|
|
3956
|
-
guard: not
|
|
3902
|
+
guard: not("selectOnFocus"),
|
|
3957
3903
|
actions: ["selectFocusedTab"]
|
|
3958
3904
|
},
|
|
3959
3905
|
TAB_FOCUS: {
|
|
@@ -4134,8 +4080,8 @@ const useTabs = (props) => {
|
|
|
4134
4080
|
getRootNode,
|
|
4135
4081
|
...props
|
|
4136
4082
|
};
|
|
4137
|
-
const service = useMachine(machine
|
|
4138
|
-
return connect
|
|
4083
|
+
const service = useMachine(machine, machineProps);
|
|
4084
|
+
return connect(service, normalizeProps);
|
|
4139
4085
|
};
|
|
4140
4086
|
const TabsRoot = forwardRef((props, ref) => {
|
|
4141
4087
|
const [renderStrategyProps, tabsProps] = splitRenderStrategyProps(props);
|
|
@@ -4159,1188 +4105,105 @@ const TabsRoot = forwardRef((props, ref) => {
|
|
|
4159
4105
|
return /* @__PURE__ */ jsx(TabsProvider, { value: tabs, children: /* @__PURE__ */ jsx(RenderStrategyPropsProvider, { value: renderStrategyProps, children: /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref }) }) });
|
|
4160
4106
|
});
|
|
4161
4107
|
TabsRoot.displayName = "TabsRoot";
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
loading: Infinity,
|
|
4183
|
-
DEFAULT: 5e3
|
|
4184
|
-
};
|
|
4185
|
-
function getToastDuration(duration, type) {
|
|
4186
|
-
return duration ?? defaultTimeouts[type] ?? defaultTimeouts.DEFAULT;
|
|
4187
|
-
}
|
|
4188
|
-
var getOffsets = (offsets) => typeof offsets === "string" ? { left: offsets, right: offsets, bottom: offsets, top: offsets } : offsets;
|
|
4189
|
-
function getGroupPlacementStyle(service, placement) {
|
|
4190
|
-
var _a;
|
|
4191
|
-
const { prop, computed, context: context2 } = service;
|
|
4192
|
-
const { offsets, gap } = prop("store").attrs;
|
|
4193
|
-
const heights = context2.get("heights");
|
|
4194
|
-
const computedOffset = getOffsets(offsets);
|
|
4195
|
-
const rtl = prop("dir") === "rtl";
|
|
4196
|
-
const computedPlacement = placement.replace("-start", rtl ? "-right" : "-left").replace("-end", rtl ? "-left" : "-right");
|
|
4197
|
-
const isRighty = computedPlacement.includes("right");
|
|
4198
|
-
const isLefty = computedPlacement.includes("left");
|
|
4199
|
-
const styles2 = {
|
|
4200
|
-
position: "fixed",
|
|
4201
|
-
pointerEvents: computed("count") > 0 ? void 0 : "none",
|
|
4202
|
-
display: "flex",
|
|
4203
|
-
flexDirection: "column",
|
|
4204
|
-
"--gap": `${gap}px`,
|
|
4205
|
-
"--first-height": `${((_a = heights[0]) == null ? void 0 : _a.height) || 0}px`,
|
|
4206
|
-
zIndex: MAX_Z_INDEX
|
|
4207
|
-
};
|
|
4208
|
-
let alignItems = "center";
|
|
4209
|
-
if (isRighty) alignItems = "flex-end";
|
|
4210
|
-
if (isLefty) alignItems = "flex-start";
|
|
4211
|
-
styles2.alignItems = alignItems;
|
|
4212
|
-
if (computedPlacement.includes("top")) {
|
|
4213
|
-
const offset = computedOffset.top;
|
|
4214
|
-
styles2.top = `max(env(safe-area-inset-top, 0px), ${offset})`;
|
|
4215
|
-
}
|
|
4216
|
-
if (computedPlacement.includes("bottom")) {
|
|
4217
|
-
const offset = computedOffset.bottom;
|
|
4218
|
-
styles2.bottom = `max(env(safe-area-inset-bottom, 0px), ${offset})`;
|
|
4219
|
-
}
|
|
4220
|
-
if (!computedPlacement.includes("left")) {
|
|
4221
|
-
const offset = computedOffset.right;
|
|
4222
|
-
styles2.insetInlineEnd = `calc(env(safe-area-inset-right, 0px) + ${offset})`;
|
|
4223
|
-
}
|
|
4224
|
-
if (!computedPlacement.includes("right")) {
|
|
4225
|
-
const offset = computedOffset.left;
|
|
4226
|
-
styles2.insetInlineStart = `calc(env(safe-area-inset-left, 0px) + ${offset})`;
|
|
4227
|
-
}
|
|
4228
|
-
return styles2;
|
|
4229
|
-
}
|
|
4230
|
-
function getPlacementStyle(service, visible) {
|
|
4231
|
-
const { prop, context: context2, computed } = service;
|
|
4232
|
-
const parent = prop("parent");
|
|
4233
|
-
const placement = parent.computed("placement");
|
|
4234
|
-
const { gap } = parent.prop("store").attrs;
|
|
4235
|
-
const [side] = placement.split("-");
|
|
4236
|
-
const mounted = context2.get("mounted");
|
|
4237
|
-
const remainingTime = context2.get("remainingTime");
|
|
4238
|
-
const height = computed("height");
|
|
4239
|
-
const frontmost = computed("frontmost");
|
|
4240
|
-
const sibling = !frontmost;
|
|
4241
|
-
const overlap = !prop("stacked");
|
|
4242
|
-
const stacked = prop("stacked");
|
|
4243
|
-
const type = prop("type");
|
|
4244
|
-
const duration = type === "loading" ? Number.MAX_SAFE_INTEGER : remainingTime;
|
|
4245
|
-
const offset = computed("heightIndex") * gap + computed("heightBefore");
|
|
4246
|
-
const styles2 = {
|
|
4247
|
-
position: "absolute",
|
|
4248
|
-
pointerEvents: "auto",
|
|
4249
|
-
"--opacity": "0",
|
|
4250
|
-
"--remove-delay": `${prop("removeDelay")}ms`,
|
|
4251
|
-
"--duration": `${duration}ms`,
|
|
4252
|
-
"--initial-height": `${height}px`,
|
|
4253
|
-
"--offset": `${offset}px`,
|
|
4254
|
-
"--index": prop("index"),
|
|
4255
|
-
"--z-index": computed("zIndex"),
|
|
4256
|
-
"--lift-amount": "calc(var(--lift) * var(--gap))",
|
|
4257
|
-
"--y": "100%",
|
|
4258
|
-
"--x": "0"
|
|
4259
|
-
};
|
|
4260
|
-
const assign = (overrides) => Object.assign(styles2, overrides);
|
|
4261
|
-
if (side === "top") {
|
|
4262
|
-
assign({
|
|
4263
|
-
top: "0",
|
|
4264
|
-
"--sign": "-1",
|
|
4265
|
-
"--y": "-100%",
|
|
4266
|
-
"--lift": "1"
|
|
4267
|
-
});
|
|
4268
|
-
} else if (side === "bottom") {
|
|
4269
|
-
assign({
|
|
4270
|
-
bottom: "0",
|
|
4271
|
-
"--sign": "1",
|
|
4272
|
-
"--y": "100%",
|
|
4273
|
-
"--lift": "-1"
|
|
4274
|
-
});
|
|
4275
|
-
}
|
|
4276
|
-
if (mounted) {
|
|
4277
|
-
assign({
|
|
4278
|
-
"--y": "0",
|
|
4279
|
-
"--opacity": "1"
|
|
4280
|
-
});
|
|
4281
|
-
if (stacked) {
|
|
4282
|
-
assign({
|
|
4283
|
-
"--y": "calc(var(--lift) * var(--offset))",
|
|
4284
|
-
"--height": "var(--initial-height)"
|
|
4285
|
-
});
|
|
4286
|
-
}
|
|
4287
|
-
}
|
|
4288
|
-
if (!visible) {
|
|
4289
|
-
assign({
|
|
4290
|
-
"--opacity": "0",
|
|
4291
|
-
pointerEvents: "none"
|
|
4292
|
-
});
|
|
4293
|
-
}
|
|
4294
|
-
if (sibling && overlap) {
|
|
4295
|
-
assign({
|
|
4296
|
-
"--base-scale": "var(--index) * 0.05 + 1",
|
|
4297
|
-
"--y": "calc(var(--lift-amount) * var(--index))",
|
|
4298
|
-
"--scale": "calc(-1 * var(--base-scale))",
|
|
4299
|
-
"--height": "var(--first-height)"
|
|
4300
|
-
});
|
|
4301
|
-
if (!visible) {
|
|
4302
|
-
assign({
|
|
4303
|
-
"--y": "calc(var(--sign) * 40%)"
|
|
4304
|
-
});
|
|
4108
|
+
const spinnerRecipe = cva({
|
|
4109
|
+
base: {
|
|
4110
|
+
display: "inline-block",
|
|
4111
|
+
borderWidth: "md",
|
|
4112
|
+
borderStyle: "solid",
|
|
4113
|
+
borderStartEndRadius: "full",
|
|
4114
|
+
borderEndStartRadius: "full",
|
|
4115
|
+
borderRadius: "full",
|
|
4116
|
+
animation: "spin",
|
|
4117
|
+
animationDuration: "slowest"
|
|
4118
|
+
},
|
|
4119
|
+
defaultVariants: {
|
|
4120
|
+
size: "md"
|
|
4121
|
+
},
|
|
4122
|
+
variants: {
|
|
4123
|
+
size: {
|
|
4124
|
+
sm: { width: 4, height: 4 },
|
|
4125
|
+
md: { width: 6, height: 6 },
|
|
4126
|
+
lg: { width: 12, height: 12 },
|
|
4127
|
+
xl: { width: 24, height: 24 }
|
|
4305
4128
|
}
|
|
4306
4129
|
}
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
"--y": "calc(var(--lift) * -100%)"
|
|
4315
|
-
});
|
|
4316
|
-
}
|
|
4317
|
-
return styles2;
|
|
4318
|
-
}
|
|
4319
|
-
function getGhostBeforeStyle(service, visible) {
|
|
4320
|
-
const { computed } = service;
|
|
4321
|
-
const styles2 = {
|
|
4322
|
-
position: "absolute",
|
|
4323
|
-
inset: "0",
|
|
4324
|
-
scale: "1 2",
|
|
4325
|
-
pointerEvents: visible ? "none" : "auto"
|
|
4326
|
-
};
|
|
4327
|
-
const assign = (overrides) => Object.assign(styles2, overrides);
|
|
4328
|
-
if (computed("frontmost") && !visible) {
|
|
4329
|
-
assign({
|
|
4330
|
-
height: "calc(var(--initial-height) + 80%)"
|
|
4331
|
-
});
|
|
4332
|
-
}
|
|
4333
|
-
return styles2;
|
|
4334
|
-
}
|
|
4335
|
-
function getGhostAfterStyle() {
|
|
4336
|
-
return {
|
|
4337
|
-
position: "absolute",
|
|
4338
|
-
left: "0",
|
|
4339
|
-
height: "calc(var(--gap) + 2px)",
|
|
4340
|
-
bottom: "100%",
|
|
4341
|
-
width: "100%"
|
|
4342
|
-
};
|
|
4343
|
-
}
|
|
4344
|
-
function groupConnect(service, normalize) {
|
|
4345
|
-
const { context: context2, prop, send, refs, computed } = service;
|
|
4346
|
-
return {
|
|
4347
|
-
getCount() {
|
|
4348
|
-
return context2.get("toasts").length;
|
|
4349
|
-
},
|
|
4350
|
-
getToasts() {
|
|
4351
|
-
return context2.get("toasts");
|
|
4352
|
-
},
|
|
4353
|
-
getGroupProps(options = {}) {
|
|
4354
|
-
const { label = "Notifications" } = options;
|
|
4355
|
-
const { hotkey } = prop("store").attrs;
|
|
4356
|
-
const hotkeyLabel = hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
|
|
4357
|
-
const placement = computed("placement");
|
|
4358
|
-
const [side, align = "center"] = placement.split("-");
|
|
4359
|
-
return normalize.element({
|
|
4360
|
-
...parts.group.attrs,
|
|
4361
|
-
dir: prop("dir"),
|
|
4362
|
-
tabIndex: -1,
|
|
4363
|
-
"aria-label": `${placement} ${label} ${hotkeyLabel}`,
|
|
4364
|
-
id: getRegionId(placement),
|
|
4365
|
-
"data-placement": placement,
|
|
4366
|
-
"data-side": side,
|
|
4367
|
-
"data-align": align,
|
|
4368
|
-
"aria-live": "polite",
|
|
4369
|
-
role: "region",
|
|
4370
|
-
style: getGroupPlacementStyle(service, placement),
|
|
4371
|
-
onMouseMove() {
|
|
4372
|
-
send({ type: "REGION.POINTER_ENTER", placement });
|
|
4373
|
-
},
|
|
4374
|
-
onMouseLeave() {
|
|
4375
|
-
send({ type: "REGION.POINTER_LEAVE", placement });
|
|
4376
|
-
},
|
|
4377
|
-
onFocus(event) {
|
|
4378
|
-
send({ type: "REGION.FOCUS", target: event.relatedTarget });
|
|
4379
|
-
},
|
|
4380
|
-
onBlur(event) {
|
|
4381
|
-
if (refs.get("isFocusWithin") && !contains(event.currentTarget, event.relatedTarget)) {
|
|
4382
|
-
queueMicrotask(() => send({ type: "REGION.BLUR" }));
|
|
4383
|
-
}
|
|
4384
|
-
}
|
|
4385
|
-
});
|
|
4386
|
-
},
|
|
4387
|
-
subscribe(fn) {
|
|
4388
|
-
const store = prop("store");
|
|
4389
|
-
return store.subscribe(() => fn(context2.get("toasts")));
|
|
4390
|
-
}
|
|
4391
|
-
};
|
|
4392
|
-
}
|
|
4393
|
-
var groupMachine = createMachine({
|
|
4394
|
-
props({ props }) {
|
|
4395
|
-
return {
|
|
4396
|
-
dir: "ltr",
|
|
4397
|
-
id: uuid(),
|
|
4130
|
+
});
|
|
4131
|
+
const Spinner = forwardRef((props, ref) => {
|
|
4132
|
+
const StyledSpinner = styled(ark.div, spinnerRecipe);
|
|
4133
|
+
return /* @__PURE__ */ jsx(
|
|
4134
|
+
StyledSpinner,
|
|
4135
|
+
{
|
|
4136
|
+
ref,
|
|
4398
4137
|
...props,
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
},
|
|
4405
|
-
refs() {
|
|
4406
|
-
return {
|
|
4407
|
-
lastFocusedEl: null,
|
|
4408
|
-
isFocusWithin: false,
|
|
4409
|
-
dismissableCleanup: void 0
|
|
4410
|
-
};
|
|
4411
|
-
},
|
|
4412
|
-
context({ bindable }) {
|
|
4413
|
-
return {
|
|
4414
|
-
toasts: bindable(() => ({
|
|
4415
|
-
defaultValue: [],
|
|
4416
|
-
sync: true,
|
|
4417
|
-
hash: (toasts) => toasts.map((t) => t.id).join(",")
|
|
4418
|
-
})),
|
|
4419
|
-
heights: bindable(() => ({
|
|
4420
|
-
defaultValue: [],
|
|
4421
|
-
sync: true
|
|
4422
|
-
}))
|
|
4423
|
-
};
|
|
4424
|
-
},
|
|
4425
|
-
computed: {
|
|
4426
|
-
count: ({ context: context2 }) => context2.get("toasts").length,
|
|
4427
|
-
overlap: ({ prop }) => prop("store").attrs.overlap,
|
|
4428
|
-
placement: ({ prop }) => prop("store").attrs.placement
|
|
4429
|
-
},
|
|
4430
|
-
effects: ["subscribeToStore", "trackDocumentVisibility", "trackHotKeyPress"],
|
|
4431
|
-
watch({ track, context: context2, action }) {
|
|
4432
|
-
track([() => context2.hash("toasts")], () => {
|
|
4433
|
-
queueMicrotask(() => {
|
|
4434
|
-
action(["collapsedIfEmpty", "setDismissableBranch"]);
|
|
4435
|
-
});
|
|
4436
|
-
});
|
|
4437
|
-
},
|
|
4438
|
-
exit: ["clearDismissableBranch", "clearLastFocusedEl"],
|
|
4439
|
-
on: {
|
|
4440
|
-
"DOC.HOTKEY": {
|
|
4441
|
-
actions: ["focusRegionEl"]
|
|
4442
|
-
},
|
|
4443
|
-
"REGION.BLUR": [
|
|
4444
|
-
{
|
|
4445
|
-
guard: "isOverlapping",
|
|
4446
|
-
target: "overlap",
|
|
4447
|
-
actions: ["collapseToasts", "resumeToasts", "restoreLastFocusedEl"]
|
|
4448
|
-
},
|
|
4449
|
-
{
|
|
4450
|
-
target: "stack",
|
|
4451
|
-
actions: ["resumeToasts", "restoreLastFocusedEl"]
|
|
4138
|
+
css: {
|
|
4139
|
+
borderColor: "inherit",
|
|
4140
|
+
borderBottomColor: "transparent",
|
|
4141
|
+
borderLeftColor: "transparent",
|
|
4142
|
+
...props.css
|
|
4452
4143
|
}
|
|
4453
|
-
],
|
|
4454
|
-
"TOAST.REMOVE": {
|
|
4455
|
-
actions: ["removeToast", "removeHeight"]
|
|
4456
|
-
},
|
|
4457
|
-
"TOAST.PAUSE": {
|
|
4458
|
-
actions: ["pauseToasts"]
|
|
4459
4144
|
}
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
}
|
|
4484
|
-
}
|
|
4485
|
-
},
|
|
4486
|
-
overlap: {
|
|
4487
|
-
on: {
|
|
4488
|
-
"REGION.STACK": {
|
|
4489
|
-
target: "stack",
|
|
4490
|
-
actions: ["expandToasts"]
|
|
4491
|
-
},
|
|
4492
|
-
"REGION.POINTER_ENTER": {
|
|
4493
|
-
target: "stack",
|
|
4494
|
-
actions: ["pauseToasts", "expandToasts"]
|
|
4495
|
-
},
|
|
4496
|
-
"REGION.FOCUS": {
|
|
4497
|
-
target: "stack",
|
|
4498
|
-
actions: ["setLastFocusedEl", "pauseToasts", "expandToasts"]
|
|
4499
|
-
}
|
|
4500
|
-
}
|
|
4145
|
+
);
|
|
4146
|
+
});
|
|
4147
|
+
Spinner.displayName = "Spinner";
|
|
4148
|
+
const buttonRecipe = cva({
|
|
4149
|
+
base: {
|
|
4150
|
+
alignItems: "center",
|
|
4151
|
+
appearance: "none",
|
|
4152
|
+
cursor: "pointer",
|
|
4153
|
+
display: "inline-flex",
|
|
4154
|
+
fontWeight: "semibold",
|
|
4155
|
+
isolation: "isolate",
|
|
4156
|
+
minWidth: "0",
|
|
4157
|
+
justifyContent: "center",
|
|
4158
|
+
outline: "none",
|
|
4159
|
+
position: "relative",
|
|
4160
|
+
transitionDuration: "normal",
|
|
4161
|
+
transitionProperty: "background, border-color, color, box-shadow",
|
|
4162
|
+
transitionTimingFunction: "default",
|
|
4163
|
+
userSelect: "none",
|
|
4164
|
+
verticalAlign: "middle",
|
|
4165
|
+
whiteSpace: "nowrap",
|
|
4166
|
+
_hidden: {
|
|
4167
|
+
display: "none"
|
|
4501
4168
|
}
|
|
4502
4169
|
},
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
}
|
|
4519
|
-
return [toast2, ...prev];
|
|
4520
|
-
});
|
|
4521
|
-
});
|
|
4170
|
+
defaultVariants: {
|
|
4171
|
+
variant: "solid",
|
|
4172
|
+
size: "md",
|
|
4173
|
+
radius: "full",
|
|
4174
|
+
color: "neutral"
|
|
4175
|
+
},
|
|
4176
|
+
variants: {
|
|
4177
|
+
variant: {
|
|
4178
|
+
solid: {
|
|
4179
|
+
_disabled: {
|
|
4180
|
+
background: "background.neutral.disabled",
|
|
4181
|
+
color: "content.neutral.disabled",
|
|
4182
|
+
cursor: "not-allowed",
|
|
4183
|
+
pointerEvents: "none"
|
|
4184
|
+
}
|
|
4522
4185
|
},
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4186
|
+
outline: {
|
|
4187
|
+
background: "transparent",
|
|
4188
|
+
borderWidth: "1px",
|
|
4189
|
+
borderStyle: "solid",
|
|
4190
|
+
borderColor: "border.neutral.default",
|
|
4191
|
+
_disabled: {
|
|
4192
|
+
background: "transparent",
|
|
4193
|
+
color: "content.neutral.disabled",
|
|
4194
|
+
borderColor: "border.neutral.disabled",
|
|
4195
|
+
cursor: "not-allowed",
|
|
4196
|
+
pointerEvents: "none"
|
|
4197
|
+
}
|
|
4531
4198
|
},
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
}
|
|
4540
|
-
}
|
|
4541
|
-
},
|
|
4542
|
-
actions: {
|
|
4543
|
-
setDismissableBranch({ refs, context: context2, computed, scope }) {
|
|
4544
|
-
var _a;
|
|
4545
|
-
const toasts = context2.get("toasts");
|
|
4546
|
-
const placement = computed("placement");
|
|
4547
|
-
const hasToasts = toasts.length > 0;
|
|
4548
|
-
if (!hasToasts) {
|
|
4549
|
-
(_a = refs.get("dismissableCleanup")) == null ? void 0 : _a();
|
|
4550
|
-
return;
|
|
4551
|
-
}
|
|
4552
|
-
if (hasToasts && refs.get("dismissableCleanup")) {
|
|
4553
|
-
return;
|
|
4554
|
-
}
|
|
4555
|
-
const groupEl = () => getRegionEl(scope, placement);
|
|
4556
|
-
const cleanup = trackDismissableBranch(groupEl, { defer: true });
|
|
4557
|
-
refs.set("dismissableCleanup", cleanup);
|
|
4558
|
-
},
|
|
4559
|
-
clearDismissableBranch({ refs }) {
|
|
4560
|
-
var _a;
|
|
4561
|
-
(_a = refs.get("dismissableCleanup")) == null ? void 0 : _a();
|
|
4562
|
-
},
|
|
4563
|
-
focusRegionEl({ scope, computed }) {
|
|
4564
|
-
queueMicrotask(() => {
|
|
4565
|
-
var _a;
|
|
4566
|
-
(_a = getRegionEl(scope, computed("placement"))) == null ? void 0 : _a.focus();
|
|
4567
|
-
});
|
|
4568
|
-
},
|
|
4569
|
-
pauseToasts({ prop }) {
|
|
4570
|
-
prop("store").pause();
|
|
4571
|
-
},
|
|
4572
|
-
resumeToasts({ prop }) {
|
|
4573
|
-
prop("store").resume();
|
|
4574
|
-
},
|
|
4575
|
-
expandToasts({ prop }) {
|
|
4576
|
-
prop("store").expand();
|
|
4577
|
-
},
|
|
4578
|
-
collapseToasts({ prop }) {
|
|
4579
|
-
prop("store").collapse();
|
|
4580
|
-
},
|
|
4581
|
-
removeToast({ prop, event }) {
|
|
4582
|
-
prop("store").remove(event.id);
|
|
4583
|
-
},
|
|
4584
|
-
removeHeight({ event, context: context2 }) {
|
|
4585
|
-
if ((event == null ? void 0 : event.id) == null) return;
|
|
4586
|
-
queueMicrotask(() => {
|
|
4587
|
-
context2.set("heights", (heights) => heights.filter((height) => height.id !== event.id));
|
|
4588
|
-
});
|
|
4589
|
-
},
|
|
4590
|
-
collapsedIfEmpty({ send, computed }) {
|
|
4591
|
-
if (!computed("overlap") || computed("count") > 1) return;
|
|
4592
|
-
send({ type: "REGION.OVERLAP" });
|
|
4593
|
-
},
|
|
4594
|
-
setLastFocusedEl({ refs, event }) {
|
|
4595
|
-
if (refs.get("isFocusWithin") || !event.target) return;
|
|
4596
|
-
refs.set("isFocusWithin", true);
|
|
4597
|
-
refs.set("lastFocusedEl", event.target);
|
|
4598
|
-
},
|
|
4599
|
-
restoreLastFocusedEl({ refs }) {
|
|
4600
|
-
var _a;
|
|
4601
|
-
if (!refs.get("lastFocusedEl")) return;
|
|
4602
|
-
(_a = refs.get("lastFocusedEl")) == null ? void 0 : _a.focus({ preventScroll: true });
|
|
4603
|
-
refs.set("lastFocusedEl", null);
|
|
4604
|
-
refs.set("isFocusWithin", false);
|
|
4605
|
-
},
|
|
4606
|
-
clearLastFocusedEl({ refs }) {
|
|
4607
|
-
var _a;
|
|
4608
|
-
if (!refs.get("lastFocusedEl")) return;
|
|
4609
|
-
(_a = refs.get("lastFocusedEl")) == null ? void 0 : _a.focus({ preventScroll: true });
|
|
4610
|
-
refs.set("lastFocusedEl", null);
|
|
4611
|
-
refs.set("isFocusWithin", false);
|
|
4612
|
-
}
|
|
4613
|
-
}
|
|
4614
|
-
}
|
|
4615
|
-
});
|
|
4616
|
-
function connect(service, normalize) {
|
|
4617
|
-
const { state, send, prop, scope, context: context2, computed } = service;
|
|
4618
|
-
const visible = state.hasTag("visible");
|
|
4619
|
-
const paused = state.hasTag("paused");
|
|
4620
|
-
const mounted = context2.get("mounted");
|
|
4621
|
-
const frontmost = computed("frontmost");
|
|
4622
|
-
const placement = prop("parent").computed("placement");
|
|
4623
|
-
const type = prop("type");
|
|
4624
|
-
const stacked = prop("stacked");
|
|
4625
|
-
const title = prop("title");
|
|
4626
|
-
const description = prop("description");
|
|
4627
|
-
const action = prop("action");
|
|
4628
|
-
const [side, align = "center"] = placement.split("-");
|
|
4629
|
-
return {
|
|
4630
|
-
type,
|
|
4631
|
-
title,
|
|
4632
|
-
description,
|
|
4633
|
-
placement,
|
|
4634
|
-
visible,
|
|
4635
|
-
paused,
|
|
4636
|
-
closable: !!prop("closable"),
|
|
4637
|
-
pause() {
|
|
4638
|
-
send({ type: "PAUSE" });
|
|
4639
|
-
},
|
|
4640
|
-
resume() {
|
|
4641
|
-
send({ type: "RESUME" });
|
|
4642
|
-
},
|
|
4643
|
-
dismiss() {
|
|
4644
|
-
send({ type: "DISMISS", src: "programmatic" });
|
|
4645
|
-
},
|
|
4646
|
-
getRootProps() {
|
|
4647
|
-
return normalize.element({
|
|
4648
|
-
...parts.root.attrs,
|
|
4649
|
-
dir: prop("dir"),
|
|
4650
|
-
id: getRootId(scope),
|
|
4651
|
-
"data-state": visible ? "open" : "closed",
|
|
4652
|
-
"data-type": type,
|
|
4653
|
-
"data-placement": placement,
|
|
4654
|
-
"data-align": align,
|
|
4655
|
-
"data-side": side,
|
|
4656
|
-
"data-mounted": dataAttr(mounted),
|
|
4657
|
-
"data-paused": dataAttr(paused),
|
|
4658
|
-
"data-first": dataAttr(frontmost),
|
|
4659
|
-
"data-sibling": dataAttr(!frontmost),
|
|
4660
|
-
"data-stack": dataAttr(stacked),
|
|
4661
|
-
"data-overlap": dataAttr(!stacked),
|
|
4662
|
-
role: "status",
|
|
4663
|
-
"aria-atomic": "true",
|
|
4664
|
-
"aria-describedby": description ? getDescriptionId(scope) : void 0,
|
|
4665
|
-
"aria-labelledby": title ? getTitleId(scope) : void 0,
|
|
4666
|
-
tabIndex: 0,
|
|
4667
|
-
style: getPlacementStyle(service, visible),
|
|
4668
|
-
onKeyDown(event) {
|
|
4669
|
-
if (event.defaultPrevented) return;
|
|
4670
|
-
if (event.key == "Escape") {
|
|
4671
|
-
send({ type: "DISMISS", src: "keyboard" });
|
|
4672
|
-
event.preventDefault();
|
|
4673
|
-
}
|
|
4674
|
-
}
|
|
4675
|
-
});
|
|
4676
|
-
},
|
|
4677
|
-
/* Leave a ghost div to avoid setting hover to false when transitioning out */
|
|
4678
|
-
getGhostBeforeProps() {
|
|
4679
|
-
return normalize.element({
|
|
4680
|
-
"data-ghost": "before",
|
|
4681
|
-
style: getGhostBeforeStyle(service, visible)
|
|
4682
|
-
});
|
|
4683
|
-
},
|
|
4684
|
-
/* Needed to avoid setting hover to false when in between toasts */
|
|
4685
|
-
getGhostAfterProps() {
|
|
4686
|
-
return normalize.element({
|
|
4687
|
-
"data-ghost": "after",
|
|
4688
|
-
style: getGhostAfterStyle()
|
|
4689
|
-
});
|
|
4690
|
-
},
|
|
4691
|
-
getTitleProps() {
|
|
4692
|
-
return normalize.element({
|
|
4693
|
-
...parts.title.attrs,
|
|
4694
|
-
id: getTitleId(scope)
|
|
4695
|
-
});
|
|
4696
|
-
},
|
|
4697
|
-
getDescriptionProps() {
|
|
4698
|
-
return normalize.element({
|
|
4699
|
-
...parts.description.attrs,
|
|
4700
|
-
id: getDescriptionId(scope)
|
|
4701
|
-
});
|
|
4702
|
-
},
|
|
4703
|
-
getActionTriggerProps() {
|
|
4704
|
-
return normalize.button({
|
|
4705
|
-
...parts.actionTrigger.attrs,
|
|
4706
|
-
type: "button",
|
|
4707
|
-
onClick(event) {
|
|
4708
|
-
var _a;
|
|
4709
|
-
if (event.defaultPrevented) return;
|
|
4710
|
-
(_a = action == null ? void 0 : action.onClick) == null ? void 0 : _a.call(action);
|
|
4711
|
-
send({ type: "DISMISS", src: "user" });
|
|
4712
|
-
}
|
|
4713
|
-
});
|
|
4714
|
-
},
|
|
4715
|
-
getCloseTriggerProps() {
|
|
4716
|
-
return normalize.button({
|
|
4717
|
-
id: getCloseTriggerId(scope),
|
|
4718
|
-
...parts.closeTrigger.attrs,
|
|
4719
|
-
type: "button",
|
|
4720
|
-
"aria-label": "Dismiss notification",
|
|
4721
|
-
onClick(event) {
|
|
4722
|
-
if (event.defaultPrevented) return;
|
|
4723
|
-
send({ type: "DISMISS", src: "user" });
|
|
4724
|
-
}
|
|
4725
|
-
});
|
|
4726
|
-
}
|
|
4727
|
-
};
|
|
4728
|
-
}
|
|
4729
|
-
var { not } = createGuards();
|
|
4730
|
-
var machine = createMachine({
|
|
4731
|
-
props({ props }) {
|
|
4732
|
-
ensureProps(props, ["id", "type", "parent", "removeDelay"], "toast");
|
|
4733
|
-
return {
|
|
4734
|
-
closable: true,
|
|
4735
|
-
...props,
|
|
4736
|
-
duration: getToastDuration(props.duration, props.type)
|
|
4737
|
-
};
|
|
4738
|
-
},
|
|
4739
|
-
initialState({ prop }) {
|
|
4740
|
-
const persist = prop("type") === "loading" || prop("duration") === Infinity;
|
|
4741
|
-
return persist ? "visible:persist" : "visible";
|
|
4742
|
-
},
|
|
4743
|
-
context({ prop, bindable }) {
|
|
4744
|
-
return {
|
|
4745
|
-
remainingTime: bindable(() => ({
|
|
4746
|
-
defaultValue: getToastDuration(prop("duration"), prop("type"))
|
|
4747
|
-
})),
|
|
4748
|
-
createdAt: bindable(() => ({
|
|
4749
|
-
defaultValue: Date.now()
|
|
4750
|
-
})),
|
|
4751
|
-
mounted: bindable(() => ({
|
|
4752
|
-
defaultValue: false
|
|
4753
|
-
})),
|
|
4754
|
-
initialHeight: bindable(() => ({
|
|
4755
|
-
defaultValue: 0
|
|
4756
|
-
}))
|
|
4757
|
-
};
|
|
4758
|
-
},
|
|
4759
|
-
refs() {
|
|
4760
|
-
return {
|
|
4761
|
-
closeTimerStartTime: Date.now(),
|
|
4762
|
-
lastCloseStartTimerStartTime: 0
|
|
4763
|
-
};
|
|
4764
|
-
},
|
|
4765
|
-
computed: {
|
|
4766
|
-
zIndex: ({ prop }) => {
|
|
4767
|
-
const toasts = prop("parent").context.get("toasts");
|
|
4768
|
-
const index2 = toasts.findIndex((toast2) => toast2.id === prop("id"));
|
|
4769
|
-
return toasts.length - index2;
|
|
4770
|
-
},
|
|
4771
|
-
height: ({ prop }) => {
|
|
4772
|
-
const heights = prop("parent").context.get("heights");
|
|
4773
|
-
const height = heights.find((height2) => height2.id === prop("id"));
|
|
4774
|
-
return (height == null ? void 0 : height.height) ?? 0;
|
|
4775
|
-
},
|
|
4776
|
-
heightIndex: ({ prop }) => {
|
|
4777
|
-
const heights = prop("parent").context.get("heights");
|
|
4778
|
-
return heights.findIndex((height) => height.id === prop("id"));
|
|
4779
|
-
},
|
|
4780
|
-
frontmost: ({ prop }) => prop("index") === 0,
|
|
4781
|
-
heightBefore: ({ prop }) => {
|
|
4782
|
-
const heights = prop("parent").context.get("heights");
|
|
4783
|
-
const heightIndex = heights.findIndex((height) => height.id === prop("id"));
|
|
4784
|
-
return heights.reduce((prev, curr, reducerIndex) => {
|
|
4785
|
-
if (reducerIndex >= heightIndex) return prev;
|
|
4786
|
-
return prev + curr.height;
|
|
4787
|
-
}, 0);
|
|
4788
|
-
},
|
|
4789
|
-
shouldPersist: ({ prop }) => prop("type") === "loading" || prop("duration") === Infinity
|
|
4790
|
-
},
|
|
4791
|
-
watch({ track, prop, send }) {
|
|
4792
|
-
track([() => prop("message")], () => {
|
|
4793
|
-
const message = prop("message");
|
|
4794
|
-
if (message) send({ type: message, src: "programmatic" });
|
|
4795
|
-
});
|
|
4796
|
-
track([() => prop("type"), () => prop("duration")], () => {
|
|
4797
|
-
send({ type: "UPDATE" });
|
|
4798
|
-
});
|
|
4799
|
-
},
|
|
4800
|
-
on: {
|
|
4801
|
-
UPDATE: [
|
|
4802
|
-
{
|
|
4803
|
-
guard: "shouldPersist",
|
|
4804
|
-
target: "visible:persist",
|
|
4805
|
-
actions: ["resetCloseTimer"]
|
|
4806
|
-
},
|
|
4807
|
-
{
|
|
4808
|
-
target: "visible:updating",
|
|
4809
|
-
actions: ["resetCloseTimer"]
|
|
4810
|
-
}
|
|
4811
|
-
],
|
|
4812
|
-
MEASURE: {
|
|
4813
|
-
actions: ["measureHeight"]
|
|
4814
|
-
}
|
|
4815
|
-
},
|
|
4816
|
-
entry: ["setMounted", "measureHeight", "invokeOnVisible"],
|
|
4817
|
-
effects: ["trackHeight"],
|
|
4818
|
-
states: {
|
|
4819
|
-
"visible:updating": {
|
|
4820
|
-
tags: ["visible", "updating"],
|
|
4821
|
-
effects: ["waitForNextTick"],
|
|
4822
|
-
on: {
|
|
4823
|
-
SHOW: {
|
|
4824
|
-
target: "visible"
|
|
4825
|
-
}
|
|
4826
|
-
}
|
|
4827
|
-
},
|
|
4828
|
-
"visible:persist": {
|
|
4829
|
-
tags: ["visible", "paused"],
|
|
4830
|
-
on: {
|
|
4831
|
-
RESUME: {
|
|
4832
|
-
guard: not("isLoadingType"),
|
|
4833
|
-
target: "visible",
|
|
4834
|
-
actions: ["setCloseTimer"]
|
|
4835
|
-
},
|
|
4836
|
-
DISMISS: {
|
|
4837
|
-
target: "dismissing"
|
|
4838
|
-
}
|
|
4839
|
-
}
|
|
4840
|
-
},
|
|
4841
|
-
visible: {
|
|
4842
|
-
tags: ["visible"],
|
|
4843
|
-
effects: ["waitForDuration"],
|
|
4844
|
-
on: {
|
|
4845
|
-
DISMISS: {
|
|
4846
|
-
target: "dismissing"
|
|
4847
|
-
},
|
|
4848
|
-
PAUSE: {
|
|
4849
|
-
target: "visible:persist",
|
|
4850
|
-
actions: ["syncRemainingTime"]
|
|
4851
|
-
}
|
|
4852
|
-
}
|
|
4853
|
-
},
|
|
4854
|
-
dismissing: {
|
|
4855
|
-
entry: ["invokeOnDismiss"],
|
|
4856
|
-
effects: ["waitForRemoveDelay"],
|
|
4857
|
-
on: {
|
|
4858
|
-
REMOVE: {
|
|
4859
|
-
target: "unmounted",
|
|
4860
|
-
actions: ["notifyParentToRemove"]
|
|
4861
|
-
}
|
|
4862
|
-
}
|
|
4863
|
-
},
|
|
4864
|
-
unmounted: {
|
|
4865
|
-
entry: ["invokeOnUnmount"]
|
|
4866
|
-
}
|
|
4867
|
-
},
|
|
4868
|
-
implementations: {
|
|
4869
|
-
effects: {
|
|
4870
|
-
waitForRemoveDelay({ prop, send }) {
|
|
4871
|
-
return setRafTimeout(() => {
|
|
4872
|
-
send({ type: "REMOVE", src: "timer" });
|
|
4873
|
-
}, prop("removeDelay"));
|
|
4874
|
-
},
|
|
4875
|
-
waitForDuration({ send, context: context2, computed }) {
|
|
4876
|
-
if (computed("shouldPersist")) return;
|
|
4877
|
-
return setRafTimeout(() => {
|
|
4878
|
-
send({ type: "DISMISS", src: "timer" });
|
|
4879
|
-
}, context2.get("remainingTime"));
|
|
4880
|
-
},
|
|
4881
|
-
waitForNextTick({ send }) {
|
|
4882
|
-
return setRafTimeout(() => {
|
|
4883
|
-
send({ type: "SHOW", src: "timer" });
|
|
4884
|
-
}, 0);
|
|
4885
|
-
},
|
|
4886
|
-
trackHeight({ scope, prop }) {
|
|
4887
|
-
let cleanup;
|
|
4888
|
-
raf$1(() => {
|
|
4889
|
-
const rootEl = getRootEl(scope);
|
|
4890
|
-
if (!rootEl) return;
|
|
4891
|
-
const syncHeight = () => {
|
|
4892
|
-
const originalHeight = rootEl.style.height;
|
|
4893
|
-
rootEl.style.height = "auto";
|
|
4894
|
-
const height = rootEl.getBoundingClientRect().height;
|
|
4895
|
-
rootEl.style.height = originalHeight;
|
|
4896
|
-
const item = { id: prop("id"), height };
|
|
4897
|
-
setHeight(prop("parent"), item);
|
|
4898
|
-
};
|
|
4899
|
-
const win = scope.getWin();
|
|
4900
|
-
const observer = new win.MutationObserver(syncHeight);
|
|
4901
|
-
observer.observe(rootEl, {
|
|
4902
|
-
childList: true,
|
|
4903
|
-
subtree: true,
|
|
4904
|
-
characterData: true
|
|
4905
|
-
});
|
|
4906
|
-
cleanup = () => observer.disconnect();
|
|
4907
|
-
});
|
|
4908
|
-
return () => cleanup == null ? void 0 : cleanup();
|
|
4909
|
-
}
|
|
4910
|
-
},
|
|
4911
|
-
guards: {
|
|
4912
|
-
isLoadingType: ({ prop }) => prop("type") === "loading",
|
|
4913
|
-
shouldPersist: ({ computed }) => computed("shouldPersist")
|
|
4914
|
-
},
|
|
4915
|
-
actions: {
|
|
4916
|
-
setMounted({ context: context2 }) {
|
|
4917
|
-
raf$1(() => {
|
|
4918
|
-
context2.set("mounted", true);
|
|
4919
|
-
});
|
|
4920
|
-
},
|
|
4921
|
-
measureHeight({ scope, prop, context: context2 }) {
|
|
4922
|
-
queueMicrotask(() => {
|
|
4923
|
-
const rootEl = getRootEl(scope);
|
|
4924
|
-
if (!rootEl) return;
|
|
4925
|
-
const originalHeight = rootEl.style.height;
|
|
4926
|
-
rootEl.style.height = "auto";
|
|
4927
|
-
const height = rootEl.getBoundingClientRect().height;
|
|
4928
|
-
rootEl.style.height = originalHeight;
|
|
4929
|
-
context2.set("initialHeight", height);
|
|
4930
|
-
const item = { id: prop("id"), height };
|
|
4931
|
-
setHeight(prop("parent"), item);
|
|
4932
|
-
});
|
|
4933
|
-
},
|
|
4934
|
-
setCloseTimer({ refs }) {
|
|
4935
|
-
refs.set("closeTimerStartTime", Date.now());
|
|
4936
|
-
},
|
|
4937
|
-
resetCloseTimer({ context: context2, refs, prop }) {
|
|
4938
|
-
refs.set("closeTimerStartTime", Date.now());
|
|
4939
|
-
context2.set("remainingTime", getToastDuration(prop("duration"), prop("type")));
|
|
4940
|
-
},
|
|
4941
|
-
syncRemainingTime({ context: context2, refs }) {
|
|
4942
|
-
context2.set("remainingTime", (prev) => {
|
|
4943
|
-
const closeTimerStartTime = refs.get("closeTimerStartTime");
|
|
4944
|
-
const elapsedTime = Date.now() - closeTimerStartTime;
|
|
4945
|
-
refs.set("lastCloseStartTimerStartTime", Date.now());
|
|
4946
|
-
return prev - elapsedTime;
|
|
4947
|
-
});
|
|
4948
|
-
},
|
|
4949
|
-
notifyParentToRemove({ prop }) {
|
|
4950
|
-
const parent = prop("parent");
|
|
4951
|
-
parent.send({ type: "TOAST.REMOVE", id: prop("id") });
|
|
4952
|
-
},
|
|
4953
|
-
invokeOnDismiss({ prop, event }) {
|
|
4954
|
-
var _a;
|
|
4955
|
-
(_a = prop("onStatusChange")) == null ? void 0 : _a({ status: "dismissing", src: event.src });
|
|
4956
|
-
},
|
|
4957
|
-
invokeOnUnmount({ prop }) {
|
|
4958
|
-
var _a;
|
|
4959
|
-
(_a = prop("onStatusChange")) == null ? void 0 : _a({ status: "unmounted" });
|
|
4960
|
-
},
|
|
4961
|
-
invokeOnVisible({ prop }) {
|
|
4962
|
-
var _a;
|
|
4963
|
-
(_a = prop("onStatusChange")) == null ? void 0 : _a({ status: "visible" });
|
|
4964
|
-
}
|
|
4965
|
-
}
|
|
4966
|
-
}
|
|
4967
|
-
});
|
|
4968
|
-
function setHeight(parent, item) {
|
|
4969
|
-
const { id: id2, height } = item;
|
|
4970
|
-
parent.context.set("heights", (prev) => {
|
|
4971
|
-
const alreadyExists = prev.find((i) => i.id === id2);
|
|
4972
|
-
if (!alreadyExists) {
|
|
4973
|
-
return [{ id: id2, height }, ...prev];
|
|
4974
|
-
} else {
|
|
4975
|
-
return prev.map((i) => i.id === id2 ? { ...i, height } : i);
|
|
4976
|
-
}
|
|
4977
|
-
});
|
|
4978
|
-
}
|
|
4979
|
-
var withDefaults = (options, defaults2) => {
|
|
4980
|
-
return { ...defaults2, ...options };
|
|
4981
|
-
};
|
|
4982
|
-
function createToastStore(props) {
|
|
4983
|
-
const attrs = withDefaults(props, {
|
|
4984
|
-
placement: "bottom",
|
|
4985
|
-
overlap: false,
|
|
4986
|
-
max: 24,
|
|
4987
|
-
gap: 16,
|
|
4988
|
-
offsets: "1rem",
|
|
4989
|
-
hotkey: ["altKey", "KeyT"],
|
|
4990
|
-
removeDelay: 200,
|
|
4991
|
-
pauseOnPageIdle: true
|
|
4992
|
-
});
|
|
4993
|
-
let subscribers = [];
|
|
4994
|
-
let toasts = [];
|
|
4995
|
-
let dismissedToasts = /* @__PURE__ */ new Set();
|
|
4996
|
-
const subscribe2 = (subscriber) => {
|
|
4997
|
-
subscribers.push(subscriber);
|
|
4998
|
-
return () => {
|
|
4999
|
-
const index2 = subscribers.indexOf(subscriber);
|
|
5000
|
-
subscribers.splice(index2, 1);
|
|
5001
|
-
};
|
|
5002
|
-
};
|
|
5003
|
-
const publish = (data) => {
|
|
5004
|
-
subscribers.forEach((subscriber) => subscriber(data));
|
|
5005
|
-
return data;
|
|
5006
|
-
};
|
|
5007
|
-
const addToast = (data) => {
|
|
5008
|
-
if (toasts.length >= attrs.max) return;
|
|
5009
|
-
publish(data);
|
|
5010
|
-
toasts.unshift(data);
|
|
5011
|
-
};
|
|
5012
|
-
const create = (data) => {
|
|
5013
|
-
const id2 = data.id ?? `toast:${uuid()}`;
|
|
5014
|
-
const exists = toasts.find((toast2) => toast2.id === id2);
|
|
5015
|
-
if (dismissedToasts.has(id2)) dismissedToasts.delete(id2);
|
|
5016
|
-
if (exists) {
|
|
5017
|
-
toasts = toasts.map((toast2) => {
|
|
5018
|
-
if (toast2.id === id2) {
|
|
5019
|
-
return publish({ ...toast2, ...data, id: id2 });
|
|
5020
|
-
}
|
|
5021
|
-
return toast2;
|
|
5022
|
-
});
|
|
5023
|
-
} else {
|
|
5024
|
-
addToast({
|
|
5025
|
-
id: id2,
|
|
5026
|
-
duration: attrs.duration,
|
|
5027
|
-
removeDelay: attrs.removeDelay,
|
|
5028
|
-
type: "info",
|
|
5029
|
-
...data,
|
|
5030
|
-
stacked: !attrs.overlap,
|
|
5031
|
-
gap: attrs.gap
|
|
5032
|
-
});
|
|
5033
|
-
}
|
|
5034
|
-
return id2;
|
|
5035
|
-
};
|
|
5036
|
-
const remove = (id2) => {
|
|
5037
|
-
dismissedToasts.add(id2);
|
|
5038
|
-
if (!id2) {
|
|
5039
|
-
toasts.forEach((toast2) => {
|
|
5040
|
-
subscribers.forEach((subscriber) => subscriber({ id: toast2.id, dismiss: true }));
|
|
5041
|
-
});
|
|
5042
|
-
toasts = [];
|
|
5043
|
-
} else {
|
|
5044
|
-
subscribers.forEach((subscriber) => subscriber({ id: id2, dismiss: true }));
|
|
5045
|
-
toasts = toasts.filter((toast2) => toast2.id !== id2);
|
|
5046
|
-
}
|
|
5047
|
-
return id2;
|
|
5048
|
-
};
|
|
5049
|
-
const error = (data) => {
|
|
5050
|
-
return create({ ...data, type: "error" });
|
|
5051
|
-
};
|
|
5052
|
-
const success = (data) => {
|
|
5053
|
-
return create({ ...data, type: "success" });
|
|
5054
|
-
};
|
|
5055
|
-
const info = (data) => {
|
|
5056
|
-
return create({ ...data, type: "info" });
|
|
5057
|
-
};
|
|
5058
|
-
const warning2 = (data) => {
|
|
5059
|
-
return create({ ...data, type: "warning" });
|
|
5060
|
-
};
|
|
5061
|
-
const loading = (data) => {
|
|
5062
|
-
return create({ ...data, type: "loading" });
|
|
5063
|
-
};
|
|
5064
|
-
const getVisibleToasts = () => {
|
|
5065
|
-
return toasts.filter((toast2) => !dismissedToasts.has(toast2.id));
|
|
5066
|
-
};
|
|
5067
|
-
const getCount = () => {
|
|
5068
|
-
return toasts.length;
|
|
5069
|
-
};
|
|
5070
|
-
const promise = (promise2, options, shared = {}) => {
|
|
5071
|
-
if (!options) return;
|
|
5072
|
-
let id2 = void 0;
|
|
5073
|
-
if (options.loading !== void 0) {
|
|
5074
|
-
id2 = create({
|
|
5075
|
-
...shared,
|
|
5076
|
-
...options.loading,
|
|
5077
|
-
promise: promise2,
|
|
5078
|
-
type: "loading"
|
|
5079
|
-
});
|
|
5080
|
-
}
|
|
5081
|
-
let removable = id2 !== void 0;
|
|
5082
|
-
let result;
|
|
5083
|
-
const prom = runIfFn(promise2).then(async (response) => {
|
|
5084
|
-
result = ["resolve", response];
|
|
5085
|
-
if (isHttpResponse(response) && !response.ok) {
|
|
5086
|
-
removable = false;
|
|
5087
|
-
const errorOptions = runIfFn(options.error, `HTTP Error! status: ${response.status}`);
|
|
5088
|
-
create({ ...shared, ...errorOptions, id: id2, type: "error" });
|
|
5089
|
-
} else if (options.success !== void 0) {
|
|
5090
|
-
removable = false;
|
|
5091
|
-
const successOptions = runIfFn(options.success, response);
|
|
5092
|
-
create({ ...shared, ...successOptions, id: id2, type: "success" });
|
|
5093
|
-
}
|
|
5094
|
-
}).catch(async (error2) => {
|
|
5095
|
-
result = ["reject", error2];
|
|
5096
|
-
if (options.error !== void 0) {
|
|
5097
|
-
removable = false;
|
|
5098
|
-
const errorOptions = runIfFn(options.error, error2);
|
|
5099
|
-
create({ ...shared, ...errorOptions, id: id2, type: "error" });
|
|
5100
|
-
}
|
|
5101
|
-
}).finally(() => {
|
|
5102
|
-
var _a;
|
|
5103
|
-
if (removable) {
|
|
5104
|
-
remove(id2);
|
|
5105
|
-
id2 = void 0;
|
|
5106
|
-
}
|
|
5107
|
-
(_a = options.finally) == null ? void 0 : _a.call(options);
|
|
5108
|
-
});
|
|
5109
|
-
const unwrap = () => new Promise(
|
|
5110
|
-
(resolve, reject) => prom.then(() => result[0] === "reject" ? reject(result[1]) : resolve(result[1])).catch(reject)
|
|
5111
|
-
);
|
|
5112
|
-
return { id: id2, unwrap };
|
|
5113
|
-
};
|
|
5114
|
-
const update = (id2, data) => {
|
|
5115
|
-
return create({ id: id2, ...data });
|
|
5116
|
-
};
|
|
5117
|
-
const pause = (id2) => {
|
|
5118
|
-
if (id2 != null) {
|
|
5119
|
-
toasts = toasts.map((toast2) => {
|
|
5120
|
-
if (toast2.id === id2) return publish({ ...toast2, message: "PAUSE" });
|
|
5121
|
-
return toast2;
|
|
5122
|
-
});
|
|
5123
|
-
} else {
|
|
5124
|
-
toasts = toasts.map((toast2) => publish({ ...toast2, message: "PAUSE" }));
|
|
5125
|
-
}
|
|
5126
|
-
};
|
|
5127
|
-
const resume = (id2) => {
|
|
5128
|
-
if (id2 != null) {
|
|
5129
|
-
toasts = toasts.map((toast2) => {
|
|
5130
|
-
if (toast2.id === id2) return publish({ ...toast2, message: "RESUME" });
|
|
5131
|
-
return toast2;
|
|
5132
|
-
});
|
|
5133
|
-
} else {
|
|
5134
|
-
toasts = toasts.map((toast2) => publish({ ...toast2, message: "RESUME" }));
|
|
5135
|
-
}
|
|
5136
|
-
};
|
|
5137
|
-
const dismiss = (id2) => {
|
|
5138
|
-
if (id2 != null) {
|
|
5139
|
-
toasts = toasts.map((toast2) => {
|
|
5140
|
-
if (toast2.id === id2) return publish({ ...toast2, message: "DISMISS" });
|
|
5141
|
-
return toast2;
|
|
5142
|
-
});
|
|
5143
|
-
} else {
|
|
5144
|
-
toasts = toasts.map((toast2) => publish({ ...toast2, message: "DISMISS" }));
|
|
5145
|
-
}
|
|
5146
|
-
};
|
|
5147
|
-
const isVisible = (id2) => {
|
|
5148
|
-
return !dismissedToasts.has(id2) && !!toasts.find((toast2) => toast2.id === id2);
|
|
5149
|
-
};
|
|
5150
|
-
const isDismissed = (id2) => {
|
|
5151
|
-
return dismissedToasts.has(id2);
|
|
5152
|
-
};
|
|
5153
|
-
const expand = () => {
|
|
5154
|
-
toasts = toasts.map((toast2) => publish({ ...toast2, stacked: true }));
|
|
5155
|
-
};
|
|
5156
|
-
const collapse = () => {
|
|
5157
|
-
toasts = toasts.map((toast2) => publish({ ...toast2, stacked: false }));
|
|
5158
|
-
};
|
|
5159
|
-
return {
|
|
5160
|
-
attrs,
|
|
5161
|
-
subscribe: subscribe2,
|
|
5162
|
-
create,
|
|
5163
|
-
update,
|
|
5164
|
-
remove,
|
|
5165
|
-
dismiss,
|
|
5166
|
-
error,
|
|
5167
|
-
success,
|
|
5168
|
-
info,
|
|
5169
|
-
warning: warning2,
|
|
5170
|
-
loading,
|
|
5171
|
-
getVisibleToasts,
|
|
5172
|
-
getCount,
|
|
5173
|
-
promise,
|
|
5174
|
-
pause,
|
|
5175
|
-
resume,
|
|
5176
|
-
isVisible,
|
|
5177
|
-
isDismissed,
|
|
5178
|
-
expand,
|
|
5179
|
-
collapse
|
|
5180
|
-
};
|
|
5181
|
-
}
|
|
5182
|
-
var isHttpResponse = (data) => {
|
|
5183
|
-
return data && typeof data === "object" && "ok" in data && typeof data.ok === "boolean" && "status" in data && typeof data.status === "number";
|
|
5184
|
-
};
|
|
5185
|
-
var group = {
|
|
5186
|
-
connect: groupConnect,
|
|
5187
|
-
machine: groupMachine
|
|
5188
|
-
};
|
|
5189
|
-
const createToaster = (props) => {
|
|
5190
|
-
return createToastStore(props);
|
|
5191
|
-
};
|
|
5192
|
-
const [ToastProvider$1, useToastContext] = createContext({
|
|
5193
|
-
name: "ToastContext",
|
|
5194
|
-
hookName: "useToastContext",
|
|
5195
|
-
providerName: "<ToastProvider />"
|
|
5196
|
-
});
|
|
5197
|
-
const ToastActionTrigger = forwardRef((props, ref) => {
|
|
5198
|
-
const toast2 = useToastContext();
|
|
5199
|
-
const mergedProps = mergeProps(toast2.getActionTriggerProps(), props);
|
|
5200
|
-
return /* @__PURE__ */ jsx(ark.button, { ...mergedProps, ref });
|
|
5201
|
-
});
|
|
5202
|
-
ToastActionTrigger.displayName = "ToastActionTrigger";
|
|
5203
|
-
const ToastDescription = forwardRef((props, ref) => {
|
|
5204
|
-
const toast2 = useToastContext();
|
|
5205
|
-
const mergedProps = mergeProps(toast2.getDescriptionProps(), props);
|
|
5206
|
-
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref });
|
|
5207
|
-
});
|
|
5208
|
-
ToastDescription.displayName = "ToastDescription";
|
|
5209
|
-
const ToastRoot = forwardRef((props, ref) => {
|
|
5210
|
-
const toast2 = useToastContext();
|
|
5211
|
-
const mergedProps = mergeProps(toast2.getRootProps(), props);
|
|
5212
|
-
return /* @__PURE__ */ jsxs("div", { ...mergedProps, ref, children: [
|
|
5213
|
-
/* @__PURE__ */ jsx("div", { ...toast2.getGhostBeforeProps() }),
|
|
5214
|
-
props.children,
|
|
5215
|
-
/* @__PURE__ */ jsx("div", { ...toast2.getGhostAfterProps() })
|
|
5216
|
-
] });
|
|
5217
|
-
});
|
|
5218
|
-
ToastRoot.displayName = "ToastRoot";
|
|
5219
|
-
const Toaster = forwardRef((props, ref) => {
|
|
5220
|
-
const { toaster, children, ...localProps } = props;
|
|
5221
|
-
const locale = useLocaleContext();
|
|
5222
|
-
const env = useEnvironmentContext();
|
|
5223
|
-
const service = useMachine(group.machine, {
|
|
5224
|
-
store: toaster,
|
|
5225
|
-
id: useId(),
|
|
5226
|
-
dir: locale == null ? void 0 : locale.dir,
|
|
5227
|
-
getRootNode: () => env == null ? void 0 : env.getDocument()
|
|
5228
|
-
});
|
|
5229
|
-
const api = group.connect(service, normalizeProps);
|
|
5230
|
-
const mergedProps = mergeProps(api.getGroupProps(), localProps);
|
|
5231
|
-
return /* @__PURE__ */ jsx(ark.div, { ...mergedProps, ref, children: api.getToasts().map((toast2, index2) => /* @__PURE__ */ jsx(ToastActor, { value: toast2, parent: service, index: index2, children: (ctx) => children(ctx) }, toast2.id)) });
|
|
5232
|
-
});
|
|
5233
|
-
Toaster.displayName = "Toaster";
|
|
5234
|
-
const ToastActor = (props) => {
|
|
5235
|
-
const localProps = {
|
|
5236
|
-
...props.value,
|
|
5237
|
-
parent: props.parent,
|
|
5238
|
-
index: props.index
|
|
5239
|
-
};
|
|
5240
|
-
const service = useMachine(machine, { ...localProps });
|
|
5241
|
-
const api = connect(service, normalizeProps);
|
|
5242
|
-
return /* @__PURE__ */ jsx(ToastProvider$1, { value: api, children: props.children(props.value) });
|
|
5243
|
-
};
|
|
5244
|
-
ToastActor.displayName = "ToastActor";
|
|
5245
|
-
const spinnerRecipe = cva({
|
|
5246
|
-
base: {
|
|
5247
|
-
display: "inline-block",
|
|
5248
|
-
borderWidth: "md",
|
|
5249
|
-
borderStyle: "solid",
|
|
5250
|
-
borderStartEndRadius: "full",
|
|
5251
|
-
borderEndStartRadius: "full",
|
|
5252
|
-
borderRadius: "full",
|
|
5253
|
-
animation: "spin",
|
|
5254
|
-
animationDuration: "slowest"
|
|
5255
|
-
},
|
|
5256
|
-
defaultVariants: {
|
|
5257
|
-
size: "md"
|
|
5258
|
-
},
|
|
5259
|
-
variants: {
|
|
5260
|
-
size: {
|
|
5261
|
-
sm: { width: 4, height: 4 },
|
|
5262
|
-
md: { width: 6, height: 6 },
|
|
5263
|
-
lg: { width: 12, height: 12 },
|
|
5264
|
-
xl: { width: 24, height: 24 }
|
|
5265
|
-
}
|
|
5266
|
-
}
|
|
5267
|
-
});
|
|
5268
|
-
const Spinner = forwardRef((props, ref) => {
|
|
5269
|
-
const StyledSpinner = styled(ark.div, spinnerRecipe);
|
|
5270
|
-
return /* @__PURE__ */ jsx(
|
|
5271
|
-
StyledSpinner,
|
|
5272
|
-
{
|
|
5273
|
-
ref,
|
|
5274
|
-
...props,
|
|
5275
|
-
css: {
|
|
5276
|
-
borderColor: "inherit",
|
|
5277
|
-
borderBottomColor: "transparent",
|
|
5278
|
-
borderLeftColor: "transparent",
|
|
5279
|
-
...props.css
|
|
5280
|
-
}
|
|
5281
|
-
}
|
|
5282
|
-
);
|
|
5283
|
-
});
|
|
5284
|
-
Spinner.displayName = "Spinner";
|
|
5285
|
-
const buttonRecipe = cva({
|
|
5286
|
-
base: {
|
|
5287
|
-
alignItems: "center",
|
|
5288
|
-
appearance: "none",
|
|
5289
|
-
cursor: "pointer",
|
|
5290
|
-
display: "inline-flex",
|
|
5291
|
-
fontWeight: "semibold",
|
|
5292
|
-
isolation: "isolate",
|
|
5293
|
-
minWidth: "0",
|
|
5294
|
-
justifyContent: "center",
|
|
5295
|
-
outline: "none",
|
|
5296
|
-
position: "relative",
|
|
5297
|
-
transitionDuration: "normal",
|
|
5298
|
-
transitionProperty: "background, border-color, color, box-shadow",
|
|
5299
|
-
transitionTimingFunction: "default",
|
|
5300
|
-
userSelect: "none",
|
|
5301
|
-
verticalAlign: "middle",
|
|
5302
|
-
whiteSpace: "nowrap",
|
|
5303
|
-
_hidden: {
|
|
5304
|
-
display: "none"
|
|
5305
|
-
}
|
|
5306
|
-
},
|
|
5307
|
-
defaultVariants: {
|
|
5308
|
-
variant: "solid",
|
|
5309
|
-
size: "md",
|
|
5310
|
-
radius: "full",
|
|
5311
|
-
color: "neutral"
|
|
5312
|
-
},
|
|
5313
|
-
variants: {
|
|
5314
|
-
variant: {
|
|
5315
|
-
solid: {
|
|
5316
|
-
_disabled: {
|
|
5317
|
-
background: "background.neutral.disabled",
|
|
5318
|
-
color: "content.neutral.disabled",
|
|
5319
|
-
cursor: "not-allowed",
|
|
5320
|
-
pointerEvents: "none"
|
|
5321
|
-
}
|
|
5322
|
-
},
|
|
5323
|
-
outline: {
|
|
5324
|
-
background: "transparent",
|
|
5325
|
-
borderWidth: "1px",
|
|
5326
|
-
borderStyle: "solid",
|
|
5327
|
-
borderColor: "border.neutral.default",
|
|
5328
|
-
_disabled: {
|
|
5329
|
-
background: "transparent",
|
|
5330
|
-
color: "content.neutral.disabled",
|
|
5331
|
-
borderColor: "border.neutral.disabled",
|
|
5332
|
-
cursor: "not-allowed",
|
|
5333
|
-
pointerEvents: "none"
|
|
5334
|
-
}
|
|
5335
|
-
},
|
|
5336
|
-
light: {
|
|
5337
|
-
background: "transparent",
|
|
5338
|
-
_disabled: {
|
|
5339
|
-
background: "transparent",
|
|
5340
|
-
color: "content.neutral.disabled",
|
|
5341
|
-
cursor: "not-allowed",
|
|
5342
|
-
pointerEvents: "none"
|
|
5343
|
-
}
|
|
4199
|
+
light: {
|
|
4200
|
+
background: "transparent",
|
|
4201
|
+
_disabled: {
|
|
4202
|
+
background: "transparent",
|
|
4203
|
+
color: "content.neutral.disabled",
|
|
4204
|
+
cursor: "not-allowed",
|
|
4205
|
+
pointerEvents: "none"
|
|
4206
|
+
}
|
|
5344
4207
|
}
|
|
5345
4208
|
},
|
|
5346
4209
|
color: {
|
|
@@ -5858,7 +4721,7 @@ const createStyleContext = (recipe) => {
|
|
|
5858
4721
|
};
|
|
5859
4722
|
return StyledComponent;
|
|
5860
4723
|
};
|
|
5861
|
-
const
|
|
4724
|
+
const withProvider = (Component2, slot, options) => {
|
|
5862
4725
|
const StyledComponent = styled(
|
|
5863
4726
|
Component2,
|
|
5864
4727
|
{},
|
|
@@ -5885,13 +4748,13 @@ const createStyleContext = (recipe) => {
|
|
|
5885
4748
|
};
|
|
5886
4749
|
return {
|
|
5887
4750
|
withRootProvider: withRootProvider2,
|
|
5888
|
-
withProvider
|
|
4751
|
+
withProvider,
|
|
5889
4752
|
withContext: withContext2
|
|
5890
4753
|
};
|
|
5891
4754
|
};
|
|
5892
4755
|
const dialogRecipe = sva({
|
|
5893
4756
|
className: "dialog",
|
|
5894
|
-
slots: [...anatomy$
|
|
4757
|
+
slots: [...anatomy$1.keys(), "header", "footer", "body"],
|
|
5895
4758
|
base: {
|
|
5896
4759
|
backdrop: {
|
|
5897
4760
|
backdropFilter: "blur(3px)",
|
|
@@ -5920,7 +4783,7 @@ const dialogRecipe = sva({
|
|
|
5920
4783
|
top: "0",
|
|
5921
4784
|
width: "100vw",
|
|
5922
4785
|
height: "100vh",
|
|
5923
|
-
zIndex: "
|
|
4786
|
+
zIndex: "popover",
|
|
5924
4787
|
p: "4"
|
|
5925
4788
|
},
|
|
5926
4789
|
content: {
|
|
@@ -5974,16 +4837,16 @@ const dialogRecipe = sva({
|
|
|
5974
4837
|
}
|
|
5975
4838
|
}
|
|
5976
4839
|
});
|
|
5977
|
-
const { withRootProvider: withRootProvider$2, withContext: withContext$
|
|
4840
|
+
const { withRootProvider: withRootProvider$2, withContext: withContext$2 } = createStyleContext(dialogRecipe);
|
|
5978
4841
|
const Root$3 = withRootProvider$2(DialogRoot);
|
|
5979
|
-
const Backdrop$1 = withContext$
|
|
5980
|
-
const Trigger$2 = withContext$
|
|
5981
|
-
const Content$3 = withContext$
|
|
5982
|
-
const Title = withContext$
|
|
5983
|
-
const Description$1 = withContext$
|
|
5984
|
-
const Positioner = withContext$
|
|
5985
|
-
const Header$1 = withContext$
|
|
5986
|
-
const Footer = withContext$
|
|
4842
|
+
const Backdrop$1 = withContext$2(DialogBackdrop, "backdrop");
|
|
4843
|
+
const Trigger$2 = withContext$2(DialogTrigger, "trigger");
|
|
4844
|
+
const Content$3 = withContext$2(DialogContent, "content");
|
|
4845
|
+
const Title = withContext$2(DialogTitle, "title");
|
|
4846
|
+
const Description$1 = withContext$2(DialogDescription, "description");
|
|
4847
|
+
const Positioner = withContext$2(DialogPositioner, "positioner");
|
|
4848
|
+
const Header$1 = withContext$2(ark.header, "header");
|
|
4849
|
+
const Footer = withContext$2(
|
|
5987
4850
|
({ orientation = "horizontal", className, ...props }) => {
|
|
5988
4851
|
return /* @__PURE__ */ jsx(
|
|
5989
4852
|
ark.footer,
|
|
@@ -6001,8 +4864,8 @@ const Footer = withContext$3(
|
|
|
6001
4864
|
},
|
|
6002
4865
|
"footer"
|
|
6003
4866
|
);
|
|
6004
|
-
const Body = withContext$
|
|
6005
|
-
const CloseTrigger = withContext$
|
|
4867
|
+
const Body = withContext$2(ark.main, "body");
|
|
4868
|
+
const CloseTrigger = withContext$2(DialogCloseTrigger, "closeTrigger");
|
|
6006
4869
|
const Dialog = {
|
|
6007
4870
|
Root: Root$3,
|
|
6008
4871
|
Backdrop: Backdrop$1,
|
|
@@ -6216,7 +5079,7 @@ const isBrowser = typeof window !== "undefined";
|
|
|
6216
5079
|
const useIsomorphicLayoutEffect$1 = isBrowser ? useLayoutEffect : useEffect;
|
|
6217
5080
|
const PresenceContext = /* @__PURE__ */ createContext$1(null);
|
|
6218
5081
|
const MotionConfigContext = createContext$1({
|
|
6219
|
-
transformPagePoint: (
|
|
5082
|
+
transformPagePoint: (p2) => p2,
|
|
6220
5083
|
isStatic: false,
|
|
6221
5084
|
reducedMotion: "never"
|
|
6222
5085
|
});
|
|
@@ -6259,7 +5122,7 @@ function PopChild({ children, isPresent, anchorX }) {
|
|
|
6259
5122
|
const { width, height, top, left, right } = size.current;
|
|
6260
5123
|
if (isPresent || !ref.current || !width || !height)
|
|
6261
5124
|
return;
|
|
6262
|
-
const
|
|
5125
|
+
const x2 = anchorX === "left" ? `left: ${left}` : `right: ${right}`;
|
|
6263
5126
|
ref.current.dataset.motionPopId = id2;
|
|
6264
5127
|
const style = document.createElement("style");
|
|
6265
5128
|
if (nonce)
|
|
@@ -6271,7 +5134,7 @@ function PopChild({ children, isPresent, anchorX }) {
|
|
|
6271
5134
|
position: absolute !important;
|
|
6272
5135
|
width: ${width}px !important;
|
|
6273
5136
|
height: ${height}px !important;
|
|
6274
|
-
${
|
|
5137
|
+
${x2}px !important;
|
|
6275
5138
|
top: ${top}px !important;
|
|
6276
5139
|
}
|
|
6277
5140
|
`);
|
|
@@ -6313,7 +5176,7 @@ const PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, p
|
|
|
6313
5176
|
presenceAffectsLayout ? [Math.random(), memoizedOnExitComplete] : [isPresent, memoizedOnExitComplete]
|
|
6314
5177
|
);
|
|
6315
5178
|
useMemo(() => {
|
|
6316
|
-
presenceChildren.forEach((
|
|
5179
|
+
presenceChildren.forEach((_2, key) => presenceChildren.set(key, false));
|
|
6317
5180
|
}, [isPresent]);
|
|
6318
5181
|
React.useEffect(() => {
|
|
6319
5182
|
!isPresent && !presenceChildren.size && onExitComplete && onExitComplete();
|
|
@@ -6361,8 +5224,8 @@ const AnimatePresence = ({ children, custom, initial = true, onExitComplete, pre
|
|
|
6361
5224
|
useIsomorphicLayoutEffect$1(() => {
|
|
6362
5225
|
isInitialRender.current = false;
|
|
6363
5226
|
pendingPresentChildren.current = presentChildren;
|
|
6364
|
-
for (let
|
|
6365
|
-
const key = getChildKey(renderedChildren[
|
|
5227
|
+
for (let i2 = 0; i2 < renderedChildren.length; i2++) {
|
|
5228
|
+
const key = getChildKey(renderedChildren[i2]);
|
|
6366
5229
|
if (!presentKeys.includes(key)) {
|
|
6367
5230
|
if (exitComplete.get(key) !== true) {
|
|
6368
5231
|
exitComplete.set(key, false);
|
|
@@ -6375,11 +5238,11 @@ const AnimatePresence = ({ children, custom, initial = true, onExitComplete, pre
|
|
|
6375
5238
|
const exitingChildren = [];
|
|
6376
5239
|
if (presentChildren !== diffedChildren) {
|
|
6377
5240
|
let nextChildren = [...presentChildren];
|
|
6378
|
-
for (let
|
|
6379
|
-
const child = renderedChildren[
|
|
5241
|
+
for (let i2 = 0; i2 < renderedChildren.length; i2++) {
|
|
5242
|
+
const child = renderedChildren[i2];
|
|
6380
5243
|
const key = getChildKey(child);
|
|
6381
5244
|
if (!presentKeys.includes(key)) {
|
|
6382
|
-
nextChildren.splice(
|
|
5245
|
+
nextChildren.splice(i2, 0, child);
|
|
6383
5246
|
exitingChildren.push(child);
|
|
6384
5247
|
}
|
|
6385
5248
|
}
|
|
@@ -6564,8 +5427,8 @@ function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
|
|
|
6564
5427
|
return acc;
|
|
6565
5428
|
}, {});
|
|
6566
5429
|
const cancel = (process2) => {
|
|
6567
|
-
for (let
|
|
6568
|
-
steps[stepsOrder[
|
|
5430
|
+
for (let i2 = 0; i2 < stepsOrder.length; i2++) {
|
|
5431
|
+
steps[stepsOrder[i2]].cancel(process2);
|
|
6569
5432
|
}
|
|
6570
5433
|
};
|
|
6571
5434
|
return { schedule, cancel, state, steps };
|
|
@@ -7073,8 +5936,8 @@ const numTransforms = transformPropOrder.length;
|
|
|
7073
5936
|
function buildTransform(latestValues, transform2, transformTemplate) {
|
|
7074
5937
|
let transformString = "";
|
|
7075
5938
|
let transformIsDefault = true;
|
|
7076
|
-
for (let
|
|
7077
|
-
const key = transformPropOrder[
|
|
5939
|
+
for (let i2 = 0; i2 < numTransforms; i2++) {
|
|
5940
|
+
const key = transformPropOrder[i2];
|
|
7078
5941
|
const value = latestValues[key];
|
|
7079
5942
|
if (value === void 0)
|
|
7080
5943
|
continue;
|
|
@@ -7403,8 +6266,8 @@ function makeLatestValues(props, context2, presenceContext, scrapeMotionValues)
|
|
|
7403
6266
|
const variantToSet = isInitialAnimationBlocked ? animate2 : initial;
|
|
7404
6267
|
if (variantToSet && typeof variantToSet !== "boolean" && !isAnimationControls(variantToSet)) {
|
|
7405
6268
|
const list = Array.isArray(variantToSet) ? variantToSet : [variantToSet];
|
|
7406
|
-
for (let
|
|
7407
|
-
const resolved = resolveVariantFromProps(props, list[
|
|
6269
|
+
for (let i2 = 0; i2 < list.length; i2++) {
|
|
6270
|
+
const resolved = resolveVariantFromProps(props, list[i2]);
|
|
7408
6271
|
if (resolved) {
|
|
7409
6272
|
const { transitionEnd, transition, ...target } = resolved;
|
|
7410
6273
|
for (const key in target) {
|
|
@@ -7445,7 +6308,7 @@ const htmlMotionConfig = {
|
|
|
7445
6308
|
function updateSVGDimensions(instance, renderState) {
|
|
7446
6309
|
try {
|
|
7447
6310
|
renderState.dimensions = typeof instance.getBBox === "function" ? instance.getBBox() : instance.getBoundingClientRect();
|
|
7448
|
-
} catch (
|
|
6311
|
+
} catch (e2) {
|
|
7449
6312
|
renderState.dimensions = {
|
|
7450
6313
|
x: 0,
|
|
7451
6314
|
y: 0,
|
|
@@ -7522,8 +6385,8 @@ const svgMotionConfig = {
|
|
|
7522
6385
|
return;
|
|
7523
6386
|
let needsMeasure = !prevProps;
|
|
7524
6387
|
if (prevProps) {
|
|
7525
|
-
for (let
|
|
7526
|
-
const key = layoutProps[
|
|
6388
|
+
for (let i2 = 0; i2 < layoutProps.length; i2++) {
|
|
6389
|
+
const key = layoutProps[i2];
|
|
7527
6390
|
if (props[key] !== prevProps[key]) {
|
|
7528
6391
|
needsMeasure = true;
|
|
7529
6392
|
}
|
|
@@ -7587,16 +6450,16 @@ class SubscriptionManager {
|
|
|
7587
6450
|
addUniqueItem(this.subscriptions, handler);
|
|
7588
6451
|
return () => removeItem(this.subscriptions, handler);
|
|
7589
6452
|
}
|
|
7590
|
-
notify(
|
|
6453
|
+
notify(a2, b2, c2) {
|
|
7591
6454
|
const numSubscriptions = this.subscriptions.length;
|
|
7592
6455
|
if (!numSubscriptions)
|
|
7593
6456
|
return;
|
|
7594
6457
|
if (numSubscriptions === 1) {
|
|
7595
|
-
this.subscriptions[0](
|
|
6458
|
+
this.subscriptions[0](a2, b2, c2);
|
|
7596
6459
|
} else {
|
|
7597
|
-
for (let
|
|
7598
|
-
const handler = this.subscriptions[
|
|
7599
|
-
handler && handler(
|
|
6460
|
+
for (let i2 = 0; i2 < numSubscriptions; i2++) {
|
|
6461
|
+
const handler = this.subscriptions[i2];
|
|
6462
|
+
handler && handler(a2, b2, c2);
|
|
7600
6463
|
}
|
|
7601
6464
|
}
|
|
7602
6465
|
}
|
|
@@ -7947,8 +6810,8 @@ class GroupAnimation {
|
|
|
7947
6810
|
return this.animations[0][propName];
|
|
7948
6811
|
}
|
|
7949
6812
|
setAll(propName, newValue) {
|
|
7950
|
-
for (let
|
|
7951
|
-
this.animations[
|
|
6813
|
+
for (let i2 = 0; i2 < this.animations.length; i2++) {
|
|
6814
|
+
this.animations[i2][propName] = newValue;
|
|
7952
6815
|
}
|
|
7953
6816
|
}
|
|
7954
6817
|
attachTimeline(timeline, fallback) {
|
|
@@ -7960,9 +6823,9 @@ class GroupAnimation {
|
|
|
7960
6823
|
}
|
|
7961
6824
|
});
|
|
7962
6825
|
return () => {
|
|
7963
|
-
subscriptions.forEach((cancel,
|
|
6826
|
+
subscriptions.forEach((cancel, i2) => {
|
|
7964
6827
|
cancel && cancel();
|
|
7965
|
-
this.animations[
|
|
6828
|
+
this.animations[i2].stop();
|
|
7966
6829
|
});
|
|
7967
6830
|
};
|
|
7968
6831
|
}
|
|
@@ -7983,8 +6846,8 @@ class GroupAnimation {
|
|
|
7983
6846
|
}
|
|
7984
6847
|
get duration() {
|
|
7985
6848
|
let max = 0;
|
|
7986
|
-
for (let
|
|
7987
|
-
max = Math.max(max, this.animations[
|
|
6849
|
+
for (let i2 = 0; i2 < this.animations.length; i2++) {
|
|
6850
|
+
max = Math.max(max, this.animations[i2].duration);
|
|
7988
6851
|
}
|
|
7989
6852
|
return max;
|
|
7990
6853
|
}
|
|
@@ -8022,7 +6885,7 @@ function memoSupports(callback, supportsFlag) {
|
|
|
8022
6885
|
const supportsLinearEasing = /* @__PURE__ */ memoSupports(() => {
|
|
8023
6886
|
try {
|
|
8024
6887
|
document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
|
|
8025
|
-
} catch (
|
|
6888
|
+
} catch (e2) {
|
|
8026
6889
|
return false;
|
|
8027
6890
|
}
|
|
8028
6891
|
return true;
|
|
@@ -8030,12 +6893,12 @@ const supportsLinearEasing = /* @__PURE__ */ memoSupports(() => {
|
|
|
8030
6893
|
const generateLinearEasing = (easing, duration, resolution = 10) => {
|
|
8031
6894
|
let points = "";
|
|
8032
6895
|
const numPoints = Math.max(Math.round(duration / resolution), 2);
|
|
8033
|
-
for (let
|
|
8034
|
-
points += easing(
|
|
6896
|
+
for (let i2 = 0; i2 < numPoints; i2++) {
|
|
6897
|
+
points += easing(i2 / (numPoints - 1)) + ", ";
|
|
8035
6898
|
}
|
|
8036
6899
|
return `linear(${points.substring(0, points.length - 2)})`;
|
|
8037
6900
|
};
|
|
8038
|
-
const cubicBezierAsString = ([
|
|
6901
|
+
const cubicBezierAsString = ([a2, b2, c2, d2]) => `cubic-bezier(${a2}, ${b2}, ${c2}, ${d2})`;
|
|
8039
6902
|
const supportedWaapiEasing = {
|
|
8040
6903
|
linear: "linear",
|
|
8041
6904
|
ease: "ease",
|
|
@@ -8090,37 +6953,37 @@ function attachTimeline(animation, timeline) {
|
|
|
8090
6953
|
animation.timeline = timeline;
|
|
8091
6954
|
animation.onfinish = null;
|
|
8092
6955
|
}
|
|
8093
|
-
const calcBezier = (
|
|
6956
|
+
const calcBezier = (t2, a1, a2) => (((1 - 3 * a2 + 3 * a1) * t2 + (3 * a2 - 6 * a1)) * t2 + 3 * a1) * t2;
|
|
8094
6957
|
const subdivisionPrecision = 1e-7;
|
|
8095
6958
|
const subdivisionMaxIterations = 12;
|
|
8096
|
-
function binarySubdivide(
|
|
6959
|
+
function binarySubdivide(x2, lowerBound, upperBound, mX1, mX2) {
|
|
8097
6960
|
let currentX;
|
|
8098
6961
|
let currentT;
|
|
8099
|
-
let
|
|
6962
|
+
let i2 = 0;
|
|
8100
6963
|
do {
|
|
8101
6964
|
currentT = lowerBound + (upperBound - lowerBound) / 2;
|
|
8102
|
-
currentX = calcBezier(currentT, mX1, mX2) -
|
|
6965
|
+
currentX = calcBezier(currentT, mX1, mX2) - x2;
|
|
8103
6966
|
if (currentX > 0) {
|
|
8104
6967
|
upperBound = currentT;
|
|
8105
6968
|
} else {
|
|
8106
6969
|
lowerBound = currentT;
|
|
8107
6970
|
}
|
|
8108
|
-
} while (Math.abs(currentX) > subdivisionPrecision && ++
|
|
6971
|
+
} while (Math.abs(currentX) > subdivisionPrecision && ++i2 < subdivisionMaxIterations);
|
|
8109
6972
|
return currentT;
|
|
8110
6973
|
}
|
|
8111
6974
|
function cubicBezier(mX1, mY1, mX2, mY2) {
|
|
8112
6975
|
if (mX1 === mY1 && mX2 === mY2)
|
|
8113
6976
|
return noop;
|
|
8114
6977
|
const getTForX = (aX) => binarySubdivide(aX, 0, 1, mX1, mX2);
|
|
8115
|
-
return (
|
|
6978
|
+
return (t2) => t2 === 0 || t2 === 1 ? t2 : calcBezier(getTForX(t2), mY1, mY2);
|
|
8116
6979
|
}
|
|
8117
|
-
const mirrorEasing = (easing) => (
|
|
8118
|
-
const reverseEasing = (easing) => (
|
|
6980
|
+
const mirrorEasing = (easing) => (p2) => p2 <= 0.5 ? easing(2 * p2) / 2 : (2 - easing(2 * (1 - p2))) / 2;
|
|
6981
|
+
const reverseEasing = (easing) => (p2) => 1 - easing(1 - p2);
|
|
8119
6982
|
const backOut = /* @__PURE__ */ cubicBezier(0.33, 1.53, 0.69, 0.99);
|
|
8120
6983
|
const backIn = /* @__PURE__ */ reverseEasing(backOut);
|
|
8121
6984
|
const backInOut = /* @__PURE__ */ mirrorEasing(backIn);
|
|
8122
|
-
const anticipate = (
|
|
8123
|
-
const circIn = (
|
|
6985
|
+
const anticipate = (p2) => (p2 *= 2) < 1 ? 0.5 * backIn(p2) : 0.5 * (2 - Math.pow(2, -10 * (p2 - 1)));
|
|
6986
|
+
const circIn = (p2) => 1 - Math.sin(Math.acos(p2));
|
|
8124
6987
|
const circOut = reverseEasing(circIn);
|
|
8125
6988
|
const circInOut = mirrorEasing(circIn);
|
|
8126
6989
|
const isZeroValueString = (v2) => /^0[^.\s]+$/u.test(v2);
|
|
@@ -8145,11 +7008,11 @@ const isColorString = (type, testProp) => (v2) => {
|
|
|
8145
7008
|
const splitColor = (aName, bName, cName) => (v2) => {
|
|
8146
7009
|
if (typeof v2 !== "string")
|
|
8147
7010
|
return v2;
|
|
8148
|
-
const [
|
|
7011
|
+
const [a2, b2, c2, alpha2] = v2.match(floatRegex);
|
|
8149
7012
|
return {
|
|
8150
|
-
[aName]: parseFloat(
|
|
8151
|
-
[bName]: parseFloat(
|
|
8152
|
-
[cName]: parseFloat(
|
|
7013
|
+
[aName]: parseFloat(a2),
|
|
7014
|
+
[bName]: parseFloat(b2),
|
|
7015
|
+
[cName]: parseFloat(c2),
|
|
8153
7016
|
alpha: alpha2 !== void 0 ? parseFloat(alpha2) : 1
|
|
8154
7017
|
};
|
|
8155
7018
|
};
|
|
@@ -8166,28 +7029,28 @@ const rgba = {
|
|
|
8166
7029
|
function parseHex(v2) {
|
|
8167
7030
|
let r = "";
|
|
8168
7031
|
let g2 = "";
|
|
8169
|
-
let
|
|
8170
|
-
let
|
|
7032
|
+
let b2 = "";
|
|
7033
|
+
let a2 = "";
|
|
8171
7034
|
if (v2.length > 5) {
|
|
8172
7035
|
r = v2.substring(1, 3);
|
|
8173
7036
|
g2 = v2.substring(3, 5);
|
|
8174
|
-
|
|
8175
|
-
|
|
7037
|
+
b2 = v2.substring(5, 7);
|
|
7038
|
+
a2 = v2.substring(7, 9);
|
|
8176
7039
|
} else {
|
|
8177
7040
|
r = v2.substring(1, 2);
|
|
8178
7041
|
g2 = v2.substring(2, 3);
|
|
8179
|
-
|
|
8180
|
-
|
|
7042
|
+
b2 = v2.substring(3, 4);
|
|
7043
|
+
a2 = v2.substring(4, 5);
|
|
8181
7044
|
r += r;
|
|
8182
7045
|
g2 += g2;
|
|
8183
|
-
|
|
8184
|
-
|
|
7046
|
+
b2 += b2;
|
|
7047
|
+
a2 += a2;
|
|
8185
7048
|
}
|
|
8186
7049
|
return {
|
|
8187
7050
|
red: parseInt(r, 16),
|
|
8188
7051
|
green: parseInt(g2, 16),
|
|
8189
|
-
blue: parseInt(
|
|
8190
|
-
alpha:
|
|
7052
|
+
blue: parseInt(b2, 16),
|
|
7053
|
+
alpha: a2 ? parseInt(a2, 16) / 255 : 1
|
|
8191
7054
|
};
|
|
8192
7055
|
}
|
|
8193
7056
|
const hex = {
|
|
@@ -8237,22 +7100,22 @@ function analyseComplexValue(value) {
|
|
|
8237
7100
|
var: []
|
|
8238
7101
|
};
|
|
8239
7102
|
const types = [];
|
|
8240
|
-
let
|
|
7103
|
+
let i2 = 0;
|
|
8241
7104
|
const tokenised = originalValue.replace(complexRegex, (parsedValue) => {
|
|
8242
7105
|
if (color.test(parsedValue)) {
|
|
8243
|
-
indexes.color.push(
|
|
7106
|
+
indexes.color.push(i2);
|
|
8244
7107
|
types.push(COLOR_TOKEN);
|
|
8245
7108
|
values.push(color.parse(parsedValue));
|
|
8246
7109
|
} else if (parsedValue.startsWith(VAR_FUNCTION_TOKEN)) {
|
|
8247
|
-
indexes.var.push(
|
|
7110
|
+
indexes.var.push(i2);
|
|
8248
7111
|
types.push(VAR_TOKEN);
|
|
8249
7112
|
values.push(parsedValue);
|
|
8250
7113
|
} else {
|
|
8251
|
-
indexes.number.push(
|
|
7114
|
+
indexes.number.push(i2);
|
|
8252
7115
|
types.push(NUMBER_TOKEN);
|
|
8253
7116
|
values.push(parseFloat(parsedValue));
|
|
8254
7117
|
}
|
|
8255
|
-
++
|
|
7118
|
+
++i2;
|
|
8256
7119
|
return SPLIT_TOKEN;
|
|
8257
7120
|
});
|
|
8258
7121
|
const split = tokenised.split(SPLIT_TOKEN);
|
|
@@ -8266,16 +7129,16 @@ function createTransformer(source) {
|
|
|
8266
7129
|
const numSections = split.length;
|
|
8267
7130
|
return (v2) => {
|
|
8268
7131
|
let output = "";
|
|
8269
|
-
for (let
|
|
8270
|
-
output += split[
|
|
8271
|
-
if (v2[
|
|
8272
|
-
const type = types[
|
|
7132
|
+
for (let i2 = 0; i2 < numSections; i2++) {
|
|
7133
|
+
output += split[i2];
|
|
7134
|
+
if (v2[i2] !== void 0) {
|
|
7135
|
+
const type = types[i2];
|
|
8273
7136
|
if (type === NUMBER_TOKEN) {
|
|
8274
|
-
output += sanitize(v2[
|
|
7137
|
+
output += sanitize(v2[i2]);
|
|
8275
7138
|
} else if (type === COLOR_TOKEN) {
|
|
8276
|
-
output += color.transform(v2[
|
|
7139
|
+
output += color.transform(v2[i2]);
|
|
8277
7140
|
} else {
|
|
8278
|
-
output += v2[
|
|
7141
|
+
output += v2[i2];
|
|
8279
7142
|
}
|
|
8280
7143
|
}
|
|
8281
7144
|
}
|
|
@@ -8342,14 +7205,14 @@ function getAnimatableNone(key, value) {
|
|
|
8342
7205
|
}
|
|
8343
7206
|
const invalidTemplates = /* @__PURE__ */ new Set(["auto", "none", "0"]);
|
|
8344
7207
|
function makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name) {
|
|
8345
|
-
let
|
|
7208
|
+
let i2 = 0;
|
|
8346
7209
|
let animatableTemplate = void 0;
|
|
8347
|
-
while (
|
|
8348
|
-
const keyframe = unresolvedKeyframes[
|
|
7210
|
+
while (i2 < unresolvedKeyframes.length && !animatableTemplate) {
|
|
7211
|
+
const keyframe = unresolvedKeyframes[i2];
|
|
8349
7212
|
if (typeof keyframe === "string" && !invalidTemplates.has(keyframe) && analyseComplexValue(keyframe).values.length) {
|
|
8350
|
-
animatableTemplate = unresolvedKeyframes[
|
|
7213
|
+
animatableTemplate = unresolvedKeyframes[i2];
|
|
8351
7214
|
}
|
|
8352
|
-
|
|
7215
|
+
i2++;
|
|
8353
7216
|
}
|
|
8354
7217
|
if (animatableTemplate && name) {
|
|
8355
7218
|
for (const noneIndex of noneKeyframeIndexes) {
|
|
@@ -8451,12 +7314,12 @@ function removeNonTranslationalTransform(visualElement) {
|
|
|
8451
7314
|
}
|
|
8452
7315
|
const positionalValues = {
|
|
8453
7316
|
// Dimensions
|
|
8454
|
-
width: ({ x }, { paddingLeft = "0", paddingRight = "0" }) =>
|
|
8455
|
-
height: ({ y }, { paddingTop = "0", paddingBottom = "0" }) =>
|
|
7317
|
+
width: ({ x: x2 }, { paddingLeft = "0", paddingRight = "0" }) => x2.max - x2.min - parseFloat(paddingLeft) - parseFloat(paddingRight),
|
|
7318
|
+
height: ({ y: y2 }, { paddingTop = "0", paddingBottom = "0" }) => y2.max - y2.min - parseFloat(paddingTop) - parseFloat(paddingBottom),
|
|
8456
7319
|
top: (_bbox, { top }) => parseFloat(top),
|
|
8457
7320
|
left: (_bbox, { left }) => parseFloat(left),
|
|
8458
|
-
bottom: ({ y }, { top }) => parseFloat(top) + (
|
|
8459
|
-
right: ({ x }, { left }) => parseFloat(left) + (
|
|
7321
|
+
bottom: ({ y: y2 }, { top }) => parseFloat(top) + (y2.max - y2.min),
|
|
7322
|
+
right: ({ x: x2 }, { left }) => parseFloat(left) + (x2.max - x2.min),
|
|
8460
7323
|
// Transform
|
|
8461
7324
|
x: (_bbox, { transform: transform2 }) => parseValueFromTransform(transform2, "x"),
|
|
8462
7325
|
y: (_bbox, { transform: transform2 }) => parseValueFromTransform(transform2, "y")
|
|
@@ -8542,9 +7405,9 @@ class KeyframeResolver {
|
|
|
8542
7405
|
}
|
|
8543
7406
|
readKeyframes() {
|
|
8544
7407
|
const { unresolvedKeyframes, name, element, motionValue: motionValue2 } = this;
|
|
8545
|
-
for (let
|
|
8546
|
-
if (unresolvedKeyframes[
|
|
8547
|
-
if (
|
|
7408
|
+
for (let i2 = 0; i2 < unresolvedKeyframes.length; i2++) {
|
|
7409
|
+
if (unresolvedKeyframes[i2] === null) {
|
|
7410
|
+
if (i2 === 0) {
|
|
8548
7411
|
const currentValue = motionValue2 == null ? void 0 : motionValue2.get();
|
|
8549
7412
|
const finalKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];
|
|
8550
7413
|
if (currentValue !== void 0) {
|
|
@@ -8562,7 +7425,7 @@ class KeyframeResolver {
|
|
|
8562
7425
|
motionValue2.set(unresolvedKeyframes[0]);
|
|
8563
7426
|
}
|
|
8564
7427
|
} else {
|
|
8565
|
-
unresolvedKeyframes[
|
|
7428
|
+
unresolvedKeyframes[i2] = unresolvedKeyframes[i2 - 1];
|
|
8566
7429
|
}
|
|
8567
7430
|
}
|
|
8568
7431
|
}
|
|
@@ -8632,16 +7495,16 @@ class DOMKeyframesResolver extends KeyframeResolver {
|
|
|
8632
7495
|
if (!element || !element.current)
|
|
8633
7496
|
return;
|
|
8634
7497
|
super.readKeyframes();
|
|
8635
|
-
for (let
|
|
8636
|
-
let keyframe = unresolvedKeyframes[
|
|
7498
|
+
for (let i2 = 0; i2 < unresolvedKeyframes.length; i2++) {
|
|
7499
|
+
let keyframe = unresolvedKeyframes[i2];
|
|
8637
7500
|
if (typeof keyframe === "string") {
|
|
8638
7501
|
keyframe = keyframe.trim();
|
|
8639
7502
|
if (isCSSVariableToken(keyframe)) {
|
|
8640
7503
|
const resolved = getVariableValue(keyframe, element.current);
|
|
8641
7504
|
if (resolved !== void 0) {
|
|
8642
|
-
unresolvedKeyframes[
|
|
7505
|
+
unresolvedKeyframes[i2] = resolved;
|
|
8643
7506
|
}
|
|
8644
|
-
if (
|
|
7507
|
+
if (i2 === unresolvedKeyframes.length - 1) {
|
|
8645
7508
|
this.finalKeyframe = keyframe;
|
|
8646
7509
|
}
|
|
8647
7510
|
}
|
|
@@ -8657,10 +7520,10 @@ class DOMKeyframesResolver extends KeyframeResolver {
|
|
|
8657
7520
|
if (originType === targetType)
|
|
8658
7521
|
return;
|
|
8659
7522
|
if (isNumOrPxType(originType) && isNumOrPxType(targetType)) {
|
|
8660
|
-
for (let
|
|
8661
|
-
const value = unresolvedKeyframes[
|
|
7523
|
+
for (let i2 = 0; i2 < unresolvedKeyframes.length; i2++) {
|
|
7524
|
+
const value = unresolvedKeyframes[i2];
|
|
8662
7525
|
if (typeof value === "string") {
|
|
8663
|
-
unresolvedKeyframes[
|
|
7526
|
+
unresolvedKeyframes[i2] = parseFloat(value);
|
|
8664
7527
|
}
|
|
8665
7528
|
}
|
|
8666
7529
|
} else {
|
|
@@ -8670,9 +7533,9 @@ class DOMKeyframesResolver extends KeyframeResolver {
|
|
|
8670
7533
|
resolveNoneKeyframes() {
|
|
8671
7534
|
const { unresolvedKeyframes, name } = this;
|
|
8672
7535
|
const noneKeyframeIndexes = [];
|
|
8673
|
-
for (let
|
|
8674
|
-
if (isNone(unresolvedKeyframes[
|
|
8675
|
-
noneKeyframeIndexes.push(
|
|
7536
|
+
for (let i2 = 0; i2 < unresolvedKeyframes.length; i2++) {
|
|
7537
|
+
if (isNone(unresolvedKeyframes[i2])) {
|
|
7538
|
+
noneKeyframeIndexes.push(i2);
|
|
8676
7539
|
}
|
|
8677
7540
|
}
|
|
8678
7541
|
if (noneKeyframeIndexes.length) {
|
|
@@ -8730,8 +7593,8 @@ function hasKeyframesChanged(keyframes2) {
|
|
|
8730
7593
|
const current = keyframes2[0];
|
|
8731
7594
|
if (keyframes2.length === 1)
|
|
8732
7595
|
return true;
|
|
8733
|
-
for (let
|
|
8734
|
-
if (keyframes2[
|
|
7596
|
+
for (let i2 = 0; i2 < keyframes2.length; i2++) {
|
|
7597
|
+
if (keyframes2[i2] !== current)
|
|
8735
7598
|
return true;
|
|
8736
7599
|
}
|
|
8737
7600
|
}
|
|
@@ -8864,18 +7727,18 @@ function calcGeneratorDuration(generator) {
|
|
|
8864
7727
|
const mixNumber$1 = (from, to, progress2) => {
|
|
8865
7728
|
return from + (to - from) * progress2;
|
|
8866
7729
|
};
|
|
8867
|
-
function hueToRgb(
|
|
8868
|
-
if (
|
|
8869
|
-
|
|
8870
|
-
if (
|
|
8871
|
-
|
|
8872
|
-
if (
|
|
8873
|
-
return
|
|
8874
|
-
if (
|
|
8875
|
-
return
|
|
8876
|
-
if (
|
|
8877
|
-
return
|
|
8878
|
-
return
|
|
7730
|
+
function hueToRgb(p2, q2, t2) {
|
|
7731
|
+
if (t2 < 0)
|
|
7732
|
+
t2 += 1;
|
|
7733
|
+
if (t2 > 1)
|
|
7734
|
+
t2 -= 1;
|
|
7735
|
+
if (t2 < 1 / 6)
|
|
7736
|
+
return p2 + (q2 - p2) * 6 * t2;
|
|
7737
|
+
if (t2 < 1 / 2)
|
|
7738
|
+
return q2;
|
|
7739
|
+
if (t2 < 2 / 3)
|
|
7740
|
+
return p2 + (q2 - p2) * (2 / 3 - t2) * 6;
|
|
7741
|
+
return p2;
|
|
8879
7742
|
}
|
|
8880
7743
|
function hslaToRgba({ hue, saturation, lightness, alpha: alpha2 }) {
|
|
8881
7744
|
hue /= 360;
|
|
@@ -8887,11 +7750,11 @@ function hslaToRgba({ hue, saturation, lightness, alpha: alpha2 }) {
|
|
|
8887
7750
|
if (!saturation) {
|
|
8888
7751
|
red = green = blue = lightness;
|
|
8889
7752
|
} else {
|
|
8890
|
-
const
|
|
8891
|
-
const
|
|
8892
|
-
red = hueToRgb(
|
|
8893
|
-
green = hueToRgb(
|
|
8894
|
-
blue = hueToRgb(
|
|
7753
|
+
const q2 = lightness < 0.5 ? lightness * (1 + saturation) : lightness + saturation - lightness * saturation;
|
|
7754
|
+
const p2 = 2 * lightness - q2;
|
|
7755
|
+
red = hueToRgb(p2, q2, hue + 1 / 3);
|
|
7756
|
+
green = hueToRgb(p2, q2, hue);
|
|
7757
|
+
blue = hueToRgb(p2, q2, hue - 1 / 3);
|
|
8895
7758
|
}
|
|
8896
7759
|
return {
|
|
8897
7760
|
red: Math.round(red * 255),
|
|
@@ -8900,8 +7763,8 @@ function hslaToRgba({ hue, saturation, lightness, alpha: alpha2 }) {
|
|
|
8900
7763
|
alpha: alpha2
|
|
8901
7764
|
};
|
|
8902
7765
|
}
|
|
8903
|
-
function mixImmediate(
|
|
8904
|
-
return (
|
|
7766
|
+
function mixImmediate(a2, b2) {
|
|
7767
|
+
return (p2) => p2 > 0 ? b2 : a2;
|
|
8905
7768
|
}
|
|
8906
7769
|
const mixLinearColor = (from, to, v2) => {
|
|
8907
7770
|
const fromExpo = from * from;
|
|
@@ -8936,48 +7799,48 @@ const mixColor = (from, to) => {
|
|
|
8936
7799
|
return rgba.transform(blended);
|
|
8937
7800
|
};
|
|
8938
7801
|
};
|
|
8939
|
-
const combineFunctions = (
|
|
7802
|
+
const combineFunctions = (a2, b2) => (v2) => b2(a2(v2));
|
|
8940
7803
|
const pipe = (...transformers) => transformers.reduce(combineFunctions);
|
|
8941
7804
|
const invisibleValues = /* @__PURE__ */ new Set(["none", "hidden"]);
|
|
8942
7805
|
function mixVisibility(origin, target) {
|
|
8943
7806
|
if (invisibleValues.has(origin)) {
|
|
8944
|
-
return (
|
|
7807
|
+
return (p2) => p2 <= 0 ? origin : target;
|
|
8945
7808
|
} else {
|
|
8946
|
-
return (
|
|
7809
|
+
return (p2) => p2 >= 1 ? target : origin;
|
|
8947
7810
|
}
|
|
8948
7811
|
}
|
|
8949
|
-
function mixNumber(
|
|
8950
|
-
return (
|
|
7812
|
+
function mixNumber(a2, b2) {
|
|
7813
|
+
return (p2) => mixNumber$1(a2, b2, p2);
|
|
8951
7814
|
}
|
|
8952
|
-
function getMixer$1(
|
|
8953
|
-
if (typeof
|
|
7815
|
+
function getMixer$1(a2) {
|
|
7816
|
+
if (typeof a2 === "number") {
|
|
8954
7817
|
return mixNumber;
|
|
8955
|
-
} else if (typeof
|
|
8956
|
-
return isCSSVariableToken(
|
|
8957
|
-
} else if (Array.isArray(
|
|
7818
|
+
} else if (typeof a2 === "string") {
|
|
7819
|
+
return isCSSVariableToken(a2) ? mixImmediate : color.test(a2) ? mixColor : mixComplex;
|
|
7820
|
+
} else if (Array.isArray(a2)) {
|
|
8958
7821
|
return mixArray;
|
|
8959
|
-
} else if (typeof
|
|
8960
|
-
return color.test(
|
|
7822
|
+
} else if (typeof a2 === "object") {
|
|
7823
|
+
return color.test(a2) ? mixColor : mixObject;
|
|
8961
7824
|
}
|
|
8962
7825
|
return mixImmediate;
|
|
8963
7826
|
}
|
|
8964
|
-
function mixArray(
|
|
8965
|
-
const output = [...
|
|
7827
|
+
function mixArray(a2, b2) {
|
|
7828
|
+
const output = [...a2];
|
|
8966
7829
|
const numValues = output.length;
|
|
8967
|
-
const blendValue =
|
|
8968
|
-
return (
|
|
8969
|
-
for (let
|
|
8970
|
-
output[
|
|
7830
|
+
const blendValue = a2.map((v2, i2) => getMixer$1(v2)(v2, b2[i2]));
|
|
7831
|
+
return (p2) => {
|
|
7832
|
+
for (let i2 = 0; i2 < numValues; i2++) {
|
|
7833
|
+
output[i2] = blendValue[i2](p2);
|
|
8971
7834
|
}
|
|
8972
7835
|
return output;
|
|
8973
7836
|
};
|
|
8974
7837
|
}
|
|
8975
|
-
function mixObject(
|
|
8976
|
-
const output = { ...
|
|
7838
|
+
function mixObject(a2, b2) {
|
|
7839
|
+
const output = { ...a2, ...b2 };
|
|
8977
7840
|
const blendValue = {};
|
|
8978
7841
|
for (const key in output) {
|
|
8979
|
-
if (
|
|
8980
|
-
blendValue[key] = getMixer$1(
|
|
7842
|
+
if (a2[key] !== void 0 && b2[key] !== void 0) {
|
|
7843
|
+
blendValue[key] = getMixer$1(a2[key])(a2[key], b2[key]);
|
|
8981
7844
|
}
|
|
8982
7845
|
}
|
|
8983
7846
|
return (v2) => {
|
|
@@ -8990,11 +7853,11 @@ function mixObject(a, b) {
|
|
|
8990
7853
|
function matchOrder(origin, target) {
|
|
8991
7854
|
const orderedOrigin = [];
|
|
8992
7855
|
const pointers = { color: 0, var: 0, number: 0 };
|
|
8993
|
-
for (let
|
|
8994
|
-
const type = target.types[
|
|
7856
|
+
for (let i2 = 0; i2 < target.values.length; i2++) {
|
|
7857
|
+
const type = target.types[i2];
|
|
8995
7858
|
const originIndex = origin.indexes[type][pointers[type]];
|
|
8996
7859
|
const originValue = origin.values[originIndex] ?? 0;
|
|
8997
|
-
orderedOrigin[
|
|
7860
|
+
orderedOrigin[i2] = originValue;
|
|
8998
7861
|
pointers[type]++;
|
|
8999
7862
|
}
|
|
9000
7863
|
return orderedOrigin;
|
|
@@ -9014,9 +7877,9 @@ const mixComplex = (origin, target) => {
|
|
|
9014
7877
|
return mixImmediate(origin, target);
|
|
9015
7878
|
}
|
|
9016
7879
|
};
|
|
9017
|
-
function mix(from, to,
|
|
9018
|
-
if (typeof from === "number" && typeof to === "number" && typeof
|
|
9019
|
-
return mixNumber$1(from, to,
|
|
7880
|
+
function mix(from, to, p2) {
|
|
7881
|
+
if (typeof from === "number" && typeof to === "number" && typeof p2 === "number") {
|
|
7882
|
+
return mixNumber$1(from, to, p2);
|
|
9020
7883
|
}
|
|
9021
7884
|
const mixer = getMixer$1(from);
|
|
9022
7885
|
return mixer(from, to);
|
|
@@ -9033,9 +7896,9 @@ function createGeneratorEasing(options, scale2 = 100, createGenerator) {
|
|
|
9033
7896
|
};
|
|
9034
7897
|
}
|
|
9035
7898
|
const velocitySampleDuration = 5;
|
|
9036
|
-
function calcGeneratorVelocity(resolveValue,
|
|
9037
|
-
const prevT = Math.max(
|
|
9038
|
-
return velocityPerSecond(current - resolveValue(prevT),
|
|
7899
|
+
function calcGeneratorVelocity(resolveValue, t2, current) {
|
|
7900
|
+
const prevT = Math.max(t2 - velocitySampleDuration, 0);
|
|
7901
|
+
return velocityPerSecond(current - resolveValue(prevT), t2 - prevT);
|
|
9039
7902
|
}
|
|
9040
7903
|
const springDefaults = {
|
|
9041
7904
|
// Default spring physics
|
|
@@ -9078,31 +7941,31 @@ function findSpring({ duration = springDefaults.duration, bounce = springDefault
|
|
|
9078
7941
|
envelope = (undampedFreq2) => {
|
|
9079
7942
|
const exponentialDecay = undampedFreq2 * dampingRatio;
|
|
9080
7943
|
const delta = exponentialDecay * duration;
|
|
9081
|
-
const
|
|
9082
|
-
const
|
|
9083
|
-
const
|
|
9084
|
-
return safeMin -
|
|
7944
|
+
const a2 = exponentialDecay - velocity;
|
|
7945
|
+
const b2 = calcAngularFreq(undampedFreq2, dampingRatio);
|
|
7946
|
+
const c2 = Math.exp(-delta);
|
|
7947
|
+
return safeMin - a2 / b2 * c2;
|
|
9085
7948
|
};
|
|
9086
7949
|
derivative = (undampedFreq2) => {
|
|
9087
7950
|
const exponentialDecay = undampedFreq2 * dampingRatio;
|
|
9088
7951
|
const delta = exponentialDecay * duration;
|
|
9089
|
-
const
|
|
9090
|
-
const
|
|
9091
|
-
const
|
|
7952
|
+
const d2 = delta * velocity + velocity;
|
|
7953
|
+
const e2 = Math.pow(dampingRatio, 2) * Math.pow(undampedFreq2, 2) * duration;
|
|
7954
|
+
const f2 = Math.exp(-delta);
|
|
9092
7955
|
const g2 = calcAngularFreq(Math.pow(undampedFreq2, 2), dampingRatio);
|
|
9093
7956
|
const factor = -envelope(undampedFreq2) + safeMin > 0 ? -1 : 1;
|
|
9094
|
-
return factor * ((
|
|
7957
|
+
return factor * ((d2 - e2) * f2) / g2;
|
|
9095
7958
|
};
|
|
9096
7959
|
} else {
|
|
9097
7960
|
envelope = (undampedFreq2) => {
|
|
9098
|
-
const
|
|
9099
|
-
const
|
|
9100
|
-
return -1e-3 +
|
|
7961
|
+
const a2 = Math.exp(-undampedFreq2 * duration);
|
|
7962
|
+
const b2 = (undampedFreq2 - velocity) * duration + 1;
|
|
7963
|
+
return -1e-3 + a2 * b2;
|
|
9101
7964
|
};
|
|
9102
7965
|
derivative = (undampedFreq2) => {
|
|
9103
|
-
const
|
|
9104
|
-
const
|
|
9105
|
-
return
|
|
7966
|
+
const a2 = Math.exp(-undampedFreq2 * duration);
|
|
7967
|
+
const b2 = (velocity - undampedFreq2) * (duration * duration);
|
|
7968
|
+
return a2 * b2;
|
|
9106
7969
|
};
|
|
9107
7970
|
}
|
|
9108
7971
|
const initialGuess = 5 / duration;
|
|
@@ -9126,7 +7989,7 @@ function findSpring({ duration = springDefaults.duration, bounce = springDefault
|
|
|
9126
7989
|
const rootIterations = 12;
|
|
9127
7990
|
function approximateRoot(envelope, derivative, initialGuess) {
|
|
9128
7991
|
let result = initialGuess;
|
|
9129
|
-
for (let
|
|
7992
|
+
for (let i2 = 1; i2 < rootIterations; i2++) {
|
|
9130
7993
|
result = result - envelope(result) / derivative(result);
|
|
9131
7994
|
}
|
|
9132
7995
|
return result;
|
|
@@ -9196,34 +8059,34 @@ function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce
|
|
|
9196
8059
|
let resolveSpring;
|
|
9197
8060
|
if (dampingRatio < 1) {
|
|
9198
8061
|
const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
|
|
9199
|
-
resolveSpring = (
|
|
9200
|
-
const envelope = Math.exp(-dampingRatio * undampedAngularFreq *
|
|
9201
|
-
return target - envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) / angularFreq * Math.sin(angularFreq *
|
|
8062
|
+
resolveSpring = (t2) => {
|
|
8063
|
+
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t2);
|
|
8064
|
+
return target - envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) / angularFreq * Math.sin(angularFreq * t2) + initialDelta * Math.cos(angularFreq * t2));
|
|
9202
8065
|
};
|
|
9203
8066
|
} else if (dampingRatio === 1) {
|
|
9204
|
-
resolveSpring = (
|
|
8067
|
+
resolveSpring = (t2) => target - Math.exp(-undampedAngularFreq * t2) * (initialDelta + (initialVelocity + undampedAngularFreq * initialDelta) * t2);
|
|
9205
8068
|
} else {
|
|
9206
8069
|
const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);
|
|
9207
|
-
resolveSpring = (
|
|
9208
|
-
const envelope = Math.exp(-dampingRatio * undampedAngularFreq *
|
|
9209
|
-
const freqForT = Math.min(dampedAngularFreq *
|
|
8070
|
+
resolveSpring = (t2) => {
|
|
8071
|
+
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t2);
|
|
8072
|
+
const freqForT = Math.min(dampedAngularFreq * t2, 300);
|
|
9210
8073
|
return target - envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) * Math.sinh(freqForT) + dampedAngularFreq * initialDelta * Math.cosh(freqForT)) / dampedAngularFreq;
|
|
9211
8074
|
};
|
|
9212
8075
|
}
|
|
9213
8076
|
const generator = {
|
|
9214
8077
|
calculatedDuration: isResolvedFromDuration ? duration || null : null,
|
|
9215
|
-
next: (
|
|
9216
|
-
const current = resolveSpring(
|
|
8078
|
+
next: (t2) => {
|
|
8079
|
+
const current = resolveSpring(t2);
|
|
9217
8080
|
if (!isResolvedFromDuration) {
|
|
9218
8081
|
let currentVelocity = 0;
|
|
9219
8082
|
if (dampingRatio < 1) {
|
|
9220
|
-
currentVelocity =
|
|
8083
|
+
currentVelocity = t2 === 0 ? /* @__PURE__ */ secondsToMilliseconds(initialVelocity) : calcGeneratorVelocity(resolveSpring, t2, current);
|
|
9221
8084
|
}
|
|
9222
8085
|
const isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed;
|
|
9223
8086
|
const isBelowDisplacementThreshold = Math.abs(target - current) <= restDelta;
|
|
9224
8087
|
state.done = isBelowVelocityThreshold && isBelowDisplacementThreshold;
|
|
9225
8088
|
} else {
|
|
9226
|
-
state.done =
|
|
8089
|
+
state.done = t2 >= duration;
|
|
9227
8090
|
}
|
|
9228
8091
|
state.value = state.done ? target : current;
|
|
9229
8092
|
return state;
|
|
@@ -9264,23 +8127,23 @@ function inertia({ keyframes: keyframes2, velocity = 0, power = 0.8, timeConstan
|
|
|
9264
8127
|
const target = modifyTarget === void 0 ? ideal : modifyTarget(ideal);
|
|
9265
8128
|
if (target !== ideal)
|
|
9266
8129
|
amplitude = target - origin;
|
|
9267
|
-
const calcDelta = (
|
|
9268
|
-
const calcLatest = (
|
|
9269
|
-
const applyFriction = (
|
|
9270
|
-
const delta = calcDelta(
|
|
9271
|
-
const latest = calcLatest(
|
|
8130
|
+
const calcDelta = (t2) => -amplitude * Math.exp(-t2 / timeConstant);
|
|
8131
|
+
const calcLatest = (t2) => target + calcDelta(t2);
|
|
8132
|
+
const applyFriction = (t2) => {
|
|
8133
|
+
const delta = calcDelta(t2);
|
|
8134
|
+
const latest = calcLatest(t2);
|
|
9272
8135
|
state.done = Math.abs(delta) <= restDelta;
|
|
9273
8136
|
state.value = state.done ? target : latest;
|
|
9274
8137
|
};
|
|
9275
8138
|
let timeReachedBoundary;
|
|
9276
8139
|
let spring$1;
|
|
9277
|
-
const checkCatchBoundary = (
|
|
8140
|
+
const checkCatchBoundary = (t2) => {
|
|
9278
8141
|
if (!isOutOfBounds(state.value))
|
|
9279
8142
|
return;
|
|
9280
|
-
timeReachedBoundary =
|
|
8143
|
+
timeReachedBoundary = t2;
|
|
9281
8144
|
spring$1 = spring({
|
|
9282
8145
|
keyframes: [state.value, nearestBoundary(state.value)],
|
|
9283
|
-
velocity: calcGeneratorVelocity(calcLatest,
|
|
8146
|
+
velocity: calcGeneratorVelocity(calcLatest, t2, state.value),
|
|
9284
8147
|
// TODO: This should be passing * 1000
|
|
9285
8148
|
damping: bounceDamping,
|
|
9286
8149
|
stiffness: bounceStiffness,
|
|
@@ -9291,17 +8154,17 @@ function inertia({ keyframes: keyframes2, velocity = 0, power = 0.8, timeConstan
|
|
|
9291
8154
|
checkCatchBoundary(0);
|
|
9292
8155
|
return {
|
|
9293
8156
|
calculatedDuration: null,
|
|
9294
|
-
next: (
|
|
8157
|
+
next: (t2) => {
|
|
9295
8158
|
let hasUpdatedFrame = false;
|
|
9296
8159
|
if (!spring$1 && timeReachedBoundary === void 0) {
|
|
9297
8160
|
hasUpdatedFrame = true;
|
|
9298
|
-
applyFriction(
|
|
9299
|
-
checkCatchBoundary(
|
|
8161
|
+
applyFriction(t2);
|
|
8162
|
+
checkCatchBoundary(t2);
|
|
9300
8163
|
}
|
|
9301
|
-
if (timeReachedBoundary !== void 0 &&
|
|
9302
|
-
return spring$1.next(
|
|
8164
|
+
if (timeReachedBoundary !== void 0 && t2 >= timeReachedBoundary) {
|
|
8165
|
+
return spring$1.next(t2 - timeReachedBoundary);
|
|
9303
8166
|
} else {
|
|
9304
|
-
!hasUpdatedFrame && applyFriction(
|
|
8167
|
+
!hasUpdatedFrame && applyFriction(t2);
|
|
9305
8168
|
return state;
|
|
9306
8169
|
}
|
|
9307
8170
|
}
|
|
@@ -9345,10 +8208,10 @@ function createMixers(output, ease2, customMixer) {
|
|
|
9345
8208
|
const mixers = [];
|
|
9346
8209
|
const mixerFactory = customMixer || mix;
|
|
9347
8210
|
const numMixers = output.length - 1;
|
|
9348
|
-
for (let
|
|
9349
|
-
let mixer = mixerFactory(output[
|
|
8211
|
+
for (let i2 = 0; i2 < numMixers; i2++) {
|
|
8212
|
+
let mixer = mixerFactory(output[i2], output[i2 + 1]);
|
|
9350
8213
|
if (ease2) {
|
|
9351
|
-
const easingFunction = Array.isArray(ease2) ? ease2[
|
|
8214
|
+
const easingFunction = Array.isArray(ease2) ? ease2[i2] || noop : ease2;
|
|
9352
8215
|
mixer = pipe(easingFunction, mixer);
|
|
9353
8216
|
}
|
|
9354
8217
|
mixers.push(mixer);
|
|
@@ -9372,22 +8235,22 @@ function interpolate(input, output, { clamp: isClamp = true, ease: ease2, mixer
|
|
|
9372
8235
|
const interpolator = (v2) => {
|
|
9373
8236
|
if (isZeroDeltaRange && v2 < input[0])
|
|
9374
8237
|
return output[0];
|
|
9375
|
-
let
|
|
8238
|
+
let i2 = 0;
|
|
9376
8239
|
if (numMixers > 1) {
|
|
9377
|
-
for (;
|
|
9378
|
-
if (v2 < input[
|
|
8240
|
+
for (; i2 < input.length - 2; i2++) {
|
|
8241
|
+
if (v2 < input[i2 + 1])
|
|
9379
8242
|
break;
|
|
9380
8243
|
}
|
|
9381
8244
|
}
|
|
9382
|
-
const progressInRange = /* @__PURE__ */ progress(input[
|
|
9383
|
-
return mixers[
|
|
8245
|
+
const progressInRange = /* @__PURE__ */ progress(input[i2], input[i2 + 1], v2);
|
|
8246
|
+
return mixers[i2](progressInRange);
|
|
9384
8247
|
};
|
|
9385
8248
|
return isClamp ? (v2) => interpolator(clamp(input[0], input[inputLength - 1], v2)) : interpolator;
|
|
9386
8249
|
}
|
|
9387
8250
|
function fillOffset(offset, remaining) {
|
|
9388
8251
|
const min = offset[offset.length - 1];
|
|
9389
|
-
for (let
|
|
9390
|
-
const offsetProgress = /* @__PURE__ */ progress(0, remaining,
|
|
8252
|
+
for (let i2 = 1; i2 <= remaining; i2++) {
|
|
8253
|
+
const offsetProgress = /* @__PURE__ */ progress(0, remaining, i2);
|
|
9391
8254
|
offset.push(mixNumber$1(min, 1, offsetProgress));
|
|
9392
8255
|
}
|
|
9393
8256
|
}
|
|
@@ -9397,7 +8260,7 @@ function defaultOffset(arr) {
|
|
|
9397
8260
|
return offset;
|
|
9398
8261
|
}
|
|
9399
8262
|
function convertOffsetToTimes(offset, duration) {
|
|
9400
|
-
return offset.map((
|
|
8263
|
+
return offset.map((o2) => o2 * duration);
|
|
9401
8264
|
}
|
|
9402
8265
|
function defaultEasing(values, easing) {
|
|
9403
8266
|
return values.map(() => easing || easeInOut).splice(0, values.length - 1);
|
|
@@ -9419,9 +8282,9 @@ function keyframes$1({ duration = 300, keyframes: keyframeValues, times, ease: e
|
|
|
9419
8282
|
});
|
|
9420
8283
|
return {
|
|
9421
8284
|
calculatedDuration: duration,
|
|
9422
|
-
next: (
|
|
9423
|
-
state.value = mapTimeToKeyframe(
|
|
9424
|
-
state.done =
|
|
8285
|
+
next: (t2) => {
|
|
8286
|
+
state.value = mapTimeToKeyframe(t2);
|
|
8287
|
+
state.done = t2 >= duration;
|
|
9425
8288
|
return state;
|
|
9426
8289
|
}
|
|
9427
8290
|
};
|
|
@@ -9725,16 +8588,16 @@ function pregenerateKeyframes(keyframes2, options) {
|
|
|
9725
8588
|
});
|
|
9726
8589
|
let state = { done: false, value: keyframes2[0] };
|
|
9727
8590
|
const pregeneratedKeyframes = [];
|
|
9728
|
-
let
|
|
9729
|
-
while (!state.done &&
|
|
9730
|
-
state = sampleAnimation.sample(
|
|
8591
|
+
let t2 = 0;
|
|
8592
|
+
while (!state.done && t2 < maxDuration) {
|
|
8593
|
+
state = sampleAnimation.sample(t2);
|
|
9731
8594
|
pregeneratedKeyframes.push(state.value);
|
|
9732
|
-
|
|
8595
|
+
t2 += sampleDelta;
|
|
9733
8596
|
}
|
|
9734
8597
|
return {
|
|
9735
8598
|
times: void 0,
|
|
9736
8599
|
keyframes: pregeneratedKeyframes,
|
|
9737
|
-
duration:
|
|
8600
|
+
duration: t2 - sampleDelta,
|
|
9738
8601
|
ease: "linear"
|
|
9739
8602
|
};
|
|
9740
8603
|
}
|
|
@@ -10105,18 +8968,18 @@ function animateVariant(visualElement, variant, options = {}) {
|
|
|
10105
8968
|
function animateChildren(visualElement, variant, delayChildren = 0, staggerChildren = 0, staggerDirection = 1, options) {
|
|
10106
8969
|
const animations2 = [];
|
|
10107
8970
|
const maxStaggerDuration = (visualElement.variantChildren.size - 1) * staggerChildren;
|
|
10108
|
-
const generateStaggerDuration = staggerDirection === 1 ? (
|
|
10109
|
-
Array.from(visualElement.variantChildren).sort(sortByTreeOrder).forEach((child,
|
|
8971
|
+
const generateStaggerDuration = staggerDirection === 1 ? (i2 = 0) => i2 * staggerChildren : (i2 = 0) => maxStaggerDuration - i2 * staggerChildren;
|
|
8972
|
+
Array.from(visualElement.variantChildren).sort(sortByTreeOrder).forEach((child, i2) => {
|
|
10110
8973
|
child.notify("AnimationStart", variant);
|
|
10111
8974
|
animations2.push(animateVariant(child, variant, {
|
|
10112
8975
|
...options,
|
|
10113
|
-
delay: delayChildren + generateStaggerDuration(
|
|
8976
|
+
delay: delayChildren + generateStaggerDuration(i2)
|
|
10114
8977
|
}).then(() => child.notify("AnimationComplete", variant)));
|
|
10115
8978
|
});
|
|
10116
8979
|
return Promise.all(animations2);
|
|
10117
8980
|
}
|
|
10118
|
-
function sortByTreeOrder(
|
|
10119
|
-
return
|
|
8981
|
+
function sortByTreeOrder(a2, b2) {
|
|
8982
|
+
return a2.sortNodePosition(b2);
|
|
10120
8983
|
}
|
|
10121
8984
|
function animateVisualElement(visualElement, definition, options = {}) {
|
|
10122
8985
|
visualElement.notify("AnimationStart", definition);
|
|
@@ -10140,8 +9003,8 @@ function shallowCompare(next, prev) {
|
|
|
10140
9003
|
const prevLength = prev.length;
|
|
10141
9004
|
if (prevLength !== next.length)
|
|
10142
9005
|
return false;
|
|
10143
|
-
for (let
|
|
10144
|
-
if (prev[
|
|
9006
|
+
for (let i2 = 0; i2 < prevLength; i2++) {
|
|
9007
|
+
if (prev[i2] !== next[i2])
|
|
10145
9008
|
return false;
|
|
10146
9009
|
}
|
|
10147
9010
|
return true;
|
|
@@ -10158,8 +9021,8 @@ function getVariantContext(visualElement) {
|
|
|
10158
9021
|
return context3;
|
|
10159
9022
|
}
|
|
10160
9023
|
const context2 = {};
|
|
10161
|
-
for (let
|
|
10162
|
-
const name = variantProps[
|
|
9024
|
+
for (let i2 = 0; i2 < numVariantProps; i2++) {
|
|
9025
|
+
const name = variantProps[i2];
|
|
10163
9026
|
const prop = visualElement.props[name];
|
|
10164
9027
|
if (isVariantLabel(prop) || prop === false) {
|
|
10165
9028
|
context2[name] = prop;
|
|
@@ -10195,14 +9058,14 @@ function createAnimationState(visualElement) {
|
|
|
10195
9058
|
const removedKeys = /* @__PURE__ */ new Set();
|
|
10196
9059
|
let encounteredKeys = {};
|
|
10197
9060
|
let removedVariantIndex = Infinity;
|
|
10198
|
-
for (let
|
|
10199
|
-
const type = reversePriorityOrder[
|
|
9061
|
+
for (let i2 = 0; i2 < numAnimationTypes; i2++) {
|
|
9062
|
+
const type = reversePriorityOrder[i2];
|
|
10200
9063
|
const typeState = state[type];
|
|
10201
9064
|
const prop = props[type] !== void 0 ? props[type] : context2[type];
|
|
10202
9065
|
const propIsVariant = isVariantLabel(prop);
|
|
10203
9066
|
const activeDelta = type === changedActiveType ? typeState.isActive : null;
|
|
10204
9067
|
if (activeDelta === false)
|
|
10205
|
-
removedVariantIndex =
|
|
9068
|
+
removedVariantIndex = i2;
|
|
10206
9069
|
let isInherited = prop === context2[type] && prop !== props[type] && propIsVariant;
|
|
10207
9070
|
if (isInherited && isInitialRender && visualElement.manuallyAnimateOnMount) {
|
|
10208
9071
|
isInherited = false;
|
|
@@ -10219,7 +9082,7 @@ function createAnimationState(visualElement) {
|
|
|
10219
9082
|
const variantDidChange = checkVariantsDidChange(typeState.prevProp, prop);
|
|
10220
9083
|
let shouldAnimateType = variantDidChange || // If we're making this variant active, we want to always make it active
|
|
10221
9084
|
type === changedActiveType && typeState.isActive && !isInherited && propIsVariant || // If we removed a higher-priority variant (i is in reverse order)
|
|
10222
|
-
|
|
9085
|
+
i2 > removedVariantIndex && propIsVariant;
|
|
10223
9086
|
let handledRemovedValues = false;
|
|
10224
9087
|
const definitionList = Array.isArray(prop) ? prop : [prop];
|
|
10225
9088
|
let resolvedValues = definitionList.reduce(buildResolvedTypeValues(type), {});
|
|
@@ -10501,8 +9364,8 @@ function convertBoundingBoxToBox({ top, left, right, bottom }) {
|
|
|
10501
9364
|
y: { min: top, max: bottom }
|
|
10502
9365
|
};
|
|
10503
9366
|
}
|
|
10504
|
-
function convertBoxToBoundingBox({ x, y }) {
|
|
10505
|
-
return { top:
|
|
9367
|
+
function convertBoxToBoundingBox({ x: x2, y: y2 }) {
|
|
9368
|
+
return { top: y2.min, right: x2.max, bottom: y2.max, left: x2.min };
|
|
10506
9369
|
}
|
|
10507
9370
|
function transformBoxPoints(point, transformPoint2) {
|
|
10508
9371
|
if (!transformPoint2)
|
|
@@ -10608,9 +9471,9 @@ function applyAxisDelta(axis, translate = 0, scale2 = 1, originPoint, boxScale)
|
|
|
10608
9471
|
axis.min = applyPointDelta(axis.min, translate, scale2, originPoint, boxScale);
|
|
10609
9472
|
axis.max = applyPointDelta(axis.max, translate, scale2, originPoint, boxScale);
|
|
10610
9473
|
}
|
|
10611
|
-
function applyBoxDelta(box, { x, y }) {
|
|
10612
|
-
applyAxisDelta(box.x,
|
|
10613
|
-
applyAxisDelta(box.y,
|
|
9474
|
+
function applyBoxDelta(box, { x: x2, y: y2 }) {
|
|
9475
|
+
applyAxisDelta(box.x, x2.translate, x2.scale, x2.originPoint);
|
|
9476
|
+
applyAxisDelta(box.y, y2.translate, y2.scale, y2.originPoint);
|
|
10614
9477
|
}
|
|
10615
9478
|
const TREE_SCALE_SNAP_MIN = 0.999999999999;
|
|
10616
9479
|
const TREE_SCALE_SNAP_MAX = 1.0000000000001;
|
|
@@ -10621,8 +9484,8 @@ function applyTreeDeltas(box, treeScale, treePath, isSharedTransition = false) {
|
|
|
10621
9484
|
treeScale.x = treeScale.y = 1;
|
|
10622
9485
|
let node;
|
|
10623
9486
|
let delta;
|
|
10624
|
-
for (let
|
|
10625
|
-
node = treePath[
|
|
9487
|
+
for (let i2 = 0; i2 < treeLength; i2++) {
|
|
9488
|
+
node = treePath[i2];
|
|
10626
9489
|
delta = node.projectionDelta;
|
|
10627
9490
|
const { visualElement } = node.options;
|
|
10628
9491
|
if (visualElement && visualElement.props.style && visualElement.props.style.display === "contents") {
|
|
@@ -10677,10 +9540,10 @@ function measurePageBox(element, rootProjectionNode2, transformPagePoint) {
|
|
|
10677
9540
|
const getContextWindow = ({ current }) => {
|
|
10678
9541
|
return current ? current.ownerDocument.defaultView : null;
|
|
10679
9542
|
};
|
|
10680
|
-
const distance = (
|
|
10681
|
-
function distance2D(
|
|
10682
|
-
const xDelta = distance(
|
|
10683
|
-
const yDelta = distance(
|
|
9543
|
+
const distance = (a2, b2) => Math.abs(a2 - b2);
|
|
9544
|
+
function distance2D(a2, b2) {
|
|
9545
|
+
const xDelta = distance(a2.x, b2.x);
|
|
9546
|
+
const yDelta = distance(a2.y, b2.y);
|
|
10684
9547
|
return Math.sqrt(xDelta ** 2 + yDelta ** 2);
|
|
10685
9548
|
}
|
|
10686
9549
|
class PanSession {
|
|
@@ -10752,8 +9615,8 @@ class PanSession {
|
|
|
10752
9615
|
function transformPoint(info, transformPagePoint) {
|
|
10753
9616
|
return transformPagePoint ? { point: transformPagePoint(info.point) } : info;
|
|
10754
9617
|
}
|
|
10755
|
-
function subtractPoint(
|
|
10756
|
-
return { x:
|
|
9618
|
+
function subtractPoint(a2, b2) {
|
|
9619
|
+
return { x: a2.x - b2.x, y: a2.y - b2.y };
|
|
10757
9620
|
}
|
|
10758
9621
|
function getPanInfo({ point }, history) {
|
|
10759
9622
|
return {
|
|
@@ -10773,15 +9636,15 @@ function getVelocity(history, timeDelta) {
|
|
|
10773
9636
|
if (history.length < 2) {
|
|
10774
9637
|
return { x: 0, y: 0 };
|
|
10775
9638
|
}
|
|
10776
|
-
let
|
|
9639
|
+
let i2 = history.length - 1;
|
|
10777
9640
|
let timestampedPoint = null;
|
|
10778
9641
|
const lastPoint = lastDevicePoint(history);
|
|
10779
|
-
while (
|
|
10780
|
-
timestampedPoint = history[
|
|
9642
|
+
while (i2 >= 0) {
|
|
9643
|
+
timestampedPoint = history[i2];
|
|
10781
9644
|
if (lastPoint.timestamp - timestampedPoint.timestamp > /* @__PURE__ */ secondsToMilliseconds(timeDelta)) {
|
|
10782
9645
|
break;
|
|
10783
9646
|
}
|
|
10784
|
-
|
|
9647
|
+
i2--;
|
|
10785
9648
|
}
|
|
10786
9649
|
if (!timestampedPoint) {
|
|
10787
9650
|
return { x: 0, y: 0 };
|
|
@@ -11316,9 +10179,9 @@ const correctBorderRadius = {
|
|
|
11316
10179
|
return latest;
|
|
11317
10180
|
}
|
|
11318
10181
|
}
|
|
11319
|
-
const
|
|
11320
|
-
const
|
|
11321
|
-
return `${
|
|
10182
|
+
const x2 = pixelsToPercent(latest, node.target.x);
|
|
10183
|
+
const y2 = pixelsToPercent(latest, node.target.y);
|
|
10184
|
+
return `${x2}% ${y2}%`;
|
|
11322
10185
|
}
|
|
11323
10186
|
};
|
|
11324
10187
|
const correctBoxShadow = {
|
|
@@ -11452,7 +10315,7 @@ function animateSingleValue(value, keyframes2, options) {
|
|
|
11452
10315
|
function isSVGElement(element) {
|
|
11453
10316
|
return element instanceof SVGElement && element.tagName !== "svg";
|
|
11454
10317
|
}
|
|
11455
|
-
const compareByDepth = (
|
|
10318
|
+
const compareByDepth = (a2, b2) => a2.depth - b2.depth;
|
|
11456
10319
|
class FlatTree {
|
|
11457
10320
|
constructor() {
|
|
11458
10321
|
this.children = [];
|
|
@@ -11500,8 +10363,8 @@ function mixValues(target, follow, lead, progress2, shouldCrossfadeOpacity, isOn
|
|
|
11500
10363
|
} else if (isOnlyMember) {
|
|
11501
10364
|
target.opacity = mixNumber$1(follow.opacity !== void 0 ? follow.opacity : 1, lead.opacity !== void 0 ? lead.opacity : 1, progress2);
|
|
11502
10365
|
}
|
|
11503
|
-
for (let
|
|
11504
|
-
const borderLabel = `border${borders$1[
|
|
10366
|
+
for (let i2 = 0; i2 < numBorders; i2++) {
|
|
10367
|
+
const borderLabel = `border${borders$1[i2]}Radius`;
|
|
11505
10368
|
let followRadius = getRadius(follow, borderLabel);
|
|
11506
10369
|
let leadRadius = getRadius(lead, borderLabel);
|
|
11507
10370
|
if (followRadius === void 0 && leadRadius === void 0)
|
|
@@ -11528,12 +10391,12 @@ function getRadius(values, radiusName) {
|
|
|
11528
10391
|
const easeCrossfadeIn = /* @__PURE__ */ compress(0, 0.5, circOut);
|
|
11529
10392
|
const easeCrossfadeOut = /* @__PURE__ */ compress(0.5, 0.95, noop);
|
|
11530
10393
|
function compress(min, max, easing) {
|
|
11531
|
-
return (
|
|
11532
|
-
if (
|
|
10394
|
+
return (p2) => {
|
|
10395
|
+
if (p2 < min)
|
|
11533
10396
|
return 0;
|
|
11534
|
-
if (
|
|
10397
|
+
if (p2 > max)
|
|
11535
10398
|
return 1;
|
|
11536
|
-
return easing(/* @__PURE__ */ progress(min, max,
|
|
10399
|
+
return easing(/* @__PURE__ */ progress(min, max, p2));
|
|
11537
10400
|
};
|
|
11538
10401
|
}
|
|
11539
10402
|
function copyAxisInto(axis, originAxis) {
|
|
@@ -11587,23 +10450,23 @@ function isAxisDeltaZero(delta) {
|
|
|
11587
10450
|
function isDeltaZero(delta) {
|
|
11588
10451
|
return isAxisDeltaZero(delta.x) && isAxisDeltaZero(delta.y);
|
|
11589
10452
|
}
|
|
11590
|
-
function axisEquals(
|
|
11591
|
-
return
|
|
10453
|
+
function axisEquals(a2, b2) {
|
|
10454
|
+
return a2.min === b2.min && a2.max === b2.max;
|
|
11592
10455
|
}
|
|
11593
|
-
function boxEquals(
|
|
11594
|
-
return axisEquals(
|
|
10456
|
+
function boxEquals(a2, b2) {
|
|
10457
|
+
return axisEquals(a2.x, b2.x) && axisEquals(a2.y, b2.y);
|
|
11595
10458
|
}
|
|
11596
|
-
function axisEqualsRounded(
|
|
11597
|
-
return Math.round(
|
|
10459
|
+
function axisEqualsRounded(a2, b2) {
|
|
10460
|
+
return Math.round(a2.min) === Math.round(b2.min) && Math.round(a2.max) === Math.round(b2.max);
|
|
11598
10461
|
}
|
|
11599
|
-
function boxEqualsRounded(
|
|
11600
|
-
return axisEqualsRounded(
|
|
10462
|
+
function boxEqualsRounded(a2, b2) {
|
|
10463
|
+
return axisEqualsRounded(a2.x, b2.x) && axisEqualsRounded(a2.y, b2.y);
|
|
11601
10464
|
}
|
|
11602
10465
|
function aspectRatio(box) {
|
|
11603
10466
|
return calcLength(box.x) / calcLength(box.y);
|
|
11604
10467
|
}
|
|
11605
|
-
function axisDeltaEquals(
|
|
11606
|
-
return
|
|
10468
|
+
function axisDeltaEquals(a2, b2) {
|
|
10469
|
+
return a2.translate === b2.translate && a2.scale === b2.scale && a2.originPoint === b2.originPoint;
|
|
11607
10470
|
}
|
|
11608
10471
|
class NodeStack {
|
|
11609
10472
|
constructor() {
|
|
@@ -11630,8 +10493,8 @@ class NodeStack {
|
|
|
11630
10493
|
if (indexOfNode === 0)
|
|
11631
10494
|
return false;
|
|
11632
10495
|
let prevLead;
|
|
11633
|
-
for (let
|
|
11634
|
-
const member = this.members[
|
|
10496
|
+
for (let i2 = indexOfNode; i2 >= 0; i2--) {
|
|
10497
|
+
const member = this.members[i2];
|
|
11635
10498
|
if (member.isPresent !== false) {
|
|
11636
10499
|
prevLead = member;
|
|
11637
10500
|
break;
|
|
@@ -11808,8 +10671,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
11808
10671
|
this.path = parent ? [...parent.path, parent] : [];
|
|
11809
10672
|
this.parent = parent;
|
|
11810
10673
|
this.depth = parent ? parent.depth + 1 : 0;
|
|
11811
|
-
for (let
|
|
11812
|
-
this.path[
|
|
10674
|
+
for (let i2 = 0; i2 < this.path.length; i2++) {
|
|
10675
|
+
this.path[i2].shouldResetTransform = true;
|
|
11813
10676
|
}
|
|
11814
10677
|
if (this.root === this)
|
|
11815
10678
|
this.nodes = new FlatTree();
|
|
@@ -11946,8 +10809,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
11946
10809
|
if (this.isLayoutDirty)
|
|
11947
10810
|
return;
|
|
11948
10811
|
this.isLayoutDirty = true;
|
|
11949
|
-
for (let
|
|
11950
|
-
const node = this.path[
|
|
10812
|
+
for (let i2 = 0; i2 < this.path.length; i2++) {
|
|
10813
|
+
const node = this.path[i2];
|
|
11951
10814
|
node.shouldResetTransform = true;
|
|
11952
10815
|
node.updateScroll("snapshot");
|
|
11953
10816
|
if (node.options.layoutRoot) {
|
|
@@ -12032,8 +10895,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
12032
10895
|
return;
|
|
12033
10896
|
}
|
|
12034
10897
|
if (this.resumeFrom && !this.resumeFrom.instance) {
|
|
12035
|
-
for (let
|
|
12036
|
-
const node = this.path[
|
|
10898
|
+
for (let i2 = 0; i2 < this.path.length; i2++) {
|
|
10899
|
+
const node = this.path[i2];
|
|
12037
10900
|
node.updateScroll();
|
|
12038
10901
|
}
|
|
12039
10902
|
}
|
|
@@ -12114,8 +10977,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
12114
10977
|
if ((_a = this.scroll) == null ? void 0 : _a.wasRoot) {
|
|
12115
10978
|
return boxWithoutScroll;
|
|
12116
10979
|
}
|
|
12117
|
-
for (let
|
|
12118
|
-
const node = this.path[
|
|
10980
|
+
for (let i2 = 0; i2 < this.path.length; i2++) {
|
|
10981
|
+
const node = this.path[i2];
|
|
12119
10982
|
const { scroll, options } = node;
|
|
12120
10983
|
if (node !== this.root && scroll && options.layoutScroll) {
|
|
12121
10984
|
if (scroll.wasRoot) {
|
|
@@ -12130,8 +10993,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
12130
10993
|
applyTransform(box, transformOnly = false) {
|
|
12131
10994
|
const withTransforms = createBox();
|
|
12132
10995
|
copyBoxInto(withTransforms, box);
|
|
12133
|
-
for (let
|
|
12134
|
-
const node = this.path[
|
|
10996
|
+
for (let i2 = 0; i2 < this.path.length; i2++) {
|
|
10997
|
+
const node = this.path[i2];
|
|
12135
10998
|
if (!transformOnly && node.options.layoutScroll && node.scroll && node !== node.root) {
|
|
12136
10999
|
transformBox(withTransforms, {
|
|
12137
11000
|
x: -node.scroll.offset.x,
|
|
@@ -12150,8 +11013,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
12150
11013
|
removeTransform(box) {
|
|
12151
11014
|
const boxWithoutTransform = createBox();
|
|
12152
11015
|
copyBoxInto(boxWithoutTransform, box);
|
|
12153
|
-
for (let
|
|
12154
|
-
const node = this.path[
|
|
11016
|
+
for (let i2 = 0; i2 < this.path.length; i2++) {
|
|
11017
|
+
const node = this.path[i2];
|
|
12155
11018
|
if (!node.instance)
|
|
12156
11019
|
continue;
|
|
12157
11020
|
if (!hasTransform(node.latestValues))
|
|
@@ -12517,9 +11380,9 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
12517
11380
|
if (latestValues.z) {
|
|
12518
11381
|
resetDistortingTransform("z", visualElement, resetValues, this.animationValues);
|
|
12519
11382
|
}
|
|
12520
|
-
for (let
|
|
12521
|
-
resetDistortingTransform(`rotate${transformAxes[
|
|
12522
|
-
resetDistortingTransform(`skew${transformAxes[
|
|
11383
|
+
for (let i2 = 0; i2 < transformAxes.length; i2++) {
|
|
11384
|
+
resetDistortingTransform(`rotate${transformAxes[i2]}`, visualElement, resetValues, this.animationValues);
|
|
11385
|
+
resetDistortingTransform(`skew${transformAxes[i2]}`, visualElement, resetValues, this.animationValues);
|
|
12523
11386
|
}
|
|
12524
11387
|
visualElement.render();
|
|
12525
11388
|
for (const key in resetValues) {
|
|
@@ -12566,8 +11429,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
12566
11429
|
if (transformTemplate) {
|
|
12567
11430
|
styles2.transform = transformTemplate(valuesToRender, styles2.transform);
|
|
12568
11431
|
}
|
|
12569
|
-
const { x, y } = this.projectionDelta;
|
|
12570
|
-
styles2.transformOrigin = `${
|
|
11432
|
+
const { x: x2, y: y2 } = this.projectionDelta;
|
|
11433
|
+
styles2.transformOrigin = `${x2.origin * 100}% ${y2.origin * 100}% 0`;
|
|
12571
11434
|
if (lead.animationValues) {
|
|
12572
11435
|
styles2.opacity = lead === this ? valuesToRender.opacity ?? this.latestValues.opacity ?? 1 : this.preserveOpacity ? this.latestValues.opacity : valuesToRender.opacityExit;
|
|
12573
11436
|
} else {
|
|
@@ -12580,8 +11443,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
12580
11443
|
const corrected = styles2.transform === "none" ? valuesToRender[key] : correct(valuesToRender[key], lead);
|
|
12581
11444
|
if (applyTo) {
|
|
12582
11445
|
const num = applyTo.length;
|
|
12583
|
-
for (let
|
|
12584
|
-
styles2[applyTo[
|
|
11446
|
+
for (let i2 = 0; i2 < num; i2++) {
|
|
11447
|
+
styles2[applyTo[i2]] = corrected;
|
|
12585
11448
|
}
|
|
12586
11449
|
} else {
|
|
12587
11450
|
if (isCSSVariable) {
|
|
@@ -12727,19 +11590,19 @@ function resetSkewAndRotation(node) {
|
|
|
12727
11590
|
function removeLeadSnapshots(stack) {
|
|
12728
11591
|
stack.removeLeadSnapshot();
|
|
12729
11592
|
}
|
|
12730
|
-
function mixAxisDelta(output, delta,
|
|
12731
|
-
output.translate = mixNumber$1(delta.translate, 0,
|
|
12732
|
-
output.scale = mixNumber$1(delta.scale, 1,
|
|
11593
|
+
function mixAxisDelta(output, delta, p2) {
|
|
11594
|
+
output.translate = mixNumber$1(delta.translate, 0, p2);
|
|
11595
|
+
output.scale = mixNumber$1(delta.scale, 1, p2);
|
|
12733
11596
|
output.origin = delta.origin;
|
|
12734
11597
|
output.originPoint = delta.originPoint;
|
|
12735
11598
|
}
|
|
12736
|
-
function mixAxis(output, from, to,
|
|
12737
|
-
output.min = mixNumber$1(from.min, to.min,
|
|
12738
|
-
output.max = mixNumber$1(from.max, to.max,
|
|
11599
|
+
function mixAxis(output, from, to, p2) {
|
|
11600
|
+
output.min = mixNumber$1(from.min, to.min, p2);
|
|
11601
|
+
output.max = mixNumber$1(from.max, to.max, p2);
|
|
12739
11602
|
}
|
|
12740
|
-
function mixBox(output, from, to,
|
|
12741
|
-
mixAxis(output.x, from.x, to.x,
|
|
12742
|
-
mixAxis(output.y, from.y, to.y,
|
|
11603
|
+
function mixBox(output, from, to, p2) {
|
|
11604
|
+
mixAxis(output.x, from.x, to.x, p2);
|
|
11605
|
+
mixAxis(output.y, from.y, to.y, p2);
|
|
12743
11606
|
}
|
|
12744
11607
|
function hasOpacityCrossfade(node) {
|
|
12745
11608
|
return node.animationValues && node.animationValues.opacityExit !== void 0;
|
|
@@ -12884,7 +11747,7 @@ class FocusGesture extends Feature {
|
|
|
12884
11747
|
let isFocusVisible = false;
|
|
12885
11748
|
try {
|
|
12886
11749
|
isFocusVisible = this.node.current.matches(":focus-visible");
|
|
12887
|
-
} catch (
|
|
11750
|
+
} catch (e2) {
|
|
12888
11751
|
isFocusVisible = true;
|
|
12889
11752
|
}
|
|
12890
11753
|
if (!isFocusVisible || !this.node.animationState)
|
|
@@ -13378,8 +12241,8 @@ class VisualElement {
|
|
|
13378
12241
|
this.props = props;
|
|
13379
12242
|
this.prevPresenceContext = this.presenceContext;
|
|
13380
12243
|
this.presenceContext = presenceContext;
|
|
13381
|
-
for (let
|
|
13382
|
-
const key = propEventHandlers[
|
|
12244
|
+
for (let i2 = 0; i2 < propEventHandlers.length; i2++) {
|
|
12245
|
+
const key = propEventHandlers[i2];
|
|
13383
12246
|
if (this.propEventSubscriptions[key]) {
|
|
13384
12247
|
this.propEventSubscriptions[key]();
|
|
13385
12248
|
delete this.propEventSubscriptions[key];
|
|
@@ -13533,8 +12396,8 @@ class DOMVisualElement extends VisualElement {
|
|
|
13533
12396
|
super(...arguments);
|
|
13534
12397
|
this.KeyframeResolver = DOMKeyframesResolver;
|
|
13535
12398
|
}
|
|
13536
|
-
sortInstanceNodePosition(
|
|
13537
|
-
return
|
|
12399
|
+
sortInstanceNodePosition(a2, b2) {
|
|
12400
|
+
return a2.compareDocumentPosition(b2) & 2 ? 1 : -1;
|
|
13538
12401
|
}
|
|
13539
12402
|
getBaseTargetFromProps(props, key) {
|
|
13540
12403
|
return props.style ? props.style[key] : void 0;
|
|
@@ -13699,8 +12562,8 @@ function useListTransform(values, transformer) {
|
|
|
13699
12562
|
return useCombineMotionValues(values, () => {
|
|
13700
12563
|
latest.length = 0;
|
|
13701
12564
|
const numValues = values.length;
|
|
13702
|
-
for (let
|
|
13703
|
-
latest[
|
|
12565
|
+
for (let i2 = 0; i2 < numValues; i2++) {
|
|
12566
|
+
latest[i2] = values[i2].get();
|
|
13704
12567
|
}
|
|
13705
12568
|
return transformer(latest);
|
|
13706
12569
|
});
|
|
@@ -13717,8 +12580,8 @@ const wrap = (min, max, v2) => {
|
|
|
13717
12580
|
const rangeSize = max - min;
|
|
13718
12581
|
return ((v2 - min) % rangeSize + rangeSize) % rangeSize + min;
|
|
13719
12582
|
};
|
|
13720
|
-
function getEasingForSegment(easing,
|
|
13721
|
-
return isEasingArray(easing) ? easing[wrap(0, easing.length,
|
|
12583
|
+
function getEasingForSegment(easing, i2) {
|
|
12584
|
+
return isEasingArray(easing) ? easing[wrap(0, easing.length, i2)] : easing;
|
|
13722
12585
|
}
|
|
13723
12586
|
function isDOMKeyframes(keyframes2) {
|
|
13724
12587
|
return typeof keyframes2 === "object" && !Array.isArray(keyframes2);
|
|
@@ -13749,38 +12612,38 @@ function calcNextTime(current, next, prev, labels) {
|
|
|
13749
12612
|
}
|
|
13750
12613
|
}
|
|
13751
12614
|
function eraseKeyframes(sequence, startTime, endTime) {
|
|
13752
|
-
for (let
|
|
13753
|
-
const keyframe = sequence[
|
|
12615
|
+
for (let i2 = 0; i2 < sequence.length; i2++) {
|
|
12616
|
+
const keyframe = sequence[i2];
|
|
13754
12617
|
if (keyframe.at > startTime && keyframe.at < endTime) {
|
|
13755
12618
|
removeItem(sequence, keyframe);
|
|
13756
|
-
|
|
12619
|
+
i2--;
|
|
13757
12620
|
}
|
|
13758
12621
|
}
|
|
13759
12622
|
}
|
|
13760
12623
|
function addKeyframes(sequence, keyframes2, easing, offset, startTime, endTime) {
|
|
13761
12624
|
eraseKeyframes(sequence, startTime, endTime);
|
|
13762
|
-
for (let
|
|
12625
|
+
for (let i2 = 0; i2 < keyframes2.length; i2++) {
|
|
13763
12626
|
sequence.push({
|
|
13764
|
-
value: keyframes2[
|
|
13765
|
-
at: mixNumber$1(startTime, endTime, offset[
|
|
13766
|
-
easing: getEasingForSegment(easing,
|
|
12627
|
+
value: keyframes2[i2],
|
|
12628
|
+
at: mixNumber$1(startTime, endTime, offset[i2]),
|
|
12629
|
+
easing: getEasingForSegment(easing, i2)
|
|
13767
12630
|
});
|
|
13768
12631
|
}
|
|
13769
12632
|
}
|
|
13770
12633
|
function normalizeTimes(times, repeat) {
|
|
13771
|
-
for (let
|
|
13772
|
-
times[
|
|
12634
|
+
for (let i2 = 0; i2 < times.length; i2++) {
|
|
12635
|
+
times[i2] = times[i2] / (repeat + 1);
|
|
13773
12636
|
}
|
|
13774
12637
|
}
|
|
13775
|
-
function compareByTime(
|
|
13776
|
-
if (
|
|
13777
|
-
if (
|
|
12638
|
+
function compareByTime(a2, b2) {
|
|
12639
|
+
if (a2.at === b2.at) {
|
|
12640
|
+
if (a2.value === null)
|
|
13778
12641
|
return 1;
|
|
13779
|
-
if (
|
|
12642
|
+
if (b2.value === null)
|
|
13780
12643
|
return -1;
|
|
13781
12644
|
return 0;
|
|
13782
12645
|
} else {
|
|
13783
|
-
return
|
|
12646
|
+
return a2.at - b2.at;
|
|
13784
12647
|
}
|
|
13785
12648
|
}
|
|
13786
12649
|
const defaultSegmentEasing = "easeInOut";
|
|
@@ -13794,8 +12657,8 @@ function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...seq
|
|
|
13794
12657
|
let prevTime = 0;
|
|
13795
12658
|
let currentTime = 0;
|
|
13796
12659
|
let totalDuration = 0;
|
|
13797
|
-
for (let
|
|
13798
|
-
const segment = sequence[
|
|
12660
|
+
for (let i2 = 0; i2 < sequence.length; i2++) {
|
|
12661
|
+
const segment = sequence[i2];
|
|
13799
12662
|
if (typeof segment === "string") {
|
|
13800
12663
|
timeLabels.set(segment, currentTime);
|
|
13801
12664
|
continue;
|
|
@@ -13884,8 +12747,8 @@ function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...seq
|
|
|
13884
12747
|
const keyframes2 = [];
|
|
13885
12748
|
const valueOffset = [];
|
|
13886
12749
|
const valueEasing = [];
|
|
13887
|
-
for (let
|
|
13888
|
-
const { at, value, easing } = valueSequence[
|
|
12750
|
+
for (let i2 = 0; i2 < valueSequence.length; i2++) {
|
|
12751
|
+
const { at, value, easing } = valueSequence[i2];
|
|
13889
12752
|
keyframes2.push(value);
|
|
13890
12753
|
valueOffset.push(/* @__PURE__ */ progress(0, totalDuration, at));
|
|
13891
12754
|
valueEasing.push(easing || "easeOut");
|
|
@@ -14019,8 +12882,8 @@ function animateSubject(subject, keyframes2, options, scope) {
|
|
|
14019
12882
|
const subjects = resolveSubjects(subject, keyframes2, scope);
|
|
14020
12883
|
const numSubjects = subjects.length;
|
|
14021
12884
|
invariant(Boolean(numSubjects), "No valid elements provided.");
|
|
14022
|
-
for (let
|
|
14023
|
-
const thisSubject = subjects[
|
|
12885
|
+
for (let i2 = 0; i2 < numSubjects; i2++) {
|
|
12886
|
+
const thisSubject = subjects[i2];
|
|
14024
12887
|
const createVisualElement = thisSubject instanceof Element ? createDOMVisualElement : createObjectVisualElement;
|
|
14025
12888
|
if (!visualElementStore.has(thisSubject)) {
|
|
14026
12889
|
createVisualElement(thisSubject);
|
|
@@ -14028,7 +12891,7 @@ function animateSubject(subject, keyframes2, options, scope) {
|
|
|
14028
12891
|
const visualElement = visualElementStore.get(thisSubject);
|
|
14029
12892
|
const transition = { ...options };
|
|
14030
12893
|
if ("delay" in transition && typeof transition.delay === "function") {
|
|
14031
|
-
transition.delay = transition.delay(
|
|
12894
|
+
transition.delay = transition.delay(i2, numSubjects);
|
|
14032
12895
|
}
|
|
14033
12896
|
animations2.push(...animateTarget(visualElement, { ...keyframes2, transition }, {}));
|
|
14034
12897
|
}
|
|
@@ -14074,7 +12937,7 @@ const DEFAULT_DRAG_CLOSE_THRESHOLD = 0.6;
|
|
|
14074
12937
|
const DEFAULT_DRAG_VELOCITY_THRESHOLD = 500;
|
|
14075
12938
|
const useIsomorphicLayoutEffect = IS_SSR ? useEffect : useLayoutEffect;
|
|
14076
12939
|
function useModalEffect({
|
|
14077
|
-
y,
|
|
12940
|
+
y: y2,
|
|
14078
12941
|
rootId,
|
|
14079
12942
|
sheetRef
|
|
14080
12943
|
}) {
|
|
@@ -14115,36 +12978,36 @@ function useModalEffect({
|
|
|
14115
12978
|
const root = document.querySelector(`#${rootId}`);
|
|
14116
12979
|
if (!root) return;
|
|
14117
12980
|
function onCompleted() {
|
|
14118
|
-
if (
|
|
12981
|
+
if (y2.get() - 10 >= heightRef.current) cleanup();
|
|
14119
12982
|
}
|
|
14120
|
-
const removeStartListener =
|
|
12983
|
+
const removeStartListener = y2.on("animationStart", () => {
|
|
14121
12984
|
var _a;
|
|
14122
12985
|
heightRef.current = ((_a = sheetRef.current) == null ? void 0 : _a.offsetHeight) || window.innerHeight;
|
|
14123
12986
|
setup();
|
|
14124
12987
|
});
|
|
14125
|
-
const removeChangeListener =
|
|
12988
|
+
const removeChangeListener = y2.on("change", (value) => {
|
|
14126
12989
|
if (root) {
|
|
14127
12990
|
const progress2 = Math.max(0, 1 - value / heightRef.current);
|
|
14128
12991
|
const pageWidth = window.innerWidth;
|
|
14129
12992
|
const scale2 = (pageWidth - 16) / pageWidth;
|
|
14130
12993
|
const ty = transform(progress2, [0, 1], [0, 24]);
|
|
14131
|
-
const
|
|
12994
|
+
const s2 = transform(progress2, [0, 1], [1, scale2]);
|
|
14132
12995
|
const borderRadius = transform(progress2, [0, 1], [0, 10]);
|
|
14133
12996
|
const inset = "env(safe-area-inset-top)";
|
|
14134
|
-
root.style.transform = `scale(${
|
|
12997
|
+
root.style.transform = `scale(${s2}) translate3d(0, calc(${inset} + ${ty}px), 0)`;
|
|
14135
12998
|
root.style.borderTopRightRadius = `${borderRadius}px`;
|
|
14136
12999
|
root.style.borderTopLeftRadius = `${borderRadius}px`;
|
|
14137
13000
|
}
|
|
14138
13001
|
});
|
|
14139
|
-
const removeCompleteListener =
|
|
14140
|
-
const removeCancelListener =
|
|
13002
|
+
const removeCompleteListener = y2.on("animationComplete", onCompleted);
|
|
13003
|
+
const removeCancelListener = y2.on("animationCancel", onCompleted);
|
|
14141
13004
|
return () => {
|
|
14142
13005
|
removeStartListener();
|
|
14143
13006
|
removeChangeListener();
|
|
14144
13007
|
removeCompleteListener();
|
|
14145
13008
|
removeCancelListener();
|
|
14146
13009
|
};
|
|
14147
|
-
}, [
|
|
13010
|
+
}, [y2, rootId]);
|
|
14148
13011
|
}
|
|
14149
13012
|
function useEventCallbacks(isOpen, callbacks) {
|
|
14150
13013
|
const prevOpen = usePrevious(isOpen);
|
|
@@ -14238,18 +13101,18 @@ const useSheetScrollerContext = () => {
|
|
|
14238
13101
|
function getClosest(nums, goal) {
|
|
14239
13102
|
let closest = nums[0];
|
|
14240
13103
|
let minDifference = Math.abs(nums[0] - goal);
|
|
14241
|
-
for (let
|
|
14242
|
-
const difference = Math.abs(nums[
|
|
13104
|
+
for (let i2 = 1; i2 < nums.length; i2++) {
|
|
13105
|
+
const difference = Math.abs(nums[i2] - goal);
|
|
14243
13106
|
if (difference < minDifference) {
|
|
14244
|
-
closest = nums[
|
|
13107
|
+
closest = nums[i2];
|
|
14245
13108
|
minDifference = difference;
|
|
14246
13109
|
}
|
|
14247
13110
|
}
|
|
14248
13111
|
return closest;
|
|
14249
13112
|
}
|
|
14250
13113
|
function inDescendingOrder(arr) {
|
|
14251
|
-
for (let
|
|
14252
|
-
if (arr[
|
|
13114
|
+
for (let i2 = 0; i2 < arr.length; i2++) {
|
|
13115
|
+
if (arr[i2 + 1] > arr[i2]) return false;
|
|
14253
13116
|
}
|
|
14254
13117
|
return true;
|
|
14255
13118
|
}
|
|
@@ -14279,9 +13142,9 @@ function isTouchDevice() {
|
|
|
14279
13142
|
if (typeof window === "undefined") return false;
|
|
14280
13143
|
return "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
14281
13144
|
}
|
|
14282
|
-
function testPlatform(
|
|
13145
|
+
function testPlatform(re2) {
|
|
14283
13146
|
var _a;
|
|
14284
|
-
return typeof window !== "undefined" && window.navigator != null ?
|
|
13147
|
+
return typeof window !== "undefined" && window.navigator != null ? re2.test(
|
|
14285
13148
|
// @ts-expect-error
|
|
14286
13149
|
((_a = window.navigator.userAgentData) == null ? void 0 : _a.platform) || window.navigator.platform
|
|
14287
13150
|
) : false;
|
|
@@ -14390,39 +13253,39 @@ function preventScrollStandard() {
|
|
|
14390
13253
|
function preventScrollMobileSafari() {
|
|
14391
13254
|
let scrollable;
|
|
14392
13255
|
let lastY = 0;
|
|
14393
|
-
const onTouchStart = (
|
|
13256
|
+
const onTouchStart = (e2) => {
|
|
14394
13257
|
var _a;
|
|
14395
|
-
const target = (_a =
|
|
13258
|
+
const target = (_a = e2.composedPath()) == null ? void 0 : _a[0];
|
|
14396
13259
|
scrollable = getScrollParent(target, true);
|
|
14397
13260
|
if (scrollable === document.documentElement && scrollable === document.body) {
|
|
14398
13261
|
return;
|
|
14399
13262
|
}
|
|
14400
|
-
lastY =
|
|
13263
|
+
lastY = e2.changedTouches[0].pageY;
|
|
14401
13264
|
};
|
|
14402
|
-
const onTouchMove = (
|
|
13265
|
+
const onTouchMove = (e2) => {
|
|
14403
13266
|
if (scrollable === void 0) {
|
|
14404
13267
|
return;
|
|
14405
13268
|
}
|
|
14406
13269
|
if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {
|
|
14407
|
-
|
|
13270
|
+
e2.preventDefault();
|
|
14408
13271
|
return;
|
|
14409
13272
|
}
|
|
14410
|
-
const
|
|
13273
|
+
const y2 = e2.changedTouches[0].pageY;
|
|
14411
13274
|
const scrollTop = scrollable.scrollTop;
|
|
14412
13275
|
const bottom = scrollable.scrollHeight - scrollable.clientHeight;
|
|
14413
13276
|
if (bottom === 0) {
|
|
14414
13277
|
return;
|
|
14415
13278
|
}
|
|
14416
|
-
if (scrollTop <= 0 &&
|
|
14417
|
-
|
|
13279
|
+
if (scrollTop <= 0 && y2 > lastY || scrollTop >= bottom && y2 < lastY) {
|
|
13280
|
+
e2.preventDefault();
|
|
14418
13281
|
}
|
|
14419
|
-
lastY =
|
|
13282
|
+
lastY = y2;
|
|
14420
13283
|
};
|
|
14421
|
-
const onTouchEnd = (
|
|
13284
|
+
const onTouchEnd = (e2) => {
|
|
14422
13285
|
var _a;
|
|
14423
|
-
const target = (_a =
|
|
13286
|
+
const target = (_a = e2.composedPath()) == null ? void 0 : _a[0];
|
|
14424
13287
|
if (willOpenKeyboard(target) && target !== document.activeElement) {
|
|
14425
|
-
|
|
13288
|
+
e2.preventDefault();
|
|
14426
13289
|
target.style.transform = "translateY(-2000px)";
|
|
14427
13290
|
target.focus();
|
|
14428
13291
|
requestAnimationFrame(() => {
|
|
@@ -14430,9 +13293,9 @@ function preventScrollMobileSafari() {
|
|
|
14430
13293
|
});
|
|
14431
13294
|
}
|
|
14432
13295
|
};
|
|
14433
|
-
const onFocus = (
|
|
13296
|
+
const onFocus = (e2) => {
|
|
14434
13297
|
var _a;
|
|
14435
|
-
const target = (_a =
|
|
13298
|
+
const target = (_a = e2.composedPath()) == null ? void 0 : _a[0];
|
|
14436
13299
|
if (willOpenKeyboard(target)) {
|
|
14437
13300
|
target.style.transform = "translateY(-2000px)";
|
|
14438
13301
|
requestAnimationFrame(() => {
|
|
@@ -14621,9 +13484,9 @@ const Sheet$1 = forwardRef(
|
|
|
14621
13484
|
type: "tween",
|
|
14622
13485
|
...reduceMotion ? REDUCED_MOTION_TWEEN_CONFIG : tweenConfig
|
|
14623
13486
|
};
|
|
14624
|
-
const
|
|
14625
|
-
const zIndex2 = useTransform(
|
|
14626
|
-
const visibility = useTransform(
|
|
13487
|
+
const y2 = useMotionValue(windowHeight);
|
|
13488
|
+
const zIndex2 = useTransform(y2, (value) => value + 2 >= windowHeight ? -1 : (style == null ? void 0 : style.zIndex) ?? 1300);
|
|
13489
|
+
const visibility = useTransform(y2, (value) => value + 2 >= windowHeight ? "hidden" : "visible");
|
|
14627
13490
|
const callbacks = useRef({
|
|
14628
13491
|
onOpenStart,
|
|
14629
13492
|
onOpenEnd,
|
|
@@ -14649,11 +13512,11 @@ const Sheet$1 = forwardRef(
|
|
|
14649
13512
|
`Snap points need to be in descending order got: [${snapPoints.join(", ")}]`
|
|
14650
13513
|
);
|
|
14651
13514
|
}
|
|
14652
|
-
const onDrag = useEffectEvent((
|
|
14653
|
-
const velocity =
|
|
13515
|
+
const onDrag = useEffectEvent((_2, { delta }) => {
|
|
13516
|
+
const velocity = y2.getVelocity();
|
|
14654
13517
|
if (velocity > 0) indicatorRotation.set(10);
|
|
14655
13518
|
if (velocity < 0) indicatorRotation.set(-10);
|
|
14656
|
-
|
|
13519
|
+
y2.set(Math.max(y2.get() + delta.y, 0));
|
|
14657
13520
|
});
|
|
14658
13521
|
const onDragStart = useEffectEvent(() => {
|
|
14659
13522
|
const focusedElement = document.activeElement;
|
|
@@ -14663,15 +13526,15 @@ const Sheet$1 = forwardRef(
|
|
|
14663
13526
|
focusedElement.blur();
|
|
14664
13527
|
}
|
|
14665
13528
|
});
|
|
14666
|
-
const onDragEnd = useEffectEvent((
|
|
13529
|
+
const onDragEnd = useEffectEvent((_2, { velocity }) => {
|
|
14667
13530
|
if (velocity.y > dragVelocityThreshold) {
|
|
14668
13531
|
onClose();
|
|
14669
13532
|
} else {
|
|
14670
13533
|
const sheetHeight = sheetRef.current.getBoundingClientRect().height;
|
|
14671
|
-
const currentY =
|
|
13534
|
+
const currentY = y2.get();
|
|
14672
13535
|
let snapTo = 0;
|
|
14673
13536
|
if (snapPoints) {
|
|
14674
|
-
const snapToValues = snapPoints.map((
|
|
13537
|
+
const snapToValues = snapPoints.map((p2) => sheetHeight - Math.min(p2, sheetHeight));
|
|
14675
13538
|
if (detent === "content-height" && !snapToValues.includes(0)) {
|
|
14676
13539
|
snapToValues.unshift(0);
|
|
14677
13540
|
}
|
|
@@ -14680,7 +13543,7 @@ const Sheet$1 = forwardRef(
|
|
|
14680
13543
|
snapTo = sheetHeight;
|
|
14681
13544
|
}
|
|
14682
13545
|
snapTo = validateSnapTo({ snapTo, sheetHeight });
|
|
14683
|
-
animate(
|
|
13546
|
+
animate(y2, snapTo, animationOptions);
|
|
14684
13547
|
if (snapPoints && onSnap) {
|
|
14685
13548
|
const snapValue = Math.abs(Math.round(snapPoints[0] - snapTo));
|
|
14686
13549
|
const snapIndex = snapPoints.indexOf(getClosest(snapPoints, snapValue));
|
|
@@ -14698,7 +13561,7 @@ const Sheet$1 = forwardRef(
|
|
|
14698
13561
|
onSnap(snapIndex);
|
|
14699
13562
|
}, [isOpen]);
|
|
14700
13563
|
useImperativeHandle(ref, () => ({
|
|
14701
|
-
y,
|
|
13564
|
+
y: y2,
|
|
14702
13565
|
snapTo: (snapIndex) => {
|
|
14703
13566
|
const sheetEl = sheetRef.current;
|
|
14704
13567
|
if ((snapPoints == null ? void 0 : snapPoints[snapIndex]) !== void 0 && sheetEl) {
|
|
@@ -14708,14 +13571,14 @@ const Sheet$1 = forwardRef(
|
|
|
14708
13571
|
snapTo: sheetHeight - snapPoint,
|
|
14709
13572
|
sheetHeight
|
|
14710
13573
|
});
|
|
14711
|
-
animate(
|
|
13574
|
+
animate(y2, snapTo, animationOptions);
|
|
14712
13575
|
if (onSnap) onSnap(snapIndex);
|
|
14713
13576
|
if (snapTo >= sheetHeight) onClose();
|
|
14714
13577
|
}
|
|
14715
13578
|
}
|
|
14716
13579
|
}));
|
|
14717
13580
|
useModalEffect({
|
|
14718
|
-
y,
|
|
13581
|
+
y: y2,
|
|
14719
13582
|
rootId,
|
|
14720
13583
|
sheetRef
|
|
14721
13584
|
});
|
|
@@ -14733,7 +13596,7 @@ const Sheet$1 = forwardRef(
|
|
|
14733
13596
|
return disableDrag ? void 0 : dragProps2;
|
|
14734
13597
|
}, [disableDrag, windowHeight]);
|
|
14735
13598
|
const context2 = {
|
|
14736
|
-
y,
|
|
13599
|
+
y: y2,
|
|
14737
13600
|
sheetRef,
|
|
14738
13601
|
isOpen,
|
|
14739
13602
|
initialSnap,
|
|
@@ -14747,7 +13610,7 @@ const Sheet$1 = forwardRef(
|
|
|
14747
13610
|
reduceMotion,
|
|
14748
13611
|
disableDrag
|
|
14749
13612
|
};
|
|
14750
|
-
const sheet = /* @__PURE__ */ jsx(SheetContext.Provider, { value: context2, children: /* @__PURE__ */ jsx(motion.div, { ...rest, ref, style: { ...styles.wrapper, zIndex: zIndex2, visibility, ...style }, children: /* @__PURE__ */ jsx(AnimatePresence, { children: isOpen ? /* @__PURE__ */ jsx(SheetScrollerContextProvider, { children: Children.map(children, (child,
|
|
13613
|
+
const sheet = /* @__PURE__ */ jsx(SheetContext.Provider, { value: context2, children: /* @__PURE__ */ jsx(motion.div, { ...rest, ref, style: { ...styles.wrapper, zIndex: zIndex2, visibility, ...style }, children: /* @__PURE__ */ jsx(AnimatePresence, { children: isOpen ? /* @__PURE__ */ jsx(SheetScrollerContextProvider, { children: Children.map(children, (child, i2) => cloneElement(child, { key: `sheet-child-${i2}` })) }) : null }) }) });
|
|
14751
13614
|
if (IS_SSR) return sheet;
|
|
14752
13615
|
return createPortal(sheet, mountPoint ?? document.body);
|
|
14753
13616
|
}
|
|
@@ -14756,7 +13619,7 @@ Sheet$1.displayName = "Sheet";
|
|
|
14756
13619
|
const SheetContainer = forwardRef(
|
|
14757
13620
|
({ children, style = {}, className = "", ...rest }, ref) => {
|
|
14758
13621
|
const {
|
|
14759
|
-
y,
|
|
13622
|
+
y: y2,
|
|
14760
13623
|
isOpen,
|
|
14761
13624
|
callbacks,
|
|
14762
13625
|
snapPoints,
|
|
@@ -14782,7 +13645,7 @@ const SheetContainer = forwardRef(
|
|
|
14782
13645
|
...style,
|
|
14783
13646
|
...detent === "full-height" && { height },
|
|
14784
13647
|
...detent === "content-height" && { maxHeight: height },
|
|
14785
|
-
y
|
|
13648
|
+
y: y2
|
|
14786
13649
|
},
|
|
14787
13650
|
initial: reduceMotion ? false : { y: windowHeight },
|
|
14788
13651
|
animate: { y: initialY, transition: animationOptions },
|
|
@@ -14885,16 +13748,16 @@ const SheetScroller = forwardRef(
|
|
|
14885
13748
|
sheetScrollerContext.setDragDisabled();
|
|
14886
13749
|
}
|
|
14887
13750
|
}
|
|
14888
|
-
function onScroll(
|
|
14889
|
-
determineDragState(
|
|
13751
|
+
function onScroll(e2) {
|
|
13752
|
+
determineDragState(e2.currentTarget);
|
|
14890
13753
|
if (rest.onScroll) {
|
|
14891
|
-
rest.onScroll(
|
|
13754
|
+
rest.onScroll(e2);
|
|
14892
13755
|
}
|
|
14893
13756
|
}
|
|
14894
|
-
function onTouchStart(
|
|
14895
|
-
determineDragState(
|
|
13757
|
+
function onTouchStart(e2) {
|
|
13758
|
+
determineDragState(e2.currentTarget);
|
|
14896
13759
|
if (rest.onTouchStart) {
|
|
14897
|
-
rest.onTouchStart(
|
|
13760
|
+
rest.onTouchStart(e2);
|
|
14898
13761
|
}
|
|
14899
13762
|
}
|
|
14900
13763
|
const scrollProps = isTouchDevice() ? { onScroll, onTouchStart } : void 0;
|
|
@@ -15071,7 +13934,7 @@ BottomSheet.Handle = Handle;
|
|
|
15071
13934
|
BottomSheet.Scroller = Sheet.Scroller;
|
|
15072
13935
|
const navigationRecipe = sva({
|
|
15073
13936
|
className: "navigation",
|
|
15074
|
-
slots: anatomy
|
|
13937
|
+
slots: anatomy.keys(),
|
|
15075
13938
|
base: {
|
|
15076
13939
|
root: {
|
|
15077
13940
|
bg: "surface.layer_1",
|
|
@@ -15112,16 +13975,16 @@ const navigationRecipe = sva({
|
|
|
15112
13975
|
}
|
|
15113
13976
|
}
|
|
15114
13977
|
});
|
|
15115
|
-
const { withRootProvider: withRootProvider$1, withContext: withContext$
|
|
13978
|
+
const { withRootProvider: withRootProvider$1, withContext: withContext$1 } = createStyleContext(navigationRecipe);
|
|
15116
13979
|
const Root$2 = withRootProvider$1(TabsRoot);
|
|
15117
|
-
const Trigger$1 = withContext$
|
|
13980
|
+
const Trigger$1 = withContext$1(
|
|
15118
13981
|
({ icon, label, ...props }) => /* @__PURE__ */ jsxs(TabTrigger, { ...props, children: [
|
|
15119
13982
|
icon,
|
|
15120
13983
|
label
|
|
15121
13984
|
] }),
|
|
15122
13985
|
"trigger"
|
|
15123
13986
|
);
|
|
15124
|
-
const List$1 = withContext$
|
|
13987
|
+
const List$1 = withContext$1(TabList, "list");
|
|
15125
13988
|
const Navigation = {
|
|
15126
13989
|
Root: Root$2,
|
|
15127
13990
|
Item: Trigger$1,
|
|
@@ -15250,18 +14113,18 @@ const tagRecipe = cva({
|
|
|
15250
14113
|
avatar: false
|
|
15251
14114
|
}
|
|
15252
14115
|
});
|
|
15253
|
-
function P({ size:
|
|
14116
|
+
function P$1({ size: C2 = 24, color: n2 = "currentColor", ...o2 }) {
|
|
15254
14117
|
return /* @__PURE__ */ jsx(
|
|
15255
14118
|
"svg",
|
|
15256
14119
|
{
|
|
15257
|
-
width:
|
|
15258
|
-
height:
|
|
14120
|
+
width: C2,
|
|
14121
|
+
height: C2,
|
|
15259
14122
|
viewBox: "0 0 24 24",
|
|
15260
14123
|
fill: "none",
|
|
15261
14124
|
xmlns: "http://www.w3.org/2000/svg",
|
|
15262
14125
|
strokeWidth: "0",
|
|
15263
|
-
color:
|
|
15264
|
-
...
|
|
14126
|
+
color: n2,
|
|
14127
|
+
...o2,
|
|
15265
14128
|
children: /* @__PURE__ */ jsx(
|
|
15266
14129
|
"path",
|
|
15267
14130
|
{
|
|
@@ -15277,8 +14140,8 @@ function P({ size: C = 24, color: n = "currentColor", ...o }) {
|
|
|
15277
14140
|
}
|
|
15278
14141
|
const Tag = forwardRef(({ imageSrc, text, onDeleteClick, ...rest }, ref) => {
|
|
15279
14142
|
const StyledTag = styled(ark.div, tagRecipe);
|
|
15280
|
-
const handleClickDelete = (
|
|
15281
|
-
|
|
14143
|
+
const handleClickDelete = (e2) => {
|
|
14144
|
+
e2.stopPropagation();
|
|
15282
14145
|
if (onDeleteClick) {
|
|
15283
14146
|
onDeleteClick();
|
|
15284
14147
|
}
|
|
@@ -15293,7 +14156,7 @@ const Tag = forwardRef(({ imageSrc, text, onDeleteClick, ...rest }, ref) => {
|
|
|
15293
14156
|
}
|
|
15294
14157
|
) : null,
|
|
15295
14158
|
text,
|
|
15296
|
-
onDeleteClick ? /* @__PURE__ */ jsx(P, { size: 12, onClick: handleClickDelete, className: css$1({ cursor: "pointer" }) }) : null
|
|
14159
|
+
onDeleteClick ? /* @__PURE__ */ jsx(P$1, { size: 12, onClick: handleClickDelete, className: css$1({ cursor: "pointer" }) }) : null
|
|
15297
14160
|
] });
|
|
15298
14161
|
});
|
|
15299
14162
|
Tag.displayName = "Tag";
|
|
@@ -15519,11 +14382,11 @@ const Input = forwardRef(
|
|
|
15519
14382
|
const innerRef = useRef(null);
|
|
15520
14383
|
const inputRef = ref || innerRef;
|
|
15521
14384
|
const handleInputChange = useCallback(
|
|
15522
|
-
(
|
|
14385
|
+
(e2) => {
|
|
15523
14386
|
if (disabled) return;
|
|
15524
|
-
const { value } =
|
|
15525
|
-
|
|
15526
|
-
onChange == null ? void 0 : onChange(
|
|
14387
|
+
const { value } = e2.target;
|
|
14388
|
+
e2.target.value = value.slice(0, textLimit);
|
|
14389
|
+
onChange == null ? void 0 : onChange(e2);
|
|
15527
14390
|
},
|
|
15528
14391
|
[disabled, onChange, textLimit]
|
|
15529
14392
|
);
|
|
@@ -15595,11 +14458,11 @@ const Textarea = forwardRef(
|
|
|
15595
14458
|
const innerRef = useRef(null);
|
|
15596
14459
|
const inputRef = ref || innerRef;
|
|
15597
14460
|
const handleTextareaChange = useCallback(
|
|
15598
|
-
(
|
|
14461
|
+
(e2) => {
|
|
15599
14462
|
if (disabled) return;
|
|
15600
|
-
const { value: value2 } =
|
|
15601
|
-
|
|
15602
|
-
onChange == null ? void 0 : onChange(
|
|
14463
|
+
const { value: value2 } = e2.target;
|
|
14464
|
+
e2.target.value = value2.slice(0, textLimit);
|
|
14465
|
+
onChange == null ? void 0 : onChange(e2);
|
|
15603
14466
|
if (showTextCount) setCount(value2.length);
|
|
15604
14467
|
},
|
|
15605
14468
|
[disabled, onChange, textLimit, showTextCount]
|
|
@@ -15648,7 +14511,7 @@ Textarea.displayName = "Textarea";
|
|
|
15648
14511
|
const index = memo$2(Textarea);
|
|
15649
14512
|
const tabsRecipe = sva({
|
|
15650
14513
|
className: "tabs",
|
|
15651
|
-
slots: anatomy
|
|
14514
|
+
slots: anatomy.keys(),
|
|
15652
14515
|
base: {
|
|
15653
14516
|
root: {
|
|
15654
14517
|
display: "flex",
|
|
@@ -15728,87 +14591,683 @@ const tabsRecipe = sva({
|
|
|
15728
14591
|
}
|
|
15729
14592
|
}
|
|
15730
14593
|
},
|
|
15731
|
-
fitted: {
|
|
15732
|
-
true: {
|
|
14594
|
+
fitted: {
|
|
14595
|
+
true: {
|
|
14596
|
+
root: {
|
|
14597
|
+
width: "100%"
|
|
14598
|
+
},
|
|
14599
|
+
list: {
|
|
14600
|
+
width: "100%",
|
|
14601
|
+
p: 1,
|
|
14602
|
+
overflowX: "visible"
|
|
14603
|
+
},
|
|
14604
|
+
trigger: {
|
|
14605
|
+
flex: 1,
|
|
14606
|
+
justifyContent: "center",
|
|
14607
|
+
overflow: "hidden",
|
|
14608
|
+
textOverflow: "ellipsis",
|
|
14609
|
+
whiteSpace: "nowrap"
|
|
14610
|
+
}
|
|
14611
|
+
}
|
|
14612
|
+
},
|
|
14613
|
+
bottomLine: {
|
|
14614
|
+
true: {
|
|
14615
|
+
list: {
|
|
14616
|
+
borderBottomWidth: "1px",
|
|
14617
|
+
borderColor: "background.neutral.selected"
|
|
14618
|
+
}
|
|
14619
|
+
},
|
|
14620
|
+
false: {
|
|
14621
|
+
list: {
|
|
14622
|
+
borderBottomWidth: "0px"
|
|
14623
|
+
}
|
|
14624
|
+
}
|
|
14625
|
+
},
|
|
14626
|
+
shadow: {
|
|
14627
|
+
true: {
|
|
14628
|
+
list: {
|
|
14629
|
+
boxShadow: "0px 8px 12px 0px var(--colors-semantic-shadow-overlay, rgba(0, 0, 0, 0.08))"
|
|
14630
|
+
}
|
|
14631
|
+
}
|
|
14632
|
+
}
|
|
14633
|
+
},
|
|
14634
|
+
compoundVariants: [
|
|
14635
|
+
{
|
|
14636
|
+
variant: "enclosed",
|
|
14637
|
+
fitted: true,
|
|
14638
|
+
css: {
|
|
14639
|
+
list: {
|
|
14640
|
+
background: "background.neutral.default",
|
|
14641
|
+
borderRadius: "full"
|
|
14642
|
+
}
|
|
14643
|
+
}
|
|
14644
|
+
},
|
|
14645
|
+
{
|
|
14646
|
+
variant: "enclosed",
|
|
14647
|
+
bottomLine: true,
|
|
14648
|
+
css: {
|
|
14649
|
+
list: {
|
|
14650
|
+
borderBottomWidth: "0px"
|
|
14651
|
+
}
|
|
14652
|
+
}
|
|
14653
|
+
}
|
|
14654
|
+
],
|
|
14655
|
+
defaultVariants: {
|
|
14656
|
+
variant: "line",
|
|
14657
|
+
fitted: false,
|
|
14658
|
+
bottomLine: true,
|
|
14659
|
+
shadow: false
|
|
14660
|
+
}
|
|
14661
|
+
});
|
|
14662
|
+
const { withRootProvider, withContext } = createStyleContext(tabsRecipe);
|
|
14663
|
+
const Root$1 = withRootProvider(TabsRoot);
|
|
14664
|
+
const List = withContext(TabList, "list");
|
|
14665
|
+
const Trigger = withContext(TabTrigger, "trigger");
|
|
14666
|
+
const Content$1 = withContext(TabContent, "content");
|
|
14667
|
+
const Indicator = withContext(TabIndicator, "indicator");
|
|
14668
|
+
const Tabs = Object.assign(Root$1, {
|
|
14669
|
+
Root: Root$1,
|
|
14670
|
+
List,
|
|
14671
|
+
Trigger,
|
|
14672
|
+
Content: Content$1,
|
|
14673
|
+
Indicator
|
|
14674
|
+
});
|
|
14675
|
+
let e = { data: "" }, t = (t2) => "object" == typeof window ? ((t2 ? t2.querySelector("#_goober") : window._goober) || Object.assign((t2 || document.head).appendChild(document.createElement("style")), { innerHTML: " ", id: "_goober" })).firstChild : t2 || e, l = /(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g, a = /\/\*[^]*?\*\/| +/g, n = /\n+/g, o = (e2, t2) => {
|
|
14676
|
+
let r = "", l2 = "", a2 = "";
|
|
14677
|
+
for (let n2 in e2) {
|
|
14678
|
+
let c2 = e2[n2];
|
|
14679
|
+
"@" == n2[0] ? "i" == n2[1] ? r = n2 + " " + c2 + ";" : l2 += "f" == n2[1] ? o(c2, n2) : n2 + "{" + o(c2, "k" == n2[1] ? "" : t2) + "}" : "object" == typeof c2 ? l2 += o(c2, t2 ? t2.replace(/([^,])+/g, (e3) => n2.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g, (t3) => /&/.test(t3) ? t3.replace(/&/g, e3) : e3 ? e3 + " " + t3 : t3)) : n2) : null != c2 && (n2 = /^--/.test(n2) ? n2 : n2.replace(/[A-Z]/g, "-$&").toLowerCase(), a2 += o.p ? o.p(n2, c2) : n2 + ":" + c2 + ";");
|
|
14680
|
+
}
|
|
14681
|
+
return r + (t2 && a2 ? t2 + "{" + a2 + "}" : a2) + l2;
|
|
14682
|
+
}, c$1 = {}, s = (e2) => {
|
|
14683
|
+
if ("object" == typeof e2) {
|
|
14684
|
+
let t2 = "";
|
|
14685
|
+
for (let r in e2) t2 += r + s(e2[r]);
|
|
14686
|
+
return t2;
|
|
14687
|
+
}
|
|
14688
|
+
return e2;
|
|
14689
|
+
}, i = (e2, t2, r, i2, p2) => {
|
|
14690
|
+
let u2 = s(e2), d2 = c$1[u2] || (c$1[u2] = ((e3) => {
|
|
14691
|
+
let t3 = 0, r2 = 11;
|
|
14692
|
+
for (; t3 < e3.length; ) r2 = 101 * r2 + e3.charCodeAt(t3++) >>> 0;
|
|
14693
|
+
return "go" + r2;
|
|
14694
|
+
})(u2));
|
|
14695
|
+
if (!c$1[d2]) {
|
|
14696
|
+
let t3 = u2 !== e2 ? e2 : ((e3) => {
|
|
14697
|
+
let t4, r2, o2 = [{}];
|
|
14698
|
+
for (; t4 = l.exec(e3.replace(a, "")); ) t4[4] ? o2.shift() : t4[3] ? (r2 = t4[3].replace(n, " ").trim(), o2.unshift(o2[0][r2] = o2[0][r2] || {})) : o2[0][t4[1]] = t4[2].replace(n, " ").trim();
|
|
14699
|
+
return o2[0];
|
|
14700
|
+
})(e2);
|
|
14701
|
+
c$1[d2] = o(p2 ? { ["@keyframes " + d2]: t3 } : t3, r ? "" : "." + d2);
|
|
14702
|
+
}
|
|
14703
|
+
let f2 = r && c$1.g ? c$1.g : null;
|
|
14704
|
+
return r && (c$1.g = c$1[d2]), ((e3, t3, r2, l2) => {
|
|
14705
|
+
l2 ? t3.data = t3.data.replace(l2, e3) : -1 === t3.data.indexOf(e3) && (t3.data = r2 ? e3 + t3.data : t3.data + e3);
|
|
14706
|
+
})(c$1[d2], t2, i2, f2), d2;
|
|
14707
|
+
}, p = (e2, t2, r) => e2.reduce((e3, l2, a2) => {
|
|
14708
|
+
let n2 = t2[a2];
|
|
14709
|
+
if (n2 && n2.call) {
|
|
14710
|
+
let e4 = n2(r), t3 = e4 && e4.props && e4.props.className || /^go/.test(e4) && e4;
|
|
14711
|
+
n2 = t3 ? "." + t3 : e4 && "object" == typeof e4 ? e4.props ? "" : o(e4, "") : false === e4 ? "" : e4;
|
|
14712
|
+
}
|
|
14713
|
+
return e3 + l2 + (null == n2 ? "" : n2);
|
|
14714
|
+
}, "");
|
|
14715
|
+
function u$1(e2) {
|
|
14716
|
+
let r = this || {}, l2 = e2.call ? e2(r.p) : e2;
|
|
14717
|
+
return i(l2.unshift ? l2.raw ? p(l2, [].slice.call(arguments, 1), r.p) : l2.reduce((e3, t2) => Object.assign(e3, t2 && t2.call ? t2(r.p) : t2), {}) : l2, t(r.target), r.g, r.o, r.k);
|
|
14718
|
+
}
|
|
14719
|
+
let d, f$1, g$1;
|
|
14720
|
+
u$1.bind({ g: 1 });
|
|
14721
|
+
let h = u$1.bind({ k: 1 });
|
|
14722
|
+
function m$1(e2, t2, r, l2) {
|
|
14723
|
+
o.p = t2, d = e2, f$1 = r, g$1 = l2;
|
|
14724
|
+
}
|
|
14725
|
+
function j(e2, t2) {
|
|
14726
|
+
let r = this || {};
|
|
14727
|
+
return function() {
|
|
14728
|
+
let l2 = arguments;
|
|
14729
|
+
function a2(n2, o2) {
|
|
14730
|
+
let c2 = Object.assign({}, n2), s2 = c2.className || a2.className;
|
|
14731
|
+
r.p = Object.assign({ theme: f$1 && f$1() }, c2), r.o = / *go\d+/.test(s2), c2.className = u$1.apply(r, l2) + (s2 ? " " + s2 : "");
|
|
14732
|
+
let i2 = e2;
|
|
14733
|
+
return e2[0] && (i2 = c2.as || e2, delete c2.as), g$1 && i2[0] && g$1(c2), d(i2, c2);
|
|
14734
|
+
}
|
|
14735
|
+
return a2;
|
|
14736
|
+
};
|
|
14737
|
+
}
|
|
14738
|
+
var W = (e2) => typeof e2 == "function", f = (e2, t2) => W(e2) ? e2(t2) : e2;
|
|
14739
|
+
var F = /* @__PURE__ */ (() => {
|
|
14740
|
+
let e2 = 0;
|
|
14741
|
+
return () => (++e2).toString();
|
|
14742
|
+
})(), A = /* @__PURE__ */ (() => {
|
|
14743
|
+
let e2;
|
|
14744
|
+
return () => {
|
|
14745
|
+
if (e2 === void 0 && typeof window < "u") {
|
|
14746
|
+
let t2 = matchMedia("(prefers-reduced-motion: reduce)");
|
|
14747
|
+
e2 = !t2 || t2.matches;
|
|
14748
|
+
}
|
|
14749
|
+
return e2;
|
|
14750
|
+
};
|
|
14751
|
+
})();
|
|
14752
|
+
var Y = 20;
|
|
14753
|
+
var U = (e2, t2) => {
|
|
14754
|
+
switch (t2.type) {
|
|
14755
|
+
case 0:
|
|
14756
|
+
return { ...e2, toasts: [t2.toast, ...e2.toasts].slice(0, Y) };
|
|
14757
|
+
case 1:
|
|
14758
|
+
return { ...e2, toasts: e2.toasts.map((o2) => o2.id === t2.toast.id ? { ...o2, ...t2.toast } : o2) };
|
|
14759
|
+
case 2:
|
|
14760
|
+
let { toast: r } = t2;
|
|
14761
|
+
return U(e2, { type: e2.toasts.find((o2) => o2.id === r.id) ? 1 : 0, toast: r });
|
|
14762
|
+
case 3:
|
|
14763
|
+
let { toastId: s2 } = t2;
|
|
14764
|
+
return { ...e2, toasts: e2.toasts.map((o2) => o2.id === s2 || s2 === void 0 ? { ...o2, dismissed: true, visible: false } : o2) };
|
|
14765
|
+
case 4:
|
|
14766
|
+
return t2.toastId === void 0 ? { ...e2, toasts: [] } : { ...e2, toasts: e2.toasts.filter((o2) => o2.id !== t2.toastId) };
|
|
14767
|
+
case 5:
|
|
14768
|
+
return { ...e2, pausedAt: t2.time };
|
|
14769
|
+
case 6:
|
|
14770
|
+
let a2 = t2.time - (e2.pausedAt || 0);
|
|
14771
|
+
return { ...e2, pausedAt: void 0, toasts: e2.toasts.map((o2) => ({ ...o2, pauseDuration: o2.pauseDuration + a2 })) };
|
|
14772
|
+
}
|
|
14773
|
+
}, P = [], y = { toasts: [], pausedAt: void 0 }, u = (e2) => {
|
|
14774
|
+
y = U(y, e2), P.forEach((t2) => {
|
|
14775
|
+
t2(y);
|
|
14776
|
+
});
|
|
14777
|
+
}, q = { blank: 4e3, error: 4e3, success: 2e3, loading: 1 / 0, custom: 4e3 }, D = (e2 = {}) => {
|
|
14778
|
+
let [t2, r] = useState(y), s2 = useRef(y);
|
|
14779
|
+
useEffect(() => (s2.current !== y && r(y), P.push(r), () => {
|
|
14780
|
+
let o2 = P.indexOf(r);
|
|
14781
|
+
o2 > -1 && P.splice(o2, 1);
|
|
14782
|
+
}), []);
|
|
14783
|
+
let a2 = t2.toasts.map((o2) => {
|
|
14784
|
+
var n2, i2, p2;
|
|
14785
|
+
return { ...e2, ...e2[o2.type], ...o2, removeDelay: o2.removeDelay || ((n2 = e2[o2.type]) == null ? void 0 : n2.removeDelay) || (e2 == null ? void 0 : e2.removeDelay), duration: o2.duration || ((i2 = e2[o2.type]) == null ? void 0 : i2.duration) || (e2 == null ? void 0 : e2.duration) || q[o2.type], style: { ...e2.style, ...(p2 = e2[o2.type]) == null ? void 0 : p2.style, ...o2.style } };
|
|
14786
|
+
});
|
|
14787
|
+
return { ...t2, toasts: a2 };
|
|
14788
|
+
};
|
|
14789
|
+
var J = (e2, t2 = "blank", r) => ({ createdAt: Date.now(), visible: true, dismissed: false, type: t2, ariaProps: { role: "status", "aria-live": "polite" }, message: e2, pauseDuration: 0, ...r, id: (r == null ? void 0 : r.id) || F() }), x = (e2) => (t2, r) => {
|
|
14790
|
+
let s2 = J(t2, e2, r);
|
|
14791
|
+
return u({ type: 2, toast: s2 }), s2.id;
|
|
14792
|
+
}, c = (e2, t2) => x("blank")(e2, t2);
|
|
14793
|
+
c.error = x("error");
|
|
14794
|
+
c.success = x("success");
|
|
14795
|
+
c.loading = x("loading");
|
|
14796
|
+
c.custom = x("custom");
|
|
14797
|
+
c.dismiss = (e2) => {
|
|
14798
|
+
u({ type: 3, toastId: e2 });
|
|
14799
|
+
};
|
|
14800
|
+
c.remove = (e2) => u({ type: 4, toastId: e2 });
|
|
14801
|
+
c.promise = (e2, t2, r) => {
|
|
14802
|
+
let s2 = c.loading(t2.loading, { ...r, ...r == null ? void 0 : r.loading });
|
|
14803
|
+
return typeof e2 == "function" && (e2 = e2()), e2.then((a2) => {
|
|
14804
|
+
let o2 = t2.success ? f(t2.success, a2) : void 0;
|
|
14805
|
+
return o2 ? c.success(o2, { id: s2, ...r, ...r == null ? void 0 : r.success }) : c.dismiss(s2), a2;
|
|
14806
|
+
}).catch((a2) => {
|
|
14807
|
+
let o2 = t2.error ? f(t2.error, a2) : void 0;
|
|
14808
|
+
o2 ? c.error(o2, { id: s2, ...r, ...r == null ? void 0 : r.error }) : c.dismiss(s2);
|
|
14809
|
+
}), e2;
|
|
14810
|
+
};
|
|
14811
|
+
var K = (e2, t2) => {
|
|
14812
|
+
u({ type: 1, toast: { id: e2, height: t2 } });
|
|
14813
|
+
}, X = () => {
|
|
14814
|
+
u({ type: 5, time: Date.now() });
|
|
14815
|
+
}, b = /* @__PURE__ */ new Map(), Z = 1e3, ee = (e2, t2 = Z) => {
|
|
14816
|
+
if (b.has(e2)) return;
|
|
14817
|
+
let r = setTimeout(() => {
|
|
14818
|
+
b.delete(e2), u({ type: 4, toastId: e2 });
|
|
14819
|
+
}, t2);
|
|
14820
|
+
b.set(e2, r);
|
|
14821
|
+
}, O = (e2) => {
|
|
14822
|
+
let { toasts: t2, pausedAt: r } = D(e2);
|
|
14823
|
+
useEffect(() => {
|
|
14824
|
+
if (r) return;
|
|
14825
|
+
let o2 = Date.now(), n2 = t2.map((i2) => {
|
|
14826
|
+
if (i2.duration === 1 / 0) return;
|
|
14827
|
+
let p2 = (i2.duration || 0) + i2.pauseDuration - (o2 - i2.createdAt);
|
|
14828
|
+
if (p2 < 0) {
|
|
14829
|
+
i2.visible && c.dismiss(i2.id);
|
|
14830
|
+
return;
|
|
14831
|
+
}
|
|
14832
|
+
return setTimeout(() => c.dismiss(i2.id), p2);
|
|
14833
|
+
});
|
|
14834
|
+
return () => {
|
|
14835
|
+
n2.forEach((i2) => i2 && clearTimeout(i2));
|
|
14836
|
+
};
|
|
14837
|
+
}, [t2, r]);
|
|
14838
|
+
let s2 = useCallback(() => {
|
|
14839
|
+
r && u({ type: 6, time: Date.now() });
|
|
14840
|
+
}, [r]), a2 = useCallback((o2, n2) => {
|
|
14841
|
+
let { reverseOrder: i2 = false, gutter: p2 = 8, defaultPosition: d2 } = n2 || {}, h2 = t2.filter((m2) => (m2.position || d2) === (o2.position || d2) && m2.height), v2 = h2.findIndex((m2) => m2.id === o2.id), S = h2.filter((m2, E) => E < v2 && m2.visible).length;
|
|
14842
|
+
return h2.filter((m2) => m2.visible).slice(...i2 ? [S + 1] : [0, S]).reduce((m2, E) => m2 + (E.height || 0) + p2, 0);
|
|
14843
|
+
}, [t2]);
|
|
14844
|
+
return useEffect(() => {
|
|
14845
|
+
t2.forEach((o2) => {
|
|
14846
|
+
if (o2.dismissed) ee(o2.id, o2.removeDelay);
|
|
14847
|
+
else {
|
|
14848
|
+
let n2 = b.get(o2.id);
|
|
14849
|
+
n2 && (clearTimeout(n2), b.delete(o2.id));
|
|
14850
|
+
}
|
|
14851
|
+
});
|
|
14852
|
+
}, [t2]), { toasts: t2, handlers: { updateHeight: K, startPause: X, endPause: s2, calculateOffset: a2 } };
|
|
14853
|
+
};
|
|
14854
|
+
var oe = h`
|
|
14855
|
+
from {
|
|
14856
|
+
transform: scale(0) rotate(45deg);
|
|
14857
|
+
opacity: 0;
|
|
14858
|
+
}
|
|
14859
|
+
to {
|
|
14860
|
+
transform: scale(1) rotate(45deg);
|
|
14861
|
+
opacity: 1;
|
|
14862
|
+
}`, re = h`
|
|
14863
|
+
from {
|
|
14864
|
+
transform: scale(0);
|
|
14865
|
+
opacity: 0;
|
|
14866
|
+
}
|
|
14867
|
+
to {
|
|
14868
|
+
transform: scale(1);
|
|
14869
|
+
opacity: 1;
|
|
14870
|
+
}`, se = h`
|
|
14871
|
+
from {
|
|
14872
|
+
transform: scale(0) rotate(90deg);
|
|
14873
|
+
opacity: 0;
|
|
14874
|
+
}
|
|
14875
|
+
to {
|
|
14876
|
+
transform: scale(1) rotate(90deg);
|
|
14877
|
+
opacity: 1;
|
|
14878
|
+
}`, k = j("div")`
|
|
14879
|
+
width: 20px;
|
|
14880
|
+
opacity: 0;
|
|
14881
|
+
height: 20px;
|
|
14882
|
+
border-radius: 10px;
|
|
14883
|
+
background: ${(e2) => e2.primary || "#ff4b4b"};
|
|
14884
|
+
position: relative;
|
|
14885
|
+
transform: rotate(45deg);
|
|
14886
|
+
|
|
14887
|
+
animation: ${oe} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
|
|
14888
|
+
forwards;
|
|
14889
|
+
animation-delay: 100ms;
|
|
14890
|
+
|
|
14891
|
+
&:after,
|
|
14892
|
+
&:before {
|
|
14893
|
+
content: '';
|
|
14894
|
+
animation: ${re} 0.15s ease-out forwards;
|
|
14895
|
+
animation-delay: 150ms;
|
|
14896
|
+
position: absolute;
|
|
14897
|
+
border-radius: 3px;
|
|
14898
|
+
opacity: 0;
|
|
14899
|
+
background: ${(e2) => e2.secondary || "#fff"};
|
|
14900
|
+
bottom: 9px;
|
|
14901
|
+
left: 4px;
|
|
14902
|
+
height: 2px;
|
|
14903
|
+
width: 12px;
|
|
14904
|
+
}
|
|
14905
|
+
|
|
14906
|
+
&:before {
|
|
14907
|
+
animation: ${se} 0.15s ease-out forwards;
|
|
14908
|
+
animation-delay: 180ms;
|
|
14909
|
+
transform: rotate(90deg);
|
|
14910
|
+
}
|
|
14911
|
+
`;
|
|
14912
|
+
var ne = h`
|
|
14913
|
+
from {
|
|
14914
|
+
transform: rotate(0deg);
|
|
14915
|
+
}
|
|
14916
|
+
to {
|
|
14917
|
+
transform: rotate(360deg);
|
|
14918
|
+
}
|
|
14919
|
+
`, V = j("div")`
|
|
14920
|
+
width: 12px;
|
|
14921
|
+
height: 12px;
|
|
14922
|
+
box-sizing: border-box;
|
|
14923
|
+
border: 2px solid;
|
|
14924
|
+
border-radius: 100%;
|
|
14925
|
+
border-color: ${(e2) => e2.secondary || "#e0e0e0"};
|
|
14926
|
+
border-right-color: ${(e2) => e2.primary || "#616161"};
|
|
14927
|
+
animation: ${ne} 1s linear infinite;
|
|
14928
|
+
`;
|
|
14929
|
+
var pe = h`
|
|
14930
|
+
from {
|
|
14931
|
+
transform: scale(0) rotate(45deg);
|
|
14932
|
+
opacity: 0;
|
|
14933
|
+
}
|
|
14934
|
+
to {
|
|
14935
|
+
transform: scale(1) rotate(45deg);
|
|
14936
|
+
opacity: 1;
|
|
14937
|
+
}`, de = h`
|
|
14938
|
+
0% {
|
|
14939
|
+
height: 0;
|
|
14940
|
+
width: 0;
|
|
14941
|
+
opacity: 0;
|
|
14942
|
+
}
|
|
14943
|
+
40% {
|
|
14944
|
+
height: 0;
|
|
14945
|
+
width: 6px;
|
|
14946
|
+
opacity: 1;
|
|
14947
|
+
}
|
|
14948
|
+
100% {
|
|
14949
|
+
opacity: 1;
|
|
14950
|
+
height: 10px;
|
|
14951
|
+
}`, _ = j("div")`
|
|
14952
|
+
width: 20px;
|
|
14953
|
+
opacity: 0;
|
|
14954
|
+
height: 20px;
|
|
14955
|
+
border-radius: 10px;
|
|
14956
|
+
background: ${(e2) => e2.primary || "#61d345"};
|
|
14957
|
+
position: relative;
|
|
14958
|
+
transform: rotate(45deg);
|
|
14959
|
+
|
|
14960
|
+
animation: ${pe} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
|
|
14961
|
+
forwards;
|
|
14962
|
+
animation-delay: 100ms;
|
|
14963
|
+
&:after {
|
|
14964
|
+
content: '';
|
|
14965
|
+
box-sizing: border-box;
|
|
14966
|
+
animation: ${de} 0.2s ease-out forwards;
|
|
14967
|
+
opacity: 0;
|
|
14968
|
+
animation-delay: 200ms;
|
|
14969
|
+
position: absolute;
|
|
14970
|
+
border-right: 2px solid;
|
|
14971
|
+
border-bottom: 2px solid;
|
|
14972
|
+
border-color: ${(e2) => e2.secondary || "#fff"};
|
|
14973
|
+
bottom: 6px;
|
|
14974
|
+
left: 6px;
|
|
14975
|
+
height: 10px;
|
|
14976
|
+
width: 6px;
|
|
14977
|
+
}
|
|
14978
|
+
`;
|
|
14979
|
+
var ue = j("div")`
|
|
14980
|
+
position: absolute;
|
|
14981
|
+
`, le = j("div")`
|
|
14982
|
+
position: relative;
|
|
14983
|
+
display: flex;
|
|
14984
|
+
justify-content: center;
|
|
14985
|
+
align-items: center;
|
|
14986
|
+
min-width: 20px;
|
|
14987
|
+
min-height: 20px;
|
|
14988
|
+
`, fe = h`
|
|
14989
|
+
from {
|
|
14990
|
+
transform: scale(0.6);
|
|
14991
|
+
opacity: 0.4;
|
|
14992
|
+
}
|
|
14993
|
+
to {
|
|
14994
|
+
transform: scale(1);
|
|
14995
|
+
opacity: 1;
|
|
14996
|
+
}`, Te = j("div")`
|
|
14997
|
+
position: relative;
|
|
14998
|
+
transform: scale(0.6);
|
|
14999
|
+
opacity: 0.4;
|
|
15000
|
+
min-width: 20px;
|
|
15001
|
+
animation: ${fe} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
|
|
15002
|
+
forwards;
|
|
15003
|
+
`, M = ({ toast: e2 }) => {
|
|
15004
|
+
let { icon: t2, type: r, iconTheme: s2 } = e2;
|
|
15005
|
+
return t2 !== void 0 ? typeof t2 == "string" ? React.createElement(Te, null, t2) : t2 : r === "blank" ? null : React.createElement(le, null, React.createElement(V, { ...s2 }), r !== "loading" && React.createElement(ue, null, r === "error" ? React.createElement(k, { ...s2 }) : React.createElement(_, { ...s2 })));
|
|
15006
|
+
};
|
|
15007
|
+
var ye = (e2) => `
|
|
15008
|
+
0% {transform: translate3d(0,${e2 * -200}%,0) scale(.6); opacity:.5;}
|
|
15009
|
+
100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
|
|
15010
|
+
`, ge = (e2) => `
|
|
15011
|
+
0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}
|
|
15012
|
+
100% {transform: translate3d(0,${e2 * -150}%,-1px) scale(.6); opacity:0;}
|
|
15013
|
+
`, he = "0%{opacity:0;} 100%{opacity:1;}", xe = "0%{opacity:1;} 100%{opacity:0;}", be = j("div")`
|
|
15014
|
+
display: flex;
|
|
15015
|
+
align-items: center;
|
|
15016
|
+
background: #fff;
|
|
15017
|
+
color: #363636;
|
|
15018
|
+
line-height: 1.3;
|
|
15019
|
+
will-change: transform;
|
|
15020
|
+
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05);
|
|
15021
|
+
max-width: 350px;
|
|
15022
|
+
pointer-events: auto;
|
|
15023
|
+
padding: 8px 10px;
|
|
15024
|
+
border-radius: 8px;
|
|
15025
|
+
`, Se = j("div")`
|
|
15026
|
+
display: flex;
|
|
15027
|
+
justify-content: center;
|
|
15028
|
+
margin: 4px 10px;
|
|
15029
|
+
color: inherit;
|
|
15030
|
+
flex: 1 1 auto;
|
|
15031
|
+
white-space: pre-line;
|
|
15032
|
+
`, Ae = (e2, t2) => {
|
|
15033
|
+
let s2 = e2.includes("top") ? 1 : -1, [a2, o2] = A() ? [he, xe] : [ye(s2), ge(s2)];
|
|
15034
|
+
return { animation: t2 ? `${h(a2)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards` : `${h(o2)} 0.4s forwards cubic-bezier(.06,.71,.55,1)` };
|
|
15035
|
+
}, C = React.memo(({ toast: e2, position: t2, style: r, children: s2 }) => {
|
|
15036
|
+
let a2 = e2.height ? Ae(e2.position || t2 || "top-center", e2.visible) : { opacity: 0 }, o2 = React.createElement(M, { toast: e2 }), n2 = React.createElement(Se, { ...e2.ariaProps }, f(e2.message, e2));
|
|
15037
|
+
return React.createElement(be, { className: e2.className, style: { ...a2, ...r, ...e2.style } }, typeof s2 == "function" ? s2({ icon: o2, message: n2 }) : React.createElement(React.Fragment, null, o2, n2));
|
|
15038
|
+
});
|
|
15039
|
+
m$1(React.createElement);
|
|
15040
|
+
var ve = ({ id: e2, className: t2, style: r, onHeightUpdate: s2, children: a2 }) => {
|
|
15041
|
+
let o2 = React.useCallback((n2) => {
|
|
15042
|
+
if (n2) {
|
|
15043
|
+
let i2 = () => {
|
|
15044
|
+
let p2 = n2.getBoundingClientRect().height;
|
|
15045
|
+
s2(e2, p2);
|
|
15046
|
+
};
|
|
15047
|
+
i2(), new MutationObserver(i2).observe(n2, { subtree: true, childList: true, characterData: true });
|
|
15048
|
+
}
|
|
15049
|
+
}, [e2, s2]);
|
|
15050
|
+
return React.createElement("div", { ref: o2, className: t2, style: r }, a2);
|
|
15051
|
+
}, Ee = (e2, t2) => {
|
|
15052
|
+
let r = e2.includes("top"), s2 = r ? { top: 0 } : { bottom: 0 }, a2 = e2.includes("center") ? { justifyContent: "center" } : e2.includes("right") ? { justifyContent: "flex-end" } : {};
|
|
15053
|
+
return { left: 0, right: 0, display: "flex", position: "absolute", transition: A() ? void 0 : "all 230ms cubic-bezier(.21,1.02,.73,1)", transform: `translateY(${t2 * (r ? 1 : -1)}px)`, ...s2, ...a2 };
|
|
15054
|
+
}, De = u$1`
|
|
15055
|
+
z-index: 9999;
|
|
15056
|
+
> * {
|
|
15057
|
+
pointer-events: auto;
|
|
15058
|
+
}
|
|
15059
|
+
`, R = 16, Oe = ({ reverseOrder: e2, position: t2 = "top-center", toastOptions: r, gutter: s2, children: a2, containerStyle: o2, containerClassName: n2 }) => {
|
|
15060
|
+
let { toasts: i2, handlers: p2 } = O(r);
|
|
15061
|
+
return React.createElement("div", { id: "_rht_toaster", style: { position: "fixed", zIndex: 9999, top: R, left: R, right: R, bottom: R, pointerEvents: "none", ...o2 }, className: n2, onMouseEnter: p2.startPause, onMouseLeave: p2.endPause }, i2.map((d2) => {
|
|
15062
|
+
let h2 = d2.position || t2, v2 = p2.calculateOffset(d2, { reverseOrder: e2, gutter: s2, defaultPosition: t2 }), S = Ee(h2, v2);
|
|
15063
|
+
return React.createElement(ve, { id: d2.id, key: d2.id, onHeightUpdate: p2.updateHeight, className: d2.visible ? De : "", style: S }, d2.type === "custom" ? f(d2.message, d2) : a2 ? a2(d2) : React.createElement(C, { toast: d2, position: h2 }));
|
|
15064
|
+
}));
|
|
15065
|
+
};
|
|
15066
|
+
var Vt = c;
|
|
15067
|
+
const toastRecipe = sva({
|
|
15068
|
+
className: "toast",
|
|
15069
|
+
slots: ["root", "content", "description", "actionTrigger", "icon"],
|
|
15070
|
+
base: {
|
|
15071
|
+
root: {
|
|
15072
|
+
display: "flex",
|
|
15073
|
+
alignItems: "center",
|
|
15074
|
+
justifyContent: "center",
|
|
15075
|
+
backgroundColor: "background.neutralInverse.default",
|
|
15076
|
+
borderRadius: 16,
|
|
15077
|
+
height: "fit-content",
|
|
15078
|
+
minHeight: "48px",
|
|
15079
|
+
width: "fit-content",
|
|
15080
|
+
maxWidth: "328px",
|
|
15081
|
+
overflowWrap: "anywhere",
|
|
15082
|
+
zIndex: "overlay",
|
|
15083
|
+
fontStyle: "body.md",
|
|
15084
|
+
color: "content.neutralInverse.bold",
|
|
15085
|
+
px: 3,
|
|
15086
|
+
py: 2,
|
|
15087
|
+
boxShadow: "0px 4px 12px rgba(0, 0, 0, 0.1)",
|
|
15088
|
+
shadow: "overlay"
|
|
15089
|
+
},
|
|
15090
|
+
content: {
|
|
15091
|
+
display: "inline-flex",
|
|
15092
|
+
alignItems: "center",
|
|
15093
|
+
gap: 2
|
|
15094
|
+
},
|
|
15095
|
+
description: {
|
|
15096
|
+
textStyle: "body.md"
|
|
15097
|
+
},
|
|
15098
|
+
actionTrigger: {
|
|
15099
|
+
height: "100%",
|
|
15100
|
+
width: "fit-content",
|
|
15101
|
+
display: "flex",
|
|
15102
|
+
alignItems: "center",
|
|
15103
|
+
justifyContent: "center",
|
|
15104
|
+
textStyle: "title.sm",
|
|
15105
|
+
cursor: "pointer",
|
|
15106
|
+
px: 4,
|
|
15107
|
+
pr: 1,
|
|
15108
|
+
whiteSpace: "nowrap",
|
|
15109
|
+
color: "content.neutralInverse.bold",
|
|
15110
|
+
"&:hover": {
|
|
15111
|
+
opacity: 0.8
|
|
15112
|
+
}
|
|
15113
|
+
},
|
|
15114
|
+
icon: {
|
|
15115
|
+
width: 6,
|
|
15116
|
+
height: 6,
|
|
15117
|
+
minWidth: 6,
|
|
15118
|
+
minHeight: 6,
|
|
15119
|
+
ml: -1,
|
|
15120
|
+
display: "flex",
|
|
15121
|
+
alignItems: "center",
|
|
15122
|
+
justifyContent: "center"
|
|
15123
|
+
}
|
|
15124
|
+
},
|
|
15125
|
+
variants: {
|
|
15126
|
+
width: {
|
|
15127
|
+
full: {
|
|
15733
15128
|
root: {
|
|
15734
|
-
width: "100%"
|
|
15735
|
-
},
|
|
15736
|
-
list: {
|
|
15737
15129
|
width: "100%",
|
|
15738
|
-
|
|
15739
|
-
overflowX: "visible"
|
|
15740
|
-
},
|
|
15741
|
-
trigger: {
|
|
15742
|
-
flex: 1,
|
|
15743
|
-
justifyContent: "center",
|
|
15744
|
-
overflow: "hidden",
|
|
15745
|
-
textOverflow: "ellipsis",
|
|
15746
|
-
whiteSpace: "nowrap"
|
|
15747
|
-
}
|
|
15748
|
-
}
|
|
15749
|
-
},
|
|
15750
|
-
bottomLine: {
|
|
15751
|
-
true: {
|
|
15752
|
-
list: {
|
|
15753
|
-
borderBottomWidth: "1px",
|
|
15754
|
-
borderColor: "background.neutral.selected"
|
|
15130
|
+
justifyContent: "space-between"
|
|
15755
15131
|
}
|
|
15756
15132
|
},
|
|
15757
|
-
|
|
15758
|
-
|
|
15759
|
-
|
|
15133
|
+
fit: {
|
|
15134
|
+
root: {
|
|
15135
|
+
width: "fit-content"
|
|
15760
15136
|
}
|
|
15761
15137
|
}
|
|
15762
15138
|
},
|
|
15763
|
-
|
|
15139
|
+
asLink: {
|
|
15764
15140
|
true: {
|
|
15765
|
-
|
|
15766
|
-
|
|
15141
|
+
actionTrigger: {
|
|
15142
|
+
textDecoration: "underline",
|
|
15143
|
+
cursor: "pointer"
|
|
15767
15144
|
}
|
|
15768
15145
|
}
|
|
15769
15146
|
}
|
|
15770
15147
|
},
|
|
15771
|
-
|
|
15772
|
-
|
|
15773
|
-
|
|
15774
|
-
|
|
15775
|
-
|
|
15776
|
-
|
|
15777
|
-
|
|
15778
|
-
|
|
15148
|
+
defaultVariants: {
|
|
15149
|
+
width: "full",
|
|
15150
|
+
asLink: false
|
|
15151
|
+
}
|
|
15152
|
+
});
|
|
15153
|
+
const DEFAULT_DURATION = 3e3;
|
|
15154
|
+
const Root = forwardRef(
|
|
15155
|
+
({ children, className, width = "fit", ...props }, ref) => {
|
|
15156
|
+
const styles2 = toastRecipe({ width });
|
|
15157
|
+
return /* @__PURE__ */ jsx(Box$1, { ref, className: cx(styles2.root, className), ...props, children });
|
|
15158
|
+
}
|
|
15159
|
+
);
|
|
15160
|
+
Root.displayName = "Toast.Root";
|
|
15161
|
+
const Content = forwardRef(
|
|
15162
|
+
({ children, className }, ref) => {
|
|
15163
|
+
const styles2 = toastRecipe();
|
|
15164
|
+
return /* @__PURE__ */ jsx(HStack$1, { ref, className: cx(styles2.content, className), children });
|
|
15165
|
+
}
|
|
15166
|
+
);
|
|
15167
|
+
Content.displayName = "Toast.Content";
|
|
15168
|
+
const Description = forwardRef(
|
|
15169
|
+
({ children, className }, ref) => {
|
|
15170
|
+
const styles2 = toastRecipe();
|
|
15171
|
+
return /* @__PURE__ */ jsx(Box$1, { ref, className: cx(styles2.description, className), children });
|
|
15172
|
+
}
|
|
15173
|
+
);
|
|
15174
|
+
const Icon = forwardRef(({ icon, className }, ref) => {
|
|
15175
|
+
const styles2 = toastRecipe();
|
|
15176
|
+
return /* @__PURE__ */ jsx(Box$1, { ref, className: cx(styles2.icon, className), children: icon });
|
|
15177
|
+
});
|
|
15178
|
+
Icon.displayName = "Toast.Icon";
|
|
15179
|
+
const ActionTrigger = forwardRef(({ onClick, children, className, asLink = false }, ref) => {
|
|
15180
|
+
const styles2 = toastRecipe({ asLink });
|
|
15181
|
+
return /* @__PURE__ */ jsx("button", { ref, className: cx(styles2.actionTrigger, className), onClick, children });
|
|
15182
|
+
});
|
|
15183
|
+
ActionTrigger.displayName = "Toast.ActionTrigger";
|
|
15184
|
+
const Toaster = () => {
|
|
15185
|
+
return createPortal(
|
|
15186
|
+
/* @__PURE__ */ jsx(
|
|
15187
|
+
Oe,
|
|
15188
|
+
{
|
|
15189
|
+
position: "bottom-center",
|
|
15190
|
+
toastOptions: {
|
|
15191
|
+
duration: DEFAULT_DURATION,
|
|
15192
|
+
style: {
|
|
15193
|
+
background: "transparent",
|
|
15194
|
+
boxShadow: "none",
|
|
15195
|
+
padding: 0,
|
|
15196
|
+
margin: 0
|
|
15197
|
+
}
|
|
15779
15198
|
}
|
|
15780
15199
|
}
|
|
15781
|
-
|
|
15200
|
+
),
|
|
15201
|
+
document.body
|
|
15202
|
+
);
|
|
15203
|
+
};
|
|
15204
|
+
Toaster.displayName = "Toast.Toaster";
|
|
15205
|
+
const Toast = forwardRef((props, ref) => {
|
|
15206
|
+
return /* @__PURE__ */ jsx(Box$1, { ref, ...props });
|
|
15207
|
+
});
|
|
15208
|
+
Toast.Root = Root;
|
|
15209
|
+
Toast.Content = Content;
|
|
15210
|
+
Toast.Description = Description;
|
|
15211
|
+
Toast.Icon = Icon;
|
|
15212
|
+
Toast.ActionTrigger = ActionTrigger;
|
|
15213
|
+
Toast.Toaster = Toaster;
|
|
15214
|
+
Toast.show = (description, option) => {
|
|
15215
|
+
Vt(
|
|
15216
|
+
(t2) => /* @__PURE__ */ jsxs(Toast.Root, { width: (option == null ? void 0 : option.actionLabel) ? "full" : "fit", children: [
|
|
15217
|
+
/* @__PURE__ */ jsxs(Toast.Content, { children: [
|
|
15218
|
+
(option == null ? void 0 : option.icon) && /* @__PURE__ */ jsx(Toast.Icon, { icon: option == null ? void 0 : option.icon }),
|
|
15219
|
+
/* @__PURE__ */ jsx(Toast.Description, { children: description })
|
|
15220
|
+
] }),
|
|
15221
|
+
(option == null ? void 0 : option.actionLabel) && /* @__PURE__ */ jsx(
|
|
15222
|
+
Toast.ActionTrigger,
|
|
15223
|
+
{
|
|
15224
|
+
asLink: option == null ? void 0 : option.asLink,
|
|
15225
|
+
onClick: () => {
|
|
15226
|
+
var _a;
|
|
15227
|
+
(_a = option == null ? void 0 : option.onActionClick) == null ? void 0 : _a.call(option);
|
|
15228
|
+
if (!(option == null ? void 0 : option.disableCloseOnActionClick)) {
|
|
15229
|
+
Vt.dismiss(t2.id);
|
|
15230
|
+
}
|
|
15231
|
+
},
|
|
15232
|
+
children: option == null ? void 0 : option.actionLabel
|
|
15233
|
+
}
|
|
15234
|
+
)
|
|
15235
|
+
] }),
|
|
15782
15236
|
{
|
|
15783
|
-
|
|
15784
|
-
|
|
15785
|
-
|
|
15786
|
-
|
|
15787
|
-
|
|
15237
|
+
duration: (option == null ? void 0 : option.duration) || DEFAULT_DURATION,
|
|
15238
|
+
position: "bottom-center"
|
|
15239
|
+
}
|
|
15240
|
+
);
|
|
15241
|
+
};
|
|
15242
|
+
Toast.error = (description, option) => {
|
|
15243
|
+
console.error("error", description);
|
|
15244
|
+
Vt(
|
|
15245
|
+
(t2) => /* @__PURE__ */ jsxs(Toast.Root, { width: (option == null ? void 0 : option.actionLabel) ? "full" : "fit", children: [
|
|
15246
|
+
/* @__PURE__ */ jsxs(Toast.Content, { children: [
|
|
15247
|
+
(option == null ? void 0 : option.icon) && /* @__PURE__ */ jsx(Toast.Icon, { icon: option == null ? void 0 : option.icon }),
|
|
15248
|
+
/* @__PURE__ */ jsx(Toast.Description, { children: description })
|
|
15249
|
+
] }),
|
|
15250
|
+
(option == null ? void 0 : option.actionLabel) && /* @__PURE__ */ jsx(
|
|
15251
|
+
Toast.ActionTrigger,
|
|
15252
|
+
{
|
|
15253
|
+
asLink: option == null ? void 0 : option.asLink,
|
|
15254
|
+
onClick: () => {
|
|
15255
|
+
var _a;
|
|
15256
|
+
(_a = option == null ? void 0 : option.onActionClick) == null ? void 0 : _a.call(option);
|
|
15257
|
+
if (!(option == null ? void 0 : option.disableCloseOnActionClick)) {
|
|
15258
|
+
Vt.dismiss(t2.id);
|
|
15259
|
+
}
|
|
15260
|
+
},
|
|
15261
|
+
children: option == null ? void 0 : option.actionLabel
|
|
15788
15262
|
}
|
|
15789
|
-
|
|
15263
|
+
)
|
|
15264
|
+
] }),
|
|
15265
|
+
{
|
|
15266
|
+
duration: (option == null ? void 0 : option.duration) || DEFAULT_DURATION,
|
|
15267
|
+
position: "bottom-center"
|
|
15790
15268
|
}
|
|
15791
|
-
|
|
15792
|
-
|
|
15793
|
-
variant: "line",
|
|
15794
|
-
fitted: false,
|
|
15795
|
-
bottomLine: true,
|
|
15796
|
-
shadow: false
|
|
15797
|
-
}
|
|
15798
|
-
});
|
|
15799
|
-
const { withRootProvider, withContext: withContext$1 } = createStyleContext(tabsRecipe);
|
|
15800
|
-
const Root$1 = withRootProvider(TabsRoot);
|
|
15801
|
-
const List = withContext$1(TabList, "list");
|
|
15802
|
-
const Trigger = withContext$1(TabTrigger, "trigger");
|
|
15803
|
-
const Content$1 = withContext$1(TabContent, "content");
|
|
15804
|
-
const Indicator = withContext$1(TabIndicator, "indicator");
|
|
15805
|
-
const Tabs = Object.assign(Root$1, {
|
|
15806
|
-
Root: Root$1,
|
|
15807
|
-
List,
|
|
15808
|
-
Trigger,
|
|
15809
|
-
Content: Content$1,
|
|
15810
|
-
Indicator
|
|
15811
|
-
});
|
|
15269
|
+
);
|
|
15270
|
+
};
|
|
15812
15271
|
function definePreset(preset2) {
|
|
15813
15272
|
return preset2;
|
|
15814
15273
|
}
|
|
@@ -16118,291 +15577,6 @@ const preset = definePreset({
|
|
|
16118
15577
|
}
|
|
16119
15578
|
}
|
|
16120
15579
|
});
|
|
16121
|
-
const toastRecipe = sva({
|
|
16122
|
-
className: "toast",
|
|
16123
|
-
slots: [...anatomy.keys(), "content", "icon"],
|
|
16124
|
-
base: {
|
|
16125
|
-
root: {
|
|
16126
|
-
display: "flex",
|
|
16127
|
-
alignItems: "center",
|
|
16128
|
-
justifyContent: "center",
|
|
16129
|
-
backgroundColor: "background.neutralInverse.default",
|
|
16130
|
-
borderRadius: 16,
|
|
16131
|
-
height: "fit-content",
|
|
16132
|
-
minHeight: "48px",
|
|
16133
|
-
width: "fit-content",
|
|
16134
|
-
maxWidth: "328px",
|
|
16135
|
-
overflowWrap: "anywhere",
|
|
16136
|
-
zIndex: "overlay",
|
|
16137
|
-
fontStyle: "body.md",
|
|
16138
|
-
color: "content.neutralInverse.bold",
|
|
16139
|
-
pr: 4,
|
|
16140
|
-
pl: 3,
|
|
16141
|
-
py: 2,
|
|
16142
|
-
boxShadow: "0px 4px 12px rgba(0, 0, 0, 0.1)",
|
|
16143
|
-
animation: "fadeIn 0.25s ease-out",
|
|
16144
|
-
transform: "translateY(20px)",
|
|
16145
|
-
shadow: "overlay",
|
|
16146
|
-
transition: "transform 0.25s ease-out",
|
|
16147
|
-
'&[data-state="open"]': {
|
|
16148
|
-
animation: "slide-in 0.4s cubic-bezier(0.05, 0.7, 0.1, 1.0)",
|
|
16149
|
-
transform: "translateY(0px)"
|
|
16150
|
-
},
|
|
16151
|
-
'&[data-state="closed"]': {
|
|
16152
|
-
animation: "slide-out 0.2s cubic-bezier(0.3, 0.0, 0.8, 0.15)",
|
|
16153
|
-
transform: "translateY(64px)"
|
|
16154
|
-
}
|
|
16155
|
-
},
|
|
16156
|
-
content: {
|
|
16157
|
-
display: "inline-flex",
|
|
16158
|
-
alignItems: "center"
|
|
16159
|
-
},
|
|
16160
|
-
description: {
|
|
16161
|
-
textStyle: "body.md",
|
|
16162
|
-
marginLeft: 2
|
|
16163
|
-
},
|
|
16164
|
-
actionTrigger: {
|
|
16165
|
-
height: "100%",
|
|
16166
|
-
width: "fit-content",
|
|
16167
|
-
display: "flex",
|
|
16168
|
-
alignItems: "center",
|
|
16169
|
-
justifyContent: "center",
|
|
16170
|
-
textStyle: "title.sm",
|
|
16171
|
-
cursor: "pointer",
|
|
16172
|
-
px: 4,
|
|
16173
|
-
pr: 1,
|
|
16174
|
-
whiteSpace: "nowrap",
|
|
16175
|
-
transition: "opacity 0.2s ease",
|
|
16176
|
-
color: "content.neutralInverse.bold",
|
|
16177
|
-
"&:hover": {
|
|
16178
|
-
opacity: 0.8
|
|
16179
|
-
}
|
|
16180
|
-
},
|
|
16181
|
-
icon: {
|
|
16182
|
-
width: 6,
|
|
16183
|
-
height: 6,
|
|
16184
|
-
minWidth: 6,
|
|
16185
|
-
minHeight: 6,
|
|
16186
|
-
display: "flex",
|
|
16187
|
-
alignItems: "center",
|
|
16188
|
-
justifyContent: "center"
|
|
16189
|
-
}
|
|
16190
|
-
},
|
|
16191
|
-
variants: {
|
|
16192
|
-
width: {
|
|
16193
|
-
full: {
|
|
16194
|
-
root: {
|
|
16195
|
-
width: "100%",
|
|
16196
|
-
justifyContent: "space-between"
|
|
16197
|
-
}
|
|
16198
|
-
},
|
|
16199
|
-
fit: {
|
|
16200
|
-
root: {
|
|
16201
|
-
width: "fit-content"
|
|
16202
|
-
}
|
|
16203
|
-
}
|
|
16204
|
-
},
|
|
16205
|
-
asLink: {
|
|
16206
|
-
true: {
|
|
16207
|
-
actionTrigger: {
|
|
16208
|
-
textDecoration: "underline",
|
|
16209
|
-
cursor: "pointer"
|
|
16210
|
-
}
|
|
16211
|
-
}
|
|
16212
|
-
}
|
|
16213
|
-
}
|
|
16214
|
-
});
|
|
16215
|
-
const { withProvider, withContext } = createStyleContext(toastRecipe);
|
|
16216
|
-
const OriginalRoot = withProvider(ToastRoot, "root");
|
|
16217
|
-
const Root = React__default.forwardRef((props, ref) => {
|
|
16218
|
-
const { children, width, ...rest } = props;
|
|
16219
|
-
const hasActionTrigger = React__default.Children.toArray(children).some((child) => {
|
|
16220
|
-
if (React__default.isValidElement(child)) {
|
|
16221
|
-
if (child.type === ActionTrigger) {
|
|
16222
|
-
return true;
|
|
16223
|
-
}
|
|
16224
|
-
if (child.type === React__default.Fragment && child.props.children) {
|
|
16225
|
-
return React__default.Children.toArray(child.props.children).some(
|
|
16226
|
-
(fragmentChild) => React__default.isValidElement(fragmentChild) && fragmentChild.type === ActionTrigger
|
|
16227
|
-
);
|
|
16228
|
-
}
|
|
16229
|
-
}
|
|
16230
|
-
return false;
|
|
16231
|
-
});
|
|
16232
|
-
const widthValue = width !== void 0 ? width : hasActionTrigger ? "full" : "fit";
|
|
16233
|
-
return /* @__PURE__ */ jsx(OriginalRoot, { ref, width: widthValue, ...rest, children });
|
|
16234
|
-
});
|
|
16235
|
-
Root.displayName = "Toast.Root";
|
|
16236
|
-
const OriginalActionTrigger = withContext(
|
|
16237
|
-
ToastActionTrigger,
|
|
16238
|
-
"actionTrigger"
|
|
16239
|
-
);
|
|
16240
|
-
const OriginalActionTriggerAsLink = withContext(ark.a, "actionTrigger");
|
|
16241
|
-
const ActionTrigger = React__default.forwardRef((props, ref) => {
|
|
16242
|
-
const { asLink, ...rest } = props;
|
|
16243
|
-
return asLink ? /* @__PURE__ */ jsx(OriginalActionTriggerAsLink, { ref, ...rest }) : /* @__PURE__ */ jsx(OriginalActionTrigger, { ref, ...rest });
|
|
16244
|
-
});
|
|
16245
|
-
ActionTrigger.displayName = "Toast.ActionTrigger";
|
|
16246
|
-
const Description = withContext(
|
|
16247
|
-
ToastDescription,
|
|
16248
|
-
"description"
|
|
16249
|
-
);
|
|
16250
|
-
const Content = withContext(ark.div, "content");
|
|
16251
|
-
const Icon = withContext(ark.div, "icon");
|
|
16252
|
-
const Toast = {
|
|
16253
|
-
Root,
|
|
16254
|
-
ActionTrigger,
|
|
16255
|
-
Content,
|
|
16256
|
-
Description,
|
|
16257
|
-
Icon
|
|
16258
|
-
};
|
|
16259
|
-
const toast = {
|
|
16260
|
-
queue: [],
|
|
16261
|
-
// ToastProvider에서 호출
|
|
16262
|
-
_getQueue: () => {
|
|
16263
|
-
const queue = [...toast.queue];
|
|
16264
|
-
toast.queue = [];
|
|
16265
|
-
return queue;
|
|
16266
|
-
},
|
|
16267
|
-
/**
|
|
16268
|
-
* ToastProvider가 준비되었는지 확인하는 상태
|
|
16269
|
-
*/
|
|
16270
|
-
isReady: false,
|
|
16271
|
-
/**
|
|
16272
|
-
* 대기 중인 토스트 메시지 큐
|
|
16273
|
-
*/
|
|
16274
|
-
pendingToasts: [],
|
|
16275
|
-
/**
|
|
16276
|
-
* ToastProvider에서 호출하여 준비 상태를 설정
|
|
16277
|
-
*/
|
|
16278
|
-
_setReady: () => {
|
|
16279
|
-
toast.isReady = true;
|
|
16280
|
-
if (toast.pendingToasts.length > 0) {
|
|
16281
|
-
toast.pendingToasts.forEach((args) => {
|
|
16282
|
-
toast.show(args[0], args[1]);
|
|
16283
|
-
});
|
|
16284
|
-
toast.pendingToasts = [];
|
|
16285
|
-
}
|
|
16286
|
-
},
|
|
16287
|
-
// render toast
|
|
16288
|
-
show: (message, options) => {
|
|
16289
|
-
if (!toast.isReady) {
|
|
16290
|
-
toast.pendingToasts.push([message, options]);
|
|
16291
|
-
return;
|
|
16292
|
-
}
|
|
16293
|
-
const toastData = {
|
|
16294
|
-
description: message,
|
|
16295
|
-
action: (options == null ? void 0 : options.actionLabel) ? {
|
|
16296
|
-
label: options.actionLabel,
|
|
16297
|
-
onClick: options.onActionClick
|
|
16298
|
-
} : void 0,
|
|
16299
|
-
icon: options == null ? void 0 : options.icon,
|
|
16300
|
-
asLink: options == null ? void 0 : options.asLink,
|
|
16301
|
-
duration: options == null ? void 0 : options.duration
|
|
16302
|
-
};
|
|
16303
|
-
toast.queue.push(toastData);
|
|
16304
|
-
if (typeof window !== "undefined") {
|
|
16305
|
-
window.dispatchEvent(new CustomEvent("toast-queue-updated"));
|
|
16306
|
-
}
|
|
16307
|
-
},
|
|
16308
|
-
success: (message, options) => {
|
|
16309
|
-
toast.show(message, { ...options });
|
|
16310
|
-
},
|
|
16311
|
-
error: (message, options) => {
|
|
16312
|
-
toast.show(message, { ...options });
|
|
16313
|
-
},
|
|
16314
|
-
warning: (message, options) => {
|
|
16315
|
-
toast.show(message, { ...options });
|
|
16316
|
-
},
|
|
16317
|
-
info: (message, options) => {
|
|
16318
|
-
toast.show(message, { ...options });
|
|
16319
|
-
}
|
|
16320
|
-
};
|
|
16321
|
-
const DURATION = {
|
|
16322
|
-
DEFAULT: 2500,
|
|
16323
|
-
HAS_ACTION: 5500
|
|
16324
|
-
};
|
|
16325
|
-
const ToastProvider = ({ children }) => {
|
|
16326
|
-
const toaster = createToaster({
|
|
16327
|
-
placement: "bottom",
|
|
16328
|
-
duration: DURATION.DEFAULT,
|
|
16329
|
-
offsets: {
|
|
16330
|
-
bottom: "55px",
|
|
16331
|
-
top: "0px",
|
|
16332
|
-
left: "0px",
|
|
16333
|
-
right: "0px"
|
|
16334
|
-
},
|
|
16335
|
-
overlap: true
|
|
16336
|
-
});
|
|
16337
|
-
useEffect(() => {
|
|
16338
|
-
toast._setReady();
|
|
16339
|
-
return () => {
|
|
16340
|
-
};
|
|
16341
|
-
}, []);
|
|
16342
|
-
useEffect(() => {
|
|
16343
|
-
let currentZIndexCounter = 1300;
|
|
16344
|
-
const showToasts = () => {
|
|
16345
|
-
const queuedToasts = toast._getQueue();
|
|
16346
|
-
queuedToasts.forEach((toastData) => {
|
|
16347
|
-
try {
|
|
16348
|
-
const options = {
|
|
16349
|
-
description: toastData.description,
|
|
16350
|
-
zIndex: currentZIndexCounter++
|
|
16351
|
-
// 증가된 zIndex 값 사용
|
|
16352
|
-
};
|
|
16353
|
-
options.data = {
|
|
16354
|
-
icon: toastData.icon ? toastData.icon : null,
|
|
16355
|
-
asLink: toastData.asLink,
|
|
16356
|
-
zIndex: options.zIndex
|
|
16357
|
-
// zIndex를 data에도 저장
|
|
16358
|
-
};
|
|
16359
|
-
if (toastData.action) {
|
|
16360
|
-
options.action = {
|
|
16361
|
-
label: toastData.action.label,
|
|
16362
|
-
onClick: toastData.action.onClick ?? (() => {
|
|
16363
|
-
}),
|
|
16364
|
-
duration: DURATION.HAS_ACTION
|
|
16365
|
-
};
|
|
16366
|
-
}
|
|
16367
|
-
if (toastData.duration) {
|
|
16368
|
-
options.duration = toastData.duration;
|
|
16369
|
-
}
|
|
16370
|
-
setTimeout(() => {
|
|
16371
|
-
toaster.create(options);
|
|
16372
|
-
}, 0);
|
|
16373
|
-
} catch (error) {
|
|
16374
|
-
console.error("Error creating toast:", error);
|
|
16375
|
-
}
|
|
16376
|
-
});
|
|
16377
|
-
};
|
|
16378
|
-
const handleToastQueue = () => showToasts();
|
|
16379
|
-
window.addEventListener("toast-queue-updated", handleToastQueue);
|
|
16380
|
-
return () => {
|
|
16381
|
-
window.removeEventListener("toast-queue-updated", handleToastQueue);
|
|
16382
|
-
};
|
|
16383
|
-
}, [toaster]);
|
|
16384
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
16385
|
-
children,
|
|
16386
|
-
/* @__PURE__ */ jsx(Toaster, { toaster, children: (toast2) => {
|
|
16387
|
-
var _a, _b, _c, _d, _e;
|
|
16388
|
-
return /* @__PURE__ */ jsxs(
|
|
16389
|
-
Toast.Root,
|
|
16390
|
-
{
|
|
16391
|
-
asLink: (_a = toast2.data) == null ? void 0 : _a.asLink,
|
|
16392
|
-
style: { zIndex: ((_b = toast2.data) == null ? void 0 : _b.zIndex) || 1e3 },
|
|
16393
|
-
children: [
|
|
16394
|
-
/* @__PURE__ */ jsxs(Toast.Content, { children: [
|
|
16395
|
-
((_c = toast2.data) == null ? void 0 : _c.icon) && /* @__PURE__ */ jsx(Toast.Icon, { children: toast2.data.icon }),
|
|
16396
|
-
toast2.description && /* @__PURE__ */ jsx(Toast.Description, { children: toast2.description })
|
|
16397
|
-
] }),
|
|
16398
|
-
toast2.action && /* @__PURE__ */ jsx(Toast.ActionTrigger, { onClick: (_d = toast2.action) == null ? void 0 : _d.onClick, children: (_e = toast2.action) == null ? void 0 : _e.label })
|
|
16399
|
-
]
|
|
16400
|
-
},
|
|
16401
|
-
toast2.id
|
|
16402
|
-
);
|
|
16403
|
-
} })
|
|
16404
|
-
] });
|
|
16405
|
-
};
|
|
16406
15580
|
export {
|
|
16407
15581
|
BottomSheet,
|
|
16408
15582
|
Box2 as Box,
|
|
@@ -16423,9 +15597,8 @@ export {
|
|
|
16423
15597
|
index$2 as Tag,
|
|
16424
15598
|
Text,
|
|
16425
15599
|
index as TextArea,
|
|
16426
|
-
|
|
15600
|
+
Toast,
|
|
16427
15601
|
VStack2 as VStack,
|
|
16428
|
-
preset
|
|
16429
|
-
toast
|
|
15602
|
+
preset
|
|
16430
15603
|
};
|
|
16431
15604
|
//# sourceMappingURL=index.js.map
|