@purpurds/tabs 5.10.0 → 5.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/dist/LICENSE.txt +1 -1
- package/dist/tabs.cjs.js.map +1 -1
- package/dist/tabs.es.js +106 -106
- package/dist/tabs.es.js.map +1 -1
- package/package.json +4 -4
package/dist/tabs.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as T, jsxs as ee } from "react/jsx-runtime";
|
|
2
2
|
import * as ve from "react";
|
|
3
|
-
import A, { createContext as ne, useMemo as W, createElement as x, useContext as me, useCallback as
|
|
3
|
+
import A, { createContext as ne, useMemo as W, createElement as x, useContext as me, useCallback as B, forwardRef as S, Children as E, isValidElement as k, cloneElement as se, Fragment as Fe, useLayoutEffect as De, useEffect as P, useRef as R, useState as D, useReducer as qe } from "react";
|
|
4
4
|
import { flushSync as Le } from "react-dom";
|
|
5
5
|
function Ue(e) {
|
|
6
6
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
@@ -41,8 +41,8 @@ var _e = { exports: {} };
|
|
|
41
41
|
e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
|
|
42
42
|
})();
|
|
43
43
|
})(_e);
|
|
44
|
-
var
|
|
45
|
-
const
|
|
44
|
+
var Be = _e.exports;
|
|
45
|
+
const Ve = /* @__PURE__ */ Ue(Be), Ge = {
|
|
46
46
|
"purpur-icon": "_purpur-icon_8u1lq_1",
|
|
47
47
|
"purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
|
|
48
48
|
"purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
|
|
@@ -50,7 +50,7 @@ const Be = /* @__PURE__ */ Ue(Ve), je = {
|
|
|
50
50
|
"purpur-icon--md": "_purpur-icon--md_8u1lq_16",
|
|
51
51
|
"purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
|
|
52
52
|
"purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
|
|
53
|
-
},
|
|
53
|
+
}, je = {
|
|
54
54
|
name: "chevron-left",
|
|
55
55
|
svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M16.175 3.905a.9.9 0 0 1-.08 1.27L8.36 12l7.736 6.825a.9.9 0 0 1-1.191 1.35l-8.5-7.5a.9.9 0 0 1 0-1.35l8.5-7.5a.9.9 0 0 1 1.27.08Z" clip-rule="evenodd"/></svg>',
|
|
56
56
|
keywords: ["chevron-left"],
|
|
@@ -60,7 +60,7 @@ const Be = /* @__PURE__ */ Ue(Ve), je = {
|
|
|
60
60
|
svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path fill-rule="evenodd" d="M7.809 3.924a.9.9 0 0 0 .115 1.267L16.094 12l-8.17 6.809a.9.9 0 0 0 1.152 1.382l9-7.5a.9.9 0 0 0 0-1.382l-9-7.5a.9.9 0 0 0-1.267.115Z" clip-rule="evenodd"/></svg>',
|
|
61
61
|
keywords: ["chevron-right"],
|
|
62
62
|
category: "utility"
|
|
63
|
-
},
|
|
63
|
+
}, Ke = Ve.bind(Ge), be = "purpur-icon", ze = "md", We = (e) => e.filter((t) => Object.keys(t).length >= 1).map((t) => `${t.name}="${t.value}"`).join(" "), Ye = ({ content: e = "", title: t } = {}) => {
|
|
64
64
|
const n = [
|
|
65
65
|
{ name: "xmlns", value: "http://www.w3.org/2000/svg" },
|
|
66
66
|
{ name: "fill", value: "currentColor" },
|
|
@@ -73,14 +73,14 @@ const Be = /* @__PURE__ */ Ue(Ve), je = {
|
|
|
73
73
|
svg: t,
|
|
74
74
|
allyTitle: n,
|
|
75
75
|
className: o = "",
|
|
76
|
-
size: s =
|
|
76
|
+
size: s = ze,
|
|
77
77
|
...r
|
|
78
78
|
}) => {
|
|
79
79
|
const c = Ye({
|
|
80
80
|
content: Ze(t.svg),
|
|
81
81
|
title: n
|
|
82
|
-
}), a =
|
|
83
|
-
return /* @__PURE__ */
|
|
82
|
+
}), a = Ke(o, be, `${be}--${s}`);
|
|
83
|
+
return /* @__PURE__ */ T(
|
|
84
84
|
"span",
|
|
85
85
|
{
|
|
86
86
|
"aria-label": n,
|
|
@@ -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) {
|
|
@@ -200,17 +200,17 @@ function ge(...e) {
|
|
|
200
200
|
);
|
|
201
201
|
}
|
|
202
202
|
function Y(...e) {
|
|
203
|
-
return
|
|
203
|
+
return B(ge(...e), e);
|
|
204
204
|
}
|
|
205
205
|
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
|
});
|
|
@@ -267,11 +267,11 @@ function nt(e) {
|
|
|
267
267
|
ref: h
|
|
268
268
|
}, m);
|
|
269
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),
|
|
271
|
-
return A.useEffect(() => (
|
|
270
|
+
const { scope: b, children: m, ..._ } = v, h = A.useRef(null), F = Y(d, h), w = r(i, b);
|
|
271
|
+
return A.useEffect(() => (w.itemMap.set(h, {
|
|
272
272
|
ref: h,
|
|
273
273
|
..._
|
|
274
|
-
}), () => void
|
|
274
|
+
}), () => void w.itemMap.delete(h))), /* @__PURE__ */ A.createElement(Z, {
|
|
275
275
|
[p]: "",
|
|
276
276
|
ref: F
|
|
277
277
|
}, m);
|
|
@@ -284,7 +284,7 @@ function nt(e) {
|
|
|
284
284
|
return [];
|
|
285
285
|
const _ = Array.from(m.querySelectorAll(`[${p}]`));
|
|
286
286
|
return Array.from(d.itemMap.values()).sort(
|
|
287
|
-
(
|
|
287
|
+
(w, q) => _.indexOf(w.ref.current) - _.indexOf(q.ref.current)
|
|
288
288
|
);
|
|
289
289
|
}, [
|
|
290
290
|
d.collectionRef,
|
|
@@ -332,12 +332,12 @@ const ct = [
|
|
|
332
332
|
"span",
|
|
333
333
|
"svg",
|
|
334
334
|
"ul"
|
|
335
|
-
],
|
|
335
|
+
], j = ct.reduce((e, t) => {
|
|
336
336
|
const n = /* @__PURE__ */ S((o, s) => {
|
|
337
337
|
const { asChild: r, ...c } = o, a = r ? Z : t;
|
|
338
338
|
return P(() => {
|
|
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
|
});
|
|
@@ -363,7 +363,7 @@ function xe({ prop: e, defaultProp: t, onChange: n = () => {
|
|
|
363
363
|
const [o, s] = st({
|
|
364
364
|
defaultProp: t,
|
|
365
365
|
onChange: n
|
|
366
|
-
}), r = e !== void 0, c = r ? e : o, a = ie(n), u =
|
|
366
|
+
}), r = e !== void 0, c = r ? e : o, a = ie(n), u = B((i) => {
|
|
367
367
|
if (r) {
|
|
368
368
|
const l = typeof i == "function" ? i(e) : i;
|
|
369
369
|
l !== e && a(l);
|
|
@@ -391,31 +391,31 @@ 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, ...p } = e, l = R(null), $ = Y(t, l), v =
|
|
410
|
+
const { __scopeRovingFocusGroup: n, orientation: o, loop: s = !1, dir: r, currentTabStopId: c, defaultCurrentTabStopId: a, onCurrentTabStopIdChange: u, onEntryFocus: i, ...p } = e, l = R(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), h = ie(i), F =
|
|
414
|
+
}), [m, _] = D(!1), h = ie(i), F = Ce(n), w = R(!1), [q, K] = D(0);
|
|
415
415
|
return P(() => {
|
|
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, {
|
|
@@ -424,29 +424,29 @@ const te = "rovingFocusGroup.onEntryFocus", it = {
|
|
|
424
424
|
dir: v,
|
|
425
425
|
loop: s,
|
|
426
426
|
currentTabStopId: d,
|
|
427
|
-
onItemFocus:
|
|
428
|
-
(
|
|
427
|
+
onItemFocus: B(
|
|
428
|
+
(I) => b(I),
|
|
429
429
|
[
|
|
430
430
|
b
|
|
431
431
|
]
|
|
432
432
|
),
|
|
433
|
-
onItemShiftTab:
|
|
433
|
+
onItemShiftTab: B(
|
|
434
434
|
() => _(!0),
|
|
435
435
|
[]
|
|
436
436
|
),
|
|
437
|
-
onFocusableItemAdd:
|
|
438
|
-
() =>
|
|
439
|
-
(
|
|
437
|
+
onFocusableItemAdd: B(
|
|
438
|
+
() => K(
|
|
439
|
+
(I) => I + 1
|
|
440
440
|
),
|
|
441
441
|
[]
|
|
442
442
|
),
|
|
443
|
-
onFocusableItemRemove:
|
|
444
|
-
() =>
|
|
445
|
-
(
|
|
443
|
+
onFocusableItemRemove: B(
|
|
444
|
+
() => K(
|
|
445
|
+
(I) => I - 1
|
|
446
446
|
),
|
|
447
447
|
[]
|
|
448
448
|
)
|
|
449
|
-
}, /* @__PURE__ */ x(
|
|
449
|
+
}, /* @__PURE__ */ x(j.div, C({
|
|
450
450
|
tabIndex: m || q === 0 ? -1 : 0,
|
|
451
451
|
"data-orientation": o
|
|
452
452
|
}, p, {
|
|
@@ -456,13 +456,13 @@ const te = "rovingFocusGroup.onEntryFocus", it = {
|
|
|
456
456
|
...e.style
|
|
457
457
|
},
|
|
458
458
|
onMouseDown: O(e.onMouseDown, () => {
|
|
459
|
-
|
|
459
|
+
w.current = !0;
|
|
460
460
|
}),
|
|
461
|
-
onFocus: O(e.onFocus, (
|
|
462
|
-
const H = !
|
|
463
|
-
if (
|
|
464
|
-
const
|
|
465
|
-
if (
|
|
461
|
+
onFocus: O(e.onFocus, (I) => {
|
|
462
|
+
const H = !w.current;
|
|
463
|
+
if (I.target === I.currentTarget && H && !m) {
|
|
464
|
+
const V = new CustomEvent(te, it);
|
|
465
|
+
if (I.currentTarget.dispatchEvent(V), !V.defaultPrevented) {
|
|
466
466
|
const L = F().filter(
|
|
467
467
|
(g) => g.focusable
|
|
468
468
|
), X = L.find(
|
|
@@ -479,7 +479,7 @@ const te = "rovingFocusGroup.onEntryFocus", it = {
|
|
|
479
479
|
Se(f);
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
|
-
|
|
482
|
+
w.current = !1;
|
|
483
483
|
}),
|
|
484
484
|
onBlur: O(
|
|
485
485
|
e.onBlur,
|
|
@@ -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), p = i.currentTabStopId === u, l =
|
|
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 P(() => {
|
|
492
492
|
if (o)
|
|
493
493
|
return $(), () => v();
|
|
@@ -500,7 +500,7 @@ const te = "rovingFocusGroup.onEntryFocus", it = {
|
|
|
500
500
|
id: u,
|
|
501
501
|
focusable: o,
|
|
502
502
|
active: s
|
|
503
|
-
}, /* @__PURE__ */ x(
|
|
503
|
+
}, /* @__PURE__ */ x(j.span, C({
|
|
504
504
|
tabIndex: p ? 0 : -1,
|
|
505
505
|
"data-orientation": i.orientation
|
|
506
506
|
}, c, {
|
|
@@ -575,14 +575,14 @@ 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;
|
|
583
583
|
}, e);
|
|
584
584
|
}
|
|
585
|
-
const
|
|
585
|
+
const Te = (e) => {
|
|
586
586
|
const { present: t, children: n } = e, o = yt(t), s = typeof n == "function" ? n({
|
|
587
587
|
present: o.isPresent
|
|
588
588
|
}) : E.only(n), r = Y(o.ref, s.ref);
|
|
@@ -590,9 +590,9 @@ const we = (e) => {
|
|
|
590
590
|
ref: r
|
|
591
591
|
}) : null;
|
|
592
592
|
};
|
|
593
|
-
|
|
593
|
+
Te.displayName = "Presence";
|
|
594
594
|
function yt(e) {
|
|
595
|
-
const [t, n] = D(), o = R({}), s = R(e), r = R("none"), c = e ? "mounted" : "unmounted", [a, u] =
|
|
595
|
+
const [t, n] = D(), o = R({}), s = R(e), r = R("none"), c = e ? "mounted" : "unmounted", [a, u] = Ct(c, {
|
|
596
596
|
mounted: {
|
|
597
597
|
UNMOUNT: "unmounted",
|
|
598
598
|
ANIMATION_OUT: "unmountSuspended"
|
|
@@ -606,14 +606,14 @@ function yt(e) {
|
|
|
606
606
|
}
|
|
607
607
|
});
|
|
608
608
|
return P(() => {
|
|
609
|
-
const i =
|
|
609
|
+
const i = z(o.current);
|
|
610
610
|
r.current = a === "mounted" ? i : "none";
|
|
611
611
|
}, [
|
|
612
612
|
a
|
|
613
613
|
]), oe(() => {
|
|
614
614
|
const i = o.current, p = s.current;
|
|
615
615
|
if (p !== e) {
|
|
616
|
-
const $ = r.current, v =
|
|
616
|
+
const $ = r.current, v = z(i);
|
|
617
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
|
}, [
|
|
@@ -622,12 +622,12 @@ function yt(e) {
|
|
|
622
622
|
]), oe(() => {
|
|
623
623
|
if (t) {
|
|
624
624
|
const i = (l) => {
|
|
625
|
-
const v =
|
|
625
|
+
const v = z(o.current).includes(l.animationName);
|
|
626
626
|
l.target === t && v && Le(
|
|
627
627
|
() => u("ANIMATION_END")
|
|
628
628
|
);
|
|
629
629
|
}, p = (l) => {
|
|
630
|
-
l.target === t && (r.current =
|
|
630
|
+
l.target === t && (r.current = z(o.current));
|
|
631
631
|
};
|
|
632
632
|
return t.addEventListener("animationstart", p), t.addEventListener("animationcancel", i), t.addEventListener("animationend", i), () => {
|
|
633
633
|
t.removeEventListener("animationstart", p), t.removeEventListener("animationcancel", i), t.removeEventListener("animationend", i);
|
|
@@ -642,23 +642,23 @@ function yt(e) {
|
|
|
642
642
|
"mounted",
|
|
643
643
|
"unmountSuspended"
|
|
644
644
|
].includes(a),
|
|
645
|
-
ref:
|
|
645
|
+
ref: B((i) => {
|
|
646
646
|
i && (o.current = getComputedStyle(i)), n(i);
|
|
647
647
|
}, [])
|
|
648
648
|
};
|
|
649
649
|
}
|
|
650
|
-
function
|
|
650
|
+
function z(e) {
|
|
651
651
|
return (e == null ? void 0 : e.animationName) || "none";
|
|
652
652
|
}
|
|
653
|
-
const
|
|
653
|
+
const we = "Tabs", [St, tn] = ae(we, [
|
|
654
654
|
ye
|
|
655
|
-
]), Ne = ye(), [
|
|
656
|
-
const { __scopeTabs: n, value: o, onValueChange: s, defaultValue: r, orientation: c = "horizontal", dir: a, activationMode: u = "automatic", ...i } = e, p =
|
|
655
|
+
]), Ne = ye(), [Tt, le] = St(we), wt = /* @__PURE__ */ S((e, t) => {
|
|
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
|
|
660
660
|
});
|
|
661
|
-
return /* @__PURE__ */ x(
|
|
661
|
+
return /* @__PURE__ */ x(Tt, {
|
|
662
662
|
scope: n,
|
|
663
663
|
baseId: he(),
|
|
664
664
|
value: l,
|
|
@@ -666,7 +666,7 @@ const Te = "Tabs", [St, tn] = ae(Te, [
|
|
|
666
666
|
orientation: c,
|
|
667
667
|
dir: p,
|
|
668
668
|
activationMode: u
|
|
669
|
-
}, /* @__PURE__ */ x(
|
|
669
|
+
}, /* @__PURE__ */ x(j.div, C({
|
|
670
670
|
dir: p,
|
|
671
671
|
"data-orientation": c
|
|
672
672
|
}, i, {
|
|
@@ -674,13 +674,13 @@ const Te = "Tabs", [St, tn] = ae(Te, [
|
|
|
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(
|
|
683
|
+
}), /* @__PURE__ */ x(j.div, C({
|
|
684
684
|
role: "tablist",
|
|
685
685
|
"aria-orientation": r.orientation
|
|
686
686
|
}, s, {
|
|
@@ -688,12 +688,12 @@ const Te = "Tabs", [St, tn] = ae(Te, [
|
|
|
688
688
|
})));
|
|
689
689
|
}), Et = "TabsTrigger", Pt = /* @__PURE__ */ S((e, t) => {
|
|
690
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(
|
|
691
|
+
return /* @__PURE__ */ x(It, C({
|
|
692
692
|
asChild: !0
|
|
693
693
|
}, a, {
|
|
694
694
|
focusable: !s,
|
|
695
695
|
active: p
|
|
696
|
-
}), /* @__PURE__ */ x(
|
|
696
|
+
}), /* @__PURE__ */ x(j.button, C({
|
|
697
697
|
type: "button",
|
|
698
698
|
role: "tab",
|
|
699
699
|
"aria-selected": p,
|
|
@@ -726,11 +726,11 @@ const Te = "Tabs", [St, tn] = ae(Te, [
|
|
|
726
726
|
);
|
|
727
727
|
return () => cancelAnimationFrame($);
|
|
728
728
|
}, []), /* @__PURE__ */ x(
|
|
729
|
-
|
|
729
|
+
Te,
|
|
730
730
|
{
|
|
731
731
|
present: s || p
|
|
732
732
|
},
|
|
733
|
-
({ present: $ }) => /* @__PURE__ */ x(
|
|
733
|
+
({ present: $ }) => /* @__PURE__ */ x(j.div, C({
|
|
734
734
|
"data-state": p ? "active" : "inactive",
|
|
735
735
|
"data-orientation": a.orientation,
|
|
736
736
|
role: "tabpanel",
|
|
@@ -753,7 +753,7 @@ function Ae(e, t) {
|
|
|
753
753
|
function Ee(e, t) {
|
|
754
754
|
return `${e}-content-${t}`;
|
|
755
755
|
}
|
|
756
|
-
const Ot =
|
|
756
|
+
const Ot = wt, Ft = At, Dt = Pt, qt = Mt;
|
|
757
757
|
function Lt(e) {
|
|
758
758
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
759
759
|
}
|
|
@@ -794,27 +794,27 @@ var Pe = { exports: {} };
|
|
|
794
794
|
})();
|
|
795
795
|
})(Pe);
|
|
796
796
|
var Ut = Pe.exports;
|
|
797
|
-
const de = /* @__PURE__ */ Lt(Ut),
|
|
797
|
+
const de = /* @__PURE__ */ Lt(Ut), Bt = {
|
|
798
798
|
"purpur-tab-content": "_purpur-tab-content_1x2zs_1"
|
|
799
|
-
},
|
|
800
|
-
({ children: e, tabId: t, "data-testid": n, className: o, ...s }, r) => /* @__PURE__ */
|
|
799
|
+
}, Vt = de.bind(Bt), Gt = "purpur-tab-content", jt = S(
|
|
800
|
+
({ children: e, tabId: t, "data-testid": n, className: o, ...s }, r) => /* @__PURE__ */ T(
|
|
801
801
|
qt,
|
|
802
802
|
{
|
|
803
803
|
ref: r,
|
|
804
|
-
className:
|
|
804
|
+
className: Vt([Gt, o]),
|
|
805
805
|
"data-testid": n,
|
|
806
806
|
value: t,
|
|
807
807
|
...s,
|
|
808
808
|
children: e
|
|
809
809
|
}
|
|
810
810
|
)
|
|
811
|
-
), kt = (e) => !!e && k(e) && !!e.props.name && !!e.props.tabId,
|
|
811
|
+
), kt = (e) => !!e && k(e) && !!e.props.name && !!e.props.tabId, Kt = {
|
|
812
812
|
"purpur-tab-header": "_purpur-tab-header_18g3c_1",
|
|
813
813
|
"purpur-tab-header--contained": "_purpur-tab-header--contained_18g3c_33",
|
|
814
814
|
"purpur-tab-header--contained-negative": "_purpur-tab-header--contained-negative_18g3c_33",
|
|
815
815
|
"purpur-tab-header--line": "_purpur-tab-header--line_18g3c_36",
|
|
816
816
|
"purpur-tab-header--line-negative": "_purpur-tab-header--line-negative_18g3c_48"
|
|
817
|
-
},
|
|
817
|
+
}, zt = de.bind(Kt), $e = "purpur-tab-header", Wt = S(
|
|
818
818
|
({
|
|
819
819
|
index: e,
|
|
820
820
|
tabId: t,
|
|
@@ -823,11 +823,11 @@ const de = /* @__PURE__ */ Lt(Ut), Vt = {
|
|
|
823
823
|
onFocus: s,
|
|
824
824
|
"data-testid": r,
|
|
825
825
|
children: c
|
|
826
|
-
}, a) => /* @__PURE__ */
|
|
826
|
+
}, a) => /* @__PURE__ */ T(
|
|
827
827
|
Dt,
|
|
828
828
|
{
|
|
829
829
|
id: `${t}-trigger`,
|
|
830
|
-
className:
|
|
830
|
+
className: zt([$e, `${$e}--${n}${o ? "-negative" : ""}`]),
|
|
831
831
|
value: t,
|
|
832
832
|
"data-testid": r,
|
|
833
833
|
"data-index": e,
|
|
@@ -869,30 +869,30 @@ const de = /* @__PURE__ */ Lt(Ut), Vt = {
|
|
|
869
869
|
"data-testid": a,
|
|
870
870
|
...u
|
|
871
871
|
}) => {
|
|
872
|
-
const [i, p] = D({}), [l, $] = D(0), [v, d] = D(0), b = E.toArray(e).filter(kt), m = R(), _ = R(new Array(b.length)), h = 200, F = t === "line",
|
|
872
|
+
const [i, p] = D({}), [l, $] = D(0), [v, d] = D(0), b = E.toArray(e).filter(kt), m = R(), _ = R(new Array(b.length)), h = 200, F = t === "line", w = 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: f } }) => f),
|
|
877
|
+
]), q = E.map(b, ({ props: { tabId: f } }) => f), K = () => {
|
|
878
878
|
const f = q.findIndex((g) => g === c);
|
|
879
879
|
return f >= 0 ? f : 0;
|
|
880
|
-
}, [
|
|
880
|
+
}, [I, H] = D(K);
|
|
881
881
|
if (new Set(q).size !== q.length)
|
|
882
882
|
throw new Error("tabId must be unique");
|
|
883
|
-
const
|
|
883
|
+
const V = (f, g) => g || a ? `${g || a}-${f}` : void 0, L = () => {
|
|
884
884
|
if (!F)
|
|
885
885
|
return;
|
|
886
|
-
const f = _.current[
|
|
886
|
+
const f = _.current[I];
|
|
887
887
|
$((f == null ? void 0 : f.offsetLeft) || 0), d((f == null ? void 0 : f.getBoundingClientRect().width) || 0);
|
|
888
888
|
}, X = (f) => {
|
|
889
889
|
F && H(b.findIndex((g) => g.props.tabId === f)), s == null || s(Zt(f));
|
|
890
890
|
}, J = (f) => {
|
|
891
891
|
if (m != null && m.current) {
|
|
892
|
-
const { scrollLeft: g } = m.current,
|
|
893
|
-
m.current.scroll({ left: g +
|
|
892
|
+
const { scrollLeft: g } = m.current, G = f === "left" ? -h : h;
|
|
893
|
+
m.current.scroll({ left: g + G, behavior: "smooth" });
|
|
894
894
|
}
|
|
895
|
-
}, Q = ({ side: f }) => /* @__PURE__ */
|
|
895
|
+
}, Q = ({ side: f }) => /* @__PURE__ */ T(
|
|
896
896
|
"button",
|
|
897
897
|
{
|
|
898
898
|
className: U(`${y}__scroll-button`, `${y}__scroll-button--${f}`),
|
|
@@ -900,15 +900,15 @@ const de = /* @__PURE__ */ Lt(Ut), Vt = {
|
|
|
900
900
|
type: "button",
|
|
901
901
|
"aria-hidden": "true",
|
|
902
902
|
tabIndex: -1,
|
|
903
|
-
"data-testid":
|
|
904
|
-
children: /* @__PURE__ */
|
|
903
|
+
"data-testid": V("scroll-button"),
|
|
904
|
+
children: /* @__PURE__ */ T(He, { svg: f === "left" ? je : ke, size: "md" })
|
|
905
905
|
}
|
|
906
906
|
);
|
|
907
907
|
return P(() => (window.addEventListener("resize", L), () => {
|
|
908
908
|
window.removeEventListener("resize", L);
|
|
909
909
|
}), []), P(() => {
|
|
910
910
|
L();
|
|
911
|
-
}, [
|
|
911
|
+
}, [I, o, b.length, t]), P(() => {
|
|
912
912
|
const f = (M) => {
|
|
913
913
|
if (M.every((N) => N.isIntersecting) && M.length === b.length) {
|
|
914
914
|
p({});
|
|
@@ -929,17 +929,17 @@ const de = /* @__PURE__ */ Lt(Ut), Vt = {
|
|
|
929
929
|
}, g = new IntersectionObserver(f, {
|
|
930
930
|
threshold: [0.99],
|
|
931
931
|
root: m.current
|
|
932
|
-
}),
|
|
933
|
-
return
|
|
934
|
-
|
|
932
|
+
}), G = _.current;
|
|
933
|
+
return G.forEach((M) => g.observe(M)), () => {
|
|
934
|
+
G.forEach((M) => g.unobserve(M));
|
|
935
935
|
};
|
|
936
|
-
}, [b.length]), /* @__PURE__ */
|
|
936
|
+
}, [b.length]), /* @__PURE__ */ T(
|
|
937
937
|
Ot,
|
|
938
938
|
{
|
|
939
939
|
defaultValue: c ?? b[0].props.tabId,
|
|
940
940
|
onValueChange: X,
|
|
941
941
|
"data-testid": a,
|
|
942
|
-
className:
|
|
942
|
+
className: w,
|
|
943
943
|
...u,
|
|
944
944
|
children: /* @__PURE__ */ ee("div", { className: U(`${y}__container`), children: [
|
|
945
945
|
/* @__PURE__ */ ee("div", { className: U([`${y}__wrapper`, i]), children: [
|
|
@@ -952,11 +952,11 @@ const de = /* @__PURE__ */ Lt(Ut), Vt = {
|
|
|
952
952
|
className: U(`${y}__list`),
|
|
953
953
|
children: [
|
|
954
954
|
E.map(b, (f, g) => {
|
|
955
|
-
const { name:
|
|
956
|
-
return /* @__PURE__ */
|
|
955
|
+
const { name: G, tabId: M, "data-testid": fe } = f.props;
|
|
956
|
+
return /* @__PURE__ */ T(
|
|
957
957
|
Wt,
|
|
958
958
|
{
|
|
959
|
-
"data-testid":
|
|
959
|
+
"data-testid": V("header", fe),
|
|
960
960
|
index: g,
|
|
961
961
|
tabId: M,
|
|
962
962
|
ref: (N) => {
|
|
@@ -967,11 +967,11 @@ const de = /* @__PURE__ */ Lt(Ut), Vt = {
|
|
|
967
967
|
},
|
|
968
968
|
variant: t,
|
|
969
969
|
negative: n,
|
|
970
|
-
children:
|
|
970
|
+
children: G
|
|
971
971
|
}
|
|
972
972
|
);
|
|
973
973
|
}),
|
|
974
|
-
F && /* @__PURE__ */
|
|
974
|
+
F && /* @__PURE__ */ T(
|
|
975
975
|
"div",
|
|
976
976
|
{
|
|
977
977
|
className: U(`${y}__selected-border`),
|
|
@@ -979,21 +979,21 @@ const de = /* @__PURE__ */ Lt(Ut), Vt = {
|
|
|
979
979
|
width: v,
|
|
980
980
|
transform: `translateX(${l}px)`
|
|
981
981
|
},
|
|
982
|
-
"data-testid":
|
|
982
|
+
"data-testid": V("selected-border")
|
|
983
983
|
}
|
|
984
984
|
)
|
|
985
985
|
]
|
|
986
986
|
}
|
|
987
987
|
),
|
|
988
|
-
/* @__PURE__ */
|
|
989
|
-
/* @__PURE__ */
|
|
988
|
+
/* @__PURE__ */ T(Q, { side: "left" }),
|
|
989
|
+
/* @__PURE__ */ T(Q, { side: "right" })
|
|
990
990
|
] }),
|
|
991
|
-
/* @__PURE__ */
|
|
991
|
+
/* @__PURE__ */ T("div", { className: U(`${y}__content-container`), children: E.map(b, (f) => f) })
|
|
992
992
|
] })
|
|
993
993
|
}
|
|
994
994
|
);
|
|
995
995
|
};
|
|
996
|
-
Xt.Content =
|
|
996
|
+
Xt.Content = jt;
|
|
997
997
|
export {
|
|
998
998
|
Xt as Tabs,
|
|
999
999
|
Zt as createTabChangeDetailEvent,
|