@sps-woodland/buttons 8.7.4 → 8.7.6
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/lib/index.cjs.js +2 -2
- package/lib/index.es.js +386 -425
- package/lib/style.css +1 -1
- package/package.json +5 -5
- /package/{vite.config.js → vite.config.mjs} +0 -0
package/lib/index.es.js
CHANGED
@@ -1,61 +1,61 @@
|
|
1
1
|
import * as c from "react";
|
2
|
-
import
|
3
|
-
import { Metadata as
|
4
|
-
import { useFocusable as
|
2
|
+
import Te, { useRef as Q, useCallback as Y, useEffect as X, useState as Be, useMemo as $e, useContext as Ke } from "react";
|
3
|
+
import { Metadata as Ae, I18nContext as Le, Spinner as Me, cl as Fe, Icon as Ue } from "@sps-woodland/core";
|
4
|
+
import { useFocusable as He, FocusRing as Re } from "@react-aria/focus";
|
5
5
|
import { code as y } from "@spscommerce/utils";
|
6
|
-
|
7
|
-
var t, r, o = "";
|
8
|
-
if (typeof e == "string" || typeof e == "number")
|
9
|
-
o += e;
|
10
|
-
else if (typeof e == "object")
|
11
|
-
if (Array.isArray(e)) {
|
12
|
-
var i = e.length;
|
13
|
-
for (t = 0; t < i; t++)
|
14
|
-
e[t] && (r = Le(e[t])) && (o && (o += " "), o += r);
|
15
|
-
} else
|
16
|
-
for (r in e)
|
17
|
-
e[r] && (o && (o += " "), o += r);
|
18
|
-
return o;
|
19
|
-
}
|
20
|
-
function et() {
|
21
|
-
for (var e, t, r = 0, o = "", i = arguments.length; r < i; r++)
|
22
|
-
(e = arguments[r]) && (t = Le(e)) && (o && (o += " "), o += t);
|
23
|
-
return o;
|
24
|
-
}
|
25
|
-
const Ce = typeof document < "u" ? Ne.useLayoutEffect : () => {
|
6
|
+
const Pe = typeof document < "u" ? Te.useLayoutEffect : () => {
|
26
7
|
};
|
27
|
-
function
|
28
|
-
const t =
|
29
|
-
return
|
8
|
+
function F(e) {
|
9
|
+
const t = Q(null);
|
10
|
+
return Pe(() => {
|
30
11
|
t.current = e;
|
31
12
|
}, [
|
32
13
|
e
|
33
|
-
]),
|
14
|
+
]), Y((...r) => {
|
34
15
|
const o = t.current;
|
35
16
|
return o == null ? void 0 : o(...r);
|
36
17
|
}, []);
|
37
18
|
}
|
38
|
-
let
|
39
|
-
function
|
19
|
+
let de = /* @__PURE__ */ new Map();
|
20
|
+
function Ge(e, t) {
|
40
21
|
if (e === t)
|
41
22
|
return e;
|
42
|
-
let r =
|
23
|
+
let r = de.get(e);
|
43
24
|
if (r)
|
44
25
|
return r(t), t;
|
45
|
-
let o =
|
26
|
+
let o = de.get(t);
|
46
27
|
return o ? (o(e), e) : t;
|
47
28
|
}
|
48
|
-
function
|
29
|
+
function we(...e) {
|
49
30
|
return (...t) => {
|
50
31
|
for (let r of e)
|
51
32
|
typeof r == "function" && r(...t);
|
52
33
|
};
|
53
34
|
}
|
54
|
-
const
|
35
|
+
const _ = (e) => {
|
55
36
|
var t;
|
56
37
|
return (t = e == null ? void 0 : e.ownerDocument) !== null && t !== void 0 ? t : document;
|
57
|
-
},
|
58
|
-
function
|
38
|
+
}, se = (e) => e && "window" in e && e.window === e ? e : _(e).defaultView || window;
|
39
|
+
function xe(e) {
|
40
|
+
var t, r, o = "";
|
41
|
+
if (typeof e == "string" || typeof e == "number")
|
42
|
+
o += e;
|
43
|
+
else if (typeof e == "object")
|
44
|
+
if (Array.isArray(e)) {
|
45
|
+
var i = e.length;
|
46
|
+
for (t = 0; t < i; t++)
|
47
|
+
e[t] && (r = xe(e[t])) && (o && (o += " "), o += r);
|
48
|
+
} else
|
49
|
+
for (r in e)
|
50
|
+
e[r] && (o && (o += " "), o += r);
|
51
|
+
return o;
|
52
|
+
}
|
53
|
+
function Ve() {
|
54
|
+
for (var e, t, r = 0, o = "", i = arguments.length; r < i; r++)
|
55
|
+
(e = arguments[r]) && (t = xe(e)) && (o && (o += " "), o += t);
|
56
|
+
return o;
|
57
|
+
}
|
58
|
+
function H(...e) {
|
59
59
|
let t = {
|
60
60
|
...e[0]
|
61
61
|
};
|
@@ -63,58 +63,62 @@ function W(...e) {
|
|
63
63
|
let o = e[r];
|
64
64
|
for (let i in o) {
|
65
65
|
let d = t[i], u = o[i];
|
66
|
-
typeof d == "function" && typeof u == "function" &&
|
66
|
+
typeof d == "function" && typeof u == "function" && // This is a lot faster than a regex.
|
67
|
+
i[0] === "o" && i[1] === "n" && i.charCodeAt(2) >= /* 'A' */
|
68
|
+
65 && i.charCodeAt(2) <= /* 'Z' */
|
69
|
+
90 ? t[i] = we(d, u) : (i === "className" || i === "UNSAFE_className") && typeof d == "string" && typeof u == "string" ? t[i] = Ve(d, u) : i === "id" && d && u ? t.id = Ge(d, u) : t[i] = u !== void 0 ? u : d;
|
67
70
|
}
|
68
71
|
}
|
69
72
|
return t;
|
70
73
|
}
|
71
|
-
const
|
74
|
+
const We = /* @__PURE__ */ new Set([
|
72
75
|
"id"
|
73
|
-
]),
|
76
|
+
]), je = /* @__PURE__ */ new Set([
|
74
77
|
"aria-label",
|
75
78
|
"aria-labelledby",
|
76
79
|
"aria-describedby",
|
77
80
|
"aria-details"
|
78
|
-
]),
|
81
|
+
]), Ye = /* @__PURE__ */ new Set([
|
79
82
|
"href",
|
83
|
+
"hrefLang",
|
80
84
|
"target",
|
81
85
|
"rel",
|
82
86
|
"download",
|
83
87
|
"ping",
|
84
88
|
"referrerPolicy"
|
85
|
-
]),
|
86
|
-
function
|
89
|
+
]), ze = /^(data-.*)$/;
|
90
|
+
function Xe(e, t = {}) {
|
87
91
|
let { labelable: r, isLink: o, propNames: i } = t, d = {};
|
88
92
|
for (const u in e)
|
89
|
-
Object.prototype.hasOwnProperty.call(e, u) && (
|
93
|
+
Object.prototype.hasOwnProperty.call(e, u) && (We.has(u) || r && je.has(u) || o && Ye.has(u) || i != null && i.has(u) || ze.test(u)) && (d[u] = e[u]);
|
90
94
|
return d;
|
91
95
|
}
|
92
|
-
function
|
93
|
-
if (
|
96
|
+
function U(e) {
|
97
|
+
if (qe())
|
94
98
|
e.focus({
|
95
99
|
preventScroll: !0
|
96
100
|
});
|
97
101
|
else {
|
98
|
-
let t =
|
99
|
-
e.focus(),
|
102
|
+
let t = Je(e);
|
103
|
+
e.focus(), Qe(t);
|
100
104
|
}
|
101
105
|
}
|
102
|
-
let
|
103
|
-
function
|
104
|
-
if (
|
105
|
-
|
106
|
+
let G = null;
|
107
|
+
function qe() {
|
108
|
+
if (G == null) {
|
109
|
+
G = !1;
|
106
110
|
try {
|
107
111
|
document.createElement("div").focus({
|
108
112
|
get preventScroll() {
|
109
|
-
return
|
113
|
+
return G = !0, !0;
|
110
114
|
}
|
111
115
|
});
|
112
116
|
} catch {
|
113
117
|
}
|
114
118
|
}
|
115
|
-
return
|
119
|
+
return G;
|
116
120
|
}
|
117
|
-
function
|
121
|
+
function Je(e) {
|
118
122
|
let t = e.parentNode, r = [], o = document.scrollingElement || document.documentElement;
|
119
123
|
for (; t instanceof HTMLElement && t !== o; )
|
120
124
|
(t.offsetHeight < t.scrollHeight || t.offsetWidth < t.scrollWidth) && r.push({
|
@@ -128,47 +132,48 @@ function lt(e) {
|
|
128
132
|
scrollLeft: o.scrollLeft
|
129
133
|
}), r;
|
130
134
|
}
|
131
|
-
function
|
135
|
+
function Qe(e) {
|
132
136
|
for (let { element: t, scrollTop: r, scrollLeft: o } of e)
|
133
137
|
t.scrollTop = r, t.scrollLeft = o;
|
134
138
|
}
|
135
|
-
function
|
139
|
+
function Z(e) {
|
136
140
|
var t;
|
137
141
|
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);
|
138
142
|
}
|
139
|
-
function
|
143
|
+
function ue(e) {
|
140
144
|
var t;
|
141
145
|
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;
|
142
146
|
}
|
143
|
-
function
|
144
|
-
return
|
147
|
+
function q() {
|
148
|
+
return ue(/^Mac/i);
|
145
149
|
}
|
146
|
-
function
|
147
|
-
return
|
150
|
+
function Ze() {
|
151
|
+
return ue(/^iPhone/i);
|
148
152
|
}
|
149
|
-
function
|
150
|
-
return
|
153
|
+
function Se() {
|
154
|
+
return ue(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
155
|
+
q() && navigator.maxTouchPoints > 1;
|
151
156
|
}
|
152
|
-
function
|
153
|
-
return
|
157
|
+
function Ne() {
|
158
|
+
return Ze() || Se();
|
154
159
|
}
|
155
|
-
function
|
156
|
-
return
|
160
|
+
function et() {
|
161
|
+
return Z(/AppleWebKit/i) && !tt();
|
157
162
|
}
|
158
|
-
function
|
159
|
-
return
|
163
|
+
function tt() {
|
164
|
+
return Z(/Chrome/i);
|
160
165
|
}
|
161
|
-
function
|
162
|
-
return
|
166
|
+
function Oe() {
|
167
|
+
return Z(/Android/i);
|
163
168
|
}
|
164
|
-
function
|
165
|
-
return
|
169
|
+
function nt() {
|
170
|
+
return Z(/Firefox/i);
|
166
171
|
}
|
167
|
-
function
|
172
|
+
function R(e, t, r = !0) {
|
168
173
|
var o, i;
|
169
174
|
let { metaKey: d, ctrlKey: u, altKey: p, shiftKey: b } = t;
|
170
|
-
|
171
|
-
let
|
175
|
+
nt() && (!((i = window.event) === null || i === void 0 || (o = i.type) === null || o === void 0) && o.startsWith("key")) && e.target === "_blank" && (q() ? d = !0 : u = !0);
|
176
|
+
let k = et() && q() && !Se() ? new KeyboardEvent("keydown", {
|
172
177
|
keyIdentifier: "Enter",
|
173
178
|
metaKey: d,
|
174
179
|
ctrlKey: u,
|
@@ -182,11 +187,11 @@ function Y(e, t, r = !0) {
|
|
182
187
|
bubbles: !0,
|
183
188
|
cancelable: !0
|
184
189
|
});
|
185
|
-
|
190
|
+
R.isOpening = r, U(e), e.dispatchEvent(k), R.isOpening = !1;
|
186
191
|
}
|
187
|
-
|
188
|
-
let
|
189
|
-
function
|
192
|
+
R.isOpening = !1;
|
193
|
+
let L = /* @__PURE__ */ new Map(), ie = /* @__PURE__ */ new Set();
|
194
|
+
function pe() {
|
190
195
|
if (typeof window > "u")
|
191
196
|
return;
|
192
197
|
function e(o) {
|
@@ -195,32 +200,32 @@ function he() {
|
|
195
200
|
let t = (o) => {
|
196
201
|
if (!e(o) || !o.target)
|
197
202
|
return;
|
198
|
-
let i =
|
199
|
-
i || (i = /* @__PURE__ */ new Set(),
|
203
|
+
let i = L.get(o.target);
|
204
|
+
i || (i = /* @__PURE__ */ new Set(), L.set(o.target, i), o.target.addEventListener("transitioncancel", r, {
|
200
205
|
once: !0
|
201
206
|
})), i.add(o.propertyName);
|
202
207
|
}, r = (o) => {
|
203
208
|
if (!e(o) || !o.target)
|
204
209
|
return;
|
205
|
-
let i =
|
206
|
-
if (
|
207
|
-
for (let d of
|
210
|
+
let i = L.get(o.target);
|
211
|
+
if (i && (i.delete(o.propertyName), i.size === 0 && (o.target.removeEventListener("transitioncancel", r), L.delete(o.target)), L.size === 0)) {
|
212
|
+
for (let d of ie)
|
208
213
|
d();
|
209
|
-
|
214
|
+
ie.clear();
|
210
215
|
}
|
211
216
|
};
|
212
217
|
document.body.addEventListener("transitionrun", t), document.body.addEventListener("transitionend", r);
|
213
218
|
}
|
214
|
-
typeof document < "u" && (document.readyState !== "loading" ?
|
215
|
-
function
|
219
|
+
typeof document < "u" && (document.readyState !== "loading" ? pe() : document.addEventListener("DOMContentLoaded", pe));
|
220
|
+
function rt(e) {
|
216
221
|
requestAnimationFrame(() => {
|
217
|
-
|
222
|
+
L.size === 0 ? e() : ie.add(e);
|
218
223
|
});
|
219
224
|
}
|
220
|
-
function
|
221
|
-
let e =
|
222
|
-
let b = p != null && p.once ? (...
|
223
|
-
e.current.delete(u), u(...
|
225
|
+
function ot() {
|
226
|
+
let e = Q(/* @__PURE__ */ new Map()), t = Y((i, d, u, p) => {
|
227
|
+
let b = p != null && p.once ? (...k) => {
|
228
|
+
e.current.delete(u), u(...k);
|
224
229
|
} : u;
|
225
230
|
e.current.set(u, {
|
226
231
|
type: d,
|
@@ -228,18 +233,18 @@ function bt() {
|
|
228
233
|
fn: b,
|
229
234
|
options: p
|
230
235
|
}), i.addEventListener(d, u, p);
|
231
|
-
}, []), r =
|
236
|
+
}, []), r = Y((i, d, u, p) => {
|
232
237
|
var b;
|
233
|
-
let
|
234
|
-
i.removeEventListener(d,
|
235
|
-
}, []), o =
|
238
|
+
let k = ((b = e.current.get(u)) === null || b === void 0 ? void 0 : b.fn) || u;
|
239
|
+
i.removeEventListener(d, k, p), e.current.delete(u);
|
240
|
+
}, []), o = Y(() => {
|
236
241
|
e.current.forEach((i, d) => {
|
237
242
|
r(i.eventTarget, i.type, d, i.options);
|
238
243
|
});
|
239
244
|
}, [
|
240
245
|
r
|
241
246
|
]);
|
242
|
-
return
|
247
|
+
return X(() => o, [
|
243
248
|
o
|
244
249
|
]), {
|
245
250
|
addGlobalListener: t,
|
@@ -247,40 +252,73 @@ function bt() {
|
|
247
252
|
removeAllGlobalListeners: o
|
248
253
|
};
|
249
254
|
}
|
250
|
-
function
|
251
|
-
|
255
|
+
function st(e, t) {
|
256
|
+
Pe(() => {
|
252
257
|
if (e && e.ref && t)
|
253
258
|
return e.ref.current = t.current, () => {
|
254
259
|
e.ref && (e.ref.current = null);
|
255
260
|
};
|
256
261
|
});
|
257
262
|
}
|
258
|
-
function
|
259
|
-
return e.mozInputSource === 0 && e.isTrusted ? !0 :
|
263
|
+
function fe(e) {
|
264
|
+
return e.mozInputSource === 0 && e.isTrusted ? !0 : Oe() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
|
265
|
+
}
|
266
|
+
function it(e) {
|
267
|
+
return !Oe() && e.width === 0 && e.height === 0 || e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse";
|
268
|
+
}
|
269
|
+
let M = "default", ae = "", z = /* @__PURE__ */ new WeakMap();
|
270
|
+
function me(e) {
|
271
|
+
if (Ne()) {
|
272
|
+
if (M === "default") {
|
273
|
+
const t = _(e);
|
274
|
+
ae = t.documentElement.style.webkitUserSelect, t.documentElement.style.webkitUserSelect = "none";
|
275
|
+
}
|
276
|
+
M = "disabled";
|
277
|
+
} else
|
278
|
+
(e instanceof HTMLElement || e instanceof SVGElement) && (z.set(e, e.style.userSelect), e.style.userSelect = "none");
|
260
279
|
}
|
261
|
-
function
|
262
|
-
|
280
|
+
function V(e) {
|
281
|
+
if (Ne()) {
|
282
|
+
if (M !== "disabled")
|
283
|
+
return;
|
284
|
+
M = "restoring", setTimeout(() => {
|
285
|
+
rt(() => {
|
286
|
+
if (M === "restoring") {
|
287
|
+
const t = _(e);
|
288
|
+
t.documentElement.style.webkitUserSelect === "none" && (t.documentElement.style.webkitUserSelect = ae || ""), ae = "", M = "default";
|
289
|
+
}
|
290
|
+
});
|
291
|
+
}, 300);
|
292
|
+
} else if ((e instanceof HTMLElement || e instanceof SVGElement) && e && z.has(e)) {
|
293
|
+
let t = z.get(e);
|
294
|
+
e.style.userSelect === "none" && (e.style.userSelect = t), e.getAttribute("style") === "" && e.removeAttribute("style"), z.delete(e);
|
295
|
+
}
|
263
296
|
}
|
264
|
-
|
297
|
+
const De = Te.createContext({
|
298
|
+
register: () => {
|
299
|
+
}
|
300
|
+
});
|
301
|
+
De.displayName = "PressResponderContext";
|
302
|
+
function at(e, t) {
|
265
303
|
return t.get ? t.get.call(e) : t.value;
|
266
304
|
}
|
267
|
-
function
|
305
|
+
function Ce(e, t, r) {
|
268
306
|
if (!t.has(e))
|
269
307
|
throw new TypeError("attempted to " + r + " private field on non-instance");
|
270
308
|
return t.get(e);
|
271
309
|
}
|
272
|
-
function
|
273
|
-
var r =
|
274
|
-
return
|
310
|
+
function lt(e, t) {
|
311
|
+
var r = Ce(e, t, "get");
|
312
|
+
return at(e, r);
|
275
313
|
}
|
276
|
-
function
|
314
|
+
function ut(e, t) {
|
277
315
|
if (t.has(e))
|
278
316
|
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
279
317
|
}
|
280
|
-
function
|
281
|
-
|
318
|
+
function ct(e, t, r) {
|
319
|
+
ut(e, t), t.set(e, r);
|
282
320
|
}
|
283
|
-
function
|
321
|
+
function dt(e, t, r) {
|
284
322
|
if (t.set)
|
285
323
|
t.set.call(e, r);
|
286
324
|
else {
|
@@ -289,68 +327,35 @@ function kt(e, t, r) {
|
|
289
327
|
t.value = r;
|
290
328
|
}
|
291
329
|
}
|
292
|
-
function
|
293
|
-
var o =
|
294
|
-
return
|
330
|
+
function be(e, t, r) {
|
331
|
+
var o = Ce(e, t, "set");
|
332
|
+
return dt(e, o, r), r;
|
295
333
|
}
|
296
|
-
|
297
|
-
|
298
|
-
if (Ie()) {
|
299
|
-
if (U === "default") {
|
300
|
-
const t = D(e);
|
301
|
-
pe = t.documentElement.style.webkitUserSelect, t.documentElement.style.webkitUserSelect = "none";
|
302
|
-
}
|
303
|
-
U = "disabled";
|
304
|
-
} else
|
305
|
-
(e instanceof HTMLElement || e instanceof SVGElement) && (Z.set(e, e.style.userSelect), e.style.userSelect = "none");
|
306
|
-
}
|
307
|
-
function X(e) {
|
308
|
-
if (Ie()) {
|
309
|
-
if (U !== "disabled")
|
310
|
-
return;
|
311
|
-
U = "restoring", setTimeout(() => {
|
312
|
-
mt(() => {
|
313
|
-
if (U === "restoring") {
|
314
|
-
const t = D(e);
|
315
|
-
t.documentElement.style.webkitUserSelect === "none" && (t.documentElement.style.webkitUserSelect = pe || ""), pe = "", U = "default";
|
316
|
-
}
|
317
|
-
});
|
318
|
-
}, 300);
|
319
|
-
} else if ((e instanceof HTMLElement || e instanceof SVGElement) && e && Z.has(e)) {
|
320
|
-
let t = Z.get(e);
|
321
|
-
e.style.userSelect === "none" && (e.style.userSelect = t), e.getAttribute("style") === "" && e.removeAttribute("style"), Z.delete(e);
|
322
|
-
}
|
323
|
-
}
|
324
|
-
const Fe = Ne.createContext({
|
325
|
-
register: () => {
|
326
|
-
}
|
327
|
-
});
|
328
|
-
Fe.displayName = "PressResponderContext";
|
329
|
-
function wt(e) {
|
330
|
-
let t = je(Fe);
|
334
|
+
function pt(e) {
|
335
|
+
let t = Ke(De);
|
331
336
|
if (t) {
|
332
337
|
let { register: r, ...o } = t;
|
333
|
-
e =
|
338
|
+
e = H(o, e), r();
|
334
339
|
}
|
335
|
-
return
|
340
|
+
return st(t, e.ref), e;
|
336
341
|
}
|
337
|
-
var
|
338
|
-
class
|
342
|
+
var W = /* @__PURE__ */ new WeakMap();
|
343
|
+
class j {
|
339
344
|
continuePropagation() {
|
340
|
-
|
345
|
+
be(this, W, !1);
|
341
346
|
}
|
342
347
|
get shouldStopPropagation() {
|
343
|
-
return
|
348
|
+
return lt(this, W);
|
344
349
|
}
|
345
350
|
constructor(t, r, o) {
|
346
|
-
|
351
|
+
ct(this, W, {
|
347
352
|
writable: !0,
|
348
353
|
value: void 0
|
349
|
-
}),
|
354
|
+
}), be(this, W, !0), this.type = t, this.pointerType = r, this.target = o.currentTarget, this.shiftKey = o.shiftKey, this.metaKey = o.metaKey, this.ctrlKey = o.ctrlKey, this.altKey = o.altKey;
|
350
355
|
}
|
351
356
|
}
|
352
|
-
const
|
353
|
-
function
|
357
|
+
const ge = Symbol("linkClicked");
|
358
|
+
function ft(e) {
|
354
359
|
let {
|
355
360
|
onPress: t,
|
356
361
|
onPressChange: r,
|
@@ -360,11 +365,12 @@ function Tt(e) {
|
|
360
365
|
isDisabled: u,
|
361
366
|
isPressed: p,
|
362
367
|
preventFocusOnPress: b,
|
363
|
-
shouldCancelOnPointerExit:
|
364
|
-
allowTextSelectionOnPress:
|
365
|
-
|
368
|
+
shouldCancelOnPointerExit: k,
|
369
|
+
allowTextSelectionOnPress: g,
|
370
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
371
|
+
ref: D,
|
366
372
|
...x
|
367
|
-
} =
|
373
|
+
} = pt(e), [m, w] = Be(!1), T = Q({
|
368
374
|
isPressed: !1,
|
369
375
|
ignoreEmulatedMouseEvents: !1,
|
370
376
|
ignoreClickAfterPress: !1,
|
@@ -374,154 +380,154 @@ function Tt(e) {
|
|
374
380
|
target: null,
|
375
381
|
isOverTarget: !1,
|
376
382
|
pointerType: null
|
377
|
-
}), { addGlobalListener:
|
378
|
-
let
|
379
|
-
if (u ||
|
383
|
+
}), { addGlobalListener: $, removeAllGlobalListeners: S } = ot(), P = F((n, f) => {
|
384
|
+
let B = T.current;
|
385
|
+
if (u || B.didFirePressStart)
|
380
386
|
return !1;
|
381
387
|
let l = !0;
|
382
|
-
if (
|
383
|
-
let
|
384
|
-
o(
|
388
|
+
if (B.isTriggeringEvent = !0, o) {
|
389
|
+
let v = new j("pressstart", f, n);
|
390
|
+
o(v), l = v.shouldStopPropagation;
|
385
391
|
}
|
386
|
-
return r && r(!0),
|
387
|
-
}),
|
388
|
-
let l =
|
392
|
+
return r && r(!0), B.isTriggeringEvent = !1, B.didFirePressStart = !0, w(!0), l;
|
393
|
+
}), E = F((n, f, B = !0) => {
|
394
|
+
let l = T.current;
|
389
395
|
if (!l.didFirePressStart)
|
390
396
|
return !1;
|
391
397
|
l.ignoreClickAfterPress = !0, l.didFirePressStart = !1, l.isTriggeringEvent = !0;
|
392
|
-
let
|
398
|
+
let v = !0;
|
393
399
|
if (i) {
|
394
|
-
let s = new
|
395
|
-
i(s),
|
400
|
+
let s = new j("pressend", f, n);
|
401
|
+
i(s), v = s.shouldStopPropagation;
|
396
402
|
}
|
397
|
-
if (r && r(!1),
|
398
|
-
let s = new
|
399
|
-
t(s),
|
403
|
+
if (r && r(!1), w(!1), t && B && !u) {
|
404
|
+
let s = new j("press", f, n);
|
405
|
+
t(s), v && (v = s.shouldStopPropagation);
|
400
406
|
}
|
401
|
-
return l.isTriggeringEvent = !1,
|
402
|
-
}),
|
403
|
-
let
|
407
|
+
return l.isTriggeringEvent = !1, v;
|
408
|
+
}), O = F((n, f) => {
|
409
|
+
let B = T.current;
|
404
410
|
if (u)
|
405
411
|
return !1;
|
406
412
|
if (d) {
|
407
|
-
|
408
|
-
let l = new
|
409
|
-
return d(l),
|
413
|
+
B.isTriggeringEvent = !0;
|
414
|
+
let l = new j("pressup", f, n);
|
415
|
+
return d(l), B.isTriggeringEvent = !1, l.shouldStopPropagation;
|
410
416
|
}
|
411
417
|
return !0;
|
412
|
-
}),
|
413
|
-
let f =
|
414
|
-
f.isPressed && f.target && (f.isOverTarget && f.pointerType != null &&
|
415
|
-
}), I =
|
416
|
-
|
417
|
-
}),
|
418
|
-
let n =
|
418
|
+
}), N = F((n) => {
|
419
|
+
let f = T.current;
|
420
|
+
f.isPressed && f.target && (f.isOverTarget && f.pointerType != null && E(C(f.target, n), f.pointerType, !1), f.isPressed = !1, f.isOverTarget = !1, f.activePointerId = null, f.pointerType = null, S(), g || V(f.target));
|
421
|
+
}), I = F((n) => {
|
422
|
+
k && N(n);
|
423
|
+
}), te = $e(() => {
|
424
|
+
let n = T.current, f = {
|
419
425
|
onKeyDown(l) {
|
420
|
-
if (
|
421
|
-
var
|
422
|
-
|
426
|
+
if (ne(l.nativeEvent, l.currentTarget) && l.currentTarget.contains(l.target)) {
|
427
|
+
var v;
|
428
|
+
ye(l.target, l.key) && l.preventDefault();
|
423
429
|
let s = !0;
|
424
430
|
if (!n.isPressed && !l.repeat) {
|
425
|
-
n.target = l.currentTarget, n.isPressed = !0, s =
|
426
|
-
let a = l.currentTarget, h = (
|
427
|
-
|
431
|
+
n.target = l.currentTarget, n.isPressed = !0, s = P(l, "keyboard");
|
432
|
+
let a = l.currentTarget, h = (K) => {
|
433
|
+
ne(K, a) && !K.repeat && a.contains(K.target) && n.target && O(C(n.target, K), "keyboard");
|
428
434
|
};
|
429
|
-
|
435
|
+
$(_(l.currentTarget), "keyup", we(h, B), !0);
|
430
436
|
}
|
431
|
-
s && l.stopPropagation(), l.metaKey &&
|
437
|
+
s && l.stopPropagation(), l.metaKey && q() && ((v = n.metaKeyEvents) === null || v === void 0 || v.set(l.key, l.nativeEvent));
|
432
438
|
} else
|
433
439
|
l.key === "Meta" && (n.metaKeyEvents = /* @__PURE__ */ new Map());
|
434
440
|
},
|
435
441
|
onClick(l) {
|
436
|
-
if (!(l && !l.currentTarget.contains(l.target)) && l && l.button === 0 && !n.isTriggeringEvent && !
|
437
|
-
let
|
438
|
-
if (u && l.preventDefault(), !n.ignoreClickAfterPress && !n.ignoreEmulatedMouseEvents && !n.isPressed && (n.pointerType === "virtual" ||
|
439
|
-
!u && !b &&
|
440
|
-
let s =
|
441
|
-
|
442
|
+
if (!(l && !l.currentTarget.contains(l.target)) && l && l.button === 0 && !n.isTriggeringEvent && !R.isOpening) {
|
443
|
+
let v = !0;
|
444
|
+
if (u && l.preventDefault(), !n.ignoreClickAfterPress && !n.ignoreEmulatedMouseEvents && !n.isPressed && (n.pointerType === "virtual" || fe(l.nativeEvent))) {
|
445
|
+
!u && !b && U(l.currentTarget);
|
446
|
+
let s = P(l, "virtual"), a = O(l, "virtual"), h = E(l, "virtual");
|
447
|
+
v = s && a && h;
|
442
448
|
}
|
443
|
-
n.ignoreEmulatedMouseEvents = !1, n.ignoreClickAfterPress = !1,
|
449
|
+
n.ignoreEmulatedMouseEvents = !1, n.ignoreClickAfterPress = !1, v && l.stopPropagation();
|
444
450
|
}
|
445
451
|
}
|
446
|
-
},
|
447
|
-
var
|
448
|
-
if (n.isPressed && n.target &&
|
452
|
+
}, B = (l) => {
|
453
|
+
var v;
|
454
|
+
if (n.isPressed && n.target && ne(l, n.target)) {
|
449
455
|
var s;
|
450
|
-
|
456
|
+
ye(l.target, l.key) && l.preventDefault();
|
451
457
|
let h = l.target;
|
452
|
-
|
453
|
-
} else if (l.key === "Meta" && ((
|
458
|
+
E(C(n.target, l), "keyboard", n.target.contains(h)), S(), l.key !== "Enter" && ce(n.target) && n.target.contains(h) && !l[ge] && (l[ge] = !0, R(n.target, l, !1)), n.isPressed = !1, (s = n.metaKeyEvents) === null || s === void 0 || s.delete(l.key);
|
459
|
+
} else if (l.key === "Meta" && (!((v = n.metaKeyEvents) === null || v === void 0) && v.size)) {
|
454
460
|
var a;
|
455
461
|
let h = n.metaKeyEvents;
|
456
462
|
n.metaKeyEvents = void 0;
|
457
|
-
for (let
|
458
|
-
(a = n.target) === null || a === void 0 || a.dispatchEvent(new KeyboardEvent("keyup",
|
463
|
+
for (let K of h.values())
|
464
|
+
(a = n.target) === null || a === void 0 || a.dispatchEvent(new KeyboardEvent("keyup", K));
|
459
465
|
}
|
460
466
|
};
|
461
467
|
if (typeof PointerEvent < "u") {
|
462
468
|
f.onPointerDown = (a) => {
|
463
469
|
if (a.button !== 0 || !a.currentTarget.contains(a.target))
|
464
470
|
return;
|
465
|
-
if (
|
471
|
+
if (it(a.nativeEvent)) {
|
466
472
|
n.pointerType = "virtual";
|
467
473
|
return;
|
468
474
|
}
|
469
|
-
|
475
|
+
re(a.currentTarget) && a.preventDefault(), n.pointerType = a.pointerType;
|
470
476
|
let h = !0;
|
471
|
-
n.isPressed || (n.isPressed = !0, n.isOverTarget = !0, n.activePointerId = a.pointerId, n.target = a.currentTarget, !u && !b &&
|
477
|
+
n.isPressed || (n.isPressed = !0, n.isOverTarget = !0, n.activePointerId = a.pointerId, n.target = a.currentTarget, !u && !b && U(a.currentTarget), g || me(n.target), h = P(a, n.pointerType), $(_(a.currentTarget), "pointermove", l, !1), $(_(a.currentTarget), "pointerup", v, !1), $(_(a.currentTarget), "pointercancel", s, !1)), h && a.stopPropagation();
|
472
478
|
}, f.onMouseDown = (a) => {
|
473
|
-
|
479
|
+
a.currentTarget.contains(a.target) && a.button === 0 && (re(a.currentTarget) && a.preventDefault(), a.stopPropagation());
|
474
480
|
}, f.onPointerUp = (a) => {
|
475
|
-
!a.currentTarget.contains(a.target) || n.pointerType === "virtual" || a.button === 0 &&
|
481
|
+
!a.currentTarget.contains(a.target) || n.pointerType === "virtual" || a.button === 0 && A(a, a.currentTarget) && O(a, n.pointerType || a.pointerType);
|
476
482
|
};
|
477
483
|
let l = (a) => {
|
478
|
-
a.pointerId === n.activePointerId && (n.target &&
|
479
|
-
},
|
480
|
-
a.pointerId === n.activePointerId && n.isPressed && a.button === 0 && n.target && (
|
484
|
+
a.pointerId === n.activePointerId && (n.target && A(a, n.target) ? !n.isOverTarget && n.pointerType != null && (n.isOverTarget = !0, P(C(n.target, a), n.pointerType)) : n.target && n.isOverTarget && n.pointerType != null && (n.isOverTarget = !1, E(C(n.target, a), n.pointerType, !1), I(a)));
|
485
|
+
}, v = (a) => {
|
486
|
+
a.pointerId === n.activePointerId && n.isPressed && a.button === 0 && n.target && (A(a, n.target) && n.pointerType != null ? E(C(n.target, a), n.pointerType) : n.isOverTarget && n.pointerType != null && E(C(n.target, a), n.pointerType, !1), n.isPressed = !1, n.isOverTarget = !1, n.activePointerId = null, n.pointerType = null, S(), g || V(n.target));
|
481
487
|
}, s = (a) => {
|
482
|
-
|
488
|
+
N(a);
|
483
489
|
};
|
484
490
|
f.onDragStart = (a) => {
|
485
|
-
|
491
|
+
a.currentTarget.contains(a.target) && N(a);
|
486
492
|
};
|
487
493
|
} else {
|
488
494
|
f.onMouseDown = (s) => {
|
489
495
|
if (s.button !== 0 || !s.currentTarget.contains(s.target))
|
490
496
|
return;
|
491
|
-
if (
|
497
|
+
if (re(s.currentTarget) && s.preventDefault(), n.ignoreEmulatedMouseEvents) {
|
492
498
|
s.stopPropagation();
|
493
499
|
return;
|
494
500
|
}
|
495
|
-
n.isPressed = !0, n.isOverTarget = !0, n.target = s.currentTarget, n.pointerType =
|
501
|
+
n.isPressed = !0, n.isOverTarget = !0, n.target = s.currentTarget, n.pointerType = fe(s.nativeEvent) ? "virtual" : "mouse", !u && !b && U(s.currentTarget), P(s, n.pointerType) && s.stopPropagation(), $(_(s.currentTarget), "mouseup", l, !1);
|
496
502
|
}, f.onMouseEnter = (s) => {
|
497
503
|
if (!s.currentTarget.contains(s.target))
|
498
504
|
return;
|
499
505
|
let a = !0;
|
500
|
-
n.isPressed && !n.ignoreEmulatedMouseEvents && n.pointerType != null && (n.isOverTarget = !0, a =
|
506
|
+
n.isPressed && !n.ignoreEmulatedMouseEvents && n.pointerType != null && (n.isOverTarget = !0, a = P(s, n.pointerType)), a && s.stopPropagation();
|
501
507
|
}, f.onMouseLeave = (s) => {
|
502
508
|
if (!s.currentTarget.contains(s.target))
|
503
509
|
return;
|
504
510
|
let a = !0;
|
505
|
-
n.isPressed && !n.ignoreEmulatedMouseEvents && n.pointerType != null && (n.isOverTarget = !1, a =
|
511
|
+
n.isPressed && !n.ignoreEmulatedMouseEvents && n.pointerType != null && (n.isOverTarget = !1, a = E(s, n.pointerType, !1), I(s)), a && s.stopPropagation();
|
506
512
|
}, f.onMouseUp = (s) => {
|
507
|
-
|
513
|
+
s.currentTarget.contains(s.target) && !n.ignoreEmulatedMouseEvents && s.button === 0 && O(s, n.pointerType || "mouse");
|
508
514
|
};
|
509
515
|
let l = (s) => {
|
510
516
|
if (s.button === 0) {
|
511
|
-
if (n.isPressed = !1,
|
517
|
+
if (n.isPressed = !1, S(), n.ignoreEmulatedMouseEvents) {
|
512
518
|
n.ignoreEmulatedMouseEvents = !1;
|
513
519
|
return;
|
514
520
|
}
|
515
|
-
n.target &&
|
521
|
+
n.target && A(s, n.target) && n.pointerType != null ? E(C(n.target, s), n.pointerType) : n.target && n.isOverTarget && n.pointerType != null && E(C(n.target, s), n.pointerType, !1), n.isOverTarget = !1;
|
516
522
|
}
|
517
523
|
};
|
518
524
|
f.onTouchStart = (s) => {
|
519
525
|
if (!s.currentTarget.contains(s.target))
|
520
526
|
return;
|
521
|
-
let a =
|
527
|
+
let a = mt(s.nativeEvent);
|
522
528
|
if (!a)
|
523
529
|
return;
|
524
|
-
n.activePointerId = a.identifier, n.ignoreEmulatedMouseEvents = !0, n.isOverTarget = !0, n.isPressed = !0, n.target = s.currentTarget, n.pointerType = "touch", !u && !b &&
|
530
|
+
n.activePointerId = a.identifier, n.ignoreEmulatedMouseEvents = !0, n.isOverTarget = !0, n.isPressed = !0, n.target = s.currentTarget, n.pointerType = "touch", !u && !b && U(s.currentTarget), g || me(n.target), P(s, n.pointerType) && s.stopPropagation(), $(se(s.currentTarget), "scroll", v, !0);
|
525
531
|
}, f.onTouchMove = (s) => {
|
526
532
|
if (!s.currentTarget.contains(s.target))
|
527
533
|
return;
|
@@ -529,8 +535,8 @@ function Tt(e) {
|
|
529
535
|
s.stopPropagation();
|
530
536
|
return;
|
531
537
|
}
|
532
|
-
let a =
|
533
|
-
a &&
|
538
|
+
let a = ve(s.nativeEvent, n.activePointerId), h = !0;
|
539
|
+
a && A(a, s.currentTarget) ? !n.isOverTarget && n.pointerType != null && (n.isOverTarget = !0, h = P(s, n.pointerType)) : n.isOverTarget && n.pointerType != null && (n.isOverTarget = !1, h = E(s, n.pointerType, !1), I(s)), h && s.stopPropagation();
|
534
540
|
}, f.onTouchEnd = (s) => {
|
535
541
|
if (!s.currentTarget.contains(s.target))
|
536
542
|
return;
|
@@ -538,13 +544,13 @@ function Tt(e) {
|
|
538
544
|
s.stopPropagation();
|
539
545
|
return;
|
540
546
|
}
|
541
|
-
let a =
|
542
|
-
a &&
|
547
|
+
let a = ve(s.nativeEvent, n.activePointerId), h = !0;
|
548
|
+
a && A(a, s.currentTarget) && n.pointerType != null ? (O(s, n.pointerType), h = E(s, n.pointerType)) : n.isOverTarget && n.pointerType != null && (h = E(s, n.pointerType, !1)), h && s.stopPropagation(), n.isPressed = !1, n.activePointerId = null, n.isOverTarget = !1, n.ignoreEmulatedMouseEvents = !0, n.target && !g && V(n.target), S();
|
543
549
|
}, f.onTouchCancel = (s) => {
|
544
|
-
|
550
|
+
s.currentTarget.contains(s.target) && (s.stopPropagation(), n.isPressed && N(s));
|
545
551
|
};
|
546
|
-
let
|
547
|
-
n.isPressed && s.target.contains(n.target) &&
|
552
|
+
let v = (s) => {
|
553
|
+
n.isPressed && s.target.contains(n.target) && N({
|
548
554
|
currentTarget: n.target,
|
549
555
|
shiftKey: !1,
|
550
556
|
ctrlKey: !1,
|
@@ -553,44 +559,45 @@ function Tt(e) {
|
|
553
559
|
});
|
554
560
|
};
|
555
561
|
f.onDragStart = (s) => {
|
556
|
-
|
562
|
+
s.currentTarget.contains(s.target) && N(s);
|
557
563
|
};
|
558
564
|
}
|
559
565
|
return f;
|
560
566
|
}, [
|
561
|
-
|
567
|
+
$,
|
562
568
|
u,
|
563
569
|
b,
|
570
|
+
S,
|
571
|
+
g,
|
564
572
|
N,
|
565
|
-
v,
|
566
|
-
O,
|
567
573
|
I,
|
568
|
-
|
569
|
-
|
570
|
-
|
574
|
+
E,
|
575
|
+
P,
|
576
|
+
O
|
571
577
|
]);
|
572
|
-
return
|
578
|
+
return X(() => () => {
|
573
579
|
var n;
|
574
|
-
|
580
|
+
g || V((n = T.current.target) !== null && n !== void 0 ? n : void 0);
|
575
581
|
}, [
|
576
|
-
|
582
|
+
g
|
577
583
|
]), {
|
578
584
|
isPressed: p || m,
|
579
|
-
pressProps:
|
585
|
+
pressProps: H(x, te)
|
580
586
|
};
|
581
587
|
}
|
582
|
-
function
|
588
|
+
function ce(e) {
|
583
589
|
return e.tagName === "A" && e.hasAttribute("href");
|
584
590
|
}
|
585
|
-
function
|
591
|
+
function ne(e, t) {
|
586
592
|
const { key: r, code: o } = e, i = t, d = i.getAttribute("role");
|
587
|
-
return (r === "Enter" || r === " " || r === "Spacebar" || o === "Space") && !(i instanceof
|
593
|
+
return (r === "Enter" || r === " " || r === "Spacebar" || o === "Space") && !(i instanceof se(i).HTMLInputElement && !_e(i, r) || i instanceof se(i).HTMLTextAreaElement || i.isContentEditable) && // Links should only trigger with Enter key
|
594
|
+
!((d === "link" || !d && ce(i)) && r !== "Enter");
|
588
595
|
}
|
589
|
-
function
|
596
|
+
function mt(e) {
|
590
597
|
const { targetTouches: t } = e;
|
591
598
|
return t.length > 0 ? t[0] : null;
|
592
599
|
}
|
593
|
-
function
|
600
|
+
function ve(e, t) {
|
594
601
|
const r = e.changedTouches;
|
595
602
|
for (let o = 0; o < r.length; o++) {
|
596
603
|
const i = r[o];
|
@@ -599,7 +606,7 @@ function we(e, t) {
|
|
599
606
|
}
|
600
607
|
return null;
|
601
608
|
}
|
602
|
-
function
|
609
|
+
function C(e, t) {
|
603
610
|
return {
|
604
611
|
currentTarget: e,
|
605
612
|
shiftKey: t.shiftKey,
|
@@ -608,7 +615,7 @@ function _(e, t) {
|
|
608
615
|
altKey: t.altKey
|
609
616
|
};
|
610
617
|
}
|
611
|
-
function
|
618
|
+
function bt(e) {
|
612
619
|
let t = 0, r = 0;
|
613
620
|
return e.width !== void 0 ? t = e.width / 2 : e.radiusX !== void 0 && (t = e.radiusX), e.height !== void 0 ? r = e.height / 2 : e.radiusY !== void 0 && (r = e.radiusY), {
|
614
621
|
top: e.clientY - r,
|
@@ -617,20 +624,20 @@ function Pt(e) {
|
|
617
624
|
left: e.clientX - t
|
618
625
|
};
|
619
626
|
}
|
620
|
-
function
|
627
|
+
function gt(e, t) {
|
621
628
|
return !(e.left > t.right || t.left > e.right || e.top > t.bottom || t.top > e.bottom);
|
622
629
|
}
|
623
|
-
function
|
624
|
-
let r = t.getBoundingClientRect(), o =
|
625
|
-
return
|
630
|
+
function A(e, t) {
|
631
|
+
let r = t.getBoundingClientRect(), o = bt(e);
|
632
|
+
return gt(r, o);
|
626
633
|
}
|
627
|
-
function
|
634
|
+
function re(e) {
|
628
635
|
return !(e instanceof HTMLElement) || !e.hasAttribute("draggable");
|
629
636
|
}
|
630
|
-
function
|
631
|
-
return e instanceof HTMLInputElement ? !
|
637
|
+
function ye(e, t) {
|
638
|
+
return e instanceof HTMLInputElement ? !_e(e, t) : e instanceof HTMLButtonElement ? e.type !== "submit" && e.type !== "reset" : !ce(e);
|
632
639
|
}
|
633
|
-
const
|
640
|
+
const vt = /* @__PURE__ */ new Set([
|
634
641
|
"checkbox",
|
635
642
|
"radio",
|
636
643
|
"range",
|
@@ -641,117 +648,67 @@ const St = /* @__PURE__ */ new Set([
|
|
641
648
|
"submit",
|
642
649
|
"reset"
|
643
650
|
]);
|
644
|
-
function
|
645
|
-
return e.type === "checkbox" || e.type === "radio" ? t === " " :
|
646
|
-
}
|
647
|
-
let Nt = /* @__PURE__ */ new Set(), V = /* @__PURE__ */ new Map(), K = !1, fe = !1;
|
648
|
-
function ve(e, t) {
|
649
|
-
for (let r of Nt)
|
650
|
-
r(e, t);
|
651
|
-
}
|
652
|
-
function Ot(e) {
|
653
|
-
return !(e.metaKey || !j() && e.altKey || e.ctrlKey || e.key === "Control" || e.key === "Shift" || e.key === "Meta");
|
654
|
-
}
|
655
|
-
function te(e) {
|
656
|
-
K = !0, Ot(e) && ve("keyboard", e);
|
657
|
-
}
|
658
|
-
function S(e) {
|
659
|
-
(e.type === "mousedown" || e.type === "pointerdown") && (K = !0, ve("pointer", e));
|
660
|
-
}
|
661
|
-
function He(e) {
|
662
|
-
de(e) && (K = !0);
|
663
|
-
}
|
664
|
-
function Re(e) {
|
665
|
-
e.target === window || e.target === document || (!K && !fe && ve("virtual", e), K = !1, fe = !1);
|
666
|
-
}
|
667
|
-
function Ge() {
|
668
|
-
K = !1, fe = !0;
|
669
|
-
}
|
670
|
-
function Be(e) {
|
671
|
-
if (typeof window > "u" || V.get(H(e)))
|
672
|
-
return;
|
673
|
-
const t = H(e), r = D(e);
|
674
|
-
let o = t.HTMLElement.prototype.focus;
|
675
|
-
t.HTMLElement.prototype.focus = function() {
|
676
|
-
K = !0, o.apply(this, arguments);
|
677
|
-
}, r.addEventListener("keydown", te, !0), r.addEventListener("keyup", te, !0), r.addEventListener("click", He, !0), t.addEventListener("focus", Re, !0), t.addEventListener("blur", Ge, !1), typeof PointerEvent < "u" ? (r.addEventListener("pointerdown", S, !0), r.addEventListener("pointermove", S, !0), r.addEventListener("pointerup", S, !0)) : (r.addEventListener("mousedown", S, !0), r.addEventListener("mousemove", S, !0), r.addEventListener("mouseup", S, !0)), t.addEventListener("beforeunload", () => {
|
678
|
-
Ve(e);
|
679
|
-
}, {
|
680
|
-
once: !0
|
681
|
-
}), V.set(t, {
|
682
|
-
focus: o
|
683
|
-
});
|
684
|
-
}
|
685
|
-
const Ve = (e, t) => {
|
686
|
-
const r = H(e), o = D(e);
|
687
|
-
t && o.removeEventListener("DOMContentLoaded", t), V.has(r) && (r.HTMLElement.prototype.focus = V.get(r).focus, o.removeEventListener("keydown", te, !0), o.removeEventListener("keyup", te, !0), o.removeEventListener("click", He, !0), r.removeEventListener("focus", Re, !0), r.removeEventListener("blur", Ge, !1), typeof PointerEvent < "u" ? (o.removeEventListener("pointerdown", S, !0), o.removeEventListener("pointermove", S, !0), o.removeEventListener("pointerup", S, !0)) : (o.removeEventListener("mousedown", S, !0), o.removeEventListener("mousemove", S, !0), o.removeEventListener("mouseup", S, !0)), V.delete(r));
|
688
|
-
};
|
689
|
-
function Dt(e) {
|
690
|
-
const t = D(e);
|
691
|
-
let r;
|
692
|
-
return t.readyState !== "loading" ? Be(e) : (r = () => {
|
693
|
-
Be(e);
|
694
|
-
}, t.addEventListener("DOMContentLoaded", r)), () => Ve(e, r);
|
651
|
+
function _e(e, t) {
|
652
|
+
return e.type === "checkbox" || e.type === "radio" ? t === " " : vt.has(e.type);
|
695
653
|
}
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
ne = !1;
|
654
|
+
let J = !1, oe = 0;
|
655
|
+
function le() {
|
656
|
+
J = !0, setTimeout(() => {
|
657
|
+
J = !1;
|
701
658
|
}, 50);
|
702
659
|
}
|
703
|
-
function
|
704
|
-
e.pointerType === "touch" &&
|
660
|
+
function he(e) {
|
661
|
+
e.pointerType === "touch" && le();
|
705
662
|
}
|
706
|
-
function
|
663
|
+
function yt() {
|
707
664
|
if (!(typeof document > "u"))
|
708
|
-
return typeof PointerEvent < "u" ? document.addEventListener("pointerup",
|
709
|
-
|
665
|
+
return typeof PointerEvent < "u" ? document.addEventListener("pointerup", he) : document.addEventListener("touchend", le), oe++, () => {
|
666
|
+
oe--, !(oe > 0) && (typeof PointerEvent < "u" ? document.removeEventListener("pointerup", he) : document.removeEventListener("touchend", le));
|
710
667
|
};
|
711
668
|
}
|
712
|
-
function
|
713
|
-
let { onHoverStart: t, onHoverChange: r, onHoverEnd: o, isDisabled: i } = e, [d, u] =
|
669
|
+
function ht(e) {
|
670
|
+
let { onHoverStart: t, onHoverChange: r, onHoverEnd: o, isDisabled: i } = e, [d, u] = Be(!1), p = Q({
|
714
671
|
isHovered: !1,
|
715
672
|
ignoreEmulatedMouseEvents: !1,
|
716
673
|
pointerType: "",
|
717
674
|
target: null
|
718
675
|
}).current;
|
719
|
-
|
720
|
-
let { hoverProps: b, triggerHoverEnd:
|
721
|
-
let
|
722
|
-
if (p.pointerType =
|
676
|
+
X(yt, []);
|
677
|
+
let { hoverProps: b, triggerHoverEnd: k } = $e(() => {
|
678
|
+
let g = (m, w) => {
|
679
|
+
if (p.pointerType = w, i || w === "touch" || p.isHovered || !m.currentTarget.contains(m.target))
|
723
680
|
return;
|
724
681
|
p.isHovered = !0;
|
725
|
-
let
|
726
|
-
p.target =
|
682
|
+
let T = m.currentTarget;
|
683
|
+
p.target = T, t && t({
|
727
684
|
type: "hoverstart",
|
728
|
-
target:
|
729
|
-
pointerType:
|
685
|
+
target: T,
|
686
|
+
pointerType: w
|
730
687
|
}), r && r(!0), u(!0);
|
731
|
-
},
|
732
|
-
if (p.pointerType = "", p.target = null,
|
688
|
+
}, D = (m, w) => {
|
689
|
+
if (p.pointerType = "", p.target = null, w === "touch" || !p.isHovered)
|
733
690
|
return;
|
734
691
|
p.isHovered = !1;
|
735
|
-
let
|
692
|
+
let T = m.currentTarget;
|
736
693
|
o && o({
|
737
694
|
type: "hoverend",
|
738
|
-
target:
|
739
|
-
pointerType:
|
695
|
+
target: T,
|
696
|
+
pointerType: w
|
740
697
|
}), r && r(!1), u(!1);
|
741
698
|
}, x = {};
|
742
699
|
return typeof PointerEvent < "u" ? (x.onPointerEnter = (m) => {
|
743
|
-
|
700
|
+
J && m.pointerType === "mouse" || g(m, m.pointerType);
|
744
701
|
}, x.onPointerLeave = (m) => {
|
745
|
-
!i && m.currentTarget.contains(m.target) &&
|
702
|
+
!i && m.currentTarget.contains(m.target) && D(m, m.pointerType);
|
746
703
|
}) : (x.onTouchStart = () => {
|
747
704
|
p.ignoreEmulatedMouseEvents = !0;
|
748
705
|
}, x.onMouseEnter = (m) => {
|
749
|
-
!p.ignoreEmulatedMouseEvents && !
|
706
|
+
!p.ignoreEmulatedMouseEvents && !J && g(m, "mouse"), p.ignoreEmulatedMouseEvents = !1;
|
750
707
|
}, x.onMouseLeave = (m) => {
|
751
|
-
!i && m.currentTarget.contains(m.target) &&
|
708
|
+
!i && m.currentTarget.contains(m.target) && D(m, "mouse");
|
752
709
|
}), {
|
753
710
|
hoverProps: x,
|
754
|
-
triggerHoverEnd:
|
711
|
+
triggerHoverEnd: D
|
755
712
|
};
|
756
713
|
}, [
|
757
714
|
t,
|
@@ -760,8 +717,8 @@ function Ct(e) {
|
|
760
717
|
i,
|
761
718
|
p
|
762
719
|
]);
|
763
|
-
return
|
764
|
-
i &&
|
720
|
+
return X(() => {
|
721
|
+
i && k({
|
765
722
|
currentTarget: p.target
|
766
723
|
}, p.pointerType);
|
767
724
|
}, [
|
@@ -771,7 +728,7 @@ function Ct(e) {
|
|
771
728
|
isHovered: d
|
772
729
|
};
|
773
730
|
}
|
774
|
-
function
|
731
|
+
function kt(e, t) {
|
775
732
|
let {
|
776
733
|
elementType: r = "button",
|
777
734
|
isDisabled: o,
|
@@ -780,55 +737,56 @@ function _t(e, t) {
|
|
780
737
|
onPressEnd: u,
|
781
738
|
onPressUp: p,
|
782
739
|
onPressChange: b,
|
783
|
-
preventFocusOnPress:
|
784
|
-
allowFocusWhenDisabled:
|
785
|
-
|
740
|
+
preventFocusOnPress: k,
|
741
|
+
allowFocusWhenDisabled: g,
|
742
|
+
// @ts-ignore
|
743
|
+
onClick: D,
|
786
744
|
href: x,
|
787
745
|
target: m,
|
788
|
-
rel:
|
789
|
-
type:
|
790
|
-
} = e,
|
791
|
-
r === "button" ?
|
792
|
-
type:
|
746
|
+
rel: w,
|
747
|
+
type: T = "button"
|
748
|
+
} = e, $;
|
749
|
+
r === "button" ? $ = {
|
750
|
+
type: T,
|
793
751
|
disabled: o
|
794
|
-
} :
|
752
|
+
} : $ = {
|
795
753
|
role: "button",
|
796
754
|
tabIndex: o ? void 0 : 0,
|
797
755
|
href: r === "a" && o ? void 0 : x,
|
798
756
|
target: r === "a" ? m : void 0,
|
799
|
-
type: r === "input" ?
|
757
|
+
type: r === "input" ? T : void 0,
|
800
758
|
disabled: r === "input" ? o : void 0,
|
801
759
|
"aria-disabled": !o || r === "input" ? void 0 : o,
|
802
|
-
rel: r === "a" ?
|
760
|
+
rel: r === "a" ? w : void 0
|
803
761
|
};
|
804
|
-
let { pressProps:
|
762
|
+
let { pressProps: S, isPressed: P } = ft({
|
805
763
|
onPressStart: d,
|
806
764
|
onPressEnd: u,
|
807
765
|
onPressChange: b,
|
808
766
|
onPress: i,
|
809
767
|
onPressUp: p,
|
810
768
|
isDisabled: o,
|
811
|
-
preventFocusOnPress:
|
769
|
+
preventFocusOnPress: k,
|
812
770
|
ref: t
|
813
|
-
}), { focusableProps:
|
814
|
-
|
815
|
-
let
|
771
|
+
}), { focusableProps: E } = He(e, t);
|
772
|
+
g && (E.tabIndex = o ? -1 : E.tabIndex);
|
773
|
+
let O = H(E, S, Xe(e, {
|
816
774
|
labelable: !0
|
817
775
|
}));
|
818
776
|
return {
|
819
|
-
isPressed:
|
820
|
-
buttonProps:
|
777
|
+
isPressed: P,
|
778
|
+
buttonProps: H($, O, {
|
821
779
|
"aria-haspopup": e["aria-haspopup"],
|
822
780
|
"aria-expanded": e["aria-expanded"],
|
823
781
|
"aria-controls": e["aria-controls"],
|
824
782
|
"aria-pressed": e["aria-pressed"],
|
825
|
-
onClick: (
|
826
|
-
|
783
|
+
onClick: (N) => {
|
784
|
+
D && (D(N), console.warn("onClick is deprecated, please use onPress"));
|
827
785
|
}
|
828
786
|
})
|
829
787
|
};
|
830
788
|
}
|
831
|
-
function
|
789
|
+
function Et(e, t, r) {
|
832
790
|
return t in e ? Object.defineProperty(e, t, {
|
833
791
|
value: r,
|
834
792
|
enumerable: !0,
|
@@ -836,7 +794,7 @@ function Kt(e, t, r) {
|
|
836
794
|
writable: !0
|
837
795
|
}) : e[t] = r, e;
|
838
796
|
}
|
839
|
-
function
|
797
|
+
function ke(e, t) {
|
840
798
|
var r = Object.keys(e);
|
841
799
|
if (Object.getOwnPropertySymbols) {
|
842
800
|
var o = Object.getOwnPropertySymbols(e);
|
@@ -846,40 +804,43 @@ function xe(e, t) {
|
|
846
804
|
}
|
847
805
|
return r;
|
848
806
|
}
|
849
|
-
function
|
807
|
+
function Ee(e) {
|
850
808
|
for (var t = 1; t < arguments.length; t++) {
|
851
809
|
var r = arguments[t] != null ? arguments[t] : {};
|
852
|
-
t % 2 ?
|
853
|
-
|
854
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) :
|
810
|
+
t % 2 ? ke(Object(r), !0).forEach(function(o) {
|
811
|
+
Et(e, o, r[o]);
|
812
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : ke(Object(r)).forEach(function(o) {
|
855
813
|
Object.defineProperty(e, o, Object.getOwnPropertyDescriptor(r, o));
|
856
814
|
});
|
857
815
|
}
|
858
816
|
return e;
|
859
817
|
}
|
860
|
-
var
|
818
|
+
var Tt = (e, t, r) => {
|
861
819
|
for (var o of Object.keys(e)) {
|
862
820
|
var i;
|
863
821
|
if (e[o] !== ((i = t[o]) !== null && i !== void 0 ? i : r[o]))
|
864
822
|
return !1;
|
865
823
|
}
|
866
824
|
return !0;
|
867
|
-
},
|
868
|
-
var r = e.defaultClassName, o =
|
825
|
+
}, ee = (e) => (t) => {
|
826
|
+
var r = e.defaultClassName, o = Ee(Ee({}, e.defaultVariants), t);
|
869
827
|
for (var i in o) {
|
870
828
|
var d, u = (d = o[i]) !== null && d !== void 0 ? d : e.defaultVariants[i];
|
871
829
|
if (u != null) {
|
872
830
|
var p = u;
|
873
831
|
typeof p == "boolean" && (p = p === !0 ? "true" : "false");
|
874
|
-
var b =
|
832
|
+
var b = (
|
833
|
+
// @ts-expect-error
|
834
|
+
e.variantClassNames[i][p]
|
835
|
+
);
|
875
836
|
b && (r += " " + b);
|
876
837
|
}
|
877
838
|
}
|
878
|
-
for (var [
|
879
|
-
|
839
|
+
for (var [k, g] of e.compoundVariants)
|
840
|
+
Tt(k, o, e.defaultVariants) && (r += " " + g);
|
880
841
|
return r;
|
881
|
-
},
|
882
|
-
function
|
842
|
+
}, Bt = ee({ defaultClassName: "_125pcxy0", variantClassNames: { disabled: { true: "_125pcxy1", false: "_125pcxy2" }, kind: { default: "_125pcxy3", link: "_125pcxy4", confirm: "_125pcxy5", delete: "_125pcxy6", key: "_125pcxy7", icon: "_125pcxy8" }, spinning: { true: "_125pcxy9", false: "_125pcxya" } }, defaultVariants: { disabled: !1, kind: "default", spinning: !1 }, compoundVariants: [[{ kind: "icon", spinning: !0 }, "_125pcxyb"], [{ kind: "default", spinning: !0 }, "_125pcxyc"], [{ kind: "confirm", spinning: !0 }, "_125pcxyd"], [{ kind: "delete", spinning: !0 }, "_125pcxye"], [{ kind: "key", spinning: !0 }, "_125pcxyf"], [{ disabled: !0, spinning: !1 }, "_125pcxyg"]] }), $t = ee({ defaultClassName: "_125pcxyh", variantClassNames: { disabled: { true: "_125pcxyi", false: "_125pcxyj" }, kind: { icon: "_125pcxyk", default: "_125pcxyl", delete: "_125pcxym", key: "_125pcxyn", confirm: "_125pcxyo", link: "_125pcxyp" }, spinning: { true: "_125pcxyq", false: "_125pcxyr" } }, defaultVariants: { disabled: !1, kind: "default", spinning: !1 }, compoundVariants: [] }), Pt = "_125pcxyv", wt = ee({ defaultClassName: "_125pcxyw", variantClassNames: { spinning: { true: "_125pcxyx", false: "_125pcxyy" } }, defaultVariants: { spinning: !1 }, compoundVariants: [] }), xt = ee({ defaultClassName: "_125pcxys", variantClassNames: { spinning: { true: "_125pcxyt", false: "_125pcxyu" } }, defaultVariants: { spinning: !1 }, compoundVariants: [] });
|
843
|
+
function St({
|
883
844
|
as: e,
|
884
845
|
onClick: t,
|
885
846
|
onPress: r,
|
@@ -889,60 +850,60 @@ function Rt({
|
|
889
850
|
disabled: u,
|
890
851
|
href: p,
|
891
852
|
icon: b,
|
892
|
-
kind:
|
893
|
-
spinning:
|
894
|
-
spinningTitle:
|
853
|
+
kind: k = "default",
|
854
|
+
spinning: g,
|
855
|
+
spinningTitle: D,
|
895
856
|
title: x,
|
896
857
|
...m
|
897
|
-
},
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
isDisabled:
|
858
|
+
}, w) {
|
859
|
+
const T = e ?? (p ? "a" : "button"), $ = {
|
860
|
+
onPress: r ?? t,
|
861
|
+
// the button element should be disabled if the button is marked as disabled or spinning
|
862
|
+
isDisabled: u ?? d ?? g,
|
902
863
|
...m
|
903
|
-
}, { "data-testid":
|
904
|
-
...
|
905
|
-
ref:
|
864
|
+
}, { "data-testid": S } = m, P = w || c.useRef(null), { buttonProps: E } = kt($, P), { hoverProps: O } = ht({ isDisabled: $.isDisabled }), { type: N, ...I } = E, te = {
|
865
|
+
...H(I, O),
|
866
|
+
ref: P,
|
906
867
|
title: x,
|
907
|
-
className: p ?
|
908
|
-
...p ? { href: p } : { type:
|
909
|
-
}, { t: n } = c.useContext(
|
910
|
-
|
868
|
+
className: p ? xt({ spinning: g }) : $t({ disabled: d || u, kind: k, spinning: g }),
|
869
|
+
...p ? { href: p } : { type: N }
|
870
|
+
}, { t: n } = c.useContext(Le), f = b && /* @__PURE__ */ c.createElement(
|
871
|
+
Ue,
|
911
872
|
{
|
912
|
-
className:
|
873
|
+
className: Pt,
|
913
874
|
icon: b,
|
914
875
|
"aria-hidden": "true",
|
915
|
-
"data-testid": `${
|
876
|
+
"data-testid": `${S}__${b}-icon`
|
916
877
|
}
|
917
878
|
);
|
918
|
-
let
|
919
|
-
|
920
|
-
const l =
|
921
|
-
|
879
|
+
let B;
|
880
|
+
k === "default" || k === "icon" || k === "link" ? B = "dark" : B = "light";
|
881
|
+
const l = g && /* @__PURE__ */ c.createElement(
|
882
|
+
Me,
|
922
883
|
{
|
923
|
-
color:
|
924
|
-
className:
|
925
|
-
title:
|
926
|
-
"data-testid": `${
|
884
|
+
color: B,
|
885
|
+
className: wt({ spinning: g }),
|
886
|
+
title: D || n("design-system:button.spinningTitle"),
|
887
|
+
"data-testid": `${S}__spinner`
|
927
888
|
}
|
928
889
|
);
|
929
|
-
return /* @__PURE__ */ c.createElement(
|
890
|
+
return /* @__PURE__ */ c.createElement(Re, null, /* @__PURE__ */ c.createElement(
|
930
891
|
"div",
|
931
892
|
{
|
932
|
-
className:
|
933
|
-
|
893
|
+
className: Fe(
|
894
|
+
Bt({
|
934
895
|
disabled: d || u,
|
935
|
-
kind:
|
936
|
-
spinning:
|
896
|
+
kind: k,
|
897
|
+
spinning: g
|
937
898
|
}),
|
938
899
|
i
|
939
900
|
)
|
940
901
|
},
|
941
|
-
/* @__PURE__ */ c.createElement(
|
902
|
+
/* @__PURE__ */ c.createElement(T, { ...te }, f, o ? /* @__PURE__ */ c.createElement("span", null, o) : "", l)
|
942
903
|
));
|
943
904
|
}
|
944
|
-
const
|
945
|
-
|
905
|
+
const Ie = c.forwardRef(St);
|
906
|
+
Ae.set(Ie, {
|
946
907
|
name: "Button",
|
947
908
|
props: {
|
948
909
|
disabled: "boolean",
|
@@ -958,9 +919,9 @@ Ye.set(We, {
|
|
958
919
|
},
|
959
920
|
panellable: !0
|
960
921
|
});
|
961
|
-
const
|
962
|
-
components: [
|
963
|
-
description: () => /* @__PURE__ */ c.createElement(c.Fragment, null, /* @__PURE__ */ c.createElement("div", { className: "sps-body-14" }, "Buttons are used to initiate events or actions. The labels and/or icons describe what the button will do."), /* @__PURE__ */ c.createElement("br", null), /* @__PURE__ */ c.createElement("h5", null, "Variants"), /* @__PURE__ */ c.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ c.createElement("span", { className: "sps-text-semibold" }, "Default: "), "For tertiary actions or actions of lower importance on a page."), /* @__PURE__ */ c.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ c.createElement("span", { className: "sps-text-semibold" }, "Key: "), "For primary or important actions on a page."), /* @__PURE__ */ c.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ c.createElement("span", { className: "sps-text-semibold" }, "Confirm: "), "For the main call to action on a page. There should only be one Confirm button per screen."), /* @__PURE__ */ c.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ c.createElement("span", { className: "sps-text-semibold" }, "Delete: "), "For deleting information or another destructive action. These should always be paired with a Delete Confirmation Modal."), /* @__PURE__ */ c.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ c.createElement("span", { className: "sps-text-semibold" }, "Disabled: "), "For actions that are not permitted in a particular state. These can be accompanied by a Tooltip on hover describing why it
|
922
|
+
const Nt = {
|
923
|
+
components: [Ie],
|
924
|
+
description: () => /* @__PURE__ */ c.createElement(c.Fragment, null, /* @__PURE__ */ c.createElement("div", { className: "sps-body-14" }, "Buttons are used to initiate events or actions. The labels and/or icons describe what the button will do."), /* @__PURE__ */ c.createElement("br", null), /* @__PURE__ */ c.createElement("h5", null, "Variants"), /* @__PURE__ */ c.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ c.createElement("span", { className: "sps-text-semibold" }, "Default: "), "For tertiary actions or actions of lower importance on a page."), /* @__PURE__ */ c.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ c.createElement("span", { className: "sps-text-semibold" }, "Key: "), "For primary or important actions on a page."), /* @__PURE__ */ c.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ c.createElement("span", { className: "sps-text-semibold" }, "Confirm: "), "For the main call to action on a page. There should only be one Confirm button per screen."), /* @__PURE__ */ c.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ c.createElement("span", { className: "sps-text-semibold" }, "Delete: "), "For deleting information or another destructive action. These should always be paired with a Delete Confirmation Modal."), /* @__PURE__ */ c.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ c.createElement("span", { className: "sps-text-semibold" }, "Disabled: "), "For actions that are not permitted in a particular state. These can be accompanied by a Tooltip on hover describing why it’s disabled."), /* @__PURE__ */ c.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ c.createElement("span", { className: "sps-text-semibold" }, "With an Icon: "), "For further illustrating the action. Example: Pencil icon in an Edit button. There can also be Icon Buttons without text.")),
|
964
925
|
examples: {
|
965
926
|
basic: {
|
966
927
|
label: "Basic Buttons",
|
@@ -1522,10 +1483,10 @@ const Gt = {
|
|
1522
1483
|
}
|
1523
1484
|
}
|
1524
1485
|
}
|
1525
|
-
},
|
1526
|
-
Buttons:
|
1486
|
+
}, It = {
|
1487
|
+
Buttons: Nt
|
1527
1488
|
};
|
1528
1489
|
export {
|
1529
|
-
|
1530
|
-
|
1490
|
+
Ie as Button,
|
1491
|
+
It as MANIFEST
|
1531
1492
|
};
|