@easypost/easy-ui 1.0.0-alpha.0
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/Button/Button.d.ts +27 -0
- package/Button/Button.d.ts.map +1 -0
- package/Button/Button.test.d.ts +2 -0
- package/Button/Button.test.d.ts.map +1 -0
- package/Button/index.d.ts +2 -0
- package/Button/index.d.ts.map +1 -0
- package/Button/index.js +1 -0
- package/Button/index.mjs +49 -0
- package/Button/utilities.d.ts +5 -0
- package/Button/utilities.d.ts.map +1 -0
- package/Button.module-115ca683.mjs +818 -0
- package/Button.module-14fa8511.js +1 -0
- package/Button.module-1fb91980.js +1 -0
- package/Button.module-494257e9.js +1 -0
- package/Button.module-5cc363bc.js +1 -0
- package/Button.module-5ce97013.mjs +818 -0
- package/Button.module-607d5623.mjs +818 -0
- package/Button.module-679f6b64.js +1 -0
- package/Button.module-7023bed7.mjs +818 -0
- package/Button.module-77f21f0f.mjs +818 -0
- package/Button.module-7d974638.mjs +818 -0
- package/Button.module-7f3d0216.js +1 -0
- package/Button.module-82af93cc.mjs +818 -0
- package/Button.module-9123c201.mjs +818 -0
- package/Button.module-91cfa338.js +1 -0
- package/Button.module-942c4274.js +1 -0
- package/Button.module-94a630d2.js +1 -0
- package/Button.module-a2c386c5.mjs +818 -0
- package/Button.module-aa9387fb.js +1 -0
- package/Button.module-baa496d5.mjs +818 -0
- package/DropdownButton/DropdownButton.d.ts +15 -0
- package/DropdownButton/DropdownButton.d.ts.map +1 -0
- package/DropdownButton/DropdownButton.test.d.ts +2 -0
- package/DropdownButton/DropdownButton.test.d.ts.map +1 -0
- package/DropdownButton/index.d.ts +2 -0
- package/DropdownButton/index.d.ts.map +1 -0
- package/DropdownButton/index.js +1 -0
- package/DropdownButton/index.mjs +40 -0
- package/Icon/Icon.d.ts +17 -0
- package/Icon/Icon.d.ts.map +1 -0
- package/Icon/Icon.test.d.ts +2 -0
- package/Icon/Icon.test.d.ts.map +1 -0
- package/Icon/index.d.ts +2 -0
- package/Icon/index.d.ts.map +1 -0
- package/Icon/index.js +1 -0
- package/Icon/index.mjs +6 -0
- package/Icon-0c035f66.mjs +30 -0
- package/Icon-1b63144c.js +1 -0
- package/Icon-37ce3d9a.mjs +30 -0
- package/Icon-53acbca3.mjs +30 -0
- package/Icon-5639942d.js +1 -0
- package/Icon-570b5898.js +1 -0
- package/Icon-666c3de5.js +1 -0
- package/Icon-68936d33.mjs +30 -0
- package/Icon-6abef12c.mjs +30 -0
- package/Icon-8baad3e8.js +1 -0
- package/Icon-8d3de3bb.js +1 -0
- package/Icon-96d00995.mjs +30 -0
- package/Icon-98a40b01.mjs +30 -0
- package/Icon-aa3be33e.js +1 -0
- package/Icon-d82e92cf.js +1 -0
- package/Icon-da4359df.mjs +30 -0
- package/Icon-e3fea9c2.mjs +30 -0
- package/Icon-e457e65d.js +1 -0
- package/Icon-eacb00d7.js +1 -0
- package/Icon-fea6a93a.mjs +30 -0
- package/Placeholder/Placeholder.d.ts +15 -0
- package/Placeholder/Placeholder.d.ts.map +1 -0
- package/Placeholder/Placeholder.test.d.ts +2 -0
- package/Placeholder/Placeholder.test.d.ts.map +1 -0
- package/Placeholder/index.d.ts +2 -0
- package/Placeholder/index.d.ts.map +1 -0
- package/Placeholder/index.js +1 -0
- package/Placeholder/index.mjs +65 -0
- package/Provider/Provider.d.ts +10 -0
- package/Provider/Provider.d.ts.map +1 -0
- package/Provider/index.d.ts +2 -0
- package/Provider/index.d.ts.map +1 -0
- package/Provider/index.js +1 -0
- package/Provider/index.mjs +9 -0
- package/Text/Text.d.ts +70 -0
- package/Text/Text.d.ts.map +1 -0
- package/Text/Text.test.d.ts +2 -0
- package/Text/Text.test.d.ts.map +1 -0
- package/Text/index.d.ts +2 -0
- package/Text/index.d.ts.map +1 -0
- package/Text/index.js +1 -0
- package/Text/index.mjs +60 -0
- package/Theme/Container.d.ts +6 -0
- package/Theme/Container.d.ts.map +1 -0
- package/Theme/Theme.d.ts +63 -0
- package/Theme/Theme.d.ts.map +1 -0
- package/Theme/Theme.test.d.ts +2 -0
- package/Theme/Theme.test.d.ts.map +1 -0
- package/Theme/index.d.ts +2 -0
- package/Theme/index.d.ts.map +1 -0
- package/Theme/index.js +1 -0
- package/Theme/index.mjs +8 -0
- package/Theme-0f0cbd77.mjs +396 -0
- package/Theme-122e766e.mjs +63 -0
- package/Theme-141dde98.js +7 -0
- package/Theme-161aed4a.mjs +389 -0
- package/Theme-1644b1f8.js +1 -0
- package/Theme-1a567898.js +18 -0
- package/Theme-2364878e.js +33 -0
- package/Theme-5ea4ba90.js +5 -0
- package/Theme-6ff68130.mjs +3764 -0
- package/Theme-93ca6374.js +18 -0
- package/Theme-e616f85f.mjs +57 -0
- package/Theme-f6215b48.mjs +375 -0
- package/package.json +19 -0
- package/style.css +1 -0
- package/styles/ezui-theme.scss.js +1 -0
- package/styles/ezui-theme.scss.mjs +4 -0
- package/theme.css +13 -0
- package/tokens-19a34c03.js +1 -0
- package/tokens-32b892de.mjs +192 -0
- package/tokens-4571c29d.js +1 -0
- package/tokens-713623f4.mjs +210 -0
- package/tokens-e7406ce6.js +1 -0
- package/tokens-ecab3956.mjs +196 -0
- package/types.d.ts +16 -0
- package/types.d.ts.map +1 -0
- package/utilities/css.d.ts +21 -0
- package/utilities/css.d.ts.map +1 -0
- package/utilities/css.js +1 -0
- package/utilities/css.mjs +47 -0
- package/utilities/css.test.d.ts +2 -0
- package/utilities/css.test.d.ts.map +1 -0
- package/utilities/css.test.js +1 -0
- package/utilities/css.test.mjs +56 -0
- package/utilities/storybook.d.ts +33 -0
- package/utilities/storybook.d.ts.map +1 -0
- package/utilities/storybook.js +1 -0
- package/utilities/storybook.mjs +33 -0
- package/utilities/tokens.d.ts +2 -0
- package/utilities/tokens.d.ts.map +1 -0
- package/utilities/tokens.js +1 -0
- package/utilities/tokens.mjs +9 -0
- package/utilities/tokens.test.d.ts +2 -0
- package/utilities/tokens.test.d.ts.map +1 -0
- package/utilities/types.d.ts +7 -0
- package/utilities/types.d.ts.map +1 -0
- package/utilities/types.js +1 -0
- package/utilities/types.mjs +1 -0
|
@@ -0,0 +1,818 @@
|
|
|
1
|
+
import Q, { useRef as D, useCallback as x, useEffect as Z, useState as _e, useMemo as Le, useContext as ge } from "react";
|
|
2
|
+
function ve(e) {
|
|
3
|
+
var t, r, o = "";
|
|
4
|
+
if (typeof e == "string" || typeof e == "number")
|
|
5
|
+
o += e;
|
|
6
|
+
else if (typeof e == "object")
|
|
7
|
+
if (Array.isArray(e))
|
|
8
|
+
for (t = 0; t < e.length; t++)
|
|
9
|
+
e[t] && (r = ve(e[t])) && (o && (o += " "), o += r);
|
|
10
|
+
else
|
|
11
|
+
for (t in e)
|
|
12
|
+
e[t] && (o && (o += " "), o += t);
|
|
13
|
+
return o;
|
|
14
|
+
}
|
|
15
|
+
function Me() {
|
|
16
|
+
for (var e, t, r = 0, o = ""; r < arguments.length; )
|
|
17
|
+
(e = arguments[r++]) && (t = ve(e)) && (o && (o += " "), o += t);
|
|
18
|
+
return o;
|
|
19
|
+
}
|
|
20
|
+
const $e = typeof window < "u" ? Q.useLayoutEffect : () => {
|
|
21
|
+
};
|
|
22
|
+
let ae = /* @__PURE__ */ new Map();
|
|
23
|
+
function Ce(e, t) {
|
|
24
|
+
if (e === t)
|
|
25
|
+
return e;
|
|
26
|
+
let r = ae.get(e);
|
|
27
|
+
if (r)
|
|
28
|
+
return r(t), t;
|
|
29
|
+
let o = ae.get(t);
|
|
30
|
+
return o ? (o(e), e) : t;
|
|
31
|
+
}
|
|
32
|
+
function Ke(...e) {
|
|
33
|
+
return (...t) => {
|
|
34
|
+
for (let r of e)
|
|
35
|
+
typeof r == "function" && r(...t);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function k(...e) {
|
|
39
|
+
let t = {
|
|
40
|
+
...e[0]
|
|
41
|
+
};
|
|
42
|
+
for (let r = 1; r < e.length; r++) {
|
|
43
|
+
let o = e[r];
|
|
44
|
+
for (let l in o) {
|
|
45
|
+
let c = t[l], u = o[l];
|
|
46
|
+
typeof c == "function" && typeof u == "function" && // This is a lot faster than a regex.
|
|
47
|
+
l[0] === "o" && l[1] === "n" && l.charCodeAt(2) >= /* 'A' */
|
|
48
|
+
65 && l.charCodeAt(2) <= /* 'Z' */
|
|
49
|
+
90 ? t[l] = Ke(c, u) : (l === "className" || l === "UNSAFE_className") && typeof c == "string" && typeof u == "string" ? t[l] = Me(c, u) : l === "id" && c && u ? t.id = Ce(c, u) : t[l] = u !== void 0 ? u : c;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return t;
|
|
53
|
+
}
|
|
54
|
+
const xe = /* @__PURE__ */ new Set([
|
|
55
|
+
"id"
|
|
56
|
+
]), ke = /* @__PURE__ */ new Set([
|
|
57
|
+
"aria-label",
|
|
58
|
+
"aria-labelledby",
|
|
59
|
+
"aria-describedby",
|
|
60
|
+
"aria-details"
|
|
61
|
+
]), Oe = /^(data-.*)$/;
|
|
62
|
+
function De(e, t = {}) {
|
|
63
|
+
let { labelable: r, propNames: o } = t, l = {};
|
|
64
|
+
for (const c in e)
|
|
65
|
+
Object.prototype.hasOwnProperty.call(e, c) && (xe.has(c) || r && ke.has(c) || o != null && o.has(c) || Oe.test(c)) && (l[c] = e[c]);
|
|
66
|
+
return l;
|
|
67
|
+
}
|
|
68
|
+
function C(e) {
|
|
69
|
+
if (Fe())
|
|
70
|
+
e.focus({
|
|
71
|
+
preventScroll: !0
|
|
72
|
+
});
|
|
73
|
+
else {
|
|
74
|
+
let t = Ae(e);
|
|
75
|
+
e.focus(), Ie(t);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
let N = null;
|
|
79
|
+
function Fe() {
|
|
80
|
+
if (N == null) {
|
|
81
|
+
N = !1;
|
|
82
|
+
try {
|
|
83
|
+
var e = document.createElement("div");
|
|
84
|
+
e.focus({
|
|
85
|
+
get preventScroll() {
|
|
86
|
+
return N = !0, !0;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
} catch {
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return N;
|
|
93
|
+
}
|
|
94
|
+
function Ae(e) {
|
|
95
|
+
for (var t = e.parentNode, r = [], o = document.scrollingElement || document.documentElement; t instanceof HTMLElement && t !== o; )
|
|
96
|
+
(t.offsetHeight < t.scrollHeight || t.offsetWidth < t.scrollWidth) && r.push({
|
|
97
|
+
element: t,
|
|
98
|
+
scrollTop: t.scrollTop,
|
|
99
|
+
scrollLeft: t.scrollLeft
|
|
100
|
+
}), t = t.parentNode;
|
|
101
|
+
return o instanceof HTMLElement && r.push({
|
|
102
|
+
element: o,
|
|
103
|
+
scrollTop: o.scrollTop,
|
|
104
|
+
scrollLeft: o.scrollLeft
|
|
105
|
+
}), r;
|
|
106
|
+
}
|
|
107
|
+
function Ie(e) {
|
|
108
|
+
for (let { element: t, scrollTop: r, scrollLeft: o } of e)
|
|
109
|
+
t.scrollTop = r, t.scrollLeft = o;
|
|
110
|
+
}
|
|
111
|
+
let M = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new Set();
|
|
112
|
+
function se() {
|
|
113
|
+
if (typeof window > "u")
|
|
114
|
+
return;
|
|
115
|
+
let e = (r) => {
|
|
116
|
+
let o = M.get(r.target);
|
|
117
|
+
o || (o = /* @__PURE__ */ new Set(), M.set(r.target, o), r.target.addEventListener("transitioncancel", t)), o.add(r.propertyName);
|
|
118
|
+
}, t = (r) => {
|
|
119
|
+
let o = M.get(r.target);
|
|
120
|
+
if (o && (o.delete(r.propertyName), o.size === 0 && (r.target.removeEventListener("transitioncancel", t), M.delete(r.target)), M.size === 0)) {
|
|
121
|
+
for (let l of V)
|
|
122
|
+
l();
|
|
123
|
+
V.clear();
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
document.body.addEventListener("transitionrun", e), document.body.addEventListener("transitionend", t);
|
|
127
|
+
}
|
|
128
|
+
typeof document < "u" && (document.readyState !== "loading" ? se() : document.addEventListener("DOMContentLoaded", se));
|
|
129
|
+
function ye(e) {
|
|
130
|
+
requestAnimationFrame(() => {
|
|
131
|
+
M.size === 0 ? e() : V.add(e);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
function Re() {
|
|
135
|
+
let e = D(/* @__PURE__ */ new Map()), t = x((l, c, u, d) => {
|
|
136
|
+
let f = d != null && d.once ? (...E) => {
|
|
137
|
+
e.current.delete(u), u(...E);
|
|
138
|
+
} : u;
|
|
139
|
+
e.current.set(u, {
|
|
140
|
+
type: c,
|
|
141
|
+
eventTarget: l,
|
|
142
|
+
fn: f,
|
|
143
|
+
options: d
|
|
144
|
+
}), l.addEventListener(c, u, d);
|
|
145
|
+
}, []), r = x((l, c, u, d) => {
|
|
146
|
+
var f;
|
|
147
|
+
let E = ((f = e.current.get(u)) === null || f === void 0 ? void 0 : f.fn) || u;
|
|
148
|
+
l.removeEventListener(c, E, d), e.current.delete(u);
|
|
149
|
+
}, []), o = x(() => {
|
|
150
|
+
e.current.forEach((l, c) => {
|
|
151
|
+
r(l.eventTarget, l.type, c, l.options);
|
|
152
|
+
});
|
|
153
|
+
}, [
|
|
154
|
+
r
|
|
155
|
+
]);
|
|
156
|
+
return Z(() => o, [
|
|
157
|
+
o
|
|
158
|
+
]), {
|
|
159
|
+
addGlobalListener: t,
|
|
160
|
+
removeGlobalListener: r,
|
|
161
|
+
removeAllGlobalListeners: o
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function he(e, t) {
|
|
165
|
+
$e(() => {
|
|
166
|
+
if (e && e.ref && t)
|
|
167
|
+
return e.ref.current = t.current, () => {
|
|
168
|
+
e.ref.current = null;
|
|
169
|
+
};
|
|
170
|
+
}, [
|
|
171
|
+
e,
|
|
172
|
+
t
|
|
173
|
+
]);
|
|
174
|
+
}
|
|
175
|
+
function Ne(e) {
|
|
176
|
+
var t;
|
|
177
|
+
return typeof window > "u" || window.navigator == null ? !1 : ((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.brands.some((r) => e.test(r.brand))) || e.test(window.navigator.userAgent);
|
|
178
|
+
}
|
|
179
|
+
function ee(e) {
|
|
180
|
+
var t;
|
|
181
|
+
return typeof window < "u" && window.navigator != null ? e.test(((t = window.navigator.userAgentData) === null || t === void 0 ? void 0 : t.platform) || window.navigator.platform) : !1;
|
|
182
|
+
}
|
|
183
|
+
function Pe() {
|
|
184
|
+
return ee(/^Mac/i);
|
|
185
|
+
}
|
|
186
|
+
function Ue() {
|
|
187
|
+
return ee(/^iPhone/i);
|
|
188
|
+
}
|
|
189
|
+
function He() {
|
|
190
|
+
return ee(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
191
|
+
Pe() && navigator.maxTouchPoints > 1;
|
|
192
|
+
}
|
|
193
|
+
function me() {
|
|
194
|
+
return Ue() || He();
|
|
195
|
+
}
|
|
196
|
+
function Be() {
|
|
197
|
+
return Ne(/Android/i);
|
|
198
|
+
}
|
|
199
|
+
function Y(e) {
|
|
200
|
+
return e.mozInputSource === 0 && e.isTrusted ? !0 : Be() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
|
|
201
|
+
}
|
|
202
|
+
function Ge(e) {
|
|
203
|
+
return e.width === 0 && e.height === 0 || e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse";
|
|
204
|
+
}
|
|
205
|
+
function X(e, t, r) {
|
|
206
|
+
return t in e ? Object.defineProperty(e, t, {
|
|
207
|
+
value: r,
|
|
208
|
+
enumerable: !0,
|
|
209
|
+
configurable: !0,
|
|
210
|
+
writable: !0
|
|
211
|
+
}) : e[t] = r, e;
|
|
212
|
+
}
|
|
213
|
+
let K = "default", q = "", H = /* @__PURE__ */ new WeakMap();
|
|
214
|
+
function ie(e) {
|
|
215
|
+
me() ? (K === "default" && (q = document.documentElement.style.webkitUserSelect, document.documentElement.style.webkitUserSelect = "none"), K = "disabled") : (e instanceof HTMLElement || e instanceof SVGElement) && (H.set(e, e.style.userSelect), e.style.userSelect = "none");
|
|
216
|
+
}
|
|
217
|
+
function U(e) {
|
|
218
|
+
if (me()) {
|
|
219
|
+
if (K !== "disabled")
|
|
220
|
+
return;
|
|
221
|
+
K = "restoring", setTimeout(() => {
|
|
222
|
+
ye(() => {
|
|
223
|
+
K === "restoring" && (document.documentElement.style.webkitUserSelect === "none" && (document.documentElement.style.webkitUserSelect = q || ""), q = "", K = "default");
|
|
224
|
+
});
|
|
225
|
+
}, 300);
|
|
226
|
+
} else if ((e instanceof HTMLElement || e instanceof SVGElement) && e && H.has(e)) {
|
|
227
|
+
let t = H.get(e);
|
|
228
|
+
e.style.userSelect === "none" && (e.style.userSelect = t), e.getAttribute("style") === "" && e.removeAttribute("style"), H.delete(e);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
const Te = Q.createContext(null);
|
|
232
|
+
Te.displayName = "PressResponderContext";
|
|
233
|
+
function ze(e) {
|
|
234
|
+
let t = ge(Te);
|
|
235
|
+
if (t) {
|
|
236
|
+
let { register: r, ...o } = t;
|
|
237
|
+
e = k(o, e), r();
|
|
238
|
+
}
|
|
239
|
+
return he(t, e.ref), e;
|
|
240
|
+
}
|
|
241
|
+
function We(e) {
|
|
242
|
+
let {
|
|
243
|
+
onPress: t,
|
|
244
|
+
onPressChange: r,
|
|
245
|
+
onPressStart: o,
|
|
246
|
+
onPressEnd: l,
|
|
247
|
+
onPressUp: c,
|
|
248
|
+
isDisabled: u,
|
|
249
|
+
isPressed: d,
|
|
250
|
+
preventFocusOnPress: f,
|
|
251
|
+
shouldCancelOnPointerExit: E,
|
|
252
|
+
allowTextSelectionOnPress: v,
|
|
253
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
254
|
+
ref: ne,
|
|
255
|
+
...B
|
|
256
|
+
} = ze(e), y = D(null);
|
|
257
|
+
y.current = {
|
|
258
|
+
onPress: t,
|
|
259
|
+
onPressChange: r,
|
|
260
|
+
onPressStart: o,
|
|
261
|
+
onPressEnd: l,
|
|
262
|
+
onPressUp: c,
|
|
263
|
+
isDisabled: u,
|
|
264
|
+
shouldCancelOnPointerExit: E
|
|
265
|
+
};
|
|
266
|
+
let [A, S] = _e(!1), I = D({
|
|
267
|
+
isPressed: !1,
|
|
268
|
+
ignoreEmulatedMouseEvents: !1,
|
|
269
|
+
ignoreClickAfterPress: !1,
|
|
270
|
+
didFirePressStart: !1,
|
|
271
|
+
activePointerId: null,
|
|
272
|
+
target: null,
|
|
273
|
+
isOverTarget: !1,
|
|
274
|
+
pointerType: null
|
|
275
|
+
}), { addGlobalListener: h, removeAllGlobalListeners: $ } = Re(), G = Le(() => {
|
|
276
|
+
let n = I.current, m = (s, b) => {
|
|
277
|
+
let { onPressStart: a, onPressChange: i, isDisabled: R } = y.current;
|
|
278
|
+
R || n.didFirePressStart || (a && a({
|
|
279
|
+
type: "pressstart",
|
|
280
|
+
pointerType: b,
|
|
281
|
+
target: s.currentTarget,
|
|
282
|
+
shiftKey: s.shiftKey,
|
|
283
|
+
metaKey: s.metaKey,
|
|
284
|
+
ctrlKey: s.ctrlKey,
|
|
285
|
+
altKey: s.altKey
|
|
286
|
+
}), i && i(!0), n.didFirePressStart = !0, S(!0));
|
|
287
|
+
}, g = (s, b, a = !0) => {
|
|
288
|
+
let { onPressEnd: i, onPressChange: R, onPress: oe, isDisabled: Se } = y.current;
|
|
289
|
+
n.didFirePressStart && (n.ignoreClickAfterPress = !0, n.didFirePressStart = !1, i && i({
|
|
290
|
+
type: "pressend",
|
|
291
|
+
pointerType: b,
|
|
292
|
+
target: s.currentTarget,
|
|
293
|
+
shiftKey: s.shiftKey,
|
|
294
|
+
metaKey: s.metaKey,
|
|
295
|
+
ctrlKey: s.ctrlKey,
|
|
296
|
+
altKey: s.altKey
|
|
297
|
+
}), R && R(!1), S(!1), oe && a && !Se && oe({
|
|
298
|
+
type: "press",
|
|
299
|
+
pointerType: b,
|
|
300
|
+
target: s.currentTarget,
|
|
301
|
+
shiftKey: s.shiftKey,
|
|
302
|
+
metaKey: s.metaKey,
|
|
303
|
+
ctrlKey: s.ctrlKey,
|
|
304
|
+
altKey: s.altKey
|
|
305
|
+
}));
|
|
306
|
+
}, O = (s, b) => {
|
|
307
|
+
let { onPressUp: a, isDisabled: i } = y.current;
|
|
308
|
+
i || a && a({
|
|
309
|
+
type: "pressup",
|
|
310
|
+
pointerType: b,
|
|
311
|
+
target: s.currentTarget,
|
|
312
|
+
shiftKey: s.shiftKey,
|
|
313
|
+
metaKey: s.metaKey,
|
|
314
|
+
ctrlKey: s.ctrlKey,
|
|
315
|
+
altKey: s.altKey
|
|
316
|
+
});
|
|
317
|
+
}, T = (s) => {
|
|
318
|
+
n.isPressed && (n.isOverTarget && g(P(n.target, s), n.pointerType, !1), n.isPressed = !1, n.isOverTarget = !1, n.activePointerId = null, n.pointerType = null, $(), v || U(n.target));
|
|
319
|
+
}, p = {
|
|
320
|
+
onKeyDown(s) {
|
|
321
|
+
z(s.nativeEvent, s.currentTarget) && s.currentTarget.contains(s.target) ? (ce(s.target, s.key) && s.preventDefault(), s.stopPropagation(), !n.isPressed && !s.repeat && (n.target = s.currentTarget, n.isPressed = !0, m(s, "keyboard"), h(document, "keyup", we, !1))) : s.key === "Enter" && j(s.currentTarget) && s.stopPropagation();
|
|
322
|
+
},
|
|
323
|
+
onKeyUp(s) {
|
|
324
|
+
z(s.nativeEvent, s.currentTarget) && !s.repeat && s.currentTarget.contains(s.target) && O(P(n.target, s), "keyboard");
|
|
325
|
+
},
|
|
326
|
+
onClick(s) {
|
|
327
|
+
s && !s.currentTarget.contains(s.target) || s && s.button === 0 && (s.stopPropagation(), u && s.preventDefault(), !n.ignoreClickAfterPress && !n.ignoreEmulatedMouseEvents && (n.pointerType === "virtual" || Y(s.nativeEvent)) && (!u && !f && C(s.currentTarget), m(s, "virtual"), O(s, "virtual"), g(s, "virtual")), n.ignoreEmulatedMouseEvents = !1, n.ignoreClickAfterPress = !1);
|
|
328
|
+
}
|
|
329
|
+
}, we = (s) => {
|
|
330
|
+
if (n.isPressed && z(s, n.target)) {
|
|
331
|
+
ce(s.target, s.key) && s.preventDefault(), s.stopPropagation(), n.isPressed = !1;
|
|
332
|
+
let b = s.target;
|
|
333
|
+
g(P(n.target, s), "keyboard", n.target.contains(b)), $(), n.target instanceof HTMLElement && n.target.contains(b) && (j(n.target) || n.target.getAttribute("role") === "link") && n.target.click();
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
if (typeof PointerEvent < "u") {
|
|
337
|
+
p.onPointerDown = (i) => {
|
|
338
|
+
if (!(i.button !== 0 || !i.currentTarget.contains(i.target))) {
|
|
339
|
+
if (Ge(i.nativeEvent)) {
|
|
340
|
+
n.pointerType = "virtual";
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
W(i.currentTarget) && i.preventDefault(), n.pointerType = i.pointerType, i.stopPropagation(), n.isPressed || (n.isPressed = !0, n.isOverTarget = !0, n.activePointerId = i.pointerId, n.target = i.currentTarget, !u && !f && C(i.currentTarget), v || ie(n.target), m(i, n.pointerType), h(document, "pointermove", s, !1), h(document, "pointerup", b, !1), h(document, "pointercancel", a, !1));
|
|
344
|
+
}
|
|
345
|
+
}, p.onMouseDown = (i) => {
|
|
346
|
+
i.currentTarget.contains(i.target) && i.button === 0 && (W(i.currentTarget) && i.preventDefault(), i.stopPropagation());
|
|
347
|
+
}, p.onPointerUp = (i) => {
|
|
348
|
+
!i.currentTarget.contains(i.target) || n.pointerType === "virtual" || i.button === 0 && _(i, i.currentTarget) && O(i, n.pointerType || i.pointerType);
|
|
349
|
+
};
|
|
350
|
+
let s = (i) => {
|
|
351
|
+
i.pointerId === n.activePointerId && (_(i, n.target) ? n.isOverTarget || (n.isOverTarget = !0, m(P(n.target, i), n.pointerType)) : n.isOverTarget && (n.isOverTarget = !1, g(P(n.target, i), n.pointerType, !1), y.current.shouldCancelOnPointerExit && T(i)));
|
|
352
|
+
}, b = (i) => {
|
|
353
|
+
i.pointerId === n.activePointerId && n.isPressed && i.button === 0 && (_(i, n.target) ? g(P(n.target, i), n.pointerType) : n.isOverTarget && g(P(n.target, i), n.pointerType, !1), n.isPressed = !1, n.isOverTarget = !1, n.activePointerId = null, n.pointerType = null, $(), v || U(n.target));
|
|
354
|
+
}, a = (i) => {
|
|
355
|
+
T(i);
|
|
356
|
+
};
|
|
357
|
+
p.onDragStart = (i) => {
|
|
358
|
+
i.currentTarget.contains(i.target) && T(i);
|
|
359
|
+
};
|
|
360
|
+
} else {
|
|
361
|
+
p.onMouseDown = (a) => {
|
|
362
|
+
a.button !== 0 || !a.currentTarget.contains(a.target) || (W(a.currentTarget) && a.preventDefault(), a.stopPropagation(), !n.ignoreEmulatedMouseEvents && (n.isPressed = !0, n.isOverTarget = !0, n.target = a.currentTarget, n.pointerType = Y(a.nativeEvent) ? "virtual" : "mouse", !u && !f && C(a.currentTarget), m(a, n.pointerType), h(document, "mouseup", s, !1)));
|
|
363
|
+
}, p.onMouseEnter = (a) => {
|
|
364
|
+
a.currentTarget.contains(a.target) && (a.stopPropagation(), n.isPressed && !n.ignoreEmulatedMouseEvents && (n.isOverTarget = !0, m(a, n.pointerType)));
|
|
365
|
+
}, p.onMouseLeave = (a) => {
|
|
366
|
+
a.currentTarget.contains(a.target) && (a.stopPropagation(), n.isPressed && !n.ignoreEmulatedMouseEvents && (n.isOverTarget = !1, g(a, n.pointerType, !1), y.current.shouldCancelOnPointerExit && T(a)));
|
|
367
|
+
}, p.onMouseUp = (a) => {
|
|
368
|
+
a.currentTarget.contains(a.target) && !n.ignoreEmulatedMouseEvents && a.button === 0 && O(a, n.pointerType);
|
|
369
|
+
};
|
|
370
|
+
let s = (a) => {
|
|
371
|
+
if (a.button === 0) {
|
|
372
|
+
if (n.isPressed = !1, $(), n.ignoreEmulatedMouseEvents) {
|
|
373
|
+
n.ignoreEmulatedMouseEvents = !1;
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
_(a, n.target) ? g(P(n.target, a), n.pointerType) : n.isOverTarget && g(P(n.target, a), n.pointerType, !1), n.isOverTarget = !1;
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
p.onTouchStart = (a) => {
|
|
380
|
+
if (!a.currentTarget.contains(a.target))
|
|
381
|
+
return;
|
|
382
|
+
a.stopPropagation();
|
|
383
|
+
let i = Ve(a.nativeEvent);
|
|
384
|
+
i && (n.activePointerId = i.identifier, n.ignoreEmulatedMouseEvents = !0, n.isOverTarget = !0, n.isPressed = !0, n.target = a.currentTarget, n.pointerType = "touch", !u && !f && C(a.currentTarget), v || ie(n.target), m(a, n.pointerType), h(window, "scroll", b, !0));
|
|
385
|
+
}, p.onTouchMove = (a) => {
|
|
386
|
+
if (!a.currentTarget.contains(a.target) || (a.stopPropagation(), !n.isPressed))
|
|
387
|
+
return;
|
|
388
|
+
let i = le(a.nativeEvent, n.activePointerId);
|
|
389
|
+
i && _(i, a.currentTarget) ? n.isOverTarget || (n.isOverTarget = !0, m(a, n.pointerType)) : n.isOverTarget && (n.isOverTarget = !1, g(a, n.pointerType, !1), y.current.shouldCancelOnPointerExit && T(a));
|
|
390
|
+
}, p.onTouchEnd = (a) => {
|
|
391
|
+
if (!a.currentTarget.contains(a.target) || (a.stopPropagation(), !n.isPressed))
|
|
392
|
+
return;
|
|
393
|
+
let i = le(a.nativeEvent, n.activePointerId);
|
|
394
|
+
i && _(i, a.currentTarget) ? (O(a, n.pointerType), g(a, n.pointerType)) : n.isOverTarget && g(a, n.pointerType, !1), n.isPressed = !1, n.activePointerId = null, n.isOverTarget = !1, n.ignoreEmulatedMouseEvents = !0, v || U(n.target), $();
|
|
395
|
+
}, p.onTouchCancel = (a) => {
|
|
396
|
+
a.currentTarget.contains(a.target) && (a.stopPropagation(), n.isPressed && T(a));
|
|
397
|
+
};
|
|
398
|
+
let b = (a) => {
|
|
399
|
+
n.isPressed && a.target.contains(n.target) && T({
|
|
400
|
+
currentTarget: n.target,
|
|
401
|
+
shiftKey: !1,
|
|
402
|
+
ctrlKey: !1,
|
|
403
|
+
metaKey: !1,
|
|
404
|
+
altKey: !1
|
|
405
|
+
});
|
|
406
|
+
};
|
|
407
|
+
p.onDragStart = (a) => {
|
|
408
|
+
a.currentTarget.contains(a.target) && T(a);
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
return p;
|
|
412
|
+
}, [
|
|
413
|
+
h,
|
|
414
|
+
u,
|
|
415
|
+
f,
|
|
416
|
+
$,
|
|
417
|
+
v
|
|
418
|
+
]);
|
|
419
|
+
return Z(() => () => {
|
|
420
|
+
v || U(I.current.target);
|
|
421
|
+
}, [
|
|
422
|
+
v
|
|
423
|
+
]), {
|
|
424
|
+
isPressed: d || A,
|
|
425
|
+
pressProps: k(B, G)
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
function j(e) {
|
|
429
|
+
return e.tagName === "A" && e.hasAttribute("href");
|
|
430
|
+
}
|
|
431
|
+
function z(e, t) {
|
|
432
|
+
const { key: r, code: o } = e, l = t, c = l.getAttribute("role");
|
|
433
|
+
return (r === "Enter" || r === " " || r === "Spacebar" || o === "Space") && !(l instanceof HTMLInputElement && !Ee(l, r) || l instanceof HTMLTextAreaElement || l.isContentEditable) && // A link with a valid href should be handled natively,
|
|
434
|
+
// unless it also has role='button' and was triggered using Space.
|
|
435
|
+
(!j(l) || c === "button" && r !== "Enter") && // An element with role='link' should only trigger with Enter key
|
|
436
|
+
!(c === "link" && r !== "Enter");
|
|
437
|
+
}
|
|
438
|
+
function Ve(e) {
|
|
439
|
+
const { targetTouches: t } = e;
|
|
440
|
+
return t.length > 0 ? t[0] : null;
|
|
441
|
+
}
|
|
442
|
+
function le(e, t) {
|
|
443
|
+
const r = e.changedTouches;
|
|
444
|
+
for (let o = 0; o < r.length; o++) {
|
|
445
|
+
const l = r[o];
|
|
446
|
+
if (l.identifier === t)
|
|
447
|
+
return l;
|
|
448
|
+
}
|
|
449
|
+
return null;
|
|
450
|
+
}
|
|
451
|
+
function P(e, t) {
|
|
452
|
+
return {
|
|
453
|
+
currentTarget: e,
|
|
454
|
+
shiftKey: t.shiftKey,
|
|
455
|
+
ctrlKey: t.ctrlKey,
|
|
456
|
+
metaKey: t.metaKey,
|
|
457
|
+
altKey: t.altKey
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
function Ye(e) {
|
|
461
|
+
let t = e.width / 2 || e.radiusX || 0, r = e.height / 2 || e.radiusY || 0;
|
|
462
|
+
return {
|
|
463
|
+
top: e.clientY - r,
|
|
464
|
+
right: e.clientX + t,
|
|
465
|
+
bottom: e.clientY + r,
|
|
466
|
+
left: e.clientX - t
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
function Xe(e, t) {
|
|
470
|
+
return !(e.left > t.right || t.left > e.right || e.top > t.bottom || t.top > e.bottom);
|
|
471
|
+
}
|
|
472
|
+
function _(e, t) {
|
|
473
|
+
let r = t.getBoundingClientRect(), o = Ye(e);
|
|
474
|
+
return Xe(r, o);
|
|
475
|
+
}
|
|
476
|
+
function W(e) {
|
|
477
|
+
return !(e instanceof HTMLElement) || !e.draggable;
|
|
478
|
+
}
|
|
479
|
+
function ce(e, t) {
|
|
480
|
+
return e instanceof HTMLInputElement ? !Ee(e, t) : e instanceof HTMLButtonElement ? e.type !== "submit" : !0;
|
|
481
|
+
}
|
|
482
|
+
const qe = /* @__PURE__ */ new Set([
|
|
483
|
+
"checkbox",
|
|
484
|
+
"radio",
|
|
485
|
+
"range",
|
|
486
|
+
"color",
|
|
487
|
+
"file",
|
|
488
|
+
"image",
|
|
489
|
+
"button",
|
|
490
|
+
"submit",
|
|
491
|
+
"reset"
|
|
492
|
+
]);
|
|
493
|
+
function Ee(e, t) {
|
|
494
|
+
return e.type === "checkbox" || e.type === "radio" ? t === " " : qe.has(e.type);
|
|
495
|
+
}
|
|
496
|
+
class je {
|
|
497
|
+
isDefaultPrevented() {
|
|
498
|
+
return this.nativeEvent.defaultPrevented;
|
|
499
|
+
}
|
|
500
|
+
preventDefault() {
|
|
501
|
+
this.defaultPrevented = !0, this.nativeEvent.preventDefault();
|
|
502
|
+
}
|
|
503
|
+
stopPropagation() {
|
|
504
|
+
this.nativeEvent.stopPropagation(), this.isPropagationStopped = () => !0;
|
|
505
|
+
}
|
|
506
|
+
isPropagationStopped() {
|
|
507
|
+
return !1;
|
|
508
|
+
}
|
|
509
|
+
persist() {
|
|
510
|
+
}
|
|
511
|
+
constructor(t, r) {
|
|
512
|
+
this.nativeEvent = r, this.target = r.target, this.currentTarget = r.currentTarget, this.relatedTarget = r.relatedTarget, this.bubbles = r.bubbles, this.cancelable = r.cancelable, this.defaultPrevented = r.defaultPrevented, this.eventPhase = r.eventPhase, this.isTrusted = r.isTrusted, this.timeStamp = r.timeStamp, this.type = t;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
function Je(e) {
|
|
516
|
+
let t = D({
|
|
517
|
+
isFocused: !1,
|
|
518
|
+
onBlur: e,
|
|
519
|
+
observer: null
|
|
520
|
+
});
|
|
521
|
+
return t.current.onBlur = e, $e(() => {
|
|
522
|
+
const r = t.current;
|
|
523
|
+
return () => {
|
|
524
|
+
r.observer && (r.observer.disconnect(), r.observer = null);
|
|
525
|
+
};
|
|
526
|
+
}, []), x((r) => {
|
|
527
|
+
if (r.target instanceof HTMLButtonElement || r.target instanceof HTMLInputElement || r.target instanceof HTMLTextAreaElement || r.target instanceof HTMLSelectElement) {
|
|
528
|
+
t.current.isFocused = !0;
|
|
529
|
+
let o = r.target, l = (c) => {
|
|
530
|
+
var u, d;
|
|
531
|
+
t.current.isFocused = !1, o.disabled && ((d = (u = t.current).onBlur) === null || d === void 0 || d.call(u, new je("blur", c))), t.current.observer && (t.current.observer.disconnect(), t.current.observer = null);
|
|
532
|
+
};
|
|
533
|
+
o.addEventListener("focusout", l, {
|
|
534
|
+
once: !0
|
|
535
|
+
}), t.current.observer = new MutationObserver(() => {
|
|
536
|
+
t.current.isFocused && o.disabled && (t.current.observer.disconnect(), o.dispatchEvent(new FocusEvent("blur")), o.dispatchEvent(new FocusEvent("focusout", {
|
|
537
|
+
bubbles: !0
|
|
538
|
+
})));
|
|
539
|
+
}), t.current.observer.observe(o, {
|
|
540
|
+
attributes: !0,
|
|
541
|
+
attributeFilter: [
|
|
542
|
+
"disabled"
|
|
543
|
+
]
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
}, []);
|
|
547
|
+
}
|
|
548
|
+
function Qe(e) {
|
|
549
|
+
let { isDisabled: t, onFocus: r, onBlur: o, onFocusChange: l } = e;
|
|
550
|
+
const c = x((f) => {
|
|
551
|
+
if (f.target === f.currentTarget)
|
|
552
|
+
return o && o(f), l && l(!1), !0;
|
|
553
|
+
}, [
|
|
554
|
+
o,
|
|
555
|
+
l
|
|
556
|
+
]), u = Je(c), d = x((f) => {
|
|
557
|
+
f.target === f.currentTarget && (r && r(f), l && l(!0), u(f));
|
|
558
|
+
}, [
|
|
559
|
+
l,
|
|
560
|
+
r,
|
|
561
|
+
u
|
|
562
|
+
]);
|
|
563
|
+
return {
|
|
564
|
+
focusProps: {
|
|
565
|
+
onFocus: !t && (r || l || o) ? d : void 0,
|
|
566
|
+
onBlur: !t && (o || l) ? c : void 0
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
let F = null, Ze = /* @__PURE__ */ new Set(), ue = !1, w = !1, J = !1;
|
|
571
|
+
function te(e, t) {
|
|
572
|
+
for (let r of Ze)
|
|
573
|
+
r(e, t);
|
|
574
|
+
}
|
|
575
|
+
function et(e) {
|
|
576
|
+
return !(e.metaKey || !Pe() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
|
|
577
|
+
}
|
|
578
|
+
function fe(e) {
|
|
579
|
+
w = !0, et(e) && (F = "keyboard", te("keyboard", e));
|
|
580
|
+
}
|
|
581
|
+
function L(e) {
|
|
582
|
+
F = "pointer", (e.type === "mousedown" || e.type === "pointerdown") && (w = !0, te("pointer", e));
|
|
583
|
+
}
|
|
584
|
+
function tt(e) {
|
|
585
|
+
Y(e) && (w = !0, F = "virtual");
|
|
586
|
+
}
|
|
587
|
+
function rt(e) {
|
|
588
|
+
e.target === window || e.target === document || (!w && !J && (F = "virtual", te("virtual", e)), w = !1, J = !1);
|
|
589
|
+
}
|
|
590
|
+
function nt() {
|
|
591
|
+
w = !1, J = !0;
|
|
592
|
+
}
|
|
593
|
+
function de() {
|
|
594
|
+
if (typeof window > "u" || ue)
|
|
595
|
+
return;
|
|
596
|
+
let e = HTMLElement.prototype.focus;
|
|
597
|
+
HTMLElement.prototype.focus = function() {
|
|
598
|
+
w = !0, e.apply(this, arguments);
|
|
599
|
+
}, document.addEventListener("keydown", fe, !0), document.addEventListener("keyup", fe, !0), document.addEventListener("click", tt, !0), window.addEventListener("focus", rt, !0), window.addEventListener("blur", nt, !1), typeof PointerEvent < "u" ? (document.addEventListener("pointerdown", L, !0), document.addEventListener("pointermove", L, !0), document.addEventListener("pointerup", L, !0)) : (document.addEventListener("mousedown", L, !0), document.addEventListener("mousemove", L, !0), document.addEventListener("mouseup", L, !0)), ue = !0;
|
|
600
|
+
}
|
|
601
|
+
typeof document < "u" && (document.readyState !== "loading" ? de() : document.addEventListener("DOMContentLoaded", de));
|
|
602
|
+
function ot() {
|
|
603
|
+
return F;
|
|
604
|
+
}
|
|
605
|
+
function pe(e) {
|
|
606
|
+
if (!e)
|
|
607
|
+
return;
|
|
608
|
+
let t = !0;
|
|
609
|
+
return (r) => {
|
|
610
|
+
let o = {
|
|
611
|
+
...r,
|
|
612
|
+
preventDefault() {
|
|
613
|
+
r.preventDefault();
|
|
614
|
+
},
|
|
615
|
+
isDefaultPrevented() {
|
|
616
|
+
return r.isDefaultPrevented();
|
|
617
|
+
},
|
|
618
|
+
stopPropagation() {
|
|
619
|
+
console.error("stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.");
|
|
620
|
+
},
|
|
621
|
+
continuePropagation() {
|
|
622
|
+
t = !1;
|
|
623
|
+
}
|
|
624
|
+
};
|
|
625
|
+
e(o), t && r.stopPropagation();
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
function at(e) {
|
|
629
|
+
return {
|
|
630
|
+
keyboardProps: e.isDisabled ? {} : {
|
|
631
|
+
onKeyDown: pe(e.onKeyDown),
|
|
632
|
+
onKeyUp: pe(e.onKeyUp)
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
function st(e) {
|
|
637
|
+
if (ot() === "virtual") {
|
|
638
|
+
let t = document.activeElement;
|
|
639
|
+
ye(() => {
|
|
640
|
+
document.activeElement === t && document.contains(e) && C(e);
|
|
641
|
+
});
|
|
642
|
+
} else
|
|
643
|
+
C(e);
|
|
644
|
+
}
|
|
645
|
+
function it(e, t) {
|
|
646
|
+
return t.some((r) => r.contains(e));
|
|
647
|
+
}
|
|
648
|
+
class re {
|
|
649
|
+
get size() {
|
|
650
|
+
return this.fastMap.size;
|
|
651
|
+
}
|
|
652
|
+
getTreeNode(t) {
|
|
653
|
+
return this.fastMap.get(t);
|
|
654
|
+
}
|
|
655
|
+
addTreeNode(t, r, o) {
|
|
656
|
+
let l = this.fastMap.get(r ?? null), c = new be({
|
|
657
|
+
scopeRef: t
|
|
658
|
+
});
|
|
659
|
+
l.addChild(c), c.parent = l, this.fastMap.set(t, c), o && (c.nodeToRestore = o);
|
|
660
|
+
}
|
|
661
|
+
addNode(t) {
|
|
662
|
+
this.fastMap.set(t.scopeRef, t);
|
|
663
|
+
}
|
|
664
|
+
removeTreeNode(t) {
|
|
665
|
+
if (t === null)
|
|
666
|
+
return;
|
|
667
|
+
let r = this.fastMap.get(t), o = r.parent;
|
|
668
|
+
for (let c of this.traverse())
|
|
669
|
+
c !== r && r.nodeToRestore && c.nodeToRestore && r.scopeRef.current && it(c.nodeToRestore, r.scopeRef.current) && (c.nodeToRestore = r.nodeToRestore);
|
|
670
|
+
let l = r.children;
|
|
671
|
+
o.removeChild(r), l.size > 0 && l.forEach((c) => o.addChild(c)), this.fastMap.delete(r.scopeRef);
|
|
672
|
+
}
|
|
673
|
+
// Pre Order Depth First
|
|
674
|
+
*traverse(t = this.root) {
|
|
675
|
+
if (t.scopeRef != null && (yield t), t.children.size > 0)
|
|
676
|
+
for (let r of t.children)
|
|
677
|
+
yield* this.traverse(r);
|
|
678
|
+
}
|
|
679
|
+
clone() {
|
|
680
|
+
let t = new re();
|
|
681
|
+
for (let r of this.traverse())
|
|
682
|
+
t.addTreeNode(r.scopeRef, r.parent.scopeRef, r.nodeToRestore);
|
|
683
|
+
return t;
|
|
684
|
+
}
|
|
685
|
+
constructor() {
|
|
686
|
+
X(this, "fastMap", /* @__PURE__ */ new Map()), this.root = new be({
|
|
687
|
+
scopeRef: null
|
|
688
|
+
}), this.fastMap.set(null, this.root);
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
class be {
|
|
692
|
+
addChild(t) {
|
|
693
|
+
this.children.add(t), t.parent = this;
|
|
694
|
+
}
|
|
695
|
+
removeChild(t) {
|
|
696
|
+
this.children.delete(t), t.parent = void 0;
|
|
697
|
+
}
|
|
698
|
+
constructor(t) {
|
|
699
|
+
X(this, "children", /* @__PURE__ */ new Set()), X(this, "contain", !1), this.scopeRef = t.scopeRef;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
new re();
|
|
703
|
+
let lt = /* @__PURE__ */ Q.createContext(null);
|
|
704
|
+
function ct(e) {
|
|
705
|
+
let t = ge(lt) || {};
|
|
706
|
+
he(t, e);
|
|
707
|
+
let { ref: r, ...o } = t;
|
|
708
|
+
return o;
|
|
709
|
+
}
|
|
710
|
+
function ut(e, t) {
|
|
711
|
+
let { focusProps: r } = Qe(e), { keyboardProps: o } = at(e), l = k(r, o), c = ct(t), u = e.isDisabled ? {} : c, d = D(e.autoFocus);
|
|
712
|
+
return Z(() => {
|
|
713
|
+
d.current && t.current && st(t.current), d.current = !1;
|
|
714
|
+
}, [
|
|
715
|
+
t
|
|
716
|
+
]), {
|
|
717
|
+
focusableProps: k({
|
|
718
|
+
...l,
|
|
719
|
+
tabIndex: e.excludeFromTabOrder && !e.isDisabled ? -1 : void 0
|
|
720
|
+
}, u)
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
function Mt(e, t) {
|
|
724
|
+
let {
|
|
725
|
+
elementType: r = "button",
|
|
726
|
+
isDisabled: o,
|
|
727
|
+
onPress: l,
|
|
728
|
+
onPressStart: c,
|
|
729
|
+
onPressEnd: u,
|
|
730
|
+
onPressChange: d,
|
|
731
|
+
preventFocusOnPress: f,
|
|
732
|
+
allowFocusWhenDisabled: E,
|
|
733
|
+
// @ts-ignore
|
|
734
|
+
onClick: v,
|
|
735
|
+
href: ne,
|
|
736
|
+
target: B,
|
|
737
|
+
rel: y,
|
|
738
|
+
type: A = "button"
|
|
739
|
+
} = e, S;
|
|
740
|
+
r === "button" ? S = {
|
|
741
|
+
type: A,
|
|
742
|
+
disabled: o
|
|
743
|
+
} : S = {
|
|
744
|
+
role: "button",
|
|
745
|
+
tabIndex: o ? void 0 : 0,
|
|
746
|
+
href: r === "a" && o ? void 0 : ne,
|
|
747
|
+
target: r === "a" ? B : void 0,
|
|
748
|
+
type: r === "input" ? A : void 0,
|
|
749
|
+
disabled: r === "input" ? o : void 0,
|
|
750
|
+
"aria-disabled": !o || r === "input" ? void 0 : o,
|
|
751
|
+
rel: r === "a" ? y : void 0
|
|
752
|
+
};
|
|
753
|
+
let { pressProps: I, isPressed: h } = We({
|
|
754
|
+
onPressStart: c,
|
|
755
|
+
onPressEnd: u,
|
|
756
|
+
onPressChange: d,
|
|
757
|
+
onPress: l,
|
|
758
|
+
isDisabled: o,
|
|
759
|
+
preventFocusOnPress: f,
|
|
760
|
+
ref: t
|
|
761
|
+
}), { focusableProps: $ } = ut(e, t);
|
|
762
|
+
E && ($.tabIndex = o ? -1 : $.tabIndex);
|
|
763
|
+
let G = k($, I, De(e, {
|
|
764
|
+
labelable: !0
|
|
765
|
+
}));
|
|
766
|
+
return {
|
|
767
|
+
isPressed: h,
|
|
768
|
+
buttonProps: k(S, G, {
|
|
769
|
+
"aria-haspopup": e["aria-haspopup"],
|
|
770
|
+
"aria-expanded": e["aria-expanded"],
|
|
771
|
+
"aria-controls": e["aria-controls"],
|
|
772
|
+
"aria-pressed": e["aria-pressed"],
|
|
773
|
+
onClick: (n) => {
|
|
774
|
+
v && (v(n), console.warn("onClick is deprecated, please use onPress"));
|
|
775
|
+
}
|
|
776
|
+
})
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
function Ct(e, t) {
|
|
780
|
+
var o;
|
|
781
|
+
(o = {
|
|
782
|
+
filled: ["primary", "secondary", "success", "warning", "neutral"],
|
|
783
|
+
outlined: [
|
|
784
|
+
"primary",
|
|
785
|
+
"secondary",
|
|
786
|
+
"success",
|
|
787
|
+
"warning",
|
|
788
|
+
"support",
|
|
789
|
+
"inverse"
|
|
790
|
+
],
|
|
791
|
+
link: ["primary", "secondary"]
|
|
792
|
+
}[t]) != null && o.includes(e) || console.warn(
|
|
793
|
+
`The color '${e}' is not supported with the '${t}' variant`
|
|
794
|
+
);
|
|
795
|
+
}
|
|
796
|
+
const ft = "_Button_148ha_5", dt = "_colorPrimary_148ha_20", pt = "_colorSecondary_148ha_28", bt = "_colorSuccess_148ha_36", gt = "_colorWarning_148ha_44", vt = "_colorNeutral_148ha_52", $t = "_colorSupport_148ha_60", yt = "_colorInverse_148ha_66", ht = "_variantFilled_148ha_72", Pt = "_variantOutlined_148ha_99", mt = "_variantLink_148ha_128", Tt = "_sizeMd_148ha_148", Et = "_sizeSm_148ha_156", wt = "_block_148ha_173", St = "_iconAtStart_148ha_178", _t = "_iconAtEnd_148ha_182", Kt = {
|
|
797
|
+
Button: ft,
|
|
798
|
+
colorPrimary: dt,
|
|
799
|
+
colorSecondary: pt,
|
|
800
|
+
colorSuccess: bt,
|
|
801
|
+
colorWarning: gt,
|
|
802
|
+
colorNeutral: vt,
|
|
803
|
+
colorSupport: $t,
|
|
804
|
+
colorInverse: yt,
|
|
805
|
+
variantFilled: ht,
|
|
806
|
+
variantOutlined: Pt,
|
|
807
|
+
variantLink: mt,
|
|
808
|
+
sizeMd: Tt,
|
|
809
|
+
sizeSm: Et,
|
|
810
|
+
block: wt,
|
|
811
|
+
iconAtStart: St,
|
|
812
|
+
iconAtEnd: _t
|
|
813
|
+
};
|
|
814
|
+
export {
|
|
815
|
+
Mt as $,
|
|
816
|
+
Kt as c,
|
|
817
|
+
Ct as l
|
|
818
|
+
};
|