@sps-woodland/buttons 8.34.16 → 8.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +244 -264
- package/lib/index.umd.cjs +80 -100
- package/lib/style.css +1 -1
- package/package.json +7 -7
package/lib/index.js
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
import * as d from "react";
|
2
|
-
import
|
2
|
+
import $e, { useRef as ee, useCallback as z, useEffect as J, useState as Pe, useMemo as Be, useContext as Me } from "react";
|
3
3
|
import { Spinner as Fe, cl as Ue, Metadata as He, Icon as Re } from "@sps-woodland/core";
|
4
4
|
import { useFocusable as Ve, FocusRing as Ge } from "@react-aria/focus";
|
5
5
|
import { useWoodlandLanguage as We } from "@spscommerce/i18n";
|
6
6
|
import { code as y } from "@spscommerce/utils";
|
7
|
-
const
|
7
|
+
const Ee = typeof document < "u" ? $e.useLayoutEffect : () => {
|
8
8
|
};
|
9
9
|
function H(e) {
|
10
10
|
const t = ee(null);
|
11
|
-
return
|
11
|
+
return Ee(() => {
|
12
12
|
t.current = e;
|
13
13
|
}, [
|
14
14
|
e
|
@@ -26,26 +26,26 @@ function Ye(e, t) {
|
|
26
26
|
let o = fe.get(t);
|
27
27
|
return o ? (o.forEach((i) => i(e)), e) : t;
|
28
28
|
}
|
29
|
-
function
|
29
|
+
function Oe(...e) {
|
30
30
|
return (...t) => {
|
31
31
|
for (let r of e) typeof r == "function" && r(...t);
|
32
32
|
};
|
33
33
|
}
|
34
|
-
const
|
34
|
+
const A = (e) => {
|
35
35
|
var t;
|
36
36
|
return (t = e?.ownerDocument) !== null && t !== void 0 ? t : document;
|
37
|
-
}, ae = (e) => e && "window" in e && e.window === e ? e :
|
38
|
-
function
|
37
|
+
}, ae = (e) => e && "window" in e && e.window === e ? e : A(e).defaultView || window;
|
38
|
+
function xe(e) {
|
39
39
|
var t, r, o = "";
|
40
40
|
if (typeof e == "string" || typeof e == "number") o += e;
|
41
41
|
else if (typeof e == "object") if (Array.isArray(e)) {
|
42
42
|
var i = e.length;
|
43
|
-
for (t = 0; t < i; t++) e[t] && (r =
|
43
|
+
for (t = 0; t < i; t++) e[t] && (r = xe(e[t])) && (o && (o += " "), o += r);
|
44
44
|
} else for (r in e) e[r] && (o && (o += " "), o += r);
|
45
45
|
return o;
|
46
46
|
}
|
47
47
|
function je() {
|
48
|
-
for (var e, t, r = 0, o = "", i = arguments.length; r < i; r++) (e = arguments[r]) && (t =
|
48
|
+
for (var e, t, r = 0, o = "", i = arguments.length; r < i; r++) (e = arguments[r]) && (t = xe(e)) && (o && (o += " "), o += t);
|
49
49
|
return o;
|
50
50
|
}
|
51
51
|
function V(...e) {
|
@@ -59,7 +59,7 @@ function V(...e) {
|
|
59
59
|
typeof c == "function" && typeof u == "function" && // This is a lot faster than a regex.
|
60
60
|
i[0] === "o" && i[1] === "n" && i.charCodeAt(2) >= /* 'A' */
|
61
61
|
65 && i.charCodeAt(2) <= /* 'Z' */
|
62
|
-
90 ? t[i] =
|
62
|
+
90 ? t[i] = Oe(c, u) : (i === "className" || i === "UNSAFE_className") && typeof c == "string" && typeof u == "string" ? t[i] = je(c, u) : i === "id" && c && u ? t.id = Ye(c, u) : t[i] = u !== void 0 ? u : c;
|
63
63
|
}
|
64
64
|
}
|
65
65
|
return t;
|
@@ -135,33 +135,33 @@ function pe(e) {
|
|
135
135
|
var t;
|
136
136
|
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;
|
137
137
|
}
|
138
|
-
function
|
138
|
+
function K(e) {
|
139
139
|
let t = null;
|
140
140
|
return () => (t == null && (t = e()), t);
|
141
141
|
}
|
142
|
-
const Q =
|
142
|
+
const Q = K(function() {
|
143
143
|
return pe(/^Mac/i);
|
144
|
-
}), nt =
|
144
|
+
}), nt = K(function() {
|
145
145
|
return pe(/^iPhone/i);
|
146
|
-
}),
|
146
|
+
}), Se = K(function() {
|
147
147
|
return pe(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
148
148
|
Q() && navigator.maxTouchPoints > 1;
|
149
|
-
}),
|
150
|
-
return nt() ||
|
151
|
-
}), ot =
|
149
|
+
}), De = K(function() {
|
150
|
+
return nt() || Se();
|
151
|
+
}), ot = K(function() {
|
152
152
|
return te(/AppleWebKit/i) && !rt();
|
153
|
-
}), rt =
|
153
|
+
}), rt = K(function() {
|
154
154
|
return te(/Chrome/i);
|
155
|
-
}),
|
155
|
+
}), Ne = K(function() {
|
156
156
|
return te(/Android/i);
|
157
|
-
}), st =
|
157
|
+
}), st = K(function() {
|
158
158
|
return te(/Firefox/i);
|
159
159
|
});
|
160
160
|
function G(e, t, r = !0) {
|
161
161
|
var o, i;
|
162
162
|
let { metaKey: c, ctrlKey: u, altKey: p, shiftKey: m } = t;
|
163
163
|
st() && (!((i = window.event) === null || i === void 0 || (o = i.type) === null || o === void 0) && o.startsWith("key")) && e.target === "_blank" && (Q() ? c = !0 : u = !0);
|
164
|
-
let v = ot() && Q() && !
|
164
|
+
let v = ot() && Q() && !Se() ? new KeyboardEvent("keydown", {
|
165
165
|
keyIdentifier: "Enter",
|
166
166
|
metaKey: c,
|
167
167
|
ctrlKey: u,
|
@@ -237,7 +237,7 @@ function at() {
|
|
237
237
|
};
|
238
238
|
}
|
239
239
|
function lt(e, t) {
|
240
|
-
|
240
|
+
Ee(() => {
|
241
241
|
if (e && e.ref && t)
|
242
242
|
return e.ref.current = t.current, () => {
|
243
243
|
e.ref && (e.ref.current = null);
|
@@ -245,28 +245,28 @@ function lt(e, t) {
|
|
245
245
|
});
|
246
246
|
}
|
247
247
|
function _e(e) {
|
248
|
-
return e.mozInputSource === 0 && e.isTrusted ? !0 :
|
248
|
+
return e.mozInputSource === 0 && e.isTrusted ? !0 : Ne() && e.pointerType ? e.type === "click" && e.buttons === 1 : e.detail === 0 && !e.pointerType;
|
249
249
|
}
|
250
250
|
function ut(e) {
|
251
|
-
return !
|
251
|
+
return !Ne() && e.width === 0 && e.height === 0 || e.width === 1 && e.height === 1 && e.pressure === 0 && e.detail === 0 && e.pointerType === "mouse";
|
252
252
|
}
|
253
253
|
let U = "default", ue = "", q = /* @__PURE__ */ new WeakMap();
|
254
|
-
function
|
255
|
-
if (
|
254
|
+
function ge(e) {
|
255
|
+
if (De()) {
|
256
256
|
if (U === "default") {
|
257
|
-
const t =
|
257
|
+
const t = A(e);
|
258
258
|
ue = t.documentElement.style.webkitUserSelect, t.documentElement.style.webkitUserSelect = "none";
|
259
259
|
}
|
260
260
|
U = "disabled";
|
261
261
|
} else (e instanceof HTMLElement || e instanceof SVGElement) && (q.set(e, e.style.userSelect), e.style.userSelect = "none");
|
262
262
|
}
|
263
263
|
function Y(e) {
|
264
|
-
if (
|
264
|
+
if (De()) {
|
265
265
|
if (U !== "disabled") return;
|
266
266
|
U = "restoring", setTimeout(() => {
|
267
267
|
it(() => {
|
268
268
|
if (U === "restoring") {
|
269
|
-
const t =
|
269
|
+
const t = A(e);
|
270
270
|
t.documentElement.style.webkitUserSelect === "none" && (t.documentElement.style.webkitUserSelect = ue || ""), ue = "", U = "default";
|
271
271
|
}
|
272
272
|
});
|
@@ -276,7 +276,7 @@ function Y(e) {
|
|
276
276
|
e.style.userSelect === "none" && (e.style.userSelect = t), e.getAttribute("style") === "" && e.removeAttribute("style"), q.delete(e);
|
277
277
|
}
|
278
278
|
}
|
279
|
-
const Ce =
|
279
|
+
const Ce = $e.createContext({
|
280
280
|
register: () => {
|
281
281
|
}
|
282
282
|
});
|
@@ -284,12 +284,12 @@ Ce.displayName = "PressResponderContext";
|
|
284
284
|
function ct(e, t) {
|
285
285
|
return t.get ? t.get.call(e) : t.value;
|
286
286
|
}
|
287
|
-
function
|
287
|
+
function Le(e, t, r) {
|
288
288
|
if (!t.has(e)) throw new TypeError("attempted to " + r + " private field on non-instance");
|
289
289
|
return t.get(e);
|
290
290
|
}
|
291
291
|
function pt(e, t) {
|
292
|
-
var r =
|
292
|
+
var r = Le(e, t, "get");
|
293
293
|
return ct(e, r);
|
294
294
|
}
|
295
295
|
function dt(e, t) {
|
@@ -307,8 +307,8 @@ function mt(e, t, r) {
|
|
307
307
|
t.value = r;
|
308
308
|
}
|
309
309
|
}
|
310
|
-
function
|
311
|
-
var o =
|
310
|
+
function be(e, t, r) {
|
311
|
+
var o = Le(e, t, "set");
|
312
312
|
return mt(e, o, r), r;
|
313
313
|
}
|
314
314
|
function _t(e) {
|
@@ -322,7 +322,7 @@ function _t(e) {
|
|
322
322
|
var j = /* @__PURE__ */ new WeakMap();
|
323
323
|
class X {
|
324
324
|
continuePropagation() {
|
325
|
-
|
325
|
+
be(this, j, !1);
|
326
326
|
}
|
327
327
|
get shouldStopPropagation() {
|
328
328
|
return pt(this, j);
|
@@ -331,16 +331,16 @@ class X {
|
|
331
331
|
ft(this, j, {
|
332
332
|
writable: !0,
|
333
333
|
value: void 0
|
334
|
-
}),
|
334
|
+
}), be(this, j, !0);
|
335
335
|
var c;
|
336
336
|
let u = (c = i?.target) !== null && c !== void 0 ? c : o.currentTarget;
|
337
337
|
const p = u?.getBoundingClientRect();
|
338
|
-
let m, v = 0,
|
339
|
-
o.clientX != null && o.clientY != null && (
|
338
|
+
let m, v = 0, g, $ = null;
|
339
|
+
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;
|
340
340
|
}
|
341
341
|
}
|
342
342
|
const ve = Symbol("linkClicked");
|
343
|
-
function
|
343
|
+
function gt(e) {
|
344
344
|
let {
|
345
345
|
onPress: t,
|
346
346
|
onPressChange: r,
|
@@ -351,11 +351,11 @@ function bt(e) {
|
|
351
351
|
isPressed: p,
|
352
352
|
preventFocusOnPress: m,
|
353
353
|
shouldCancelOnPointerExit: v,
|
354
|
-
allowTextSelectionOnPress:
|
354
|
+
allowTextSelectionOnPress: g,
|
355
355
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
356
|
-
ref:
|
357
|
-
...
|
358
|
-
} = _t(e), [_,
|
356
|
+
ref: $,
|
357
|
+
...O
|
358
|
+
} = _t(e), [_, P] = Pe(!1), w = ee({
|
359
359
|
isPressed: !1,
|
360
360
|
ignoreEmulatedMouseEvents: !1,
|
361
361
|
ignoreClickAfterPress: !1,
|
@@ -365,16 +365,16 @@ function bt(e) {
|
|
365
365
|
target: null,
|
366
366
|
isOverTarget: !1,
|
367
367
|
pointerType: null
|
368
|
-
}), { addGlobalListener: T, removeAllGlobalListeners:
|
369
|
-
let
|
370
|
-
if (u ||
|
368
|
+
}), { addGlobalListener: T, removeAllGlobalListeners: x } = at(), B = H((n, f) => {
|
369
|
+
let E = w.current;
|
370
|
+
if (u || E.didFirePressStart) return !1;
|
371
371
|
let l = !0;
|
372
|
-
if (
|
372
|
+
if (E.isTriggeringEvent = !0, o) {
|
373
373
|
let h = new X("pressstart", f, n);
|
374
374
|
o(h), l = h.shouldStopPropagation;
|
375
375
|
}
|
376
|
-
return r && r(!0),
|
377
|
-
}), k = H((n, f,
|
376
|
+
return r && r(!0), E.isTriggeringEvent = !1, E.didFirePressStart = !0, P(!0), l;
|
377
|
+
}), k = H((n, f, E = !0) => {
|
378
378
|
let l = w.current;
|
379
379
|
if (!l.didFirePressStart) return !1;
|
380
380
|
l.ignoreClickAfterPress = !0, l.didFirePressStart = !1, l.isTriggeringEvent = !0;
|
@@ -383,25 +383,25 @@ function bt(e) {
|
|
383
383
|
let s = new X("pressend", f, n);
|
384
384
|
i(s), h = s.shouldStopPropagation;
|
385
385
|
}
|
386
|
-
if (r && r(!1),
|
386
|
+
if (r && r(!1), P(!1), t && E && !u) {
|
387
387
|
let s = new X("press", f, n);
|
388
388
|
t(s), h && (h = s.shouldStopPropagation);
|
389
389
|
}
|
390
390
|
return l.isTriggeringEvent = !1, h;
|
391
|
-
}),
|
392
|
-
let
|
391
|
+
}), D = H((n, f) => {
|
392
|
+
let E = w.current;
|
393
393
|
if (u) return !1;
|
394
394
|
if (c) {
|
395
|
-
|
395
|
+
E.isTriggeringEvent = !0;
|
396
396
|
let l = new X("pressup", f, n);
|
397
|
-
return c(l),
|
397
|
+
return c(l), E.isTriggeringEvent = !1, l.shouldStopPropagation;
|
398
398
|
}
|
399
399
|
return !0;
|
400
|
-
}),
|
400
|
+
}), S = H((n) => {
|
401
401
|
let f = w.current;
|
402
|
-
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,
|
403
|
-
}),
|
404
|
-
v &&
|
402
|
+
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, x(), g || Y(f.target));
|
403
|
+
}), I = H((n) => {
|
404
|
+
v && S(n);
|
405
405
|
}), oe = Be(() => {
|
406
406
|
let n = w.current, f = {
|
407
407
|
onKeyDown(l) {
|
@@ -411,10 +411,10 @@ function bt(e) {
|
|
411
411
|
let s = !0;
|
412
412
|
if (!n.isPressed && !l.repeat) {
|
413
413
|
n.target = l.currentTarget, n.isPressed = !0, s = B(l, "keyboard");
|
414
|
-
let
|
415
|
-
re(
|
414
|
+
let b = l.currentTarget, a = (N) => {
|
415
|
+
re(N, b) && !N.repeat && b.contains(N.target) && n.target && D(C(n.target, N), "keyboard");
|
416
416
|
};
|
417
|
-
T(
|
417
|
+
T(A(l.currentTarget), "keyup", Oe(a, E), !0);
|
418
418
|
}
|
419
419
|
s && l.stopPropagation(), l.metaKey && Q() && ((h = n.metaKeyEvents) === null || h === void 0 || h.set(l.key, l.nativeEvent));
|
420
420
|
} else l.key === "Meta" && (n.metaKeyEvents = /* @__PURE__ */ new Map());
|
@@ -424,24 +424,24 @@ function bt(e) {
|
|
424
424
|
let h = !0;
|
425
425
|
if (u && l.preventDefault(), !n.ignoreClickAfterPress && !n.ignoreEmulatedMouseEvents && !n.isPressed && (n.pointerType === "virtual" || _e(l.nativeEvent))) {
|
426
426
|
!u && !m && R(l.currentTarget);
|
427
|
-
let s = B(l, "virtual"),
|
428
|
-
h = s &&
|
427
|
+
let s = B(l, "virtual"), b = D(l, "virtual"), a = k(l, "virtual");
|
428
|
+
h = s && b && a;
|
429
429
|
}
|
430
430
|
n.ignoreEmulatedMouseEvents = !1, n.ignoreClickAfterPress = !1, h && l.stopPropagation();
|
431
431
|
}
|
432
432
|
}
|
433
|
-
},
|
433
|
+
}, E = (l) => {
|
434
434
|
var h;
|
435
435
|
if (n.isPressed && n.target && re(l, n.target)) {
|
436
436
|
var s;
|
437
437
|
ye(l.target, l.key) && l.preventDefault();
|
438
438
|
let a = l.target;
|
439
|
-
k(C(n.target, l), "keyboard", n.target.contains(a)),
|
439
|
+
k(C(n.target, l), "keyboard", n.target.contains(a)), x(), l.key !== "Enter" && de(n.target) && n.target.contains(a) && !l[ve] && (l[ve] = !0, G(n.target, l, !1)), n.isPressed = !1, (s = n.metaKeyEvents) === null || s === void 0 || s.delete(l.key);
|
440
440
|
} else if (l.key === "Meta" && (!((h = n.metaKeyEvents) === null || h === void 0) && h.size)) {
|
441
|
-
var
|
441
|
+
var b;
|
442
442
|
let a = n.metaKeyEvents;
|
443
443
|
n.metaKeyEvents = void 0;
|
444
|
-
for (let
|
444
|
+
for (let N of a.values()) (b = n.target) === null || b === void 0 || b.dispatchEvent(new KeyboardEvent("keyup", N));
|
445
445
|
}
|
446
446
|
};
|
447
447
|
if (typeof PointerEvent < "u") {
|
@@ -452,26 +452,26 @@ function bt(e) {
|
|
452
452
|
return;
|
453
453
|
}
|
454
454
|
se(a.currentTarget) && a.preventDefault(), n.pointerType = a.pointerType;
|
455
|
-
let
|
456
|
-
n.isPressed || (n.isPressed = !0, n.isOverTarget = !0, n.activePointerId = a.pointerId, n.target = a.currentTarget, !u && !m && R(a.currentTarget),
|
455
|
+
let N = !0;
|
456
|
+
n.isPressed || (n.isPressed = !0, n.isOverTarget = !0, n.activePointerId = a.pointerId, n.target = a.currentTarget, !u && !m && R(a.currentTarget), g || ge(n.target), N = B(a, n.pointerType), T(A(a.currentTarget), "pointermove", l, !1), T(A(a.currentTarget), "pointerup", h, !1), T(A(a.currentTarget), "pointercancel", b, !1)), N && a.stopPropagation();
|
457
457
|
}, f.onMouseDown = (a) => {
|
458
458
|
a.currentTarget.contains(a.target) && a.button === 0 && (se(a.currentTarget) && a.preventDefault(), a.stopPropagation());
|
459
459
|
}, f.onPointerUp = (a) => {
|
460
|
-
!a.currentTarget.contains(a.target) || n.pointerType === "virtual" || a.button === 0 && M(a, a.currentTarget) &&
|
460
|
+
!a.currentTarget.contains(a.target) || n.pointerType === "virtual" || a.button === 0 && M(a, a.currentTarget) && D(a, n.pointerType || a.pointerType);
|
461
461
|
};
|
462
462
|
let l = (a) => {
|
463
|
-
a.pointerId === n.activePointerId && (n.target && M(a, n.target) ? !n.isOverTarget && n.pointerType != null && (n.isOverTarget = !0, B(C(n.target, a), n.pointerType)) : n.target && n.isOverTarget && n.pointerType != null && (n.isOverTarget = !1, k(C(n.target, a), n.pointerType, !1),
|
463
|
+
a.pointerId === n.activePointerId && (n.target && M(a, n.target) ? !n.isOverTarget && n.pointerType != null && (n.isOverTarget = !0, B(C(n.target, a), n.pointerType)) : n.target && n.isOverTarget && n.pointerType != null && (n.isOverTarget = !1, k(C(n.target, a), n.pointerType, !1), I(a)));
|
464
464
|
}, h = (a) => {
|
465
|
-
a.pointerId === n.activePointerId && n.isPressed && a.button === 0 && n.target && (M(a, n.target) && n.pointerType != null ? k(C(n.target, a), n.pointerType) : n.isOverTarget && n.pointerType != null && k(C(n.target, a), n.pointerType, !1), n.isPressed = !1, n.isOverTarget = !1, n.activePointerId = null, n.pointerType = null,
|
465
|
+
a.pointerId === n.activePointerId && n.isPressed && a.button === 0 && n.target && (M(a, n.target) && n.pointerType != null ? k(C(n.target, a), n.pointerType) : n.isOverTarget && n.pointerType != null && k(C(n.target, a), n.pointerType, !1), n.isPressed = !1, n.isOverTarget = !1, n.activePointerId = null, n.pointerType = null, x(), g || Y(n.target), "ontouchend" in n.target && a.pointerType !== "mouse" && T(n.target, "touchend", s, {
|
466
466
|
once: !0
|
467
467
|
}));
|
468
468
|
}, s = (a) => {
|
469
|
-
|
470
|
-
},
|
471
|
-
|
469
|
+
Ae(a.target) && a.preventDefault();
|
470
|
+
}, b = (a) => {
|
471
|
+
S(a);
|
472
472
|
};
|
473
473
|
f.onDragStart = (a) => {
|
474
|
-
a.currentTarget.contains(a.target) &&
|
474
|
+
a.currentTarget.contains(a.target) && S(a);
|
475
475
|
};
|
476
476
|
} else {
|
477
477
|
f.onMouseDown = (s) => {
|
@@ -480,21 +480,21 @@ function bt(e) {
|
|
480
480
|
s.stopPropagation();
|
481
481
|
return;
|
482
482
|
}
|
483
|
-
n.isPressed = !0, n.isOverTarget = !0, n.target = s.currentTarget, n.pointerType = _e(s.nativeEvent) ? "virtual" : "mouse", !u && !m && R(s.currentTarget), B(s, n.pointerType) && s.stopPropagation(), T(
|
483
|
+
n.isPressed = !0, n.isOverTarget = !0, n.target = s.currentTarget, n.pointerType = _e(s.nativeEvent) ? "virtual" : "mouse", !u && !m && R(s.currentTarget), B(s, n.pointerType) && s.stopPropagation(), T(A(s.currentTarget), "mouseup", l, !1);
|
484
484
|
}, f.onMouseEnter = (s) => {
|
485
485
|
if (!s.currentTarget.contains(s.target)) return;
|
486
|
-
let
|
487
|
-
n.isPressed && !n.ignoreEmulatedMouseEvents && n.pointerType != null && (n.isOverTarget = !0,
|
486
|
+
let b = !0;
|
487
|
+
n.isPressed && !n.ignoreEmulatedMouseEvents && n.pointerType != null && (n.isOverTarget = !0, b = B(s, n.pointerType)), b && s.stopPropagation();
|
488
488
|
}, f.onMouseLeave = (s) => {
|
489
489
|
if (!s.currentTarget.contains(s.target)) return;
|
490
|
-
let
|
491
|
-
n.isPressed && !n.ignoreEmulatedMouseEvents && n.pointerType != null && (n.isOverTarget = !1,
|
490
|
+
let b = !0;
|
491
|
+
n.isPressed && !n.ignoreEmulatedMouseEvents && n.pointerType != null && (n.isOverTarget = !1, b = k(s, n.pointerType, !1), I(s)), b && s.stopPropagation();
|
492
492
|
}, f.onMouseUp = (s) => {
|
493
|
-
s.currentTarget.contains(s.target) && !n.ignoreEmulatedMouseEvents && s.button === 0 &&
|
493
|
+
s.currentTarget.contains(s.target) && !n.ignoreEmulatedMouseEvents && s.button === 0 && D(s, n.pointerType || "mouse");
|
494
494
|
};
|
495
495
|
let l = (s) => {
|
496
496
|
if (s.button === 0) {
|
497
|
-
if (n.isPressed = !1,
|
497
|
+
if (n.isPressed = !1, x(), n.ignoreEmulatedMouseEvents) {
|
498
498
|
n.ignoreEmulatedMouseEvents = !1;
|
499
499
|
return;
|
500
500
|
}
|
@@ -503,30 +503,30 @@ function bt(e) {
|
|
503
503
|
};
|
504
504
|
f.onTouchStart = (s) => {
|
505
505
|
if (!s.currentTarget.contains(s.target)) return;
|
506
|
-
let
|
507
|
-
if (!
|
508
|
-
n.activePointerId =
|
506
|
+
let b = bt(s.nativeEvent);
|
507
|
+
if (!b) return;
|
508
|
+
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), B(L(n.target, s), n.pointerType) && s.stopPropagation(), T(ae(s.currentTarget), "scroll", h, !0);
|
509
509
|
}, f.onTouchMove = (s) => {
|
510
510
|
if (!s.currentTarget.contains(s.target)) return;
|
511
511
|
if (!n.isPressed) {
|
512
512
|
s.stopPropagation();
|
513
513
|
return;
|
514
514
|
}
|
515
|
-
let
|
516
|
-
|
515
|
+
let b = he(s.nativeEvent, n.activePointerId), a = !0;
|
516
|
+
b && M(b, s.currentTarget) ? !n.isOverTarget && n.pointerType != null && (n.isOverTarget = !0, a = B(L(n.target, s), n.pointerType)) : n.isOverTarget && n.pointerType != null && (n.isOverTarget = !1, a = k(L(n.target, s), n.pointerType, !1), I(L(n.target, s))), a && s.stopPropagation();
|
517
517
|
}, f.onTouchEnd = (s) => {
|
518
518
|
if (!s.currentTarget.contains(s.target)) return;
|
519
519
|
if (!n.isPressed) {
|
520
520
|
s.stopPropagation();
|
521
521
|
return;
|
522
522
|
}
|
523
|
-
let
|
524
|
-
|
523
|
+
let b = he(s.nativeEvent, n.activePointerId), a = !0;
|
524
|
+
b && M(b, s.currentTarget) && n.pointerType != null ? (D(L(n.target, s), n.pointerType), a = k(L(n.target, s), n.pointerType)) : n.isOverTarget && n.pointerType != null && (a = k(L(n.target, s), n.pointerType, !1)), a && s.stopPropagation(), n.isPressed = !1, n.activePointerId = null, n.isOverTarget = !1, n.ignoreEmulatedMouseEvents = !0, n.target && !g && Y(n.target), x();
|
525
525
|
}, f.onTouchCancel = (s) => {
|
526
|
-
s.currentTarget.contains(s.target) && (s.stopPropagation(), n.isPressed &&
|
526
|
+
s.currentTarget.contains(s.target) && (s.stopPropagation(), n.isPressed && S(L(n.target, s)));
|
527
527
|
};
|
528
528
|
let h = (s) => {
|
529
|
-
n.isPressed && s.target.contains(n.target) &&
|
529
|
+
n.isPressed && s.target.contains(n.target) && S({
|
530
530
|
currentTarget: n.target,
|
531
531
|
shiftKey: !1,
|
532
532
|
ctrlKey: !1,
|
@@ -535,7 +535,7 @@ function bt(e) {
|
|
535
535
|
});
|
536
536
|
};
|
537
537
|
f.onDragStart = (s) => {
|
538
|
-
s.currentTarget.contains(s.target) &&
|
538
|
+
s.currentTarget.contains(s.target) && S(s);
|
539
539
|
};
|
540
540
|
}
|
541
541
|
return f;
|
@@ -543,22 +543,22 @@ function bt(e) {
|
|
543
543
|
T,
|
544
544
|
u,
|
545
545
|
m,
|
546
|
+
x,
|
547
|
+
g,
|
546
548
|
S,
|
547
|
-
|
548
|
-
O,
|
549
|
-
L,
|
549
|
+
I,
|
550
550
|
k,
|
551
551
|
B,
|
552
|
-
|
552
|
+
D
|
553
553
|
]);
|
554
554
|
return J(() => () => {
|
555
555
|
var n;
|
556
|
-
|
556
|
+
g || Y((n = w.current.target) !== null && n !== void 0 ? n : void 0);
|
557
557
|
}, [
|
558
|
-
|
558
|
+
g
|
559
559
|
]), {
|
560
560
|
isPressed: p || _,
|
561
|
-
pressProps: V(
|
561
|
+
pressProps: V(O, oe)
|
562
562
|
};
|
563
563
|
}
|
564
564
|
function de(e) {
|
@@ -566,10 +566,10 @@ function de(e) {
|
|
566
566
|
}
|
567
567
|
function re(e, t) {
|
568
568
|
const { key: r, code: o } = e, i = t, c = i.getAttribute("role");
|
569
|
-
return (r === "Enter" || r === " " || r === "Spacebar" || o === "Space") && !(i instanceof ae(i).HTMLInputElement && !
|
569
|
+
return (r === "Enter" || r === " " || r === "Spacebar" || o === "Space") && !(i instanceof ae(i).HTMLInputElement && !Ke(i, r) || i instanceof ae(i).HTMLTextAreaElement || i.isContentEditable) && // Links should only trigger with Enter key
|
570
570
|
!((c === "link" || !c && de(i)) && r !== "Enter");
|
571
571
|
}
|
572
|
-
function
|
572
|
+
function bt(e) {
|
573
573
|
const { targetTouches: t } = e;
|
574
574
|
return t.length > 0 ? t[0] : null;
|
575
575
|
}
|
@@ -581,7 +581,7 @@ function he(e, t) {
|
|
581
581
|
}
|
582
582
|
return null;
|
583
583
|
}
|
584
|
-
function
|
584
|
+
function L(e, t) {
|
585
585
|
let r = 0, o = 0;
|
586
586
|
return t.targetTouches && t.targetTouches.length === 1 && (r = t.targetTouches[0].clientX, o = t.targetTouches[0].clientY), {
|
587
587
|
currentTarget: e,
|
@@ -624,11 +624,11 @@ function M(e, t) {
|
|
624
624
|
function se(e) {
|
625
625
|
return !(e instanceof HTMLElement) || !e.hasAttribute("draggable");
|
626
626
|
}
|
627
|
-
function
|
627
|
+
function Ae(e) {
|
628
628
|
return e instanceof HTMLInputElement ? !1 : e instanceof HTMLButtonElement ? e.type !== "submit" && e.type !== "reset" : !de(e);
|
629
629
|
}
|
630
630
|
function ye(e, t) {
|
631
|
-
return e instanceof HTMLInputElement ? !
|
631
|
+
return e instanceof HTMLInputElement ? !Ke(e, t) : Ae(e);
|
632
632
|
}
|
633
633
|
const yt = /* @__PURE__ */ new Set([
|
634
634
|
"checkbox",
|
@@ -641,7 +641,7 @@ const yt = /* @__PURE__ */ new Set([
|
|
641
641
|
"submit",
|
642
642
|
"reset"
|
643
643
|
]);
|
644
|
-
function
|
644
|
+
function Ke(e, t) {
|
645
645
|
return e.type === "checkbox" || e.type === "radio" ? t === " " : yt.has(e.type);
|
646
646
|
}
|
647
647
|
let Z = !1, ie = 0;
|
@@ -660,7 +660,7 @@ function kt() {
|
|
660
660
|
};
|
661
661
|
}
|
662
662
|
function wt(e) {
|
663
|
-
let { onHoverStart: t, onHoverChange: r, onHoverEnd: o, isDisabled: i } = e, [c, u] =
|
663
|
+
let { onHoverStart: t, onHoverChange: r, onHoverEnd: o, isDisabled: i } = e, [c, u] = Pe(!1), p = ee({
|
664
664
|
isHovered: !1,
|
665
665
|
ignoreEmulatedMouseEvents: !1,
|
666
666
|
pointerType: "",
|
@@ -668,38 +668,38 @@ function wt(e) {
|
|
668
668
|
}).current;
|
669
669
|
J(kt, []);
|
670
670
|
let { hoverProps: m, triggerHoverEnd: v } = Be(() => {
|
671
|
-
let
|
672
|
-
if (p.pointerType =
|
671
|
+
let g = (_, P) => {
|
672
|
+
if (p.pointerType = P, i || P === "touch" || p.isHovered || !_.currentTarget.contains(_.target)) return;
|
673
673
|
p.isHovered = !0;
|
674
674
|
let w = _.currentTarget;
|
675
675
|
p.target = w, t && t({
|
676
676
|
type: "hoverstart",
|
677
677
|
target: w,
|
678
|
-
pointerType:
|
678
|
+
pointerType: P
|
679
679
|
}), r && r(!0), u(!0);
|
680
|
-
},
|
681
|
-
if (p.pointerType = "", p.target = null,
|
680
|
+
}, $ = (_, P) => {
|
681
|
+
if (p.pointerType = "", p.target = null, P === "touch" || !p.isHovered) return;
|
682
682
|
p.isHovered = !1;
|
683
683
|
let w = _.currentTarget;
|
684
684
|
o && o({
|
685
685
|
type: "hoverend",
|
686
686
|
target: w,
|
687
|
-
pointerType:
|
687
|
+
pointerType: P
|
688
688
|
}), r && r(!1), u(!1);
|
689
|
-
},
|
690
|
-
return typeof PointerEvent < "u" ? (
|
691
|
-
Z && _.pointerType === "mouse" ||
|
692
|
-
},
|
693
|
-
!i && _.currentTarget.contains(_.target) &&
|
694
|
-
}) : (
|
689
|
+
}, O = {};
|
690
|
+
return typeof PointerEvent < "u" ? (O.onPointerEnter = (_) => {
|
691
|
+
Z && _.pointerType === "mouse" || g(_, _.pointerType);
|
692
|
+
}, O.onPointerLeave = (_) => {
|
693
|
+
!i && _.currentTarget.contains(_.target) && $(_, _.pointerType);
|
694
|
+
}) : (O.onTouchStart = () => {
|
695
695
|
p.ignoreEmulatedMouseEvents = !0;
|
696
|
-
},
|
697
|
-
!p.ignoreEmulatedMouseEvents && !Z &&
|
698
|
-
},
|
699
|
-
!i && _.currentTarget.contains(_.target) &&
|
696
|
+
}, O.onMouseEnter = (_) => {
|
697
|
+
!p.ignoreEmulatedMouseEvents && !Z && g(_, "mouse"), p.ignoreEmulatedMouseEvents = !1;
|
698
|
+
}, O.onMouseLeave = (_) => {
|
699
|
+
!i && _.currentTarget.contains(_.target) && $(_, "mouse");
|
700
700
|
}), {
|
701
|
-
hoverProps:
|
702
|
-
triggerHoverEnd:
|
701
|
+
hoverProps: O,
|
702
|
+
triggerHoverEnd: $
|
703
703
|
};
|
704
704
|
}, [
|
705
705
|
t,
|
@@ -729,12 +729,12 @@ function Tt(e, t) {
|
|
729
729
|
onPressUp: p,
|
730
730
|
onPressChange: m,
|
731
731
|
preventFocusOnPress: v,
|
732
|
-
allowFocusWhenDisabled:
|
732
|
+
allowFocusWhenDisabled: g,
|
733
733
|
// @ts-ignore
|
734
|
-
onClick:
|
735
|
-
href:
|
734
|
+
onClick: $,
|
735
|
+
href: O,
|
736
736
|
target: _,
|
737
|
-
rel:
|
737
|
+
rel: P,
|
738
738
|
type: w = "button"
|
739
739
|
} = e, T;
|
740
740
|
r === "button" ? T = {
|
@@ -743,14 +743,14 @@ function Tt(e, t) {
|
|
743
743
|
} : T = {
|
744
744
|
role: "button",
|
745
745
|
tabIndex: o ? void 0 : 0,
|
746
|
-
href: r === "a" && o ? void 0 :
|
746
|
+
href: r === "a" && o ? void 0 : O,
|
747
747
|
target: r === "a" ? _ : void 0,
|
748
748
|
type: r === "input" ? w : void 0,
|
749
749
|
disabled: r === "input" ? o : void 0,
|
750
750
|
"aria-disabled": !o || r === "input" ? void 0 : o,
|
751
|
-
rel: r === "a" ?
|
751
|
+
rel: r === "a" ? P : void 0
|
752
752
|
};
|
753
|
-
let { pressProps:
|
753
|
+
let { pressProps: x, isPressed: B } = gt({
|
754
754
|
onPressStart: c,
|
755
755
|
onPressEnd: u,
|
756
756
|
onPressChange: m,
|
@@ -760,24 +760,24 @@ function Tt(e, t) {
|
|
760
760
|
preventFocusOnPress: v,
|
761
761
|
ref: t
|
762
762
|
}), { focusableProps: k } = Ve(e, t);
|
763
|
-
|
764
|
-
let
|
763
|
+
g && (k.tabIndex = o ? -1 : k.tabIndex);
|
764
|
+
let D = V(k, x, Qe(e, {
|
765
765
|
labelable: !0
|
766
766
|
}));
|
767
767
|
return {
|
768
768
|
isPressed: B,
|
769
|
-
buttonProps: V(T,
|
769
|
+
buttonProps: V(T, D, {
|
770
770
|
"aria-haspopup": e["aria-haspopup"],
|
771
771
|
"aria-expanded": e["aria-expanded"],
|
772
772
|
"aria-controls": e["aria-controls"],
|
773
773
|
"aria-pressed": e["aria-pressed"],
|
774
|
-
onClick: (
|
775
|
-
|
774
|
+
onClick: (S) => {
|
775
|
+
$ && ($(S), console.warn("onClick is deprecated, please use onPress"));
|
776
776
|
}
|
777
777
|
})
|
778
778
|
};
|
779
779
|
}
|
780
|
-
function
|
780
|
+
function $t(e, t, r) {
|
781
781
|
return t in e ? Object.defineProperty(e, t, {
|
782
782
|
value: r,
|
783
783
|
enumerable: !0,
|
@@ -799,14 +799,14 @@ function Te(e) {
|
|
799
799
|
for (var t = 1; t < arguments.length; t++) {
|
800
800
|
var r = arguments[t] != null ? arguments[t] : {};
|
801
801
|
t % 2 ? we(Object(r), !0).forEach(function(o) {
|
802
|
-
|
802
|
+
$t(e, o, r[o]);
|
803
803
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : we(Object(r)).forEach(function(o) {
|
804
804
|
Object.defineProperty(e, o, Object.getOwnPropertyDescriptor(r, o));
|
805
805
|
});
|
806
806
|
}
|
807
807
|
return e;
|
808
808
|
}
|
809
|
-
var
|
809
|
+
var Pt = (e, t, r) => {
|
810
810
|
for (var o of Object.keys(e)) {
|
811
811
|
var i;
|
812
812
|
if (e[o] !== ((i = t[o]) !== null && i !== void 0 ? i : r[o]))
|
@@ -827,11 +827,11 @@ var $t = (e, t, r) => {
|
|
827
827
|
m && (r += " " + m);
|
828
828
|
}
|
829
829
|
}
|
830
|
-
for (var [v,
|
831
|
-
|
830
|
+
for (var [v, g] of e.compoundVariants)
|
831
|
+
Pt(v, o, e.defaultVariants) && (r += " " + g);
|
832
832
|
return r;
|
833
|
-
}, Bt = ne({ defaultClassName: "pkg_sps-
|
834
|
-
const
|
833
|
+
}, Bt = ne({ defaultClassName: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxy0", variantClassNames: { disabled: { true: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxy1", false: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxy2" }, kind: { default: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxy3", link: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxy4", confirm: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxy5", delete: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxy6", key: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxy7", icon: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxy8" }, spinning: { true: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxy9", false: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxya" } }, defaultVariants: { disabled: !1, kind: "default", spinning: !1 }, compoundVariants: [[{ kind: "icon", spinning: !0 }, "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyb"], [{ kind: "default", spinning: !0 }, "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyc"], [{ kind: "confirm", spinning: !0 }, "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyd"], [{ kind: "delete", spinning: !0 }, "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxye"], [{ kind: "key", spinning: !0 }, "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyf"], [{ disabled: !0, spinning: !1 }, "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyg"], [{ kind: "link", disabled: !0 }, "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyh"]] }), Et = ne({ defaultClassName: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyi", variantClassNames: { disabled: { true: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyj", false: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyk" }, kind: { icon: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyl", default: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxym", delete: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyn", key: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyo", confirm: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyp", link: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyq" }, spinning: { true: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyr", false: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxys" } }, defaultVariants: { disabled: !1, kind: "default", spinning: !1 }, compoundVariants: [] }), Ot = ne({ defaultClassName: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyt", variantClassNames: { spinning: { true: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyu", false: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyv" }, kind: { icon: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyw", default: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyx", delete: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyy", key: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxyz", confirm: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxy10", link: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxy11" } }, defaultVariants: { spinning: !1 }, compoundVariants: [] }), xt = "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxy12", St = ne({ defaultClassName: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxy13", variantClassNames: { spinning: { true: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxy14", false: "pkg_sps-woodland_buttons__version_8_35_0__hash_125pcxy15" } }, defaultVariants: { spinning: !1 }, compoundVariants: [] });
|
834
|
+
const Ie = d.forwardRef(
|
835
835
|
({
|
836
836
|
as: e,
|
837
837
|
onClick: t,
|
@@ -843,44 +843,44 @@ const Le = d.forwardRef(
|
|
843
843
|
href: p,
|
844
844
|
icon: m,
|
845
845
|
kind: v = "default",
|
846
|
-
spinning:
|
847
|
-
spinningTitle:
|
848
|
-
title:
|
846
|
+
spinning: g,
|
847
|
+
spinningTitle: $,
|
848
|
+
title: O,
|
849
849
|
..._
|
850
|
-
},
|
850
|
+
}, P) => {
|
851
851
|
const w = e ?? (p ? "a" : "button"), T = {
|
852
852
|
onPress: r ?? t,
|
853
853
|
// the button element should be disabled if the button is marked as disabled or spinning
|
854
|
-
isDisabled: u ?? c ??
|
854
|
+
isDisabled: u ?? c ?? g,
|
855
855
|
..._
|
856
|
-
}, { "data-testid":
|
856
|
+
}, { "data-testid": x } = _, B = d.useRef(null), k = P || B, { buttonProps: D } = Tt(
|
857
857
|
T,
|
858
858
|
k
|
859
|
-
), { hoverProps:
|
860
|
-
...V(oe,
|
859
|
+
), { hoverProps: S } = wt({ isDisabled: T.isDisabled }), { type: I, ...oe } = D, n = {
|
860
|
+
...V(oe, S),
|
861
861
|
ref: k,
|
862
|
-
title:
|
863
|
-
className: p ?
|
864
|
-
...p ? { href: p } : { type:
|
862
|
+
title: O,
|
863
|
+
className: p ? Ot({ spinning: g, kind: v }) : Et({ disabled: c || u, kind: v, spinning: g }),
|
864
|
+
...p ? { href: p } : { type: I },
|
865
865
|
..._
|
866
|
-
}, { t: f } = We(),
|
866
|
+
}, { t: f } = We(), E = m && /* @__PURE__ */ d.createElement(
|
867
867
|
Re,
|
868
868
|
{
|
869
|
-
className:
|
869
|
+
className: xt,
|
870
870
|
icon: m,
|
871
871
|
"aria-hidden": "true",
|
872
|
-
"data-testid": `${
|
872
|
+
"data-testid": `${x}__${m}-icon`
|
873
873
|
}
|
874
874
|
);
|
875
875
|
let l;
|
876
876
|
v === "default" || v === "icon" || v === "link" ? l = "dark" : l = "light";
|
877
|
-
const h =
|
877
|
+
const h = g && /* @__PURE__ */ d.createElement(
|
878
878
|
Fe,
|
879
879
|
{
|
880
880
|
color: l,
|
881
|
-
className:
|
882
|
-
title:
|
883
|
-
"data-testid": `${
|
881
|
+
className: St({ spinning: g }),
|
882
|
+
title: $ || f("button.spinningTitle", { defaultValue: "Loading..." }),
|
883
|
+
"data-testid": `${x}__spinner`
|
884
884
|
}
|
885
885
|
);
|
886
886
|
return /* @__PURE__ */ d.createElement(Ge, null, /* @__PURE__ */ d.createElement(
|
@@ -890,16 +890,16 @@ const Le = d.forwardRef(
|
|
890
890
|
Bt({
|
891
891
|
disabled: c || u,
|
892
892
|
kind: v,
|
893
|
-
spinning:
|
893
|
+
spinning: g
|
894
894
|
}),
|
895
895
|
i
|
896
896
|
)
|
897
897
|
},
|
898
|
-
/* @__PURE__ */ d.createElement(w, { ...n },
|
898
|
+
/* @__PURE__ */ d.createElement(w, { ...n }, E, o ? /* @__PURE__ */ d.createElement("span", null, o) : "", h)
|
899
899
|
));
|
900
900
|
}
|
901
901
|
);
|
902
|
-
He.set(
|
902
|
+
He.set(Ie, {
|
903
903
|
name: "Button",
|
904
904
|
props: {
|
905
905
|
disabled: "boolean",
|
@@ -922,8 +922,8 @@ He.set(Le, {
|
|
922
922
|
},
|
923
923
|
panellable: !0
|
924
924
|
});
|
925
|
-
const
|
926
|
-
components: [
|
925
|
+
const Dt = {
|
926
|
+
components: [Ie],
|
927
927
|
description: () => /* @__PURE__ */ d.createElement(d.Fragment, null, /* @__PURE__ */ d.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__ */ d.createElement("br", null), /* @__PURE__ */ d.createElement("h5", null, "Variants"), /* @__PURE__ */ d.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ d.createElement("span", { className: "sps-text-semibold" }, "Default: "), "For tertiary actions or actions of lower importance on a page."), /* @__PURE__ */ d.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ d.createElement("span", { className: "sps-text-semibold" }, "Key: "), "For primary or important actions on a page."), /* @__PURE__ */ d.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ d.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__ */ d.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ d.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__ */ d.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ d.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__ */ d.createElement("div", { className: "sps-body-14" }, /* @__PURE__ */ d.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.")),
|
928
928
|
examples: {
|
929
929
|
basic: {
|
@@ -995,40 +995,36 @@ const Nt = {
|
|
995
995
|
withoutIcons: {
|
996
996
|
description: "Without Icons",
|
997
997
|
react: y`
|
998
|
-
import {
|
998
|
+
import { Dropdown, OptionList, Option } from "@sps-woodland/dropdowns";
|
999
999
|
|
1000
1000
|
function Component() {
|
1001
1001
|
return (
|
1002
1002
|
<>
|
1003
|
-
<
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
<
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
disabled
|
1029
|
-
label="Disabled"
|
1030
|
-
options={[[{ label: "Option A" }, () => console.log("Option A")]]}
|
1031
|
-
/>
|
1003
|
+
<Dropdown label="Default" className={sprinkles({ mr: "sm" })}>
|
1004
|
+
<OptionList>
|
1005
|
+
<Option onClick={() => console.log("Option A")}>Option A</Option>
|
1006
|
+
</OptionList>
|
1007
|
+
</Dropdown>
|
1008
|
+
<Dropdown label="Key" kind="key" className={sprinkles({ mr: "sm" })}>
|
1009
|
+
<OptionList>
|
1010
|
+
<Option onClick={() => console.log("Option A")}>Option A</Option>
|
1011
|
+
</OptionList>
|
1012
|
+
</Dropdown>
|
1013
|
+
<Dropdown label="Confirm" kind="confirm" className={sprinkles({ mr: "sm" })}>
|
1014
|
+
<OptionList>
|
1015
|
+
<Option onClick={() => console.log("Option A")}>Option A</Option>
|
1016
|
+
</OptionList>
|
1017
|
+
</Dropdown>
|
1018
|
+
<Dropdown label="Delete" kind="delete" className={sprinkles({ mr: "sm" })}>
|
1019
|
+
<OptionList>
|
1020
|
+
<Option onClick={() => console.log("Option A")}>Option A</Option>
|
1021
|
+
</OptionList>
|
1022
|
+
</Dropdown>
|
1023
|
+
<Dropdown label="Disabled" disabled>
|
1024
|
+
<OptionList>
|
1025
|
+
<Option onClick={() => console.log("Option A")}>Option A</Option>
|
1026
|
+
</OptionList>
|
1027
|
+
</Dropdown>
|
1032
1028
|
</>
|
1033
1029
|
)
|
1034
1030
|
}
|
@@ -1037,45 +1033,36 @@ const Nt = {
|
|
1037
1033
|
withIcons: {
|
1038
1034
|
description: "With Icons",
|
1039
1035
|
react: y`
|
1040
|
-
import {
|
1036
|
+
import { Dropdown, OptionList, Option } from "@sps-woodland/dropdowns";
|
1041
1037
|
|
1042
1038
|
function Component() {
|
1043
1039
|
return (
|
1044
1040
|
<>
|
1045
|
-
<
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
<
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
options={[[{ label: "Option A" }, () => console.log("Option A")]]}
|
1071
|
-
/>
|
1072
|
-
<SpsDropdown
|
1073
|
-
className="mr-1 mb-1"
|
1074
|
-
icon={SpsIcon.DOWNLOAD_CLOUD}
|
1075
|
-
disabled
|
1076
|
-
label="Disabled"
|
1077
|
-
options={[[{ label: "Option A" }, () => console.log("Option A")]]}
|
1078
|
-
/>
|
1041
|
+
<Dropdown label="Default" icon="download-cloud" className={sprinkles({ mr: "sm" })}>
|
1042
|
+
<OptionList>
|
1043
|
+
<Option onClick={() => console.log("Option A")}>Option A</Option>
|
1044
|
+
</OptionList>
|
1045
|
+
</Dropdown>
|
1046
|
+
<Dropdown label="Key" kind="key" icon="download-cloud" className={sprinkles({ mr: "sm" })}>
|
1047
|
+
<OptionList>
|
1048
|
+
<Option onClick={() => console.log("Option A")}>Option A</Option>
|
1049
|
+
</OptionList>
|
1050
|
+
</Dropdown>
|
1051
|
+
<Dropdown label="Confirm" kind="confirm" icon="download-cloud" className={sprinkles({ mr: "sm" })}>
|
1052
|
+
<OptionList>
|
1053
|
+
<Option onClick={() => console.log("Option A")}>Option A</Option>
|
1054
|
+
</OptionList>
|
1055
|
+
</Dropdown>
|
1056
|
+
<Dropdown label="Delete" kind="delete" icon="download-cloud" className={sprinkles({ mr: "sm" })}>
|
1057
|
+
<OptionList>
|
1058
|
+
<Option onClick={() => console.log("Option A")}>Option A</Option>
|
1059
|
+
</OptionList>
|
1060
|
+
</Dropdown>
|
1061
|
+
<Dropdown label="Disabled" disabled icon="download-cloud">
|
1062
|
+
<OptionList>
|
1063
|
+
<Option onClick={() => console.log("Option A")}>Option A</Option>
|
1064
|
+
</OptionList>
|
1065
|
+
</Dropdown>
|
1079
1066
|
</>
|
1080
1067
|
)
|
1081
1068
|
}
|
@@ -1084,38 +1071,31 @@ const Nt = {
|
|
1084
1071
|
spinning: {
|
1085
1072
|
description: "Spinning",
|
1086
1073
|
react: y`
|
1087
|
-
import {
|
1074
|
+
import { Dropdown, OptionList, Option } from "@sps-woodland/dropdowns";
|
1088
1075
|
|
1089
1076
|
function Component() {
|
1090
1077
|
return (
|
1091
1078
|
<>
|
1092
|
-
<
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
<SpsDropdown
|
1113
|
-
spinning
|
1114
|
-
className="mr-1 mb-1"
|
1115
|
-
kind={ButtonKind.DELETE}
|
1116
|
-
label="Delete"
|
1117
|
-
options={[[{ label: "Option A" }, () => console.log("Option A")]]}
|
1118
|
-
/>
|
1079
|
+
<Dropdown label="Default" spinning className={sprinkles({ mr: "sm" })}>
|
1080
|
+
<OptionList>
|
1081
|
+
<Option onClick={() => console.log("Option A")}>Option A</Option>
|
1082
|
+
</OptionList>
|
1083
|
+
</Dropdown>
|
1084
|
+
<Dropdown label="Key" kind="key" spinning className={sprinkles({ mr: "sm" })}>
|
1085
|
+
<OptionList>
|
1086
|
+
<Option onClick={() => console.log("Option A")}>Option A</Option>
|
1087
|
+
</OptionList>
|
1088
|
+
</Dropdown>
|
1089
|
+
<Dropdown label="Confirm" kind="confirm" spinning className={sprinkles({ mr: "sm" })}>
|
1090
|
+
<OptionList>
|
1091
|
+
<Option onClick={() => console.log("Option A")}>Option A</Option>
|
1092
|
+
</OptionList>
|
1093
|
+
</Dropdown>
|
1094
|
+
<Dropdown label="Delete" kind="delete" spinning className={sprinkles({ mr: "sm" })}>
|
1095
|
+
<OptionList>
|
1096
|
+
<Option onClick={() => console.log("Option A")}>Option A</Option>
|
1097
|
+
</OptionList>
|
1098
|
+
</Dropdown>
|
1119
1099
|
</>
|
1120
1100
|
)
|
1121
1101
|
}
|
@@ -1494,10 +1474,10 @@ const Nt = {
|
|
1494
1474
|
}
|
1495
1475
|
}
|
1496
1476
|
}
|
1497
|
-
},
|
1498
|
-
Buttons:
|
1477
|
+
}, It = {
|
1478
|
+
Buttons: Dt
|
1499
1479
|
};
|
1500
1480
|
export {
|
1501
|
-
|
1502
|
-
|
1481
|
+
Ie as Button,
|
1482
|
+
It as MANIFEST
|
1503
1483
|
};
|