@purpurds/tabs 5.1.0 → 5.1.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/dist/LICENSE.txt +1 -1
- package/dist/styles.css +1 -1
- package/dist/tabs.cjs.js +3 -3
- package/dist/tabs.cjs.js.map +1 -1
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.es.js +110 -107
- package/dist/tabs.es.js.map +1 -1
- package/package.json +4 -4
- package/src/tab-content.module.scss +6 -10
- package/src/tab-header.module.scss +6 -5
- package/src/tabs.stories.tsx +3 -3
- package/src/tabs.tsx +5 -1
package/dist/tabs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../src/tabs.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAY,YAAY,EAA+B,MAAM,OAAO,CAAC;AAKnF,OAAO,EAAgB,UAAU,EAAE,MAAM,eAAe,CAAC;AAGzD,OAAO,EAA8B,eAAe,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEjG,KAAK,SAAS,GAAG;IACf,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,OAAO,UAAU,CAAC,CAAC,GAAG,YAAY,CAAC,OAAO,UAAU,CAAC,CAAC;IACnF,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;SAEK;IACL,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AA4CF,eAAO,MAAM,IAAI,EAAE,OAAO,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../src/tabs.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAY,YAAY,EAA+B,MAAM,OAAO,CAAC;AAKnF,OAAO,EAAgB,UAAU,EAAE,MAAM,eAAe,CAAC;AAGzD,OAAO,EAA8B,eAAe,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEjG,KAAK,SAAS,GAAG;IACf,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,OAAO,UAAU,CAAC,CAAC,GAAG,YAAY,CAAC,OAAO,UAAU,CAAC,CAAC;IACnF,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;SAEK;IACL,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AA4CF,eAAO,MAAM,IAAI,EAAE,OAAO,CAAC,SAAS,CAmMnC,CAAC;AAIF,cAAc,cAAc,CAAC"}
|
package/dist/tabs.es.js
CHANGED
|
@@ -91,15 +91,15 @@ const Be = /* @__PURE__ */ Ue(Ve), je = {
|
|
|
91
91
|
}
|
|
92
92
|
);
|
|
93
93
|
};
|
|
94
|
-
function
|
|
95
|
-
return
|
|
94
|
+
function C() {
|
|
95
|
+
return C = Object.assign ? Object.assign.bind() : function(e) {
|
|
96
96
|
for (var t = 1; t < arguments.length; t++) {
|
|
97
97
|
var n = arguments[t];
|
|
98
98
|
for (var o in n)
|
|
99
99
|
Object.prototype.hasOwnProperty.call(n, o) && (e[o] = n[o]);
|
|
100
100
|
}
|
|
101
101
|
return e;
|
|
102
|
-
},
|
|
102
|
+
}, C.apply(this, arguments);
|
|
103
103
|
}
|
|
104
104
|
function O(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
|
|
105
105
|
return function(s) {
|
|
@@ -124,7 +124,7 @@ function ae(e, t = []) {
|
|
|
124
124
|
value: m
|
|
125
125
|
}, v);
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function p(l, $) {
|
|
128
128
|
const v = ($ == null ? void 0 : $[e][u]) || a, d = me(v);
|
|
129
129
|
if (d)
|
|
130
130
|
return d;
|
|
@@ -134,7 +134,7 @@ function ae(e, t = []) {
|
|
|
134
134
|
}
|
|
135
135
|
return i.displayName = r + "Provider", [
|
|
136
136
|
i,
|
|
137
|
-
|
|
137
|
+
p
|
|
138
138
|
];
|
|
139
139
|
}
|
|
140
140
|
const s = () => {
|
|
@@ -206,11 +206,11 @@ const Z = /* @__PURE__ */ S((e, t) => {
|
|
|
206
206
|
const { children: n, ...o } = e, s = E.toArray(n), r = s.find(et);
|
|
207
207
|
if (r) {
|
|
208
208
|
const c = r.props.children, a = s.map((u) => u === r ? E.count(c) > 1 ? E.only(null) : /* @__PURE__ */ k(c) ? c.props.children : null : u);
|
|
209
|
-
return /* @__PURE__ */ x(re,
|
|
209
|
+
return /* @__PURE__ */ x(re, C({}, o, {
|
|
210
210
|
ref: t
|
|
211
211
|
}), /* @__PURE__ */ k(c) ? /* @__PURE__ */ se(c, void 0, a) : null);
|
|
212
212
|
}
|
|
213
|
-
return /* @__PURE__ */ x(re,
|
|
213
|
+
return /* @__PURE__ */ x(re, C({}, o, {
|
|
214
214
|
ref: t
|
|
215
215
|
}), n);
|
|
216
216
|
});
|
|
@@ -262,17 +262,17 @@ function nt(e) {
|
|
|
262
262
|
collectionRef: m
|
|
263
263
|
}, b);
|
|
264
264
|
}, a = e + "CollectionSlot", u = /* @__PURE__ */ A.forwardRef((v, d) => {
|
|
265
|
-
const { scope: b, children: m } = v, _ = r(a, b),
|
|
265
|
+
const { scope: b, children: m } = v, _ = r(a, b), h = Y(d, _.collectionRef);
|
|
266
266
|
return /* @__PURE__ */ A.createElement(Z, {
|
|
267
|
-
ref:
|
|
267
|
+
ref: h
|
|
268
268
|
}, m);
|
|
269
|
-
}), i = e + "CollectionItemSlot",
|
|
270
|
-
const { scope: b, children: m, ..._ } = v,
|
|
271
|
-
return A.useEffect(() => (T.itemMap.set(
|
|
272
|
-
ref:
|
|
269
|
+
}), i = e + "CollectionItemSlot", p = "data-radix-collection-item", l = /* @__PURE__ */ A.forwardRef((v, d) => {
|
|
270
|
+
const { scope: b, children: m, ..._ } = v, h = A.useRef(null), F = Y(d, h), T = r(i, b);
|
|
271
|
+
return A.useEffect(() => (T.itemMap.set(h, {
|
|
272
|
+
ref: h,
|
|
273
273
|
..._
|
|
274
|
-
}), () => void T.itemMap.delete(
|
|
275
|
-
[
|
|
274
|
+
}), () => void T.itemMap.delete(h))), /* @__PURE__ */ A.createElement(Z, {
|
|
275
|
+
[p]: "",
|
|
276
276
|
ref: F
|
|
277
277
|
}, m);
|
|
278
278
|
});
|
|
@@ -282,7 +282,7 @@ function nt(e) {
|
|
|
282
282
|
const m = d.collectionRef.current;
|
|
283
283
|
if (!m)
|
|
284
284
|
return [];
|
|
285
|
-
const _ = Array.from(m.querySelectorAll(`[${
|
|
285
|
+
const _ = Array.from(m.querySelectorAll(`[${p}]`));
|
|
286
286
|
return Array.from(d.itemMap.values()).sort(
|
|
287
287
|
(T, q) => _.indexOf(T.ref.current) - _.indexOf(q.ref.current)
|
|
288
288
|
);
|
|
@@ -337,7 +337,7 @@ const ct = [
|
|
|
337
337
|
const { asChild: r, ...c } = o, a = r ? Z : t;
|
|
338
338
|
return R(() => {
|
|
339
339
|
window[Symbol.for("radix-ui")] = !0;
|
|
340
|
-
}, []), /* @__PURE__ */ x(a,
|
|
340
|
+
}, []), /* @__PURE__ */ x(a, C({}, c, {
|
|
341
341
|
ref: s
|
|
342
342
|
}));
|
|
343
343
|
});
|
|
@@ -391,33 +391,33 @@ function st({ defaultProp: e, onChange: t }) {
|
|
|
391
391
|
]), n;
|
|
392
392
|
}
|
|
393
393
|
const at = /* @__PURE__ */ ne(void 0);
|
|
394
|
-
function
|
|
394
|
+
function Ie(e) {
|
|
395
395
|
const t = me(at);
|
|
396
396
|
return e || t || "ltr";
|
|
397
397
|
}
|
|
398
398
|
const te = "rovingFocusGroup.onEntryFocus", it = {
|
|
399
399
|
bubbles: !1,
|
|
400
400
|
cancelable: !0
|
|
401
|
-
}, ue = "RovingFocusGroup", [ce,
|
|
401
|
+
}, ue = "RovingFocusGroup", [ce, Ce, ut] = nt(ue), [lt, ye] = ae(ue, [
|
|
402
402
|
ut
|
|
403
403
|
]), [dt, ft] = lt(ue), pt = /* @__PURE__ */ S((e, t) => /* @__PURE__ */ x(ce.Provider, {
|
|
404
404
|
scope: e.__scopeRovingFocusGroup
|
|
405
405
|
}, /* @__PURE__ */ x(ce.Slot, {
|
|
406
406
|
scope: e.__scopeRovingFocusGroup
|
|
407
|
-
}, /* @__PURE__ */ x(bt,
|
|
407
|
+
}, /* @__PURE__ */ x(bt, C({}, e, {
|
|
408
408
|
ref: t
|
|
409
409
|
}))))), bt = /* @__PURE__ */ S((e, t) => {
|
|
410
|
-
const { __scopeRovingFocusGroup: n, orientation: o, loop: s = !1, dir: r, currentTabStopId: c, defaultCurrentTabStopId: a, onCurrentTabStopIdChange: u, onEntryFocus: i, ...
|
|
410
|
+
const { __scopeRovingFocusGroup: n, orientation: o, loop: s = !1, dir: r, currentTabStopId: c, defaultCurrentTabStopId: a, onCurrentTabStopIdChange: u, onEntryFocus: i, ...p } = e, l = P(null), $ = Y(t, l), v = Ie(r), [d = null, b] = xe({
|
|
411
411
|
prop: c,
|
|
412
412
|
defaultProp: a,
|
|
413
413
|
onChange: u
|
|
414
|
-
}), [m, _] = D(!1),
|
|
414
|
+
}), [m, _] = D(!1), h = ie(i), F = Ce(n), T = P(!1), [q, z] = D(0);
|
|
415
415
|
return R(() => {
|
|
416
|
-
const
|
|
417
|
-
if (
|
|
418
|
-
return
|
|
416
|
+
const I = l.current;
|
|
417
|
+
if (I)
|
|
418
|
+
return I.addEventListener(te, h), () => I.removeEventListener(te, h);
|
|
419
419
|
}, [
|
|
420
|
-
|
|
420
|
+
h
|
|
421
421
|
]), /* @__PURE__ */ x(dt, {
|
|
422
422
|
scope: n,
|
|
423
423
|
orientation: o,
|
|
@@ -425,7 +425,7 @@ const te = "rovingFocusGroup.onEntryFocus", it = {
|
|
|
425
425
|
loop: s,
|
|
426
426
|
currentTabStopId: d,
|
|
427
427
|
onItemFocus: V(
|
|
428
|
-
(
|
|
428
|
+
(I) => b(I),
|
|
429
429
|
[
|
|
430
430
|
b
|
|
431
431
|
]
|
|
@@ -436,20 +436,20 @@ const te = "rovingFocusGroup.onEntryFocus", it = {
|
|
|
436
436
|
),
|
|
437
437
|
onFocusableItemAdd: V(
|
|
438
438
|
() => z(
|
|
439
|
-
(
|
|
439
|
+
(I) => I + 1
|
|
440
440
|
),
|
|
441
441
|
[]
|
|
442
442
|
),
|
|
443
443
|
onFocusableItemRemove: V(
|
|
444
444
|
() => z(
|
|
445
|
-
(
|
|
445
|
+
(I) => I - 1
|
|
446
446
|
),
|
|
447
447
|
[]
|
|
448
448
|
)
|
|
449
|
-
}, /* @__PURE__ */ x(G.div,
|
|
449
|
+
}, /* @__PURE__ */ x(G.div, C({
|
|
450
450
|
tabIndex: m || q === 0 ? -1 : 0,
|
|
451
451
|
"data-orientation": o
|
|
452
|
-
},
|
|
452
|
+
}, p, {
|
|
453
453
|
ref: $,
|
|
454
454
|
style: {
|
|
455
455
|
outline: "none",
|
|
@@ -458,25 +458,25 @@ const te = "rovingFocusGroup.onEntryFocus", it = {
|
|
|
458
458
|
onMouseDown: O(e.onMouseDown, () => {
|
|
459
459
|
T.current = !0;
|
|
460
460
|
}),
|
|
461
|
-
onFocus: O(e.onFocus, (
|
|
461
|
+
onFocus: O(e.onFocus, (I) => {
|
|
462
462
|
const H = !T.current;
|
|
463
|
-
if (
|
|
463
|
+
if (I.target === I.currentTarget && H && !m) {
|
|
464
464
|
const B = new CustomEvent(te, it);
|
|
465
|
-
if (
|
|
465
|
+
if (I.currentTarget.dispatchEvent(B), !B.defaultPrevented) {
|
|
466
466
|
const L = F().filter(
|
|
467
|
-
(
|
|
467
|
+
(g) => g.focusable
|
|
468
468
|
), X = L.find(
|
|
469
|
-
(
|
|
469
|
+
(g) => g.active
|
|
470
470
|
), J = L.find(
|
|
471
|
-
(
|
|
472
|
-
),
|
|
471
|
+
(g) => g.id === d
|
|
472
|
+
), f = [
|
|
473
473
|
X,
|
|
474
474
|
J,
|
|
475
475
|
...L
|
|
476
476
|
].filter(Boolean).map(
|
|
477
|
-
(
|
|
477
|
+
(g) => g.ref.current
|
|
478
478
|
);
|
|
479
|
-
Se(
|
|
479
|
+
Se(f);
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
T.current = !1;
|
|
@@ -487,7 +487,7 @@ const te = "rovingFocusGroup.onEntryFocus", it = {
|
|
|
487
487
|
)
|
|
488
488
|
})));
|
|
489
489
|
}), $t = "RovingFocusGroupItem", vt = /* @__PURE__ */ S((e, t) => {
|
|
490
|
-
const { __scopeRovingFocusGroup: n, focusable: o = !0, active: s = !1, tabStopId: r, ...c } = e, a = he(), u = r || a, i = ft($t, n),
|
|
490
|
+
const { __scopeRovingFocusGroup: n, focusable: o = !0, active: s = !1, tabStopId: r, ...c } = e, a = he(), u = r || a, i = ft($t, n), p = i.currentTabStopId === u, l = Ce(n), { onFocusableItemAdd: $, onFocusableItemRemove: v } = i;
|
|
491
491
|
return R(() => {
|
|
492
492
|
if (o)
|
|
493
493
|
return $(), () => v();
|
|
@@ -500,8 +500,8 @@ const te = "rovingFocusGroup.onEntryFocus", it = {
|
|
|
500
500
|
id: u,
|
|
501
501
|
focusable: o,
|
|
502
502
|
active: s
|
|
503
|
-
}, /* @__PURE__ */ x(G.span,
|
|
504
|
-
tabIndex:
|
|
503
|
+
}, /* @__PURE__ */ x(G.span, C({
|
|
504
|
+
tabIndex: p ? 0 : -1,
|
|
505
505
|
"data-orientation": i.orientation
|
|
506
506
|
}, c, {
|
|
507
507
|
ref: t,
|
|
@@ -523,16 +523,16 @@ const te = "rovingFocusGroup.onEntryFocus", it = {
|
|
|
523
523
|
if (b !== void 0) {
|
|
524
524
|
d.preventDefault();
|
|
525
525
|
let _ = l().filter(
|
|
526
|
-
(
|
|
526
|
+
(h) => h.focusable
|
|
527
527
|
).map(
|
|
528
|
-
(
|
|
528
|
+
(h) => h.ref.current
|
|
529
529
|
);
|
|
530
530
|
if (b === "last")
|
|
531
531
|
_.reverse();
|
|
532
532
|
else if (b === "prev" || b === "next") {
|
|
533
533
|
b === "prev" && _.reverse();
|
|
534
|
-
const
|
|
535
|
-
_ = i.loop ? ht(_,
|
|
534
|
+
const h = _.indexOf(d.currentTarget);
|
|
535
|
+
_ = i.loop ? ht(_, h + 1) : _.slice(h + 1);
|
|
536
536
|
}
|
|
537
537
|
setTimeout(
|
|
538
538
|
() => Se(_)
|
|
@@ -575,8 +575,8 @@ function ht(e, t) {
|
|
|
575
575
|
(n, o) => e[(t + o) % e.length]
|
|
576
576
|
);
|
|
577
577
|
}
|
|
578
|
-
const xt = pt,
|
|
579
|
-
function
|
|
578
|
+
const xt = pt, It = vt;
|
|
579
|
+
function Ct(e, t) {
|
|
580
580
|
return qe((n, o) => {
|
|
581
581
|
const s = t[n][o];
|
|
582
582
|
return s ?? n;
|
|
@@ -592,7 +592,7 @@ const we = (e) => {
|
|
|
592
592
|
};
|
|
593
593
|
we.displayName = "Presence";
|
|
594
594
|
function yt(e) {
|
|
595
|
-
const [t, n] = D(), o = P({}), s = P(e), r = P("none"), c = e ? "mounted" : "unmounted", [a, u] =
|
|
595
|
+
const [t, n] = D(), o = P({}), s = P(e), r = P("none"), c = e ? "mounted" : "unmounted", [a, u] = Ct(c, {
|
|
596
596
|
mounted: {
|
|
597
597
|
UNMOUNT: "unmounted",
|
|
598
598
|
ANIMATION_OUT: "unmountSuspended"
|
|
@@ -611,10 +611,10 @@ function yt(e) {
|
|
|
611
611
|
}, [
|
|
612
612
|
a
|
|
613
613
|
]), oe(() => {
|
|
614
|
-
const i = o.current,
|
|
615
|
-
if (
|
|
614
|
+
const i = o.current, p = s.current;
|
|
615
|
+
if (p !== e) {
|
|
616
616
|
const $ = r.current, v = K(i);
|
|
617
|
-
e ? u("MOUNT") : v === "none" || (i == null ? void 0 : i.display) === "none" ? u("UNMOUNT") : u(
|
|
617
|
+
e ? u("MOUNT") : v === "none" || (i == null ? void 0 : i.display) === "none" ? u("UNMOUNT") : u(p && $ !== v ? "ANIMATION_OUT" : "UNMOUNT"), s.current = e;
|
|
618
618
|
}
|
|
619
619
|
}, [
|
|
620
620
|
e,
|
|
@@ -626,11 +626,11 @@ function yt(e) {
|
|
|
626
626
|
l.target === t && v && Le(
|
|
627
627
|
() => u("ANIMATION_END")
|
|
628
628
|
);
|
|
629
|
-
},
|
|
629
|
+
}, p = (l) => {
|
|
630
630
|
l.target === t && (r.current = K(o.current));
|
|
631
631
|
};
|
|
632
|
-
return t.addEventListener("animationstart",
|
|
633
|
-
t.removeEventListener("animationstart",
|
|
632
|
+
return t.addEventListener("animationstart", p), t.addEventListener("animationcancel", i), t.addEventListener("animationend", i), () => {
|
|
633
|
+
t.removeEventListener("animationstart", p), t.removeEventListener("animationcancel", i), t.removeEventListener("animationend", i);
|
|
634
634
|
};
|
|
635
635
|
} else
|
|
636
636
|
u("ANIMATION_END");
|
|
@@ -653,7 +653,7 @@ function K(e) {
|
|
|
653
653
|
const Te = "Tabs", [St, tn] = ae(Te, [
|
|
654
654
|
ye
|
|
655
655
|
]), Ne = ye(), [wt, le] = St(Te), Tt = /* @__PURE__ */ S((e, t) => {
|
|
656
|
-
const { __scopeTabs: n, value: o, onValueChange: s, defaultValue: r, orientation: c = "horizontal", dir: a, activationMode: u = "automatic", ...i } = e,
|
|
656
|
+
const { __scopeTabs: n, value: o, onValueChange: s, defaultValue: r, orientation: c = "horizontal", dir: a, activationMode: u = "automatic", ...i } = e, p = Ie(a), [l, $] = xe({
|
|
657
657
|
prop: o,
|
|
658
658
|
onChange: s,
|
|
659
659
|
defaultProp: r
|
|
@@ -664,41 +664,41 @@ const Te = "Tabs", [St, tn] = ae(Te, [
|
|
|
664
664
|
value: l,
|
|
665
665
|
onValueChange: $,
|
|
666
666
|
orientation: c,
|
|
667
|
-
dir:
|
|
667
|
+
dir: p,
|
|
668
668
|
activationMode: u
|
|
669
|
-
}, /* @__PURE__ */ x(G.div,
|
|
670
|
-
dir:
|
|
669
|
+
}, /* @__PURE__ */ x(G.div, C({
|
|
670
|
+
dir: p,
|
|
671
671
|
"data-orientation": c
|
|
672
672
|
}, i, {
|
|
673
673
|
ref: t
|
|
674
674
|
})));
|
|
675
675
|
}), Nt = "TabsList", At = /* @__PURE__ */ S((e, t) => {
|
|
676
676
|
const { __scopeTabs: n, loop: o = !0, ...s } = e, r = le(Nt, n), c = Ne(n);
|
|
677
|
-
return /* @__PURE__ */ x(xt,
|
|
677
|
+
return /* @__PURE__ */ x(xt, C({
|
|
678
678
|
asChild: !0
|
|
679
679
|
}, c, {
|
|
680
680
|
orientation: r.orientation,
|
|
681
681
|
dir: r.dir,
|
|
682
682
|
loop: o
|
|
683
|
-
}), /* @__PURE__ */ x(G.div,
|
|
683
|
+
}), /* @__PURE__ */ x(G.div, C({
|
|
684
684
|
role: "tablist",
|
|
685
685
|
"aria-orientation": r.orientation
|
|
686
686
|
}, s, {
|
|
687
687
|
ref: t
|
|
688
688
|
})));
|
|
689
689
|
}), Et = "TabsTrigger", Rt = /* @__PURE__ */ S((e, t) => {
|
|
690
|
-
const { __scopeTabs: n, value: o, disabled: s = !1, ...r } = e, c = le(Et, n), a = Ne(n), u = Ae(c.baseId, o), i = Ee(c.baseId, o),
|
|
691
|
-
return /* @__PURE__ */ x(
|
|
690
|
+
const { __scopeTabs: n, value: o, disabled: s = !1, ...r } = e, c = le(Et, n), a = Ne(n), u = Ae(c.baseId, o), i = Ee(c.baseId, o), p = o === c.value;
|
|
691
|
+
return /* @__PURE__ */ x(It, C({
|
|
692
692
|
asChild: !0
|
|
693
693
|
}, a, {
|
|
694
694
|
focusable: !s,
|
|
695
|
-
active:
|
|
696
|
-
}), /* @__PURE__ */ x(G.button,
|
|
695
|
+
active: p
|
|
696
|
+
}), /* @__PURE__ */ x(G.button, C({
|
|
697
697
|
type: "button",
|
|
698
698
|
role: "tab",
|
|
699
|
-
"aria-selected":
|
|
699
|
+
"aria-selected": p,
|
|
700
700
|
"aria-controls": i,
|
|
701
|
-
"data-state":
|
|
701
|
+
"data-state": p ? "active" : "inactive",
|
|
702
702
|
"data-disabled": s ? "" : void 0,
|
|
703
703
|
disabled: s,
|
|
704
704
|
id: u
|
|
@@ -715,11 +715,11 @@ const Te = "Tabs", [St, tn] = ae(Te, [
|
|
|
715
715
|
}),
|
|
716
716
|
onFocus: O(e.onFocus, () => {
|
|
717
717
|
const l = c.activationMode !== "manual";
|
|
718
|
-
!
|
|
718
|
+
!p && !s && l && c.onValueChange(o);
|
|
719
719
|
})
|
|
720
720
|
})));
|
|
721
721
|
}), Pt = "TabsContent", Mt = /* @__PURE__ */ S((e, t) => {
|
|
722
|
-
const { __scopeTabs: n, value: o, forceMount: s, children: r, ...c } = e, a = le(Pt, n), u = Ae(a.baseId, o), i = Ee(a.baseId, o),
|
|
722
|
+
const { __scopeTabs: n, value: o, forceMount: s, children: r, ...c } = e, a = le(Pt, n), u = Ae(a.baseId, o), i = Ee(a.baseId, o), p = o === a.value, l = P(p);
|
|
723
723
|
return R(() => {
|
|
724
724
|
const $ = requestAnimationFrame(
|
|
725
725
|
() => l.current = !1
|
|
@@ -728,10 +728,10 @@ const Te = "Tabs", [St, tn] = ae(Te, [
|
|
|
728
728
|
}, []), /* @__PURE__ */ x(
|
|
729
729
|
we,
|
|
730
730
|
{
|
|
731
|
-
present: s ||
|
|
731
|
+
present: s || p
|
|
732
732
|
},
|
|
733
|
-
({ present: $ }) => /* @__PURE__ */ x(G.div,
|
|
734
|
-
"data-state":
|
|
733
|
+
({ present: $ }) => /* @__PURE__ */ x(G.div, C({
|
|
734
|
+
"data-state": p ? "active" : "inactive",
|
|
735
735
|
"data-orientation": a.orientation,
|
|
736
736
|
role: "tabpanel",
|
|
737
737
|
"aria-labelledby": u,
|
|
@@ -795,7 +795,7 @@ var Re = { exports: {} };
|
|
|
795
795
|
})(Re);
|
|
796
796
|
var Ut = Re.exports;
|
|
797
797
|
const de = /* @__PURE__ */ Lt(Ut), Vt = {
|
|
798
|
-
"purpur-tab-content": "_purpur-tab-
|
|
798
|
+
"purpur-tab-content": "_purpur-tab-content_1x2zs_1"
|
|
799
799
|
}, Bt = de.bind(Vt), jt = "purpur-tab-content", Gt = S(
|
|
800
800
|
({ children: e, tabId: t, "data-testid": n, className: o, ...s }, r) => /* @__PURE__ */ w(
|
|
801
801
|
qt,
|
|
@@ -809,11 +809,11 @@ const de = /* @__PURE__ */ Lt(Ut), Vt = {
|
|
|
809
809
|
}
|
|
810
810
|
)
|
|
811
811
|
), kt = (e) => !!e && k(e) && !!e.props.name && !!e.props.tabId, zt = {
|
|
812
|
-
"purpur-tab-header": "_purpur-tab-
|
|
813
|
-
"purpur-tab-header--contained": "_purpur-tab-header--
|
|
814
|
-
"purpur-tab-header--contained-negative": "_purpur-tab-header--contained-
|
|
815
|
-
"purpur-tab-header--line": "_purpur-tab-header--
|
|
816
|
-
"purpur-tab-header--line-negative": "_purpur-tab-header--line-
|
|
812
|
+
"purpur-tab-header": "_purpur-tab-header_18g3c_1",
|
|
813
|
+
"purpur-tab-header--contained": "_purpur-tab-header--contained_18g3c_33",
|
|
814
|
+
"purpur-tab-header--contained-negative": "_purpur-tab-header--contained-negative_18g3c_33",
|
|
815
|
+
"purpur-tab-header--line": "_purpur-tab-header--line_18g3c_36",
|
|
816
|
+
"purpur-tab-header--line-negative": "_purpur-tab-header--line-negative_18g3c_48"
|
|
817
817
|
}, Kt = de.bind(zt), $e = "purpur-tab-header", Wt = S(
|
|
818
818
|
({
|
|
819
819
|
index: e,
|
|
@@ -869,51 +869,54 @@ const de = /* @__PURE__ */ Lt(Ut), Vt = {
|
|
|
869
869
|
"data-testid": a,
|
|
870
870
|
...u
|
|
871
871
|
}) => {
|
|
872
|
-
const [i,
|
|
872
|
+
const [i, p] = D({}), [l, $] = D(0), [v, d] = D(0), b = E.toArray(e).filter(kt), m = P(), _ = P(new Array(b.length)), h = 200, F = t === "line", T = U([
|
|
873
873
|
y,
|
|
874
874
|
`${y}--${t}${n ? "-negative" : ""}`,
|
|
875
875
|
{ [`${y}--fullWidth`]: o },
|
|
876
876
|
r
|
|
877
|
-
]), q = E.map(b, ({ props: { tabId:
|
|
877
|
+
]), q = E.map(b, ({ props: { tabId: f } }) => f), z = () => {
|
|
878
|
+
const f = q.findIndex((g) => g === c);
|
|
879
|
+
return f >= 0 ? f : 0;
|
|
880
|
+
}, [I, H] = D(z);
|
|
878
881
|
if (new Set(q).size !== q.length)
|
|
879
882
|
throw new Error("tabId must be unique");
|
|
880
|
-
const B = (
|
|
883
|
+
const B = (f, g) => g || a ? `${g || a}-${f}` : void 0, L = () => {
|
|
881
884
|
if (!F)
|
|
882
885
|
return;
|
|
883
|
-
const
|
|
884
|
-
$((
|
|
885
|
-
}, X = (
|
|
886
|
-
F && H(b.findIndex((
|
|
887
|
-
}, J = (
|
|
886
|
+
const f = _.current[I];
|
|
887
|
+
$((f == null ? void 0 : f.offsetLeft) || 0), d((f == null ? void 0 : f.getBoundingClientRect().width) || 0);
|
|
888
|
+
}, X = (f) => {
|
|
889
|
+
F && H(b.findIndex((g) => g.props.tabId === f)), s == null || s(Zt(f));
|
|
890
|
+
}, J = (f) => {
|
|
888
891
|
if (m != null && m.current) {
|
|
889
|
-
const { scrollLeft:
|
|
890
|
-
m.current.scroll({ left:
|
|
892
|
+
const { scrollLeft: g } = m.current, j = f === "left" ? -h : h;
|
|
893
|
+
m.current.scroll({ left: g + j, behavior: "smooth" });
|
|
891
894
|
}
|
|
892
|
-
}, Q = ({ side:
|
|
895
|
+
}, Q = ({ side: f }) => /* @__PURE__ */ w(
|
|
893
896
|
"button",
|
|
894
897
|
{
|
|
895
|
-
className: U(`${y}__scroll-button`, `${y}__scroll-button--${
|
|
896
|
-
onClick: () => J(
|
|
898
|
+
className: U(`${y}__scroll-button`, `${y}__scroll-button--${f}`),
|
|
899
|
+
onClick: () => J(f),
|
|
897
900
|
type: "button",
|
|
898
901
|
"aria-hidden": "true",
|
|
899
902
|
tabIndex: -1,
|
|
900
903
|
"data-testid": B("scroll-button"),
|
|
901
|
-
children: /* @__PURE__ */ w(He, { svg:
|
|
904
|
+
children: /* @__PURE__ */ w(He, { svg: f === "left" ? Ge : ke, size: "md" })
|
|
902
905
|
}
|
|
903
906
|
);
|
|
904
907
|
return R(() => (window.addEventListener("resize", L), () => {
|
|
905
908
|
window.removeEventListener("resize", L);
|
|
906
909
|
}), []), R(() => {
|
|
907
910
|
L();
|
|
908
|
-
}, [
|
|
909
|
-
const
|
|
911
|
+
}, [I, o, b.length, t]), R(() => {
|
|
912
|
+
const f = (M) => {
|
|
910
913
|
if (M.every((N) => N.isIntersecting) && M.length === b.length) {
|
|
911
|
-
|
|
914
|
+
p({});
|
|
912
915
|
return;
|
|
913
916
|
}
|
|
914
917
|
M.forEach((N) => {
|
|
915
918
|
const pe = Number(N.target.getAttribute("data-index")), Pe = pe === 0, Me = pe === b.length - 1;
|
|
916
|
-
|
|
919
|
+
p((Oe) => ({
|
|
917
920
|
...Oe,
|
|
918
921
|
...Pe && {
|
|
919
922
|
[`${y}__wrapper--scroll-end`]: !N.isIntersecting
|
|
@@ -923,12 +926,12 @@ const de = /* @__PURE__ */ Lt(Ut), Vt = {
|
|
|
923
926
|
}
|
|
924
927
|
}));
|
|
925
928
|
});
|
|
926
|
-
},
|
|
929
|
+
}, g = new IntersectionObserver(f, {
|
|
927
930
|
threshold: [0.99],
|
|
928
931
|
root: m.current
|
|
929
932
|
}), j = _.current;
|
|
930
|
-
return j.forEach((M) =>
|
|
931
|
-
j.forEach((M) =>
|
|
933
|
+
return j.forEach((M) => g.observe(M)), () => {
|
|
934
|
+
j.forEach((M) => g.unobserve(M));
|
|
932
935
|
};
|
|
933
936
|
}, [b.length]), /* @__PURE__ */ w(
|
|
934
937
|
Ot,
|
|
@@ -943,21 +946,21 @@ const de = /* @__PURE__ */ Lt(Ut), Vt = {
|
|
|
943
946
|
/* @__PURE__ */ ee(
|
|
944
947
|
Ft,
|
|
945
948
|
{
|
|
946
|
-
ref: (
|
|
947
|
-
m.current =
|
|
949
|
+
ref: (f) => {
|
|
950
|
+
m.current = f;
|
|
948
951
|
},
|
|
949
952
|
className: U(`${y}__list`),
|
|
950
953
|
children: [
|
|
951
|
-
E.map(b, (
|
|
952
|
-
const { name: j, tabId: M, "data-testid": fe } =
|
|
954
|
+
E.map(b, (f, g) => {
|
|
955
|
+
const { name: j, tabId: M, "data-testid": fe } = f.props;
|
|
953
956
|
return /* @__PURE__ */ w(
|
|
954
957
|
Wt,
|
|
955
958
|
{
|
|
956
959
|
"data-testid": B("header", fe),
|
|
957
|
-
index:
|
|
960
|
+
index: g,
|
|
958
961
|
tabId: M,
|
|
959
962
|
ref: (N) => {
|
|
960
|
-
N && (_.current[
|
|
963
|
+
N && (_.current[g] = N);
|
|
961
964
|
},
|
|
962
965
|
onFocus: (N) => {
|
|
963
966
|
Ht(N.target, m.current);
|
|
@@ -985,7 +988,7 @@ const de = /* @__PURE__ */ Lt(Ut), Vt = {
|
|
|
985
988
|
/* @__PURE__ */ w(Q, { side: "left" }),
|
|
986
989
|
/* @__PURE__ */ w(Q, { side: "right" })
|
|
987
990
|
] }),
|
|
988
|
-
/* @__PURE__ */ w("div", { className: U(`${y}__content-container`), children: E.map(b, (
|
|
991
|
+
/* @__PURE__ */ w("div", { className: U(`${y}__content-container`), children: E.map(b, (f) => f) })
|
|
989
992
|
] })
|
|
990
993
|
}
|
|
991
994
|
);
|