@sps-woodland/buttons 8.10.4 → 8.11.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.es.js +70 -36
- package/package.json +5 -5
package/lib/index.es.js
CHANGED
@@ -18,7 +18,8 @@ function F(e) {
|
|
18
18
|
}
|
19
19
|
let de = /* @__PURE__ */ new Map();
|
20
20
|
function Ge(e, t) {
|
21
|
-
if (e === t)
|
21
|
+
if (e === t)
|
22
|
+
return e;
|
22
23
|
let r = de.get(e);
|
23
24
|
if (r)
|
24
25
|
return r(t), t;
|
@@ -27,7 +28,8 @@ function Ge(e, t) {
|
|
27
28
|
}
|
28
29
|
function we(...e) {
|
29
30
|
return (...t) => {
|
30
|
-
for (let r of e)
|
31
|
+
for (let r of e)
|
32
|
+
typeof r == "function" && r(...t);
|
31
33
|
};
|
32
34
|
}
|
33
35
|
const _ = (e) => {
|
@@ -36,15 +38,21 @@ const _ = (e) => {
|
|
36
38
|
}, se = (e) => e && "window" in e && e.window === e ? e : _(e).defaultView || window;
|
37
39
|
function xe(e) {
|
38
40
|
var t, r, o = "";
|
39
|
-
if (typeof e == "string" || typeof e == "number")
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
if (typeof e == "string" || typeof e == "number")
|
42
|
+
o += e;
|
43
|
+
else if (typeof e == "object")
|
44
|
+
if (Array.isArray(e)) {
|
45
|
+
var i = e.length;
|
46
|
+
for (t = 0; t < i; t++)
|
47
|
+
e[t] && (r = xe(e[t])) && (o && (o += " "), o += r);
|
48
|
+
} else
|
49
|
+
for (r in e)
|
50
|
+
e[r] && (o && (o += " "), o += r);
|
44
51
|
return o;
|
45
52
|
}
|
46
53
|
function Ve() {
|
47
|
-
for (var e, t, r = 0, o = "", i = arguments.length; r < i; r++)
|
54
|
+
for (var e, t, r = 0, o = "", i = arguments.length; r < i; r++)
|
55
|
+
(e = arguments[r]) && (t = xe(e)) && (o && (o += " "), o += t);
|
48
56
|
return o;
|
49
57
|
}
|
50
58
|
function H(...e) {
|
@@ -81,13 +89,15 @@ const We = /* @__PURE__ */ new Set([
|
|
81
89
|
]), ze = /^(data-.*)$/;
|
82
90
|
function Xe(e, t = {}) {
|
83
91
|
let { labelable: r, isLink: o, propNames: i } = t, d = {};
|
84
|
-
for (const u in e)
|
92
|
+
for (const u in e)
|
93
|
+
Object.prototype.hasOwnProperty.call(e, u) && (We.has(u) || r && je.has(u) || o && Ye.has(u) || i != null && i.has(u) || ze.test(u)) && (d[u] = e[u]);
|
85
94
|
return d;
|
86
95
|
}
|
87
96
|
function U(e) {
|
88
|
-
if (qe())
|
89
|
-
|
90
|
-
|
97
|
+
if (qe())
|
98
|
+
e.focus({
|
99
|
+
preventScroll: !0
|
100
|
+
});
|
91
101
|
else {
|
92
102
|
let t = Je(e);
|
93
103
|
e.focus(), Qe(t);
|
@@ -182,21 +192,25 @@ function R(e, t, r = !0) {
|
|
182
192
|
R.isOpening = !1;
|
183
193
|
let L = /* @__PURE__ */ new Map(), ie = /* @__PURE__ */ new Set();
|
184
194
|
function pe() {
|
185
|
-
if (typeof window > "u")
|
195
|
+
if (typeof window > "u")
|
196
|
+
return;
|
186
197
|
function e(o) {
|
187
198
|
return "propertyName" in o;
|
188
199
|
}
|
189
200
|
let t = (o) => {
|
190
|
-
if (!e(o) || !o.target)
|
201
|
+
if (!e(o) || !o.target)
|
202
|
+
return;
|
191
203
|
let i = L.get(o.target);
|
192
204
|
i || (i = /* @__PURE__ */ new Set(), L.set(o.target, i), o.target.addEventListener("transitioncancel", r, {
|
193
205
|
once: !0
|
194
206
|
})), i.add(o.propertyName);
|
195
207
|
}, r = (o) => {
|
196
|
-
if (!e(o) || !o.target)
|
208
|
+
if (!e(o) || !o.target)
|
209
|
+
return;
|
197
210
|
let i = L.get(o.target);
|
198
211
|
if (i && (i.delete(o.propertyName), i.size === 0 && (o.target.removeEventListener("transitioncancel", r), L.delete(o.target)), L.size === 0)) {
|
199
|
-
for (let d of ie)
|
212
|
+
for (let d of ie)
|
213
|
+
d();
|
200
214
|
ie.clear();
|
201
215
|
}
|
202
216
|
};
|
@@ -260,11 +274,13 @@ function me(e) {
|
|
260
274
|
ae = t.documentElement.style.webkitUserSelect, t.documentElement.style.webkitUserSelect = "none";
|
261
275
|
}
|
262
276
|
M = "disabled";
|
263
|
-
} else
|
277
|
+
} else
|
278
|
+
(e instanceof HTMLElement || e instanceof SVGElement) && (z.set(e, e.style.userSelect), e.style.userSelect = "none");
|
264
279
|
}
|
265
280
|
function V(e) {
|
266
281
|
if (Ne()) {
|
267
|
-
if (M !== "disabled")
|
282
|
+
if (M !== "disabled")
|
283
|
+
return;
|
268
284
|
M = "restoring", setTimeout(() => {
|
269
285
|
rt(() => {
|
270
286
|
if (M === "restoring") {
|
@@ -287,7 +303,8 @@ function at(e, t) {
|
|
287
303
|
return t.get ? t.get.call(e) : t.value;
|
288
304
|
}
|
289
305
|
function Ce(e, t, r) {
|
290
|
-
if (!t.has(e))
|
306
|
+
if (!t.has(e))
|
307
|
+
throw new TypeError("attempted to " + r + " private field on non-instance");
|
291
308
|
return t.get(e);
|
292
309
|
}
|
293
310
|
function lt(e, t) {
|
@@ -302,7 +319,8 @@ function ct(e, t, r) {
|
|
302
319
|
ut(e, t), t.set(e, r);
|
303
320
|
}
|
304
321
|
function dt(e, t, r) {
|
305
|
-
if (t.set)
|
322
|
+
if (t.set)
|
323
|
+
t.set.call(e, r);
|
306
324
|
else {
|
307
325
|
if (!t.writable)
|
308
326
|
throw new TypeError("attempted to set read only private field");
|
@@ -364,7 +382,8 @@ function ft(e) {
|
|
364
382
|
pointerType: null
|
365
383
|
}), { addGlobalListener: $, removeAllGlobalListeners: S } = ot(), P = F((n, f) => {
|
366
384
|
let B = T.current;
|
367
|
-
if (u || B.didFirePressStart)
|
385
|
+
if (u || B.didFirePressStart)
|
386
|
+
return !1;
|
368
387
|
let l = !0;
|
369
388
|
if (B.isTriggeringEvent = !0, o) {
|
370
389
|
let v = new j("pressstart", f, n);
|
@@ -373,7 +392,8 @@ function ft(e) {
|
|
373
392
|
return r && r(!0), B.isTriggeringEvent = !1, B.didFirePressStart = !0, w(!0), l;
|
374
393
|
}), E = F((n, f, B = !0) => {
|
375
394
|
let l = T.current;
|
376
|
-
if (!l.didFirePressStart)
|
395
|
+
if (!l.didFirePressStart)
|
396
|
+
return !1;
|
377
397
|
l.ignoreClickAfterPress = !0, l.didFirePressStart = !1, l.isTriggeringEvent = !0;
|
378
398
|
let v = !0;
|
379
399
|
if (i) {
|
@@ -387,7 +407,8 @@ function ft(e) {
|
|
387
407
|
return l.isTriggeringEvent = !1, v;
|
388
408
|
}), O = F((n, f) => {
|
389
409
|
let B = T.current;
|
390
|
-
if (u)
|
410
|
+
if (u)
|
411
|
+
return !1;
|
391
412
|
if (d) {
|
392
413
|
B.isTriggeringEvent = !0;
|
393
414
|
let l = new j("pressup", f, n);
|
@@ -414,7 +435,8 @@ function ft(e) {
|
|
414
435
|
$(_(l.currentTarget), "keyup", we(h, B), !0);
|
415
436
|
}
|
416
437
|
s && l.stopPropagation(), l.metaKey && q() && ((v = n.metaKeyEvents) === null || v === void 0 || v.set(l.key, l.nativeEvent));
|
417
|
-
} else
|
438
|
+
} else
|
439
|
+
l.key === "Meta" && (n.metaKeyEvents = /* @__PURE__ */ new Map());
|
418
440
|
},
|
419
441
|
onClick(l) {
|
420
442
|
if (!(l && !l.currentTarget.contains(l.target)) && l && l.button === 0 && !n.isTriggeringEvent && !R.isOpening) {
|
@@ -438,12 +460,14 @@ function ft(e) {
|
|
438
460
|
var a;
|
439
461
|
let h = n.metaKeyEvents;
|
440
462
|
n.metaKeyEvents = void 0;
|
441
|
-
for (let K of h.values())
|
463
|
+
for (let K of h.values())
|
464
|
+
(a = n.target) === null || a === void 0 || a.dispatchEvent(new KeyboardEvent("keyup", K));
|
442
465
|
}
|
443
466
|
};
|
444
467
|
if (typeof PointerEvent < "u") {
|
445
468
|
f.onPointerDown = (a) => {
|
446
|
-
if (a.button !== 0 || !a.currentTarget.contains(a.target))
|
469
|
+
if (a.button !== 0 || !a.currentTarget.contains(a.target))
|
470
|
+
return;
|
447
471
|
if (it(a.nativeEvent)) {
|
448
472
|
n.pointerType = "virtual";
|
449
473
|
return;
|
@@ -468,18 +492,21 @@ function ft(e) {
|
|
468
492
|
};
|
469
493
|
} else {
|
470
494
|
f.onMouseDown = (s) => {
|
471
|
-
if (s.button !== 0 || !s.currentTarget.contains(s.target))
|
495
|
+
if (s.button !== 0 || !s.currentTarget.contains(s.target))
|
496
|
+
return;
|
472
497
|
if (re(s.currentTarget) && s.preventDefault(), n.ignoreEmulatedMouseEvents) {
|
473
498
|
s.stopPropagation();
|
474
499
|
return;
|
475
500
|
}
|
476
501
|
n.isPressed = !0, n.isOverTarget = !0, n.target = s.currentTarget, n.pointerType = fe(s.nativeEvent) ? "virtual" : "mouse", !u && !b && U(s.currentTarget), P(s, n.pointerType) && s.stopPropagation(), $(_(s.currentTarget), "mouseup", l, !1);
|
477
502
|
}, f.onMouseEnter = (s) => {
|
478
|
-
if (!s.currentTarget.contains(s.target))
|
503
|
+
if (!s.currentTarget.contains(s.target))
|
504
|
+
return;
|
479
505
|
let a = !0;
|
480
506
|
n.isPressed && !n.ignoreEmulatedMouseEvents && n.pointerType != null && (n.isOverTarget = !0, a = P(s, n.pointerType)), a && s.stopPropagation();
|
481
507
|
}, f.onMouseLeave = (s) => {
|
482
|
-
if (!s.currentTarget.contains(s.target))
|
508
|
+
if (!s.currentTarget.contains(s.target))
|
509
|
+
return;
|
483
510
|
let a = !0;
|
484
511
|
n.isPressed && !n.ignoreEmulatedMouseEvents && n.pointerType != null && (n.isOverTarget = !1, a = E(s, n.pointerType, !1), I(s)), a && s.stopPropagation();
|
485
512
|
}, f.onMouseUp = (s) => {
|
@@ -495,12 +522,15 @@ function ft(e) {
|
|
495
522
|
}
|
496
523
|
};
|
497
524
|
f.onTouchStart = (s) => {
|
498
|
-
if (!s.currentTarget.contains(s.target))
|
525
|
+
if (!s.currentTarget.contains(s.target))
|
526
|
+
return;
|
499
527
|
let a = mt(s.nativeEvent);
|
500
|
-
if (!a)
|
528
|
+
if (!a)
|
529
|
+
return;
|
501
530
|
n.activePointerId = a.identifier, n.ignoreEmulatedMouseEvents = !0, n.isOverTarget = !0, n.isPressed = !0, n.target = s.currentTarget, n.pointerType = "touch", !u && !b && U(s.currentTarget), g || me(n.target), P(s, n.pointerType) && s.stopPropagation(), $(se(s.currentTarget), "scroll", v, !0);
|
502
531
|
}, f.onTouchMove = (s) => {
|
503
|
-
if (!s.currentTarget.contains(s.target))
|
532
|
+
if (!s.currentTarget.contains(s.target))
|
533
|
+
return;
|
504
534
|
if (!n.isPressed) {
|
505
535
|
s.stopPropagation();
|
506
536
|
return;
|
@@ -508,7 +538,8 @@ function ft(e) {
|
|
508
538
|
let a = ve(s.nativeEvent, n.activePointerId), h = !0;
|
509
539
|
a && A(a, s.currentTarget) ? !n.isOverTarget && n.pointerType != null && (n.isOverTarget = !0, h = P(s, n.pointerType)) : n.isOverTarget && n.pointerType != null && (n.isOverTarget = !1, h = E(s, n.pointerType, !1), I(s)), h && s.stopPropagation();
|
510
540
|
}, f.onTouchEnd = (s) => {
|
511
|
-
if (!s.currentTarget.contains(s.target))
|
541
|
+
if (!s.currentTarget.contains(s.target))
|
542
|
+
return;
|
512
543
|
if (!n.isPressed) {
|
513
544
|
s.stopPropagation();
|
514
545
|
return;
|
@@ -570,7 +601,8 @@ function ve(e, t) {
|
|
570
601
|
const r = e.changedTouches;
|
571
602
|
for (let o = 0; o < r.length; o++) {
|
572
603
|
const i = r[o];
|
573
|
-
if (i.identifier === t)
|
604
|
+
if (i.identifier === t)
|
605
|
+
return i;
|
574
606
|
}
|
575
607
|
return null;
|
576
608
|
}
|
@@ -644,7 +676,8 @@ function ht(e) {
|
|
644
676
|
X(yt, []);
|
645
677
|
let { hoverProps: b, triggerHoverEnd: k } = $e(() => {
|
646
678
|
let g = (m, w) => {
|
647
|
-
if (p.pointerType = w, i || w === "touch" || p.isHovered || !m.currentTarget.contains(m.target))
|
679
|
+
if (p.pointerType = w, i || w === "touch" || p.isHovered || !m.currentTarget.contains(m.target))
|
680
|
+
return;
|
648
681
|
p.isHovered = !0;
|
649
682
|
let T = m.currentTarget;
|
650
683
|
p.target = T, t && t({
|
@@ -653,7 +686,8 @@ function ht(e) {
|
|
653
686
|
pointerType: w
|
654
687
|
}), r && r(!0), u(!0);
|
655
688
|
}, D = (m, w) => {
|
656
|
-
if (p.pointerType = "", p.target = null, w === "touch" || !p.isHovered)
|
689
|
+
if (p.pointerType = "", p.target = null, w === "touch" || !p.isHovered)
|
690
|
+
return;
|
657
691
|
p.isHovered = !1;
|
658
692
|
let T = m.currentTarget;
|
659
693
|
o && o({
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sps-woodland/buttons",
|
3
3
|
"description": "SPS Woodland Design System button components",
|
4
|
-
"version": "8.
|
4
|
+
"version": "8.11.0",
|
5
5
|
"author": "SPS Commerce",
|
6
6
|
"license": "UNLICENSED",
|
7
7
|
"repository": "https://github.com/SPSCommerce/woodland/tree/main/packages/@sps-woodland/buttons",
|
@@ -30,8 +30,8 @@
|
|
30
30
|
"@spscommerce/utils": "^7.0.0",
|
31
31
|
"react": "^16.9.0",
|
32
32
|
"react-dom": "^16.9.0",
|
33
|
-
"@sps-woodland/core": "8.
|
34
|
-
"@sps-woodland/tokens": "8.
|
33
|
+
"@sps-woodland/core": "8.11.0",
|
34
|
+
"@sps-woodland/tokens": "8.11.0"
|
35
35
|
},
|
36
36
|
"devDependencies": {
|
37
37
|
"@react-aria/button": "^3.3.5",
|
@@ -42,8 +42,8 @@
|
|
42
42
|
"@vanilla-extract/recipes": "^0.2.5",
|
43
43
|
"react": "^16.9.0",
|
44
44
|
"react-dom": "^16.9.0",
|
45
|
-
"@sps-woodland/core": "8.
|
46
|
-
"@sps-woodland/tokens": "8.
|
45
|
+
"@sps-woodland/core": "8.11.0",
|
46
|
+
"@sps-woodland/tokens": "8.11.0"
|
47
47
|
},
|
48
48
|
"dependencies": {
|
49
49
|
"@react-aria/button": "^3.7.0",
|