@sps-woodland/buttons 8.20.7 → 8.20.9
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 +23 -23
- package/lib/index.es.js +243 -236
- package/lib/style.css +1 -1
- package/package.json +5 -5
package/lib/index.es.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import * as c from "react";
|
2
|
-
import Be, { useRef as ee, useCallback as z, useEffect as J, useState as
|
3
|
-
import { Metadata as
|
4
|
-
import { useFocusable as
|
5
|
-
import { code as
|
2
|
+
import Be, { useRef as ee, useCallback as z, useEffect as J, useState as Ee, useMemo as $e, useContext as Me } from "react";
|
3
|
+
import { Metadata as Fe, I18nContext as Ue, Spinner as He, cl as Re, Icon as Ge } from "@sps-woodland/core";
|
4
|
+
import { useFocusable as Ve, FocusRing as We } from "@react-aria/focus";
|
5
|
+
import { code as y } from "@spscommerce/utils";
|
6
6
|
const Pe = typeof document < "u" ? Be.useLayoutEffect : () => {
|
7
7
|
};
|
8
8
|
function H(e) {
|
@@ -17,23 +17,23 @@ function H(e) {
|
|
17
17
|
}, []);
|
18
18
|
}
|
19
19
|
let fe = /* @__PURE__ */ new Map();
|
20
|
-
function
|
20
|
+
function Ye(e, t) {
|
21
21
|
if (e === t) return e;
|
22
22
|
let r = fe.get(e);
|
23
23
|
if (r)
|
24
|
-
return r(t), t;
|
24
|
+
return r.forEach((a) => a(t)), t;
|
25
25
|
let o = fe.get(t);
|
26
|
-
return o ? (o(e), e) : t;
|
26
|
+
return o ? (o.forEach((a) => a(e)), e) : t;
|
27
27
|
}
|
28
28
|
function xe(...e) {
|
29
29
|
return (...t) => {
|
30
30
|
for (let r of e) typeof r == "function" && r(...t);
|
31
31
|
};
|
32
32
|
}
|
33
|
-
const
|
33
|
+
const I = (e) => {
|
34
34
|
var t;
|
35
35
|
return (t = e == null ? void 0 : e.ownerDocument) !== null && t !== void 0 ? t : document;
|
36
|
-
}, ie = (e) => e && "window" in e && e.window === e ? e :
|
36
|
+
}, ie = (e) => e && "window" in e && e.window === e ? e : I(e).defaultView || window;
|
37
37
|
function Se(e) {
|
38
38
|
var t, r, o = "";
|
39
39
|
if (typeof e == "string" || typeof e == "number") o += e;
|
@@ -43,7 +43,7 @@ function Se(e) {
|
|
43
43
|
} else for (r in e) e[r] && (o && (o += " "), o += r);
|
44
44
|
return o;
|
45
45
|
}
|
46
|
-
function
|
46
|
+
function je() {
|
47
47
|
for (var e, t, r = 0, o = "", a = arguments.length; r < a; r++) (e = arguments[r]) && (t = Se(e)) && (o && (o += " "), o += t);
|
48
48
|
return o;
|
49
49
|
}
|
@@ -58,19 +58,19 @@ function G(...e) {
|
|
58
58
|
typeof d == "function" && typeof u == "function" && // This is a lot faster than a regex.
|
59
59
|
a[0] === "o" && a[1] === "n" && a.charCodeAt(2) >= /* 'A' */
|
60
60
|
65 && a.charCodeAt(2) <= /* 'Z' */
|
61
|
-
90 ? t[a] = xe(d, u) : (a === "className" || a === "UNSAFE_className") && typeof d == "string" && typeof u == "string" ? t[a] =
|
61
|
+
90 ? t[a] = xe(d, u) : (a === "className" || a === "UNSAFE_className") && typeof d == "string" && typeof u == "string" ? t[a] = je(d, u) : a === "id" && d && u ? t.id = Ye(d, u) : t[a] = u !== void 0 ? u : d;
|
62
62
|
}
|
63
63
|
}
|
64
64
|
return t;
|
65
65
|
}
|
66
|
-
const
|
66
|
+
const Xe = /* @__PURE__ */ new Set([
|
67
67
|
"id"
|
68
|
-
]),
|
68
|
+
]), ze = /* @__PURE__ */ new Set([
|
69
69
|
"aria-label",
|
70
70
|
"aria-labelledby",
|
71
71
|
"aria-describedby",
|
72
72
|
"aria-details"
|
73
|
-
]),
|
73
|
+
]), qe = /* @__PURE__ */ new Set([
|
74
74
|
"href",
|
75
75
|
"hrefLang",
|
76
76
|
"target",
|
@@ -78,23 +78,23 @@ const je = /* @__PURE__ */ new Set([
|
|
78
78
|
"download",
|
79
79
|
"ping",
|
80
80
|
"referrerPolicy"
|
81
|
-
]),
|
82
|
-
function
|
81
|
+
]), Je = /^(data-.*)$/;
|
82
|
+
function Qe(e, t = {}) {
|
83
83
|
let { labelable: r, isLink: o, propNames: a } = t, d = {};
|
84
|
-
for (const u in e) Object.prototype.hasOwnProperty.call(e, u) && (
|
84
|
+
for (const u in e) Object.prototype.hasOwnProperty.call(e, u) && (Xe.has(u) || r && ze.has(u) || o && qe.has(u) || a != null && a.has(u) || Je.test(u)) && (d[u] = e[u]);
|
85
85
|
return d;
|
86
86
|
}
|
87
87
|
function R(e) {
|
88
|
-
if (
|
88
|
+
if (Ze()) e.focus({
|
89
89
|
preventScroll: !0
|
90
90
|
});
|
91
91
|
else {
|
92
|
-
let t =
|
93
|
-
e.focus(),
|
92
|
+
let t = et(e);
|
93
|
+
e.focus(), tt(t);
|
94
94
|
}
|
95
95
|
}
|
96
96
|
let W = null;
|
97
|
-
function
|
97
|
+
function Ze() {
|
98
98
|
if (W == null) {
|
99
99
|
W = !1;
|
100
100
|
try {
|
@@ -108,7 +108,7 @@ function Qe() {
|
|
108
108
|
}
|
109
109
|
return W;
|
110
110
|
}
|
111
|
-
function
|
111
|
+
function et(e) {
|
112
112
|
let t = e.parentNode, r = [], o = document.scrollingElement || document.documentElement;
|
113
113
|
for (; t instanceof HTMLElement && t !== o; )
|
114
114
|
(t.offsetHeight < t.scrollHeight || t.offsetWidth < t.scrollWidth) && r.push({
|
@@ -122,7 +122,7 @@ function Ze(e) {
|
|
122
122
|
scrollLeft: o.scrollLeft
|
123
123
|
}), r;
|
124
124
|
}
|
125
|
-
function
|
125
|
+
function tt(e) {
|
126
126
|
for (let { element: t, scrollTop: r, scrollLeft: o } of e)
|
127
127
|
t.scrollTop = r, t.scrollLeft = o;
|
128
128
|
}
|
@@ -134,33 +134,33 @@ function de(e) {
|
|
134
134
|
var t;
|
135
135
|
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;
|
136
136
|
}
|
137
|
-
function
|
137
|
+
function L(e) {
|
138
138
|
let t = null;
|
139
139
|
return () => (t == null && (t = e()), t);
|
140
140
|
}
|
141
|
-
const Q =
|
141
|
+
const Q = L(function() {
|
142
142
|
return de(/^Mac/i);
|
143
|
-
}),
|
143
|
+
}), nt = L(function() {
|
144
144
|
return de(/^iPhone/i);
|
145
|
-
}), Ne =
|
145
|
+
}), Ne = L(function() {
|
146
146
|
return de(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
147
147
|
Q() && navigator.maxTouchPoints > 1;
|
148
|
-
}),
|
149
|
-
return
|
150
|
-
}),
|
151
|
-
return te(/AppleWebKit/i) && !
|
152
|
-
}),
|
148
|
+
}), De = L(function() {
|
149
|
+
return nt() || Ne();
|
150
|
+
}), ot = L(function() {
|
151
|
+
return te(/AppleWebKit/i) && !rt();
|
152
|
+
}), rt = L(function() {
|
153
153
|
return te(/Chrome/i);
|
154
|
-
}),
|
154
|
+
}), Oe = L(function() {
|
155
155
|
return te(/Android/i);
|
156
|
-
}),
|
156
|
+
}), st = L(function() {
|
157
157
|
return te(/Firefox/i);
|
158
158
|
});
|
159
159
|
function V(e, t, r = !0) {
|
160
160
|
var o, a;
|
161
161
|
let { metaKey: d, ctrlKey: u, altKey: p, shiftKey: m } = t;
|
162
|
-
|
163
|
-
let
|
162
|
+
st() && (!((a = window.event) === null || a === void 0 || (o = a.type) === null || o === void 0) && o.startsWith("key")) && e.target === "_blank" && (Q() ? d = !0 : u = !0);
|
163
|
+
let v = ot() && Q() && !Ne() ? new KeyboardEvent("keydown", {
|
164
164
|
keyIdentifier: "Enter",
|
165
165
|
metaKey: d,
|
166
166
|
ctrlKey: u,
|
@@ -174,7 +174,7 @@ function V(e, t, r = !0) {
|
|
174
174
|
bubbles: !0,
|
175
175
|
cancelable: !0
|
176
176
|
});
|
177
|
-
V.isOpening = r, R(e), e.dispatchEvent(
|
177
|
+
V.isOpening = r, R(e), e.dispatchEvent(v), V.isOpening = !1;
|
178
178
|
}
|
179
179
|
V.isOpening = !1;
|
180
180
|
let F = /* @__PURE__ */ new Map(), le = /* @__PURE__ */ new Set();
|
@@ -200,15 +200,15 @@ function me() {
|
|
200
200
|
document.body.addEventListener("transitionrun", t), document.body.addEventListener("transitionend", r);
|
201
201
|
}
|
202
202
|
typeof document < "u" && (document.readyState !== "loading" ? me() : document.addEventListener("DOMContentLoaded", me));
|
203
|
-
function
|
203
|
+
function at(e) {
|
204
204
|
requestAnimationFrame(() => {
|
205
205
|
F.size === 0 ? e() : le.add(e);
|
206
206
|
});
|
207
207
|
}
|
208
|
-
function
|
208
|
+
function it() {
|
209
209
|
let e = ee(/* @__PURE__ */ new Map()), t = z((a, d, u, p) => {
|
210
|
-
let m = p != null && p.once ? (...
|
211
|
-
e.current.delete(u), u(...
|
210
|
+
let m = p != null && p.once ? (...v) => {
|
211
|
+
e.current.delete(u), u(...v);
|
212
212
|
} : u;
|
213
213
|
e.current.set(u, {
|
214
214
|
type: d,
|
@@ -218,8 +218,8 @@ function at() {
|
|
218
218
|
}), a.addEventListener(d, u, p);
|
219
219
|
}, []), r = z((a, d, u, p) => {
|
220
220
|
var m;
|
221
|
-
let
|
222
|
-
a.removeEventListener(d,
|
221
|
+
let v = ((m = e.current.get(u)) === null || m === void 0 ? void 0 : m.fn) || u;
|
222
|
+
a.removeEventListener(d, v, p), e.current.delete(u);
|
223
223
|
}, []), o = z(() => {
|
224
224
|
e.current.forEach((a, d) => {
|
225
225
|
r(a.eventTarget, a.type, d, a.options);
|
@@ -235,7 +235,7 @@ function at() {
|
|
235
235
|
removeAllGlobalListeners: o
|
236
236
|
};
|
237
237
|
}
|
238
|
-
function
|
238
|
+
function lt(e, t) {
|
239
239
|
Pe(() => {
|
240
240
|
if (e && e.ref && t)
|
241
241
|
return e.ref.current = t.current, () => {
|
@@ -244,28 +244,28 @@ function it(e, t) {
|
|
244
244
|
});
|
245
245
|
}
|
246
246
|
function _e(e) {
|
247
|
-
return e.mozInputSource === 0 && e.isTrusted ? !0 :
|
247
|
+
return e.mozInputSource === 0 && e.isTrusted ? !0 : Oe() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
|
248
248
|
}
|
249
|
-
function
|
250
|
-
return !
|
249
|
+
function ut(e) {
|
250
|
+
return !Oe() && e.width === 0 && e.height === 0 || e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse";
|
251
251
|
}
|
252
252
|
let U = "default", ue = "", q = /* @__PURE__ */ new WeakMap();
|
253
|
-
function
|
254
|
-
if (
|
253
|
+
function ge(e) {
|
254
|
+
if (De()) {
|
255
255
|
if (U === "default") {
|
256
|
-
const t =
|
256
|
+
const t = I(e);
|
257
257
|
ue = t.documentElement.style.webkitUserSelect, t.documentElement.style.webkitUserSelect = "none";
|
258
258
|
}
|
259
259
|
U = "disabled";
|
260
260
|
} else (e instanceof HTMLElement || e instanceof SVGElement) && (q.set(e, e.style.userSelect), e.style.userSelect = "none");
|
261
261
|
}
|
262
262
|
function Y(e) {
|
263
|
-
if (
|
263
|
+
if (De()) {
|
264
264
|
if (U !== "disabled") return;
|
265
265
|
U = "restoring", setTimeout(() => {
|
266
|
-
|
266
|
+
at(() => {
|
267
267
|
if (U === "restoring") {
|
268
|
-
const t =
|
268
|
+
const t = I(e);
|
269
269
|
t.documentElement.style.webkitUserSelect === "none" && (t.documentElement.style.webkitUserSelect = ue || ""), ue = "", U = "default";
|
270
270
|
}
|
271
271
|
});
|
@@ -280,25 +280,25 @@ const Ce = Be.createContext({
|
|
280
280
|
}
|
281
281
|
});
|
282
282
|
Ce.displayName = "PressResponderContext";
|
283
|
-
function
|
283
|
+
function ct(e, t) {
|
284
284
|
return t.get ? t.get.call(e) : t.value;
|
285
285
|
}
|
286
286
|
function Ke(e, t, r) {
|
287
287
|
if (!t.has(e)) throw new TypeError("attempted to " + r + " private field on non-instance");
|
288
288
|
return t.get(e);
|
289
289
|
}
|
290
|
-
function
|
290
|
+
function dt(e, t) {
|
291
291
|
var r = Ke(e, t, "get");
|
292
|
-
return
|
292
|
+
return ct(e, r);
|
293
293
|
}
|
294
|
-
function
|
294
|
+
function pt(e, t) {
|
295
295
|
if (t.has(e))
|
296
296
|
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
297
297
|
}
|
298
|
-
function pt(e, t, r) {
|
299
|
-
dt(e, t), t.set(e, r);
|
300
|
-
}
|
301
298
|
function ft(e, t, r) {
|
299
|
+
pt(e, t), t.set(e, r);
|
300
|
+
}
|
301
|
+
function mt(e, t, r) {
|
302
302
|
if (t.set) t.set.call(e, r);
|
303
303
|
else {
|
304
304
|
if (!t.writable)
|
@@ -306,40 +306,40 @@ function ft(e, t, r) {
|
|
306
306
|
t.value = r;
|
307
307
|
}
|
308
308
|
}
|
309
|
-
function
|
309
|
+
function be(e, t, r) {
|
310
310
|
var o = Ke(e, t, "set");
|
311
|
-
return
|
311
|
+
return mt(e, o, r), r;
|
312
312
|
}
|
313
|
-
function
|
314
|
-
let t =
|
313
|
+
function _t(e) {
|
314
|
+
let t = Me(Ce);
|
315
315
|
if (t) {
|
316
316
|
let { register: r, ...o } = t;
|
317
317
|
e = G(o, e), r();
|
318
318
|
}
|
319
|
-
return
|
319
|
+
return lt(t, e.ref), e;
|
320
320
|
}
|
321
321
|
var j = /* @__PURE__ */ new WeakMap();
|
322
322
|
class X {
|
323
323
|
continuePropagation() {
|
324
|
-
|
324
|
+
be(this, j, !1);
|
325
325
|
}
|
326
326
|
get shouldStopPropagation() {
|
327
|
-
return
|
327
|
+
return dt(this, j);
|
328
328
|
}
|
329
329
|
constructor(t, r, o, a) {
|
330
|
-
|
330
|
+
ft(this, j, {
|
331
331
|
writable: !0,
|
332
332
|
value: void 0
|
333
|
-
}),
|
333
|
+
}), be(this, j, !0);
|
334
334
|
var d;
|
335
335
|
let u = (d = a == null ? void 0 : a.target) !== null && d !== void 0 ? d : o.currentTarget;
|
336
336
|
const p = u == null ? void 0 : u.getBoundingClientRect();
|
337
|
-
let m,
|
338
|
-
o.clientX != null && o.clientY != null && (
|
337
|
+
let m, v = 0, g, $ = null;
|
338
|
+
o.clientX != null && o.clientY != null && (g = o.clientX, $ = o.clientY), p && (g != null && $ != null ? (m = g - p.left, v = $ - p.top) : (m = p.width / 2, v = p.height / 2)), 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, this.x = m, this.y = v;
|
339
339
|
}
|
340
340
|
}
|
341
341
|
const ve = Symbol("linkClicked");
|
342
|
-
function
|
342
|
+
function gt(e) {
|
343
343
|
let {
|
344
344
|
onPress: t,
|
345
345
|
onPressChange: r,
|
@@ -349,12 +349,12 @@ function _t(e) {
|
|
349
349
|
isDisabled: u,
|
350
350
|
isPressed: p,
|
351
351
|
preventFocusOnPress: m,
|
352
|
-
shouldCancelOnPointerExit:
|
353
|
-
allowTextSelectionOnPress:
|
352
|
+
shouldCancelOnPointerExit: v,
|
353
|
+
allowTextSelectionOnPress: g,
|
354
354
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
355
|
-
ref:
|
355
|
+
ref: $,
|
356
356
|
...x
|
357
|
-
} =
|
357
|
+
} = _t(e), [_, P] = Ee(!1), w = ee({
|
358
358
|
isPressed: !1,
|
359
359
|
ignoreEmulatedMouseEvents: !1,
|
360
360
|
ignoreClickAfterPress: !1,
|
@@ -364,105 +364,109 @@ function _t(e) {
|
|
364
364
|
target: null,
|
365
365
|
isOverTarget: !1,
|
366
366
|
pointerType: null
|
367
|
-
}), { addGlobalListener:
|
368
|
-
let
|
369
|
-
if (u ||
|
367
|
+
}), { addGlobalListener: T, removeAllGlobalListeners: S } = it(), E = H((n, f) => {
|
368
|
+
let B = w.current;
|
369
|
+
if (u || B.didFirePressStart) return !1;
|
370
370
|
let l = !0;
|
371
|
-
if (
|
372
|
-
let
|
373
|
-
o(
|
371
|
+
if (B.isTriggeringEvent = !0, o) {
|
372
|
+
let h = new X("pressstart", f, n);
|
373
|
+
o(h), l = h.shouldStopPropagation;
|
374
374
|
}
|
375
|
-
return r && r(!0),
|
376
|
-
}), k = H((n, f,
|
375
|
+
return r && r(!0), B.isTriggeringEvent = !1, B.didFirePressStart = !0, P(!0), l;
|
376
|
+
}), k = H((n, f, B = !0) => {
|
377
377
|
let l = w.current;
|
378
378
|
if (!l.didFirePressStart) return !1;
|
379
379
|
l.ignoreClickAfterPress = !0, l.didFirePressStart = !1, l.isTriggeringEvent = !0;
|
380
|
-
let
|
380
|
+
let h = !0;
|
381
381
|
if (a) {
|
382
382
|
let s = new X("pressend", f, n);
|
383
|
-
a(s),
|
383
|
+
a(s), h = s.shouldStopPropagation;
|
384
384
|
}
|
385
|
-
if (r && r(!1), P(!1), t &&
|
385
|
+
if (r && r(!1), P(!1), t && B && !u) {
|
386
386
|
let s = new X("press", f, n);
|
387
|
-
t(s),
|
387
|
+
t(s), h && (h = s.shouldStopPropagation);
|
388
388
|
}
|
389
|
-
return l.isTriggeringEvent = !1,
|
390
|
-
}),
|
391
|
-
let
|
389
|
+
return l.isTriggeringEvent = !1, h;
|
390
|
+
}), D = H((n, f) => {
|
391
|
+
let B = w.current;
|
392
392
|
if (u) return !1;
|
393
393
|
if (d) {
|
394
|
-
|
394
|
+
B.isTriggeringEvent = !0;
|
395
395
|
let l = new X("pressup", f, n);
|
396
|
-
return d(l),
|
396
|
+
return d(l), B.isTriggeringEvent = !1, l.shouldStopPropagation;
|
397
397
|
}
|
398
398
|
return !0;
|
399
399
|
}), N = H((n) => {
|
400
400
|
let f = w.current;
|
401
|
-
f.isPressed && f.target && (f.isOverTarget && f.pointerType != null && k(
|
401
|
+
f.isPressed && f.target && (f.isOverTarget && f.pointerType != null && k(C(f.target, n), f.pointerType, !1), f.isPressed = !1, f.isOverTarget = !1, f.activePointerId = null, f.pointerType = null, S(), g || Y(f.target));
|
402
402
|
}), A = H((n) => {
|
403
|
-
|
404
|
-
}), oe =
|
403
|
+
v && N(n);
|
404
|
+
}), oe = $e(() => {
|
405
405
|
let n = w.current, f = {
|
406
406
|
onKeyDown(l) {
|
407
407
|
if (re(l.nativeEvent, l.currentTarget) && l.currentTarget.contains(l.target)) {
|
408
|
-
var
|
408
|
+
var h;
|
409
409
|
ye(l.target, l.key) && l.preventDefault();
|
410
410
|
let s = !0;
|
411
411
|
if (!n.isPressed && !l.repeat) {
|
412
|
-
n.target = l.currentTarget, n.isPressed = !0, s =
|
413
|
-
let
|
414
|
-
re(
|
412
|
+
n.target = l.currentTarget, n.isPressed = !0, s = E(l, "keyboard");
|
413
|
+
let b = l.currentTarget, i = (O) => {
|
414
|
+
re(O, b) && !O.repeat && b.contains(O.target) && n.target && D(C(n.target, O), "keyboard");
|
415
415
|
};
|
416
|
-
|
416
|
+
T(I(l.currentTarget), "keyup", xe(i, B), !0);
|
417
417
|
}
|
418
|
-
s && l.stopPropagation(), l.metaKey && Q() && ((
|
418
|
+
s && l.stopPropagation(), l.metaKey && Q() && ((h = n.metaKeyEvents) === null || h === void 0 || h.set(l.key, l.nativeEvent));
|
419
419
|
} else l.key === "Meta" && (n.metaKeyEvents = /* @__PURE__ */ new Map());
|
420
420
|
},
|
421
421
|
onClick(l) {
|
422
422
|
if (!(l && !l.currentTarget.contains(l.target)) && l && l.button === 0 && !n.isTriggeringEvent && !V.isOpening) {
|
423
|
-
let
|
423
|
+
let h = !0;
|
424
424
|
if (u && l.preventDefault(), !n.ignoreClickAfterPress && !n.ignoreEmulatedMouseEvents && !n.isPressed && (n.pointerType === "virtual" || _e(l.nativeEvent))) {
|
425
425
|
!u && !m && R(l.currentTarget);
|
426
|
-
let s =
|
427
|
-
|
426
|
+
let s = E(l, "virtual"), b = D(l, "virtual"), i = k(l, "virtual");
|
427
|
+
h = s && b && i;
|
428
428
|
}
|
429
|
-
n.ignoreEmulatedMouseEvents = !1, n.ignoreClickAfterPress = !1,
|
429
|
+
n.ignoreEmulatedMouseEvents = !1, n.ignoreClickAfterPress = !1, h && l.stopPropagation();
|
430
430
|
}
|
431
431
|
}
|
432
|
-
},
|
433
|
-
var
|
432
|
+
}, B = (l) => {
|
433
|
+
var h;
|
434
434
|
if (n.isPressed && n.target && re(l, n.target)) {
|
435
435
|
var s;
|
436
436
|
ye(l.target, l.key) && l.preventDefault();
|
437
|
-
let
|
438
|
-
k(
|
439
|
-
} else if (l.key === "Meta" && (!((
|
440
|
-
var
|
441
|
-
let
|
437
|
+
let i = l.target;
|
438
|
+
k(C(n.target, l), "keyboard", n.target.contains(i)), S(), l.key !== "Enter" && pe(n.target) && n.target.contains(i) && !l[ve] && (l[ve] = !0, V(n.target, l, !1)), n.isPressed = !1, (s = n.metaKeyEvents) === null || s === void 0 || s.delete(l.key);
|
439
|
+
} else if (l.key === "Meta" && (!((h = n.metaKeyEvents) === null || h === void 0) && h.size)) {
|
440
|
+
var b;
|
441
|
+
let i = n.metaKeyEvents;
|
442
442
|
n.metaKeyEvents = void 0;
|
443
|
-
for (let
|
443
|
+
for (let O of i.values()) (b = n.target) === null || b === void 0 || b.dispatchEvent(new KeyboardEvent("keyup", O));
|
444
444
|
}
|
445
445
|
};
|
446
446
|
if (typeof PointerEvent < "u") {
|
447
447
|
f.onPointerDown = (i) => {
|
448
448
|
if (i.button !== 0 || !i.currentTarget.contains(i.target)) return;
|
449
|
-
if (
|
449
|
+
if (ut(i.nativeEvent)) {
|
450
450
|
n.pointerType = "virtual";
|
451
451
|
return;
|
452
452
|
}
|
453
453
|
se(i.currentTarget) && i.preventDefault(), n.pointerType = i.pointerType;
|
454
|
-
let
|
455
|
-
n.isPressed || (n.isPressed = !0, n.isOverTarget = !0, n.activePointerId = i.pointerId, n.target = i.currentTarget, !u && !m && R(i.currentTarget),
|
454
|
+
let O = !0;
|
455
|
+
n.isPressed || (n.isPressed = !0, n.isOverTarget = !0, n.activePointerId = i.pointerId, n.target = i.currentTarget, !u && !m && R(i.currentTarget), g || ge(n.target), O = E(i, n.pointerType), T(I(i.currentTarget), "pointermove", l, !1), T(I(i.currentTarget), "pointerup", h, !1), T(I(i.currentTarget), "pointercancel", b, !1)), O && i.stopPropagation();
|
456
456
|
}, f.onMouseDown = (i) => {
|
457
457
|
i.currentTarget.contains(i.target) && i.button === 0 && (se(i.currentTarget) && i.preventDefault(), i.stopPropagation());
|
458
458
|
}, f.onPointerUp = (i) => {
|
459
|
-
!i.currentTarget.contains(i.target) || n.pointerType === "virtual" || i.button === 0 && M(i, i.currentTarget) &&
|
459
|
+
!i.currentTarget.contains(i.target) || n.pointerType === "virtual" || i.button === 0 && M(i, i.currentTarget) && D(i, n.pointerType || i.pointerType);
|
460
460
|
};
|
461
461
|
let l = (i) => {
|
462
|
-
i.pointerId === n.activePointerId && (n.target && M(i, n.target) ? !n.isOverTarget && n.pointerType != null && (n.isOverTarget = !0,
|
463
|
-
},
|
464
|
-
i.pointerId === n.activePointerId && n.isPressed && i.button === 0 && n.target && (M(i, n.target) && n.pointerType != null ? k(
|
462
|
+
i.pointerId === n.activePointerId && (n.target && M(i, n.target) ? !n.isOverTarget && n.pointerType != null && (n.isOverTarget = !0, E(C(n.target, i), n.pointerType)) : n.target && n.isOverTarget && n.pointerType != null && (n.isOverTarget = !1, k(C(n.target, i), n.pointerType, !1), A(i)));
|
463
|
+
}, h = (i) => {
|
464
|
+
i.pointerId === n.activePointerId && n.isPressed && i.button === 0 && n.target && (M(i, n.target) && n.pointerType != null ? k(C(n.target, i), n.pointerType) : n.isOverTarget && n.pointerType != null && k(C(n.target, i), n.pointerType, !1), n.isPressed = !1, n.isOverTarget = !1, n.activePointerId = null, n.pointerType = null, S(), g || Y(n.target), "ontouchend" in n.target && i.pointerType !== "mouse" && T(n.target, "touchend", s, {
|
465
|
+
once: !0
|
466
|
+
}));
|
465
467
|
}, s = (i) => {
|
468
|
+
Ie(i.target) && i.preventDefault();
|
469
|
+
}, b = (i) => {
|
466
470
|
N(i);
|
467
471
|
};
|
468
472
|
f.onDragStart = (i) => {
|
@@ -475,17 +479,17 @@ function _t(e) {
|
|
475
479
|
s.stopPropagation();
|
476
480
|
return;
|
477
481
|
}
|
478
|
-
n.isPressed = !0, n.isOverTarget = !0, n.target = s.currentTarget, n.pointerType = _e(s.nativeEvent) ? "virtual" : "mouse", !u && !m && R(s.currentTarget),
|
482
|
+
n.isPressed = !0, n.isOverTarget = !0, n.target = s.currentTarget, n.pointerType = _e(s.nativeEvent) ? "virtual" : "mouse", !u && !m && R(s.currentTarget), E(s, n.pointerType) && s.stopPropagation(), T(I(s.currentTarget), "mouseup", l, !1);
|
479
483
|
}, f.onMouseEnter = (s) => {
|
480
484
|
if (!s.currentTarget.contains(s.target)) return;
|
481
|
-
let
|
482
|
-
n.isPressed && !n.ignoreEmulatedMouseEvents && n.pointerType != null && (n.isOverTarget = !0,
|
485
|
+
let b = !0;
|
486
|
+
n.isPressed && !n.ignoreEmulatedMouseEvents && n.pointerType != null && (n.isOverTarget = !0, b = E(s, n.pointerType)), b && s.stopPropagation();
|
483
487
|
}, f.onMouseLeave = (s) => {
|
484
488
|
if (!s.currentTarget.contains(s.target)) return;
|
485
|
-
let
|
486
|
-
n.isPressed && !n.ignoreEmulatedMouseEvents && n.pointerType != null && (n.isOverTarget = !1,
|
489
|
+
let b = !0;
|
490
|
+
n.isPressed && !n.ignoreEmulatedMouseEvents && n.pointerType != null && (n.isOverTarget = !1, b = k(s, n.pointerType, !1), A(s)), b && s.stopPropagation();
|
487
491
|
}, f.onMouseUp = (s) => {
|
488
|
-
s.currentTarget.contains(s.target) && !n.ignoreEmulatedMouseEvents && s.button === 0 &&
|
492
|
+
s.currentTarget.contains(s.target) && !n.ignoreEmulatedMouseEvents && s.button === 0 && D(s, n.pointerType || "mouse");
|
489
493
|
};
|
490
494
|
let l = (s) => {
|
491
495
|
if (s.button === 0) {
|
@@ -493,34 +497,34 @@ function _t(e) {
|
|
493
497
|
n.ignoreEmulatedMouseEvents = !1;
|
494
498
|
return;
|
495
499
|
}
|
496
|
-
n.target && M(s, n.target) && n.pointerType != null ? k(
|
500
|
+
n.target && M(s, n.target) && n.pointerType != null ? k(C(n.target, s), n.pointerType) : n.target && n.isOverTarget && n.pointerType != null && k(C(n.target, s), n.pointerType, !1), n.isOverTarget = !1;
|
497
501
|
}
|
498
502
|
};
|
499
503
|
f.onTouchStart = (s) => {
|
500
504
|
if (!s.currentTarget.contains(s.target)) return;
|
501
|
-
let
|
502
|
-
if (!
|
503
|
-
n.activePointerId =
|
505
|
+
let b = bt(s.nativeEvent);
|
506
|
+
if (!b) return;
|
507
|
+
n.activePointerId = b.identifier, n.ignoreEmulatedMouseEvents = !0, n.isOverTarget = !0, n.isPressed = !0, n.target = s.currentTarget, n.pointerType = "touch", !u && !m && R(s.currentTarget), g || ge(n.target), E(K(n.target, s), n.pointerType) && s.stopPropagation(), T(ie(s.currentTarget), "scroll", h, !0);
|
504
508
|
}, f.onTouchMove = (s) => {
|
505
509
|
if (!s.currentTarget.contains(s.target)) return;
|
506
510
|
if (!n.isPressed) {
|
507
511
|
s.stopPropagation();
|
508
512
|
return;
|
509
513
|
}
|
510
|
-
let
|
511
|
-
|
514
|
+
let b = he(s.nativeEvent, n.activePointerId), i = !0;
|
515
|
+
b && M(b, s.currentTarget) ? !n.isOverTarget && n.pointerType != null && (n.isOverTarget = !0, i = E(K(n.target, s), n.pointerType)) : n.isOverTarget && n.pointerType != null && (n.isOverTarget = !1, i = k(K(n.target, s), n.pointerType, !1), A(K(n.target, s))), i && s.stopPropagation();
|
512
516
|
}, f.onTouchEnd = (s) => {
|
513
517
|
if (!s.currentTarget.contains(s.target)) return;
|
514
518
|
if (!n.isPressed) {
|
515
519
|
s.stopPropagation();
|
516
520
|
return;
|
517
521
|
}
|
518
|
-
let
|
519
|
-
|
522
|
+
let b = he(s.nativeEvent, n.activePointerId), i = !0;
|
523
|
+
b && M(b, s.currentTarget) && n.pointerType != null ? (D(K(n.target, s), n.pointerType), i = k(K(n.target, s), n.pointerType)) : n.isOverTarget && n.pointerType != null && (i = k(K(n.target, s), n.pointerType, !1)), i && s.stopPropagation(), n.isPressed = !1, n.activePointerId = null, n.isOverTarget = !1, n.ignoreEmulatedMouseEvents = !0, n.target && !g && Y(n.target), S();
|
520
524
|
}, f.onTouchCancel = (s) => {
|
521
|
-
s.currentTarget.contains(s.target) && (s.stopPropagation(), n.isPressed && N(
|
525
|
+
s.currentTarget.contains(s.target) && (s.stopPropagation(), n.isPressed && N(K(n.target, s)));
|
522
526
|
};
|
523
|
-
let
|
527
|
+
let h = (s) => {
|
524
528
|
n.isPressed && s.target.contains(n.target) && N({
|
525
529
|
currentTarget: n.target,
|
526
530
|
shiftKey: !1,
|
@@ -535,22 +539,22 @@ function _t(e) {
|
|
535
539
|
}
|
536
540
|
return f;
|
537
541
|
}, [
|
538
|
-
|
542
|
+
T,
|
539
543
|
u,
|
540
544
|
m,
|
541
545
|
S,
|
542
|
-
|
546
|
+
g,
|
543
547
|
N,
|
544
548
|
A,
|
545
549
|
k,
|
546
|
-
|
547
|
-
|
550
|
+
E,
|
551
|
+
D
|
548
552
|
]);
|
549
553
|
return J(() => () => {
|
550
554
|
var n;
|
551
|
-
|
555
|
+
g || Y((n = w.current.target) !== null && n !== void 0 ? n : void 0);
|
552
556
|
}, [
|
553
|
-
|
557
|
+
g
|
554
558
|
]), {
|
555
559
|
isPressed: p || _,
|
556
560
|
pressProps: G(x, oe)
|
@@ -561,7 +565,7 @@ function pe(e) {
|
|
561
565
|
}
|
562
566
|
function re(e, t) {
|
563
567
|
const { key: r, code: o } = e, a = t, d = a.getAttribute("role");
|
564
|
-
return (r === "Enter" || r === " " || r === "Spacebar" || o === "Space") && !(a instanceof ie(a).HTMLInputElement && !
|
568
|
+
return (r === "Enter" || r === " " || r === "Spacebar" || o === "Space") && !(a instanceof ie(a).HTMLInputElement && !Le(a, r) || a instanceof ie(a).HTMLTextAreaElement || a.isContentEditable) && // Links should only trigger with Enter key
|
565
569
|
!((d === "link" || !d && pe(a)) && r !== "Enter");
|
566
570
|
}
|
567
571
|
function bt(e) {
|
@@ -576,7 +580,7 @@ function he(e, t) {
|
|
576
580
|
}
|
577
581
|
return null;
|
578
582
|
}
|
579
|
-
function
|
583
|
+
function K(e, t) {
|
580
584
|
let r = 0, o = 0;
|
581
585
|
return t.targetTouches && t.targetTouches.length === 1 && (r = t.targetTouches[0].clientX, o = t.targetTouches[0].clientY), {
|
582
586
|
currentTarget: e,
|
@@ -588,7 +592,7 @@ function C(e, t) {
|
|
588
592
|
clientY: o
|
589
593
|
};
|
590
594
|
}
|
591
|
-
function
|
595
|
+
function C(e, t) {
|
592
596
|
let r = t.clientX, o = t.clientY;
|
593
597
|
return {
|
594
598
|
currentTarget: e,
|
@@ -600,7 +604,7 @@ function D(e, t) {
|
|
600
604
|
clientY: o
|
601
605
|
};
|
602
606
|
}
|
603
|
-
function
|
607
|
+
function vt(e) {
|
604
608
|
let t = 0, r = 0;
|
605
609
|
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), {
|
606
610
|
top: e.clientY - r,
|
@@ -609,20 +613,23 @@ function gt(e) {
|
|
609
613
|
left: e.clientX - t
|
610
614
|
};
|
611
615
|
}
|
612
|
-
function
|
616
|
+
function ht(e, t) {
|
613
617
|
return !(e.left > t.right || t.left > e.right || e.top > t.bottom || t.top > e.bottom);
|
614
618
|
}
|
615
619
|
function M(e, t) {
|
616
|
-
let r = t.getBoundingClientRect(), o =
|
617
|
-
return
|
620
|
+
let r = t.getBoundingClientRect(), o = vt(e);
|
621
|
+
return ht(r, o);
|
618
622
|
}
|
619
623
|
function se(e) {
|
620
624
|
return !(e instanceof HTMLElement) || !e.hasAttribute("draggable");
|
621
625
|
}
|
626
|
+
function Ie(e) {
|
627
|
+
return e instanceof HTMLInputElement ? !1 : e instanceof HTMLButtonElement ? e.type !== "submit" && e.type !== "reset" : !pe(e);
|
628
|
+
}
|
622
629
|
function ye(e, t) {
|
623
|
-
return e instanceof HTMLInputElement ? !
|
630
|
+
return e instanceof HTMLInputElement ? !Le(e, t) : Ie(e);
|
624
631
|
}
|
625
|
-
const
|
632
|
+
const yt = /* @__PURE__ */ new Set([
|
626
633
|
"checkbox",
|
627
634
|
"radio",
|
628
635
|
"range",
|
@@ -633,8 +640,8 @@ const ht = /* @__PURE__ */ new Set([
|
|
633
640
|
"submit",
|
634
641
|
"reset"
|
635
642
|
]);
|
636
|
-
function
|
637
|
-
return e.type === "checkbox" || e.type === "radio" ? t === " " :
|
643
|
+
function Le(e, t) {
|
644
|
+
return e.type === "checkbox" || e.type === "radio" ? t === " " : yt.has(e.type);
|
638
645
|
}
|
639
646
|
let Z = !1, ae = 0;
|
640
647
|
function ce() {
|
@@ -645,22 +652,22 @@ function ce() {
|
|
645
652
|
function ke(e) {
|
646
653
|
e.pointerType === "touch" && ce();
|
647
654
|
}
|
648
|
-
function
|
655
|
+
function kt() {
|
649
656
|
if (!(typeof document > "u"))
|
650
657
|
return typeof PointerEvent < "u" ? document.addEventListener("pointerup", ke) : document.addEventListener("touchend", ce), ae++, () => {
|
651
658
|
ae--, !(ae > 0) && (typeof PointerEvent < "u" ? document.removeEventListener("pointerup", ke) : document.removeEventListener("touchend", ce));
|
652
659
|
};
|
653
660
|
}
|
654
|
-
function
|
655
|
-
let { onHoverStart: t, onHoverChange: r, onHoverEnd: o, isDisabled: a } = e, [d, u] =
|
661
|
+
function wt(e) {
|
662
|
+
let { onHoverStart: t, onHoverChange: r, onHoverEnd: o, isDisabled: a } = e, [d, u] = Ee(!1), p = ee({
|
656
663
|
isHovered: !1,
|
657
664
|
ignoreEmulatedMouseEvents: !1,
|
658
665
|
pointerType: "",
|
659
666
|
target: null
|
660
667
|
}).current;
|
661
|
-
J(
|
662
|
-
let { hoverProps: m, triggerHoverEnd:
|
663
|
-
let
|
668
|
+
J(kt, []);
|
669
|
+
let { hoverProps: m, triggerHoverEnd: v } = $e(() => {
|
670
|
+
let g = (_, P) => {
|
664
671
|
if (p.pointerType = P, a || P === "touch" || p.isHovered || !_.currentTarget.contains(_.target)) return;
|
665
672
|
p.isHovered = !0;
|
666
673
|
let w = _.currentTarget;
|
@@ -669,7 +676,7 @@ function kt(e) {
|
|
669
676
|
target: w,
|
670
677
|
pointerType: P
|
671
678
|
}), r && r(!0), u(!0);
|
672
|
-
},
|
679
|
+
}, $ = (_, P) => {
|
673
680
|
if (p.pointerType = "", p.target = null, P === "touch" || !p.isHovered) return;
|
674
681
|
p.isHovered = !1;
|
675
682
|
let w = _.currentTarget;
|
@@ -680,18 +687,18 @@ function kt(e) {
|
|
680
687
|
}), r && r(!1), u(!1);
|
681
688
|
}, x = {};
|
682
689
|
return typeof PointerEvent < "u" ? (x.onPointerEnter = (_) => {
|
683
|
-
Z && _.pointerType === "mouse" ||
|
690
|
+
Z && _.pointerType === "mouse" || g(_, _.pointerType);
|
684
691
|
}, x.onPointerLeave = (_) => {
|
685
|
-
!a && _.currentTarget.contains(_.target) &&
|
692
|
+
!a && _.currentTarget.contains(_.target) && $(_, _.pointerType);
|
686
693
|
}) : (x.onTouchStart = () => {
|
687
694
|
p.ignoreEmulatedMouseEvents = !0;
|
688
695
|
}, x.onMouseEnter = (_) => {
|
689
|
-
!p.ignoreEmulatedMouseEvents && !Z &&
|
696
|
+
!p.ignoreEmulatedMouseEvents && !Z && g(_, "mouse"), p.ignoreEmulatedMouseEvents = !1;
|
690
697
|
}, x.onMouseLeave = (_) => {
|
691
|
-
!a && _.currentTarget.contains(_.target) &&
|
698
|
+
!a && _.currentTarget.contains(_.target) && $(_, "mouse");
|
692
699
|
}), {
|
693
700
|
hoverProps: x,
|
694
|
-
triggerHoverEnd:
|
701
|
+
triggerHoverEnd: $
|
695
702
|
};
|
696
703
|
}, [
|
697
704
|
t,
|
@@ -701,7 +708,7 @@ function kt(e) {
|
|
701
708
|
p
|
702
709
|
]);
|
703
710
|
return J(() => {
|
704
|
-
a &&
|
711
|
+
a && v({
|
705
712
|
currentTarget: p.target
|
706
713
|
}, p.pointerType);
|
707
714
|
}, [
|
@@ -711,7 +718,7 @@ function kt(e) {
|
|
711
718
|
isHovered: d
|
712
719
|
};
|
713
720
|
}
|
714
|
-
function
|
721
|
+
function Tt(e, t) {
|
715
722
|
let {
|
716
723
|
elementType: r = "button",
|
717
724
|
isDisabled: o,
|
@@ -720,19 +727,19 @@ function wt(e, t) {
|
|
720
727
|
onPressEnd: u,
|
721
728
|
onPressUp: p,
|
722
729
|
onPressChange: m,
|
723
|
-
preventFocusOnPress:
|
724
|
-
allowFocusWhenDisabled:
|
730
|
+
preventFocusOnPress: v,
|
731
|
+
allowFocusWhenDisabled: g,
|
725
732
|
// @ts-ignore
|
726
|
-
onClick:
|
733
|
+
onClick: $,
|
727
734
|
href: x,
|
728
735
|
target: _,
|
729
736
|
rel: P,
|
730
737
|
type: w = "button"
|
731
|
-
} = e,
|
732
|
-
r === "button" ?
|
738
|
+
} = e, T;
|
739
|
+
r === "button" ? T = {
|
733
740
|
type: w,
|
734
741
|
disabled: o
|
735
|
-
} :
|
742
|
+
} : T = {
|
736
743
|
role: "button",
|
737
744
|
tabIndex: o ? void 0 : 0,
|
738
745
|
href: r === "a" && o ? void 0 : x,
|
@@ -742,34 +749,34 @@ function wt(e, t) {
|
|
742
749
|
"aria-disabled": !o || r === "input" ? void 0 : o,
|
743
750
|
rel: r === "a" ? P : void 0
|
744
751
|
};
|
745
|
-
let { pressProps: S, isPressed:
|
752
|
+
let { pressProps: S, isPressed: E } = gt({
|
746
753
|
onPressStart: d,
|
747
754
|
onPressEnd: u,
|
748
755
|
onPressChange: m,
|
749
756
|
onPress: a,
|
750
757
|
onPressUp: p,
|
751
758
|
isDisabled: o,
|
752
|
-
preventFocusOnPress:
|
759
|
+
preventFocusOnPress: v,
|
753
760
|
ref: t
|
754
|
-
}), { focusableProps: k } =
|
755
|
-
|
756
|
-
let
|
761
|
+
}), { focusableProps: k } = Ve(e, t);
|
762
|
+
g && (k.tabIndex = o ? -1 : k.tabIndex);
|
763
|
+
let D = G(k, S, Qe(e, {
|
757
764
|
labelable: !0
|
758
765
|
}));
|
759
766
|
return {
|
760
|
-
isPressed:
|
761
|
-
buttonProps: G(
|
767
|
+
isPressed: E,
|
768
|
+
buttonProps: G(T, D, {
|
762
769
|
"aria-haspopup": e["aria-haspopup"],
|
763
770
|
"aria-expanded": e["aria-expanded"],
|
764
771
|
"aria-controls": e["aria-controls"],
|
765
772
|
"aria-pressed": e["aria-pressed"],
|
766
773
|
onClick: (N) => {
|
767
|
-
|
774
|
+
$ && ($(N), console.warn("onClick is deprecated, please use onPress"));
|
768
775
|
}
|
769
776
|
})
|
770
777
|
};
|
771
778
|
}
|
772
|
-
function
|
779
|
+
function Bt(e, t, r) {
|
773
780
|
return t in e ? Object.defineProperty(e, t, {
|
774
781
|
value: r,
|
775
782
|
enumerable: !0,
|
@@ -791,14 +798,14 @@ function Te(e) {
|
|
791
798
|
for (var t = 1; t < arguments.length; t++) {
|
792
799
|
var r = arguments[t] != null ? arguments[t] : {};
|
793
800
|
t % 2 ? we(Object(r), !0).forEach(function(o) {
|
794
|
-
|
801
|
+
Bt(e, o, r[o]);
|
795
802
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : we(Object(r)).forEach(function(o) {
|
796
803
|
Object.defineProperty(e, o, Object.getOwnPropertyDescriptor(r, o));
|
797
804
|
});
|
798
805
|
}
|
799
806
|
return e;
|
800
807
|
}
|
801
|
-
var
|
808
|
+
var Et = (e, t, r) => {
|
802
809
|
for (var o of Object.keys(e)) {
|
803
810
|
var a;
|
804
811
|
if (e[o] !== ((a = t[o]) !== null && a !== void 0 ? a : r[o]))
|
@@ -819,11 +826,11 @@ var Bt = (e, t, r) => {
|
|
819
826
|
m && (r += " " + m);
|
820
827
|
}
|
821
828
|
}
|
822
|
-
for (var [
|
823
|
-
|
829
|
+
for (var [v, g] of e.compoundVariants)
|
830
|
+
Et(v, o, e.defaultVariants) && (r += " " + g);
|
824
831
|
return r;
|
825
|
-
}, $t = ne({ defaultClassName: "pkg_sps-
|
826
|
-
function
|
832
|
+
}, $t = ne({ defaultClassName: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxy0", variantClassNames: { disabled: { true: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxy1", false: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxy2" }, kind: { default: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxy3", link: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxy4", confirm: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxy5", delete: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxy6", key: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxy7", icon: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxy8" }, spinning: { true: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxy9", false: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxya" } }, defaultVariants: { disabled: !1, kind: "default", spinning: !1 }, compoundVariants: [[{ kind: "icon", spinning: !0 }, "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyb"], [{ kind: "default", spinning: !0 }, "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyc"], [{ kind: "confirm", spinning: !0 }, "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyd"], [{ kind: "delete", spinning: !0 }, "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxye"], [{ kind: "key", spinning: !0 }, "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyf"], [{ disabled: !0, spinning: !1 }, "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyg"]] }), Pt = ne({ defaultClassName: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyh", variantClassNames: { disabled: { true: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyi", false: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyj" }, kind: { icon: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyk", default: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyl", delete: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxym", key: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyn", confirm: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyo", link: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyp" }, spinning: { true: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyq", false: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyr" } }, defaultVariants: { disabled: !1, kind: "default", spinning: !1 }, compoundVariants: [] }), xt = "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxy11", St = ne({ defaultClassName: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxy12", variantClassNames: { spinning: { true: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxy13", false: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxy14" } }, defaultVariants: { spinning: !1 }, compoundVariants: [] }), Nt = ne({ defaultClassName: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxys", variantClassNames: { spinning: { true: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyt", false: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyu" }, kind: { icon: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyv", default: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyw", delete: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyx", key: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyy", confirm: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxyz", link: "pkg_sps-woodland_buttons__version_8_20_9__hash_125pcxy10" } }, defaultVariants: { spinning: !1 }, compoundVariants: [] });
|
833
|
+
function Dt({
|
827
834
|
as: e,
|
828
835
|
onClick: t,
|
829
836
|
onPress: r,
|
@@ -833,52 +840,52 @@ function Nt({
|
|
833
840
|
disabled: u,
|
834
841
|
href: p,
|
835
842
|
icon: m,
|
836
|
-
kind:
|
837
|
-
spinning:
|
838
|
-
spinningTitle:
|
843
|
+
kind: v = "default",
|
844
|
+
spinning: g,
|
845
|
+
spinningTitle: $,
|
839
846
|
title: x,
|
840
847
|
..._
|
841
848
|
}, P) {
|
842
|
-
const w = e ?? (p ? "a" : "button"),
|
849
|
+
const w = e ?? (p ? "a" : "button"), T = {
|
843
850
|
onPress: r ?? t,
|
844
851
|
// the button element should be disabled if the button is marked as disabled or spinning
|
845
|
-
isDisabled: u ?? d ??
|
852
|
+
isDisabled: u ?? d ?? g,
|
846
853
|
..._
|
847
|
-
}, { "data-testid": S } = _,
|
848
|
-
...G(A,
|
849
|
-
ref:
|
854
|
+
}, { "data-testid": S } = _, E = P || c.useRef(null), { buttonProps: k } = Tt(T, E), { hoverProps: D } = wt({ isDisabled: T.isDisabled }), { type: N, ...A } = k, oe = {
|
855
|
+
...G(A, D),
|
856
|
+
ref: E,
|
850
857
|
title: x,
|
851
|
-
className: p ?
|
858
|
+
className: p ? Nt({ spinning: g, kind: v }) : Pt({ disabled: d || u, kind: v, spinning: g }),
|
852
859
|
...p ? { href: p } : { type: N },
|
853
860
|
..._
|
854
|
-
}, { t: n } = c.useContext(
|
855
|
-
|
861
|
+
}, { t: n } = c.useContext(Ue), f = m && /* @__PURE__ */ c.createElement(
|
862
|
+
Ge,
|
856
863
|
{
|
857
|
-
className:
|
864
|
+
className: xt,
|
858
865
|
icon: m,
|
859
866
|
"aria-hidden": "true",
|
860
867
|
"data-testid": `${S}__${m}-icon`
|
861
868
|
}
|
862
869
|
);
|
863
|
-
let
|
864
|
-
|
865
|
-
const l =
|
866
|
-
|
870
|
+
let B;
|
871
|
+
v === "default" || v === "icon" || v === "link" ? B = "dark" : B = "light";
|
872
|
+
const l = g && /* @__PURE__ */ c.createElement(
|
873
|
+
He,
|
867
874
|
{
|
868
|
-
color:
|
869
|
-
className:
|
870
|
-
title:
|
875
|
+
color: B,
|
876
|
+
className: St({ spinning: g }),
|
877
|
+
title: $ || n("design-system:button.spinningTitle"),
|
871
878
|
"data-testid": `${S}__spinner`
|
872
879
|
}
|
873
880
|
);
|
874
|
-
return /* @__PURE__ */ c.createElement(
|
881
|
+
return /* @__PURE__ */ c.createElement(We, null, /* @__PURE__ */ c.createElement(
|
875
882
|
"div",
|
876
883
|
{
|
877
|
-
className:
|
884
|
+
className: Re(
|
878
885
|
$t({
|
879
886
|
disabled: d || u,
|
880
|
-
kind:
|
881
|
-
spinning:
|
887
|
+
kind: v,
|
888
|
+
spinning: g
|
882
889
|
}),
|
883
890
|
a
|
884
891
|
)
|
@@ -886,8 +893,8 @@ function Nt({
|
|
886
893
|
/* @__PURE__ */ c.createElement(w, { ...oe }, f, o ? /* @__PURE__ */ c.createElement("span", null, o) : "", l)
|
887
894
|
));
|
888
895
|
}
|
889
|
-
const Ae = c.forwardRef(
|
890
|
-
|
896
|
+
const Ae = c.forwardRef(Dt);
|
897
|
+
Fe.set(Ae, {
|
891
898
|
name: "Button",
|
892
899
|
props: {
|
893
900
|
disabled: "boolean",
|
@@ -913,7 +920,7 @@ const Ot = {
|
|
913
920
|
examples: {
|
914
921
|
withoutIcons: {
|
915
922
|
description: "Without Icons",
|
916
|
-
react:
|
923
|
+
react: y`
|
917
924
|
import { Button } from "@sps-woodland/buttons";
|
918
925
|
import { sprinkles } from "@sps-woodland/tokens";
|
919
926
|
|
@@ -932,7 +939,7 @@ const Ot = {
|
|
932
939
|
},
|
933
940
|
withIcons: {
|
934
941
|
description: "With Icons",
|
935
|
-
react:
|
942
|
+
react: y`
|
936
943
|
import { Button } from "@sps-woodland/buttons";
|
937
944
|
import { sprinkles } from "@sps-woodland/tokens";
|
938
945
|
|
@@ -951,7 +958,7 @@ const Ot = {
|
|
951
958
|
},
|
952
959
|
spinning: {
|
953
960
|
description: "Spinning",
|
954
|
-
react:
|
961
|
+
react: y`
|
955
962
|
import { Button } from "@sps-woodland/buttons";
|
956
963
|
import { sprinkles } from "@sps-woodland/tokens";
|
957
964
|
|
@@ -975,7 +982,7 @@ const Ot = {
|
|
975
982
|
examples: {
|
976
983
|
withoutIcons: {
|
977
984
|
description: "Without Icons",
|
978
|
-
react:
|
985
|
+
react: y`
|
979
986
|
import { SpsDropdown } from "@spscommerce/ds-react";
|
980
987
|
|
981
988
|
function Component() {
|
@@ -1017,7 +1024,7 @@ const Ot = {
|
|
1017
1024
|
},
|
1018
1025
|
withIcons: {
|
1019
1026
|
description: "With Icons",
|
1020
|
-
react:
|
1027
|
+
react: y`
|
1021
1028
|
import { SpsDropdown } from "@spscommerce/ds-react";
|
1022
1029
|
|
1023
1030
|
function Component() {
|
@@ -1064,7 +1071,7 @@ const Ot = {
|
|
1064
1071
|
},
|
1065
1072
|
spinning: {
|
1066
1073
|
description: "Spinning",
|
1067
|
-
react:
|
1074
|
+
react: y`
|
1068
1075
|
import { SpsDropdown } from "@spscommerce/ds-react";
|
1069
1076
|
|
1070
1077
|
function Component() {
|
@@ -1110,7 +1117,7 @@ const Ot = {
|
|
1110
1117
|
examples: {
|
1111
1118
|
withoutIcons: {
|
1112
1119
|
description: "Without Icons",
|
1113
|
-
react:
|
1120
|
+
react: y`
|
1114
1121
|
import { SpsSplitButton } from "@spscommerce/ds-react";
|
1115
1122
|
|
1116
1123
|
function Component() {
|
@@ -1140,7 +1147,7 @@ const Ot = {
|
|
1140
1147
|
},
|
1141
1148
|
withIcons: {
|
1142
1149
|
description: "With Icons",
|
1143
|
-
react:
|
1150
|
+
react: y`
|
1144
1151
|
import { SpsSplitButton } from "@spscommerce/ds-react";
|
1145
1152
|
|
1146
1153
|
function Component() {
|
@@ -1188,7 +1195,7 @@ const Ot = {
|
|
1188
1195
|
examples: {
|
1189
1196
|
standard: {
|
1190
1197
|
description: "Standard Icon Buttons",
|
1191
|
-
react:
|
1198
|
+
react: y`
|
1192
1199
|
import { Button } from "@sps-woodland/buttons";
|
1193
1200
|
import { sprinkles } from "@sps-woodland/tokens";
|
1194
1201
|
|
@@ -1211,7 +1218,7 @@ const Ot = {
|
|
1211
1218
|
},
|
1212
1219
|
dropdown: {
|
1213
1220
|
description: ({ NavigateTo: e }) => /* @__PURE__ */ c.createElement(c.Fragment, null, /* @__PURE__ */ c.createElement("h5", null, "Dropdown Icon Buttons"), /* @__PURE__ */ c.createElement("p", null, "Use these when there are several options available for action. Example: Dropdown Icon Button in a ", /* @__PURE__ */ c.createElement(e, { to: "content-rows" }, "Content Row"), ".")),
|
1214
|
-
react:
|
1221
|
+
react: y`
|
1215
1222
|
import { SpsDropdown } from "@spscommerce/ds-react";
|
1216
1223
|
|
1217
1224
|
function Component() {
|
@@ -1229,7 +1236,7 @@ const Ot = {
|
|
1229
1236
|
},
|
1230
1237
|
spinner: {
|
1231
1238
|
description: "Spinner",
|
1232
|
-
react:
|
1239
|
+
react: y`
|
1233
1240
|
import { Button } from "@sps-woodland/buttons";
|
1234
1241
|
|
1235
1242
|
function Component() {
|
@@ -1249,7 +1256,7 @@ const Ot = {
|
|
1249
1256
|
examples: {
|
1250
1257
|
withoutIcons: {
|
1251
1258
|
description: "Without Icons",
|
1252
|
-
react:
|
1259
|
+
react: y`
|
1253
1260
|
import { Button } from "@sps-woodland/buttons";
|
1254
1261
|
import { sprinkles } from "@sps-woodland/tokens";
|
1255
1262
|
|
@@ -1266,7 +1273,7 @@ const Ot = {
|
|
1266
1273
|
},
|
1267
1274
|
withIcons: {
|
1268
1275
|
description: "With Icons",
|
1269
|
-
react:
|
1276
|
+
react: y`
|
1270
1277
|
import { Button } from "@sps-woodland/buttons";
|
1271
1278
|
import { sprinkles } from "@sps-woodland/tokens";
|
1272
1279
|
|
@@ -1283,7 +1290,7 @@ const Ot = {
|
|
1283
1290
|
},
|
1284
1291
|
spinner: {
|
1285
1292
|
description: "Spinner",
|
1286
|
-
react:
|
1293
|
+
react: y`
|
1287
1294
|
import { Button } from "@sps-woodland/buttons";
|
1288
1295
|
|
1289
1296
|
function Component() {
|
@@ -1302,7 +1309,7 @@ const Ot = {
|
|
1302
1309
|
description: ({ NavigateTo: e }) => /* @__PURE__ */ c.createElement("p", null, "Use to submit a form. There can be a number of visual variations, for example a", " ", /* @__PURE__ */ c.createElement(e, { to: "modals" }, "Modal"), " uses Basic Button (Key) as its Submit Button."),
|
1303
1310
|
examples: {
|
1304
1311
|
basic: {
|
1305
|
-
react:
|
1312
|
+
react: y`
|
1306
1313
|
import { Button } from "@sps-woodland/buttons";
|
1307
1314
|
import { sprinkles } from "@sps-woodland/tokens";
|
1308
1315
|
|
@@ -1330,7 +1337,7 @@ const Ot = {
|
|
1330
1337
|
description: "Used to link to another page, such as an external website. They may open in the same window or in a new one. It should only be used when a Text Button doesn't provide enough visual emphasis.",
|
1331
1338
|
examples: {
|
1332
1339
|
basic: {
|
1333
|
-
react:
|
1340
|
+
react: y`
|
1334
1341
|
import { Button } from "@sps-woodland/buttons";
|
1335
1342
|
|
1336
1343
|
function Component() {
|
@@ -1352,7 +1359,7 @@ const Ot = {
|
|
1352
1359
|
examples: {
|
1353
1360
|
basic: {
|
1354
1361
|
description: "Basic Button Groups",
|
1355
|
-
react:
|
1362
|
+
react: y`
|
1356
1363
|
import { Button } from "@sps-woodland/buttons";
|
1357
1364
|
import { sprinkles } from "@sps-woodland/tokens";
|
1358
1365
|
|
@@ -1368,7 +1375,7 @@ const Ot = {
|
|
1368
1375
|
},
|
1369
1376
|
icon: {
|
1370
1377
|
description: "Icon Button Groups",
|
1371
|
-
react:
|
1378
|
+
react: y`
|
1372
1379
|
import { Button } from "@sps-woodland/buttons";
|
1373
1380
|
|
1374
1381
|
function Component() {
|
@@ -1383,7 +1390,7 @@ const Ot = {
|
|
1383
1390
|
},
|
1384
1391
|
textAndIcons: {
|
1385
1392
|
description: "Text Buttons + Icon Buttons Group",
|
1386
|
-
react:
|
1393
|
+
react: y`
|
1387
1394
|
import { Button } from "@sps-woodland/buttons";
|
1388
1395
|
import { sprinkles } from "@sps-woodland/tokens";
|
1389
1396
|
import { VericalRule } from "@sps-woodland/core";
|
@@ -1402,7 +1409,7 @@ const Ot = {
|
|
1402
1409
|
},
|
1403
1410
|
textAndBasic: {
|
1404
1411
|
description: "Text Buttons + Basic Buttons Group",
|
1405
|
-
react:
|
1412
|
+
react: y`
|
1406
1413
|
import { Button } from "@sps-woodland/buttons";
|
1407
1414
|
import { sprinkles } from "@sps-woodland/tokens";
|
1408
1415
|
import { VericalRule } from "@sps-woodland/core";
|
@@ -1422,7 +1429,7 @@ const Ot = {
|
|
1422
1429
|
},
|
1423
1430
|
iconsAndBasic: {
|
1424
1431
|
description: "Icon Buttons + Basic Buttons Group",
|
1425
|
-
react:
|
1432
|
+
react: y`
|
1426
1433
|
import { Button } from "@sps-woodland/buttons";
|
1427
1434
|
import { sprinkles } from "@sps-woodland/tokens";
|
1428
1435
|
import { VericalRule } from "@sps-woodland/core";
|
@@ -1443,7 +1450,7 @@ const Ot = {
|
|
1443
1450
|
},
|
1444
1451
|
textIconsAndBasic: {
|
1445
1452
|
description: "Text Buttons + Icon Buttons + Basic Buttons Group",
|
1446
|
-
react:
|
1453
|
+
react: y`
|
1447
1454
|
import { Button } from "@sps-woodland/buttons";
|
1448
1455
|
import { sprinkles } from "@sps-woodland/tokens";
|
1449
1456
|
import { VericalRule } from "@sps-woodland/core";
|