@purpurds/tabs 5.13.0 → 5.15.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 +2 -2
- package/dist/tab-header.d.ts +1 -1
- package/dist/tabs.cjs.js +3 -3
- package/dist/tabs.cjs.js.map +1 -1
- package/dist/tabs.d.ts +2 -2
- package/dist/tabs.es.js +115 -116
- package/dist/tabs.es.js.map +1 -1
- package/package.json +4 -4
package/dist/tabs.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { TabChangeDetail, TabsCmp, TabsVariant } from './tabs.utils';
|
|
2
|
-
import { TabContent } from './tab-content';
|
|
3
1
|
import { ReactElement } from 'react';
|
|
2
|
+
import { TabContent } from './tab-content';
|
|
3
|
+
import { TabChangeDetail, TabsCmp, TabsVariant } from './tabs.utils';
|
|
4
4
|
|
|
5
5
|
type TabsProps = {
|
|
6
6
|
children: Array<ReactElement<typeof TabContent>> | ReactElement<typeof TabContent>;
|
package/dist/tabs.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as w, 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 V, forwardRef as S, Children as E, isValidElement as k, cloneElement as se, Fragment as Oe, 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 Ve = _e.exports;
|
|
45
|
+
const Be = /* @__PURE__ */ Ue(Ve), 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",
|
|
@@ -60,7 +60,7 @@ const Ve = /* @__PURE__ */ Ue(Be), Ge = {
|
|
|
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
|
+
}, ze = Be.bind(Ge), be = "purpur-icon", Ke = "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 Ve = /* @__PURE__ */ Ue(Be), Ge = {
|
|
|
73
73
|
svg: t,
|
|
74
74
|
allyTitle: n,
|
|
75
75
|
className: o,
|
|
76
|
-
size: s =
|
|
76
|
+
size: s = Ke,
|
|
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 = ze(o, be, `${be}--${s}`);
|
|
83
|
+
return /* @__PURE__ */ w(
|
|
84
84
|
"span",
|
|
85
85
|
{
|
|
86
86
|
"aria-label": n,
|
|
@@ -91,17 +91,16 @@ const Ve = /* @__PURE__ */ Ue(Be), Ge = {
|
|
|
91
91
|
}
|
|
92
92
|
);
|
|
93
93
|
};
|
|
94
|
-
function
|
|
95
|
-
return
|
|
94
|
+
function I() {
|
|
95
|
+
return I = Object.assign ? Object.assign.bind() : function(e) {
|
|
96
96
|
for (var t = 1; t < arguments.length; t++) {
|
|
97
97
|
var n = arguments[t];
|
|
98
|
-
for (var o in n)
|
|
99
|
-
Object.prototype.hasOwnProperty.call(n, o) && (e[o] = n[o]);
|
|
98
|
+
for (var o in n) ({}).hasOwnProperty.call(n, o) && (e[o] = n[o]);
|
|
100
99
|
}
|
|
101
100
|
return e;
|
|
102
|
-
},
|
|
101
|
+
}, I.apply(null, arguments);
|
|
103
102
|
}
|
|
104
|
-
function
|
|
103
|
+
function F(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
|
|
105
104
|
return function(s) {
|
|
106
105
|
if (e == null || e(s), n === !1 || !s.defaultPrevented) return t == null ? void 0 : t(s);
|
|
107
106
|
};
|
|
@@ -196,17 +195,17 @@ function ge(...e) {
|
|
|
196
195
|
);
|
|
197
196
|
}
|
|
198
197
|
function Y(...e) {
|
|
199
|
-
return
|
|
198
|
+
return V(ge(...e), e);
|
|
200
199
|
}
|
|
201
200
|
const Z = /* @__PURE__ */ S((e, t) => {
|
|
202
201
|
const { children: n, ...o } = e, s = E.toArray(n), r = s.find(et);
|
|
203
202
|
if (r) {
|
|
204
203
|
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);
|
|
205
|
-
return /* @__PURE__ */ x(re,
|
|
204
|
+
return /* @__PURE__ */ x(re, I({}, o, {
|
|
206
205
|
ref: t
|
|
207
206
|
}), /* @__PURE__ */ k(c) ? /* @__PURE__ */ se(c, void 0, a) : null);
|
|
208
207
|
}
|
|
209
|
-
return /* @__PURE__ */ x(re,
|
|
208
|
+
return /* @__PURE__ */ x(re, I({}, o, {
|
|
210
209
|
ref: t
|
|
211
210
|
}), n);
|
|
212
211
|
});
|
|
@@ -219,7 +218,7 @@ const re = /* @__PURE__ */ S((e, t) => {
|
|
|
219
218
|
}) : E.count(n) > 1 ? E.only(null) : null;
|
|
220
219
|
});
|
|
221
220
|
re.displayName = "SlotClone";
|
|
222
|
-
const Qe = ({ children: e }) => /* @__PURE__ */ x(
|
|
221
|
+
const Qe = ({ children: e }) => /* @__PURE__ */ x(Oe, null, e);
|
|
223
222
|
function et(e) {
|
|
224
223
|
return /* @__PURE__ */ k(e) && e.type === Qe;
|
|
225
224
|
}
|
|
@@ -263,13 +262,13 @@ function nt(e) {
|
|
|
263
262
|
ref: h
|
|
264
263
|
}, m);
|
|
265
264
|
}), i = e + "CollectionItemSlot", p = "data-radix-collection-item", l = /* @__PURE__ */ A.forwardRef((v, d) => {
|
|
266
|
-
const { scope: b, children: m, ..._ } = v, h = A.useRef(null),
|
|
267
|
-
return A.useEffect(() => (
|
|
265
|
+
const { scope: b, children: m, ..._ } = v, h = A.useRef(null), O = Y(d, h), T = r(i, b);
|
|
266
|
+
return A.useEffect(() => (T.itemMap.set(h, {
|
|
268
267
|
ref: h,
|
|
269
268
|
..._
|
|
270
|
-
}), () => void
|
|
269
|
+
}), () => void T.itemMap.delete(h))), /* @__PURE__ */ A.createElement(Z, {
|
|
271
270
|
[p]: "",
|
|
272
|
-
ref:
|
|
271
|
+
ref: O
|
|
273
272
|
}, m);
|
|
274
273
|
});
|
|
275
274
|
function $(v) {
|
|
@@ -279,7 +278,7 @@ function nt(e) {
|
|
|
279
278
|
if (!m) return [];
|
|
280
279
|
const _ = Array.from(m.querySelectorAll(`[${p}]`));
|
|
281
280
|
return Array.from(d.itemMap.values()).sort(
|
|
282
|
-
(
|
|
281
|
+
(T, q) => _.indexOf(T.ref.current) - _.indexOf(q.ref.current)
|
|
283
282
|
);
|
|
284
283
|
}, [
|
|
285
284
|
d.collectionRef,
|
|
@@ -332,7 +331,7 @@ const ct = [
|
|
|
332
331
|
const { asChild: r, ...c } = o, a = r ? Z : t;
|
|
333
332
|
return P(() => {
|
|
334
333
|
window[Symbol.for("radix-ui")] = !0;
|
|
335
|
-
}, []), /* @__PURE__ */ x(a,
|
|
334
|
+
}, []), /* @__PURE__ */ x(a, I({}, c, {
|
|
336
335
|
ref: s
|
|
337
336
|
}));
|
|
338
337
|
});
|
|
@@ -358,7 +357,7 @@ function xe({ prop: e, defaultProp: t, onChange: n = () => {
|
|
|
358
357
|
const [o, s] = st({
|
|
359
358
|
defaultProp: t,
|
|
360
359
|
onChange: n
|
|
361
|
-
}), r = e !== void 0, c = r ? e : o, a = ie(n), u =
|
|
360
|
+
}), r = e !== void 0, c = r ? e : o, a = ie(n), u = V((i) => {
|
|
362
361
|
if (r) {
|
|
363
362
|
const l = typeof i == "function" ? i(e) : i;
|
|
364
363
|
l !== e && a(l);
|
|
@@ -385,31 +384,31 @@ function st({ defaultProp: e, onChange: t }) {
|
|
|
385
384
|
]), n;
|
|
386
385
|
}
|
|
387
386
|
const at = /* @__PURE__ */ ne(void 0);
|
|
388
|
-
function
|
|
387
|
+
function Ce(e) {
|
|
389
388
|
const t = me(at);
|
|
390
389
|
return e || t || "ltr";
|
|
391
390
|
}
|
|
392
391
|
const te = "rovingFocusGroup.onEntryFocus", it = {
|
|
393
392
|
bubbles: !1,
|
|
394
393
|
cancelable: !0
|
|
395
|
-
}, ue = "RovingFocusGroup", [ce,
|
|
394
|
+
}, ue = "RovingFocusGroup", [ce, Ie, ut] = nt(ue), [lt, ye] = ae(ue, [
|
|
396
395
|
ut
|
|
397
396
|
]), [dt, ft] = lt(ue), pt = /* @__PURE__ */ S((e, t) => /* @__PURE__ */ x(ce.Provider, {
|
|
398
397
|
scope: e.__scopeRovingFocusGroup
|
|
399
398
|
}, /* @__PURE__ */ x(ce.Slot, {
|
|
400
399
|
scope: e.__scopeRovingFocusGroup
|
|
401
|
-
}, /* @__PURE__ */ x(bt,
|
|
400
|
+
}, /* @__PURE__ */ x(bt, I({}, e, {
|
|
402
401
|
ref: t
|
|
403
402
|
}))))), bt = /* @__PURE__ */ S((e, t) => {
|
|
404
|
-
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 =
|
|
403
|
+
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 = Ce(r), [d = null, b] = xe({
|
|
405
404
|
prop: c,
|
|
406
405
|
defaultProp: a,
|
|
407
406
|
onChange: u
|
|
408
|
-
}), [m, _] = D(!1), h = ie(i),
|
|
407
|
+
}), [m, _] = D(!1), h = ie(i), O = Ie(n), T = R(!1), [q, z] = D(0);
|
|
409
408
|
return P(() => {
|
|
410
|
-
const
|
|
411
|
-
if (
|
|
412
|
-
return
|
|
409
|
+
const C = l.current;
|
|
410
|
+
if (C)
|
|
411
|
+
return C.addEventListener(te, h), () => C.removeEventListener(te, h);
|
|
413
412
|
}, [
|
|
414
413
|
h
|
|
415
414
|
]), /* @__PURE__ */ x(dt, {
|
|
@@ -418,29 +417,29 @@ const te = "rovingFocusGroup.onEntryFocus", it = {
|
|
|
418
417
|
dir: v,
|
|
419
418
|
loop: s,
|
|
420
419
|
currentTabStopId: d,
|
|
421
|
-
onItemFocus:
|
|
422
|
-
(
|
|
420
|
+
onItemFocus: V(
|
|
421
|
+
(C) => b(C),
|
|
423
422
|
[
|
|
424
423
|
b
|
|
425
424
|
]
|
|
426
425
|
),
|
|
427
|
-
onItemShiftTab:
|
|
426
|
+
onItemShiftTab: V(
|
|
428
427
|
() => _(!0),
|
|
429
428
|
[]
|
|
430
429
|
),
|
|
431
|
-
onFocusableItemAdd:
|
|
432
|
-
() =>
|
|
433
|
-
(
|
|
430
|
+
onFocusableItemAdd: V(
|
|
431
|
+
() => z(
|
|
432
|
+
(C) => C + 1
|
|
434
433
|
),
|
|
435
434
|
[]
|
|
436
435
|
),
|
|
437
|
-
onFocusableItemRemove:
|
|
438
|
-
() =>
|
|
439
|
-
(
|
|
436
|
+
onFocusableItemRemove: V(
|
|
437
|
+
() => z(
|
|
438
|
+
(C) => C - 1
|
|
440
439
|
),
|
|
441
440
|
[]
|
|
442
441
|
)
|
|
443
|
-
}, /* @__PURE__ */ x(j.div,
|
|
442
|
+
}, /* @__PURE__ */ x(j.div, I({
|
|
444
443
|
tabIndex: m || q === 0 ? -1 : 0,
|
|
445
444
|
"data-orientation": o
|
|
446
445
|
}, p, {
|
|
@@ -449,15 +448,15 @@ const te = "rovingFocusGroup.onEntryFocus", it = {
|
|
|
449
448
|
outline: "none",
|
|
450
449
|
...e.style
|
|
451
450
|
},
|
|
452
|
-
onMouseDown:
|
|
453
|
-
|
|
451
|
+
onMouseDown: F(e.onMouseDown, () => {
|
|
452
|
+
T.current = !0;
|
|
454
453
|
}),
|
|
455
|
-
onFocus:
|
|
456
|
-
const H = !
|
|
457
|
-
if (
|
|
458
|
-
const
|
|
459
|
-
if (
|
|
460
|
-
const L =
|
|
454
|
+
onFocus: F(e.onFocus, (C) => {
|
|
455
|
+
const H = !T.current;
|
|
456
|
+
if (C.target === C.currentTarget && H && !m) {
|
|
457
|
+
const B = new CustomEvent(te, it);
|
|
458
|
+
if (C.currentTarget.dispatchEvent(B), !B.defaultPrevented) {
|
|
459
|
+
const L = O().filter(
|
|
461
460
|
(g) => g.focusable
|
|
462
461
|
), X = L.find(
|
|
463
462
|
(g) => g.active
|
|
@@ -473,15 +472,15 @@ const te = "rovingFocusGroup.onEntryFocus", it = {
|
|
|
473
472
|
Se(f);
|
|
474
473
|
}
|
|
475
474
|
}
|
|
476
|
-
|
|
475
|
+
T.current = !1;
|
|
477
476
|
}),
|
|
478
|
-
onBlur:
|
|
477
|
+
onBlur: F(
|
|
479
478
|
e.onBlur,
|
|
480
479
|
() => _(!1)
|
|
481
480
|
)
|
|
482
481
|
})));
|
|
483
482
|
}), $t = "RovingFocusGroupItem", vt = /* @__PURE__ */ S((e, t) => {
|
|
484
|
-
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 =
|
|
483
|
+
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 = Ie(n), { onFocusableItemAdd: $, onFocusableItemRemove: v } = i;
|
|
485
484
|
return P(() => {
|
|
486
485
|
if (o)
|
|
487
486
|
return $(), () => v();
|
|
@@ -494,19 +493,19 @@ const te = "rovingFocusGroup.onEntryFocus", it = {
|
|
|
494
493
|
id: u,
|
|
495
494
|
focusable: o,
|
|
496
495
|
active: s
|
|
497
|
-
}, /* @__PURE__ */ x(j.span,
|
|
496
|
+
}, /* @__PURE__ */ x(j.span, I({
|
|
498
497
|
tabIndex: p ? 0 : -1,
|
|
499
498
|
"data-orientation": i.orientation
|
|
500
499
|
}, c, {
|
|
501
500
|
ref: t,
|
|
502
|
-
onMouseDown:
|
|
501
|
+
onMouseDown: F(e.onMouseDown, (d) => {
|
|
503
502
|
o ? i.onItemFocus(u) : d.preventDefault();
|
|
504
503
|
}),
|
|
505
|
-
onFocus:
|
|
504
|
+
onFocus: F(
|
|
506
505
|
e.onFocus,
|
|
507
506
|
() => i.onItemFocus(u)
|
|
508
507
|
),
|
|
509
|
-
onKeyDown:
|
|
508
|
+
onKeyDown: F(e.onKeyDown, (d) => {
|
|
510
509
|
if (d.key === "Tab" && d.shiftKey) {
|
|
511
510
|
i.onItemShiftTab();
|
|
512
511
|
return;
|
|
@@ -566,14 +565,14 @@ function ht(e, t) {
|
|
|
566
565
|
(n, o) => e[(t + o) % e.length]
|
|
567
566
|
);
|
|
568
567
|
}
|
|
569
|
-
const xt = pt,
|
|
570
|
-
function
|
|
568
|
+
const xt = pt, Ct = vt;
|
|
569
|
+
function It(e, t) {
|
|
571
570
|
return qe((n, o) => {
|
|
572
571
|
const s = t[n][o];
|
|
573
572
|
return s ?? n;
|
|
574
573
|
}, e);
|
|
575
574
|
}
|
|
576
|
-
const
|
|
575
|
+
const we = (e) => {
|
|
577
576
|
const { present: t, children: n } = e, o = yt(t), s = typeof n == "function" ? n({
|
|
578
577
|
present: o.isPresent
|
|
579
578
|
}) : E.only(n), r = Y(o.ref, s.ref);
|
|
@@ -581,9 +580,9 @@ const Te = (e) => {
|
|
|
581
580
|
ref: r
|
|
582
581
|
}) : null;
|
|
583
582
|
};
|
|
584
|
-
|
|
583
|
+
we.displayName = "Presence";
|
|
585
584
|
function yt(e) {
|
|
586
|
-
const [t, n] = D(), o = R({}), s = R(e), r = R("none"), c = e ? "mounted" : "unmounted", [a, u] =
|
|
585
|
+
const [t, n] = D(), o = R({}), s = R(e), r = R("none"), c = e ? "mounted" : "unmounted", [a, u] = It(c, {
|
|
587
586
|
mounted: {
|
|
588
587
|
UNMOUNT: "unmounted",
|
|
589
588
|
ANIMATION_OUT: "unmountSuspended"
|
|
@@ -597,14 +596,14 @@ function yt(e) {
|
|
|
597
596
|
}
|
|
598
597
|
});
|
|
599
598
|
return P(() => {
|
|
600
|
-
const i =
|
|
599
|
+
const i = K(o.current);
|
|
601
600
|
r.current = a === "mounted" ? i : "none";
|
|
602
601
|
}, [
|
|
603
602
|
a
|
|
604
603
|
]), oe(() => {
|
|
605
604
|
const i = o.current, p = s.current;
|
|
606
605
|
if (p !== e) {
|
|
607
|
-
const $ = r.current, v =
|
|
606
|
+
const $ = r.current, v = K(i);
|
|
608
607
|
e ? u("MOUNT") : v === "none" || (i == null ? void 0 : i.display) === "none" ? u("UNMOUNT") : u(p && $ !== v ? "ANIMATION_OUT" : "UNMOUNT"), s.current = e;
|
|
609
608
|
}
|
|
610
609
|
}, [
|
|
@@ -613,12 +612,12 @@ function yt(e) {
|
|
|
613
612
|
]), oe(() => {
|
|
614
613
|
if (t) {
|
|
615
614
|
const i = (l) => {
|
|
616
|
-
const v =
|
|
615
|
+
const v = K(o.current).includes(l.animationName);
|
|
617
616
|
l.target === t && v && Le(
|
|
618
617
|
() => u("ANIMATION_END")
|
|
619
618
|
);
|
|
620
619
|
}, p = (l) => {
|
|
621
|
-
l.target === t && (r.current =
|
|
620
|
+
l.target === t && (r.current = K(o.current));
|
|
622
621
|
};
|
|
623
622
|
return t.addEventListener("animationstart", p), t.addEventListener("animationcancel", i), t.addEventListener("animationend", i), () => {
|
|
624
623
|
t.removeEventListener("animationstart", p), t.removeEventListener("animationcancel", i), t.removeEventListener("animationend", i);
|
|
@@ -633,23 +632,23 @@ function yt(e) {
|
|
|
633
632
|
"mounted",
|
|
634
633
|
"unmountSuspended"
|
|
635
634
|
].includes(a),
|
|
636
|
-
ref:
|
|
635
|
+
ref: V((i) => {
|
|
637
636
|
i && (o.current = getComputedStyle(i)), n(i);
|
|
638
637
|
}, [])
|
|
639
638
|
};
|
|
640
639
|
}
|
|
641
|
-
function
|
|
640
|
+
function K(e) {
|
|
642
641
|
return (e == null ? void 0 : e.animationName) || "none";
|
|
643
642
|
}
|
|
644
|
-
const
|
|
643
|
+
const Te = "Tabs", [St, tn] = ae(Te, [
|
|
645
644
|
ye
|
|
646
|
-
]), Ne = ye(), [
|
|
647
|
-
const { __scopeTabs: n, value: o, onValueChange: s, defaultValue: r, orientation: c = "horizontal", dir: a, activationMode: u = "automatic", ...i } = e, p =
|
|
645
|
+
]), Ne = ye(), [wt, le] = St(Te), Tt = /* @__PURE__ */ S((e, t) => {
|
|
646
|
+
const { __scopeTabs: n, value: o, onValueChange: s, defaultValue: r, orientation: c = "horizontal", dir: a, activationMode: u = "automatic", ...i } = e, p = Ce(a), [l, $] = xe({
|
|
648
647
|
prop: o,
|
|
649
648
|
onChange: s,
|
|
650
649
|
defaultProp: r
|
|
651
650
|
});
|
|
652
|
-
return /* @__PURE__ */ x(
|
|
651
|
+
return /* @__PURE__ */ x(wt, {
|
|
653
652
|
scope: n,
|
|
654
653
|
baseId: he(),
|
|
655
654
|
value: l,
|
|
@@ -657,7 +656,7 @@ const we = "Tabs", [St, tn] = ae(we, [
|
|
|
657
656
|
orientation: c,
|
|
658
657
|
dir: p,
|
|
659
658
|
activationMode: u
|
|
660
|
-
}, /* @__PURE__ */ x(j.div,
|
|
659
|
+
}, /* @__PURE__ */ x(j.div, I({
|
|
661
660
|
dir: p,
|
|
662
661
|
"data-orientation": c
|
|
663
662
|
}, i, {
|
|
@@ -665,13 +664,13 @@ const we = "Tabs", [St, tn] = ae(we, [
|
|
|
665
664
|
})));
|
|
666
665
|
}), Nt = "TabsList", At = /* @__PURE__ */ S((e, t) => {
|
|
667
666
|
const { __scopeTabs: n, loop: o = !0, ...s } = e, r = le(Nt, n), c = Ne(n);
|
|
668
|
-
return /* @__PURE__ */ x(xt,
|
|
667
|
+
return /* @__PURE__ */ x(xt, I({
|
|
669
668
|
asChild: !0
|
|
670
669
|
}, c, {
|
|
671
670
|
orientation: r.orientation,
|
|
672
671
|
dir: r.dir,
|
|
673
672
|
loop: o
|
|
674
|
-
}), /* @__PURE__ */ x(j.div,
|
|
673
|
+
}), /* @__PURE__ */ x(j.div, I({
|
|
675
674
|
role: "tablist",
|
|
676
675
|
"aria-orientation": r.orientation
|
|
677
676
|
}, s, {
|
|
@@ -679,12 +678,12 @@ const we = "Tabs", [St, tn] = ae(we, [
|
|
|
679
678
|
})));
|
|
680
679
|
}), Et = "TabsTrigger", Pt = /* @__PURE__ */ S((e, t) => {
|
|
681
680
|
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;
|
|
682
|
-
return /* @__PURE__ */ x(
|
|
681
|
+
return /* @__PURE__ */ x(Ct, I({
|
|
683
682
|
asChild: !0
|
|
684
683
|
}, a, {
|
|
685
684
|
focusable: !s,
|
|
686
685
|
active: p
|
|
687
|
-
}), /* @__PURE__ */ x(j.button,
|
|
686
|
+
}), /* @__PURE__ */ x(j.button, I({
|
|
688
687
|
type: "button",
|
|
689
688
|
role: "tab",
|
|
690
689
|
"aria-selected": p,
|
|
@@ -695,16 +694,16 @@ const we = "Tabs", [St, tn] = ae(we, [
|
|
|
695
694
|
id: u
|
|
696
695
|
}, r, {
|
|
697
696
|
ref: t,
|
|
698
|
-
onMouseDown:
|
|
697
|
+
onMouseDown: F(e.onMouseDown, (l) => {
|
|
699
698
|
!s && l.button === 0 && l.ctrlKey === !1 ? c.onValueChange(o) : l.preventDefault();
|
|
700
699
|
}),
|
|
701
|
-
onKeyDown:
|
|
700
|
+
onKeyDown: F(e.onKeyDown, (l) => {
|
|
702
701
|
[
|
|
703
702
|
" ",
|
|
704
703
|
"Enter"
|
|
705
704
|
].includes(l.key) && c.onValueChange(o);
|
|
706
705
|
}),
|
|
707
|
-
onFocus:
|
|
706
|
+
onFocus: F(e.onFocus, () => {
|
|
708
707
|
const l = c.activationMode !== "manual";
|
|
709
708
|
!p && !s && l && c.onValueChange(o);
|
|
710
709
|
})
|
|
@@ -717,11 +716,11 @@ const we = "Tabs", [St, tn] = ae(we, [
|
|
|
717
716
|
);
|
|
718
717
|
return () => cancelAnimationFrame($);
|
|
719
718
|
}, []), /* @__PURE__ */ x(
|
|
720
|
-
|
|
719
|
+
we,
|
|
721
720
|
{
|
|
722
721
|
present: s || p
|
|
723
722
|
},
|
|
724
|
-
({ present: $ }) => /* @__PURE__ */ x(j.div,
|
|
723
|
+
({ present: $ }) => /* @__PURE__ */ x(j.div, I({
|
|
725
724
|
"data-state": p ? "active" : "inactive",
|
|
726
725
|
"data-orientation": a.orientation,
|
|
727
726
|
role: "tabpanel",
|
|
@@ -744,7 +743,7 @@ function Ae(e, t) {
|
|
|
744
743
|
function Ee(e, t) {
|
|
745
744
|
return `${e}-content-${t}`;
|
|
746
745
|
}
|
|
747
|
-
const
|
|
746
|
+
const Ft = Tt, Ot = At, Dt = Pt, qt = Mt;
|
|
748
747
|
function Lt(e) {
|
|
749
748
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
750
749
|
}
|
|
@@ -785,27 +784,27 @@ var Pe = { exports: {} };
|
|
|
785
784
|
})();
|
|
786
785
|
})(Pe);
|
|
787
786
|
var Ut = Pe.exports;
|
|
788
|
-
const de = /* @__PURE__ */ Lt(Ut),
|
|
787
|
+
const de = /* @__PURE__ */ Lt(Ut), Vt = {
|
|
789
788
|
"purpur-tab-content": "_purpur-tab-content_1x2zs_1"
|
|
790
|
-
},
|
|
791
|
-
({ children: e, tabId: t, "data-testid": n, className: o, ...s }, r) => /* @__PURE__ */
|
|
789
|
+
}, Bt = de.bind(Vt), Gt = "purpur-tab-content", jt = S(
|
|
790
|
+
({ children: e, tabId: t, "data-testid": n, className: o, ...s }, r) => /* @__PURE__ */ w(
|
|
792
791
|
qt,
|
|
793
792
|
{
|
|
794
793
|
ref: r,
|
|
795
|
-
className:
|
|
794
|
+
className: Bt([Gt, o]),
|
|
796
795
|
"data-testid": n,
|
|
797
796
|
value: t,
|
|
798
797
|
...s,
|
|
799
798
|
children: e
|
|
800
799
|
}
|
|
801
800
|
)
|
|
802
|
-
), kt = (e) => !!e && k(e) && !!e.props.name && !!e.props.tabId,
|
|
801
|
+
), kt = (e) => !!e && k(e) && !!e.props.name && !!e.props.tabId, zt = {
|
|
803
802
|
"purpur-tab-header": "_purpur-tab-header_18g3c_1",
|
|
804
803
|
"purpur-tab-header--contained": "_purpur-tab-header--contained_18g3c_33",
|
|
805
804
|
"purpur-tab-header--contained-negative": "_purpur-tab-header--contained-negative_18g3c_33",
|
|
806
805
|
"purpur-tab-header--line": "_purpur-tab-header--line_18g3c_36",
|
|
807
806
|
"purpur-tab-header--line-negative": "_purpur-tab-header--line-negative_18g3c_48"
|
|
808
|
-
},
|
|
807
|
+
}, Kt = de.bind(zt), $e = "purpur-tab-header", Wt = S(
|
|
809
808
|
({
|
|
810
809
|
index: e,
|
|
811
810
|
tabId: t,
|
|
@@ -814,11 +813,11 @@ const de = /* @__PURE__ */ Lt(Ut), Bt = {
|
|
|
814
813
|
onFocus: s,
|
|
815
814
|
"data-testid": r,
|
|
816
815
|
children: c
|
|
817
|
-
}, a) => /* @__PURE__ */
|
|
816
|
+
}, a) => /* @__PURE__ */ w(
|
|
818
817
|
Dt,
|
|
819
818
|
{
|
|
820
819
|
id: `${t}-trigger`,
|
|
821
|
-
className:
|
|
820
|
+
className: Kt([$e, `${$e}--${n}${o ? "-negative" : ""}`]),
|
|
822
821
|
value: t,
|
|
823
822
|
"data-testid": r,
|
|
824
823
|
"data-index": e,
|
|
@@ -860,30 +859,30 @@ const de = /* @__PURE__ */ Lt(Ut), Bt = {
|
|
|
860
859
|
"data-testid": a,
|
|
861
860
|
...u
|
|
862
861
|
}) => {
|
|
863
|
-
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,
|
|
862
|
+
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, O = t === "line", T = U([
|
|
864
863
|
y,
|
|
865
864
|
`${y}--${t}${n ? "-negative" : ""}`,
|
|
866
865
|
{ [`${y}--fullWidth`]: o },
|
|
867
866
|
r
|
|
868
|
-
]), q = E.map(b, ({ props: { tabId: f } }) => f),
|
|
867
|
+
]), q = E.map(b, ({ props: { tabId: f } }) => f), z = () => {
|
|
869
868
|
const f = q.findIndex((g) => g === c);
|
|
870
869
|
return f >= 0 ? f : 0;
|
|
871
|
-
}, [
|
|
870
|
+
}, [C, H] = D(z);
|
|
872
871
|
if (new Set(q).size !== q.length)
|
|
873
872
|
throw new Error("tabId must be unique");
|
|
874
|
-
const
|
|
875
|
-
if (!
|
|
873
|
+
const B = (f, g) => g || a ? `${g || a}-${f}` : void 0, L = () => {
|
|
874
|
+
if (!O)
|
|
876
875
|
return;
|
|
877
|
-
const f = _.current[
|
|
876
|
+
const f = _.current[C];
|
|
878
877
|
$((f == null ? void 0 : f.offsetLeft) || 0), d((f == null ? void 0 : f.getBoundingClientRect().width) || 0);
|
|
879
878
|
}, X = (f) => {
|
|
880
|
-
|
|
879
|
+
O && H(b.findIndex((g) => g.props.tabId === f)), s == null || s(Zt(f));
|
|
881
880
|
}, J = (f) => {
|
|
882
881
|
if (m != null && m.current) {
|
|
883
882
|
const { scrollLeft: g } = m.current, G = f === "left" ? -h : h;
|
|
884
883
|
m.current.scroll({ left: g + G, behavior: "smooth" });
|
|
885
884
|
}
|
|
886
|
-
}, Q = ({ side: f }) => /* @__PURE__ */
|
|
885
|
+
}, Q = ({ side: f }) => /* @__PURE__ */ w(
|
|
887
886
|
"button",
|
|
888
887
|
{
|
|
889
888
|
className: U(`${y}__scroll-button`, `${y}__scroll-button--${f}`),
|
|
@@ -891,15 +890,15 @@ const de = /* @__PURE__ */ Lt(Ut), Bt = {
|
|
|
891
890
|
type: "button",
|
|
892
891
|
"aria-hidden": "true",
|
|
893
892
|
tabIndex: -1,
|
|
894
|
-
"data-testid":
|
|
895
|
-
children: /* @__PURE__ */
|
|
893
|
+
"data-testid": B("scroll-button"),
|
|
894
|
+
children: /* @__PURE__ */ w(He, { svg: f === "left" ? je : ke, size: "md" })
|
|
896
895
|
}
|
|
897
896
|
);
|
|
898
897
|
return P(() => (window.addEventListener("resize", L), () => {
|
|
899
898
|
window.removeEventListener("resize", L);
|
|
900
899
|
}), []), P(() => {
|
|
901
900
|
L();
|
|
902
|
-
}, [
|
|
901
|
+
}, [C, o, b.length, t]), P(() => {
|
|
903
902
|
const f = (M) => {
|
|
904
903
|
if (M.every((N) => N.isIntersecting) && M.length === b.length) {
|
|
905
904
|
p({});
|
|
@@ -907,8 +906,8 @@ const de = /* @__PURE__ */ Lt(Ut), Bt = {
|
|
|
907
906
|
}
|
|
908
907
|
M.forEach((N) => {
|
|
909
908
|
const pe = Number(N.target.getAttribute("data-index")), Re = pe === 0, Me = pe === b.length - 1;
|
|
910
|
-
p((
|
|
911
|
-
...
|
|
909
|
+
p((Fe) => ({
|
|
910
|
+
...Fe,
|
|
912
911
|
...Re && {
|
|
913
912
|
[`${y}__wrapper--scroll-end`]: !N.isIntersecting
|
|
914
913
|
},
|
|
@@ -924,18 +923,18 @@ const de = /* @__PURE__ */ Lt(Ut), Bt = {
|
|
|
924
923
|
return G.forEach((M) => g.observe(M)), () => {
|
|
925
924
|
G.forEach((M) => g.unobserve(M));
|
|
926
925
|
};
|
|
927
|
-
}, [b.length]), /* @__PURE__ */
|
|
928
|
-
|
|
926
|
+
}, [b.length]), /* @__PURE__ */ w(
|
|
927
|
+
Ft,
|
|
929
928
|
{
|
|
930
929
|
defaultValue: c ?? b[0].props.tabId,
|
|
931
930
|
onValueChange: X,
|
|
932
931
|
"data-testid": a,
|
|
933
|
-
className:
|
|
932
|
+
className: T,
|
|
934
933
|
...u,
|
|
935
934
|
children: /* @__PURE__ */ ee("div", { className: U(`${y}__container`), children: [
|
|
936
935
|
/* @__PURE__ */ ee("div", { className: U([`${y}__wrapper`, i]), children: [
|
|
937
936
|
/* @__PURE__ */ ee(
|
|
938
|
-
|
|
937
|
+
Ot,
|
|
939
938
|
{
|
|
940
939
|
ref: (f) => {
|
|
941
940
|
m.current = f;
|
|
@@ -944,10 +943,10 @@ const de = /* @__PURE__ */ Lt(Ut), Bt = {
|
|
|
944
943
|
children: [
|
|
945
944
|
E.map(b, (f, g) => {
|
|
946
945
|
const { name: G, tabId: M, "data-testid": fe } = f.props;
|
|
947
|
-
return /* @__PURE__ */
|
|
946
|
+
return /* @__PURE__ */ w(
|
|
948
947
|
Wt,
|
|
949
948
|
{
|
|
950
|
-
"data-testid":
|
|
949
|
+
"data-testid": B("header", fe),
|
|
951
950
|
index: g,
|
|
952
951
|
tabId: M,
|
|
953
952
|
ref: (N) => {
|
|
@@ -962,7 +961,7 @@ const de = /* @__PURE__ */ Lt(Ut), Bt = {
|
|
|
962
961
|
}
|
|
963
962
|
);
|
|
964
963
|
}),
|
|
965
|
-
|
|
964
|
+
O && /* @__PURE__ */ w(
|
|
966
965
|
"div",
|
|
967
966
|
{
|
|
968
967
|
className: U(`${y}__selected-border`),
|
|
@@ -970,16 +969,16 @@ const de = /* @__PURE__ */ Lt(Ut), Bt = {
|
|
|
970
969
|
width: v,
|
|
971
970
|
transform: `translateX(${l}px)`
|
|
972
971
|
},
|
|
973
|
-
"data-testid":
|
|
972
|
+
"data-testid": B("selected-border")
|
|
974
973
|
}
|
|
975
974
|
)
|
|
976
975
|
]
|
|
977
976
|
}
|
|
978
977
|
),
|
|
979
|
-
/* @__PURE__ */
|
|
980
|
-
/* @__PURE__ */
|
|
978
|
+
/* @__PURE__ */ w(Q, { side: "left" }),
|
|
979
|
+
/* @__PURE__ */ w(Q, { side: "right" })
|
|
981
980
|
] }),
|
|
982
|
-
/* @__PURE__ */
|
|
981
|
+
/* @__PURE__ */ w("div", { className: U(`${y}__content-container`), children: E.map(b, (f) => f) })
|
|
983
982
|
] })
|
|
984
983
|
}
|
|
985
984
|
);
|