@sps-woodland/tabs 8.12.0 → 8.12.1
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 +91 -177
- package/package.json +6 -6
package/lib/index.es.js
CHANGED
@@ -44,12 +44,9 @@ class Ge {
|
|
44
44
|
constructor(e) {
|
45
45
|
this.keyMap = /* @__PURE__ */ new Map(), this.iterable = e;
|
46
46
|
let r = (o) => {
|
47
|
-
if (this.keyMap.set(o.key, o), o.childNodes && o.type === "section")
|
48
|
-
for (let s of o.childNodes)
|
49
|
-
r(s);
|
47
|
+
if (this.keyMap.set(o.key, o), o.childNodes && o.type === "section") for (let s of o.childNodes) r(s);
|
50
48
|
};
|
51
|
-
for (let o of e)
|
52
|
-
r(o);
|
49
|
+
for (let o of e) r(o);
|
53
50
|
let n, i = 0;
|
54
51
|
for (let [o, s] of this.keyMap)
|
55
52
|
n ? (n.nextKey = o, s.prevKey = n.key) : (this.firstKey = o, s.prevKey = void 0), s.type === "item" && (s.index = i++), n = s, n.nextKey = void 0;
|
@@ -88,11 +85,9 @@ function dt(t, e, r) {
|
|
88
85
|
];
|
89
86
|
}
|
90
87
|
function qt(t, e) {
|
91
|
-
if (t.size !== e.size)
|
92
|
-
return !1;
|
88
|
+
if (t.size !== e.size) return !1;
|
93
89
|
for (let r of t)
|
94
|
-
if (!e.has(r))
|
95
|
-
return !1;
|
90
|
+
if (!e.has(r)) return !1;
|
96
91
|
return !0;
|
97
92
|
}
|
98
93
|
function Yt(t) {
|
@@ -222,12 +217,9 @@ class _t {
|
|
222
217
|
* Whether all items in the collection are selected.
|
223
218
|
*/
|
224
219
|
get isSelectAll() {
|
225
|
-
if (this.isEmpty)
|
226
|
-
|
227
|
-
if (this.
|
228
|
-
return !0;
|
229
|
-
if (this._isSelectAll != null)
|
230
|
-
return this._isSelectAll;
|
220
|
+
if (this.isEmpty) return !1;
|
221
|
+
if (this.state.selectedKeys === "all") return !0;
|
222
|
+
if (this._isSelectAll != null) return this._isSelectAll;
|
231
223
|
let e = this.getSelectAllKeys(), r = this.state.selectedKeys;
|
232
224
|
return this._isSelectAll = e.every((n) => r.has(n)), this._isSelectAll;
|
233
225
|
}
|
@@ -257,25 +249,21 @@ class _t {
|
|
257
249
|
* Extends the selection to the given key.
|
258
250
|
*/
|
259
251
|
extendSelection(e) {
|
260
|
-
if (this.selectionMode === "none")
|
261
|
-
return;
|
252
|
+
if (this.selectionMode === "none") return;
|
262
253
|
if (this.selectionMode === "single") {
|
263
254
|
this.replaceSelection(e);
|
264
255
|
return;
|
265
256
|
}
|
266
257
|
e = this.getKey(e);
|
267
258
|
let r;
|
268
|
-
if (this.state.selectedKeys === "all")
|
269
|
-
|
270
|
-
|
271
|
-
], e, e);
|
259
|
+
if (this.state.selectedKeys === "all") r = new N([
|
260
|
+
e
|
261
|
+
], e, e);
|
272
262
|
else {
|
273
263
|
let n = this.state.selectedKeys, i = n.anchorKey || e;
|
274
264
|
r = new N(n, i, e);
|
275
|
-
for (let o of this.getKeyRange(i, n.currentKey || e))
|
276
|
-
|
277
|
-
for (let o of this.getKeyRange(e, i))
|
278
|
-
this.canSelectItem(o) && r.add(o);
|
265
|
+
for (let o of this.getKeyRange(i, n.currentKey || e)) r.delete(o);
|
266
|
+
for (let o of this.getKeyRange(e, i)) this.canSelectItem(o) && r.add(o);
|
279
267
|
}
|
280
268
|
this.state.setSelectedKeys(r);
|
281
269
|
}
|
@@ -287,32 +275,27 @@ class _t {
|
|
287
275
|
let n = [], i = e;
|
288
276
|
for (; i; ) {
|
289
277
|
let o = this.collection.getItem(i);
|
290
|
-
if ((o && o.type === "item" || o.type === "cell" && this.allowsCellSelection) && n.push(i), i === r)
|
291
|
-
return n;
|
278
|
+
if ((o && o.type === "item" || o.type === "cell" && this.allowsCellSelection) && n.push(i), i === r) return n;
|
292
279
|
i = this.collection.getKeyAfter(i);
|
293
280
|
}
|
294
281
|
return [];
|
295
282
|
}
|
296
283
|
getKey(e) {
|
297
284
|
let r = this.collection.getItem(e);
|
298
|
-
if (!r || r.type === "cell" && this.allowsCellSelection)
|
299
|
-
|
300
|
-
for (; r.type !== "item" && r.parentKey != null; )
|
301
|
-
r = this.collection.getItem(r.parentKey);
|
285
|
+
if (!r || r.type === "cell" && this.allowsCellSelection) return e;
|
286
|
+
for (; r.type !== "item" && r.parentKey != null; ) r = this.collection.getItem(r.parentKey);
|
302
287
|
return !r || r.type !== "item" ? null : r.key;
|
303
288
|
}
|
304
289
|
/**
|
305
290
|
* Toggles whether the given key is selected.
|
306
291
|
*/
|
307
292
|
toggleSelection(e) {
|
308
|
-
if (this.selectionMode === "none")
|
309
|
-
return;
|
293
|
+
if (this.selectionMode === "none") return;
|
310
294
|
if (this.selectionMode === "single" && !this.isSelected(e)) {
|
311
295
|
this.replaceSelection(e);
|
312
296
|
return;
|
313
297
|
}
|
314
|
-
if (e = this.getKey(e), e == null)
|
315
|
-
return;
|
298
|
+
if (e = this.getKey(e), e == null) return;
|
316
299
|
let r = new N(this.state.selectedKeys === "all" ? this.getSelectAllKeys() : this.state.selectedKeys);
|
317
300
|
r.has(e) ? r.delete(e) : this.canSelectItem(e) && (r.add(e), r.anchorKey = e, r.currentKey = e), !(this.disallowEmptySelection && r.size === 0) && this.state.setSelectedKeys(r);
|
318
301
|
}
|
@@ -320,8 +303,7 @@ class _t {
|
|
320
303
|
* Replaces the selection with only the given key.
|
321
304
|
*/
|
322
305
|
replaceSelection(e) {
|
323
|
-
if (this.selectionMode === "none" || (e = this.getKey(e), e == null))
|
324
|
-
return;
|
306
|
+
if (this.selectionMode === "none" || (e = this.getKey(e), e == null)) return;
|
325
307
|
let r = this.canSelectItem(e) ? new N([
|
326
308
|
e
|
327
309
|
], e, e) : new N();
|
@@ -331,8 +313,7 @@ class _t {
|
|
331
313
|
* Replaces the selection with the given keys.
|
332
314
|
*/
|
333
315
|
setSelectedKeys(e) {
|
334
|
-
if (this.selectionMode === "none")
|
335
|
-
return;
|
316
|
+
if (this.selectionMode === "none") return;
|
336
317
|
let r = new N();
|
337
318
|
for (let n of e)
|
338
319
|
if (n = this.getKey(n), n != null && (r.add(n), this.selectionMode === "single"))
|
@@ -376,23 +357,18 @@ class _t {
|
|
376
357
|
* Returns whether the current selection is equal to the given selection.
|
377
358
|
*/
|
378
359
|
isSelectionEqual(e) {
|
379
|
-
if (e === this.state.selectedKeys)
|
380
|
-
return !0;
|
360
|
+
if (e === this.state.selectedKeys) return !0;
|
381
361
|
let r = this.selectedKeys;
|
382
|
-
if (e.size !== r.size)
|
383
|
-
return !1;
|
362
|
+
if (e.size !== r.size) return !1;
|
384
363
|
for (let n of e)
|
385
|
-
if (!r.has(n))
|
386
|
-
return !1;
|
364
|
+
if (!r.has(n)) return !1;
|
387
365
|
for (let n of r)
|
388
|
-
if (!e.has(n))
|
389
|
-
return !1;
|
366
|
+
if (!e.has(n)) return !1;
|
390
367
|
return !0;
|
391
368
|
}
|
392
369
|
canSelectItem(e) {
|
393
370
|
var r;
|
394
|
-
if (this.state.selectionMode === "none" || this.state.disabledKeys.has(e))
|
395
|
-
return !1;
|
371
|
+
if (this.state.selectionMode === "none" || this.state.disabledKeys.has(e)) return !1;
|
396
372
|
let n = this.collection.getItem(e);
|
397
373
|
return !(!n || !(n == null || (r = n.props) === null || r === void 0) && r.isDisabled || n.type === "cell" && !this.allowsCellSelection);
|
398
374
|
}
|
@@ -510,8 +486,7 @@ function Qt(t) {
|
|
510
486
|
function qe(t, e) {
|
511
487
|
let r = null;
|
512
488
|
if (t) {
|
513
|
-
for (r = t.getFirstKey(); e.has(r) && r !== t.getLastKey(); )
|
514
|
-
r = t.getKeyAfter(r);
|
489
|
+
for (r = t.getFirstKey(); e.has(r) && r !== t.getLastKey(); ) r = t.getKeyAfter(r);
|
515
490
|
e.has(r) && r === t.getLastKey() && (r = t.getFirstKey());
|
516
491
|
}
|
517
492
|
return r;
|
@@ -596,8 +571,7 @@ function yt(t) {
|
|
596
571
|
}), i;
|
597
572
|
}
|
598
573
|
function ur(t, e) {
|
599
|
-
if (t === e)
|
600
|
-
return t;
|
574
|
+
if (t === e) return t;
|
601
575
|
let r = $e.get(t);
|
602
576
|
if (r)
|
603
577
|
return r(e), e;
|
@@ -606,8 +580,7 @@ function ur(t, e) {
|
|
606
580
|
}
|
607
581
|
function vt(...t) {
|
608
582
|
return (...e) => {
|
609
|
-
for (let r of t)
|
610
|
-
typeof r == "function" && r(...e);
|
583
|
+
for (let r of t) typeof r == "function" && r(...e);
|
611
584
|
};
|
612
585
|
}
|
613
586
|
const D = (t) => {
|
@@ -616,21 +589,15 @@ const D = (t) => {
|
|
616
589
|
}, _ = (t) => t && "window" in t && t.window === t ? t : D(t).defaultView || window;
|
617
590
|
function gt(t) {
|
618
591
|
var e, r, n = "";
|
619
|
-
if (typeof t == "string" || typeof t == "number")
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
for (e = 0; e < i; e++)
|
625
|
-
t[e] && (r = gt(t[e])) && (n && (n += " "), n += r);
|
626
|
-
} else
|
627
|
-
for (r in t)
|
628
|
-
t[r] && (n && (n += " "), n += r);
|
592
|
+
if (typeof t == "string" || typeof t == "number") n += t;
|
593
|
+
else if (typeof t == "object") if (Array.isArray(t)) {
|
594
|
+
var i = t.length;
|
595
|
+
for (e = 0; e < i; e++) t[e] && (r = gt(t[e])) && (n && (n += " "), n += r);
|
596
|
+
} else for (r in t) t[r] && (n && (n += " "), n += r);
|
629
597
|
return n;
|
630
598
|
}
|
631
599
|
function dr() {
|
632
|
-
for (var t, e, r = 0, n = "", i = arguments.length; r < i; r++)
|
633
|
-
(t = arguments[r]) && (e = gt(t)) && (n && (n += " "), n += e);
|
600
|
+
for (var t, e, r = 0, n = "", i = arguments.length; r < i; r++) (t = arguments[r]) && (e = gt(t)) && (n && (n += " "), n += e);
|
634
601
|
return n;
|
635
602
|
}
|
636
603
|
function X(...t) {
|
@@ -667,15 +634,13 @@ const fr = /* @__PURE__ */ new Set([
|
|
667
634
|
]), yr = /^(data-.*)$/;
|
668
635
|
function vr(t, e = {}) {
|
669
636
|
let { labelable: r, isLink: n, propNames: i } = e, o = {};
|
670
|
-
for (const s in t)
|
671
|
-
Object.prototype.hasOwnProperty.call(t, s) && (fr.has(s) || r && pr.has(s) || n && br.has(s) || i != null && i.has(s) || yr.test(s)) && (o[s] = t[s]);
|
637
|
+
for (const s in t) Object.prototype.hasOwnProperty.call(t, s) && (fr.has(s) || r && pr.has(s) || n && br.has(s) || i != null && i.has(s) || yr.test(s)) && (o[s] = t[s]);
|
672
638
|
return o;
|
673
639
|
}
|
674
640
|
function V(t) {
|
675
|
-
if (gr())
|
676
|
-
|
677
|
-
|
678
|
-
});
|
641
|
+
if (gr()) t.focus({
|
642
|
+
preventScroll: !0
|
643
|
+
});
|
679
644
|
else {
|
680
645
|
let e = hr(t);
|
681
646
|
t.focus(), $r(e);
|
@@ -780,8 +745,7 @@ function Z(t, e, r = !0) {
|
|
780
745
|
}
|
781
746
|
Z.isOpening = !1;
|
782
747
|
function Er(t, e) {
|
783
|
-
if (t instanceof HTMLAnchorElement)
|
784
|
-
e(t);
|
748
|
+
if (t instanceof HTMLAnchorElement) e(t);
|
785
749
|
else if (t.hasAttribute("data-href")) {
|
786
750
|
let r = document.createElement("a");
|
787
751
|
r.href = t.getAttribute("data-href"), t.hasAttribute("data-target") && (r.target = t.getAttribute("data-target")), t.hasAttribute("data-rel") && (r.rel = t.getAttribute("data-rel")), t.hasAttribute("data-download") && (r.download = t.getAttribute("data-download")), t.hasAttribute("data-ping") && (r.ping = t.getAttribute("data-ping")), t.hasAttribute("data-referrer-policy") && (r.referrerPolicy = t.getAttribute("data-referrer-policy")), t.appendChild(r), e(r), t.removeChild(r);
|
@@ -803,25 +767,21 @@ function kr(t) {
|
|
803
767
|
}
|
804
768
|
let ne = /* @__PURE__ */ new Map(), ke = /* @__PURE__ */ new Set();
|
805
769
|
function Ye() {
|
806
|
-
if (typeof window > "u")
|
807
|
-
return;
|
770
|
+
if (typeof window > "u") return;
|
808
771
|
function t(n) {
|
809
772
|
return "propertyName" in n;
|
810
773
|
}
|
811
774
|
let e = (n) => {
|
812
|
-
if (!t(n) || !n.target)
|
813
|
-
return;
|
775
|
+
if (!t(n) || !n.target) return;
|
814
776
|
let i = ne.get(n.target);
|
815
777
|
i || (i = /* @__PURE__ */ new Set(), ne.set(n.target, i), n.target.addEventListener("transitioncancel", r, {
|
816
778
|
once: !0
|
817
779
|
})), i.add(n.propertyName);
|
818
780
|
}, r = (n) => {
|
819
|
-
if (!t(n) || !n.target)
|
820
|
-
return;
|
781
|
+
if (!t(n) || !n.target) return;
|
821
782
|
let i = ne.get(n.target);
|
822
783
|
if (i && (i.delete(n.propertyName), i.size === 0 && (n.target.removeEventListener("transitioncancel", r), ne.delete(n.target)), ne.size === 0)) {
|
823
|
-
for (let o of ke)
|
824
|
-
o();
|
784
|
+
for (let o of ke) o();
|
825
785
|
ke.clear();
|
826
786
|
}
|
827
787
|
};
|
@@ -899,8 +859,7 @@ const Pe = /* @__PURE__ */ new Map();
|
|
899
859
|
function Dr(t) {
|
900
860
|
let [e, r] = R();
|
901
861
|
return ue(() => {
|
902
|
-
if (!t)
|
903
|
-
return;
|
862
|
+
if (!t) return;
|
904
863
|
let n = Pe.get(t);
|
905
864
|
if (n)
|
906
865
|
r(n.element.id);
|
@@ -925,8 +884,7 @@ function Dr(t) {
|
|
925
884
|
function Ar(t, e, r, n) {
|
926
885
|
let i = re(r), o = r == null;
|
927
886
|
z(() => {
|
928
|
-
if (o || !t.current)
|
929
|
-
return;
|
887
|
+
if (o || !t.current) return;
|
930
888
|
let s = t.current;
|
931
889
|
return s.addEventListener(e, i, n), () => {
|
932
890
|
s.removeEventListener(e, i, n);
|
@@ -960,8 +918,7 @@ function Je(t, e) {
|
|
960
918
|
let s = document.scrollingElement || document.documentElement;
|
961
919
|
if (window.getComputedStyle(s).overflow === "hidden") {
|
962
920
|
let p = Ir(t);
|
963
|
-
for (let y of p)
|
964
|
-
Tt(y, t);
|
921
|
+
for (let y of p) Tt(y, t);
|
965
922
|
} else {
|
966
923
|
var r;
|
967
924
|
let { left: p, top: y } = t.getBoundingClientRect();
|
@@ -1000,8 +957,7 @@ function zr(t) {
|
|
1000
957
|
timeout: null
|
1001
958
|
}).current, o = (s) => {
|
1002
959
|
let u = Nr(s.key);
|
1003
|
-
if (!u || s.ctrlKey || s.metaKey || !s.currentTarget.contains(s.target))
|
1004
|
-
return;
|
960
|
+
if (!u || s.ctrlKey || s.metaKey || !s.currentTarget.contains(s.target)) return;
|
1005
961
|
u === " " && i.search.trim().length > 0 && (s.preventDefault(), "continuePropagation" in s || s.stopPropagation()), i.search += u;
|
1006
962
|
let p = e.getKeyForSearch(i.search, r.focusedKey);
|
1007
963
|
p == null && (p = e.getKeyForSearch(i.search)), p != null && (r.setFocusedKey(p), n && n(p)), clearTimeout(i.timeout), i.timeout = setTimeout(() => {
|
@@ -1027,13 +983,11 @@ function Ze(t) {
|
|
1027
983
|
Ie = e.documentElement.style.webkitUserSelect, e.documentElement.style.webkitUserSelect = "none";
|
1028
984
|
}
|
1029
985
|
le = "disabled";
|
1030
|
-
} else
|
1031
|
-
(t instanceof HTMLElement || t instanceof SVGElement) && (ve.set(t, t.style.userSelect), t.style.userSelect = "none");
|
986
|
+
} else (t instanceof HTMLElement || t instanceof SVGElement) && (ve.set(t, t.style.userSelect), t.style.userSelect = "none");
|
1032
987
|
}
|
1033
988
|
function pe(t) {
|
1034
989
|
if (ze()) {
|
1035
|
-
if (le !== "disabled")
|
1036
|
-
return;
|
990
|
+
if (le !== "disabled") return;
|
1037
991
|
le = "restoring", setTimeout(() => {
|
1038
992
|
mt(() => {
|
1039
993
|
if (le === "restoring") {
|
@@ -1056,8 +1010,7 @@ function Br(t, e) {
|
|
1056
1010
|
return e.get ? e.get.call(t) : e.value;
|
1057
1011
|
}
|
1058
1012
|
function Pt(t, e, r) {
|
1059
|
-
if (!e.has(t))
|
1060
|
-
throw new TypeError("attempted to " + r + " private field on non-instance");
|
1013
|
+
if (!e.has(t)) throw new TypeError("attempted to " + r + " private field on non-instance");
|
1061
1014
|
return e.get(t);
|
1062
1015
|
}
|
1063
1016
|
function Rr(t, e) {
|
@@ -1072,8 +1025,7 @@ function Hr(t, e, r) {
|
|
1072
1025
|
Ur(t, e), e.set(t, r);
|
1073
1026
|
}
|
1074
1027
|
function Wr(t, e, r) {
|
1075
|
-
if (e.set)
|
1076
|
-
e.set.call(t, r);
|
1028
|
+
if (e.set) e.set.call(t, r);
|
1077
1029
|
else {
|
1078
1030
|
if (!e.writable)
|
1079
1031
|
throw new TypeError("attempted to set read only private field");
|
@@ -1135,8 +1087,7 @@ function Et(t) {
|
|
1135
1087
|
pointerType: null
|
1136
1088
|
}), { addGlobalListener: w, removeAllGlobalListeners: M } = Kt(), x = re((l, $) => {
|
1137
1089
|
let f = S.current;
|
1138
|
-
if (s || f.didFirePressStart)
|
1139
|
-
return !1;
|
1090
|
+
if (s || f.didFirePressStart) return !1;
|
1140
1091
|
let d = !0;
|
1141
1092
|
if (f.isTriggeringEvent = !0, n) {
|
1142
1093
|
let K = new ye("pressstart", $, l);
|
@@ -1145,8 +1096,7 @@ function Et(t) {
|
|
1145
1096
|
return r && r(!0), f.isTriggeringEvent = !1, f.didFirePressStart = !0, L(!0), d;
|
1146
1097
|
}), E = re((l, $, f = !0) => {
|
1147
1098
|
let d = S.current;
|
1148
|
-
if (!d.didFirePressStart)
|
1149
|
-
return !1;
|
1099
|
+
if (!d.didFirePressStart) return !1;
|
1150
1100
|
d.ignoreClickAfterPress = !0, d.didFirePressStart = !1, d.isTriggeringEvent = !0;
|
1151
1101
|
let K = !0;
|
1152
1102
|
if (i) {
|
@@ -1160,8 +1110,7 @@ function Et(t) {
|
|
1160
1110
|
return d.isTriggeringEvent = !1, K;
|
1161
1111
|
}), I = re((l, $) => {
|
1162
1112
|
let f = S.current;
|
1163
|
-
if (s)
|
1164
|
-
return !1;
|
1113
|
+
if (s) return !1;
|
1165
1114
|
if (o) {
|
1166
1115
|
f.isTriggeringEvent = !0;
|
1167
1116
|
let d = new ye("pressup", $, l);
|
@@ -1188,8 +1137,7 @@ function Et(t) {
|
|
1188
1137
|
w(D(d.currentTarget), "keyup", vt(P, f), !0);
|
1189
1138
|
}
|
1190
1139
|
a && d.stopPropagation(), d.metaKey && J() && ((K = l.metaKeyEvents) === null || K === void 0 || K.set(d.key, d.nativeEvent));
|
1191
|
-
} else
|
1192
|
-
d.key === "Meta" && (l.metaKeyEvents = /* @__PURE__ */ new Map());
|
1140
|
+
} else d.key === "Meta" && (l.metaKeyEvents = /* @__PURE__ */ new Map());
|
1193
1141
|
},
|
1194
1142
|
onClick(d) {
|
1195
1143
|
if (!(d && !d.currentTarget.contains(d.target)) && d && d.button === 0 && !l.isTriggeringEvent && !Z.isOpening) {
|
@@ -1213,14 +1161,12 @@ function Et(t) {
|
|
1213
1161
|
var c;
|
1214
1162
|
let P = l.metaKeyEvents;
|
1215
1163
|
l.metaKeyEvents = void 0;
|
1216
|
-
for (let F of P.values())
|
1217
|
-
(c = l.target) === null || c === void 0 || c.dispatchEvent(new KeyboardEvent("keyup", F));
|
1164
|
+
for (let F of P.values()) (c = l.target) === null || c === void 0 || c.dispatchEvent(new KeyboardEvent("keyup", F));
|
1218
1165
|
}
|
1219
1166
|
};
|
1220
1167
|
if (typeof PointerEvent < "u") {
|
1221
1168
|
$.onPointerDown = (c) => {
|
1222
|
-
if (c.button !== 0 || !c.currentTarget.contains(c.target))
|
1223
|
-
return;
|
1169
|
+
if (c.button !== 0 || !c.currentTarget.contains(c.target)) return;
|
1224
1170
|
if (Fr(c.nativeEvent)) {
|
1225
1171
|
l.pointerType = "virtual";
|
1226
1172
|
return;
|
@@ -1245,21 +1191,18 @@ function Et(t) {
|
|
1245
1191
|
};
|
1246
1192
|
} else {
|
1247
1193
|
$.onMouseDown = (a) => {
|
1248
|
-
if (a.button !== 0 || !a.currentTarget.contains(a.target))
|
1249
|
-
return;
|
1194
|
+
if (a.button !== 0 || !a.currentTarget.contains(a.target)) return;
|
1250
1195
|
if (xe(a.currentTarget) && a.preventDefault(), l.ignoreEmulatedMouseEvents) {
|
1251
1196
|
a.stopPropagation();
|
1252
1197
|
return;
|
1253
1198
|
}
|
1254
1199
|
l.isPressed = !0, l.isOverTarget = !0, l.target = a.currentTarget, l.pointerType = Le(a.nativeEvent) ? "virtual" : "mouse", !s && !p && V(a.currentTarget), x(a, l.pointerType) && a.stopPropagation(), w(D(a.currentTarget), "mouseup", d, !1);
|
1255
1200
|
}, $.onMouseEnter = (a) => {
|
1256
|
-
if (!a.currentTarget.contains(a.target))
|
1257
|
-
return;
|
1201
|
+
if (!a.currentTarget.contains(a.target)) return;
|
1258
1202
|
let c = !0;
|
1259
1203
|
l.isPressed && !l.ignoreEmulatedMouseEvents && l.pointerType != null && (l.isOverTarget = !0, c = x(a, l.pointerType)), c && a.stopPropagation();
|
1260
1204
|
}, $.onMouseLeave = (a) => {
|
1261
|
-
if (!a.currentTarget.contains(a.target))
|
1262
|
-
return;
|
1205
|
+
if (!a.currentTarget.contains(a.target)) return;
|
1263
1206
|
let c = !0;
|
1264
1207
|
l.isPressed && !l.ignoreEmulatedMouseEvents && l.pointerType != null && (l.isOverTarget = !1, c = E(a, l.pointerType, !1), A(a)), c && a.stopPropagation();
|
1265
1208
|
}, $.onMouseUp = (a) => {
|
@@ -1275,15 +1218,12 @@ function Et(t) {
|
|
1275
1218
|
}
|
1276
1219
|
};
|
1277
1220
|
$.onTouchStart = (a) => {
|
1278
|
-
if (!a.currentTarget.contains(a.target))
|
1279
|
-
return;
|
1221
|
+
if (!a.currentTarget.contains(a.target)) return;
|
1280
1222
|
let c = Vr(a.nativeEvent);
|
1281
|
-
if (!c)
|
1282
|
-
return;
|
1223
|
+
if (!c) return;
|
1283
1224
|
l.activePointerId = c.identifier, l.ignoreEmulatedMouseEvents = !0, l.isOverTarget = !0, l.isPressed = !0, l.target = a.currentTarget, l.pointerType = "touch", !s && !p && V(a.currentTarget), g || Ze(l.target), x(a, l.pointerType) && a.stopPropagation(), w(_(a.currentTarget), "scroll", K, !0);
|
1284
1225
|
}, $.onTouchMove = (a) => {
|
1285
|
-
if (!a.currentTarget.contains(a.target))
|
1286
|
-
return;
|
1226
|
+
if (!a.currentTarget.contains(a.target)) return;
|
1287
1227
|
if (!l.isPressed) {
|
1288
1228
|
a.stopPropagation();
|
1289
1229
|
return;
|
@@ -1291,8 +1231,7 @@ function Et(t) {
|
|
1291
1231
|
let c = tt(a.nativeEvent, l.activePointerId), P = !0;
|
1292
1232
|
c && te(c, a.currentTarget) ? !l.isOverTarget && l.pointerType != null && (l.isOverTarget = !0, P = x(a, l.pointerType)) : l.isOverTarget && l.pointerType != null && (l.isOverTarget = !1, P = E(a, l.pointerType, !1), A(a)), P && a.stopPropagation();
|
1293
1233
|
}, $.onTouchEnd = (a) => {
|
1294
|
-
if (!a.currentTarget.contains(a.target))
|
1295
|
-
return;
|
1234
|
+
if (!a.currentTarget.contains(a.target)) return;
|
1296
1235
|
if (!l.isPressed) {
|
1297
1236
|
a.stopPropagation();
|
1298
1237
|
return;
|
@@ -1354,8 +1293,7 @@ function tt(t, e) {
|
|
1354
1293
|
const r = t.changedTouches;
|
1355
1294
|
for (let n = 0; n < r.length; n++) {
|
1356
1295
|
const i = r[n];
|
1357
|
-
if (i.identifier === e)
|
1358
|
-
return i;
|
1296
|
+
if (i.identifier === e) return i;
|
1359
1297
|
}
|
1360
1298
|
return null;
|
1361
1299
|
}
|
@@ -1406,8 +1344,7 @@ function xt(t, e) {
|
|
1406
1344
|
}
|
1407
1345
|
let de = null, Yr = /* @__PURE__ */ new Set(), ae = /* @__PURE__ */ new Map(), Q = !1, Ce = !1;
|
1408
1346
|
function Re(t, e) {
|
1409
|
-
for (let r of Yr)
|
1410
|
-
r(t, e);
|
1347
|
+
for (let r of Yr) r(t, e);
|
1411
1348
|
}
|
1412
1349
|
function _r(t) {
|
1413
1350
|
return !(t.metaKey || !J() && t.altKey || t.ctrlKey || t.key === "Control" || t.key === "Shift" || t.key === "Meta");
|
@@ -1428,8 +1365,7 @@ function Mt() {
|
|
1428
1365
|
Q = !1, Ce = !0;
|
1429
1366
|
}
|
1430
1367
|
function nt(t) {
|
1431
|
-
if (typeof window > "u" || ae.get(_(t)))
|
1432
|
-
return;
|
1368
|
+
if (typeof window > "u" || ae.get(_(t))) return;
|
1433
1369
|
const e = _(t), r = D(t);
|
1434
1370
|
let n = e.HTMLElement.prototype.focus;
|
1435
1371
|
e.HTMLElement.prototype.focus = function() {
|
@@ -1507,13 +1443,11 @@ function Ae(t) {
|
|
1507
1443
|
mt(() => {
|
1508
1444
|
e.activeElement === r && t.isConnected && V(t);
|
1509
1445
|
});
|
1510
|
-
} else
|
1511
|
-
V(t);
|
1446
|
+
} else V(t);
|
1512
1447
|
}
|
1513
1448
|
function en(t) {
|
1514
1449
|
const e = _(t);
|
1515
|
-
if (!(t instanceof e.HTMLElement) && !(t instanceof e.SVGElement))
|
1516
|
-
return !1;
|
1450
|
+
if (!(t instanceof e.HTMLElement) && !(t instanceof e.SVGElement)) return !1;
|
1517
1451
|
let { display: r, visibility: n } = t.style, i = r !== "none" && n !== "hidden" && n !== "collapse";
|
1518
1452
|
if (i) {
|
1519
1453
|
const { getComputedStyle: o } = t.ownerDocument.defaultView;
|
@@ -1567,8 +1501,7 @@ class He {
|
|
1567
1501
|
}
|
1568
1502
|
addTreeNode(e, r, n) {
|
1569
1503
|
let i = this.fastMap.get(r ?? null);
|
1570
|
-
if (!i)
|
1571
|
-
return;
|
1504
|
+
if (!i) return;
|
1572
1505
|
let o = new it({
|
1573
1506
|
scopeRef: e
|
1574
1507
|
});
|
@@ -1578,29 +1511,23 @@ class He {
|
|
1578
1511
|
this.fastMap.set(e.scopeRef, e);
|
1579
1512
|
}
|
1580
1513
|
removeTreeNode(e) {
|
1581
|
-
if (e === null)
|
1582
|
-
return;
|
1514
|
+
if (e === null) return;
|
1583
1515
|
let r = this.fastMap.get(e);
|
1584
|
-
if (!r)
|
1585
|
-
return;
|
1516
|
+
if (!r) return;
|
1586
1517
|
let n = r.parent;
|
1587
|
-
for (let o of this.traverse())
|
1588
|
-
o !== r && r.nodeToRestore && o.nodeToRestore && r.scopeRef && r.scopeRef.current && Dt(o.nodeToRestore, r.scopeRef.current) && (o.nodeToRestore = r.nodeToRestore);
|
1518
|
+
for (let o of this.traverse()) o !== r && r.nodeToRestore && o.nodeToRestore && r.scopeRef && r.scopeRef.current && Dt(o.nodeToRestore, r.scopeRef.current) && (o.nodeToRestore = r.nodeToRestore);
|
1589
1519
|
let i = r.children;
|
1590
1520
|
n && (n.removeChild(r), i.size > 0 && i.forEach((o) => n && n.addChild(o))), this.fastMap.delete(r.scopeRef);
|
1591
1521
|
}
|
1592
1522
|
// Pre Order Depth First
|
1593
1523
|
*traverse(e = this.root) {
|
1594
|
-
if (e.scopeRef != null && (yield e), e.children.size > 0)
|
1595
|
-
for (let r of e.children)
|
1596
|
-
yield* this.traverse(r);
|
1524
|
+
if (e.scopeRef != null && (yield e), e.children.size > 0) for (let r of e.children) yield* this.traverse(r);
|
1597
1525
|
}
|
1598
1526
|
clone() {
|
1599
1527
|
var e;
|
1600
1528
|
let r = new He();
|
1601
1529
|
var n;
|
1602
|
-
for (let i of this.traverse())
|
1603
|
-
r.addTreeNode(i.scopeRef, (n = (e = i.parent) === null || e === void 0 ? void 0 : e.scopeRef) !== null && n !== void 0 ? n : null, i.nodeToRestore);
|
1530
|
+
for (let i of this.traverse()) r.addTreeNode(i.scopeRef, (n = (e = i.parent) === null || e === void 0 ? void 0 : e.scopeRef) !== null && n !== void 0 ? n : null, i.nodeToRestore);
|
1604
1531
|
return r;
|
1605
1532
|
}
|
1606
1533
|
constructor() {
|
@@ -1684,10 +1611,8 @@ const on = /* @__PURE__ */ new Set([
|
|
1684
1611
|
function an(t) {
|
1685
1612
|
if (Intl.Locale) {
|
1686
1613
|
let r = new Intl.Locale(t).maximize(), n = typeof r.getTextInfo == "function" ? r.getTextInfo() : r.textInfo;
|
1687
|
-
if (n)
|
1688
|
-
|
1689
|
-
if (r.script)
|
1690
|
-
return on.has(r.script);
|
1614
|
+
if (n) return n.direction === "rtl";
|
1615
|
+
if (r.script) return on.has(r.script);
|
1691
1616
|
}
|
1692
1617
|
let e = t.split("-")[0];
|
1693
1618
|
return sn.has(e);
|
@@ -1710,8 +1635,7 @@ function Ft() {
|
|
1710
1635
|
let Fe = Ft(), se = /* @__PURE__ */ new Set();
|
1711
1636
|
function lt() {
|
1712
1637
|
Fe = Ft();
|
1713
|
-
for (let t of se)
|
1714
|
-
t(Fe);
|
1638
|
+
for (let t of se) t(Fe);
|
1715
1639
|
}
|
1716
1640
|
function un() {
|
1717
1641
|
let t = bt(), [e, r] = R(Fe);
|
@@ -1729,8 +1653,7 @@ function Ot() {
|
|
1729
1653
|
}
|
1730
1654
|
function fn(t) {
|
1731
1655
|
let { selectionManager: e, keyboardDelegate: r, ref: n, autoFocus: i = !1, shouldFocusWrap: o = !1, disallowEmptySelection: s = !1, disallowSelectAll: u = !1, selectOnFocus: p = e.selectionBehavior === "replace", disallowTypeAhead: y = !1, shouldUseVirtualFocus: g, allowsTabNavigation: T = !1, isVirtualized: h, scrollRef: v = n, linkBehavior: L = "action" } = t, { direction: S } = Ot(), w = Ne(), M = (f) => {
|
1732
|
-
if (f.altKey && f.key === "Tab" && f.preventDefault(), !n.current.contains(f.target))
|
1733
|
-
return;
|
1656
|
+
if (f.altKey && f.key === "Tab" && f.preventDefault(), !n.current.contains(f.target)) return;
|
1734
1657
|
const d = (m, q) => {
|
1735
1658
|
if (m != null) {
|
1736
1659
|
if (e.isLink(m) && L === "selection" && p && !Me(f)) {
|
@@ -1741,8 +1664,7 @@ function fn(t) {
|
|
1741
1664
|
w.open(ee, f, je.href, je.routerOptions);
|
1742
1665
|
return;
|
1743
1666
|
}
|
1744
|
-
if (e.setFocusedKey(m, q), e.isLink(m) && L === "override")
|
1745
|
-
return;
|
1667
|
+
if (e.setFocusedKey(m, q), e.isLink(m) && L === "override") return;
|
1746
1668
|
f.shiftKey && e.selectionMode === "multiple" ? e.extendSelection(m) : p && !Me(f) && e.replaceSelection(m);
|
1747
1669
|
}
|
1748
1670
|
};
|
@@ -1815,8 +1737,7 @@ function fn(t) {
|
|
1815
1737
|
break;
|
1816
1738
|
case "Tab":
|
1817
1739
|
if (!T) {
|
1818
|
-
if (f.shiftKey)
|
1819
|
-
n.current.focus();
|
1740
|
+
if (f.shiftKey) n.current.focus();
|
1820
1741
|
else {
|
1821
1742
|
let m = At(n.current, {
|
1822
1743
|
tabbable: !0
|
@@ -1851,8 +1772,7 @@ function fn(t) {
|
|
1851
1772
|
}, c = f.relatedTarget;
|
1852
1773
|
var d, K;
|
1853
1774
|
c && f.currentTarget.compareDocumentPosition(c) & Node.DOCUMENT_POSITION_FOLLOWING ? a((d = e.lastSelectedKey) !== null && d !== void 0 ? d : r.getLastKey()) : a((K = e.firstSelectedKey) !== null && K !== void 0 ? K : r.getFirstKey());
|
1854
|
-
} else
|
1855
|
-
h || (v.current.scrollTop = x.current.top, v.current.scrollLeft = x.current.left);
|
1775
|
+
} else h || (v.current.scrollTop = x.current.top, v.current.scrollLeft = x.current.left);
|
1856
1776
|
if (!h && e.focusedKey != null) {
|
1857
1777
|
let a = v.current.querySelector(`[data-key="${CSS.escape(e.focusedKey.toString())}"]`);
|
1858
1778
|
a && (a.contains(document.activeElement) || V(a), De() === "keyboard" && Je(a, {
|
@@ -1870,11 +1790,10 @@ function fn(t) {
|
|
1870
1790
|
i === "first" && (f = r.getFirstKey()), i === "last" && (f = r.getLastKey());
|
1871
1791
|
let d = e.selectedKeys;
|
1872
1792
|
if (d.size) {
|
1873
|
-
for (let K of d)
|
1874
|
-
|
1875
|
-
|
1876
|
-
|
1877
|
-
}
|
1793
|
+
for (let K of d) if (e.canSelectItem(K)) {
|
1794
|
+
f = K;
|
1795
|
+
break;
|
1796
|
+
}
|
1878
1797
|
}
|
1879
1798
|
e.setFocused(!0), e.setFocusedKey(f), f == null && !g && Ae(n.current);
|
1880
1799
|
}
|
@@ -1918,18 +1837,15 @@ function fn(t) {
|
|
1918
1837
|
}
|
1919
1838
|
function pn(t) {
|
1920
1839
|
let { selectionManager: e, key: r, ref: n, shouldSelectOnPressUp: i, shouldUseVirtualFocus: o, focus: s, isDisabled: u, onAction: p, allowsDifferentPressOrigin: y, linkBehavior: g = "action" } = t, T = Ne(), h = (b) => {
|
1921
|
-
if (b.pointerType === "keyboard" && Me(b))
|
1922
|
-
e.toggleSelection(r);
|
1840
|
+
if (b.pointerType === "keyboard" && Me(b)) e.toggleSelection(r);
|
1923
1841
|
else {
|
1924
|
-
if (e.selectionMode === "none")
|
1925
|
-
return;
|
1842
|
+
if (e.selectionMode === "none") return;
|
1926
1843
|
if (e.isLink(r)) {
|
1927
1844
|
if (g === "selection") {
|
1928
1845
|
let W = e.getItemProps(r);
|
1929
1846
|
T.open(n.current, b, W.href, W.routerOptions), e.setSelectedKeys(e.selectedKeys);
|
1930
1847
|
return;
|
1931
|
-
} else if (g === "override" || g === "none")
|
1932
|
-
return;
|
1848
|
+
} else if (g === "override" || g === "none") return;
|
1933
1849
|
}
|
1934
1850
|
e.selectionMode === "single" ? e.isSelected(r) && !e.disallowEmptySelection ? e.toggleSelection(r) : e.replaceSelection(r) : b && b.shiftKey ? e.extendSelection(r) : e.selectionBehavior === "toggle" || b && (ie(b) || b.pointerType === "touch" || b.pointerType === "virtual") ? e.toggleSelection(r) : e.replaceSelection(r);
|
1935
1851
|
}
|
@@ -1965,11 +1881,9 @@ function pn(t) {
|
|
1965
1881
|
b.pointerType !== "keyboard" && w && h(b);
|
1966
1882
|
}, f.onPress = x ? $ : null) : f.onPress = (b) => {
|
1967
1883
|
if (x || E && b.pointerType !== "mouse") {
|
1968
|
-
if (b.pointerType === "keyboard" && !ot())
|
1969
|
-
return;
|
1884
|
+
if (b.pointerType === "keyboard" && !ot()) return;
|
1970
1885
|
$(b);
|
1971
|
-
} else
|
1972
|
-
b.pointerType !== "keyboard" && w && h(b);
|
1886
|
+
} else b.pointerType !== "keyboard" && w && h(b);
|
1973
1887
|
}) : (f.onPressStart = (b) => {
|
1974
1888
|
C.current = b.pointerType, H.current = A, l.current = x, w && (b.pointerType === "mouse" && !x || b.pointerType === "keyboard" && (!M || st())) && h(b);
|
1975
1889
|
}, f.onPress = (b) => {
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sps-woodland/tabs",
|
3
3
|
"description": "SPS Woodland Design System tabs component",
|
4
|
-
"version": "8.12.
|
4
|
+
"version": "8.12.1",
|
5
5
|
"author": "SPS Commerce",
|
6
6
|
"license": "UNLICENSED",
|
7
7
|
"repository": "https://github.com/SPSCommerce/woodland/tree/main/packages/@sps-woodland/tabs",
|
@@ -30,8 +30,8 @@
|
|
30
30
|
"@spscommerce/utils": "^7.0.0",
|
31
31
|
"react": "^16.14.0",
|
32
32
|
"react-dom": "^16.14.0",
|
33
|
-
"@sps-woodland/core": "8.12.
|
34
|
-
"@sps-woodland/tokens": "8.12.
|
33
|
+
"@sps-woodland/core": "8.12.1",
|
34
|
+
"@sps-woodland/tokens": "8.12.1"
|
35
35
|
},
|
36
36
|
"devDependencies": {
|
37
37
|
"@react-stately/collections": "^3.6.0",
|
@@ -45,8 +45,8 @@
|
|
45
45
|
"@vanilla-extract/vite-plugin": "^3.7.1",
|
46
46
|
"react": "^16.14.0",
|
47
47
|
"react-dom": "^16.14.0",
|
48
|
-
"@sps-woodland/core": "8.12.
|
49
|
-
"@sps-woodland/tokens": "8.12.
|
48
|
+
"@sps-woodland/core": "8.12.1",
|
49
|
+
"@sps-woodland/tokens": "8.12.1"
|
50
50
|
},
|
51
51
|
"dependencies": {
|
52
52
|
"@react-aria/tabs": "^3.3.4",
|
@@ -58,6 +58,6 @@
|
|
58
58
|
"build:types": "tsc --emitDeclarationOnly --declaration --declarationDir lib",
|
59
59
|
"watch": "vite build --watch",
|
60
60
|
"clean": "git clean -fdX",
|
61
|
-
"pub": "node ../../../scripts/publish-package.
|
61
|
+
"pub": "node ../../../scripts/publish-package.mjs"
|
62
62
|
}
|
63
63
|
}
|