@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.cjs
CHANGED
|
@@ -3,21 +3,21 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const reactDom = require("react-dom");
|
|
6
|
-
function _interopNamespaceDefault(
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
9
|
-
for (const
|
|
10
|
-
if (
|
|
11
|
-
const
|
|
12
|
-
Object.defineProperty(
|
|
6
|
+
function _interopNamespaceDefault(e2) {
|
|
7
|
+
const n2 = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
8
|
+
if (e2) {
|
|
9
|
+
for (const k2 in e2) {
|
|
10
|
+
if (k2 !== "default") {
|
|
11
|
+
const d2 = Object.getOwnPropertyDescriptor(e2, k2);
|
|
12
|
+
Object.defineProperty(n2, k2, d2.get ? d2 : {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: () =>
|
|
14
|
+
get: () => e2[k2]
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
return Object.freeze(
|
|
19
|
+
n2.default = e2;
|
|
20
|
+
return Object.freeze(n2);
|
|
21
21
|
}
|
|
22
22
|
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
23
23
|
function withPolymorphicComponent(Component) {
|
|
@@ -35,27 +35,27 @@ function isObject$1(value) {
|
|
|
35
35
|
}
|
|
36
36
|
var isObjectOrArray = (obj) => typeof obj === "object" && obj !== null;
|
|
37
37
|
function compact$1(value) {
|
|
38
|
-
return Object.fromEntries(Object.entries(value ?? {}).filter(([
|
|
38
|
+
return Object.fromEntries(Object.entries(value ?? {}).filter(([_2, value2]) => value2 !== void 0));
|
|
39
39
|
}
|
|
40
40
|
var isBaseCondition = (v2) => v2 === "base";
|
|
41
|
-
function filterBaseConditions(
|
|
42
|
-
return
|
|
41
|
+
function filterBaseConditions(c2) {
|
|
42
|
+
return c2.slice().filter((v2) => !isBaseCondition(v2));
|
|
43
43
|
}
|
|
44
44
|
function toChar(code) {
|
|
45
45
|
return String.fromCharCode(code + (code > 25 ? 39 : 97));
|
|
46
46
|
}
|
|
47
47
|
function toName(code) {
|
|
48
48
|
let name = "";
|
|
49
|
-
let
|
|
50
|
-
for (
|
|
51
|
-
name = toChar(
|
|
52
|
-
return toChar(
|
|
49
|
+
let x2;
|
|
50
|
+
for (x2 = Math.abs(code); x2 > 52; x2 = x2 / 52 | 0)
|
|
51
|
+
name = toChar(x2 % 52) + name;
|
|
52
|
+
return toChar(x2 % 52) + name;
|
|
53
53
|
}
|
|
54
|
-
function toPhash(
|
|
55
|
-
let
|
|
56
|
-
while (
|
|
57
|
-
|
|
58
|
-
return
|
|
54
|
+
function toPhash(h2, x2) {
|
|
55
|
+
let i2 = x2.length;
|
|
56
|
+
while (i2)
|
|
57
|
+
h2 = h2 * 33 ^ x2.charCodeAt(--i2);
|
|
58
|
+
return h2;
|
|
59
59
|
}
|
|
60
60
|
function toHash(value) {
|
|
61
61
|
return toName(toPhash(5381, value) >>> 0);
|
|
@@ -267,10 +267,10 @@ var getSlotCompoundVariant = (compoundVariants, slotName) => compoundVariants.fi
|
|
|
267
267
|
function splitProps(props, ...keys) {
|
|
268
268
|
const descriptors = Object.getOwnPropertyDescriptors(props);
|
|
269
269
|
const dKeys = Object.keys(descriptors);
|
|
270
|
-
const split = (
|
|
270
|
+
const split = (k2) => {
|
|
271
271
|
const clone = {};
|
|
272
|
-
for (let
|
|
273
|
-
const key =
|
|
272
|
+
for (let i2 = 0; i2 < k2.length; i2++) {
|
|
273
|
+
const key = k2[i2];
|
|
274
274
|
if (descriptors[key]) {
|
|
275
275
|
Object.defineProperty(clone, key, descriptors[key]);
|
|
276
276
|
delete descriptors[key];
|
|
@@ -318,9 +318,9 @@ function finalizeConditions(paths) {
|
|
|
318
318
|
});
|
|
319
319
|
}
|
|
320
320
|
function sortConditions(paths) {
|
|
321
|
-
return paths.sort((
|
|
322
|
-
const aa = isCondition(
|
|
323
|
-
const bb = isCondition(
|
|
321
|
+
return paths.sort((a2, b2) => {
|
|
322
|
+
const aa = isCondition(a2);
|
|
323
|
+
const bb = isCondition(b2);
|
|
324
324
|
if (aa && !bb) return 1;
|
|
325
325
|
if (!aa && bb) return -1;
|
|
326
326
|
return 0;
|
|
@@ -362,9 +362,9 @@ const css$1 = (...styles2) => cssFn(mergeCss(...styles2));
|
|
|
362
362
|
css$1.raw = (...styles2) => mergeCss(...styles2);
|
|
363
363
|
const { mergeCss } = createMergeCss(context);
|
|
364
364
|
function cx() {
|
|
365
|
-
let str = "",
|
|
366
|
-
for (;
|
|
367
|
-
if ((arg = arguments[
|
|
365
|
+
let str = "", i2 = 0, arg;
|
|
366
|
+
for (; i2 < arguments.length; ) {
|
|
367
|
+
if ((arg = arguments[i2++]) && typeof arg === "string") {
|
|
368
368
|
str && (str += " ");
|
|
369
369
|
str += arg;
|
|
370
370
|
}
|
|
@@ -539,10 +539,10 @@ function styledFn(Dynamic, configOrCva = {}, options = {}) {
|
|
|
539
539
|
function createJsxFactory() {
|
|
540
540
|
const cache = /* @__PURE__ */ new Map();
|
|
541
541
|
return new Proxy(styledFn, {
|
|
542
|
-
apply(
|
|
542
|
+
apply(_2, __, args) {
|
|
543
543
|
return styledFn(...args);
|
|
544
544
|
},
|
|
545
|
-
get(
|
|
545
|
+
get(_2, el) {
|
|
546
546
|
if (!cache.has(el)) {
|
|
547
547
|
cache.set(el, styledFn(el));
|
|
548
548
|
}
|
|
@@ -790,23 +790,12 @@ var isString = (v2) => typeof v2 === "string";
|
|
|
790
790
|
var isFunction = (v2) => typeof v2 === "function";
|
|
791
791
|
var fnToString = Function.prototype.toString;
|
|
792
792
|
fnToString.call(Object);
|
|
793
|
-
var runIfFn = (v2, ...a) => {
|
|
794
|
-
const res = typeof v2 === "function" ? v2(...a) : v2;
|
|
795
|
-
return res ?? void 0;
|
|
796
|
-
};
|
|
797
793
|
var identity = (v2) => v2();
|
|
798
|
-
var callAll = (...fns2) => (...
|
|
794
|
+
var callAll = (...fns2) => (...a2) => {
|
|
799
795
|
fns2.forEach(function(fn) {
|
|
800
|
-
fn == null ? void 0 : fn(...
|
|
796
|
+
fn == null ? void 0 : fn(...a2);
|
|
801
797
|
});
|
|
802
798
|
};
|
|
803
|
-
var uuid = /* @__PURE__ */ (() => {
|
|
804
|
-
let id2 = 0;
|
|
805
|
-
return () => {
|
|
806
|
-
id2++;
|
|
807
|
-
return id2.toString(36);
|
|
808
|
-
};
|
|
809
|
-
})();
|
|
810
799
|
function compact(obj) {
|
|
811
800
|
if (!isPlainObject2(obj) || obj === void 0) return obj;
|
|
812
801
|
const keys = Reflect.ownKeys(obj).filter((key) => typeof key === "string");
|
|
@@ -822,39 +811,17 @@ function compact(obj) {
|
|
|
822
811
|
var isPlainObject2 = (v2) => {
|
|
823
812
|
return v2 && typeof v2 === "object" && v2.constructor === Object;
|
|
824
813
|
};
|
|
825
|
-
function
|
|
826
|
-
const
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
handle = requestAnimationFrame(loop);
|
|
830
|
-
const delta = now2 - start;
|
|
831
|
-
if (delta >= delay2) {
|
|
832
|
-
callback();
|
|
833
|
-
}
|
|
834
|
-
}
|
|
835
|
-
handle = requestAnimationFrame(loop);
|
|
836
|
-
return () => cancelAnimationFrame(handle);
|
|
837
|
-
}
|
|
838
|
-
function warn(...a) {
|
|
839
|
-
const m2 = a.length === 1 ? a[0] : a[1];
|
|
840
|
-
const c = a.length === 2 ? a[0] : true;
|
|
841
|
-
if (c && process.env.NODE_ENV !== "production") {
|
|
814
|
+
function warn(...a2) {
|
|
815
|
+
const m2 = a2.length === 1 ? a2[0] : a2[1];
|
|
816
|
+
const c2 = a2.length === 2 ? a2[0] : true;
|
|
817
|
+
if (c2 && process.env.NODE_ENV !== "production") {
|
|
842
818
|
console.warn(m2);
|
|
843
819
|
}
|
|
844
820
|
}
|
|
845
|
-
function ensure(
|
|
846
|
-
if (
|
|
847
|
-
}
|
|
848
|
-
function ensureProps(props, keys, scope) {
|
|
849
|
-
let missingKeys = [];
|
|
850
|
-
for (const key of keys) {
|
|
851
|
-
if (props[key] == null) missingKeys.push(key);
|
|
852
|
-
}
|
|
853
|
-
if (missingKeys.length > 0)
|
|
854
|
-
throw new Error(`[zag-js${` > ${scope}`}] missing required props: ${missingKeys.join(", ")}`);
|
|
821
|
+
function ensure(c2, m2) {
|
|
822
|
+
if (c2 == null) throw new Error(m2);
|
|
855
823
|
}
|
|
856
824
|
var isObject = (v2) => typeof v2 === "object" && v2 !== null;
|
|
857
|
-
var MAX_Z_INDEX = 2147483647;
|
|
858
825
|
var dataAttr = (guard) => guard ? "" : void 0;
|
|
859
826
|
var ELEMENT_NODE = 1;
|
|
860
827
|
var DOCUMENT_NODE = 9;
|
|
@@ -972,8 +939,8 @@ var isSelfTarget = (event) => {
|
|
|
972
939
|
function isComposingEvent(event) {
|
|
973
940
|
return getNativeEvent(event).isComposing;
|
|
974
941
|
}
|
|
975
|
-
var isContextMenuEvent = (
|
|
976
|
-
return
|
|
942
|
+
var isContextMenuEvent = (e2) => {
|
|
943
|
+
return e2.button === 2 || isMac$1() && e2.ctrlKey && e2.button === 0;
|
|
977
944
|
};
|
|
978
945
|
var keyMap = {
|
|
979
946
|
Up: "ArrowUp",
|
|
@@ -1018,10 +985,10 @@ var getFocusables = (container, includeContainer = false) => {
|
|
|
1018
985
|
elements.unshift(container);
|
|
1019
986
|
}
|
|
1020
987
|
const focusableElements2 = elements.filter(isFocusable);
|
|
1021
|
-
focusableElements2.forEach((element,
|
|
988
|
+
focusableElements2.forEach((element, i2) => {
|
|
1022
989
|
if (isFrame(element) && element.contentDocument) {
|
|
1023
990
|
const frameBody = element.contentDocument.body;
|
|
1024
|
-
focusableElements2.splice(
|
|
991
|
+
focusableElements2.splice(i2, 1, ...getFocusables(frameBody));
|
|
1025
992
|
}
|
|
1026
993
|
});
|
|
1027
994
|
return focusableElements2;
|
|
@@ -1034,11 +1001,11 @@ function getTabbables(container, includeContainer) {
|
|
|
1034
1001
|
if (!container) return [];
|
|
1035
1002
|
const elements = Array.from(container.querySelectorAll(focusableSelector));
|
|
1036
1003
|
const tabbableElements = elements.filter(isTabbable);
|
|
1037
|
-
tabbableElements.forEach((element,
|
|
1004
|
+
tabbableElements.forEach((element, i2) => {
|
|
1038
1005
|
if (isFrame(element) && element.contentDocument) {
|
|
1039
1006
|
const frameBody = element.contentDocument.body;
|
|
1040
1007
|
const allFrameTabbable = getTabbables(frameBody);
|
|
1041
|
-
tabbableElements.splice(
|
|
1008
|
+
tabbableElements.splice(i2, 1, ...allFrameTabbable);
|
|
1042
1009
|
}
|
|
1043
1010
|
});
|
|
1044
1011
|
if (!tabbableElements.length && includeContainer) ;
|
|
@@ -1212,14 +1179,14 @@ var serialize = (style) => {
|
|
|
1212
1179
|
}
|
|
1213
1180
|
return res;
|
|
1214
1181
|
};
|
|
1215
|
-
var css = (
|
|
1216
|
-
if (isString(
|
|
1217
|
-
if (isString(
|
|
1218
|
-
|
|
1219
|
-
} else if (isString(
|
|
1220
|
-
|
|
1221
|
-
}
|
|
1222
|
-
return Object.assign({},
|
|
1182
|
+
var css = (a2, b2) => {
|
|
1183
|
+
if (isString(a2)) {
|
|
1184
|
+
if (isString(b2)) return `${a2};${b2}`;
|
|
1185
|
+
a2 = serialize(a2);
|
|
1186
|
+
} else if (isString(b2)) {
|
|
1187
|
+
b2 = serialize(b2);
|
|
1188
|
+
}
|
|
1189
|
+
return Object.assign({}, a2 ?? {}, b2 ?? {});
|
|
1223
1190
|
};
|
|
1224
1191
|
function mergeProps(...args) {
|
|
1225
1192
|
let result = {};
|
|
@@ -1366,7 +1333,7 @@ var useTrack = (deps, effect) => {
|
|
|
1366
1333
|
const run = mounted && called.current;
|
|
1367
1334
|
if (run) return effect();
|
|
1368
1335
|
called.current = true;
|
|
1369
|
-
}, [...(deps ?? []).map((
|
|
1336
|
+
}, [...(deps ?? []).map((d2) => typeof d2 === "function" ? d2() : d2)]);
|
|
1370
1337
|
React.useEffect(() => {
|
|
1371
1338
|
render.current = true;
|
|
1372
1339
|
return () => {
|
|
@@ -1459,10 +1426,10 @@ function useMachine(machine2, userProps = {}) {
|
|
|
1459
1426
|
const action = (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.actions) == null ? void 0 : _b2[
|
|
1465
|
-
if (!fn) warn(`[zag-js] No implementation found for action "${JSON.stringify(
|
|
1431
|
+
const fn = (_b2 = (_a2 = machine2.implementations) == null ? void 0 : _a2.actions) == null ? void 0 : _b2[s2];
|
|
1432
|
+
if (!fn) warn(`[zag-js] No implementation found for action "${JSON.stringify(s2)}"`);
|
|
1466
1433
|
return fn;
|
|
1467
1434
|
});
|
|
1468
1435
|
for (const fn of fns2) {
|
|
@@ -1477,10 +1444,10 @@ function useMachine(machine2, userProps = {}) {
|
|
|
1477
1444
|
const effect = (keys) => {
|
|
1478
1445
|
const strs = isFunction(keys) ? keys(getParams()) : keys;
|
|
1479
1446
|
if (!strs) return;
|
|
1480
|
-
const fns2 = strs.map((
|
|
1447
|
+
const fns2 = strs.map((s2) => {
|
|
1481
1448
|
var _a2, _b2;
|
|
1482
|
-
const fn = (_b2 = (_a2 = machine2.implementations) == null ? void 0 : _a2.effects) == null ? void 0 : _b2[
|
|
1483
|
-
if (!fn) warn(`[zag-js] No implementation found for effect "${JSON.stringify(
|
|
1449
|
+
const fn = (_b2 = (_a2 = machine2.implementations) == null ? void 0 : _a2.effects) == null ? void 0 : _b2[s2];
|
|
1450
|
+
if (!fn) warn(`[zag-js] No implementation found for effect "${JSON.stringify(s2)}"`);
|
|
1484
1451
|
return fn;
|
|
1485
1452
|
});
|
|
1486
1453
|
const cleanups2 = [];
|
|
@@ -1491,10 +1458,10 @@ function useMachine(machine2, userProps = {}) {
|
|
|
1491
1458
|
return () => cleanups2.forEach((fn) => fn == null ? void 0 : fn());
|
|
1492
1459
|
};
|
|
1493
1460
|
const choose = (transitions) => {
|
|
1494
|
-
return toArray(transitions).find((
|
|
1495
|
-
let result = !
|
|
1496
|
-
if (isString(
|
|
1497
|
-
else if (isFunction(
|
|
1461
|
+
return toArray(transitions).find((t2) => {
|
|
1462
|
+
let result = !t2.guard;
|
|
1463
|
+
if (isString(t2.guard)) result = !!guard(t2.guard);
|
|
1464
|
+
else if (isFunction(t2.guard)) result = t2.guard(getParams());
|
|
1498
1465
|
return result;
|
|
1499
1466
|
});
|
|
1500
1467
|
};
|
|
@@ -1673,7 +1640,7 @@ const jsxFactory = () => {
|
|
|
1673
1640
|
apply(_target, _thisArg, argArray) {
|
|
1674
1641
|
return withAsChild(argArray[0]);
|
|
1675
1642
|
},
|
|
1676
|
-
get(
|
|
1643
|
+
get(_2, element) {
|
|
1677
1644
|
const asElement = element;
|
|
1678
1645
|
if (!cache.has(asElement)) {
|
|
1679
1646
|
cache.set(asElement, withAsChild(asElement));
|
|
@@ -1742,8 +1709,8 @@ function getWindowFrames(win) {
|
|
|
1742
1709
|
const frames = {
|
|
1743
1710
|
each(cb) {
|
|
1744
1711
|
var _a;
|
|
1745
|
-
for (let
|
|
1746
|
-
const frame2 = win.frames[
|
|
1712
|
+
for (let i2 = 0; i2 < ((_a = win.frames) == null ? void 0 : _a.length); i2 += 1) {
|
|
1713
|
+
const frame2 = win.frames[i2];
|
|
1747
1714
|
if (frame2) cb(frame2);
|
|
1748
1715
|
}
|
|
1749
1716
|
},
|
|
@@ -2129,27 +2096,6 @@ function trackDismissableElement(nodeOrFn, options) {
|
|
|
2129
2096
|
cleanups2.forEach((fn) => fn == null ? void 0 : fn());
|
|
2130
2097
|
};
|
|
2131
2098
|
}
|
|
2132
|
-
function trackDismissableBranch(nodeOrFn, options = {}) {
|
|
2133
|
-
const { defer } = options;
|
|
2134
|
-
const func = defer ? raf$1 : (v2) => v2();
|
|
2135
|
-
const cleanups2 = [];
|
|
2136
|
-
cleanups2.push(
|
|
2137
|
-
func(() => {
|
|
2138
|
-
const node = isFunction(nodeOrFn) ? nodeOrFn() : nodeOrFn;
|
|
2139
|
-
if (!node) {
|
|
2140
|
-
warn("[@zag-js/dismissable] branch node is `null` or `undefined`");
|
|
2141
|
-
return;
|
|
2142
|
-
}
|
|
2143
|
-
layerStack.addBranch(node);
|
|
2144
|
-
cleanups2.push(() => {
|
|
2145
|
-
layerStack.removeBranch(node);
|
|
2146
|
-
});
|
|
2147
|
-
})
|
|
2148
|
-
);
|
|
2149
|
-
return () => {
|
|
2150
|
-
cleanups2.forEach((fn) => fn == null ? void 0 : fn());
|
|
2151
|
-
};
|
|
2152
|
-
}
|
|
2153
2099
|
const [RenderStrategyPropsProvider, useRenderStrategyPropsContext] = createContext({
|
|
2154
2100
|
name: "RenderStrategyContext",
|
|
2155
2101
|
hookName: "useRenderStrategyContext",
|
|
@@ -2183,7 +2129,7 @@ const [PresenceProvider, usePresenceContext] = createContext({
|
|
|
2183
2129
|
providerName: "<PresenceProvider />"
|
|
2184
2130
|
});
|
|
2185
2131
|
const splitPresenceProps = (props) => createSplitProps()(props, ["immediate", "lazyMount", "onExitComplete", "present", "unmountOnExit"]);
|
|
2186
|
-
function connect$
|
|
2132
|
+
function connect$2(service, _normalize) {
|
|
2187
2133
|
const { state, send, context: context2 } = service;
|
|
2188
2134
|
const present = state.matches("mounted", "unmountSuspended");
|
|
2189
2135
|
return {
|
|
@@ -2198,7 +2144,7 @@ function connect$3(service, _normalize) {
|
|
|
2198
2144
|
}
|
|
2199
2145
|
};
|
|
2200
2146
|
}
|
|
2201
|
-
var machine$
|
|
2147
|
+
var machine$2 = createMachine({
|
|
2202
2148
|
props({ props: props2 }) {
|
|
2203
2149
|
return { ...props2, present: !!props2.present };
|
|
2204
2150
|
},
|
|
@@ -2365,8 +2311,8 @@ const usePresence$1 = (props = {}) => {
|
|
|
2365
2311
|
present,
|
|
2366
2312
|
onExitComplete: useEvent(props.onExitComplete)
|
|
2367
2313
|
};
|
|
2368
|
-
const service = useMachine(machine$
|
|
2369
|
-
const api = connect$
|
|
2314
|
+
const service = useMachine(machine$2, machineProps);
|
|
2315
|
+
const api = connect$2(service);
|
|
2370
2316
|
if (api.present) {
|
|
2371
2317
|
wasEverPresent.current = true;
|
|
2372
2318
|
}
|
|
@@ -2395,7 +2341,7 @@ var correctTargets = (parent, targets) => targets.map((target) => {
|
|
|
2395
2341
|
}
|
|
2396
2342
|
console.error("[zag-js > ariaHidden] target", target, "in not contained inside", parent, ". Doing nothing");
|
|
2397
2343
|
return null;
|
|
2398
|
-
}).filter((
|
|
2344
|
+
}).filter((x2) => Boolean(x2));
|
|
2399
2345
|
var isIgnoredNode = (node) => {
|
|
2400
2346
|
if (node.localName === "next-route-announcer") return true;
|
|
2401
2347
|
if (node.localName === "script") return true;
|
|
@@ -2442,8 +2388,8 @@ var walkTreeOutside = (originalTarget, props) => {
|
|
|
2442
2388
|
if (!alreadyHidden) {
|
|
2443
2389
|
node.setAttribute(controlAttribute, "true");
|
|
2444
2390
|
}
|
|
2445
|
-
} catch (
|
|
2446
|
-
console.error("[zag-js > ariaHidden] cannot operate on ", node,
|
|
2391
|
+
} catch (e2) {
|
|
2392
|
+
console.error("[zag-js > ariaHidden] cannot operate on ", node, e2);
|
|
2447
2393
|
}
|
|
2448
2394
|
}
|
|
2449
2395
|
});
|
|
@@ -2635,7 +2581,7 @@ var FocusTrap = class {
|
|
|
2635
2581
|
}
|
|
2636
2582
|
}
|
|
2637
2583
|
} else {
|
|
2638
|
-
if (!this.state.containerGroups.some((g2) => g2.tabbableNodes.some((
|
|
2584
|
+
if (!this.state.containerGroups.some((g2) => g2.tabbableNodes.some((n2) => getTabIndex(n2) > 0))) {
|
|
2639
2585
|
navAcrossContainers = false;
|
|
2640
2586
|
}
|
|
2641
2587
|
}
|
|
@@ -2926,11 +2872,11 @@ var FocusTrap = class {
|
|
|
2926
2872
|
returnFocusOnDeactivate: true,
|
|
2927
2873
|
escapeDeactivates: true,
|
|
2928
2874
|
delayInitialFocus: true,
|
|
2929
|
-
isKeyForward(
|
|
2930
|
-
return isTabEvent(
|
|
2875
|
+
isKeyForward(e2) {
|
|
2876
|
+
return isTabEvent(e2) && !e2.shiftKey;
|
|
2931
2877
|
},
|
|
2932
|
-
isKeyBackward(
|
|
2933
|
-
return isTabEvent(
|
|
2878
|
+
isKeyBackward(e2) {
|
|
2879
|
+
return isTabEvent(e2) && e2.shiftKey;
|
|
2934
2880
|
},
|
|
2935
2881
|
...options
|
|
2936
2882
|
};
|
|
@@ -2982,7 +2928,7 @@ var FocusTrap = class {
|
|
|
2982
2928
|
nextTabbableNode
|
|
2983
2929
|
};
|
|
2984
2930
|
});
|
|
2985
|
-
this.state.tabbableGroups = this.state.containerGroups.filter((
|
|
2931
|
+
this.state.tabbableGroups = this.state.containerGroups.filter((group) => group.tabbableNodes.length > 0);
|
|
2986
2932
|
if (this.state.tabbableGroups.length <= 0 && !this.getNodeForOption("fallbackFocus")) {
|
|
2987
2933
|
throw new Error(
|
|
2988
2934
|
"Your focus-trap must have at least one container with at least one tabbable node in it at all times"
|
|
@@ -3145,7 +3091,7 @@ function preventBodyScroll(_document) {
|
|
|
3145
3091
|
body.removeAttribute(LOCK_CLASSNAME);
|
|
3146
3092
|
};
|
|
3147
3093
|
}
|
|
3148
|
-
var anatomy$
|
|
3094
|
+
var anatomy$1 = createAnatomy("dialog").parts(
|
|
3149
3095
|
"trigger",
|
|
3150
3096
|
"backdrop",
|
|
3151
3097
|
"positioner",
|
|
@@ -3154,7 +3100,7 @@ var anatomy$2 = createAnatomy("dialog").parts(
|
|
|
3154
3100
|
"description",
|
|
3155
3101
|
"closeTrigger"
|
|
3156
3102
|
);
|
|
3157
|
-
var parts$
|
|
3103
|
+
var parts$1 = anatomy$1.build();
|
|
3158
3104
|
var getPositionerId = (ctx) => {
|
|
3159
3105
|
var _a;
|
|
3160
3106
|
return ((_a = ctx.ids) == null ? void 0 : _a.positioner) ?? `dialog:${ctx.id}:positioner`;
|
|
@@ -3171,15 +3117,15 @@ var getTriggerId$1 = (ctx) => {
|
|
|
3171
3117
|
var _a;
|
|
3172
3118
|
return ((_a = ctx.ids) == null ? void 0 : _a.trigger) ?? `dialog:${ctx.id}:trigger`;
|
|
3173
3119
|
};
|
|
3174
|
-
var getTitleId
|
|
3120
|
+
var getTitleId = (ctx) => {
|
|
3175
3121
|
var _a;
|
|
3176
3122
|
return ((_a = ctx.ids) == null ? void 0 : _a.title) ?? `dialog:${ctx.id}:title`;
|
|
3177
3123
|
};
|
|
3178
|
-
var getDescriptionId
|
|
3124
|
+
var getDescriptionId = (ctx) => {
|
|
3179
3125
|
var _a;
|
|
3180
3126
|
return ((_a = ctx.ids) == null ? void 0 : _a.description) ?? `dialog:${ctx.id}:description`;
|
|
3181
3127
|
};
|
|
3182
|
-
var getCloseTriggerId
|
|
3128
|
+
var getCloseTriggerId = (ctx) => {
|
|
3183
3129
|
var _a;
|
|
3184
3130
|
return ((_a = ctx.ids) == null ? void 0 : _a.closeTrigger) ?? `dialog:${ctx.id}:close`;
|
|
3185
3131
|
};
|
|
@@ -3187,10 +3133,10 @@ var getContentEl$1 = (ctx) => ctx.getById(getContentId$1(ctx));
|
|
|
3187
3133
|
var getPositionerEl = (ctx) => ctx.getById(getPositionerId(ctx));
|
|
3188
3134
|
var getBackdropEl = (ctx) => ctx.getById(getBackdropId(ctx));
|
|
3189
3135
|
var getTriggerEl$1 = (ctx) => ctx.getById(getTriggerId$1(ctx));
|
|
3190
|
-
var getTitleEl = (ctx) => ctx.getById(getTitleId
|
|
3191
|
-
var getDescriptionEl = (ctx) => ctx.getById(getDescriptionId
|
|
3192
|
-
var getCloseTriggerEl = (ctx) => ctx.getById(getCloseTriggerId
|
|
3193
|
-
function connect$
|
|
3136
|
+
var getTitleEl = (ctx) => ctx.getById(getTitleId(ctx));
|
|
3137
|
+
var getDescriptionEl = (ctx) => ctx.getById(getDescriptionId(ctx));
|
|
3138
|
+
var getCloseTriggerEl = (ctx) => ctx.getById(getCloseTriggerId(ctx));
|
|
3139
|
+
function connect$1(service, normalize) {
|
|
3194
3140
|
const { state, send, context: context2, prop, scope } = service;
|
|
3195
3141
|
const ariaLabel = prop("aria-label");
|
|
3196
3142
|
const open = state.matches("open");
|
|
@@ -3203,7 +3149,7 @@ function connect$2(service, normalize) {
|
|
|
3203
3149
|
},
|
|
3204
3150
|
getTriggerProps() {
|
|
3205
3151
|
return normalize.button({
|
|
3206
|
-
...parts$
|
|
3152
|
+
...parts$1.trigger.attrs,
|
|
3207
3153
|
dir: prop("dir"),
|
|
3208
3154
|
id: getTriggerId$1(scope),
|
|
3209
3155
|
"aria-haspopup": "dialog",
|
|
@@ -3219,7 +3165,7 @@ function connect$2(service, normalize) {
|
|
|
3219
3165
|
},
|
|
3220
3166
|
getBackdropProps() {
|
|
3221
3167
|
return normalize.element({
|
|
3222
|
-
...parts$
|
|
3168
|
+
...parts$1.backdrop.attrs,
|
|
3223
3169
|
dir: prop("dir"),
|
|
3224
3170
|
hidden: !open,
|
|
3225
3171
|
id: getBackdropId(scope),
|
|
@@ -3228,7 +3174,7 @@ function connect$2(service, normalize) {
|
|
|
3228
3174
|
},
|
|
3229
3175
|
getPositionerProps() {
|
|
3230
3176
|
return normalize.element({
|
|
3231
|
-
...parts$
|
|
3177
|
+
...parts$1.positioner.attrs,
|
|
3232
3178
|
dir: prop("dir"),
|
|
3233
3179
|
id: getPositionerId(scope),
|
|
3234
3180
|
style: {
|
|
@@ -3239,7 +3185,7 @@ function connect$2(service, normalize) {
|
|
|
3239
3185
|
getContentProps() {
|
|
3240
3186
|
const rendered = context2.get("rendered");
|
|
3241
3187
|
return normalize.element({
|
|
3242
|
-
...parts$
|
|
3188
|
+
...parts$1.content.attrs,
|
|
3243
3189
|
dir: prop("dir"),
|
|
3244
3190
|
role: prop("role"),
|
|
3245
3191
|
hidden: !open,
|
|
@@ -3248,29 +3194,29 @@ function connect$2(service, normalize) {
|
|
|
3248
3194
|
"data-state": open ? "open" : "closed",
|
|
3249
3195
|
"aria-modal": true,
|
|
3250
3196
|
"aria-label": ariaLabel || void 0,
|
|
3251
|
-
"aria-labelledby": ariaLabel || !rendered.title ? void 0 : getTitleId
|
|
3252
|
-
"aria-describedby": rendered.description ? getDescriptionId
|
|
3197
|
+
"aria-labelledby": ariaLabel || !rendered.title ? void 0 : getTitleId(scope),
|
|
3198
|
+
"aria-describedby": rendered.description ? getDescriptionId(scope) : void 0
|
|
3253
3199
|
});
|
|
3254
3200
|
},
|
|
3255
3201
|
getTitleProps() {
|
|
3256
3202
|
return normalize.element({
|
|
3257
|
-
...parts$
|
|
3203
|
+
...parts$1.title.attrs,
|
|
3258
3204
|
dir: prop("dir"),
|
|
3259
|
-
id: getTitleId
|
|
3205
|
+
id: getTitleId(scope)
|
|
3260
3206
|
});
|
|
3261
3207
|
},
|
|
3262
3208
|
getDescriptionProps() {
|
|
3263
3209
|
return normalize.element({
|
|
3264
|
-
...parts$
|
|
3210
|
+
...parts$1.description.attrs,
|
|
3265
3211
|
dir: prop("dir"),
|
|
3266
|
-
id: getDescriptionId
|
|
3212
|
+
id: getDescriptionId(scope)
|
|
3267
3213
|
});
|
|
3268
3214
|
},
|
|
3269
3215
|
getCloseTriggerProps() {
|
|
3270
3216
|
return normalize.button({
|
|
3271
|
-
...parts$
|
|
3217
|
+
...parts$1.closeTrigger.attrs,
|
|
3272
3218
|
dir: prop("dir"),
|
|
3273
|
-
id: getCloseTriggerId
|
|
3219
|
+
id: getCloseTriggerId(scope),
|
|
3274
3220
|
type: "button",
|
|
3275
3221
|
onClick(event) {
|
|
3276
3222
|
if (event.defaultPrevented) return;
|
|
@@ -3281,7 +3227,7 @@ function connect$2(service, normalize) {
|
|
|
3281
3227
|
}
|
|
3282
3228
|
};
|
|
3283
3229
|
}
|
|
3284
|
-
var machine$
|
|
3230
|
+
var machine$1 = createMachine({
|
|
3285
3231
|
props({ props: props2, scope }) {
|
|
3286
3232
|
const alertDialog = props2.role === "alertdialog";
|
|
3287
3233
|
const initialFocusEl = alertDialog ? () => getCloseTriggerEl(scope) : void 0;
|
|
@@ -3500,8 +3446,8 @@ const useDialog = (props) => {
|
|
|
3500
3446
|
dir,
|
|
3501
3447
|
...props
|
|
3502
3448
|
};
|
|
3503
|
-
const service = useMachine(machine$
|
|
3504
|
-
return connect$
|
|
3449
|
+
const service = useMachine(machine$1, machineProps);
|
|
3450
|
+
return connect$1(service, normalizeProps);
|
|
3505
3451
|
};
|
|
3506
3452
|
const DialogRoot = (props) => {
|
|
3507
3453
|
const [presenceProps, { children, ...localProps }] = splitPresenceProps(props);
|
|
@@ -3606,9 +3552,9 @@ const TabTrigger = React.forwardRef((props, ref) => {
|
|
|
3606
3552
|
return /* @__PURE__ */ jsxRuntime.jsx(ark.button, { ...mergedProps, ref });
|
|
3607
3553
|
});
|
|
3608
3554
|
TabTrigger.displayName = "TabTrigger";
|
|
3609
|
-
var anatomy
|
|
3610
|
-
var parts
|
|
3611
|
-
var getRootId
|
|
3555
|
+
var anatomy = createAnatomy("tabs").parts("root", "list", "trigger", "content", "indicator");
|
|
3556
|
+
var parts = anatomy.build();
|
|
3557
|
+
var getRootId = (ctx) => {
|
|
3612
3558
|
var _a;
|
|
3613
3559
|
return ((_a = ctx.ids) == null ? void 0 : _a.root) ?? `tabs:${ctx.id}`;
|
|
3614
3560
|
};
|
|
@@ -3659,7 +3605,7 @@ var resolveRect = (rect) => ({
|
|
|
3659
3605
|
left: `${rect.left}px`,
|
|
3660
3606
|
top: `${rect.top}px`
|
|
3661
3607
|
});
|
|
3662
|
-
function connect
|
|
3608
|
+
function connect(service, normalize) {
|
|
3663
3609
|
const { state, send, context: context2, prop, scope } = service;
|
|
3664
3610
|
const translations = prop("translations");
|
|
3665
3611
|
const focused = state.matches("focused");
|
|
@@ -3705,8 +3651,8 @@ function connect$1(service, normalize) {
|
|
|
3705
3651
|
},
|
|
3706
3652
|
getRootProps() {
|
|
3707
3653
|
return normalize.element({
|
|
3708
|
-
...parts
|
|
3709
|
-
id: getRootId
|
|
3654
|
+
...parts.root.attrs,
|
|
3655
|
+
id: getRootId(scope),
|
|
3710
3656
|
"data-orientation": prop("orientation"),
|
|
3711
3657
|
"data-focus": dataAttr(focused),
|
|
3712
3658
|
dir: prop("dir")
|
|
@@ -3714,7 +3660,7 @@ function connect$1(service, normalize) {
|
|
|
3714
3660
|
},
|
|
3715
3661
|
getListProps() {
|
|
3716
3662
|
return normalize.element({
|
|
3717
|
-
...parts
|
|
3663
|
+
...parts.list.attrs,
|
|
3718
3664
|
id: getListId(scope),
|
|
3719
3665
|
role: "tablist",
|
|
3720
3666
|
dir: prop("dir"),
|
|
@@ -3770,7 +3716,7 @@ function connect$1(service, normalize) {
|
|
|
3770
3716
|
const { value, disabled } = props2;
|
|
3771
3717
|
const triggerState = getTriggerState(props2);
|
|
3772
3718
|
return normalize.button({
|
|
3773
|
-
...parts
|
|
3719
|
+
...parts.trigger.attrs,
|
|
3774
3720
|
role: "tab",
|
|
3775
3721
|
type: "button",
|
|
3776
3722
|
disabled,
|
|
@@ -3810,7 +3756,7 @@ function connect$1(service, normalize) {
|
|
|
3810
3756
|
const { value } = props2;
|
|
3811
3757
|
const selected = context2.get("value") === value;
|
|
3812
3758
|
return normalize.element({
|
|
3813
|
-
...parts
|
|
3759
|
+
...parts.content.attrs,
|
|
3814
3760
|
dir: prop("dir"),
|
|
3815
3761
|
id: getContentId(scope, value),
|
|
3816
3762
|
tabIndex: composite ? 0 : -1,
|
|
@@ -3827,7 +3773,7 @@ function connect$1(service, normalize) {
|
|
|
3827
3773
|
const indicatorTransition = context2.get("indicatorTransition");
|
|
3828
3774
|
return normalize.element({
|
|
3829
3775
|
id: getIndicatorId(scope),
|
|
3830
|
-
...parts
|
|
3776
|
+
...parts.indicator.attrs,
|
|
3831
3777
|
dir: prop("dir"),
|
|
3832
3778
|
"data-orientation": prop("orientation"),
|
|
3833
3779
|
style: {
|
|
@@ -3847,8 +3793,8 @@ function connect$1(service, normalize) {
|
|
|
3847
3793
|
}
|
|
3848
3794
|
};
|
|
3849
3795
|
}
|
|
3850
|
-
var { not
|
|
3851
|
-
var machine
|
|
3796
|
+
var { not } = createGuards();
|
|
3797
|
+
var machine = createMachine({
|
|
3852
3798
|
props({ props: props2 }) {
|
|
3853
3799
|
return {
|
|
3854
3800
|
dir: "ltr",
|
|
@@ -3971,7 +3917,7 @@ var machine$1 = createMachine({
|
|
|
3971
3917
|
}
|
|
3972
3918
|
],
|
|
3973
3919
|
ENTER: {
|
|
3974
|
-
guard: not
|
|
3920
|
+
guard: not("selectOnFocus"),
|
|
3975
3921
|
actions: ["selectFocusedTab"]
|
|
3976
3922
|
},
|
|
3977
3923
|
TAB_FOCUS: {
|
|
@@ -4152,8 +4098,8 @@ const useTabs = (props) => {
|
|
|
4152
4098
|
getRootNode,
|
|
4153
4099
|
...props
|
|
4154
4100
|
};
|
|
4155
|
-
const service = useMachine(machine
|
|
4156
|
-
return connect
|
|
4101
|
+
const service = useMachine(machine, machineProps);
|
|
4102
|
+
return connect(service, normalizeProps);
|
|
4157
4103
|
};
|
|
4158
4104
|
const TabsRoot = React.forwardRef((props, ref) => {
|
|
4159
4105
|
const [renderStrategyProps, tabsProps] = splitRenderStrategyProps(props);
|
|
@@ -4177,1188 +4123,105 @@ const TabsRoot = React.forwardRef((props, ref) => {
|
|
|
4177
4123
|
return /* @__PURE__ */ jsxRuntime.jsx(TabsProvider, { value: tabs, children: /* @__PURE__ */ jsxRuntime.jsx(RenderStrategyPropsProvider, { value: renderStrategyProps, children: /* @__PURE__ */ jsxRuntime.jsx(ark.div, { ...mergedProps, ref }) }) });
|
|
4178
4124
|
});
|
|
4179
4125
|
TabsRoot.displayName = "TabsRoot";
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
loading: Infinity,
|
|
4201
|
-
DEFAULT: 5e3
|
|
4202
|
-
};
|
|
4203
|
-
function getToastDuration(duration, type) {
|
|
4204
|
-
return duration ?? defaultTimeouts[type] ?? defaultTimeouts.DEFAULT;
|
|
4205
|
-
}
|
|
4206
|
-
var getOffsets = (offsets) => typeof offsets === "string" ? { left: offsets, right: offsets, bottom: offsets, top: offsets } : offsets;
|
|
4207
|
-
function getGroupPlacementStyle(service, placement) {
|
|
4208
|
-
var _a;
|
|
4209
|
-
const { prop, computed, context: context2 } = service;
|
|
4210
|
-
const { offsets, gap } = prop("store").attrs;
|
|
4211
|
-
const heights = context2.get("heights");
|
|
4212
|
-
const computedOffset = getOffsets(offsets);
|
|
4213
|
-
const rtl = prop("dir") === "rtl";
|
|
4214
|
-
const computedPlacement = placement.replace("-start", rtl ? "-right" : "-left").replace("-end", rtl ? "-left" : "-right");
|
|
4215
|
-
const isRighty = computedPlacement.includes("right");
|
|
4216
|
-
const isLefty = computedPlacement.includes("left");
|
|
4217
|
-
const styles2 = {
|
|
4218
|
-
position: "fixed",
|
|
4219
|
-
pointerEvents: computed("count") > 0 ? void 0 : "none",
|
|
4220
|
-
display: "flex",
|
|
4221
|
-
flexDirection: "column",
|
|
4222
|
-
"--gap": `${gap}px`,
|
|
4223
|
-
"--first-height": `${((_a = heights[0]) == null ? void 0 : _a.height) || 0}px`,
|
|
4224
|
-
zIndex: MAX_Z_INDEX
|
|
4225
|
-
};
|
|
4226
|
-
let alignItems = "center";
|
|
4227
|
-
if (isRighty) alignItems = "flex-end";
|
|
4228
|
-
if (isLefty) alignItems = "flex-start";
|
|
4229
|
-
styles2.alignItems = alignItems;
|
|
4230
|
-
if (computedPlacement.includes("top")) {
|
|
4231
|
-
const offset = computedOffset.top;
|
|
4232
|
-
styles2.top = `max(env(safe-area-inset-top, 0px), ${offset})`;
|
|
4233
|
-
}
|
|
4234
|
-
if (computedPlacement.includes("bottom")) {
|
|
4235
|
-
const offset = computedOffset.bottom;
|
|
4236
|
-
styles2.bottom = `max(env(safe-area-inset-bottom, 0px), ${offset})`;
|
|
4237
|
-
}
|
|
4238
|
-
if (!computedPlacement.includes("left")) {
|
|
4239
|
-
const offset = computedOffset.right;
|
|
4240
|
-
styles2.insetInlineEnd = `calc(env(safe-area-inset-right, 0px) + ${offset})`;
|
|
4241
|
-
}
|
|
4242
|
-
if (!computedPlacement.includes("right")) {
|
|
4243
|
-
const offset = computedOffset.left;
|
|
4244
|
-
styles2.insetInlineStart = `calc(env(safe-area-inset-left, 0px) + ${offset})`;
|
|
4245
|
-
}
|
|
4246
|
-
return styles2;
|
|
4247
|
-
}
|
|
4248
|
-
function getPlacementStyle(service, visible) {
|
|
4249
|
-
const { prop, context: context2, computed } = service;
|
|
4250
|
-
const parent = prop("parent");
|
|
4251
|
-
const placement = parent.computed("placement");
|
|
4252
|
-
const { gap } = parent.prop("store").attrs;
|
|
4253
|
-
const [side] = placement.split("-");
|
|
4254
|
-
const mounted = context2.get("mounted");
|
|
4255
|
-
const remainingTime = context2.get("remainingTime");
|
|
4256
|
-
const height = computed("height");
|
|
4257
|
-
const frontmost = computed("frontmost");
|
|
4258
|
-
const sibling = !frontmost;
|
|
4259
|
-
const overlap = !prop("stacked");
|
|
4260
|
-
const stacked = prop("stacked");
|
|
4261
|
-
const type = prop("type");
|
|
4262
|
-
const duration = type === "loading" ? Number.MAX_SAFE_INTEGER : remainingTime;
|
|
4263
|
-
const offset = computed("heightIndex") * gap + computed("heightBefore");
|
|
4264
|
-
const styles2 = {
|
|
4265
|
-
position: "absolute",
|
|
4266
|
-
pointerEvents: "auto",
|
|
4267
|
-
"--opacity": "0",
|
|
4268
|
-
"--remove-delay": `${prop("removeDelay")}ms`,
|
|
4269
|
-
"--duration": `${duration}ms`,
|
|
4270
|
-
"--initial-height": `${height}px`,
|
|
4271
|
-
"--offset": `${offset}px`,
|
|
4272
|
-
"--index": prop("index"),
|
|
4273
|
-
"--z-index": computed("zIndex"),
|
|
4274
|
-
"--lift-amount": "calc(var(--lift) * var(--gap))",
|
|
4275
|
-
"--y": "100%",
|
|
4276
|
-
"--x": "0"
|
|
4277
|
-
};
|
|
4278
|
-
const assign = (overrides) => Object.assign(styles2, overrides);
|
|
4279
|
-
if (side === "top") {
|
|
4280
|
-
assign({
|
|
4281
|
-
top: "0",
|
|
4282
|
-
"--sign": "-1",
|
|
4283
|
-
"--y": "-100%",
|
|
4284
|
-
"--lift": "1"
|
|
4285
|
-
});
|
|
4286
|
-
} else if (side === "bottom") {
|
|
4287
|
-
assign({
|
|
4288
|
-
bottom: "0",
|
|
4289
|
-
"--sign": "1",
|
|
4290
|
-
"--y": "100%",
|
|
4291
|
-
"--lift": "-1"
|
|
4292
|
-
});
|
|
4293
|
-
}
|
|
4294
|
-
if (mounted) {
|
|
4295
|
-
assign({
|
|
4296
|
-
"--y": "0",
|
|
4297
|
-
"--opacity": "1"
|
|
4298
|
-
});
|
|
4299
|
-
if (stacked) {
|
|
4300
|
-
assign({
|
|
4301
|
-
"--y": "calc(var(--lift) * var(--offset))",
|
|
4302
|
-
"--height": "var(--initial-height)"
|
|
4303
|
-
});
|
|
4304
|
-
}
|
|
4305
|
-
}
|
|
4306
|
-
if (!visible) {
|
|
4307
|
-
assign({
|
|
4308
|
-
"--opacity": "0",
|
|
4309
|
-
pointerEvents: "none"
|
|
4310
|
-
});
|
|
4311
|
-
}
|
|
4312
|
-
if (sibling && overlap) {
|
|
4313
|
-
assign({
|
|
4314
|
-
"--base-scale": "var(--index) * 0.05 + 1",
|
|
4315
|
-
"--y": "calc(var(--lift-amount) * var(--index))",
|
|
4316
|
-
"--scale": "calc(-1 * var(--base-scale))",
|
|
4317
|
-
"--height": "var(--first-height)"
|
|
4318
|
-
});
|
|
4319
|
-
if (!visible) {
|
|
4320
|
-
assign({
|
|
4321
|
-
"--y": "calc(var(--sign) * 40%)"
|
|
4322
|
-
});
|
|
4126
|
+
const spinnerRecipe = cva({
|
|
4127
|
+
base: {
|
|
4128
|
+
display: "inline-block",
|
|
4129
|
+
borderWidth: "md",
|
|
4130
|
+
borderStyle: "solid",
|
|
4131
|
+
borderStartEndRadius: "full",
|
|
4132
|
+
borderEndStartRadius: "full",
|
|
4133
|
+
borderRadius: "full",
|
|
4134
|
+
animation: "spin",
|
|
4135
|
+
animationDuration: "slowest"
|
|
4136
|
+
},
|
|
4137
|
+
defaultVariants: {
|
|
4138
|
+
size: "md"
|
|
4139
|
+
},
|
|
4140
|
+
variants: {
|
|
4141
|
+
size: {
|
|
4142
|
+
sm: { width: 4, height: 4 },
|
|
4143
|
+
md: { width: 6, height: 6 },
|
|
4144
|
+
lg: { width: 12, height: 12 },
|
|
4145
|
+
xl: { width: 24, height: 24 }
|
|
4323
4146
|
}
|
|
4324
4147
|
}
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
"--y": "calc(var(--lift) * -100%)"
|
|
4333
|
-
});
|
|
4334
|
-
}
|
|
4335
|
-
return styles2;
|
|
4336
|
-
}
|
|
4337
|
-
function getGhostBeforeStyle(service, visible) {
|
|
4338
|
-
const { computed } = service;
|
|
4339
|
-
const styles2 = {
|
|
4340
|
-
position: "absolute",
|
|
4341
|
-
inset: "0",
|
|
4342
|
-
scale: "1 2",
|
|
4343
|
-
pointerEvents: visible ? "none" : "auto"
|
|
4344
|
-
};
|
|
4345
|
-
const assign = (overrides) => Object.assign(styles2, overrides);
|
|
4346
|
-
if (computed("frontmost") && !visible) {
|
|
4347
|
-
assign({
|
|
4348
|
-
height: "calc(var(--initial-height) + 80%)"
|
|
4349
|
-
});
|
|
4350
|
-
}
|
|
4351
|
-
return styles2;
|
|
4352
|
-
}
|
|
4353
|
-
function getGhostAfterStyle() {
|
|
4354
|
-
return {
|
|
4355
|
-
position: "absolute",
|
|
4356
|
-
left: "0",
|
|
4357
|
-
height: "calc(var(--gap) + 2px)",
|
|
4358
|
-
bottom: "100%",
|
|
4359
|
-
width: "100%"
|
|
4360
|
-
};
|
|
4361
|
-
}
|
|
4362
|
-
function groupConnect(service, normalize) {
|
|
4363
|
-
const { context: context2, prop, send, refs, computed } = service;
|
|
4364
|
-
return {
|
|
4365
|
-
getCount() {
|
|
4366
|
-
return context2.get("toasts").length;
|
|
4367
|
-
},
|
|
4368
|
-
getToasts() {
|
|
4369
|
-
return context2.get("toasts");
|
|
4370
|
-
},
|
|
4371
|
-
getGroupProps(options = {}) {
|
|
4372
|
-
const { label = "Notifications" } = options;
|
|
4373
|
-
const { hotkey } = prop("store").attrs;
|
|
4374
|
-
const hotkeyLabel = hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
|
|
4375
|
-
const placement = computed("placement");
|
|
4376
|
-
const [side, align = "center"] = placement.split("-");
|
|
4377
|
-
return normalize.element({
|
|
4378
|
-
...parts.group.attrs,
|
|
4379
|
-
dir: prop("dir"),
|
|
4380
|
-
tabIndex: -1,
|
|
4381
|
-
"aria-label": `${placement} ${label} ${hotkeyLabel}`,
|
|
4382
|
-
id: getRegionId(placement),
|
|
4383
|
-
"data-placement": placement,
|
|
4384
|
-
"data-side": side,
|
|
4385
|
-
"data-align": align,
|
|
4386
|
-
"aria-live": "polite",
|
|
4387
|
-
role: "region",
|
|
4388
|
-
style: getGroupPlacementStyle(service, placement),
|
|
4389
|
-
onMouseMove() {
|
|
4390
|
-
send({ type: "REGION.POINTER_ENTER", placement });
|
|
4391
|
-
},
|
|
4392
|
-
onMouseLeave() {
|
|
4393
|
-
send({ type: "REGION.POINTER_LEAVE", placement });
|
|
4394
|
-
},
|
|
4395
|
-
onFocus(event) {
|
|
4396
|
-
send({ type: "REGION.FOCUS", target: event.relatedTarget });
|
|
4397
|
-
},
|
|
4398
|
-
onBlur(event) {
|
|
4399
|
-
if (refs.get("isFocusWithin") && !contains(event.currentTarget, event.relatedTarget)) {
|
|
4400
|
-
queueMicrotask(() => send({ type: "REGION.BLUR" }));
|
|
4401
|
-
}
|
|
4402
|
-
}
|
|
4403
|
-
});
|
|
4404
|
-
},
|
|
4405
|
-
subscribe(fn) {
|
|
4406
|
-
const store = prop("store");
|
|
4407
|
-
return store.subscribe(() => fn(context2.get("toasts")));
|
|
4408
|
-
}
|
|
4409
|
-
};
|
|
4410
|
-
}
|
|
4411
|
-
var groupMachine = createMachine({
|
|
4412
|
-
props({ props }) {
|
|
4413
|
-
return {
|
|
4414
|
-
dir: "ltr",
|
|
4415
|
-
id: uuid(),
|
|
4148
|
+
});
|
|
4149
|
+
const Spinner = React.forwardRef((props, ref) => {
|
|
4150
|
+
const StyledSpinner = styled(ark.div, spinnerRecipe);
|
|
4151
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4152
|
+
StyledSpinner,
|
|
4153
|
+
{
|
|
4154
|
+
ref,
|
|
4416
4155
|
...props,
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
},
|
|
4423
|
-
refs() {
|
|
4424
|
-
return {
|
|
4425
|
-
lastFocusedEl: null,
|
|
4426
|
-
isFocusWithin: false,
|
|
4427
|
-
dismissableCleanup: void 0
|
|
4428
|
-
};
|
|
4429
|
-
},
|
|
4430
|
-
context({ bindable }) {
|
|
4431
|
-
return {
|
|
4432
|
-
toasts: bindable(() => ({
|
|
4433
|
-
defaultValue: [],
|
|
4434
|
-
sync: true,
|
|
4435
|
-
hash: (toasts) => toasts.map((t) => t.id).join(",")
|
|
4436
|
-
})),
|
|
4437
|
-
heights: bindable(() => ({
|
|
4438
|
-
defaultValue: [],
|
|
4439
|
-
sync: true
|
|
4440
|
-
}))
|
|
4441
|
-
};
|
|
4442
|
-
},
|
|
4443
|
-
computed: {
|
|
4444
|
-
count: ({ context: context2 }) => context2.get("toasts").length,
|
|
4445
|
-
overlap: ({ prop }) => prop("store").attrs.overlap,
|
|
4446
|
-
placement: ({ prop }) => prop("store").attrs.placement
|
|
4447
|
-
},
|
|
4448
|
-
effects: ["subscribeToStore", "trackDocumentVisibility", "trackHotKeyPress"],
|
|
4449
|
-
watch({ track, context: context2, action }) {
|
|
4450
|
-
track([() => context2.hash("toasts")], () => {
|
|
4451
|
-
queueMicrotask(() => {
|
|
4452
|
-
action(["collapsedIfEmpty", "setDismissableBranch"]);
|
|
4453
|
-
});
|
|
4454
|
-
});
|
|
4455
|
-
},
|
|
4456
|
-
exit: ["clearDismissableBranch", "clearLastFocusedEl"],
|
|
4457
|
-
on: {
|
|
4458
|
-
"DOC.HOTKEY": {
|
|
4459
|
-
actions: ["focusRegionEl"]
|
|
4460
|
-
},
|
|
4461
|
-
"REGION.BLUR": [
|
|
4462
|
-
{
|
|
4463
|
-
guard: "isOverlapping",
|
|
4464
|
-
target: "overlap",
|
|
4465
|
-
actions: ["collapseToasts", "resumeToasts", "restoreLastFocusedEl"]
|
|
4466
|
-
},
|
|
4467
|
-
{
|
|
4468
|
-
target: "stack",
|
|
4469
|
-
actions: ["resumeToasts", "restoreLastFocusedEl"]
|
|
4156
|
+
css: {
|
|
4157
|
+
borderColor: "inherit",
|
|
4158
|
+
borderBottomColor: "transparent",
|
|
4159
|
+
borderLeftColor: "transparent",
|
|
4160
|
+
...props.css
|
|
4470
4161
|
}
|
|
4471
|
-
],
|
|
4472
|
-
"TOAST.REMOVE": {
|
|
4473
|
-
actions: ["removeToast", "removeHeight"]
|
|
4474
|
-
},
|
|
4475
|
-
"TOAST.PAUSE": {
|
|
4476
|
-
actions: ["pauseToasts"]
|
|
4477
4162
|
}
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
}
|
|
4502
|
-
}
|
|
4503
|
-
},
|
|
4504
|
-
overlap: {
|
|
4505
|
-
on: {
|
|
4506
|
-
"REGION.STACK": {
|
|
4507
|
-
target: "stack",
|
|
4508
|
-
actions: ["expandToasts"]
|
|
4509
|
-
},
|
|
4510
|
-
"REGION.POINTER_ENTER": {
|
|
4511
|
-
target: "stack",
|
|
4512
|
-
actions: ["pauseToasts", "expandToasts"]
|
|
4513
|
-
},
|
|
4514
|
-
"REGION.FOCUS": {
|
|
4515
|
-
target: "stack",
|
|
4516
|
-
actions: ["setLastFocusedEl", "pauseToasts", "expandToasts"]
|
|
4517
|
-
}
|
|
4518
|
-
}
|
|
4163
|
+
);
|
|
4164
|
+
});
|
|
4165
|
+
Spinner.displayName = "Spinner";
|
|
4166
|
+
const buttonRecipe = cva({
|
|
4167
|
+
base: {
|
|
4168
|
+
alignItems: "center",
|
|
4169
|
+
appearance: "none",
|
|
4170
|
+
cursor: "pointer",
|
|
4171
|
+
display: "inline-flex",
|
|
4172
|
+
fontWeight: "semibold",
|
|
4173
|
+
isolation: "isolate",
|
|
4174
|
+
minWidth: "0",
|
|
4175
|
+
justifyContent: "center",
|
|
4176
|
+
outline: "none",
|
|
4177
|
+
position: "relative",
|
|
4178
|
+
transitionDuration: "normal",
|
|
4179
|
+
transitionProperty: "background, border-color, color, box-shadow",
|
|
4180
|
+
transitionTimingFunction: "default",
|
|
4181
|
+
userSelect: "none",
|
|
4182
|
+
verticalAlign: "middle",
|
|
4183
|
+
whiteSpace: "nowrap",
|
|
4184
|
+
_hidden: {
|
|
4185
|
+
display: "none"
|
|
4519
4186
|
}
|
|
4520
4187
|
},
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
}
|
|
4537
|
-
return [toast2, ...prev];
|
|
4538
|
-
});
|
|
4539
|
-
});
|
|
4188
|
+
defaultVariants: {
|
|
4189
|
+
variant: "solid",
|
|
4190
|
+
size: "md",
|
|
4191
|
+
radius: "full",
|
|
4192
|
+
color: "neutral"
|
|
4193
|
+
},
|
|
4194
|
+
variants: {
|
|
4195
|
+
variant: {
|
|
4196
|
+
solid: {
|
|
4197
|
+
_disabled: {
|
|
4198
|
+
background: "background.neutral.disabled",
|
|
4199
|
+
color: "content.neutral.disabled",
|
|
4200
|
+
cursor: "not-allowed",
|
|
4201
|
+
pointerEvents: "none"
|
|
4202
|
+
}
|
|
4540
4203
|
},
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4204
|
+
outline: {
|
|
4205
|
+
background: "transparent",
|
|
4206
|
+
borderWidth: "1px",
|
|
4207
|
+
borderStyle: "solid",
|
|
4208
|
+
borderColor: "border.neutral.default",
|
|
4209
|
+
_disabled: {
|
|
4210
|
+
background: "transparent",
|
|
4211
|
+
color: "content.neutral.disabled",
|
|
4212
|
+
borderColor: "border.neutral.disabled",
|
|
4213
|
+
cursor: "not-allowed",
|
|
4214
|
+
pointerEvents: "none"
|
|
4215
|
+
}
|
|
4549
4216
|
},
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
}
|
|
4558
|
-
}
|
|
4559
|
-
},
|
|
4560
|
-
actions: {
|
|
4561
|
-
setDismissableBranch({ refs, context: context2, computed, scope }) {
|
|
4562
|
-
var _a;
|
|
4563
|
-
const toasts = context2.get("toasts");
|
|
4564
|
-
const placement = computed("placement");
|
|
4565
|
-
const hasToasts = toasts.length > 0;
|
|
4566
|
-
if (!hasToasts) {
|
|
4567
|
-
(_a = refs.get("dismissableCleanup")) == null ? void 0 : _a();
|
|
4568
|
-
return;
|
|
4569
|
-
}
|
|
4570
|
-
if (hasToasts && refs.get("dismissableCleanup")) {
|
|
4571
|
-
return;
|
|
4572
|
-
}
|
|
4573
|
-
const groupEl = () => getRegionEl(scope, placement);
|
|
4574
|
-
const cleanup = trackDismissableBranch(groupEl, { defer: true });
|
|
4575
|
-
refs.set("dismissableCleanup", cleanup);
|
|
4576
|
-
},
|
|
4577
|
-
clearDismissableBranch({ refs }) {
|
|
4578
|
-
var _a;
|
|
4579
|
-
(_a = refs.get("dismissableCleanup")) == null ? void 0 : _a();
|
|
4580
|
-
},
|
|
4581
|
-
focusRegionEl({ scope, computed }) {
|
|
4582
|
-
queueMicrotask(() => {
|
|
4583
|
-
var _a;
|
|
4584
|
-
(_a = getRegionEl(scope, computed("placement"))) == null ? void 0 : _a.focus();
|
|
4585
|
-
});
|
|
4586
|
-
},
|
|
4587
|
-
pauseToasts({ prop }) {
|
|
4588
|
-
prop("store").pause();
|
|
4589
|
-
},
|
|
4590
|
-
resumeToasts({ prop }) {
|
|
4591
|
-
prop("store").resume();
|
|
4592
|
-
},
|
|
4593
|
-
expandToasts({ prop }) {
|
|
4594
|
-
prop("store").expand();
|
|
4595
|
-
},
|
|
4596
|
-
collapseToasts({ prop }) {
|
|
4597
|
-
prop("store").collapse();
|
|
4598
|
-
},
|
|
4599
|
-
removeToast({ prop, event }) {
|
|
4600
|
-
prop("store").remove(event.id);
|
|
4601
|
-
},
|
|
4602
|
-
removeHeight({ event, context: context2 }) {
|
|
4603
|
-
if ((event == null ? void 0 : event.id) == null) return;
|
|
4604
|
-
queueMicrotask(() => {
|
|
4605
|
-
context2.set("heights", (heights) => heights.filter((height) => height.id !== event.id));
|
|
4606
|
-
});
|
|
4607
|
-
},
|
|
4608
|
-
collapsedIfEmpty({ send, computed }) {
|
|
4609
|
-
if (!computed("overlap") || computed("count") > 1) return;
|
|
4610
|
-
send({ type: "REGION.OVERLAP" });
|
|
4611
|
-
},
|
|
4612
|
-
setLastFocusedEl({ refs, event }) {
|
|
4613
|
-
if (refs.get("isFocusWithin") || !event.target) return;
|
|
4614
|
-
refs.set("isFocusWithin", true);
|
|
4615
|
-
refs.set("lastFocusedEl", event.target);
|
|
4616
|
-
},
|
|
4617
|
-
restoreLastFocusedEl({ refs }) {
|
|
4618
|
-
var _a;
|
|
4619
|
-
if (!refs.get("lastFocusedEl")) return;
|
|
4620
|
-
(_a = refs.get("lastFocusedEl")) == null ? void 0 : _a.focus({ preventScroll: true });
|
|
4621
|
-
refs.set("lastFocusedEl", null);
|
|
4622
|
-
refs.set("isFocusWithin", false);
|
|
4623
|
-
},
|
|
4624
|
-
clearLastFocusedEl({ refs }) {
|
|
4625
|
-
var _a;
|
|
4626
|
-
if (!refs.get("lastFocusedEl")) return;
|
|
4627
|
-
(_a = refs.get("lastFocusedEl")) == null ? void 0 : _a.focus({ preventScroll: true });
|
|
4628
|
-
refs.set("lastFocusedEl", null);
|
|
4629
|
-
refs.set("isFocusWithin", false);
|
|
4630
|
-
}
|
|
4631
|
-
}
|
|
4632
|
-
}
|
|
4633
|
-
});
|
|
4634
|
-
function connect(service, normalize) {
|
|
4635
|
-
const { state, send, prop, scope, context: context2, computed } = service;
|
|
4636
|
-
const visible = state.hasTag("visible");
|
|
4637
|
-
const paused = state.hasTag("paused");
|
|
4638
|
-
const mounted = context2.get("mounted");
|
|
4639
|
-
const frontmost = computed("frontmost");
|
|
4640
|
-
const placement = prop("parent").computed("placement");
|
|
4641
|
-
const type = prop("type");
|
|
4642
|
-
const stacked = prop("stacked");
|
|
4643
|
-
const title = prop("title");
|
|
4644
|
-
const description = prop("description");
|
|
4645
|
-
const action = prop("action");
|
|
4646
|
-
const [side, align = "center"] = placement.split("-");
|
|
4647
|
-
return {
|
|
4648
|
-
type,
|
|
4649
|
-
title,
|
|
4650
|
-
description,
|
|
4651
|
-
placement,
|
|
4652
|
-
visible,
|
|
4653
|
-
paused,
|
|
4654
|
-
closable: !!prop("closable"),
|
|
4655
|
-
pause() {
|
|
4656
|
-
send({ type: "PAUSE" });
|
|
4657
|
-
},
|
|
4658
|
-
resume() {
|
|
4659
|
-
send({ type: "RESUME" });
|
|
4660
|
-
},
|
|
4661
|
-
dismiss() {
|
|
4662
|
-
send({ type: "DISMISS", src: "programmatic" });
|
|
4663
|
-
},
|
|
4664
|
-
getRootProps() {
|
|
4665
|
-
return normalize.element({
|
|
4666
|
-
...parts.root.attrs,
|
|
4667
|
-
dir: prop("dir"),
|
|
4668
|
-
id: getRootId(scope),
|
|
4669
|
-
"data-state": visible ? "open" : "closed",
|
|
4670
|
-
"data-type": type,
|
|
4671
|
-
"data-placement": placement,
|
|
4672
|
-
"data-align": align,
|
|
4673
|
-
"data-side": side,
|
|
4674
|
-
"data-mounted": dataAttr(mounted),
|
|
4675
|
-
"data-paused": dataAttr(paused),
|
|
4676
|
-
"data-first": dataAttr(frontmost),
|
|
4677
|
-
"data-sibling": dataAttr(!frontmost),
|
|
4678
|
-
"data-stack": dataAttr(stacked),
|
|
4679
|
-
"data-overlap": dataAttr(!stacked),
|
|
4680
|
-
role: "status",
|
|
4681
|
-
"aria-atomic": "true",
|
|
4682
|
-
"aria-describedby": description ? getDescriptionId(scope) : void 0,
|
|
4683
|
-
"aria-labelledby": title ? getTitleId(scope) : void 0,
|
|
4684
|
-
tabIndex: 0,
|
|
4685
|
-
style: getPlacementStyle(service, visible),
|
|
4686
|
-
onKeyDown(event) {
|
|
4687
|
-
if (event.defaultPrevented) return;
|
|
4688
|
-
if (event.key == "Escape") {
|
|
4689
|
-
send({ type: "DISMISS", src: "keyboard" });
|
|
4690
|
-
event.preventDefault();
|
|
4691
|
-
}
|
|
4692
|
-
}
|
|
4693
|
-
});
|
|
4694
|
-
},
|
|
4695
|
-
/* Leave a ghost div to avoid setting hover to false when transitioning out */
|
|
4696
|
-
getGhostBeforeProps() {
|
|
4697
|
-
return normalize.element({
|
|
4698
|
-
"data-ghost": "before",
|
|
4699
|
-
style: getGhostBeforeStyle(service, visible)
|
|
4700
|
-
});
|
|
4701
|
-
},
|
|
4702
|
-
/* Needed to avoid setting hover to false when in between toasts */
|
|
4703
|
-
getGhostAfterProps() {
|
|
4704
|
-
return normalize.element({
|
|
4705
|
-
"data-ghost": "after",
|
|
4706
|
-
style: getGhostAfterStyle()
|
|
4707
|
-
});
|
|
4708
|
-
},
|
|
4709
|
-
getTitleProps() {
|
|
4710
|
-
return normalize.element({
|
|
4711
|
-
...parts.title.attrs,
|
|
4712
|
-
id: getTitleId(scope)
|
|
4713
|
-
});
|
|
4714
|
-
},
|
|
4715
|
-
getDescriptionProps() {
|
|
4716
|
-
return normalize.element({
|
|
4717
|
-
...parts.description.attrs,
|
|
4718
|
-
id: getDescriptionId(scope)
|
|
4719
|
-
});
|
|
4720
|
-
},
|
|
4721
|
-
getActionTriggerProps() {
|
|
4722
|
-
return normalize.button({
|
|
4723
|
-
...parts.actionTrigger.attrs,
|
|
4724
|
-
type: "button",
|
|
4725
|
-
onClick(event) {
|
|
4726
|
-
var _a;
|
|
4727
|
-
if (event.defaultPrevented) return;
|
|
4728
|
-
(_a = action == null ? void 0 : action.onClick) == null ? void 0 : _a.call(action);
|
|
4729
|
-
send({ type: "DISMISS", src: "user" });
|
|
4730
|
-
}
|
|
4731
|
-
});
|
|
4732
|
-
},
|
|
4733
|
-
getCloseTriggerProps() {
|
|
4734
|
-
return normalize.button({
|
|
4735
|
-
id: getCloseTriggerId(scope),
|
|
4736
|
-
...parts.closeTrigger.attrs,
|
|
4737
|
-
type: "button",
|
|
4738
|
-
"aria-label": "Dismiss notification",
|
|
4739
|
-
onClick(event) {
|
|
4740
|
-
if (event.defaultPrevented) return;
|
|
4741
|
-
send({ type: "DISMISS", src: "user" });
|
|
4742
|
-
}
|
|
4743
|
-
});
|
|
4744
|
-
}
|
|
4745
|
-
};
|
|
4746
|
-
}
|
|
4747
|
-
var { not } = createGuards();
|
|
4748
|
-
var machine = createMachine({
|
|
4749
|
-
props({ props }) {
|
|
4750
|
-
ensureProps(props, ["id", "type", "parent", "removeDelay"], "toast");
|
|
4751
|
-
return {
|
|
4752
|
-
closable: true,
|
|
4753
|
-
...props,
|
|
4754
|
-
duration: getToastDuration(props.duration, props.type)
|
|
4755
|
-
};
|
|
4756
|
-
},
|
|
4757
|
-
initialState({ prop }) {
|
|
4758
|
-
const persist = prop("type") === "loading" || prop("duration") === Infinity;
|
|
4759
|
-
return persist ? "visible:persist" : "visible";
|
|
4760
|
-
},
|
|
4761
|
-
context({ prop, bindable }) {
|
|
4762
|
-
return {
|
|
4763
|
-
remainingTime: bindable(() => ({
|
|
4764
|
-
defaultValue: getToastDuration(prop("duration"), prop("type"))
|
|
4765
|
-
})),
|
|
4766
|
-
createdAt: bindable(() => ({
|
|
4767
|
-
defaultValue: Date.now()
|
|
4768
|
-
})),
|
|
4769
|
-
mounted: bindable(() => ({
|
|
4770
|
-
defaultValue: false
|
|
4771
|
-
})),
|
|
4772
|
-
initialHeight: bindable(() => ({
|
|
4773
|
-
defaultValue: 0
|
|
4774
|
-
}))
|
|
4775
|
-
};
|
|
4776
|
-
},
|
|
4777
|
-
refs() {
|
|
4778
|
-
return {
|
|
4779
|
-
closeTimerStartTime: Date.now(),
|
|
4780
|
-
lastCloseStartTimerStartTime: 0
|
|
4781
|
-
};
|
|
4782
|
-
},
|
|
4783
|
-
computed: {
|
|
4784
|
-
zIndex: ({ prop }) => {
|
|
4785
|
-
const toasts = prop("parent").context.get("toasts");
|
|
4786
|
-
const index2 = toasts.findIndex((toast2) => toast2.id === prop("id"));
|
|
4787
|
-
return toasts.length - index2;
|
|
4788
|
-
},
|
|
4789
|
-
height: ({ prop }) => {
|
|
4790
|
-
const heights = prop("parent").context.get("heights");
|
|
4791
|
-
const height = heights.find((height2) => height2.id === prop("id"));
|
|
4792
|
-
return (height == null ? void 0 : height.height) ?? 0;
|
|
4793
|
-
},
|
|
4794
|
-
heightIndex: ({ prop }) => {
|
|
4795
|
-
const heights = prop("parent").context.get("heights");
|
|
4796
|
-
return heights.findIndex((height) => height.id === prop("id"));
|
|
4797
|
-
},
|
|
4798
|
-
frontmost: ({ prop }) => prop("index") === 0,
|
|
4799
|
-
heightBefore: ({ prop }) => {
|
|
4800
|
-
const heights = prop("parent").context.get("heights");
|
|
4801
|
-
const heightIndex = heights.findIndex((height) => height.id === prop("id"));
|
|
4802
|
-
return heights.reduce((prev, curr, reducerIndex) => {
|
|
4803
|
-
if (reducerIndex >= heightIndex) return prev;
|
|
4804
|
-
return prev + curr.height;
|
|
4805
|
-
}, 0);
|
|
4806
|
-
},
|
|
4807
|
-
shouldPersist: ({ prop }) => prop("type") === "loading" || prop("duration") === Infinity
|
|
4808
|
-
},
|
|
4809
|
-
watch({ track, prop, send }) {
|
|
4810
|
-
track([() => prop("message")], () => {
|
|
4811
|
-
const message = prop("message");
|
|
4812
|
-
if (message) send({ type: message, src: "programmatic" });
|
|
4813
|
-
});
|
|
4814
|
-
track([() => prop("type"), () => prop("duration")], () => {
|
|
4815
|
-
send({ type: "UPDATE" });
|
|
4816
|
-
});
|
|
4817
|
-
},
|
|
4818
|
-
on: {
|
|
4819
|
-
UPDATE: [
|
|
4820
|
-
{
|
|
4821
|
-
guard: "shouldPersist",
|
|
4822
|
-
target: "visible:persist",
|
|
4823
|
-
actions: ["resetCloseTimer"]
|
|
4824
|
-
},
|
|
4825
|
-
{
|
|
4826
|
-
target: "visible:updating",
|
|
4827
|
-
actions: ["resetCloseTimer"]
|
|
4828
|
-
}
|
|
4829
|
-
],
|
|
4830
|
-
MEASURE: {
|
|
4831
|
-
actions: ["measureHeight"]
|
|
4832
|
-
}
|
|
4833
|
-
},
|
|
4834
|
-
entry: ["setMounted", "measureHeight", "invokeOnVisible"],
|
|
4835
|
-
effects: ["trackHeight"],
|
|
4836
|
-
states: {
|
|
4837
|
-
"visible:updating": {
|
|
4838
|
-
tags: ["visible", "updating"],
|
|
4839
|
-
effects: ["waitForNextTick"],
|
|
4840
|
-
on: {
|
|
4841
|
-
SHOW: {
|
|
4842
|
-
target: "visible"
|
|
4843
|
-
}
|
|
4844
|
-
}
|
|
4845
|
-
},
|
|
4846
|
-
"visible:persist": {
|
|
4847
|
-
tags: ["visible", "paused"],
|
|
4848
|
-
on: {
|
|
4849
|
-
RESUME: {
|
|
4850
|
-
guard: not("isLoadingType"),
|
|
4851
|
-
target: "visible",
|
|
4852
|
-
actions: ["setCloseTimer"]
|
|
4853
|
-
},
|
|
4854
|
-
DISMISS: {
|
|
4855
|
-
target: "dismissing"
|
|
4856
|
-
}
|
|
4857
|
-
}
|
|
4858
|
-
},
|
|
4859
|
-
visible: {
|
|
4860
|
-
tags: ["visible"],
|
|
4861
|
-
effects: ["waitForDuration"],
|
|
4862
|
-
on: {
|
|
4863
|
-
DISMISS: {
|
|
4864
|
-
target: "dismissing"
|
|
4865
|
-
},
|
|
4866
|
-
PAUSE: {
|
|
4867
|
-
target: "visible:persist",
|
|
4868
|
-
actions: ["syncRemainingTime"]
|
|
4869
|
-
}
|
|
4870
|
-
}
|
|
4871
|
-
},
|
|
4872
|
-
dismissing: {
|
|
4873
|
-
entry: ["invokeOnDismiss"],
|
|
4874
|
-
effects: ["waitForRemoveDelay"],
|
|
4875
|
-
on: {
|
|
4876
|
-
REMOVE: {
|
|
4877
|
-
target: "unmounted",
|
|
4878
|
-
actions: ["notifyParentToRemove"]
|
|
4879
|
-
}
|
|
4880
|
-
}
|
|
4881
|
-
},
|
|
4882
|
-
unmounted: {
|
|
4883
|
-
entry: ["invokeOnUnmount"]
|
|
4884
|
-
}
|
|
4885
|
-
},
|
|
4886
|
-
implementations: {
|
|
4887
|
-
effects: {
|
|
4888
|
-
waitForRemoveDelay({ prop, send }) {
|
|
4889
|
-
return setRafTimeout(() => {
|
|
4890
|
-
send({ type: "REMOVE", src: "timer" });
|
|
4891
|
-
}, prop("removeDelay"));
|
|
4892
|
-
},
|
|
4893
|
-
waitForDuration({ send, context: context2, computed }) {
|
|
4894
|
-
if (computed("shouldPersist")) return;
|
|
4895
|
-
return setRafTimeout(() => {
|
|
4896
|
-
send({ type: "DISMISS", src: "timer" });
|
|
4897
|
-
}, context2.get("remainingTime"));
|
|
4898
|
-
},
|
|
4899
|
-
waitForNextTick({ send }) {
|
|
4900
|
-
return setRafTimeout(() => {
|
|
4901
|
-
send({ type: "SHOW", src: "timer" });
|
|
4902
|
-
}, 0);
|
|
4903
|
-
},
|
|
4904
|
-
trackHeight({ scope, prop }) {
|
|
4905
|
-
let cleanup;
|
|
4906
|
-
raf$1(() => {
|
|
4907
|
-
const rootEl = getRootEl(scope);
|
|
4908
|
-
if (!rootEl) return;
|
|
4909
|
-
const syncHeight = () => {
|
|
4910
|
-
const originalHeight = rootEl.style.height;
|
|
4911
|
-
rootEl.style.height = "auto";
|
|
4912
|
-
const height = rootEl.getBoundingClientRect().height;
|
|
4913
|
-
rootEl.style.height = originalHeight;
|
|
4914
|
-
const item = { id: prop("id"), height };
|
|
4915
|
-
setHeight(prop("parent"), item);
|
|
4916
|
-
};
|
|
4917
|
-
const win = scope.getWin();
|
|
4918
|
-
const observer = new win.MutationObserver(syncHeight);
|
|
4919
|
-
observer.observe(rootEl, {
|
|
4920
|
-
childList: true,
|
|
4921
|
-
subtree: true,
|
|
4922
|
-
characterData: true
|
|
4923
|
-
});
|
|
4924
|
-
cleanup = () => observer.disconnect();
|
|
4925
|
-
});
|
|
4926
|
-
return () => cleanup == null ? void 0 : cleanup();
|
|
4927
|
-
}
|
|
4928
|
-
},
|
|
4929
|
-
guards: {
|
|
4930
|
-
isLoadingType: ({ prop }) => prop("type") === "loading",
|
|
4931
|
-
shouldPersist: ({ computed }) => computed("shouldPersist")
|
|
4932
|
-
},
|
|
4933
|
-
actions: {
|
|
4934
|
-
setMounted({ context: context2 }) {
|
|
4935
|
-
raf$1(() => {
|
|
4936
|
-
context2.set("mounted", true);
|
|
4937
|
-
});
|
|
4938
|
-
},
|
|
4939
|
-
measureHeight({ scope, prop, context: context2 }) {
|
|
4940
|
-
queueMicrotask(() => {
|
|
4941
|
-
const rootEl = getRootEl(scope);
|
|
4942
|
-
if (!rootEl) return;
|
|
4943
|
-
const originalHeight = rootEl.style.height;
|
|
4944
|
-
rootEl.style.height = "auto";
|
|
4945
|
-
const height = rootEl.getBoundingClientRect().height;
|
|
4946
|
-
rootEl.style.height = originalHeight;
|
|
4947
|
-
context2.set("initialHeight", height);
|
|
4948
|
-
const item = { id: prop("id"), height };
|
|
4949
|
-
setHeight(prop("parent"), item);
|
|
4950
|
-
});
|
|
4951
|
-
},
|
|
4952
|
-
setCloseTimer({ refs }) {
|
|
4953
|
-
refs.set("closeTimerStartTime", Date.now());
|
|
4954
|
-
},
|
|
4955
|
-
resetCloseTimer({ context: context2, refs, prop }) {
|
|
4956
|
-
refs.set("closeTimerStartTime", Date.now());
|
|
4957
|
-
context2.set("remainingTime", getToastDuration(prop("duration"), prop("type")));
|
|
4958
|
-
},
|
|
4959
|
-
syncRemainingTime({ context: context2, refs }) {
|
|
4960
|
-
context2.set("remainingTime", (prev) => {
|
|
4961
|
-
const closeTimerStartTime = refs.get("closeTimerStartTime");
|
|
4962
|
-
const elapsedTime = Date.now() - closeTimerStartTime;
|
|
4963
|
-
refs.set("lastCloseStartTimerStartTime", Date.now());
|
|
4964
|
-
return prev - elapsedTime;
|
|
4965
|
-
});
|
|
4966
|
-
},
|
|
4967
|
-
notifyParentToRemove({ prop }) {
|
|
4968
|
-
const parent = prop("parent");
|
|
4969
|
-
parent.send({ type: "TOAST.REMOVE", id: prop("id") });
|
|
4970
|
-
},
|
|
4971
|
-
invokeOnDismiss({ prop, event }) {
|
|
4972
|
-
var _a;
|
|
4973
|
-
(_a = prop("onStatusChange")) == null ? void 0 : _a({ status: "dismissing", src: event.src });
|
|
4974
|
-
},
|
|
4975
|
-
invokeOnUnmount({ prop }) {
|
|
4976
|
-
var _a;
|
|
4977
|
-
(_a = prop("onStatusChange")) == null ? void 0 : _a({ status: "unmounted" });
|
|
4978
|
-
},
|
|
4979
|
-
invokeOnVisible({ prop }) {
|
|
4980
|
-
var _a;
|
|
4981
|
-
(_a = prop("onStatusChange")) == null ? void 0 : _a({ status: "visible" });
|
|
4982
|
-
}
|
|
4983
|
-
}
|
|
4984
|
-
}
|
|
4985
|
-
});
|
|
4986
|
-
function setHeight(parent, item) {
|
|
4987
|
-
const { id: id2, height } = item;
|
|
4988
|
-
parent.context.set("heights", (prev) => {
|
|
4989
|
-
const alreadyExists = prev.find((i) => i.id === id2);
|
|
4990
|
-
if (!alreadyExists) {
|
|
4991
|
-
return [{ id: id2, height }, ...prev];
|
|
4992
|
-
} else {
|
|
4993
|
-
return prev.map((i) => i.id === id2 ? { ...i, height } : i);
|
|
4994
|
-
}
|
|
4995
|
-
});
|
|
4996
|
-
}
|
|
4997
|
-
var withDefaults = (options, defaults2) => {
|
|
4998
|
-
return { ...defaults2, ...options };
|
|
4999
|
-
};
|
|
5000
|
-
function createToastStore(props) {
|
|
5001
|
-
const attrs = withDefaults(props, {
|
|
5002
|
-
placement: "bottom",
|
|
5003
|
-
overlap: false,
|
|
5004
|
-
max: 24,
|
|
5005
|
-
gap: 16,
|
|
5006
|
-
offsets: "1rem",
|
|
5007
|
-
hotkey: ["altKey", "KeyT"],
|
|
5008
|
-
removeDelay: 200,
|
|
5009
|
-
pauseOnPageIdle: true
|
|
5010
|
-
});
|
|
5011
|
-
let subscribers = [];
|
|
5012
|
-
let toasts = [];
|
|
5013
|
-
let dismissedToasts = /* @__PURE__ */ new Set();
|
|
5014
|
-
const subscribe2 = (subscriber) => {
|
|
5015
|
-
subscribers.push(subscriber);
|
|
5016
|
-
return () => {
|
|
5017
|
-
const index2 = subscribers.indexOf(subscriber);
|
|
5018
|
-
subscribers.splice(index2, 1);
|
|
5019
|
-
};
|
|
5020
|
-
};
|
|
5021
|
-
const publish = (data) => {
|
|
5022
|
-
subscribers.forEach((subscriber) => subscriber(data));
|
|
5023
|
-
return data;
|
|
5024
|
-
};
|
|
5025
|
-
const addToast = (data) => {
|
|
5026
|
-
if (toasts.length >= attrs.max) return;
|
|
5027
|
-
publish(data);
|
|
5028
|
-
toasts.unshift(data);
|
|
5029
|
-
};
|
|
5030
|
-
const create = (data) => {
|
|
5031
|
-
const id2 = data.id ?? `toast:${uuid()}`;
|
|
5032
|
-
const exists = toasts.find((toast2) => toast2.id === id2);
|
|
5033
|
-
if (dismissedToasts.has(id2)) dismissedToasts.delete(id2);
|
|
5034
|
-
if (exists) {
|
|
5035
|
-
toasts = toasts.map((toast2) => {
|
|
5036
|
-
if (toast2.id === id2) {
|
|
5037
|
-
return publish({ ...toast2, ...data, id: id2 });
|
|
5038
|
-
}
|
|
5039
|
-
return toast2;
|
|
5040
|
-
});
|
|
5041
|
-
} else {
|
|
5042
|
-
addToast({
|
|
5043
|
-
id: id2,
|
|
5044
|
-
duration: attrs.duration,
|
|
5045
|
-
removeDelay: attrs.removeDelay,
|
|
5046
|
-
type: "info",
|
|
5047
|
-
...data,
|
|
5048
|
-
stacked: !attrs.overlap,
|
|
5049
|
-
gap: attrs.gap
|
|
5050
|
-
});
|
|
5051
|
-
}
|
|
5052
|
-
return id2;
|
|
5053
|
-
};
|
|
5054
|
-
const remove = (id2) => {
|
|
5055
|
-
dismissedToasts.add(id2);
|
|
5056
|
-
if (!id2) {
|
|
5057
|
-
toasts.forEach((toast2) => {
|
|
5058
|
-
subscribers.forEach((subscriber) => subscriber({ id: toast2.id, dismiss: true }));
|
|
5059
|
-
});
|
|
5060
|
-
toasts = [];
|
|
5061
|
-
} else {
|
|
5062
|
-
subscribers.forEach((subscriber) => subscriber({ id: id2, dismiss: true }));
|
|
5063
|
-
toasts = toasts.filter((toast2) => toast2.id !== id2);
|
|
5064
|
-
}
|
|
5065
|
-
return id2;
|
|
5066
|
-
};
|
|
5067
|
-
const error = (data) => {
|
|
5068
|
-
return create({ ...data, type: "error" });
|
|
5069
|
-
};
|
|
5070
|
-
const success = (data) => {
|
|
5071
|
-
return create({ ...data, type: "success" });
|
|
5072
|
-
};
|
|
5073
|
-
const info = (data) => {
|
|
5074
|
-
return create({ ...data, type: "info" });
|
|
5075
|
-
};
|
|
5076
|
-
const warning2 = (data) => {
|
|
5077
|
-
return create({ ...data, type: "warning" });
|
|
5078
|
-
};
|
|
5079
|
-
const loading = (data) => {
|
|
5080
|
-
return create({ ...data, type: "loading" });
|
|
5081
|
-
};
|
|
5082
|
-
const getVisibleToasts = () => {
|
|
5083
|
-
return toasts.filter((toast2) => !dismissedToasts.has(toast2.id));
|
|
5084
|
-
};
|
|
5085
|
-
const getCount = () => {
|
|
5086
|
-
return toasts.length;
|
|
5087
|
-
};
|
|
5088
|
-
const promise = (promise2, options, shared = {}) => {
|
|
5089
|
-
if (!options) return;
|
|
5090
|
-
let id2 = void 0;
|
|
5091
|
-
if (options.loading !== void 0) {
|
|
5092
|
-
id2 = create({
|
|
5093
|
-
...shared,
|
|
5094
|
-
...options.loading,
|
|
5095
|
-
promise: promise2,
|
|
5096
|
-
type: "loading"
|
|
5097
|
-
});
|
|
5098
|
-
}
|
|
5099
|
-
let removable = id2 !== void 0;
|
|
5100
|
-
let result;
|
|
5101
|
-
const prom = runIfFn(promise2).then(async (response) => {
|
|
5102
|
-
result = ["resolve", response];
|
|
5103
|
-
if (isHttpResponse(response) && !response.ok) {
|
|
5104
|
-
removable = false;
|
|
5105
|
-
const errorOptions = runIfFn(options.error, `HTTP Error! status: ${response.status}`);
|
|
5106
|
-
create({ ...shared, ...errorOptions, id: id2, type: "error" });
|
|
5107
|
-
} else if (options.success !== void 0) {
|
|
5108
|
-
removable = false;
|
|
5109
|
-
const successOptions = runIfFn(options.success, response);
|
|
5110
|
-
create({ ...shared, ...successOptions, id: id2, type: "success" });
|
|
5111
|
-
}
|
|
5112
|
-
}).catch(async (error2) => {
|
|
5113
|
-
result = ["reject", error2];
|
|
5114
|
-
if (options.error !== void 0) {
|
|
5115
|
-
removable = false;
|
|
5116
|
-
const errorOptions = runIfFn(options.error, error2);
|
|
5117
|
-
create({ ...shared, ...errorOptions, id: id2, type: "error" });
|
|
5118
|
-
}
|
|
5119
|
-
}).finally(() => {
|
|
5120
|
-
var _a;
|
|
5121
|
-
if (removable) {
|
|
5122
|
-
remove(id2);
|
|
5123
|
-
id2 = void 0;
|
|
5124
|
-
}
|
|
5125
|
-
(_a = options.finally) == null ? void 0 : _a.call(options);
|
|
5126
|
-
});
|
|
5127
|
-
const unwrap = () => new Promise(
|
|
5128
|
-
(resolve, reject) => prom.then(() => result[0] === "reject" ? reject(result[1]) : resolve(result[1])).catch(reject)
|
|
5129
|
-
);
|
|
5130
|
-
return { id: id2, unwrap };
|
|
5131
|
-
};
|
|
5132
|
-
const update = (id2, data) => {
|
|
5133
|
-
return create({ id: id2, ...data });
|
|
5134
|
-
};
|
|
5135
|
-
const pause = (id2) => {
|
|
5136
|
-
if (id2 != null) {
|
|
5137
|
-
toasts = toasts.map((toast2) => {
|
|
5138
|
-
if (toast2.id === id2) return publish({ ...toast2, message: "PAUSE" });
|
|
5139
|
-
return toast2;
|
|
5140
|
-
});
|
|
5141
|
-
} else {
|
|
5142
|
-
toasts = toasts.map((toast2) => publish({ ...toast2, message: "PAUSE" }));
|
|
5143
|
-
}
|
|
5144
|
-
};
|
|
5145
|
-
const resume = (id2) => {
|
|
5146
|
-
if (id2 != null) {
|
|
5147
|
-
toasts = toasts.map((toast2) => {
|
|
5148
|
-
if (toast2.id === id2) return publish({ ...toast2, message: "RESUME" });
|
|
5149
|
-
return toast2;
|
|
5150
|
-
});
|
|
5151
|
-
} else {
|
|
5152
|
-
toasts = toasts.map((toast2) => publish({ ...toast2, message: "RESUME" }));
|
|
5153
|
-
}
|
|
5154
|
-
};
|
|
5155
|
-
const dismiss = (id2) => {
|
|
5156
|
-
if (id2 != null) {
|
|
5157
|
-
toasts = toasts.map((toast2) => {
|
|
5158
|
-
if (toast2.id === id2) return publish({ ...toast2, message: "DISMISS" });
|
|
5159
|
-
return toast2;
|
|
5160
|
-
});
|
|
5161
|
-
} else {
|
|
5162
|
-
toasts = toasts.map((toast2) => publish({ ...toast2, message: "DISMISS" }));
|
|
5163
|
-
}
|
|
5164
|
-
};
|
|
5165
|
-
const isVisible = (id2) => {
|
|
5166
|
-
return !dismissedToasts.has(id2) && !!toasts.find((toast2) => toast2.id === id2);
|
|
5167
|
-
};
|
|
5168
|
-
const isDismissed = (id2) => {
|
|
5169
|
-
return dismissedToasts.has(id2);
|
|
5170
|
-
};
|
|
5171
|
-
const expand = () => {
|
|
5172
|
-
toasts = toasts.map((toast2) => publish({ ...toast2, stacked: true }));
|
|
5173
|
-
};
|
|
5174
|
-
const collapse = () => {
|
|
5175
|
-
toasts = toasts.map((toast2) => publish({ ...toast2, stacked: false }));
|
|
5176
|
-
};
|
|
5177
|
-
return {
|
|
5178
|
-
attrs,
|
|
5179
|
-
subscribe: subscribe2,
|
|
5180
|
-
create,
|
|
5181
|
-
update,
|
|
5182
|
-
remove,
|
|
5183
|
-
dismiss,
|
|
5184
|
-
error,
|
|
5185
|
-
success,
|
|
5186
|
-
info,
|
|
5187
|
-
warning: warning2,
|
|
5188
|
-
loading,
|
|
5189
|
-
getVisibleToasts,
|
|
5190
|
-
getCount,
|
|
5191
|
-
promise,
|
|
5192
|
-
pause,
|
|
5193
|
-
resume,
|
|
5194
|
-
isVisible,
|
|
5195
|
-
isDismissed,
|
|
5196
|
-
expand,
|
|
5197
|
-
collapse
|
|
5198
|
-
};
|
|
5199
|
-
}
|
|
5200
|
-
var isHttpResponse = (data) => {
|
|
5201
|
-
return data && typeof data === "object" && "ok" in data && typeof data.ok === "boolean" && "status" in data && typeof data.status === "number";
|
|
5202
|
-
};
|
|
5203
|
-
var group = {
|
|
5204
|
-
connect: groupConnect,
|
|
5205
|
-
machine: groupMachine
|
|
5206
|
-
};
|
|
5207
|
-
const createToaster = (props) => {
|
|
5208
|
-
return createToastStore(props);
|
|
5209
|
-
};
|
|
5210
|
-
const [ToastProvider$1, useToastContext] = createContext({
|
|
5211
|
-
name: "ToastContext",
|
|
5212
|
-
hookName: "useToastContext",
|
|
5213
|
-
providerName: "<ToastProvider />"
|
|
5214
|
-
});
|
|
5215
|
-
const ToastActionTrigger = React.forwardRef((props, ref) => {
|
|
5216
|
-
const toast2 = useToastContext();
|
|
5217
|
-
const mergedProps = mergeProps(toast2.getActionTriggerProps(), props);
|
|
5218
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ark.button, { ...mergedProps, ref });
|
|
5219
|
-
});
|
|
5220
|
-
ToastActionTrigger.displayName = "ToastActionTrigger";
|
|
5221
|
-
const ToastDescription = React.forwardRef((props, ref) => {
|
|
5222
|
-
const toast2 = useToastContext();
|
|
5223
|
-
const mergedProps = mergeProps(toast2.getDescriptionProps(), props);
|
|
5224
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ark.div, { ...mergedProps, ref });
|
|
5225
|
-
});
|
|
5226
|
-
ToastDescription.displayName = "ToastDescription";
|
|
5227
|
-
const ToastRoot = React.forwardRef((props, ref) => {
|
|
5228
|
-
const toast2 = useToastContext();
|
|
5229
|
-
const mergedProps = mergeProps(toast2.getRootProps(), props);
|
|
5230
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...mergedProps, ref, children: [
|
|
5231
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { ...toast2.getGhostBeforeProps() }),
|
|
5232
|
-
props.children,
|
|
5233
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { ...toast2.getGhostAfterProps() })
|
|
5234
|
-
] });
|
|
5235
|
-
});
|
|
5236
|
-
ToastRoot.displayName = "ToastRoot";
|
|
5237
|
-
const Toaster = React.forwardRef((props, ref) => {
|
|
5238
|
-
const { toaster, children, ...localProps } = props;
|
|
5239
|
-
const locale = useLocaleContext();
|
|
5240
|
-
const env = useEnvironmentContext();
|
|
5241
|
-
const service = useMachine(group.machine, {
|
|
5242
|
-
store: toaster,
|
|
5243
|
-
id: React.useId(),
|
|
5244
|
-
dir: locale == null ? void 0 : locale.dir,
|
|
5245
|
-
getRootNode: () => env == null ? void 0 : env.getDocument()
|
|
5246
|
-
});
|
|
5247
|
-
const api = group.connect(service, normalizeProps);
|
|
5248
|
-
const mergedProps = mergeProps(api.getGroupProps(), localProps);
|
|
5249
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ark.div, { ...mergedProps, ref, children: api.getToasts().map((toast2, index2) => /* @__PURE__ */ jsxRuntime.jsx(ToastActor, { value: toast2, parent: service, index: index2, children: (ctx) => children(ctx) }, toast2.id)) });
|
|
5250
|
-
});
|
|
5251
|
-
Toaster.displayName = "Toaster";
|
|
5252
|
-
const ToastActor = (props) => {
|
|
5253
|
-
const localProps = {
|
|
5254
|
-
...props.value,
|
|
5255
|
-
parent: props.parent,
|
|
5256
|
-
index: props.index
|
|
5257
|
-
};
|
|
5258
|
-
const service = useMachine(machine, { ...localProps });
|
|
5259
|
-
const api = connect(service, normalizeProps);
|
|
5260
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ToastProvider$1, { value: api, children: props.children(props.value) });
|
|
5261
|
-
};
|
|
5262
|
-
ToastActor.displayName = "ToastActor";
|
|
5263
|
-
const spinnerRecipe = cva({
|
|
5264
|
-
base: {
|
|
5265
|
-
display: "inline-block",
|
|
5266
|
-
borderWidth: "md",
|
|
5267
|
-
borderStyle: "solid",
|
|
5268
|
-
borderStartEndRadius: "full",
|
|
5269
|
-
borderEndStartRadius: "full",
|
|
5270
|
-
borderRadius: "full",
|
|
5271
|
-
animation: "spin",
|
|
5272
|
-
animationDuration: "slowest"
|
|
5273
|
-
},
|
|
5274
|
-
defaultVariants: {
|
|
5275
|
-
size: "md"
|
|
5276
|
-
},
|
|
5277
|
-
variants: {
|
|
5278
|
-
size: {
|
|
5279
|
-
sm: { width: 4, height: 4 },
|
|
5280
|
-
md: { width: 6, height: 6 },
|
|
5281
|
-
lg: { width: 12, height: 12 },
|
|
5282
|
-
xl: { width: 24, height: 24 }
|
|
5283
|
-
}
|
|
5284
|
-
}
|
|
5285
|
-
});
|
|
5286
|
-
const Spinner = React.forwardRef((props, ref) => {
|
|
5287
|
-
const StyledSpinner = styled(ark.div, spinnerRecipe);
|
|
5288
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5289
|
-
StyledSpinner,
|
|
5290
|
-
{
|
|
5291
|
-
ref,
|
|
5292
|
-
...props,
|
|
5293
|
-
css: {
|
|
5294
|
-
borderColor: "inherit",
|
|
5295
|
-
borderBottomColor: "transparent",
|
|
5296
|
-
borderLeftColor: "transparent",
|
|
5297
|
-
...props.css
|
|
5298
|
-
}
|
|
5299
|
-
}
|
|
5300
|
-
);
|
|
5301
|
-
});
|
|
5302
|
-
Spinner.displayName = "Spinner";
|
|
5303
|
-
const buttonRecipe = cva({
|
|
5304
|
-
base: {
|
|
5305
|
-
alignItems: "center",
|
|
5306
|
-
appearance: "none",
|
|
5307
|
-
cursor: "pointer",
|
|
5308
|
-
display: "inline-flex",
|
|
5309
|
-
fontWeight: "semibold",
|
|
5310
|
-
isolation: "isolate",
|
|
5311
|
-
minWidth: "0",
|
|
5312
|
-
justifyContent: "center",
|
|
5313
|
-
outline: "none",
|
|
5314
|
-
position: "relative",
|
|
5315
|
-
transitionDuration: "normal",
|
|
5316
|
-
transitionProperty: "background, border-color, color, box-shadow",
|
|
5317
|
-
transitionTimingFunction: "default",
|
|
5318
|
-
userSelect: "none",
|
|
5319
|
-
verticalAlign: "middle",
|
|
5320
|
-
whiteSpace: "nowrap",
|
|
5321
|
-
_hidden: {
|
|
5322
|
-
display: "none"
|
|
5323
|
-
}
|
|
5324
|
-
},
|
|
5325
|
-
defaultVariants: {
|
|
5326
|
-
variant: "solid",
|
|
5327
|
-
size: "md",
|
|
5328
|
-
radius: "full",
|
|
5329
|
-
color: "neutral"
|
|
5330
|
-
},
|
|
5331
|
-
variants: {
|
|
5332
|
-
variant: {
|
|
5333
|
-
solid: {
|
|
5334
|
-
_disabled: {
|
|
5335
|
-
background: "background.neutral.disabled",
|
|
5336
|
-
color: "content.neutral.disabled",
|
|
5337
|
-
cursor: "not-allowed",
|
|
5338
|
-
pointerEvents: "none"
|
|
5339
|
-
}
|
|
5340
|
-
},
|
|
5341
|
-
outline: {
|
|
5342
|
-
background: "transparent",
|
|
5343
|
-
borderWidth: "1px",
|
|
5344
|
-
borderStyle: "solid",
|
|
5345
|
-
borderColor: "border.neutral.default",
|
|
5346
|
-
_disabled: {
|
|
5347
|
-
background: "transparent",
|
|
5348
|
-
color: "content.neutral.disabled",
|
|
5349
|
-
borderColor: "border.neutral.disabled",
|
|
5350
|
-
cursor: "not-allowed",
|
|
5351
|
-
pointerEvents: "none"
|
|
5352
|
-
}
|
|
5353
|
-
},
|
|
5354
|
-
light: {
|
|
5355
|
-
background: "transparent",
|
|
5356
|
-
_disabled: {
|
|
5357
|
-
background: "transparent",
|
|
5358
|
-
color: "content.neutral.disabled",
|
|
5359
|
-
cursor: "not-allowed",
|
|
5360
|
-
pointerEvents: "none"
|
|
5361
|
-
}
|
|
4217
|
+
light: {
|
|
4218
|
+
background: "transparent",
|
|
4219
|
+
_disabled: {
|
|
4220
|
+
background: "transparent",
|
|
4221
|
+
color: "content.neutral.disabled",
|
|
4222
|
+
cursor: "not-allowed",
|
|
4223
|
+
pointerEvents: "none"
|
|
4224
|
+
}
|
|
5362
4225
|
}
|
|
5363
4226
|
},
|
|
5364
4227
|
color: {
|
|
@@ -5876,7 +4739,7 @@ const createStyleContext = (recipe) => {
|
|
|
5876
4739
|
};
|
|
5877
4740
|
return StyledComponent;
|
|
5878
4741
|
};
|
|
5879
|
-
const
|
|
4742
|
+
const withProvider = (Component, slot, options) => {
|
|
5880
4743
|
const StyledComponent = styled(
|
|
5881
4744
|
Component,
|
|
5882
4745
|
{},
|
|
@@ -5903,13 +4766,13 @@ const createStyleContext = (recipe) => {
|
|
|
5903
4766
|
};
|
|
5904
4767
|
return {
|
|
5905
4768
|
withRootProvider: withRootProvider2,
|
|
5906
|
-
withProvider
|
|
4769
|
+
withProvider,
|
|
5907
4770
|
withContext: withContext2
|
|
5908
4771
|
};
|
|
5909
4772
|
};
|
|
5910
4773
|
const dialogRecipe = sva({
|
|
5911
4774
|
className: "dialog",
|
|
5912
|
-
slots: [...anatomy$
|
|
4775
|
+
slots: [...anatomy$1.keys(), "header", "footer", "body"],
|
|
5913
4776
|
base: {
|
|
5914
4777
|
backdrop: {
|
|
5915
4778
|
backdropFilter: "blur(3px)",
|
|
@@ -5938,7 +4801,7 @@ const dialogRecipe = sva({
|
|
|
5938
4801
|
top: "0",
|
|
5939
4802
|
width: "100vw",
|
|
5940
4803
|
height: "100vh",
|
|
5941
|
-
zIndex: "
|
|
4804
|
+
zIndex: "popover",
|
|
5942
4805
|
p: "4"
|
|
5943
4806
|
},
|
|
5944
4807
|
content: {
|
|
@@ -5992,16 +4855,16 @@ const dialogRecipe = sva({
|
|
|
5992
4855
|
}
|
|
5993
4856
|
}
|
|
5994
4857
|
});
|
|
5995
|
-
const { withRootProvider: withRootProvider$2, withContext: withContext$
|
|
4858
|
+
const { withRootProvider: withRootProvider$2, withContext: withContext$2 } = createStyleContext(dialogRecipe);
|
|
5996
4859
|
const Root$3 = withRootProvider$2(DialogRoot);
|
|
5997
|
-
const Backdrop$1 = withContext$
|
|
5998
|
-
const Trigger$2 = withContext$
|
|
5999
|
-
const Content$3 = withContext$
|
|
6000
|
-
const Title = withContext$
|
|
6001
|
-
const Description$1 = withContext$
|
|
6002
|
-
const Positioner = withContext$
|
|
6003
|
-
const Header$1 = withContext$
|
|
6004
|
-
const Footer = withContext$
|
|
4860
|
+
const Backdrop$1 = withContext$2(DialogBackdrop, "backdrop");
|
|
4861
|
+
const Trigger$2 = withContext$2(DialogTrigger, "trigger");
|
|
4862
|
+
const Content$3 = withContext$2(DialogContent, "content");
|
|
4863
|
+
const Title = withContext$2(DialogTitle, "title");
|
|
4864
|
+
const Description$1 = withContext$2(DialogDescription, "description");
|
|
4865
|
+
const Positioner = withContext$2(DialogPositioner, "positioner");
|
|
4866
|
+
const Header$1 = withContext$2(ark.header, "header");
|
|
4867
|
+
const Footer = withContext$2(
|
|
6005
4868
|
({ orientation = "horizontal", className, ...props }) => {
|
|
6006
4869
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6007
4870
|
ark.footer,
|
|
@@ -6019,8 +4882,8 @@ const Footer = withContext$3(
|
|
|
6019
4882
|
},
|
|
6020
4883
|
"footer"
|
|
6021
4884
|
);
|
|
6022
|
-
const Body = withContext$
|
|
6023
|
-
const CloseTrigger = withContext$
|
|
4885
|
+
const Body = withContext$2(ark.main, "body");
|
|
4886
|
+
const CloseTrigger = withContext$2(DialogCloseTrigger, "closeTrigger");
|
|
6024
4887
|
const Dialog = {
|
|
6025
4888
|
Root: Root$3,
|
|
6026
4889
|
Backdrop: Backdrop$1,
|
|
@@ -6234,7 +5097,7 @@ const isBrowser = typeof window !== "undefined";
|
|
|
6234
5097
|
const useIsomorphicLayoutEffect$1 = isBrowser ? React.useLayoutEffect : React.useEffect;
|
|
6235
5098
|
const PresenceContext = /* @__PURE__ */ React.createContext(null);
|
|
6236
5099
|
const MotionConfigContext = React.createContext({
|
|
6237
|
-
transformPagePoint: (
|
|
5100
|
+
transformPagePoint: (p2) => p2,
|
|
6238
5101
|
isStatic: false,
|
|
6239
5102
|
reducedMotion: "never"
|
|
6240
5103
|
});
|
|
@@ -6277,7 +5140,7 @@ function PopChild({ children, isPresent, anchorX }) {
|
|
|
6277
5140
|
const { width, height, top, left, right } = size.current;
|
|
6278
5141
|
if (isPresent || !ref.current || !width || !height)
|
|
6279
5142
|
return;
|
|
6280
|
-
const
|
|
5143
|
+
const x2 = anchorX === "left" ? `left: ${left}` : `right: ${right}`;
|
|
6281
5144
|
ref.current.dataset.motionPopId = id2;
|
|
6282
5145
|
const style = document.createElement("style");
|
|
6283
5146
|
if (nonce)
|
|
@@ -6289,7 +5152,7 @@ function PopChild({ children, isPresent, anchorX }) {
|
|
|
6289
5152
|
position: absolute !important;
|
|
6290
5153
|
width: ${width}px !important;
|
|
6291
5154
|
height: ${height}px !important;
|
|
6292
|
-
${
|
|
5155
|
+
${x2}px !important;
|
|
6293
5156
|
top: ${top}px !important;
|
|
6294
5157
|
}
|
|
6295
5158
|
`);
|
|
@@ -6331,7 +5194,7 @@ const PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, p
|
|
|
6331
5194
|
presenceAffectsLayout ? [Math.random(), memoizedOnExitComplete] : [isPresent, memoizedOnExitComplete]
|
|
6332
5195
|
);
|
|
6333
5196
|
React.useMemo(() => {
|
|
6334
|
-
presenceChildren.forEach((
|
|
5197
|
+
presenceChildren.forEach((_2, key) => presenceChildren.set(key, false));
|
|
6335
5198
|
}, [isPresent]);
|
|
6336
5199
|
React__namespace.useEffect(() => {
|
|
6337
5200
|
!isPresent && !presenceChildren.size && onExitComplete && onExitComplete();
|
|
@@ -6379,8 +5242,8 @@ const AnimatePresence = ({ children, custom, initial = true, onExitComplete, pre
|
|
|
6379
5242
|
useIsomorphicLayoutEffect$1(() => {
|
|
6380
5243
|
isInitialRender.current = false;
|
|
6381
5244
|
pendingPresentChildren.current = presentChildren;
|
|
6382
|
-
for (let
|
|
6383
|
-
const key = getChildKey(renderedChildren[
|
|
5245
|
+
for (let i2 = 0; i2 < renderedChildren.length; i2++) {
|
|
5246
|
+
const key = getChildKey(renderedChildren[i2]);
|
|
6384
5247
|
if (!presentKeys.includes(key)) {
|
|
6385
5248
|
if (exitComplete.get(key) !== true) {
|
|
6386
5249
|
exitComplete.set(key, false);
|
|
@@ -6393,11 +5256,11 @@ const AnimatePresence = ({ children, custom, initial = true, onExitComplete, pre
|
|
|
6393
5256
|
const exitingChildren = [];
|
|
6394
5257
|
if (presentChildren !== diffedChildren) {
|
|
6395
5258
|
let nextChildren = [...presentChildren];
|
|
6396
|
-
for (let
|
|
6397
|
-
const child = renderedChildren[
|
|
5259
|
+
for (let i2 = 0; i2 < renderedChildren.length; i2++) {
|
|
5260
|
+
const child = renderedChildren[i2];
|
|
6398
5261
|
const key = getChildKey(child);
|
|
6399
5262
|
if (!presentKeys.includes(key)) {
|
|
6400
|
-
nextChildren.splice(
|
|
5263
|
+
nextChildren.splice(i2, 0, child);
|
|
6401
5264
|
exitingChildren.push(child);
|
|
6402
5265
|
}
|
|
6403
5266
|
}
|
|
@@ -6582,8 +5445,8 @@ function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
|
|
|
6582
5445
|
return acc;
|
|
6583
5446
|
}, {});
|
|
6584
5447
|
const cancel = (process2) => {
|
|
6585
|
-
for (let
|
|
6586
|
-
steps[stepsOrder[
|
|
5448
|
+
for (let i2 = 0; i2 < stepsOrder.length; i2++) {
|
|
5449
|
+
steps[stepsOrder[i2]].cancel(process2);
|
|
6587
5450
|
}
|
|
6588
5451
|
};
|
|
6589
5452
|
return { schedule, cancel, state, steps };
|
|
@@ -7091,8 +5954,8 @@ const numTransforms = transformPropOrder.length;
|
|
|
7091
5954
|
function buildTransform(latestValues, transform2, transformTemplate) {
|
|
7092
5955
|
let transformString = "";
|
|
7093
5956
|
let transformIsDefault = true;
|
|
7094
|
-
for (let
|
|
7095
|
-
const key = transformPropOrder[
|
|
5957
|
+
for (let i2 = 0; i2 < numTransforms; i2++) {
|
|
5958
|
+
const key = transformPropOrder[i2];
|
|
7096
5959
|
const value = latestValues[key];
|
|
7097
5960
|
if (value === void 0)
|
|
7098
5961
|
continue;
|
|
@@ -7421,8 +6284,8 @@ function makeLatestValues(props, context2, presenceContext, scrapeMotionValues)
|
|
|
7421
6284
|
const variantToSet = isInitialAnimationBlocked ? animate2 : initial;
|
|
7422
6285
|
if (variantToSet && typeof variantToSet !== "boolean" && !isAnimationControls(variantToSet)) {
|
|
7423
6286
|
const list = Array.isArray(variantToSet) ? variantToSet : [variantToSet];
|
|
7424
|
-
for (let
|
|
7425
|
-
const resolved = resolveVariantFromProps(props, list[
|
|
6287
|
+
for (let i2 = 0; i2 < list.length; i2++) {
|
|
6288
|
+
const resolved = resolveVariantFromProps(props, list[i2]);
|
|
7426
6289
|
if (resolved) {
|
|
7427
6290
|
const { transitionEnd, transition, ...target } = resolved;
|
|
7428
6291
|
for (const key in target) {
|
|
@@ -7463,7 +6326,7 @@ const htmlMotionConfig = {
|
|
|
7463
6326
|
function updateSVGDimensions(instance, renderState) {
|
|
7464
6327
|
try {
|
|
7465
6328
|
renderState.dimensions = typeof instance.getBBox === "function" ? instance.getBBox() : instance.getBoundingClientRect();
|
|
7466
|
-
} catch (
|
|
6329
|
+
} catch (e2) {
|
|
7467
6330
|
renderState.dimensions = {
|
|
7468
6331
|
x: 0,
|
|
7469
6332
|
y: 0,
|
|
@@ -7540,8 +6403,8 @@ const svgMotionConfig = {
|
|
|
7540
6403
|
return;
|
|
7541
6404
|
let needsMeasure = !prevProps;
|
|
7542
6405
|
if (prevProps) {
|
|
7543
|
-
for (let
|
|
7544
|
-
const key = layoutProps[
|
|
6406
|
+
for (let i2 = 0; i2 < layoutProps.length; i2++) {
|
|
6407
|
+
const key = layoutProps[i2];
|
|
7545
6408
|
if (props[key] !== prevProps[key]) {
|
|
7546
6409
|
needsMeasure = true;
|
|
7547
6410
|
}
|
|
@@ -7605,16 +6468,16 @@ class SubscriptionManager {
|
|
|
7605
6468
|
addUniqueItem(this.subscriptions, handler);
|
|
7606
6469
|
return () => removeItem(this.subscriptions, handler);
|
|
7607
6470
|
}
|
|
7608
|
-
notify(
|
|
6471
|
+
notify(a2, b2, c2) {
|
|
7609
6472
|
const numSubscriptions = this.subscriptions.length;
|
|
7610
6473
|
if (!numSubscriptions)
|
|
7611
6474
|
return;
|
|
7612
6475
|
if (numSubscriptions === 1) {
|
|
7613
|
-
this.subscriptions[0](
|
|
6476
|
+
this.subscriptions[0](a2, b2, c2);
|
|
7614
6477
|
} else {
|
|
7615
|
-
for (let
|
|
7616
|
-
const handler = this.subscriptions[
|
|
7617
|
-
handler && handler(
|
|
6478
|
+
for (let i2 = 0; i2 < numSubscriptions; i2++) {
|
|
6479
|
+
const handler = this.subscriptions[i2];
|
|
6480
|
+
handler && handler(a2, b2, c2);
|
|
7618
6481
|
}
|
|
7619
6482
|
}
|
|
7620
6483
|
}
|
|
@@ -7965,8 +6828,8 @@ class GroupAnimation {
|
|
|
7965
6828
|
return this.animations[0][propName];
|
|
7966
6829
|
}
|
|
7967
6830
|
setAll(propName, newValue) {
|
|
7968
|
-
for (let
|
|
7969
|
-
this.animations[
|
|
6831
|
+
for (let i2 = 0; i2 < this.animations.length; i2++) {
|
|
6832
|
+
this.animations[i2][propName] = newValue;
|
|
7970
6833
|
}
|
|
7971
6834
|
}
|
|
7972
6835
|
attachTimeline(timeline, fallback) {
|
|
@@ -7978,9 +6841,9 @@ class GroupAnimation {
|
|
|
7978
6841
|
}
|
|
7979
6842
|
});
|
|
7980
6843
|
return () => {
|
|
7981
|
-
subscriptions.forEach((cancel,
|
|
6844
|
+
subscriptions.forEach((cancel, i2) => {
|
|
7982
6845
|
cancel && cancel();
|
|
7983
|
-
this.animations[
|
|
6846
|
+
this.animations[i2].stop();
|
|
7984
6847
|
});
|
|
7985
6848
|
};
|
|
7986
6849
|
}
|
|
@@ -8001,8 +6864,8 @@ class GroupAnimation {
|
|
|
8001
6864
|
}
|
|
8002
6865
|
get duration() {
|
|
8003
6866
|
let max = 0;
|
|
8004
|
-
for (let
|
|
8005
|
-
max = Math.max(max, this.animations[
|
|
6867
|
+
for (let i2 = 0; i2 < this.animations.length; i2++) {
|
|
6868
|
+
max = Math.max(max, this.animations[i2].duration);
|
|
8006
6869
|
}
|
|
8007
6870
|
return max;
|
|
8008
6871
|
}
|
|
@@ -8040,7 +6903,7 @@ function memoSupports(callback, supportsFlag) {
|
|
|
8040
6903
|
const supportsLinearEasing = /* @__PURE__ */ memoSupports(() => {
|
|
8041
6904
|
try {
|
|
8042
6905
|
document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
|
|
8043
|
-
} catch (
|
|
6906
|
+
} catch (e2) {
|
|
8044
6907
|
return false;
|
|
8045
6908
|
}
|
|
8046
6909
|
return true;
|
|
@@ -8048,12 +6911,12 @@ const supportsLinearEasing = /* @__PURE__ */ memoSupports(() => {
|
|
|
8048
6911
|
const generateLinearEasing = (easing, duration, resolution = 10) => {
|
|
8049
6912
|
let points = "";
|
|
8050
6913
|
const numPoints = Math.max(Math.round(duration / resolution), 2);
|
|
8051
|
-
for (let
|
|
8052
|
-
points += easing(
|
|
6914
|
+
for (let i2 = 0; i2 < numPoints; i2++) {
|
|
6915
|
+
points += easing(i2 / (numPoints - 1)) + ", ";
|
|
8053
6916
|
}
|
|
8054
6917
|
return `linear(${points.substring(0, points.length - 2)})`;
|
|
8055
6918
|
};
|
|
8056
|
-
const cubicBezierAsString = ([
|
|
6919
|
+
const cubicBezierAsString = ([a2, b2, c2, d2]) => `cubic-bezier(${a2}, ${b2}, ${c2}, ${d2})`;
|
|
8057
6920
|
const supportedWaapiEasing = {
|
|
8058
6921
|
linear: "linear",
|
|
8059
6922
|
ease: "ease",
|
|
@@ -8108,37 +6971,37 @@ function attachTimeline(animation, timeline) {
|
|
|
8108
6971
|
animation.timeline = timeline;
|
|
8109
6972
|
animation.onfinish = null;
|
|
8110
6973
|
}
|
|
8111
|
-
const calcBezier = (
|
|
6974
|
+
const calcBezier = (t2, a1, a2) => (((1 - 3 * a2 + 3 * a1) * t2 + (3 * a2 - 6 * a1)) * t2 + 3 * a1) * t2;
|
|
8112
6975
|
const subdivisionPrecision = 1e-7;
|
|
8113
6976
|
const subdivisionMaxIterations = 12;
|
|
8114
|
-
function binarySubdivide(
|
|
6977
|
+
function binarySubdivide(x2, lowerBound, upperBound, mX1, mX2) {
|
|
8115
6978
|
let currentX;
|
|
8116
6979
|
let currentT;
|
|
8117
|
-
let
|
|
6980
|
+
let i2 = 0;
|
|
8118
6981
|
do {
|
|
8119
6982
|
currentT = lowerBound + (upperBound - lowerBound) / 2;
|
|
8120
|
-
currentX = calcBezier(currentT, mX1, mX2) -
|
|
6983
|
+
currentX = calcBezier(currentT, mX1, mX2) - x2;
|
|
8121
6984
|
if (currentX > 0) {
|
|
8122
6985
|
upperBound = currentT;
|
|
8123
6986
|
} else {
|
|
8124
6987
|
lowerBound = currentT;
|
|
8125
6988
|
}
|
|
8126
|
-
} while (Math.abs(currentX) > subdivisionPrecision && ++
|
|
6989
|
+
} while (Math.abs(currentX) > subdivisionPrecision && ++i2 < subdivisionMaxIterations);
|
|
8127
6990
|
return currentT;
|
|
8128
6991
|
}
|
|
8129
6992
|
function cubicBezier(mX1, mY1, mX2, mY2) {
|
|
8130
6993
|
if (mX1 === mY1 && mX2 === mY2)
|
|
8131
6994
|
return noop;
|
|
8132
6995
|
const getTForX = (aX) => binarySubdivide(aX, 0, 1, mX1, mX2);
|
|
8133
|
-
return (
|
|
6996
|
+
return (t2) => t2 === 0 || t2 === 1 ? t2 : calcBezier(getTForX(t2), mY1, mY2);
|
|
8134
6997
|
}
|
|
8135
|
-
const mirrorEasing = (easing) => (
|
|
8136
|
-
const reverseEasing = (easing) => (
|
|
6998
|
+
const mirrorEasing = (easing) => (p2) => p2 <= 0.5 ? easing(2 * p2) / 2 : (2 - easing(2 * (1 - p2))) / 2;
|
|
6999
|
+
const reverseEasing = (easing) => (p2) => 1 - easing(1 - p2);
|
|
8137
7000
|
const backOut = /* @__PURE__ */ cubicBezier(0.33, 1.53, 0.69, 0.99);
|
|
8138
7001
|
const backIn = /* @__PURE__ */ reverseEasing(backOut);
|
|
8139
7002
|
const backInOut = /* @__PURE__ */ mirrorEasing(backIn);
|
|
8140
|
-
const anticipate = (
|
|
8141
|
-
const circIn = (
|
|
7003
|
+
const anticipate = (p2) => (p2 *= 2) < 1 ? 0.5 * backIn(p2) : 0.5 * (2 - Math.pow(2, -10 * (p2 - 1)));
|
|
7004
|
+
const circIn = (p2) => 1 - Math.sin(Math.acos(p2));
|
|
8142
7005
|
const circOut = reverseEasing(circIn);
|
|
8143
7006
|
const circInOut = mirrorEasing(circIn);
|
|
8144
7007
|
const isZeroValueString = (v2) => /^0[^.\s]+$/u.test(v2);
|
|
@@ -8163,11 +7026,11 @@ const isColorString = (type, testProp) => (v2) => {
|
|
|
8163
7026
|
const splitColor = (aName, bName, cName) => (v2) => {
|
|
8164
7027
|
if (typeof v2 !== "string")
|
|
8165
7028
|
return v2;
|
|
8166
|
-
const [
|
|
7029
|
+
const [a2, b2, c2, alpha2] = v2.match(floatRegex);
|
|
8167
7030
|
return {
|
|
8168
|
-
[aName]: parseFloat(
|
|
8169
|
-
[bName]: parseFloat(
|
|
8170
|
-
[cName]: parseFloat(
|
|
7031
|
+
[aName]: parseFloat(a2),
|
|
7032
|
+
[bName]: parseFloat(b2),
|
|
7033
|
+
[cName]: parseFloat(c2),
|
|
8171
7034
|
alpha: alpha2 !== void 0 ? parseFloat(alpha2) : 1
|
|
8172
7035
|
};
|
|
8173
7036
|
};
|
|
@@ -8184,28 +7047,28 @@ const rgba = {
|
|
|
8184
7047
|
function parseHex(v2) {
|
|
8185
7048
|
let r = "";
|
|
8186
7049
|
let g2 = "";
|
|
8187
|
-
let
|
|
8188
|
-
let
|
|
7050
|
+
let b2 = "";
|
|
7051
|
+
let a2 = "";
|
|
8189
7052
|
if (v2.length > 5) {
|
|
8190
7053
|
r = v2.substring(1, 3);
|
|
8191
7054
|
g2 = v2.substring(3, 5);
|
|
8192
|
-
|
|
8193
|
-
|
|
7055
|
+
b2 = v2.substring(5, 7);
|
|
7056
|
+
a2 = v2.substring(7, 9);
|
|
8194
7057
|
} else {
|
|
8195
7058
|
r = v2.substring(1, 2);
|
|
8196
7059
|
g2 = v2.substring(2, 3);
|
|
8197
|
-
|
|
8198
|
-
|
|
7060
|
+
b2 = v2.substring(3, 4);
|
|
7061
|
+
a2 = v2.substring(4, 5);
|
|
8199
7062
|
r += r;
|
|
8200
7063
|
g2 += g2;
|
|
8201
|
-
|
|
8202
|
-
|
|
7064
|
+
b2 += b2;
|
|
7065
|
+
a2 += a2;
|
|
8203
7066
|
}
|
|
8204
7067
|
return {
|
|
8205
7068
|
red: parseInt(r, 16),
|
|
8206
7069
|
green: parseInt(g2, 16),
|
|
8207
|
-
blue: parseInt(
|
|
8208
|
-
alpha:
|
|
7070
|
+
blue: parseInt(b2, 16),
|
|
7071
|
+
alpha: a2 ? parseInt(a2, 16) / 255 : 1
|
|
8209
7072
|
};
|
|
8210
7073
|
}
|
|
8211
7074
|
const hex = {
|
|
@@ -8255,22 +7118,22 @@ function analyseComplexValue(value) {
|
|
|
8255
7118
|
var: []
|
|
8256
7119
|
};
|
|
8257
7120
|
const types = [];
|
|
8258
|
-
let
|
|
7121
|
+
let i2 = 0;
|
|
8259
7122
|
const tokenised = originalValue.replace(complexRegex, (parsedValue) => {
|
|
8260
7123
|
if (color.test(parsedValue)) {
|
|
8261
|
-
indexes.color.push(
|
|
7124
|
+
indexes.color.push(i2);
|
|
8262
7125
|
types.push(COLOR_TOKEN);
|
|
8263
7126
|
values.push(color.parse(parsedValue));
|
|
8264
7127
|
} else if (parsedValue.startsWith(VAR_FUNCTION_TOKEN)) {
|
|
8265
|
-
indexes.var.push(
|
|
7128
|
+
indexes.var.push(i2);
|
|
8266
7129
|
types.push(VAR_TOKEN);
|
|
8267
7130
|
values.push(parsedValue);
|
|
8268
7131
|
} else {
|
|
8269
|
-
indexes.number.push(
|
|
7132
|
+
indexes.number.push(i2);
|
|
8270
7133
|
types.push(NUMBER_TOKEN);
|
|
8271
7134
|
values.push(parseFloat(parsedValue));
|
|
8272
7135
|
}
|
|
8273
|
-
++
|
|
7136
|
+
++i2;
|
|
8274
7137
|
return SPLIT_TOKEN;
|
|
8275
7138
|
});
|
|
8276
7139
|
const split = tokenised.split(SPLIT_TOKEN);
|
|
@@ -8284,16 +7147,16 @@ function createTransformer(source) {
|
|
|
8284
7147
|
const numSections = split.length;
|
|
8285
7148
|
return (v2) => {
|
|
8286
7149
|
let output = "";
|
|
8287
|
-
for (let
|
|
8288
|
-
output += split[
|
|
8289
|
-
if (v2[
|
|
8290
|
-
const type = types[
|
|
7150
|
+
for (let i2 = 0; i2 < numSections; i2++) {
|
|
7151
|
+
output += split[i2];
|
|
7152
|
+
if (v2[i2] !== void 0) {
|
|
7153
|
+
const type = types[i2];
|
|
8291
7154
|
if (type === NUMBER_TOKEN) {
|
|
8292
|
-
output += sanitize(v2[
|
|
7155
|
+
output += sanitize(v2[i2]);
|
|
8293
7156
|
} else if (type === COLOR_TOKEN) {
|
|
8294
|
-
output += color.transform(v2[
|
|
7157
|
+
output += color.transform(v2[i2]);
|
|
8295
7158
|
} else {
|
|
8296
|
-
output += v2[
|
|
7159
|
+
output += v2[i2];
|
|
8297
7160
|
}
|
|
8298
7161
|
}
|
|
8299
7162
|
}
|
|
@@ -8360,14 +7223,14 @@ function getAnimatableNone(key, value) {
|
|
|
8360
7223
|
}
|
|
8361
7224
|
const invalidTemplates = /* @__PURE__ */ new Set(["auto", "none", "0"]);
|
|
8362
7225
|
function makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name) {
|
|
8363
|
-
let
|
|
7226
|
+
let i2 = 0;
|
|
8364
7227
|
let animatableTemplate = void 0;
|
|
8365
|
-
while (
|
|
8366
|
-
const keyframe = unresolvedKeyframes[
|
|
7228
|
+
while (i2 < unresolvedKeyframes.length && !animatableTemplate) {
|
|
7229
|
+
const keyframe = unresolvedKeyframes[i2];
|
|
8367
7230
|
if (typeof keyframe === "string" && !invalidTemplates.has(keyframe) && analyseComplexValue(keyframe).values.length) {
|
|
8368
|
-
animatableTemplate = unresolvedKeyframes[
|
|
7231
|
+
animatableTemplate = unresolvedKeyframes[i2];
|
|
8369
7232
|
}
|
|
8370
|
-
|
|
7233
|
+
i2++;
|
|
8371
7234
|
}
|
|
8372
7235
|
if (animatableTemplate && name) {
|
|
8373
7236
|
for (const noneIndex of noneKeyframeIndexes) {
|
|
@@ -8469,12 +7332,12 @@ function removeNonTranslationalTransform(visualElement) {
|
|
|
8469
7332
|
}
|
|
8470
7333
|
const positionalValues = {
|
|
8471
7334
|
// Dimensions
|
|
8472
|
-
width: ({ x }, { paddingLeft = "0", paddingRight = "0" }) =>
|
|
8473
|
-
height: ({ y }, { paddingTop = "0", paddingBottom = "0" }) =>
|
|
7335
|
+
width: ({ x: x2 }, { paddingLeft = "0", paddingRight = "0" }) => x2.max - x2.min - parseFloat(paddingLeft) - parseFloat(paddingRight),
|
|
7336
|
+
height: ({ y: y2 }, { paddingTop = "0", paddingBottom = "0" }) => y2.max - y2.min - parseFloat(paddingTop) - parseFloat(paddingBottom),
|
|
8474
7337
|
top: (_bbox, { top }) => parseFloat(top),
|
|
8475
7338
|
left: (_bbox, { left }) => parseFloat(left),
|
|
8476
|
-
bottom: ({ y }, { top }) => parseFloat(top) + (
|
|
8477
|
-
right: ({ x }, { left }) => parseFloat(left) + (
|
|
7339
|
+
bottom: ({ y: y2 }, { top }) => parseFloat(top) + (y2.max - y2.min),
|
|
7340
|
+
right: ({ x: x2 }, { left }) => parseFloat(left) + (x2.max - x2.min),
|
|
8478
7341
|
// Transform
|
|
8479
7342
|
x: (_bbox, { transform: transform2 }) => parseValueFromTransform(transform2, "x"),
|
|
8480
7343
|
y: (_bbox, { transform: transform2 }) => parseValueFromTransform(transform2, "y")
|
|
@@ -8560,9 +7423,9 @@ class KeyframeResolver {
|
|
|
8560
7423
|
}
|
|
8561
7424
|
readKeyframes() {
|
|
8562
7425
|
const { unresolvedKeyframes, name, element, motionValue: motionValue2 } = this;
|
|
8563
|
-
for (let
|
|
8564
|
-
if (unresolvedKeyframes[
|
|
8565
|
-
if (
|
|
7426
|
+
for (let i2 = 0; i2 < unresolvedKeyframes.length; i2++) {
|
|
7427
|
+
if (unresolvedKeyframes[i2] === null) {
|
|
7428
|
+
if (i2 === 0) {
|
|
8566
7429
|
const currentValue = motionValue2 == null ? void 0 : motionValue2.get();
|
|
8567
7430
|
const finalKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];
|
|
8568
7431
|
if (currentValue !== void 0) {
|
|
@@ -8580,7 +7443,7 @@ class KeyframeResolver {
|
|
|
8580
7443
|
motionValue2.set(unresolvedKeyframes[0]);
|
|
8581
7444
|
}
|
|
8582
7445
|
} else {
|
|
8583
|
-
unresolvedKeyframes[
|
|
7446
|
+
unresolvedKeyframes[i2] = unresolvedKeyframes[i2 - 1];
|
|
8584
7447
|
}
|
|
8585
7448
|
}
|
|
8586
7449
|
}
|
|
@@ -8650,16 +7513,16 @@ class DOMKeyframesResolver extends KeyframeResolver {
|
|
|
8650
7513
|
if (!element || !element.current)
|
|
8651
7514
|
return;
|
|
8652
7515
|
super.readKeyframes();
|
|
8653
|
-
for (let
|
|
8654
|
-
let keyframe = unresolvedKeyframes[
|
|
7516
|
+
for (let i2 = 0; i2 < unresolvedKeyframes.length; i2++) {
|
|
7517
|
+
let keyframe = unresolvedKeyframes[i2];
|
|
8655
7518
|
if (typeof keyframe === "string") {
|
|
8656
7519
|
keyframe = keyframe.trim();
|
|
8657
7520
|
if (isCSSVariableToken(keyframe)) {
|
|
8658
7521
|
const resolved = getVariableValue(keyframe, element.current);
|
|
8659
7522
|
if (resolved !== void 0) {
|
|
8660
|
-
unresolvedKeyframes[
|
|
7523
|
+
unresolvedKeyframes[i2] = resolved;
|
|
8661
7524
|
}
|
|
8662
|
-
if (
|
|
7525
|
+
if (i2 === unresolvedKeyframes.length - 1) {
|
|
8663
7526
|
this.finalKeyframe = keyframe;
|
|
8664
7527
|
}
|
|
8665
7528
|
}
|
|
@@ -8675,10 +7538,10 @@ class DOMKeyframesResolver extends KeyframeResolver {
|
|
|
8675
7538
|
if (originType === targetType)
|
|
8676
7539
|
return;
|
|
8677
7540
|
if (isNumOrPxType(originType) && isNumOrPxType(targetType)) {
|
|
8678
|
-
for (let
|
|
8679
|
-
const value = unresolvedKeyframes[
|
|
7541
|
+
for (let i2 = 0; i2 < unresolvedKeyframes.length; i2++) {
|
|
7542
|
+
const value = unresolvedKeyframes[i2];
|
|
8680
7543
|
if (typeof value === "string") {
|
|
8681
|
-
unresolvedKeyframes[
|
|
7544
|
+
unresolvedKeyframes[i2] = parseFloat(value);
|
|
8682
7545
|
}
|
|
8683
7546
|
}
|
|
8684
7547
|
} else {
|
|
@@ -8688,9 +7551,9 @@ class DOMKeyframesResolver extends KeyframeResolver {
|
|
|
8688
7551
|
resolveNoneKeyframes() {
|
|
8689
7552
|
const { unresolvedKeyframes, name } = this;
|
|
8690
7553
|
const noneKeyframeIndexes = [];
|
|
8691
|
-
for (let
|
|
8692
|
-
if (isNone(unresolvedKeyframes[
|
|
8693
|
-
noneKeyframeIndexes.push(
|
|
7554
|
+
for (let i2 = 0; i2 < unresolvedKeyframes.length; i2++) {
|
|
7555
|
+
if (isNone(unresolvedKeyframes[i2])) {
|
|
7556
|
+
noneKeyframeIndexes.push(i2);
|
|
8694
7557
|
}
|
|
8695
7558
|
}
|
|
8696
7559
|
if (noneKeyframeIndexes.length) {
|
|
@@ -8748,8 +7611,8 @@ function hasKeyframesChanged(keyframes2) {
|
|
|
8748
7611
|
const current = keyframes2[0];
|
|
8749
7612
|
if (keyframes2.length === 1)
|
|
8750
7613
|
return true;
|
|
8751
|
-
for (let
|
|
8752
|
-
if (keyframes2[
|
|
7614
|
+
for (let i2 = 0; i2 < keyframes2.length; i2++) {
|
|
7615
|
+
if (keyframes2[i2] !== current)
|
|
8753
7616
|
return true;
|
|
8754
7617
|
}
|
|
8755
7618
|
}
|
|
@@ -8882,18 +7745,18 @@ function calcGeneratorDuration(generator) {
|
|
|
8882
7745
|
const mixNumber$1 = (from, to, progress2) => {
|
|
8883
7746
|
return from + (to - from) * progress2;
|
|
8884
7747
|
};
|
|
8885
|
-
function hueToRgb(
|
|
8886
|
-
if (
|
|
8887
|
-
|
|
8888
|
-
if (
|
|
8889
|
-
|
|
8890
|
-
if (
|
|
8891
|
-
return
|
|
8892
|
-
if (
|
|
8893
|
-
return
|
|
8894
|
-
if (
|
|
8895
|
-
return
|
|
8896
|
-
return
|
|
7748
|
+
function hueToRgb(p2, q2, t2) {
|
|
7749
|
+
if (t2 < 0)
|
|
7750
|
+
t2 += 1;
|
|
7751
|
+
if (t2 > 1)
|
|
7752
|
+
t2 -= 1;
|
|
7753
|
+
if (t2 < 1 / 6)
|
|
7754
|
+
return p2 + (q2 - p2) * 6 * t2;
|
|
7755
|
+
if (t2 < 1 / 2)
|
|
7756
|
+
return q2;
|
|
7757
|
+
if (t2 < 2 / 3)
|
|
7758
|
+
return p2 + (q2 - p2) * (2 / 3 - t2) * 6;
|
|
7759
|
+
return p2;
|
|
8897
7760
|
}
|
|
8898
7761
|
function hslaToRgba({ hue, saturation, lightness, alpha: alpha2 }) {
|
|
8899
7762
|
hue /= 360;
|
|
@@ -8905,11 +7768,11 @@ function hslaToRgba({ hue, saturation, lightness, alpha: alpha2 }) {
|
|
|
8905
7768
|
if (!saturation) {
|
|
8906
7769
|
red = green = blue = lightness;
|
|
8907
7770
|
} else {
|
|
8908
|
-
const
|
|
8909
|
-
const
|
|
8910
|
-
red = hueToRgb(
|
|
8911
|
-
green = hueToRgb(
|
|
8912
|
-
blue = hueToRgb(
|
|
7771
|
+
const q2 = lightness < 0.5 ? lightness * (1 + saturation) : lightness + saturation - lightness * saturation;
|
|
7772
|
+
const p2 = 2 * lightness - q2;
|
|
7773
|
+
red = hueToRgb(p2, q2, hue + 1 / 3);
|
|
7774
|
+
green = hueToRgb(p2, q2, hue);
|
|
7775
|
+
blue = hueToRgb(p2, q2, hue - 1 / 3);
|
|
8913
7776
|
}
|
|
8914
7777
|
return {
|
|
8915
7778
|
red: Math.round(red * 255),
|
|
@@ -8918,8 +7781,8 @@ function hslaToRgba({ hue, saturation, lightness, alpha: alpha2 }) {
|
|
|
8918
7781
|
alpha: alpha2
|
|
8919
7782
|
};
|
|
8920
7783
|
}
|
|
8921
|
-
function mixImmediate(
|
|
8922
|
-
return (
|
|
7784
|
+
function mixImmediate(a2, b2) {
|
|
7785
|
+
return (p2) => p2 > 0 ? b2 : a2;
|
|
8923
7786
|
}
|
|
8924
7787
|
const mixLinearColor = (from, to, v2) => {
|
|
8925
7788
|
const fromExpo = from * from;
|
|
@@ -8954,48 +7817,48 @@ const mixColor = (from, to) => {
|
|
|
8954
7817
|
return rgba.transform(blended);
|
|
8955
7818
|
};
|
|
8956
7819
|
};
|
|
8957
|
-
const combineFunctions = (
|
|
7820
|
+
const combineFunctions = (a2, b2) => (v2) => b2(a2(v2));
|
|
8958
7821
|
const pipe = (...transformers) => transformers.reduce(combineFunctions);
|
|
8959
7822
|
const invisibleValues = /* @__PURE__ */ new Set(["none", "hidden"]);
|
|
8960
7823
|
function mixVisibility(origin, target) {
|
|
8961
7824
|
if (invisibleValues.has(origin)) {
|
|
8962
|
-
return (
|
|
7825
|
+
return (p2) => p2 <= 0 ? origin : target;
|
|
8963
7826
|
} else {
|
|
8964
|
-
return (
|
|
7827
|
+
return (p2) => p2 >= 1 ? target : origin;
|
|
8965
7828
|
}
|
|
8966
7829
|
}
|
|
8967
|
-
function mixNumber(
|
|
8968
|
-
return (
|
|
7830
|
+
function mixNumber(a2, b2) {
|
|
7831
|
+
return (p2) => mixNumber$1(a2, b2, p2);
|
|
8969
7832
|
}
|
|
8970
|
-
function getMixer$1(
|
|
8971
|
-
if (typeof
|
|
7833
|
+
function getMixer$1(a2) {
|
|
7834
|
+
if (typeof a2 === "number") {
|
|
8972
7835
|
return mixNumber;
|
|
8973
|
-
} else if (typeof
|
|
8974
|
-
return isCSSVariableToken(
|
|
8975
|
-
} else if (Array.isArray(
|
|
7836
|
+
} else if (typeof a2 === "string") {
|
|
7837
|
+
return isCSSVariableToken(a2) ? mixImmediate : color.test(a2) ? mixColor : mixComplex;
|
|
7838
|
+
} else if (Array.isArray(a2)) {
|
|
8976
7839
|
return mixArray;
|
|
8977
|
-
} else if (typeof
|
|
8978
|
-
return color.test(
|
|
7840
|
+
} else if (typeof a2 === "object") {
|
|
7841
|
+
return color.test(a2) ? mixColor : mixObject;
|
|
8979
7842
|
}
|
|
8980
7843
|
return mixImmediate;
|
|
8981
7844
|
}
|
|
8982
|
-
function mixArray(
|
|
8983
|
-
const output = [...
|
|
7845
|
+
function mixArray(a2, b2) {
|
|
7846
|
+
const output = [...a2];
|
|
8984
7847
|
const numValues = output.length;
|
|
8985
|
-
const blendValue =
|
|
8986
|
-
return (
|
|
8987
|
-
for (let
|
|
8988
|
-
output[
|
|
7848
|
+
const blendValue = a2.map((v2, i2) => getMixer$1(v2)(v2, b2[i2]));
|
|
7849
|
+
return (p2) => {
|
|
7850
|
+
for (let i2 = 0; i2 < numValues; i2++) {
|
|
7851
|
+
output[i2] = blendValue[i2](p2);
|
|
8989
7852
|
}
|
|
8990
7853
|
return output;
|
|
8991
7854
|
};
|
|
8992
7855
|
}
|
|
8993
|
-
function mixObject(
|
|
8994
|
-
const output = { ...
|
|
7856
|
+
function mixObject(a2, b2) {
|
|
7857
|
+
const output = { ...a2, ...b2 };
|
|
8995
7858
|
const blendValue = {};
|
|
8996
7859
|
for (const key in output) {
|
|
8997
|
-
if (
|
|
8998
|
-
blendValue[key] = getMixer$1(
|
|
7860
|
+
if (a2[key] !== void 0 && b2[key] !== void 0) {
|
|
7861
|
+
blendValue[key] = getMixer$1(a2[key])(a2[key], b2[key]);
|
|
8999
7862
|
}
|
|
9000
7863
|
}
|
|
9001
7864
|
return (v2) => {
|
|
@@ -9008,11 +7871,11 @@ function mixObject(a, b) {
|
|
|
9008
7871
|
function matchOrder(origin, target) {
|
|
9009
7872
|
const orderedOrigin = [];
|
|
9010
7873
|
const pointers = { color: 0, var: 0, number: 0 };
|
|
9011
|
-
for (let
|
|
9012
|
-
const type = target.types[
|
|
7874
|
+
for (let i2 = 0; i2 < target.values.length; i2++) {
|
|
7875
|
+
const type = target.types[i2];
|
|
9013
7876
|
const originIndex = origin.indexes[type][pointers[type]];
|
|
9014
7877
|
const originValue = origin.values[originIndex] ?? 0;
|
|
9015
|
-
orderedOrigin[
|
|
7878
|
+
orderedOrigin[i2] = originValue;
|
|
9016
7879
|
pointers[type]++;
|
|
9017
7880
|
}
|
|
9018
7881
|
return orderedOrigin;
|
|
@@ -9032,9 +7895,9 @@ const mixComplex = (origin, target) => {
|
|
|
9032
7895
|
return mixImmediate(origin, target);
|
|
9033
7896
|
}
|
|
9034
7897
|
};
|
|
9035
|
-
function mix(from, to,
|
|
9036
|
-
if (typeof from === "number" && typeof to === "number" && typeof
|
|
9037
|
-
return mixNumber$1(from, to,
|
|
7898
|
+
function mix(from, to, p2) {
|
|
7899
|
+
if (typeof from === "number" && typeof to === "number" && typeof p2 === "number") {
|
|
7900
|
+
return mixNumber$1(from, to, p2);
|
|
9038
7901
|
}
|
|
9039
7902
|
const mixer = getMixer$1(from);
|
|
9040
7903
|
return mixer(from, to);
|
|
@@ -9051,9 +7914,9 @@ function createGeneratorEasing(options, scale2 = 100, createGenerator) {
|
|
|
9051
7914
|
};
|
|
9052
7915
|
}
|
|
9053
7916
|
const velocitySampleDuration = 5;
|
|
9054
|
-
function calcGeneratorVelocity(resolveValue,
|
|
9055
|
-
const prevT = Math.max(
|
|
9056
|
-
return velocityPerSecond(current - resolveValue(prevT),
|
|
7917
|
+
function calcGeneratorVelocity(resolveValue, t2, current) {
|
|
7918
|
+
const prevT = Math.max(t2 - velocitySampleDuration, 0);
|
|
7919
|
+
return velocityPerSecond(current - resolveValue(prevT), t2 - prevT);
|
|
9057
7920
|
}
|
|
9058
7921
|
const springDefaults = {
|
|
9059
7922
|
// Default spring physics
|
|
@@ -9096,31 +7959,31 @@ function findSpring({ duration = springDefaults.duration, bounce = springDefault
|
|
|
9096
7959
|
envelope = (undampedFreq2) => {
|
|
9097
7960
|
const exponentialDecay = undampedFreq2 * dampingRatio;
|
|
9098
7961
|
const delta = exponentialDecay * duration;
|
|
9099
|
-
const
|
|
9100
|
-
const
|
|
9101
|
-
const
|
|
9102
|
-
return safeMin -
|
|
7962
|
+
const a2 = exponentialDecay - velocity;
|
|
7963
|
+
const b2 = calcAngularFreq(undampedFreq2, dampingRatio);
|
|
7964
|
+
const c2 = Math.exp(-delta);
|
|
7965
|
+
return safeMin - a2 / b2 * c2;
|
|
9103
7966
|
};
|
|
9104
7967
|
derivative = (undampedFreq2) => {
|
|
9105
7968
|
const exponentialDecay = undampedFreq2 * dampingRatio;
|
|
9106
7969
|
const delta = exponentialDecay * duration;
|
|
9107
|
-
const
|
|
9108
|
-
const
|
|
9109
|
-
const
|
|
7970
|
+
const d2 = delta * velocity + velocity;
|
|
7971
|
+
const e2 = Math.pow(dampingRatio, 2) * Math.pow(undampedFreq2, 2) * duration;
|
|
7972
|
+
const f2 = Math.exp(-delta);
|
|
9110
7973
|
const g2 = calcAngularFreq(Math.pow(undampedFreq2, 2), dampingRatio);
|
|
9111
7974
|
const factor = -envelope(undampedFreq2) + safeMin > 0 ? -1 : 1;
|
|
9112
|
-
return factor * ((
|
|
7975
|
+
return factor * ((d2 - e2) * f2) / g2;
|
|
9113
7976
|
};
|
|
9114
7977
|
} else {
|
|
9115
7978
|
envelope = (undampedFreq2) => {
|
|
9116
|
-
const
|
|
9117
|
-
const
|
|
9118
|
-
return -1e-3 +
|
|
7979
|
+
const a2 = Math.exp(-undampedFreq2 * duration);
|
|
7980
|
+
const b2 = (undampedFreq2 - velocity) * duration + 1;
|
|
7981
|
+
return -1e-3 + a2 * b2;
|
|
9119
7982
|
};
|
|
9120
7983
|
derivative = (undampedFreq2) => {
|
|
9121
|
-
const
|
|
9122
|
-
const
|
|
9123
|
-
return
|
|
7984
|
+
const a2 = Math.exp(-undampedFreq2 * duration);
|
|
7985
|
+
const b2 = (velocity - undampedFreq2) * (duration * duration);
|
|
7986
|
+
return a2 * b2;
|
|
9124
7987
|
};
|
|
9125
7988
|
}
|
|
9126
7989
|
const initialGuess = 5 / duration;
|
|
@@ -9144,7 +8007,7 @@ function findSpring({ duration = springDefaults.duration, bounce = springDefault
|
|
|
9144
8007
|
const rootIterations = 12;
|
|
9145
8008
|
function approximateRoot(envelope, derivative, initialGuess) {
|
|
9146
8009
|
let result = initialGuess;
|
|
9147
|
-
for (let
|
|
8010
|
+
for (let i2 = 1; i2 < rootIterations; i2++) {
|
|
9148
8011
|
result = result - envelope(result) / derivative(result);
|
|
9149
8012
|
}
|
|
9150
8013
|
return result;
|
|
@@ -9214,34 +8077,34 @@ function spring(optionsOrVisualDuration = springDefaults.visualDuration, bounce
|
|
|
9214
8077
|
let resolveSpring;
|
|
9215
8078
|
if (dampingRatio < 1) {
|
|
9216
8079
|
const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
|
|
9217
|
-
resolveSpring = (
|
|
9218
|
-
const envelope = Math.exp(-dampingRatio * undampedAngularFreq *
|
|
9219
|
-
return target - envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) / angularFreq * Math.sin(angularFreq *
|
|
8080
|
+
resolveSpring = (t2) => {
|
|
8081
|
+
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t2);
|
|
8082
|
+
return target - envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) / angularFreq * Math.sin(angularFreq * t2) + initialDelta * Math.cos(angularFreq * t2));
|
|
9220
8083
|
};
|
|
9221
8084
|
} else if (dampingRatio === 1) {
|
|
9222
|
-
resolveSpring = (
|
|
8085
|
+
resolveSpring = (t2) => target - Math.exp(-undampedAngularFreq * t2) * (initialDelta + (initialVelocity + undampedAngularFreq * initialDelta) * t2);
|
|
9223
8086
|
} else {
|
|
9224
8087
|
const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);
|
|
9225
|
-
resolveSpring = (
|
|
9226
|
-
const envelope = Math.exp(-dampingRatio * undampedAngularFreq *
|
|
9227
|
-
const freqForT = Math.min(dampedAngularFreq *
|
|
8088
|
+
resolveSpring = (t2) => {
|
|
8089
|
+
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t2);
|
|
8090
|
+
const freqForT = Math.min(dampedAngularFreq * t2, 300);
|
|
9228
8091
|
return target - envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) * Math.sinh(freqForT) + dampedAngularFreq * initialDelta * Math.cosh(freqForT)) / dampedAngularFreq;
|
|
9229
8092
|
};
|
|
9230
8093
|
}
|
|
9231
8094
|
const generator = {
|
|
9232
8095
|
calculatedDuration: isResolvedFromDuration ? duration || null : null,
|
|
9233
|
-
next: (
|
|
9234
|
-
const current = resolveSpring(
|
|
8096
|
+
next: (t2) => {
|
|
8097
|
+
const current = resolveSpring(t2);
|
|
9235
8098
|
if (!isResolvedFromDuration) {
|
|
9236
8099
|
let currentVelocity = 0;
|
|
9237
8100
|
if (dampingRatio < 1) {
|
|
9238
|
-
currentVelocity =
|
|
8101
|
+
currentVelocity = t2 === 0 ? /* @__PURE__ */ secondsToMilliseconds(initialVelocity) : calcGeneratorVelocity(resolveSpring, t2, current);
|
|
9239
8102
|
}
|
|
9240
8103
|
const isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed;
|
|
9241
8104
|
const isBelowDisplacementThreshold = Math.abs(target - current) <= restDelta;
|
|
9242
8105
|
state.done = isBelowVelocityThreshold && isBelowDisplacementThreshold;
|
|
9243
8106
|
} else {
|
|
9244
|
-
state.done =
|
|
8107
|
+
state.done = t2 >= duration;
|
|
9245
8108
|
}
|
|
9246
8109
|
state.value = state.done ? target : current;
|
|
9247
8110
|
return state;
|
|
@@ -9282,23 +8145,23 @@ function inertia({ keyframes: keyframes2, velocity = 0, power = 0.8, timeConstan
|
|
|
9282
8145
|
const target = modifyTarget === void 0 ? ideal : modifyTarget(ideal);
|
|
9283
8146
|
if (target !== ideal)
|
|
9284
8147
|
amplitude = target - origin;
|
|
9285
|
-
const calcDelta = (
|
|
9286
|
-
const calcLatest = (
|
|
9287
|
-
const applyFriction = (
|
|
9288
|
-
const delta = calcDelta(
|
|
9289
|
-
const latest = calcLatest(
|
|
8148
|
+
const calcDelta = (t2) => -amplitude * Math.exp(-t2 / timeConstant);
|
|
8149
|
+
const calcLatest = (t2) => target + calcDelta(t2);
|
|
8150
|
+
const applyFriction = (t2) => {
|
|
8151
|
+
const delta = calcDelta(t2);
|
|
8152
|
+
const latest = calcLatest(t2);
|
|
9290
8153
|
state.done = Math.abs(delta) <= restDelta;
|
|
9291
8154
|
state.value = state.done ? target : latest;
|
|
9292
8155
|
};
|
|
9293
8156
|
let timeReachedBoundary;
|
|
9294
8157
|
let spring$1;
|
|
9295
|
-
const checkCatchBoundary = (
|
|
8158
|
+
const checkCatchBoundary = (t2) => {
|
|
9296
8159
|
if (!isOutOfBounds(state.value))
|
|
9297
8160
|
return;
|
|
9298
|
-
timeReachedBoundary =
|
|
8161
|
+
timeReachedBoundary = t2;
|
|
9299
8162
|
spring$1 = spring({
|
|
9300
8163
|
keyframes: [state.value, nearestBoundary(state.value)],
|
|
9301
|
-
velocity: calcGeneratorVelocity(calcLatest,
|
|
8164
|
+
velocity: calcGeneratorVelocity(calcLatest, t2, state.value),
|
|
9302
8165
|
// TODO: This should be passing * 1000
|
|
9303
8166
|
damping: bounceDamping,
|
|
9304
8167
|
stiffness: bounceStiffness,
|
|
@@ -9309,17 +8172,17 @@ function inertia({ keyframes: keyframes2, velocity = 0, power = 0.8, timeConstan
|
|
|
9309
8172
|
checkCatchBoundary(0);
|
|
9310
8173
|
return {
|
|
9311
8174
|
calculatedDuration: null,
|
|
9312
|
-
next: (
|
|
8175
|
+
next: (t2) => {
|
|
9313
8176
|
let hasUpdatedFrame = false;
|
|
9314
8177
|
if (!spring$1 && timeReachedBoundary === void 0) {
|
|
9315
8178
|
hasUpdatedFrame = true;
|
|
9316
|
-
applyFriction(
|
|
9317
|
-
checkCatchBoundary(
|
|
8179
|
+
applyFriction(t2);
|
|
8180
|
+
checkCatchBoundary(t2);
|
|
9318
8181
|
}
|
|
9319
|
-
if (timeReachedBoundary !== void 0 &&
|
|
9320
|
-
return spring$1.next(
|
|
8182
|
+
if (timeReachedBoundary !== void 0 && t2 >= timeReachedBoundary) {
|
|
8183
|
+
return spring$1.next(t2 - timeReachedBoundary);
|
|
9321
8184
|
} else {
|
|
9322
|
-
!hasUpdatedFrame && applyFriction(
|
|
8185
|
+
!hasUpdatedFrame && applyFriction(t2);
|
|
9323
8186
|
return state;
|
|
9324
8187
|
}
|
|
9325
8188
|
}
|
|
@@ -9363,10 +8226,10 @@ function createMixers(output, ease2, customMixer) {
|
|
|
9363
8226
|
const mixers = [];
|
|
9364
8227
|
const mixerFactory = customMixer || mix;
|
|
9365
8228
|
const numMixers = output.length - 1;
|
|
9366
|
-
for (let
|
|
9367
|
-
let mixer = mixerFactory(output[
|
|
8229
|
+
for (let i2 = 0; i2 < numMixers; i2++) {
|
|
8230
|
+
let mixer = mixerFactory(output[i2], output[i2 + 1]);
|
|
9368
8231
|
if (ease2) {
|
|
9369
|
-
const easingFunction = Array.isArray(ease2) ? ease2[
|
|
8232
|
+
const easingFunction = Array.isArray(ease2) ? ease2[i2] || noop : ease2;
|
|
9370
8233
|
mixer = pipe(easingFunction, mixer);
|
|
9371
8234
|
}
|
|
9372
8235
|
mixers.push(mixer);
|
|
@@ -9390,22 +8253,22 @@ function interpolate(input, output, { clamp: isClamp = true, ease: ease2, mixer
|
|
|
9390
8253
|
const interpolator = (v2) => {
|
|
9391
8254
|
if (isZeroDeltaRange && v2 < input[0])
|
|
9392
8255
|
return output[0];
|
|
9393
|
-
let
|
|
8256
|
+
let i2 = 0;
|
|
9394
8257
|
if (numMixers > 1) {
|
|
9395
|
-
for (;
|
|
9396
|
-
if (v2 < input[
|
|
8258
|
+
for (; i2 < input.length - 2; i2++) {
|
|
8259
|
+
if (v2 < input[i2 + 1])
|
|
9397
8260
|
break;
|
|
9398
8261
|
}
|
|
9399
8262
|
}
|
|
9400
|
-
const progressInRange = /* @__PURE__ */ progress(input[
|
|
9401
|
-
return mixers[
|
|
8263
|
+
const progressInRange = /* @__PURE__ */ progress(input[i2], input[i2 + 1], v2);
|
|
8264
|
+
return mixers[i2](progressInRange);
|
|
9402
8265
|
};
|
|
9403
8266
|
return isClamp ? (v2) => interpolator(clamp(input[0], input[inputLength - 1], v2)) : interpolator;
|
|
9404
8267
|
}
|
|
9405
8268
|
function fillOffset(offset, remaining) {
|
|
9406
8269
|
const min = offset[offset.length - 1];
|
|
9407
|
-
for (let
|
|
9408
|
-
const offsetProgress = /* @__PURE__ */ progress(0, remaining,
|
|
8270
|
+
for (let i2 = 1; i2 <= remaining; i2++) {
|
|
8271
|
+
const offsetProgress = /* @__PURE__ */ progress(0, remaining, i2);
|
|
9409
8272
|
offset.push(mixNumber$1(min, 1, offsetProgress));
|
|
9410
8273
|
}
|
|
9411
8274
|
}
|
|
@@ -9415,7 +8278,7 @@ function defaultOffset(arr) {
|
|
|
9415
8278
|
return offset;
|
|
9416
8279
|
}
|
|
9417
8280
|
function convertOffsetToTimes(offset, duration) {
|
|
9418
|
-
return offset.map((
|
|
8281
|
+
return offset.map((o2) => o2 * duration);
|
|
9419
8282
|
}
|
|
9420
8283
|
function defaultEasing(values, easing) {
|
|
9421
8284
|
return values.map(() => easing || easeInOut).splice(0, values.length - 1);
|
|
@@ -9437,9 +8300,9 @@ function keyframes$1({ duration = 300, keyframes: keyframeValues, times, ease: e
|
|
|
9437
8300
|
});
|
|
9438
8301
|
return {
|
|
9439
8302
|
calculatedDuration: duration,
|
|
9440
|
-
next: (
|
|
9441
|
-
state.value = mapTimeToKeyframe(
|
|
9442
|
-
state.done =
|
|
8303
|
+
next: (t2) => {
|
|
8304
|
+
state.value = mapTimeToKeyframe(t2);
|
|
8305
|
+
state.done = t2 >= duration;
|
|
9443
8306
|
return state;
|
|
9444
8307
|
}
|
|
9445
8308
|
};
|
|
@@ -9743,16 +8606,16 @@ function pregenerateKeyframes(keyframes2, options) {
|
|
|
9743
8606
|
});
|
|
9744
8607
|
let state = { done: false, value: keyframes2[0] };
|
|
9745
8608
|
const pregeneratedKeyframes = [];
|
|
9746
|
-
let
|
|
9747
|
-
while (!state.done &&
|
|
9748
|
-
state = sampleAnimation.sample(
|
|
8609
|
+
let t2 = 0;
|
|
8610
|
+
while (!state.done && t2 < maxDuration) {
|
|
8611
|
+
state = sampleAnimation.sample(t2);
|
|
9749
8612
|
pregeneratedKeyframes.push(state.value);
|
|
9750
|
-
|
|
8613
|
+
t2 += sampleDelta;
|
|
9751
8614
|
}
|
|
9752
8615
|
return {
|
|
9753
8616
|
times: void 0,
|
|
9754
8617
|
keyframes: pregeneratedKeyframes,
|
|
9755
|
-
duration:
|
|
8618
|
+
duration: t2 - sampleDelta,
|
|
9756
8619
|
ease: "linear"
|
|
9757
8620
|
};
|
|
9758
8621
|
}
|
|
@@ -10123,18 +8986,18 @@ function animateVariant(visualElement, variant, options = {}) {
|
|
|
10123
8986
|
function animateChildren(visualElement, variant, delayChildren = 0, staggerChildren = 0, staggerDirection = 1, options) {
|
|
10124
8987
|
const animations2 = [];
|
|
10125
8988
|
const maxStaggerDuration = (visualElement.variantChildren.size - 1) * staggerChildren;
|
|
10126
|
-
const generateStaggerDuration = staggerDirection === 1 ? (
|
|
10127
|
-
Array.from(visualElement.variantChildren).sort(sortByTreeOrder).forEach((child,
|
|
8989
|
+
const generateStaggerDuration = staggerDirection === 1 ? (i2 = 0) => i2 * staggerChildren : (i2 = 0) => maxStaggerDuration - i2 * staggerChildren;
|
|
8990
|
+
Array.from(visualElement.variantChildren).sort(sortByTreeOrder).forEach((child, i2) => {
|
|
10128
8991
|
child.notify("AnimationStart", variant);
|
|
10129
8992
|
animations2.push(animateVariant(child, variant, {
|
|
10130
8993
|
...options,
|
|
10131
|
-
delay: delayChildren + generateStaggerDuration(
|
|
8994
|
+
delay: delayChildren + generateStaggerDuration(i2)
|
|
10132
8995
|
}).then(() => child.notify("AnimationComplete", variant)));
|
|
10133
8996
|
});
|
|
10134
8997
|
return Promise.all(animations2);
|
|
10135
8998
|
}
|
|
10136
|
-
function sortByTreeOrder(
|
|
10137
|
-
return
|
|
8999
|
+
function sortByTreeOrder(a2, b2) {
|
|
9000
|
+
return a2.sortNodePosition(b2);
|
|
10138
9001
|
}
|
|
10139
9002
|
function animateVisualElement(visualElement, definition, options = {}) {
|
|
10140
9003
|
visualElement.notify("AnimationStart", definition);
|
|
@@ -10158,8 +9021,8 @@ function shallowCompare(next, prev) {
|
|
|
10158
9021
|
const prevLength = prev.length;
|
|
10159
9022
|
if (prevLength !== next.length)
|
|
10160
9023
|
return false;
|
|
10161
|
-
for (let
|
|
10162
|
-
if (prev[
|
|
9024
|
+
for (let i2 = 0; i2 < prevLength; i2++) {
|
|
9025
|
+
if (prev[i2] !== next[i2])
|
|
10163
9026
|
return false;
|
|
10164
9027
|
}
|
|
10165
9028
|
return true;
|
|
@@ -10176,8 +9039,8 @@ function getVariantContext(visualElement) {
|
|
|
10176
9039
|
return context3;
|
|
10177
9040
|
}
|
|
10178
9041
|
const context2 = {};
|
|
10179
|
-
for (let
|
|
10180
|
-
const name = variantProps[
|
|
9042
|
+
for (let i2 = 0; i2 < numVariantProps; i2++) {
|
|
9043
|
+
const name = variantProps[i2];
|
|
10181
9044
|
const prop = visualElement.props[name];
|
|
10182
9045
|
if (isVariantLabel(prop) || prop === false) {
|
|
10183
9046
|
context2[name] = prop;
|
|
@@ -10213,14 +9076,14 @@ function createAnimationState(visualElement) {
|
|
|
10213
9076
|
const removedKeys = /* @__PURE__ */ new Set();
|
|
10214
9077
|
let encounteredKeys = {};
|
|
10215
9078
|
let removedVariantIndex = Infinity;
|
|
10216
|
-
for (let
|
|
10217
|
-
const type = reversePriorityOrder[
|
|
9079
|
+
for (let i2 = 0; i2 < numAnimationTypes; i2++) {
|
|
9080
|
+
const type = reversePriorityOrder[i2];
|
|
10218
9081
|
const typeState = state[type];
|
|
10219
9082
|
const prop = props[type] !== void 0 ? props[type] : context2[type];
|
|
10220
9083
|
const propIsVariant = isVariantLabel(prop);
|
|
10221
9084
|
const activeDelta = type === changedActiveType ? typeState.isActive : null;
|
|
10222
9085
|
if (activeDelta === false)
|
|
10223
|
-
removedVariantIndex =
|
|
9086
|
+
removedVariantIndex = i2;
|
|
10224
9087
|
let isInherited = prop === context2[type] && prop !== props[type] && propIsVariant;
|
|
10225
9088
|
if (isInherited && isInitialRender && visualElement.manuallyAnimateOnMount) {
|
|
10226
9089
|
isInherited = false;
|
|
@@ -10237,7 +9100,7 @@ function createAnimationState(visualElement) {
|
|
|
10237
9100
|
const variantDidChange = checkVariantsDidChange(typeState.prevProp, prop);
|
|
10238
9101
|
let shouldAnimateType = variantDidChange || // If we're making this variant active, we want to always make it active
|
|
10239
9102
|
type === changedActiveType && typeState.isActive && !isInherited && propIsVariant || // If we removed a higher-priority variant (i is in reverse order)
|
|
10240
|
-
|
|
9103
|
+
i2 > removedVariantIndex && propIsVariant;
|
|
10241
9104
|
let handledRemovedValues = false;
|
|
10242
9105
|
const definitionList = Array.isArray(prop) ? prop : [prop];
|
|
10243
9106
|
let resolvedValues = definitionList.reduce(buildResolvedTypeValues(type), {});
|
|
@@ -10519,8 +9382,8 @@ function convertBoundingBoxToBox({ top, left, right, bottom }) {
|
|
|
10519
9382
|
y: { min: top, max: bottom }
|
|
10520
9383
|
};
|
|
10521
9384
|
}
|
|
10522
|
-
function convertBoxToBoundingBox({ x, y }) {
|
|
10523
|
-
return { top:
|
|
9385
|
+
function convertBoxToBoundingBox({ x: x2, y: y2 }) {
|
|
9386
|
+
return { top: y2.min, right: x2.max, bottom: y2.max, left: x2.min };
|
|
10524
9387
|
}
|
|
10525
9388
|
function transformBoxPoints(point, transformPoint2) {
|
|
10526
9389
|
if (!transformPoint2)
|
|
@@ -10626,9 +9489,9 @@ function applyAxisDelta(axis, translate = 0, scale2 = 1, originPoint, boxScale)
|
|
|
10626
9489
|
axis.min = applyPointDelta(axis.min, translate, scale2, originPoint, boxScale);
|
|
10627
9490
|
axis.max = applyPointDelta(axis.max, translate, scale2, originPoint, boxScale);
|
|
10628
9491
|
}
|
|
10629
|
-
function applyBoxDelta(box, { x, y }) {
|
|
10630
|
-
applyAxisDelta(box.x,
|
|
10631
|
-
applyAxisDelta(box.y,
|
|
9492
|
+
function applyBoxDelta(box, { x: x2, y: y2 }) {
|
|
9493
|
+
applyAxisDelta(box.x, x2.translate, x2.scale, x2.originPoint);
|
|
9494
|
+
applyAxisDelta(box.y, y2.translate, y2.scale, y2.originPoint);
|
|
10632
9495
|
}
|
|
10633
9496
|
const TREE_SCALE_SNAP_MIN = 0.999999999999;
|
|
10634
9497
|
const TREE_SCALE_SNAP_MAX = 1.0000000000001;
|
|
@@ -10639,8 +9502,8 @@ function applyTreeDeltas(box, treeScale, treePath, isSharedTransition = false) {
|
|
|
10639
9502
|
treeScale.x = treeScale.y = 1;
|
|
10640
9503
|
let node;
|
|
10641
9504
|
let delta;
|
|
10642
|
-
for (let
|
|
10643
|
-
node = treePath[
|
|
9505
|
+
for (let i2 = 0; i2 < treeLength; i2++) {
|
|
9506
|
+
node = treePath[i2];
|
|
10644
9507
|
delta = node.projectionDelta;
|
|
10645
9508
|
const { visualElement } = node.options;
|
|
10646
9509
|
if (visualElement && visualElement.props.style && visualElement.props.style.display === "contents") {
|
|
@@ -10695,10 +9558,10 @@ function measurePageBox(element, rootProjectionNode2, transformPagePoint) {
|
|
|
10695
9558
|
const getContextWindow = ({ current }) => {
|
|
10696
9559
|
return current ? current.ownerDocument.defaultView : null;
|
|
10697
9560
|
};
|
|
10698
|
-
const distance = (
|
|
10699
|
-
function distance2D(
|
|
10700
|
-
const xDelta = distance(
|
|
10701
|
-
const yDelta = distance(
|
|
9561
|
+
const distance = (a2, b2) => Math.abs(a2 - b2);
|
|
9562
|
+
function distance2D(a2, b2) {
|
|
9563
|
+
const xDelta = distance(a2.x, b2.x);
|
|
9564
|
+
const yDelta = distance(a2.y, b2.y);
|
|
10702
9565
|
return Math.sqrt(xDelta ** 2 + yDelta ** 2);
|
|
10703
9566
|
}
|
|
10704
9567
|
class PanSession {
|
|
@@ -10770,8 +9633,8 @@ class PanSession {
|
|
|
10770
9633
|
function transformPoint(info, transformPagePoint) {
|
|
10771
9634
|
return transformPagePoint ? { point: transformPagePoint(info.point) } : info;
|
|
10772
9635
|
}
|
|
10773
|
-
function subtractPoint(
|
|
10774
|
-
return { x:
|
|
9636
|
+
function subtractPoint(a2, b2) {
|
|
9637
|
+
return { x: a2.x - b2.x, y: a2.y - b2.y };
|
|
10775
9638
|
}
|
|
10776
9639
|
function getPanInfo({ point }, history) {
|
|
10777
9640
|
return {
|
|
@@ -10791,15 +9654,15 @@ function getVelocity(history, timeDelta) {
|
|
|
10791
9654
|
if (history.length < 2) {
|
|
10792
9655
|
return { x: 0, y: 0 };
|
|
10793
9656
|
}
|
|
10794
|
-
let
|
|
9657
|
+
let i2 = history.length - 1;
|
|
10795
9658
|
let timestampedPoint = null;
|
|
10796
9659
|
const lastPoint = lastDevicePoint(history);
|
|
10797
|
-
while (
|
|
10798
|
-
timestampedPoint = history[
|
|
9660
|
+
while (i2 >= 0) {
|
|
9661
|
+
timestampedPoint = history[i2];
|
|
10799
9662
|
if (lastPoint.timestamp - timestampedPoint.timestamp > /* @__PURE__ */ secondsToMilliseconds(timeDelta)) {
|
|
10800
9663
|
break;
|
|
10801
9664
|
}
|
|
10802
|
-
|
|
9665
|
+
i2--;
|
|
10803
9666
|
}
|
|
10804
9667
|
if (!timestampedPoint) {
|
|
10805
9668
|
return { x: 0, y: 0 };
|
|
@@ -11334,9 +10197,9 @@ const correctBorderRadius = {
|
|
|
11334
10197
|
return latest;
|
|
11335
10198
|
}
|
|
11336
10199
|
}
|
|
11337
|
-
const
|
|
11338
|
-
const
|
|
11339
|
-
return `${
|
|
10200
|
+
const x2 = pixelsToPercent(latest, node.target.x);
|
|
10201
|
+
const y2 = pixelsToPercent(latest, node.target.y);
|
|
10202
|
+
return `${x2}% ${y2}%`;
|
|
11340
10203
|
}
|
|
11341
10204
|
};
|
|
11342
10205
|
const correctBoxShadow = {
|
|
@@ -11470,7 +10333,7 @@ function animateSingleValue(value, keyframes2, options) {
|
|
|
11470
10333
|
function isSVGElement(element) {
|
|
11471
10334
|
return element instanceof SVGElement && element.tagName !== "svg";
|
|
11472
10335
|
}
|
|
11473
|
-
const compareByDepth = (
|
|
10336
|
+
const compareByDepth = (a2, b2) => a2.depth - b2.depth;
|
|
11474
10337
|
class FlatTree {
|
|
11475
10338
|
constructor() {
|
|
11476
10339
|
this.children = [];
|
|
@@ -11518,8 +10381,8 @@ function mixValues(target, follow, lead, progress2, shouldCrossfadeOpacity, isOn
|
|
|
11518
10381
|
} else if (isOnlyMember) {
|
|
11519
10382
|
target.opacity = mixNumber$1(follow.opacity !== void 0 ? follow.opacity : 1, lead.opacity !== void 0 ? lead.opacity : 1, progress2);
|
|
11520
10383
|
}
|
|
11521
|
-
for (let
|
|
11522
|
-
const borderLabel = `border${borders$1[
|
|
10384
|
+
for (let i2 = 0; i2 < numBorders; i2++) {
|
|
10385
|
+
const borderLabel = `border${borders$1[i2]}Radius`;
|
|
11523
10386
|
let followRadius = getRadius(follow, borderLabel);
|
|
11524
10387
|
let leadRadius = getRadius(lead, borderLabel);
|
|
11525
10388
|
if (followRadius === void 0 && leadRadius === void 0)
|
|
@@ -11546,12 +10409,12 @@ function getRadius(values, radiusName) {
|
|
|
11546
10409
|
const easeCrossfadeIn = /* @__PURE__ */ compress(0, 0.5, circOut);
|
|
11547
10410
|
const easeCrossfadeOut = /* @__PURE__ */ compress(0.5, 0.95, noop);
|
|
11548
10411
|
function compress(min, max, easing) {
|
|
11549
|
-
return (
|
|
11550
|
-
if (
|
|
10412
|
+
return (p2) => {
|
|
10413
|
+
if (p2 < min)
|
|
11551
10414
|
return 0;
|
|
11552
|
-
if (
|
|
10415
|
+
if (p2 > max)
|
|
11553
10416
|
return 1;
|
|
11554
|
-
return easing(/* @__PURE__ */ progress(min, max,
|
|
10417
|
+
return easing(/* @__PURE__ */ progress(min, max, p2));
|
|
11555
10418
|
};
|
|
11556
10419
|
}
|
|
11557
10420
|
function copyAxisInto(axis, originAxis) {
|
|
@@ -11605,23 +10468,23 @@ function isAxisDeltaZero(delta) {
|
|
|
11605
10468
|
function isDeltaZero(delta) {
|
|
11606
10469
|
return isAxisDeltaZero(delta.x) && isAxisDeltaZero(delta.y);
|
|
11607
10470
|
}
|
|
11608
|
-
function axisEquals(
|
|
11609
|
-
return
|
|
10471
|
+
function axisEquals(a2, b2) {
|
|
10472
|
+
return a2.min === b2.min && a2.max === b2.max;
|
|
11610
10473
|
}
|
|
11611
|
-
function boxEquals(
|
|
11612
|
-
return axisEquals(
|
|
10474
|
+
function boxEquals(a2, b2) {
|
|
10475
|
+
return axisEquals(a2.x, b2.x) && axisEquals(a2.y, b2.y);
|
|
11613
10476
|
}
|
|
11614
|
-
function axisEqualsRounded(
|
|
11615
|
-
return Math.round(
|
|
10477
|
+
function axisEqualsRounded(a2, b2) {
|
|
10478
|
+
return Math.round(a2.min) === Math.round(b2.min) && Math.round(a2.max) === Math.round(b2.max);
|
|
11616
10479
|
}
|
|
11617
|
-
function boxEqualsRounded(
|
|
11618
|
-
return axisEqualsRounded(
|
|
10480
|
+
function boxEqualsRounded(a2, b2) {
|
|
10481
|
+
return axisEqualsRounded(a2.x, b2.x) && axisEqualsRounded(a2.y, b2.y);
|
|
11619
10482
|
}
|
|
11620
10483
|
function aspectRatio(box) {
|
|
11621
10484
|
return calcLength(box.x) / calcLength(box.y);
|
|
11622
10485
|
}
|
|
11623
|
-
function axisDeltaEquals(
|
|
11624
|
-
return
|
|
10486
|
+
function axisDeltaEquals(a2, b2) {
|
|
10487
|
+
return a2.translate === b2.translate && a2.scale === b2.scale && a2.originPoint === b2.originPoint;
|
|
11625
10488
|
}
|
|
11626
10489
|
class NodeStack {
|
|
11627
10490
|
constructor() {
|
|
@@ -11648,8 +10511,8 @@ class NodeStack {
|
|
|
11648
10511
|
if (indexOfNode === 0)
|
|
11649
10512
|
return false;
|
|
11650
10513
|
let prevLead;
|
|
11651
|
-
for (let
|
|
11652
|
-
const member = this.members[
|
|
10514
|
+
for (let i2 = indexOfNode; i2 >= 0; i2--) {
|
|
10515
|
+
const member = this.members[i2];
|
|
11653
10516
|
if (member.isPresent !== false) {
|
|
11654
10517
|
prevLead = member;
|
|
11655
10518
|
break;
|
|
@@ -11826,8 +10689,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
11826
10689
|
this.path = parent ? [...parent.path, parent] : [];
|
|
11827
10690
|
this.parent = parent;
|
|
11828
10691
|
this.depth = parent ? parent.depth + 1 : 0;
|
|
11829
|
-
for (let
|
|
11830
|
-
this.path[
|
|
10692
|
+
for (let i2 = 0; i2 < this.path.length; i2++) {
|
|
10693
|
+
this.path[i2].shouldResetTransform = true;
|
|
11831
10694
|
}
|
|
11832
10695
|
if (this.root === this)
|
|
11833
10696
|
this.nodes = new FlatTree();
|
|
@@ -11964,8 +10827,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
11964
10827
|
if (this.isLayoutDirty)
|
|
11965
10828
|
return;
|
|
11966
10829
|
this.isLayoutDirty = true;
|
|
11967
|
-
for (let
|
|
11968
|
-
const node = this.path[
|
|
10830
|
+
for (let i2 = 0; i2 < this.path.length; i2++) {
|
|
10831
|
+
const node = this.path[i2];
|
|
11969
10832
|
node.shouldResetTransform = true;
|
|
11970
10833
|
node.updateScroll("snapshot");
|
|
11971
10834
|
if (node.options.layoutRoot) {
|
|
@@ -12050,8 +10913,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
12050
10913
|
return;
|
|
12051
10914
|
}
|
|
12052
10915
|
if (this.resumeFrom && !this.resumeFrom.instance) {
|
|
12053
|
-
for (let
|
|
12054
|
-
const node = this.path[
|
|
10916
|
+
for (let i2 = 0; i2 < this.path.length; i2++) {
|
|
10917
|
+
const node = this.path[i2];
|
|
12055
10918
|
node.updateScroll();
|
|
12056
10919
|
}
|
|
12057
10920
|
}
|
|
@@ -12132,8 +10995,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
12132
10995
|
if ((_a = this.scroll) == null ? void 0 : _a.wasRoot) {
|
|
12133
10996
|
return boxWithoutScroll;
|
|
12134
10997
|
}
|
|
12135
|
-
for (let
|
|
12136
|
-
const node = this.path[
|
|
10998
|
+
for (let i2 = 0; i2 < this.path.length; i2++) {
|
|
10999
|
+
const node = this.path[i2];
|
|
12137
11000
|
const { scroll, options } = node;
|
|
12138
11001
|
if (node !== this.root && scroll && options.layoutScroll) {
|
|
12139
11002
|
if (scroll.wasRoot) {
|
|
@@ -12148,8 +11011,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
12148
11011
|
applyTransform(box, transformOnly = false) {
|
|
12149
11012
|
const withTransforms = createBox();
|
|
12150
11013
|
copyBoxInto(withTransforms, box);
|
|
12151
|
-
for (let
|
|
12152
|
-
const node = this.path[
|
|
11014
|
+
for (let i2 = 0; i2 < this.path.length; i2++) {
|
|
11015
|
+
const node = this.path[i2];
|
|
12153
11016
|
if (!transformOnly && node.options.layoutScroll && node.scroll && node !== node.root) {
|
|
12154
11017
|
transformBox(withTransforms, {
|
|
12155
11018
|
x: -node.scroll.offset.x,
|
|
@@ -12168,8 +11031,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
12168
11031
|
removeTransform(box) {
|
|
12169
11032
|
const boxWithoutTransform = createBox();
|
|
12170
11033
|
copyBoxInto(boxWithoutTransform, box);
|
|
12171
|
-
for (let
|
|
12172
|
-
const node = this.path[
|
|
11034
|
+
for (let i2 = 0; i2 < this.path.length; i2++) {
|
|
11035
|
+
const node = this.path[i2];
|
|
12173
11036
|
if (!node.instance)
|
|
12174
11037
|
continue;
|
|
12175
11038
|
if (!hasTransform(node.latestValues))
|
|
@@ -12535,9 +11398,9 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
12535
11398
|
if (latestValues.z) {
|
|
12536
11399
|
resetDistortingTransform("z", visualElement, resetValues, this.animationValues);
|
|
12537
11400
|
}
|
|
12538
|
-
for (let
|
|
12539
|
-
resetDistortingTransform(`rotate${transformAxes[
|
|
12540
|
-
resetDistortingTransform(`skew${transformAxes[
|
|
11401
|
+
for (let i2 = 0; i2 < transformAxes.length; i2++) {
|
|
11402
|
+
resetDistortingTransform(`rotate${transformAxes[i2]}`, visualElement, resetValues, this.animationValues);
|
|
11403
|
+
resetDistortingTransform(`skew${transformAxes[i2]}`, visualElement, resetValues, this.animationValues);
|
|
12541
11404
|
}
|
|
12542
11405
|
visualElement.render();
|
|
12543
11406
|
for (const key in resetValues) {
|
|
@@ -12584,8 +11447,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
12584
11447
|
if (transformTemplate) {
|
|
12585
11448
|
styles2.transform = transformTemplate(valuesToRender, styles2.transform);
|
|
12586
11449
|
}
|
|
12587
|
-
const { x, y } = this.projectionDelta;
|
|
12588
|
-
styles2.transformOrigin = `${
|
|
11450
|
+
const { x: x2, y: y2 } = this.projectionDelta;
|
|
11451
|
+
styles2.transformOrigin = `${x2.origin * 100}% ${y2.origin * 100}% 0`;
|
|
12589
11452
|
if (lead.animationValues) {
|
|
12590
11453
|
styles2.opacity = lead === this ? valuesToRender.opacity ?? this.latestValues.opacity ?? 1 : this.preserveOpacity ? this.latestValues.opacity : valuesToRender.opacityExit;
|
|
12591
11454
|
} else {
|
|
@@ -12598,8 +11461,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro
|
|
|
12598
11461
|
const corrected = styles2.transform === "none" ? valuesToRender[key] : correct(valuesToRender[key], lead);
|
|
12599
11462
|
if (applyTo) {
|
|
12600
11463
|
const num = applyTo.length;
|
|
12601
|
-
for (let
|
|
12602
|
-
styles2[applyTo[
|
|
11464
|
+
for (let i2 = 0; i2 < num; i2++) {
|
|
11465
|
+
styles2[applyTo[i2]] = corrected;
|
|
12603
11466
|
}
|
|
12604
11467
|
} else {
|
|
12605
11468
|
if (isCSSVariable) {
|
|
@@ -12745,19 +11608,19 @@ function resetSkewAndRotation(node) {
|
|
|
12745
11608
|
function removeLeadSnapshots(stack) {
|
|
12746
11609
|
stack.removeLeadSnapshot();
|
|
12747
11610
|
}
|
|
12748
|
-
function mixAxisDelta(output, delta,
|
|
12749
|
-
output.translate = mixNumber$1(delta.translate, 0,
|
|
12750
|
-
output.scale = mixNumber$1(delta.scale, 1,
|
|
11611
|
+
function mixAxisDelta(output, delta, p2) {
|
|
11612
|
+
output.translate = mixNumber$1(delta.translate, 0, p2);
|
|
11613
|
+
output.scale = mixNumber$1(delta.scale, 1, p2);
|
|
12751
11614
|
output.origin = delta.origin;
|
|
12752
11615
|
output.originPoint = delta.originPoint;
|
|
12753
11616
|
}
|
|
12754
|
-
function mixAxis(output, from, to,
|
|
12755
|
-
output.min = mixNumber$1(from.min, to.min,
|
|
12756
|
-
output.max = mixNumber$1(from.max, to.max,
|
|
11617
|
+
function mixAxis(output, from, to, p2) {
|
|
11618
|
+
output.min = mixNumber$1(from.min, to.min, p2);
|
|
11619
|
+
output.max = mixNumber$1(from.max, to.max, p2);
|
|
12757
11620
|
}
|
|
12758
|
-
function mixBox(output, from, to,
|
|
12759
|
-
mixAxis(output.x, from.x, to.x,
|
|
12760
|
-
mixAxis(output.y, from.y, to.y,
|
|
11621
|
+
function mixBox(output, from, to, p2) {
|
|
11622
|
+
mixAxis(output.x, from.x, to.x, p2);
|
|
11623
|
+
mixAxis(output.y, from.y, to.y, p2);
|
|
12761
11624
|
}
|
|
12762
11625
|
function hasOpacityCrossfade(node) {
|
|
12763
11626
|
return node.animationValues && node.animationValues.opacityExit !== void 0;
|
|
@@ -12902,7 +11765,7 @@ class FocusGesture extends Feature {
|
|
|
12902
11765
|
let isFocusVisible = false;
|
|
12903
11766
|
try {
|
|
12904
11767
|
isFocusVisible = this.node.current.matches(":focus-visible");
|
|
12905
|
-
} catch (
|
|
11768
|
+
} catch (e2) {
|
|
12906
11769
|
isFocusVisible = true;
|
|
12907
11770
|
}
|
|
12908
11771
|
if (!isFocusVisible || !this.node.animationState)
|
|
@@ -13396,8 +12259,8 @@ class VisualElement {
|
|
|
13396
12259
|
this.props = props;
|
|
13397
12260
|
this.prevPresenceContext = this.presenceContext;
|
|
13398
12261
|
this.presenceContext = presenceContext;
|
|
13399
|
-
for (let
|
|
13400
|
-
const key = propEventHandlers[
|
|
12262
|
+
for (let i2 = 0; i2 < propEventHandlers.length; i2++) {
|
|
12263
|
+
const key = propEventHandlers[i2];
|
|
13401
12264
|
if (this.propEventSubscriptions[key]) {
|
|
13402
12265
|
this.propEventSubscriptions[key]();
|
|
13403
12266
|
delete this.propEventSubscriptions[key];
|
|
@@ -13551,8 +12414,8 @@ class DOMVisualElement extends VisualElement {
|
|
|
13551
12414
|
super(...arguments);
|
|
13552
12415
|
this.KeyframeResolver = DOMKeyframesResolver;
|
|
13553
12416
|
}
|
|
13554
|
-
sortInstanceNodePosition(
|
|
13555
|
-
return
|
|
12417
|
+
sortInstanceNodePosition(a2, b2) {
|
|
12418
|
+
return a2.compareDocumentPosition(b2) & 2 ? 1 : -1;
|
|
13556
12419
|
}
|
|
13557
12420
|
getBaseTargetFromProps(props, key) {
|
|
13558
12421
|
return props.style ? props.style[key] : void 0;
|
|
@@ -13717,8 +12580,8 @@ function useListTransform(values, transformer) {
|
|
|
13717
12580
|
return useCombineMotionValues(values, () => {
|
|
13718
12581
|
latest.length = 0;
|
|
13719
12582
|
const numValues = values.length;
|
|
13720
|
-
for (let
|
|
13721
|
-
latest[
|
|
12583
|
+
for (let i2 = 0; i2 < numValues; i2++) {
|
|
12584
|
+
latest[i2] = values[i2].get();
|
|
13722
12585
|
}
|
|
13723
12586
|
return transformer(latest);
|
|
13724
12587
|
});
|
|
@@ -13735,8 +12598,8 @@ const wrap = (min, max, v2) => {
|
|
|
13735
12598
|
const rangeSize = max - min;
|
|
13736
12599
|
return ((v2 - min) % rangeSize + rangeSize) % rangeSize + min;
|
|
13737
12600
|
};
|
|
13738
|
-
function getEasingForSegment(easing,
|
|
13739
|
-
return isEasingArray(easing) ? easing[wrap(0, easing.length,
|
|
12601
|
+
function getEasingForSegment(easing, i2) {
|
|
12602
|
+
return isEasingArray(easing) ? easing[wrap(0, easing.length, i2)] : easing;
|
|
13740
12603
|
}
|
|
13741
12604
|
function isDOMKeyframes(keyframes2) {
|
|
13742
12605
|
return typeof keyframes2 === "object" && !Array.isArray(keyframes2);
|
|
@@ -13767,38 +12630,38 @@ function calcNextTime(current, next, prev, labels) {
|
|
|
13767
12630
|
}
|
|
13768
12631
|
}
|
|
13769
12632
|
function eraseKeyframes(sequence, startTime, endTime) {
|
|
13770
|
-
for (let
|
|
13771
|
-
const keyframe = sequence[
|
|
12633
|
+
for (let i2 = 0; i2 < sequence.length; i2++) {
|
|
12634
|
+
const keyframe = sequence[i2];
|
|
13772
12635
|
if (keyframe.at > startTime && keyframe.at < endTime) {
|
|
13773
12636
|
removeItem(sequence, keyframe);
|
|
13774
|
-
|
|
12637
|
+
i2--;
|
|
13775
12638
|
}
|
|
13776
12639
|
}
|
|
13777
12640
|
}
|
|
13778
12641
|
function addKeyframes(sequence, keyframes2, easing, offset, startTime, endTime) {
|
|
13779
12642
|
eraseKeyframes(sequence, startTime, endTime);
|
|
13780
|
-
for (let
|
|
12643
|
+
for (let i2 = 0; i2 < keyframes2.length; i2++) {
|
|
13781
12644
|
sequence.push({
|
|
13782
|
-
value: keyframes2[
|
|
13783
|
-
at: mixNumber$1(startTime, endTime, offset[
|
|
13784
|
-
easing: getEasingForSegment(easing,
|
|
12645
|
+
value: keyframes2[i2],
|
|
12646
|
+
at: mixNumber$1(startTime, endTime, offset[i2]),
|
|
12647
|
+
easing: getEasingForSegment(easing, i2)
|
|
13785
12648
|
});
|
|
13786
12649
|
}
|
|
13787
12650
|
}
|
|
13788
12651
|
function normalizeTimes(times, repeat) {
|
|
13789
|
-
for (let
|
|
13790
|
-
times[
|
|
12652
|
+
for (let i2 = 0; i2 < times.length; i2++) {
|
|
12653
|
+
times[i2] = times[i2] / (repeat + 1);
|
|
13791
12654
|
}
|
|
13792
12655
|
}
|
|
13793
|
-
function compareByTime(
|
|
13794
|
-
if (
|
|
13795
|
-
if (
|
|
12656
|
+
function compareByTime(a2, b2) {
|
|
12657
|
+
if (a2.at === b2.at) {
|
|
12658
|
+
if (a2.value === null)
|
|
13796
12659
|
return 1;
|
|
13797
|
-
if (
|
|
12660
|
+
if (b2.value === null)
|
|
13798
12661
|
return -1;
|
|
13799
12662
|
return 0;
|
|
13800
12663
|
} else {
|
|
13801
|
-
return
|
|
12664
|
+
return a2.at - b2.at;
|
|
13802
12665
|
}
|
|
13803
12666
|
}
|
|
13804
12667
|
const defaultSegmentEasing = "easeInOut";
|
|
@@ -13812,8 +12675,8 @@ function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...seq
|
|
|
13812
12675
|
let prevTime = 0;
|
|
13813
12676
|
let currentTime = 0;
|
|
13814
12677
|
let totalDuration = 0;
|
|
13815
|
-
for (let
|
|
13816
|
-
const segment = sequence[
|
|
12678
|
+
for (let i2 = 0; i2 < sequence.length; i2++) {
|
|
12679
|
+
const segment = sequence[i2];
|
|
13817
12680
|
if (typeof segment === "string") {
|
|
13818
12681
|
timeLabels.set(segment, currentTime);
|
|
13819
12682
|
continue;
|
|
@@ -13902,8 +12765,8 @@ function createAnimationsFromSequence(sequence, { defaultTransition = {}, ...seq
|
|
|
13902
12765
|
const keyframes2 = [];
|
|
13903
12766
|
const valueOffset = [];
|
|
13904
12767
|
const valueEasing = [];
|
|
13905
|
-
for (let
|
|
13906
|
-
const { at, value, easing } = valueSequence[
|
|
12768
|
+
for (let i2 = 0; i2 < valueSequence.length; i2++) {
|
|
12769
|
+
const { at, value, easing } = valueSequence[i2];
|
|
13907
12770
|
keyframes2.push(value);
|
|
13908
12771
|
valueOffset.push(/* @__PURE__ */ progress(0, totalDuration, at));
|
|
13909
12772
|
valueEasing.push(easing || "easeOut");
|
|
@@ -14037,8 +12900,8 @@ function animateSubject(subject, keyframes2, options, scope) {
|
|
|
14037
12900
|
const subjects = resolveSubjects(subject, keyframes2, scope);
|
|
14038
12901
|
const numSubjects = subjects.length;
|
|
14039
12902
|
invariant(Boolean(numSubjects), "No valid elements provided.");
|
|
14040
|
-
for (let
|
|
14041
|
-
const thisSubject = subjects[
|
|
12903
|
+
for (let i2 = 0; i2 < numSubjects; i2++) {
|
|
12904
|
+
const thisSubject = subjects[i2];
|
|
14042
12905
|
const createVisualElement = thisSubject instanceof Element ? createDOMVisualElement : createObjectVisualElement;
|
|
14043
12906
|
if (!visualElementStore.has(thisSubject)) {
|
|
14044
12907
|
createVisualElement(thisSubject);
|
|
@@ -14046,7 +12909,7 @@ function animateSubject(subject, keyframes2, options, scope) {
|
|
|
14046
12909
|
const visualElement = visualElementStore.get(thisSubject);
|
|
14047
12910
|
const transition = { ...options };
|
|
14048
12911
|
if ("delay" in transition && typeof transition.delay === "function") {
|
|
14049
|
-
transition.delay = transition.delay(
|
|
12912
|
+
transition.delay = transition.delay(i2, numSubjects);
|
|
14050
12913
|
}
|
|
14051
12914
|
animations2.push(...animateTarget(visualElement, { ...keyframes2, transition }, {}));
|
|
14052
12915
|
}
|
|
@@ -14092,7 +12955,7 @@ const DEFAULT_DRAG_CLOSE_THRESHOLD = 0.6;
|
|
|
14092
12955
|
const DEFAULT_DRAG_VELOCITY_THRESHOLD = 500;
|
|
14093
12956
|
const useIsomorphicLayoutEffect = IS_SSR ? React.useEffect : React.useLayoutEffect;
|
|
14094
12957
|
function useModalEffect({
|
|
14095
|
-
y,
|
|
12958
|
+
y: y2,
|
|
14096
12959
|
rootId,
|
|
14097
12960
|
sheetRef
|
|
14098
12961
|
}) {
|
|
@@ -14133,36 +12996,36 @@ function useModalEffect({
|
|
|
14133
12996
|
const root = document.querySelector(`#${rootId}`);
|
|
14134
12997
|
if (!root) return;
|
|
14135
12998
|
function onCompleted() {
|
|
14136
|
-
if (
|
|
12999
|
+
if (y2.get() - 10 >= heightRef.current) cleanup();
|
|
14137
13000
|
}
|
|
14138
|
-
const removeStartListener =
|
|
13001
|
+
const removeStartListener = y2.on("animationStart", () => {
|
|
14139
13002
|
var _a;
|
|
14140
13003
|
heightRef.current = ((_a = sheetRef.current) == null ? void 0 : _a.offsetHeight) || window.innerHeight;
|
|
14141
13004
|
setup();
|
|
14142
13005
|
});
|
|
14143
|
-
const removeChangeListener =
|
|
13006
|
+
const removeChangeListener = y2.on("change", (value) => {
|
|
14144
13007
|
if (root) {
|
|
14145
13008
|
const progress2 = Math.max(0, 1 - value / heightRef.current);
|
|
14146
13009
|
const pageWidth = window.innerWidth;
|
|
14147
13010
|
const scale2 = (pageWidth - 16) / pageWidth;
|
|
14148
13011
|
const ty = transform(progress2, [0, 1], [0, 24]);
|
|
14149
|
-
const
|
|
13012
|
+
const s2 = transform(progress2, [0, 1], [1, scale2]);
|
|
14150
13013
|
const borderRadius = transform(progress2, [0, 1], [0, 10]);
|
|
14151
13014
|
const inset = "env(safe-area-inset-top)";
|
|
14152
|
-
root.style.transform = `scale(${
|
|
13015
|
+
root.style.transform = `scale(${s2}) translate3d(0, calc(${inset} + ${ty}px), 0)`;
|
|
14153
13016
|
root.style.borderTopRightRadius = `${borderRadius}px`;
|
|
14154
13017
|
root.style.borderTopLeftRadius = `${borderRadius}px`;
|
|
14155
13018
|
}
|
|
14156
13019
|
});
|
|
14157
|
-
const removeCompleteListener =
|
|
14158
|
-
const removeCancelListener =
|
|
13020
|
+
const removeCompleteListener = y2.on("animationComplete", onCompleted);
|
|
13021
|
+
const removeCancelListener = y2.on("animationCancel", onCompleted);
|
|
14159
13022
|
return () => {
|
|
14160
13023
|
removeStartListener();
|
|
14161
13024
|
removeChangeListener();
|
|
14162
13025
|
removeCompleteListener();
|
|
14163
13026
|
removeCancelListener();
|
|
14164
13027
|
};
|
|
14165
|
-
}, [
|
|
13028
|
+
}, [y2, rootId]);
|
|
14166
13029
|
}
|
|
14167
13030
|
function useEventCallbacks(isOpen, callbacks) {
|
|
14168
13031
|
const prevOpen = usePrevious(isOpen);
|
|
@@ -14256,18 +13119,18 @@ const useSheetScrollerContext = () => {
|
|
|
14256
13119
|
function getClosest(nums, goal) {
|
|
14257
13120
|
let closest = nums[0];
|
|
14258
13121
|
let minDifference = Math.abs(nums[0] - goal);
|
|
14259
|
-
for (let
|
|
14260
|
-
const difference = Math.abs(nums[
|
|
13122
|
+
for (let i2 = 1; i2 < nums.length; i2++) {
|
|
13123
|
+
const difference = Math.abs(nums[i2] - goal);
|
|
14261
13124
|
if (difference < minDifference) {
|
|
14262
|
-
closest = nums[
|
|
13125
|
+
closest = nums[i2];
|
|
14263
13126
|
minDifference = difference;
|
|
14264
13127
|
}
|
|
14265
13128
|
}
|
|
14266
13129
|
return closest;
|
|
14267
13130
|
}
|
|
14268
13131
|
function inDescendingOrder(arr) {
|
|
14269
|
-
for (let
|
|
14270
|
-
if (arr[
|
|
13132
|
+
for (let i2 = 0; i2 < arr.length; i2++) {
|
|
13133
|
+
if (arr[i2 + 1] > arr[i2]) return false;
|
|
14271
13134
|
}
|
|
14272
13135
|
return true;
|
|
14273
13136
|
}
|
|
@@ -14297,9 +13160,9 @@ function isTouchDevice() {
|
|
|
14297
13160
|
if (typeof window === "undefined") return false;
|
|
14298
13161
|
return "ontouchstart" in window || navigator.maxTouchPoints > 0;
|
|
14299
13162
|
}
|
|
14300
|
-
function testPlatform(
|
|
13163
|
+
function testPlatform(re2) {
|
|
14301
13164
|
var _a;
|
|
14302
|
-
return typeof window !== "undefined" && window.navigator != null ?
|
|
13165
|
+
return typeof window !== "undefined" && window.navigator != null ? re2.test(
|
|
14303
13166
|
// @ts-expect-error
|
|
14304
13167
|
((_a = window.navigator.userAgentData) == null ? void 0 : _a.platform) || window.navigator.platform
|
|
14305
13168
|
) : false;
|
|
@@ -14408,39 +13271,39 @@ function preventScrollStandard() {
|
|
|
14408
13271
|
function preventScrollMobileSafari() {
|
|
14409
13272
|
let scrollable;
|
|
14410
13273
|
let lastY = 0;
|
|
14411
|
-
const onTouchStart = (
|
|
13274
|
+
const onTouchStart = (e2) => {
|
|
14412
13275
|
var _a;
|
|
14413
|
-
const target = (_a =
|
|
13276
|
+
const target = (_a = e2.composedPath()) == null ? void 0 : _a[0];
|
|
14414
13277
|
scrollable = getScrollParent(target, true);
|
|
14415
13278
|
if (scrollable === document.documentElement && scrollable === document.body) {
|
|
14416
13279
|
return;
|
|
14417
13280
|
}
|
|
14418
|
-
lastY =
|
|
13281
|
+
lastY = e2.changedTouches[0].pageY;
|
|
14419
13282
|
};
|
|
14420
|
-
const onTouchMove = (
|
|
13283
|
+
const onTouchMove = (e2) => {
|
|
14421
13284
|
if (scrollable === void 0) {
|
|
14422
13285
|
return;
|
|
14423
13286
|
}
|
|
14424
13287
|
if (!scrollable || scrollable === document.documentElement || scrollable === document.body) {
|
|
14425
|
-
|
|
13288
|
+
e2.preventDefault();
|
|
14426
13289
|
return;
|
|
14427
13290
|
}
|
|
14428
|
-
const
|
|
13291
|
+
const y2 = e2.changedTouches[0].pageY;
|
|
14429
13292
|
const scrollTop = scrollable.scrollTop;
|
|
14430
13293
|
const bottom = scrollable.scrollHeight - scrollable.clientHeight;
|
|
14431
13294
|
if (bottom === 0) {
|
|
14432
13295
|
return;
|
|
14433
13296
|
}
|
|
14434
|
-
if (scrollTop <= 0 &&
|
|
14435
|
-
|
|
13297
|
+
if (scrollTop <= 0 && y2 > lastY || scrollTop >= bottom && y2 < lastY) {
|
|
13298
|
+
e2.preventDefault();
|
|
14436
13299
|
}
|
|
14437
|
-
lastY =
|
|
13300
|
+
lastY = y2;
|
|
14438
13301
|
};
|
|
14439
|
-
const onTouchEnd = (
|
|
13302
|
+
const onTouchEnd = (e2) => {
|
|
14440
13303
|
var _a;
|
|
14441
|
-
const target = (_a =
|
|
13304
|
+
const target = (_a = e2.composedPath()) == null ? void 0 : _a[0];
|
|
14442
13305
|
if (willOpenKeyboard(target) && target !== document.activeElement) {
|
|
14443
|
-
|
|
13306
|
+
e2.preventDefault();
|
|
14444
13307
|
target.style.transform = "translateY(-2000px)";
|
|
14445
13308
|
target.focus();
|
|
14446
13309
|
requestAnimationFrame(() => {
|
|
@@ -14448,9 +13311,9 @@ function preventScrollMobileSafari() {
|
|
|
14448
13311
|
});
|
|
14449
13312
|
}
|
|
14450
13313
|
};
|
|
14451
|
-
const onFocus = (
|
|
13314
|
+
const onFocus = (e2) => {
|
|
14452
13315
|
var _a;
|
|
14453
|
-
const target = (_a =
|
|
13316
|
+
const target = (_a = e2.composedPath()) == null ? void 0 : _a[0];
|
|
14454
13317
|
if (willOpenKeyboard(target)) {
|
|
14455
13318
|
target.style.transform = "translateY(-2000px)";
|
|
14456
13319
|
requestAnimationFrame(() => {
|
|
@@ -14639,9 +13502,9 @@ const Sheet$1 = React.forwardRef(
|
|
|
14639
13502
|
type: "tween",
|
|
14640
13503
|
...reduceMotion ? REDUCED_MOTION_TWEEN_CONFIG : tweenConfig
|
|
14641
13504
|
};
|
|
14642
|
-
const
|
|
14643
|
-
const zIndex2 = useTransform(
|
|
14644
|
-
const visibility = useTransform(
|
|
13505
|
+
const y2 = useMotionValue(windowHeight);
|
|
13506
|
+
const zIndex2 = useTransform(y2, (value) => value + 2 >= windowHeight ? -1 : (style == null ? void 0 : style.zIndex) ?? 1300);
|
|
13507
|
+
const visibility = useTransform(y2, (value) => value + 2 >= windowHeight ? "hidden" : "visible");
|
|
14645
13508
|
const callbacks = React.useRef({
|
|
14646
13509
|
onOpenStart,
|
|
14647
13510
|
onOpenEnd,
|
|
@@ -14667,11 +13530,11 @@ const Sheet$1 = React.forwardRef(
|
|
|
14667
13530
|
`Snap points need to be in descending order got: [${snapPoints.join(", ")}]`
|
|
14668
13531
|
);
|
|
14669
13532
|
}
|
|
14670
|
-
const onDrag = useEffectEvent((
|
|
14671
|
-
const velocity =
|
|
13533
|
+
const onDrag = useEffectEvent((_2, { delta }) => {
|
|
13534
|
+
const velocity = y2.getVelocity();
|
|
14672
13535
|
if (velocity > 0) indicatorRotation.set(10);
|
|
14673
13536
|
if (velocity < 0) indicatorRotation.set(-10);
|
|
14674
|
-
|
|
13537
|
+
y2.set(Math.max(y2.get() + delta.y, 0));
|
|
14675
13538
|
});
|
|
14676
13539
|
const onDragStart = useEffectEvent(() => {
|
|
14677
13540
|
const focusedElement = document.activeElement;
|
|
@@ -14681,15 +13544,15 @@ const Sheet$1 = React.forwardRef(
|
|
|
14681
13544
|
focusedElement.blur();
|
|
14682
13545
|
}
|
|
14683
13546
|
});
|
|
14684
|
-
const onDragEnd = useEffectEvent((
|
|
13547
|
+
const onDragEnd = useEffectEvent((_2, { velocity }) => {
|
|
14685
13548
|
if (velocity.y > dragVelocityThreshold) {
|
|
14686
13549
|
onClose();
|
|
14687
13550
|
} else {
|
|
14688
13551
|
const sheetHeight = sheetRef.current.getBoundingClientRect().height;
|
|
14689
|
-
const currentY =
|
|
13552
|
+
const currentY = y2.get();
|
|
14690
13553
|
let snapTo = 0;
|
|
14691
13554
|
if (snapPoints) {
|
|
14692
|
-
const snapToValues = snapPoints.map((
|
|
13555
|
+
const snapToValues = snapPoints.map((p2) => sheetHeight - Math.min(p2, sheetHeight));
|
|
14693
13556
|
if (detent === "content-height" && !snapToValues.includes(0)) {
|
|
14694
13557
|
snapToValues.unshift(0);
|
|
14695
13558
|
}
|
|
@@ -14698,7 +13561,7 @@ const Sheet$1 = React.forwardRef(
|
|
|
14698
13561
|
snapTo = sheetHeight;
|
|
14699
13562
|
}
|
|
14700
13563
|
snapTo = validateSnapTo({ snapTo, sheetHeight });
|
|
14701
|
-
animate(
|
|
13564
|
+
animate(y2, snapTo, animationOptions);
|
|
14702
13565
|
if (snapPoints && onSnap) {
|
|
14703
13566
|
const snapValue = Math.abs(Math.round(snapPoints[0] - snapTo));
|
|
14704
13567
|
const snapIndex = snapPoints.indexOf(getClosest(snapPoints, snapValue));
|
|
@@ -14716,7 +13579,7 @@ const Sheet$1 = React.forwardRef(
|
|
|
14716
13579
|
onSnap(snapIndex);
|
|
14717
13580
|
}, [isOpen]);
|
|
14718
13581
|
React.useImperativeHandle(ref, () => ({
|
|
14719
|
-
y,
|
|
13582
|
+
y: y2,
|
|
14720
13583
|
snapTo: (snapIndex) => {
|
|
14721
13584
|
const sheetEl = sheetRef.current;
|
|
14722
13585
|
if ((snapPoints == null ? void 0 : snapPoints[snapIndex]) !== void 0 && sheetEl) {
|
|
@@ -14726,14 +13589,14 @@ const Sheet$1 = React.forwardRef(
|
|
|
14726
13589
|
snapTo: sheetHeight - snapPoint,
|
|
14727
13590
|
sheetHeight
|
|
14728
13591
|
});
|
|
14729
|
-
animate(
|
|
13592
|
+
animate(y2, snapTo, animationOptions);
|
|
14730
13593
|
if (onSnap) onSnap(snapIndex);
|
|
14731
13594
|
if (snapTo >= sheetHeight) onClose();
|
|
14732
13595
|
}
|
|
14733
13596
|
}
|
|
14734
13597
|
}));
|
|
14735
13598
|
useModalEffect({
|
|
14736
|
-
y,
|
|
13599
|
+
y: y2,
|
|
14737
13600
|
rootId,
|
|
14738
13601
|
sheetRef
|
|
14739
13602
|
});
|
|
@@ -14751,7 +13614,7 @@ const Sheet$1 = React.forwardRef(
|
|
|
14751
13614
|
return disableDrag ? void 0 : dragProps2;
|
|
14752
13615
|
}, [disableDrag, windowHeight]);
|
|
14753
13616
|
const context2 = {
|
|
14754
|
-
y,
|
|
13617
|
+
y: y2,
|
|
14755
13618
|
sheetRef,
|
|
14756
13619
|
isOpen,
|
|
14757
13620
|
initialSnap,
|
|
@@ -14765,7 +13628,7 @@ const Sheet$1 = React.forwardRef(
|
|
|
14765
13628
|
reduceMotion,
|
|
14766
13629
|
disableDrag
|
|
14767
13630
|
};
|
|
14768
|
-
const sheet = /* @__PURE__ */ jsxRuntime.jsx(SheetContext.Provider, { value: context2, children: /* @__PURE__ */ jsxRuntime.jsx(motion.div, { ...rest, ref, style: { ...styles.wrapper, zIndex: zIndex2, visibility, ...style }, children: /* @__PURE__ */ jsxRuntime.jsx(AnimatePresence, { children: isOpen ? /* @__PURE__ */ jsxRuntime.jsx(SheetScrollerContextProvider, { children: React.Children.map(children, (child,
|
|
13631
|
+
const sheet = /* @__PURE__ */ jsxRuntime.jsx(SheetContext.Provider, { value: context2, children: /* @__PURE__ */ jsxRuntime.jsx(motion.div, { ...rest, ref, style: { ...styles.wrapper, zIndex: zIndex2, visibility, ...style }, children: /* @__PURE__ */ jsxRuntime.jsx(AnimatePresence, { children: isOpen ? /* @__PURE__ */ jsxRuntime.jsx(SheetScrollerContextProvider, { children: React.Children.map(children, (child, i2) => React.cloneElement(child, { key: `sheet-child-${i2}` })) }) : null }) }) });
|
|
14769
13632
|
if (IS_SSR) return sheet;
|
|
14770
13633
|
return reactDom.createPortal(sheet, mountPoint ?? document.body);
|
|
14771
13634
|
}
|
|
@@ -14774,7 +13637,7 @@ Sheet$1.displayName = "Sheet";
|
|
|
14774
13637
|
const SheetContainer = React.forwardRef(
|
|
14775
13638
|
({ children, style = {}, className = "", ...rest }, ref) => {
|
|
14776
13639
|
const {
|
|
14777
|
-
y,
|
|
13640
|
+
y: y2,
|
|
14778
13641
|
isOpen,
|
|
14779
13642
|
callbacks,
|
|
14780
13643
|
snapPoints,
|
|
@@ -14800,7 +13663,7 @@ const SheetContainer = React.forwardRef(
|
|
|
14800
13663
|
...style,
|
|
14801
13664
|
...detent === "full-height" && { height },
|
|
14802
13665
|
...detent === "content-height" && { maxHeight: height },
|
|
14803
|
-
y
|
|
13666
|
+
y: y2
|
|
14804
13667
|
},
|
|
14805
13668
|
initial: reduceMotion ? false : { y: windowHeight },
|
|
14806
13669
|
animate: { y: initialY, transition: animationOptions },
|
|
@@ -14903,16 +13766,16 @@ const SheetScroller = React.forwardRef(
|
|
|
14903
13766
|
sheetScrollerContext.setDragDisabled();
|
|
14904
13767
|
}
|
|
14905
13768
|
}
|
|
14906
|
-
function onScroll(
|
|
14907
|
-
determineDragState(
|
|
13769
|
+
function onScroll(e2) {
|
|
13770
|
+
determineDragState(e2.currentTarget);
|
|
14908
13771
|
if (rest.onScroll) {
|
|
14909
|
-
rest.onScroll(
|
|
13772
|
+
rest.onScroll(e2);
|
|
14910
13773
|
}
|
|
14911
13774
|
}
|
|
14912
|
-
function onTouchStart(
|
|
14913
|
-
determineDragState(
|
|
13775
|
+
function onTouchStart(e2) {
|
|
13776
|
+
determineDragState(e2.currentTarget);
|
|
14914
13777
|
if (rest.onTouchStart) {
|
|
14915
|
-
rest.onTouchStart(
|
|
13778
|
+
rest.onTouchStart(e2);
|
|
14916
13779
|
}
|
|
14917
13780
|
}
|
|
14918
13781
|
const scrollProps = isTouchDevice() ? { onScroll, onTouchStart } : void 0;
|
|
@@ -15089,7 +13952,7 @@ BottomSheet.Handle = Handle;
|
|
|
15089
13952
|
BottomSheet.Scroller = Sheet.Scroller;
|
|
15090
13953
|
const navigationRecipe = sva({
|
|
15091
13954
|
className: "navigation",
|
|
15092
|
-
slots: anatomy
|
|
13955
|
+
slots: anatomy.keys(),
|
|
15093
13956
|
base: {
|
|
15094
13957
|
root: {
|
|
15095
13958
|
bg: "surface.layer_1",
|
|
@@ -15130,16 +13993,16 @@ const navigationRecipe = sva({
|
|
|
15130
13993
|
}
|
|
15131
13994
|
}
|
|
15132
13995
|
});
|
|
15133
|
-
const { withRootProvider: withRootProvider$1, withContext: withContext$
|
|
13996
|
+
const { withRootProvider: withRootProvider$1, withContext: withContext$1 } = createStyleContext(navigationRecipe);
|
|
15134
13997
|
const Root$2 = withRootProvider$1(TabsRoot);
|
|
15135
|
-
const Trigger$1 = withContext$
|
|
13998
|
+
const Trigger$1 = withContext$1(
|
|
15136
13999
|
({ icon, label, ...props }) => /* @__PURE__ */ jsxRuntime.jsxs(TabTrigger, { ...props, children: [
|
|
15137
14000
|
icon,
|
|
15138
14001
|
label
|
|
15139
14002
|
] }),
|
|
15140
14003
|
"trigger"
|
|
15141
14004
|
);
|
|
15142
|
-
const List$1 = withContext$
|
|
14005
|
+
const List$1 = withContext$1(TabList, "list");
|
|
15143
14006
|
const Navigation = {
|
|
15144
14007
|
Root: Root$2,
|
|
15145
14008
|
Item: Trigger$1,
|
|
@@ -15268,18 +14131,18 @@ const tagRecipe = cva({
|
|
|
15268
14131
|
avatar: false
|
|
15269
14132
|
}
|
|
15270
14133
|
});
|
|
15271
|
-
function P({ size:
|
|
14134
|
+
function P$1({ size: C2 = 24, color: n2 = "currentColor", ...o2 }) {
|
|
15272
14135
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15273
14136
|
"svg",
|
|
15274
14137
|
{
|
|
15275
|
-
width:
|
|
15276
|
-
height:
|
|
14138
|
+
width: C2,
|
|
14139
|
+
height: C2,
|
|
15277
14140
|
viewBox: "0 0 24 24",
|
|
15278
14141
|
fill: "none",
|
|
15279
14142
|
xmlns: "http://www.w3.org/2000/svg",
|
|
15280
14143
|
strokeWidth: "0",
|
|
15281
|
-
color:
|
|
15282
|
-
...
|
|
14144
|
+
color: n2,
|
|
14145
|
+
...o2,
|
|
15283
14146
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
15284
14147
|
"path",
|
|
15285
14148
|
{
|
|
@@ -15295,8 +14158,8 @@ function P({ size: C = 24, color: n = "currentColor", ...o }) {
|
|
|
15295
14158
|
}
|
|
15296
14159
|
const Tag = React.forwardRef(({ imageSrc, text, onDeleteClick, ...rest }, ref) => {
|
|
15297
14160
|
const StyledTag = styled(ark.div, tagRecipe);
|
|
15298
|
-
const handleClickDelete = (
|
|
15299
|
-
|
|
14161
|
+
const handleClickDelete = (e2) => {
|
|
14162
|
+
e2.stopPropagation();
|
|
15300
14163
|
if (onDeleteClick) {
|
|
15301
14164
|
onDeleteClick();
|
|
15302
14165
|
}
|
|
@@ -15311,7 +14174,7 @@ const Tag = React.forwardRef(({ imageSrc, text, onDeleteClick, ...rest }, ref) =
|
|
|
15311
14174
|
}
|
|
15312
14175
|
) : null,
|
|
15313
14176
|
text,
|
|
15314
|
-
onDeleteClick ? /* @__PURE__ */ jsxRuntime.jsx(P, { size: 12, onClick: handleClickDelete, className: css$1({ cursor: "pointer" }) }) : null
|
|
14177
|
+
onDeleteClick ? /* @__PURE__ */ jsxRuntime.jsx(P$1, { size: 12, onClick: handleClickDelete, className: css$1({ cursor: "pointer" }) }) : null
|
|
15315
14178
|
] });
|
|
15316
14179
|
});
|
|
15317
14180
|
Tag.displayName = "Tag";
|
|
@@ -15537,11 +14400,11 @@ const Input = React.forwardRef(
|
|
|
15537
14400
|
const innerRef = React.useRef(null);
|
|
15538
14401
|
const inputRef = ref || innerRef;
|
|
15539
14402
|
const handleInputChange = React.useCallback(
|
|
15540
|
-
(
|
|
14403
|
+
(e2) => {
|
|
15541
14404
|
if (disabled) return;
|
|
15542
|
-
const { value } =
|
|
15543
|
-
|
|
15544
|
-
onChange == null ? void 0 : onChange(
|
|
14405
|
+
const { value } = e2.target;
|
|
14406
|
+
e2.target.value = value.slice(0, textLimit);
|
|
14407
|
+
onChange == null ? void 0 : onChange(e2);
|
|
15545
14408
|
},
|
|
15546
14409
|
[disabled, onChange, textLimit]
|
|
15547
14410
|
);
|
|
@@ -15613,11 +14476,11 @@ const Textarea = React.forwardRef(
|
|
|
15613
14476
|
const innerRef = React.useRef(null);
|
|
15614
14477
|
const inputRef = ref || innerRef;
|
|
15615
14478
|
const handleTextareaChange = React.useCallback(
|
|
15616
|
-
(
|
|
14479
|
+
(e2) => {
|
|
15617
14480
|
if (disabled) return;
|
|
15618
|
-
const { value: value2 } =
|
|
15619
|
-
|
|
15620
|
-
onChange == null ? void 0 : onChange(
|
|
14481
|
+
const { value: value2 } = e2.target;
|
|
14482
|
+
e2.target.value = value2.slice(0, textLimit);
|
|
14483
|
+
onChange == null ? void 0 : onChange(e2);
|
|
15621
14484
|
if (showTextCount) setCount(value2.length);
|
|
15622
14485
|
},
|
|
15623
14486
|
[disabled, onChange, textLimit, showTextCount]
|
|
@@ -15666,7 +14529,7 @@ Textarea.displayName = "Textarea";
|
|
|
15666
14529
|
const index = React.memo(Textarea);
|
|
15667
14530
|
const tabsRecipe = sva({
|
|
15668
14531
|
className: "tabs",
|
|
15669
|
-
slots: anatomy
|
|
14532
|
+
slots: anatomy.keys(),
|
|
15670
14533
|
base: {
|
|
15671
14534
|
root: {
|
|
15672
14535
|
display: "flex",
|
|
@@ -15746,87 +14609,683 @@ const tabsRecipe = sva({
|
|
|
15746
14609
|
}
|
|
15747
14610
|
}
|
|
15748
14611
|
},
|
|
15749
|
-
fitted: {
|
|
15750
|
-
true: {
|
|
14612
|
+
fitted: {
|
|
14613
|
+
true: {
|
|
14614
|
+
root: {
|
|
14615
|
+
width: "100%"
|
|
14616
|
+
},
|
|
14617
|
+
list: {
|
|
14618
|
+
width: "100%",
|
|
14619
|
+
p: 1,
|
|
14620
|
+
overflowX: "visible"
|
|
14621
|
+
},
|
|
14622
|
+
trigger: {
|
|
14623
|
+
flex: 1,
|
|
14624
|
+
justifyContent: "center",
|
|
14625
|
+
overflow: "hidden",
|
|
14626
|
+
textOverflow: "ellipsis",
|
|
14627
|
+
whiteSpace: "nowrap"
|
|
14628
|
+
}
|
|
14629
|
+
}
|
|
14630
|
+
},
|
|
14631
|
+
bottomLine: {
|
|
14632
|
+
true: {
|
|
14633
|
+
list: {
|
|
14634
|
+
borderBottomWidth: "1px",
|
|
14635
|
+
borderColor: "background.neutral.selected"
|
|
14636
|
+
}
|
|
14637
|
+
},
|
|
14638
|
+
false: {
|
|
14639
|
+
list: {
|
|
14640
|
+
borderBottomWidth: "0px"
|
|
14641
|
+
}
|
|
14642
|
+
}
|
|
14643
|
+
},
|
|
14644
|
+
shadow: {
|
|
14645
|
+
true: {
|
|
14646
|
+
list: {
|
|
14647
|
+
boxShadow: "0px 8px 12px 0px var(--colors-semantic-shadow-overlay, rgba(0, 0, 0, 0.08))"
|
|
14648
|
+
}
|
|
14649
|
+
}
|
|
14650
|
+
}
|
|
14651
|
+
},
|
|
14652
|
+
compoundVariants: [
|
|
14653
|
+
{
|
|
14654
|
+
variant: "enclosed",
|
|
14655
|
+
fitted: true,
|
|
14656
|
+
css: {
|
|
14657
|
+
list: {
|
|
14658
|
+
background: "background.neutral.default",
|
|
14659
|
+
borderRadius: "full"
|
|
14660
|
+
}
|
|
14661
|
+
}
|
|
14662
|
+
},
|
|
14663
|
+
{
|
|
14664
|
+
variant: "enclosed",
|
|
14665
|
+
bottomLine: true,
|
|
14666
|
+
css: {
|
|
14667
|
+
list: {
|
|
14668
|
+
borderBottomWidth: "0px"
|
|
14669
|
+
}
|
|
14670
|
+
}
|
|
14671
|
+
}
|
|
14672
|
+
],
|
|
14673
|
+
defaultVariants: {
|
|
14674
|
+
variant: "line",
|
|
14675
|
+
fitted: false,
|
|
14676
|
+
bottomLine: true,
|
|
14677
|
+
shadow: false
|
|
14678
|
+
}
|
|
14679
|
+
});
|
|
14680
|
+
const { withRootProvider, withContext } = createStyleContext(tabsRecipe);
|
|
14681
|
+
const Root$1 = withRootProvider(TabsRoot);
|
|
14682
|
+
const List = withContext(TabList, "list");
|
|
14683
|
+
const Trigger = withContext(TabTrigger, "trigger");
|
|
14684
|
+
const Content$1 = withContext(TabContent, "content");
|
|
14685
|
+
const Indicator = withContext(TabIndicator, "indicator");
|
|
14686
|
+
const Tabs = Object.assign(Root$1, {
|
|
14687
|
+
Root: Root$1,
|
|
14688
|
+
List,
|
|
14689
|
+
Trigger,
|
|
14690
|
+
Content: Content$1,
|
|
14691
|
+
Indicator
|
|
14692
|
+
});
|
|
14693
|
+
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) => {
|
|
14694
|
+
let r = "", l2 = "", a2 = "";
|
|
14695
|
+
for (let n2 in e2) {
|
|
14696
|
+
let c2 = e2[n2];
|
|
14697
|
+
"@" == 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 + ";");
|
|
14698
|
+
}
|
|
14699
|
+
return r + (t2 && a2 ? t2 + "{" + a2 + "}" : a2) + l2;
|
|
14700
|
+
}, c$1 = {}, s = (e2) => {
|
|
14701
|
+
if ("object" == typeof e2) {
|
|
14702
|
+
let t2 = "";
|
|
14703
|
+
for (let r in e2) t2 += r + s(e2[r]);
|
|
14704
|
+
return t2;
|
|
14705
|
+
}
|
|
14706
|
+
return e2;
|
|
14707
|
+
}, i = (e2, t2, r, i2, p2) => {
|
|
14708
|
+
let u2 = s(e2), d2 = c$1[u2] || (c$1[u2] = ((e3) => {
|
|
14709
|
+
let t3 = 0, r2 = 11;
|
|
14710
|
+
for (; t3 < e3.length; ) r2 = 101 * r2 + e3.charCodeAt(t3++) >>> 0;
|
|
14711
|
+
return "go" + r2;
|
|
14712
|
+
})(u2));
|
|
14713
|
+
if (!c$1[d2]) {
|
|
14714
|
+
let t3 = u2 !== e2 ? e2 : ((e3) => {
|
|
14715
|
+
let t4, r2, o2 = [{}];
|
|
14716
|
+
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();
|
|
14717
|
+
return o2[0];
|
|
14718
|
+
})(e2);
|
|
14719
|
+
c$1[d2] = o(p2 ? { ["@keyframes " + d2]: t3 } : t3, r ? "" : "." + d2);
|
|
14720
|
+
}
|
|
14721
|
+
let f2 = r && c$1.g ? c$1.g : null;
|
|
14722
|
+
return r && (c$1.g = c$1[d2]), ((e3, t3, r2, l2) => {
|
|
14723
|
+
l2 ? t3.data = t3.data.replace(l2, e3) : -1 === t3.data.indexOf(e3) && (t3.data = r2 ? e3 + t3.data : t3.data + e3);
|
|
14724
|
+
})(c$1[d2], t2, i2, f2), d2;
|
|
14725
|
+
}, p = (e2, t2, r) => e2.reduce((e3, l2, a2) => {
|
|
14726
|
+
let n2 = t2[a2];
|
|
14727
|
+
if (n2 && n2.call) {
|
|
14728
|
+
let e4 = n2(r), t3 = e4 && e4.props && e4.props.className || /^go/.test(e4) && e4;
|
|
14729
|
+
n2 = t3 ? "." + t3 : e4 && "object" == typeof e4 ? e4.props ? "" : o(e4, "") : false === e4 ? "" : e4;
|
|
14730
|
+
}
|
|
14731
|
+
return e3 + l2 + (null == n2 ? "" : n2);
|
|
14732
|
+
}, "");
|
|
14733
|
+
function u$1(e2) {
|
|
14734
|
+
let r = this || {}, l2 = e2.call ? e2(r.p) : e2;
|
|
14735
|
+
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);
|
|
14736
|
+
}
|
|
14737
|
+
let d, f$1, g$1;
|
|
14738
|
+
u$1.bind({ g: 1 });
|
|
14739
|
+
let h = u$1.bind({ k: 1 });
|
|
14740
|
+
function m$1(e2, t2, r, l2) {
|
|
14741
|
+
o.p = t2, d = e2, f$1 = r, g$1 = l2;
|
|
14742
|
+
}
|
|
14743
|
+
function j(e2, t2) {
|
|
14744
|
+
let r = this || {};
|
|
14745
|
+
return function() {
|
|
14746
|
+
let l2 = arguments;
|
|
14747
|
+
function a2(n2, o2) {
|
|
14748
|
+
let c2 = Object.assign({}, n2), s2 = c2.className || a2.className;
|
|
14749
|
+
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 : "");
|
|
14750
|
+
let i2 = e2;
|
|
14751
|
+
return e2[0] && (i2 = c2.as || e2, delete c2.as), g$1 && i2[0] && g$1(c2), d(i2, c2);
|
|
14752
|
+
}
|
|
14753
|
+
return a2;
|
|
14754
|
+
};
|
|
14755
|
+
}
|
|
14756
|
+
var W = (e2) => typeof e2 == "function", f = (e2, t2) => W(e2) ? e2(t2) : e2;
|
|
14757
|
+
var F = /* @__PURE__ */ (() => {
|
|
14758
|
+
let e2 = 0;
|
|
14759
|
+
return () => (++e2).toString();
|
|
14760
|
+
})(), A = /* @__PURE__ */ (() => {
|
|
14761
|
+
let e2;
|
|
14762
|
+
return () => {
|
|
14763
|
+
if (e2 === void 0 && typeof window < "u") {
|
|
14764
|
+
let t2 = matchMedia("(prefers-reduced-motion: reduce)");
|
|
14765
|
+
e2 = !t2 || t2.matches;
|
|
14766
|
+
}
|
|
14767
|
+
return e2;
|
|
14768
|
+
};
|
|
14769
|
+
})();
|
|
14770
|
+
var Y = 20;
|
|
14771
|
+
var U = (e2, t2) => {
|
|
14772
|
+
switch (t2.type) {
|
|
14773
|
+
case 0:
|
|
14774
|
+
return { ...e2, toasts: [t2.toast, ...e2.toasts].slice(0, Y) };
|
|
14775
|
+
case 1:
|
|
14776
|
+
return { ...e2, toasts: e2.toasts.map((o2) => o2.id === t2.toast.id ? { ...o2, ...t2.toast } : o2) };
|
|
14777
|
+
case 2:
|
|
14778
|
+
let { toast: r } = t2;
|
|
14779
|
+
return U(e2, { type: e2.toasts.find((o2) => o2.id === r.id) ? 1 : 0, toast: r });
|
|
14780
|
+
case 3:
|
|
14781
|
+
let { toastId: s2 } = t2;
|
|
14782
|
+
return { ...e2, toasts: e2.toasts.map((o2) => o2.id === s2 || s2 === void 0 ? { ...o2, dismissed: true, visible: false } : o2) };
|
|
14783
|
+
case 4:
|
|
14784
|
+
return t2.toastId === void 0 ? { ...e2, toasts: [] } : { ...e2, toasts: e2.toasts.filter((o2) => o2.id !== t2.toastId) };
|
|
14785
|
+
case 5:
|
|
14786
|
+
return { ...e2, pausedAt: t2.time };
|
|
14787
|
+
case 6:
|
|
14788
|
+
let a2 = t2.time - (e2.pausedAt || 0);
|
|
14789
|
+
return { ...e2, pausedAt: void 0, toasts: e2.toasts.map((o2) => ({ ...o2, pauseDuration: o2.pauseDuration + a2 })) };
|
|
14790
|
+
}
|
|
14791
|
+
}, P = [], y = { toasts: [], pausedAt: void 0 }, u = (e2) => {
|
|
14792
|
+
y = U(y, e2), P.forEach((t2) => {
|
|
14793
|
+
t2(y);
|
|
14794
|
+
});
|
|
14795
|
+
}, q = { blank: 4e3, error: 4e3, success: 2e3, loading: 1 / 0, custom: 4e3 }, D = (e2 = {}) => {
|
|
14796
|
+
let [t2, r] = React.useState(y), s2 = React.useRef(y);
|
|
14797
|
+
React.useEffect(() => (s2.current !== y && r(y), P.push(r), () => {
|
|
14798
|
+
let o2 = P.indexOf(r);
|
|
14799
|
+
o2 > -1 && P.splice(o2, 1);
|
|
14800
|
+
}), []);
|
|
14801
|
+
let a2 = t2.toasts.map((o2) => {
|
|
14802
|
+
var n2, i2, p2;
|
|
14803
|
+
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 } };
|
|
14804
|
+
});
|
|
14805
|
+
return { ...t2, toasts: a2 };
|
|
14806
|
+
};
|
|
14807
|
+
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) => {
|
|
14808
|
+
let s2 = J(t2, e2, r);
|
|
14809
|
+
return u({ type: 2, toast: s2 }), s2.id;
|
|
14810
|
+
}, c = (e2, t2) => x("blank")(e2, t2);
|
|
14811
|
+
c.error = x("error");
|
|
14812
|
+
c.success = x("success");
|
|
14813
|
+
c.loading = x("loading");
|
|
14814
|
+
c.custom = x("custom");
|
|
14815
|
+
c.dismiss = (e2) => {
|
|
14816
|
+
u({ type: 3, toastId: e2 });
|
|
14817
|
+
};
|
|
14818
|
+
c.remove = (e2) => u({ type: 4, toastId: e2 });
|
|
14819
|
+
c.promise = (e2, t2, r) => {
|
|
14820
|
+
let s2 = c.loading(t2.loading, { ...r, ...r == null ? void 0 : r.loading });
|
|
14821
|
+
return typeof e2 == "function" && (e2 = e2()), e2.then((a2) => {
|
|
14822
|
+
let o2 = t2.success ? f(t2.success, a2) : void 0;
|
|
14823
|
+
return o2 ? c.success(o2, { id: s2, ...r, ...r == null ? void 0 : r.success }) : c.dismiss(s2), a2;
|
|
14824
|
+
}).catch((a2) => {
|
|
14825
|
+
let o2 = t2.error ? f(t2.error, a2) : void 0;
|
|
14826
|
+
o2 ? c.error(o2, { id: s2, ...r, ...r == null ? void 0 : r.error }) : c.dismiss(s2);
|
|
14827
|
+
}), e2;
|
|
14828
|
+
};
|
|
14829
|
+
var K = (e2, t2) => {
|
|
14830
|
+
u({ type: 1, toast: { id: e2, height: t2 } });
|
|
14831
|
+
}, X = () => {
|
|
14832
|
+
u({ type: 5, time: Date.now() });
|
|
14833
|
+
}, b = /* @__PURE__ */ new Map(), Z = 1e3, ee = (e2, t2 = Z) => {
|
|
14834
|
+
if (b.has(e2)) return;
|
|
14835
|
+
let r = setTimeout(() => {
|
|
14836
|
+
b.delete(e2), u({ type: 4, toastId: e2 });
|
|
14837
|
+
}, t2);
|
|
14838
|
+
b.set(e2, r);
|
|
14839
|
+
}, O = (e2) => {
|
|
14840
|
+
let { toasts: t2, pausedAt: r } = D(e2);
|
|
14841
|
+
React.useEffect(() => {
|
|
14842
|
+
if (r) return;
|
|
14843
|
+
let o2 = Date.now(), n2 = t2.map((i2) => {
|
|
14844
|
+
if (i2.duration === 1 / 0) return;
|
|
14845
|
+
let p2 = (i2.duration || 0) + i2.pauseDuration - (o2 - i2.createdAt);
|
|
14846
|
+
if (p2 < 0) {
|
|
14847
|
+
i2.visible && c.dismiss(i2.id);
|
|
14848
|
+
return;
|
|
14849
|
+
}
|
|
14850
|
+
return setTimeout(() => c.dismiss(i2.id), p2);
|
|
14851
|
+
});
|
|
14852
|
+
return () => {
|
|
14853
|
+
n2.forEach((i2) => i2 && clearTimeout(i2));
|
|
14854
|
+
};
|
|
14855
|
+
}, [t2, r]);
|
|
14856
|
+
let s2 = React.useCallback(() => {
|
|
14857
|
+
r && u({ type: 6, time: Date.now() });
|
|
14858
|
+
}, [r]), a2 = React.useCallback((o2, n2) => {
|
|
14859
|
+
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;
|
|
14860
|
+
return h2.filter((m2) => m2.visible).slice(...i2 ? [S + 1] : [0, S]).reduce((m2, E) => m2 + (E.height || 0) + p2, 0);
|
|
14861
|
+
}, [t2]);
|
|
14862
|
+
return React.useEffect(() => {
|
|
14863
|
+
t2.forEach((o2) => {
|
|
14864
|
+
if (o2.dismissed) ee(o2.id, o2.removeDelay);
|
|
14865
|
+
else {
|
|
14866
|
+
let n2 = b.get(o2.id);
|
|
14867
|
+
n2 && (clearTimeout(n2), b.delete(o2.id));
|
|
14868
|
+
}
|
|
14869
|
+
});
|
|
14870
|
+
}, [t2]), { toasts: t2, handlers: { updateHeight: K, startPause: X, endPause: s2, calculateOffset: a2 } };
|
|
14871
|
+
};
|
|
14872
|
+
var oe = h`
|
|
14873
|
+
from {
|
|
14874
|
+
transform: scale(0) rotate(45deg);
|
|
14875
|
+
opacity: 0;
|
|
14876
|
+
}
|
|
14877
|
+
to {
|
|
14878
|
+
transform: scale(1) rotate(45deg);
|
|
14879
|
+
opacity: 1;
|
|
14880
|
+
}`, re = h`
|
|
14881
|
+
from {
|
|
14882
|
+
transform: scale(0);
|
|
14883
|
+
opacity: 0;
|
|
14884
|
+
}
|
|
14885
|
+
to {
|
|
14886
|
+
transform: scale(1);
|
|
14887
|
+
opacity: 1;
|
|
14888
|
+
}`, se = h`
|
|
14889
|
+
from {
|
|
14890
|
+
transform: scale(0) rotate(90deg);
|
|
14891
|
+
opacity: 0;
|
|
14892
|
+
}
|
|
14893
|
+
to {
|
|
14894
|
+
transform: scale(1) rotate(90deg);
|
|
14895
|
+
opacity: 1;
|
|
14896
|
+
}`, k = j("div")`
|
|
14897
|
+
width: 20px;
|
|
14898
|
+
opacity: 0;
|
|
14899
|
+
height: 20px;
|
|
14900
|
+
border-radius: 10px;
|
|
14901
|
+
background: ${(e2) => e2.primary || "#ff4b4b"};
|
|
14902
|
+
position: relative;
|
|
14903
|
+
transform: rotate(45deg);
|
|
14904
|
+
|
|
14905
|
+
animation: ${oe} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
|
|
14906
|
+
forwards;
|
|
14907
|
+
animation-delay: 100ms;
|
|
14908
|
+
|
|
14909
|
+
&:after,
|
|
14910
|
+
&:before {
|
|
14911
|
+
content: '';
|
|
14912
|
+
animation: ${re} 0.15s ease-out forwards;
|
|
14913
|
+
animation-delay: 150ms;
|
|
14914
|
+
position: absolute;
|
|
14915
|
+
border-radius: 3px;
|
|
14916
|
+
opacity: 0;
|
|
14917
|
+
background: ${(e2) => e2.secondary || "#fff"};
|
|
14918
|
+
bottom: 9px;
|
|
14919
|
+
left: 4px;
|
|
14920
|
+
height: 2px;
|
|
14921
|
+
width: 12px;
|
|
14922
|
+
}
|
|
14923
|
+
|
|
14924
|
+
&:before {
|
|
14925
|
+
animation: ${se} 0.15s ease-out forwards;
|
|
14926
|
+
animation-delay: 180ms;
|
|
14927
|
+
transform: rotate(90deg);
|
|
14928
|
+
}
|
|
14929
|
+
`;
|
|
14930
|
+
var ne = h`
|
|
14931
|
+
from {
|
|
14932
|
+
transform: rotate(0deg);
|
|
14933
|
+
}
|
|
14934
|
+
to {
|
|
14935
|
+
transform: rotate(360deg);
|
|
14936
|
+
}
|
|
14937
|
+
`, V = j("div")`
|
|
14938
|
+
width: 12px;
|
|
14939
|
+
height: 12px;
|
|
14940
|
+
box-sizing: border-box;
|
|
14941
|
+
border: 2px solid;
|
|
14942
|
+
border-radius: 100%;
|
|
14943
|
+
border-color: ${(e2) => e2.secondary || "#e0e0e0"};
|
|
14944
|
+
border-right-color: ${(e2) => e2.primary || "#616161"};
|
|
14945
|
+
animation: ${ne} 1s linear infinite;
|
|
14946
|
+
`;
|
|
14947
|
+
var pe = h`
|
|
14948
|
+
from {
|
|
14949
|
+
transform: scale(0) rotate(45deg);
|
|
14950
|
+
opacity: 0;
|
|
14951
|
+
}
|
|
14952
|
+
to {
|
|
14953
|
+
transform: scale(1) rotate(45deg);
|
|
14954
|
+
opacity: 1;
|
|
14955
|
+
}`, de = h`
|
|
14956
|
+
0% {
|
|
14957
|
+
height: 0;
|
|
14958
|
+
width: 0;
|
|
14959
|
+
opacity: 0;
|
|
14960
|
+
}
|
|
14961
|
+
40% {
|
|
14962
|
+
height: 0;
|
|
14963
|
+
width: 6px;
|
|
14964
|
+
opacity: 1;
|
|
14965
|
+
}
|
|
14966
|
+
100% {
|
|
14967
|
+
opacity: 1;
|
|
14968
|
+
height: 10px;
|
|
14969
|
+
}`, _ = j("div")`
|
|
14970
|
+
width: 20px;
|
|
14971
|
+
opacity: 0;
|
|
14972
|
+
height: 20px;
|
|
14973
|
+
border-radius: 10px;
|
|
14974
|
+
background: ${(e2) => e2.primary || "#61d345"};
|
|
14975
|
+
position: relative;
|
|
14976
|
+
transform: rotate(45deg);
|
|
14977
|
+
|
|
14978
|
+
animation: ${pe} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)
|
|
14979
|
+
forwards;
|
|
14980
|
+
animation-delay: 100ms;
|
|
14981
|
+
&:after {
|
|
14982
|
+
content: '';
|
|
14983
|
+
box-sizing: border-box;
|
|
14984
|
+
animation: ${de} 0.2s ease-out forwards;
|
|
14985
|
+
opacity: 0;
|
|
14986
|
+
animation-delay: 200ms;
|
|
14987
|
+
position: absolute;
|
|
14988
|
+
border-right: 2px solid;
|
|
14989
|
+
border-bottom: 2px solid;
|
|
14990
|
+
border-color: ${(e2) => e2.secondary || "#fff"};
|
|
14991
|
+
bottom: 6px;
|
|
14992
|
+
left: 6px;
|
|
14993
|
+
height: 10px;
|
|
14994
|
+
width: 6px;
|
|
14995
|
+
}
|
|
14996
|
+
`;
|
|
14997
|
+
var ue = j("div")`
|
|
14998
|
+
position: absolute;
|
|
14999
|
+
`, le = j("div")`
|
|
15000
|
+
position: relative;
|
|
15001
|
+
display: flex;
|
|
15002
|
+
justify-content: center;
|
|
15003
|
+
align-items: center;
|
|
15004
|
+
min-width: 20px;
|
|
15005
|
+
min-height: 20px;
|
|
15006
|
+
`, fe = h`
|
|
15007
|
+
from {
|
|
15008
|
+
transform: scale(0.6);
|
|
15009
|
+
opacity: 0.4;
|
|
15010
|
+
}
|
|
15011
|
+
to {
|
|
15012
|
+
transform: scale(1);
|
|
15013
|
+
opacity: 1;
|
|
15014
|
+
}`, Te = j("div")`
|
|
15015
|
+
position: relative;
|
|
15016
|
+
transform: scale(0.6);
|
|
15017
|
+
opacity: 0.4;
|
|
15018
|
+
min-width: 20px;
|
|
15019
|
+
animation: ${fe} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)
|
|
15020
|
+
forwards;
|
|
15021
|
+
`, M = ({ toast: e2 }) => {
|
|
15022
|
+
let { icon: t2, type: r, iconTheme: s2 } = e2;
|
|
15023
|
+
return t2 !== void 0 ? typeof t2 == "string" ? React__namespace.createElement(Te, null, t2) : t2 : r === "blank" ? null : React__namespace.createElement(le, null, React__namespace.createElement(V, { ...s2 }), r !== "loading" && React__namespace.createElement(ue, null, r === "error" ? React__namespace.createElement(k, { ...s2 }) : React__namespace.createElement(_, { ...s2 })));
|
|
15024
|
+
};
|
|
15025
|
+
var ye = (e2) => `
|
|
15026
|
+
0% {transform: translate3d(0,${e2 * -200}%,0) scale(.6); opacity:.5;}
|
|
15027
|
+
100% {transform: translate3d(0,0,0) scale(1); opacity:1;}
|
|
15028
|
+
`, ge = (e2) => `
|
|
15029
|
+
0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}
|
|
15030
|
+
100% {transform: translate3d(0,${e2 * -150}%,-1px) scale(.6); opacity:0;}
|
|
15031
|
+
`, he = "0%{opacity:0;} 100%{opacity:1;}", xe = "0%{opacity:1;} 100%{opacity:0;}", be = j("div")`
|
|
15032
|
+
display: flex;
|
|
15033
|
+
align-items: center;
|
|
15034
|
+
background: #fff;
|
|
15035
|
+
color: #363636;
|
|
15036
|
+
line-height: 1.3;
|
|
15037
|
+
will-change: transform;
|
|
15038
|
+
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05);
|
|
15039
|
+
max-width: 350px;
|
|
15040
|
+
pointer-events: auto;
|
|
15041
|
+
padding: 8px 10px;
|
|
15042
|
+
border-radius: 8px;
|
|
15043
|
+
`, Se = j("div")`
|
|
15044
|
+
display: flex;
|
|
15045
|
+
justify-content: center;
|
|
15046
|
+
margin: 4px 10px;
|
|
15047
|
+
color: inherit;
|
|
15048
|
+
flex: 1 1 auto;
|
|
15049
|
+
white-space: pre-line;
|
|
15050
|
+
`, Ae = (e2, t2) => {
|
|
15051
|
+
let s2 = e2.includes("top") ? 1 : -1, [a2, o2] = A() ? [he, xe] : [ye(s2), ge(s2)];
|
|
15052
|
+
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)` };
|
|
15053
|
+
}, C = React__namespace.memo(({ toast: e2, position: t2, style: r, children: s2 }) => {
|
|
15054
|
+
let a2 = e2.height ? Ae(e2.position || t2 || "top-center", e2.visible) : { opacity: 0 }, o2 = React__namespace.createElement(M, { toast: e2 }), n2 = React__namespace.createElement(Se, { ...e2.ariaProps }, f(e2.message, e2));
|
|
15055
|
+
return React__namespace.createElement(be, { className: e2.className, style: { ...a2, ...r, ...e2.style } }, typeof s2 == "function" ? s2({ icon: o2, message: n2 }) : React__namespace.createElement(React__namespace.Fragment, null, o2, n2));
|
|
15056
|
+
});
|
|
15057
|
+
m$1(React__namespace.createElement);
|
|
15058
|
+
var ve = ({ id: e2, className: t2, style: r, onHeightUpdate: s2, children: a2 }) => {
|
|
15059
|
+
let o2 = React__namespace.useCallback((n2) => {
|
|
15060
|
+
if (n2) {
|
|
15061
|
+
let i2 = () => {
|
|
15062
|
+
let p2 = n2.getBoundingClientRect().height;
|
|
15063
|
+
s2(e2, p2);
|
|
15064
|
+
};
|
|
15065
|
+
i2(), new MutationObserver(i2).observe(n2, { subtree: true, childList: true, characterData: true });
|
|
15066
|
+
}
|
|
15067
|
+
}, [e2, s2]);
|
|
15068
|
+
return React__namespace.createElement("div", { ref: o2, className: t2, style: r }, a2);
|
|
15069
|
+
}, Ee = (e2, t2) => {
|
|
15070
|
+
let r = e2.includes("top"), s2 = r ? { top: 0 } : { bottom: 0 }, a2 = e2.includes("center") ? { justifyContent: "center" } : e2.includes("right") ? { justifyContent: "flex-end" } : {};
|
|
15071
|
+
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 };
|
|
15072
|
+
}, De = u$1`
|
|
15073
|
+
z-index: 9999;
|
|
15074
|
+
> * {
|
|
15075
|
+
pointer-events: auto;
|
|
15076
|
+
}
|
|
15077
|
+
`, R = 16, Oe = ({ reverseOrder: e2, position: t2 = "top-center", toastOptions: r, gutter: s2, children: a2, containerStyle: o2, containerClassName: n2 }) => {
|
|
15078
|
+
let { toasts: i2, handlers: p2 } = O(r);
|
|
15079
|
+
return React__namespace.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) => {
|
|
15080
|
+
let h2 = d2.position || t2, v2 = p2.calculateOffset(d2, { reverseOrder: e2, gutter: s2, defaultPosition: t2 }), S = Ee(h2, v2);
|
|
15081
|
+
return React__namespace.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__namespace.createElement(C, { toast: d2, position: h2 }));
|
|
15082
|
+
}));
|
|
15083
|
+
};
|
|
15084
|
+
var Vt = c;
|
|
15085
|
+
const toastRecipe = sva({
|
|
15086
|
+
className: "toast",
|
|
15087
|
+
slots: ["root", "content", "description", "actionTrigger", "icon"],
|
|
15088
|
+
base: {
|
|
15089
|
+
root: {
|
|
15090
|
+
display: "flex",
|
|
15091
|
+
alignItems: "center",
|
|
15092
|
+
justifyContent: "center",
|
|
15093
|
+
backgroundColor: "background.neutralInverse.default",
|
|
15094
|
+
borderRadius: 16,
|
|
15095
|
+
height: "fit-content",
|
|
15096
|
+
minHeight: "48px",
|
|
15097
|
+
width: "fit-content",
|
|
15098
|
+
maxWidth: "328px",
|
|
15099
|
+
overflowWrap: "anywhere",
|
|
15100
|
+
zIndex: "overlay",
|
|
15101
|
+
fontStyle: "body.md",
|
|
15102
|
+
color: "content.neutralInverse.bold",
|
|
15103
|
+
px: 3,
|
|
15104
|
+
py: 2,
|
|
15105
|
+
boxShadow: "0px 4px 12px rgba(0, 0, 0, 0.1)",
|
|
15106
|
+
shadow: "overlay"
|
|
15107
|
+
},
|
|
15108
|
+
content: {
|
|
15109
|
+
display: "inline-flex",
|
|
15110
|
+
alignItems: "center",
|
|
15111
|
+
gap: 2
|
|
15112
|
+
},
|
|
15113
|
+
description: {
|
|
15114
|
+
textStyle: "body.md"
|
|
15115
|
+
},
|
|
15116
|
+
actionTrigger: {
|
|
15117
|
+
height: "100%",
|
|
15118
|
+
width: "fit-content",
|
|
15119
|
+
display: "flex",
|
|
15120
|
+
alignItems: "center",
|
|
15121
|
+
justifyContent: "center",
|
|
15122
|
+
textStyle: "title.sm",
|
|
15123
|
+
cursor: "pointer",
|
|
15124
|
+
px: 4,
|
|
15125
|
+
pr: 1,
|
|
15126
|
+
whiteSpace: "nowrap",
|
|
15127
|
+
color: "content.neutralInverse.bold",
|
|
15128
|
+
"&:hover": {
|
|
15129
|
+
opacity: 0.8
|
|
15130
|
+
}
|
|
15131
|
+
},
|
|
15132
|
+
icon: {
|
|
15133
|
+
width: 6,
|
|
15134
|
+
height: 6,
|
|
15135
|
+
minWidth: 6,
|
|
15136
|
+
minHeight: 6,
|
|
15137
|
+
ml: -1,
|
|
15138
|
+
display: "flex",
|
|
15139
|
+
alignItems: "center",
|
|
15140
|
+
justifyContent: "center"
|
|
15141
|
+
}
|
|
15142
|
+
},
|
|
15143
|
+
variants: {
|
|
15144
|
+
width: {
|
|
15145
|
+
full: {
|
|
15751
15146
|
root: {
|
|
15752
|
-
width: "100%"
|
|
15753
|
-
},
|
|
15754
|
-
list: {
|
|
15755
15147
|
width: "100%",
|
|
15756
|
-
|
|
15757
|
-
overflowX: "visible"
|
|
15758
|
-
},
|
|
15759
|
-
trigger: {
|
|
15760
|
-
flex: 1,
|
|
15761
|
-
justifyContent: "center",
|
|
15762
|
-
overflow: "hidden",
|
|
15763
|
-
textOverflow: "ellipsis",
|
|
15764
|
-
whiteSpace: "nowrap"
|
|
15765
|
-
}
|
|
15766
|
-
}
|
|
15767
|
-
},
|
|
15768
|
-
bottomLine: {
|
|
15769
|
-
true: {
|
|
15770
|
-
list: {
|
|
15771
|
-
borderBottomWidth: "1px",
|
|
15772
|
-
borderColor: "background.neutral.selected"
|
|
15148
|
+
justifyContent: "space-between"
|
|
15773
15149
|
}
|
|
15774
15150
|
},
|
|
15775
|
-
|
|
15776
|
-
|
|
15777
|
-
|
|
15151
|
+
fit: {
|
|
15152
|
+
root: {
|
|
15153
|
+
width: "fit-content"
|
|
15778
15154
|
}
|
|
15779
15155
|
}
|
|
15780
15156
|
},
|
|
15781
|
-
|
|
15157
|
+
asLink: {
|
|
15782
15158
|
true: {
|
|
15783
|
-
|
|
15784
|
-
|
|
15159
|
+
actionTrigger: {
|
|
15160
|
+
textDecoration: "underline",
|
|
15161
|
+
cursor: "pointer"
|
|
15785
15162
|
}
|
|
15786
15163
|
}
|
|
15787
15164
|
}
|
|
15788
15165
|
},
|
|
15789
|
-
|
|
15790
|
-
|
|
15791
|
-
|
|
15792
|
-
|
|
15793
|
-
|
|
15794
|
-
|
|
15795
|
-
|
|
15796
|
-
|
|
15166
|
+
defaultVariants: {
|
|
15167
|
+
width: "full",
|
|
15168
|
+
asLink: false
|
|
15169
|
+
}
|
|
15170
|
+
});
|
|
15171
|
+
const DEFAULT_DURATION = 3e3;
|
|
15172
|
+
const Root = React.forwardRef(
|
|
15173
|
+
({ children, className, width = "fit", ...props }, ref) => {
|
|
15174
|
+
const styles2 = toastRecipe({ width });
|
|
15175
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box$1, { ref, className: cx(styles2.root, className), ...props, children });
|
|
15176
|
+
}
|
|
15177
|
+
);
|
|
15178
|
+
Root.displayName = "Toast.Root";
|
|
15179
|
+
const Content = React.forwardRef(
|
|
15180
|
+
({ children, className }, ref) => {
|
|
15181
|
+
const styles2 = toastRecipe();
|
|
15182
|
+
return /* @__PURE__ */ jsxRuntime.jsx(HStack$1, { ref, className: cx(styles2.content, className), children });
|
|
15183
|
+
}
|
|
15184
|
+
);
|
|
15185
|
+
Content.displayName = "Toast.Content";
|
|
15186
|
+
const Description = React.forwardRef(
|
|
15187
|
+
({ children, className }, ref) => {
|
|
15188
|
+
const styles2 = toastRecipe();
|
|
15189
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box$1, { ref, className: cx(styles2.description, className), children });
|
|
15190
|
+
}
|
|
15191
|
+
);
|
|
15192
|
+
const Icon = React.forwardRef(({ icon, className }, ref) => {
|
|
15193
|
+
const styles2 = toastRecipe();
|
|
15194
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box$1, { ref, className: cx(styles2.icon, className), children: icon });
|
|
15195
|
+
});
|
|
15196
|
+
Icon.displayName = "Toast.Icon";
|
|
15197
|
+
const ActionTrigger = React.forwardRef(({ onClick, children, className, asLink = false }, ref) => {
|
|
15198
|
+
const styles2 = toastRecipe({ asLink });
|
|
15199
|
+
return /* @__PURE__ */ jsxRuntime.jsx("button", { ref, className: cx(styles2.actionTrigger, className), onClick, children });
|
|
15200
|
+
});
|
|
15201
|
+
ActionTrigger.displayName = "Toast.ActionTrigger";
|
|
15202
|
+
const Toaster = () => {
|
|
15203
|
+
return reactDom.createPortal(
|
|
15204
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
15205
|
+
Oe,
|
|
15206
|
+
{
|
|
15207
|
+
position: "bottom-center",
|
|
15208
|
+
toastOptions: {
|
|
15209
|
+
duration: DEFAULT_DURATION,
|
|
15210
|
+
style: {
|
|
15211
|
+
background: "transparent",
|
|
15212
|
+
boxShadow: "none",
|
|
15213
|
+
padding: 0,
|
|
15214
|
+
margin: 0
|
|
15215
|
+
}
|
|
15797
15216
|
}
|
|
15798
15217
|
}
|
|
15799
|
-
|
|
15218
|
+
),
|
|
15219
|
+
document.body
|
|
15220
|
+
);
|
|
15221
|
+
};
|
|
15222
|
+
Toaster.displayName = "Toast.Toaster";
|
|
15223
|
+
const Toast = React.forwardRef((props, ref) => {
|
|
15224
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box$1, { ref, ...props });
|
|
15225
|
+
});
|
|
15226
|
+
Toast.Root = Root;
|
|
15227
|
+
Toast.Content = Content;
|
|
15228
|
+
Toast.Description = Description;
|
|
15229
|
+
Toast.Icon = Icon;
|
|
15230
|
+
Toast.ActionTrigger = ActionTrigger;
|
|
15231
|
+
Toast.Toaster = Toaster;
|
|
15232
|
+
Toast.show = (description, option) => {
|
|
15233
|
+
Vt(
|
|
15234
|
+
(t2) => /* @__PURE__ */ jsxRuntime.jsxs(Toast.Root, { width: (option == null ? void 0 : option.actionLabel) ? "full" : "fit", children: [
|
|
15235
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Toast.Content, { children: [
|
|
15236
|
+
(option == null ? void 0 : option.icon) && /* @__PURE__ */ jsxRuntime.jsx(Toast.Icon, { icon: option == null ? void 0 : option.icon }),
|
|
15237
|
+
/* @__PURE__ */ jsxRuntime.jsx(Toast.Description, { children: description })
|
|
15238
|
+
] }),
|
|
15239
|
+
(option == null ? void 0 : option.actionLabel) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
15240
|
+
Toast.ActionTrigger,
|
|
15241
|
+
{
|
|
15242
|
+
asLink: option == null ? void 0 : option.asLink,
|
|
15243
|
+
onClick: () => {
|
|
15244
|
+
var _a;
|
|
15245
|
+
(_a = option == null ? void 0 : option.onActionClick) == null ? void 0 : _a.call(option);
|
|
15246
|
+
if (!(option == null ? void 0 : option.disableCloseOnActionClick)) {
|
|
15247
|
+
Vt.dismiss(t2.id);
|
|
15248
|
+
}
|
|
15249
|
+
},
|
|
15250
|
+
children: option == null ? void 0 : option.actionLabel
|
|
15251
|
+
}
|
|
15252
|
+
)
|
|
15253
|
+
] }),
|
|
15800
15254
|
{
|
|
15801
|
-
|
|
15802
|
-
|
|
15803
|
-
|
|
15804
|
-
|
|
15805
|
-
|
|
15255
|
+
duration: (option == null ? void 0 : option.duration) || DEFAULT_DURATION,
|
|
15256
|
+
position: "bottom-center"
|
|
15257
|
+
}
|
|
15258
|
+
);
|
|
15259
|
+
};
|
|
15260
|
+
Toast.error = (description, option) => {
|
|
15261
|
+
console.error("error", description);
|
|
15262
|
+
Vt(
|
|
15263
|
+
(t2) => /* @__PURE__ */ jsxRuntime.jsxs(Toast.Root, { width: (option == null ? void 0 : option.actionLabel) ? "full" : "fit", children: [
|
|
15264
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Toast.Content, { children: [
|
|
15265
|
+
(option == null ? void 0 : option.icon) && /* @__PURE__ */ jsxRuntime.jsx(Toast.Icon, { icon: option == null ? void 0 : option.icon }),
|
|
15266
|
+
/* @__PURE__ */ jsxRuntime.jsx(Toast.Description, { children: description })
|
|
15267
|
+
] }),
|
|
15268
|
+
(option == null ? void 0 : option.actionLabel) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
15269
|
+
Toast.ActionTrigger,
|
|
15270
|
+
{
|
|
15271
|
+
asLink: option == null ? void 0 : option.asLink,
|
|
15272
|
+
onClick: () => {
|
|
15273
|
+
var _a;
|
|
15274
|
+
(_a = option == null ? void 0 : option.onActionClick) == null ? void 0 : _a.call(option);
|
|
15275
|
+
if (!(option == null ? void 0 : option.disableCloseOnActionClick)) {
|
|
15276
|
+
Vt.dismiss(t2.id);
|
|
15277
|
+
}
|
|
15278
|
+
},
|
|
15279
|
+
children: option == null ? void 0 : option.actionLabel
|
|
15806
15280
|
}
|
|
15807
|
-
|
|
15281
|
+
)
|
|
15282
|
+
] }),
|
|
15283
|
+
{
|
|
15284
|
+
duration: (option == null ? void 0 : option.duration) || DEFAULT_DURATION,
|
|
15285
|
+
position: "bottom-center"
|
|
15808
15286
|
}
|
|
15809
|
-
|
|
15810
|
-
|
|
15811
|
-
variant: "line",
|
|
15812
|
-
fitted: false,
|
|
15813
|
-
bottomLine: true,
|
|
15814
|
-
shadow: false
|
|
15815
|
-
}
|
|
15816
|
-
});
|
|
15817
|
-
const { withRootProvider, withContext: withContext$1 } = createStyleContext(tabsRecipe);
|
|
15818
|
-
const Root$1 = withRootProvider(TabsRoot);
|
|
15819
|
-
const List = withContext$1(TabList, "list");
|
|
15820
|
-
const Trigger = withContext$1(TabTrigger, "trigger");
|
|
15821
|
-
const Content$1 = withContext$1(TabContent, "content");
|
|
15822
|
-
const Indicator = withContext$1(TabIndicator, "indicator");
|
|
15823
|
-
const Tabs = Object.assign(Root$1, {
|
|
15824
|
-
Root: Root$1,
|
|
15825
|
-
List,
|
|
15826
|
-
Trigger,
|
|
15827
|
-
Content: Content$1,
|
|
15828
|
-
Indicator
|
|
15829
|
-
});
|
|
15287
|
+
);
|
|
15288
|
+
};
|
|
15830
15289
|
function definePreset(preset2) {
|
|
15831
15290
|
return preset2;
|
|
15832
15291
|
}
|
|
@@ -16136,291 +15595,6 @@ const preset = definePreset({
|
|
|
16136
15595
|
}
|
|
16137
15596
|
}
|
|
16138
15597
|
});
|
|
16139
|
-
const toastRecipe = sva({
|
|
16140
|
-
className: "toast",
|
|
16141
|
-
slots: [...anatomy.keys(), "content", "icon"],
|
|
16142
|
-
base: {
|
|
16143
|
-
root: {
|
|
16144
|
-
display: "flex",
|
|
16145
|
-
alignItems: "center",
|
|
16146
|
-
justifyContent: "center",
|
|
16147
|
-
backgroundColor: "background.neutralInverse.default",
|
|
16148
|
-
borderRadius: 16,
|
|
16149
|
-
height: "fit-content",
|
|
16150
|
-
minHeight: "48px",
|
|
16151
|
-
width: "fit-content",
|
|
16152
|
-
maxWidth: "328px",
|
|
16153
|
-
overflowWrap: "anywhere",
|
|
16154
|
-
zIndex: "overlay",
|
|
16155
|
-
fontStyle: "body.md",
|
|
16156
|
-
color: "content.neutralInverse.bold",
|
|
16157
|
-
pr: 4,
|
|
16158
|
-
pl: 3,
|
|
16159
|
-
py: 2,
|
|
16160
|
-
boxShadow: "0px 4px 12px rgba(0, 0, 0, 0.1)",
|
|
16161
|
-
animation: "fadeIn 0.25s ease-out",
|
|
16162
|
-
transform: "translateY(20px)",
|
|
16163
|
-
shadow: "overlay",
|
|
16164
|
-
transition: "transform 0.25s ease-out",
|
|
16165
|
-
'&[data-state="open"]': {
|
|
16166
|
-
animation: "slide-in 0.4s cubic-bezier(0.05, 0.7, 0.1, 1.0)",
|
|
16167
|
-
transform: "translateY(0px)"
|
|
16168
|
-
},
|
|
16169
|
-
'&[data-state="closed"]': {
|
|
16170
|
-
animation: "slide-out 0.2s cubic-bezier(0.3, 0.0, 0.8, 0.15)",
|
|
16171
|
-
transform: "translateY(64px)"
|
|
16172
|
-
}
|
|
16173
|
-
},
|
|
16174
|
-
content: {
|
|
16175
|
-
display: "inline-flex",
|
|
16176
|
-
alignItems: "center"
|
|
16177
|
-
},
|
|
16178
|
-
description: {
|
|
16179
|
-
textStyle: "body.md",
|
|
16180
|
-
marginLeft: 2
|
|
16181
|
-
},
|
|
16182
|
-
actionTrigger: {
|
|
16183
|
-
height: "100%",
|
|
16184
|
-
width: "fit-content",
|
|
16185
|
-
display: "flex",
|
|
16186
|
-
alignItems: "center",
|
|
16187
|
-
justifyContent: "center",
|
|
16188
|
-
textStyle: "title.sm",
|
|
16189
|
-
cursor: "pointer",
|
|
16190
|
-
px: 4,
|
|
16191
|
-
pr: 1,
|
|
16192
|
-
whiteSpace: "nowrap",
|
|
16193
|
-
transition: "opacity 0.2s ease",
|
|
16194
|
-
color: "content.neutralInverse.bold",
|
|
16195
|
-
"&:hover": {
|
|
16196
|
-
opacity: 0.8
|
|
16197
|
-
}
|
|
16198
|
-
},
|
|
16199
|
-
icon: {
|
|
16200
|
-
width: 6,
|
|
16201
|
-
height: 6,
|
|
16202
|
-
minWidth: 6,
|
|
16203
|
-
minHeight: 6,
|
|
16204
|
-
display: "flex",
|
|
16205
|
-
alignItems: "center",
|
|
16206
|
-
justifyContent: "center"
|
|
16207
|
-
}
|
|
16208
|
-
},
|
|
16209
|
-
variants: {
|
|
16210
|
-
width: {
|
|
16211
|
-
full: {
|
|
16212
|
-
root: {
|
|
16213
|
-
width: "100%",
|
|
16214
|
-
justifyContent: "space-between"
|
|
16215
|
-
}
|
|
16216
|
-
},
|
|
16217
|
-
fit: {
|
|
16218
|
-
root: {
|
|
16219
|
-
width: "fit-content"
|
|
16220
|
-
}
|
|
16221
|
-
}
|
|
16222
|
-
},
|
|
16223
|
-
asLink: {
|
|
16224
|
-
true: {
|
|
16225
|
-
actionTrigger: {
|
|
16226
|
-
textDecoration: "underline",
|
|
16227
|
-
cursor: "pointer"
|
|
16228
|
-
}
|
|
16229
|
-
}
|
|
16230
|
-
}
|
|
16231
|
-
}
|
|
16232
|
-
});
|
|
16233
|
-
const { withProvider, withContext } = createStyleContext(toastRecipe);
|
|
16234
|
-
const OriginalRoot = withProvider(ToastRoot, "root");
|
|
16235
|
-
const Root = React.forwardRef((props, ref) => {
|
|
16236
|
-
const { children, width, ...rest } = props;
|
|
16237
|
-
const hasActionTrigger = React.Children.toArray(children).some((child) => {
|
|
16238
|
-
if (React.isValidElement(child)) {
|
|
16239
|
-
if (child.type === ActionTrigger) {
|
|
16240
|
-
return true;
|
|
16241
|
-
}
|
|
16242
|
-
if (child.type === React.Fragment && child.props.children) {
|
|
16243
|
-
return React.Children.toArray(child.props.children).some(
|
|
16244
|
-
(fragmentChild) => React.isValidElement(fragmentChild) && fragmentChild.type === ActionTrigger
|
|
16245
|
-
);
|
|
16246
|
-
}
|
|
16247
|
-
}
|
|
16248
|
-
return false;
|
|
16249
|
-
});
|
|
16250
|
-
const widthValue = width !== void 0 ? width : hasActionTrigger ? "full" : "fit";
|
|
16251
|
-
return /* @__PURE__ */ jsxRuntime.jsx(OriginalRoot, { ref, width: widthValue, ...rest, children });
|
|
16252
|
-
});
|
|
16253
|
-
Root.displayName = "Toast.Root";
|
|
16254
|
-
const OriginalActionTrigger = withContext(
|
|
16255
|
-
ToastActionTrigger,
|
|
16256
|
-
"actionTrigger"
|
|
16257
|
-
);
|
|
16258
|
-
const OriginalActionTriggerAsLink = withContext(ark.a, "actionTrigger");
|
|
16259
|
-
const ActionTrigger = React.forwardRef((props, ref) => {
|
|
16260
|
-
const { asLink, ...rest } = props;
|
|
16261
|
-
return asLink ? /* @__PURE__ */ jsxRuntime.jsx(OriginalActionTriggerAsLink, { ref, ...rest }) : /* @__PURE__ */ jsxRuntime.jsx(OriginalActionTrigger, { ref, ...rest });
|
|
16262
|
-
});
|
|
16263
|
-
ActionTrigger.displayName = "Toast.ActionTrigger";
|
|
16264
|
-
const Description = withContext(
|
|
16265
|
-
ToastDescription,
|
|
16266
|
-
"description"
|
|
16267
|
-
);
|
|
16268
|
-
const Content = withContext(ark.div, "content");
|
|
16269
|
-
const Icon = withContext(ark.div, "icon");
|
|
16270
|
-
const Toast = {
|
|
16271
|
-
Root,
|
|
16272
|
-
ActionTrigger,
|
|
16273
|
-
Content,
|
|
16274
|
-
Description,
|
|
16275
|
-
Icon
|
|
16276
|
-
};
|
|
16277
|
-
const toast = {
|
|
16278
|
-
queue: [],
|
|
16279
|
-
// ToastProvider에서 호출
|
|
16280
|
-
_getQueue: () => {
|
|
16281
|
-
const queue = [...toast.queue];
|
|
16282
|
-
toast.queue = [];
|
|
16283
|
-
return queue;
|
|
16284
|
-
},
|
|
16285
|
-
/**
|
|
16286
|
-
* ToastProvider가 준비되었는지 확인하는 상태
|
|
16287
|
-
*/
|
|
16288
|
-
isReady: false,
|
|
16289
|
-
/**
|
|
16290
|
-
* 대기 중인 토스트 메시지 큐
|
|
16291
|
-
*/
|
|
16292
|
-
pendingToasts: [],
|
|
16293
|
-
/**
|
|
16294
|
-
* ToastProvider에서 호출하여 준비 상태를 설정
|
|
16295
|
-
*/
|
|
16296
|
-
_setReady: () => {
|
|
16297
|
-
toast.isReady = true;
|
|
16298
|
-
if (toast.pendingToasts.length > 0) {
|
|
16299
|
-
toast.pendingToasts.forEach((args) => {
|
|
16300
|
-
toast.show(args[0], args[1]);
|
|
16301
|
-
});
|
|
16302
|
-
toast.pendingToasts = [];
|
|
16303
|
-
}
|
|
16304
|
-
},
|
|
16305
|
-
// render toast
|
|
16306
|
-
show: (message, options) => {
|
|
16307
|
-
if (!toast.isReady) {
|
|
16308
|
-
toast.pendingToasts.push([message, options]);
|
|
16309
|
-
return;
|
|
16310
|
-
}
|
|
16311
|
-
const toastData = {
|
|
16312
|
-
description: message,
|
|
16313
|
-
action: (options == null ? void 0 : options.actionLabel) ? {
|
|
16314
|
-
label: options.actionLabel,
|
|
16315
|
-
onClick: options.onActionClick
|
|
16316
|
-
} : void 0,
|
|
16317
|
-
icon: options == null ? void 0 : options.icon,
|
|
16318
|
-
asLink: options == null ? void 0 : options.asLink,
|
|
16319
|
-
duration: options == null ? void 0 : options.duration
|
|
16320
|
-
};
|
|
16321
|
-
toast.queue.push(toastData);
|
|
16322
|
-
if (typeof window !== "undefined") {
|
|
16323
|
-
window.dispatchEvent(new CustomEvent("toast-queue-updated"));
|
|
16324
|
-
}
|
|
16325
|
-
},
|
|
16326
|
-
success: (message, options) => {
|
|
16327
|
-
toast.show(message, { ...options });
|
|
16328
|
-
},
|
|
16329
|
-
error: (message, options) => {
|
|
16330
|
-
toast.show(message, { ...options });
|
|
16331
|
-
},
|
|
16332
|
-
warning: (message, options) => {
|
|
16333
|
-
toast.show(message, { ...options });
|
|
16334
|
-
},
|
|
16335
|
-
info: (message, options) => {
|
|
16336
|
-
toast.show(message, { ...options });
|
|
16337
|
-
}
|
|
16338
|
-
};
|
|
16339
|
-
const DURATION = {
|
|
16340
|
-
DEFAULT: 2500,
|
|
16341
|
-
HAS_ACTION: 5500
|
|
16342
|
-
};
|
|
16343
|
-
const ToastProvider = ({ children }) => {
|
|
16344
|
-
const toaster = createToaster({
|
|
16345
|
-
placement: "bottom",
|
|
16346
|
-
duration: DURATION.DEFAULT,
|
|
16347
|
-
offsets: {
|
|
16348
|
-
bottom: "55px",
|
|
16349
|
-
top: "0px",
|
|
16350
|
-
left: "0px",
|
|
16351
|
-
right: "0px"
|
|
16352
|
-
},
|
|
16353
|
-
overlap: true
|
|
16354
|
-
});
|
|
16355
|
-
React.useEffect(() => {
|
|
16356
|
-
toast._setReady();
|
|
16357
|
-
return () => {
|
|
16358
|
-
};
|
|
16359
|
-
}, []);
|
|
16360
|
-
React.useEffect(() => {
|
|
16361
|
-
let currentZIndexCounter = 1300;
|
|
16362
|
-
const showToasts = () => {
|
|
16363
|
-
const queuedToasts = toast._getQueue();
|
|
16364
|
-
queuedToasts.forEach((toastData) => {
|
|
16365
|
-
try {
|
|
16366
|
-
const options = {
|
|
16367
|
-
description: toastData.description,
|
|
16368
|
-
zIndex: currentZIndexCounter++
|
|
16369
|
-
// 증가된 zIndex 값 사용
|
|
16370
|
-
};
|
|
16371
|
-
options.data = {
|
|
16372
|
-
icon: toastData.icon ? toastData.icon : null,
|
|
16373
|
-
asLink: toastData.asLink,
|
|
16374
|
-
zIndex: options.zIndex
|
|
16375
|
-
// zIndex를 data에도 저장
|
|
16376
|
-
};
|
|
16377
|
-
if (toastData.action) {
|
|
16378
|
-
options.action = {
|
|
16379
|
-
label: toastData.action.label,
|
|
16380
|
-
onClick: toastData.action.onClick ?? (() => {
|
|
16381
|
-
}),
|
|
16382
|
-
duration: DURATION.HAS_ACTION
|
|
16383
|
-
};
|
|
16384
|
-
}
|
|
16385
|
-
if (toastData.duration) {
|
|
16386
|
-
options.duration = toastData.duration;
|
|
16387
|
-
}
|
|
16388
|
-
setTimeout(() => {
|
|
16389
|
-
toaster.create(options);
|
|
16390
|
-
}, 0);
|
|
16391
|
-
} catch (error) {
|
|
16392
|
-
console.error("Error creating toast:", error);
|
|
16393
|
-
}
|
|
16394
|
-
});
|
|
16395
|
-
};
|
|
16396
|
-
const handleToastQueue = () => showToasts();
|
|
16397
|
-
window.addEventListener("toast-queue-updated", handleToastQueue);
|
|
16398
|
-
return () => {
|
|
16399
|
-
window.removeEventListener("toast-queue-updated", handleToastQueue);
|
|
16400
|
-
};
|
|
16401
|
-
}, [toaster]);
|
|
16402
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
16403
|
-
children,
|
|
16404
|
-
/* @__PURE__ */ jsxRuntime.jsx(Toaster, { toaster, children: (toast2) => {
|
|
16405
|
-
var _a, _b, _c, _d, _e;
|
|
16406
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16407
|
-
Toast.Root,
|
|
16408
|
-
{
|
|
16409
|
-
asLink: (_a = toast2.data) == null ? void 0 : _a.asLink,
|
|
16410
|
-
style: { zIndex: ((_b = toast2.data) == null ? void 0 : _b.zIndex) || 1e3 },
|
|
16411
|
-
children: [
|
|
16412
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Toast.Content, { children: [
|
|
16413
|
-
((_c = toast2.data) == null ? void 0 : _c.icon) && /* @__PURE__ */ jsxRuntime.jsx(Toast.Icon, { children: toast2.data.icon }),
|
|
16414
|
-
toast2.description && /* @__PURE__ */ jsxRuntime.jsx(Toast.Description, { children: toast2.description })
|
|
16415
|
-
] }),
|
|
16416
|
-
toast2.action && /* @__PURE__ */ jsxRuntime.jsx(Toast.ActionTrigger, { onClick: (_d = toast2.action) == null ? void 0 : _d.onClick, children: (_e = toast2.action) == null ? void 0 : _e.label })
|
|
16417
|
-
]
|
|
16418
|
-
},
|
|
16419
|
-
toast2.id
|
|
16420
|
-
);
|
|
16421
|
-
} })
|
|
16422
|
-
] });
|
|
16423
|
-
};
|
|
16424
15598
|
exports.BottomSheet = BottomSheet;
|
|
16425
15599
|
exports.Box = Box2;
|
|
16426
15600
|
exports.Button = index$4;
|
|
@@ -16440,8 +15614,7 @@ exports.Tabs = Tabs;
|
|
|
16440
15614
|
exports.Tag = index$2;
|
|
16441
15615
|
exports.Text = Text;
|
|
16442
15616
|
exports.TextArea = index;
|
|
16443
|
-
exports.
|
|
15617
|
+
exports.Toast = Toast;
|
|
16444
15618
|
exports.VStack = VStack2;
|
|
16445
15619
|
exports.preset = preset;
|
|
16446
|
-
exports.toast = toast;
|
|
16447
15620
|
//# sourceMappingURL=index.cjs.map
|