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