@purpurds/tabs 7.6.1 → 7.8.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/tab-content.d.ts +4 -8
- package/dist/tab-content.d.ts.map +1 -1
- package/dist/tabs.cjs.js +2 -2
- package/dist/tabs.cjs.js.map +1 -1
- package/dist/tabs.d.ts +2 -2
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.es.js +115 -139
- package/dist/tabs.es.js.map +1 -1
- package/dist/tabs.utils.d.ts +2 -1
- package/dist/tabs.utils.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/tab-content.tsx +9 -32
- package/src/tab-header.tsx +1 -1
- package/src/tabs.stories.tsx +2 -2
- package/src/tabs.tsx +13 -6
- package/src/tabs.utils.ts +4 -2
package/dist/tabs.es.js
CHANGED
|
@@ -17,9 +17,9 @@ function Xe() {
|
|
|
17
17
|
(function() {
|
|
18
18
|
var t = {}.hasOwnProperty;
|
|
19
19
|
function n() {
|
|
20
|
-
for (var r = "",
|
|
21
|
-
var
|
|
22
|
-
|
|
20
|
+
for (var r = "", c = 0; c < arguments.length; c++) {
|
|
21
|
+
var i = arguments[c];
|
|
22
|
+
i && (r = s(r, o.call(this, i)));
|
|
23
23
|
}
|
|
24
24
|
return r;
|
|
25
25
|
}
|
|
@@ -32,13 +32,13 @@ function Xe() {
|
|
|
32
32
|
return n.apply(this, r);
|
|
33
33
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
34
34
|
return r.toString();
|
|
35
|
-
var
|
|
36
|
-
for (var
|
|
37
|
-
t.call(r,
|
|
38
|
-
return
|
|
35
|
+
var c = "";
|
|
36
|
+
for (var i in r)
|
|
37
|
+
t.call(r, i) && r[i] && (c = s(c, this && this[i] || i));
|
|
38
|
+
return c;
|
|
39
39
|
}
|
|
40
|
-
function s(r,
|
|
41
|
-
return
|
|
40
|
+
function s(r, c) {
|
|
41
|
+
return c ? r ? r + " " + c : r + c : r;
|
|
42
42
|
}
|
|
43
43
|
e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
|
|
44
44
|
})();
|
|
@@ -61,27 +61,12 @@ const Je = /* @__PURE__ */ Ze(He), Qe = {
|
|
|
61
61
|
t ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
|
|
62
62
|
], o = t ? `<title>${t}</title>` : "";
|
|
63
63
|
return `<svg ${nt(n)}>${o}${e}</svg>`;
|
|
64
|
-
}, ot = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), Ce = ({
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
...r
|
|
71
|
-
}) => {
|
|
72
|
-
const i = rt({
|
|
73
|
-
content: ot(t.svg),
|
|
74
|
-
title: n
|
|
75
|
-
}), c = et(o, _e, `${_e}--${s}`);
|
|
76
|
-
return /* @__PURE__ */ m(
|
|
77
|
-
"span",
|
|
78
|
-
{
|
|
79
|
-
className: c,
|
|
80
|
-
"data-testid": e,
|
|
81
|
-
dangerouslySetInnerHTML: { __html: i },
|
|
82
|
-
...r
|
|
83
|
-
}
|
|
84
|
-
);
|
|
64
|
+
}, ot = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), Ce = ({ svg: e, allyTitle: t, className: n, size: o = tt, ...s }) => {
|
|
65
|
+
const r = rt({
|
|
66
|
+
content: ot(e.svg),
|
|
67
|
+
title: t
|
|
68
|
+
}), c = et(n, _e, `${_e}--${o}`);
|
|
69
|
+
return /* @__PURE__ */ m("span", { className: c, dangerouslySetInnerHTML: { __html: r }, ...s });
|
|
85
70
|
};
|
|
86
71
|
Ce.displayName = "Icon";
|
|
87
72
|
const st = {
|
|
@@ -89,7 +74,7 @@ const st = {
|
|
|
89
74
|
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>',
|
|
90
75
|
keywords: ["chevron-left"],
|
|
91
76
|
category: "utility"
|
|
92
|
-
},
|
|
77
|
+
}, ct = {
|
|
93
78
|
name: "chevron-right",
|
|
94
79
|
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>',
|
|
95
80
|
keywords: ["chevron-right"],
|
|
@@ -103,37 +88,37 @@ function A(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
|
|
|
103
88
|
}
|
|
104
89
|
function se(e, t = []) {
|
|
105
90
|
let n = [];
|
|
106
|
-
function o(r,
|
|
107
|
-
const
|
|
108
|
-
n = [...n,
|
|
91
|
+
function o(r, c) {
|
|
92
|
+
const i = a.createContext(c), l = n.length;
|
|
93
|
+
n = [...n, c];
|
|
109
94
|
const u = (d) => {
|
|
110
95
|
var h;
|
|
111
|
-
const { scope: v, children: b, ...f } = d, g = ((h = v == null ? void 0 : v[e]) == null ? void 0 : h[l]) ||
|
|
96
|
+
const { scope: v, children: b, ...f } = d, g = ((h = v == null ? void 0 : v[e]) == null ? void 0 : h[l]) || i, y = a.useMemo(() => f, Object.values(f));
|
|
112
97
|
return /* @__PURE__ */ m(g.Provider, { value: y, children: b });
|
|
113
98
|
};
|
|
114
99
|
u.displayName = r + "Provider";
|
|
115
100
|
function _(d, v) {
|
|
116
101
|
var g;
|
|
117
|
-
const b = ((g = v == null ? void 0 : v[e]) == null ? void 0 : g[l]) ||
|
|
102
|
+
const b = ((g = v == null ? void 0 : v[e]) == null ? void 0 : g[l]) || i, f = a.useContext(b);
|
|
118
103
|
if (f) return f;
|
|
119
|
-
if (
|
|
104
|
+
if (c !== void 0) return c;
|
|
120
105
|
throw new Error(`\`${d}\` must be used within \`${r}\``);
|
|
121
106
|
}
|
|
122
107
|
return [u, _];
|
|
123
108
|
}
|
|
124
109
|
const s = () => {
|
|
125
|
-
const r = n.map((
|
|
126
|
-
return function(
|
|
127
|
-
const l = (
|
|
110
|
+
const r = n.map((c) => a.createContext(c));
|
|
111
|
+
return function(i) {
|
|
112
|
+
const l = (i == null ? void 0 : i[e]) || r;
|
|
128
113
|
return a.useMemo(
|
|
129
|
-
() => ({ [`__scope${e}`]: { ...
|
|
130
|
-
[
|
|
114
|
+
() => ({ [`__scope${e}`]: { ...i, [e]: l } }),
|
|
115
|
+
[i, l]
|
|
131
116
|
);
|
|
132
117
|
};
|
|
133
118
|
};
|
|
134
|
-
return s.scopeName = e, [o,
|
|
119
|
+
return s.scopeName = e, [o, it(s, ...t)];
|
|
135
120
|
}
|
|
136
|
-
function
|
|
121
|
+
function it(...e) {
|
|
137
122
|
const t = e[0];
|
|
138
123
|
if (e.length === 1) return t;
|
|
139
124
|
const n = () => {
|
|
@@ -142,11 +127,11 @@ function ct(...e) {
|
|
|
142
127
|
scopeName: s.scopeName
|
|
143
128
|
}));
|
|
144
129
|
return function(r) {
|
|
145
|
-
const
|
|
130
|
+
const c = o.reduce((i, { useScope: l, scopeName: u }) => {
|
|
146
131
|
const d = l(r)[`__scope${u}`];
|
|
147
|
-
return { ...
|
|
132
|
+
return { ...i, ...d };
|
|
148
133
|
}, {});
|
|
149
|
-
return a.useMemo(() => ({ [`__scope${t.scopeName}`]:
|
|
134
|
+
return a.useMemo(() => ({ [`__scope${t.scopeName}`]: c }), [c]);
|
|
150
135
|
};
|
|
151
136
|
};
|
|
152
137
|
return n.scopeName = t.scopeName, n;
|
|
@@ -178,8 +163,8 @@ function Y(...e) {
|
|
|
178
163
|
var Z = a.forwardRef((e, t) => {
|
|
179
164
|
const { children: n, ...o } = e, s = a.Children.toArray(n), r = s.find(ut);
|
|
180
165
|
if (r) {
|
|
181
|
-
const
|
|
182
|
-
return /* @__PURE__ */ m(ne, { ...o, ref: t, children: a.isValidElement(
|
|
166
|
+
const c = r.props.children, i = s.map((l) => l === r ? a.Children.count(c) > 1 ? a.Children.only(null) : a.isValidElement(c) ? c.props.children : null : l);
|
|
167
|
+
return /* @__PURE__ */ m(ne, { ...o, ref: t, children: a.isValidElement(c) ? a.cloneElement(c, void 0, i) : null });
|
|
183
168
|
}
|
|
184
169
|
return /* @__PURE__ */ m(ne, { ...o, ref: t, children: n });
|
|
185
170
|
});
|
|
@@ -201,8 +186,8 @@ function lt(e, t) {
|
|
|
201
186
|
const n = { ...t };
|
|
202
187
|
for (const o in t) {
|
|
203
188
|
const s = e[o], r = t[o];
|
|
204
|
-
/^on[A-Z]/.test(o) ? s && r ? n[o] = (...
|
|
205
|
-
r(...
|
|
189
|
+
/^on[A-Z]/.test(o) ? s && r ? n[o] = (...i) => {
|
|
190
|
+
r(...i), s(...i);
|
|
206
191
|
} : s && (n[o] = s) : o === "style" ? n[o] = { ...s, ...r } : o === "className" && (n[o] = [s, r].filter(Boolean).join(" "));
|
|
207
192
|
}
|
|
208
193
|
return { ...e, ...n };
|
|
@@ -216,18 +201,18 @@ function ft(e) {
|
|
|
216
201
|
const t = e + "CollectionProvider", [n, o] = se(t), [s, r] = n(
|
|
217
202
|
t,
|
|
218
203
|
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
219
|
-
),
|
|
204
|
+
), c = (b) => {
|
|
220
205
|
const { scope: f, children: g } = b, y = O.useRef(null), h = O.useRef(/* @__PURE__ */ new Map()).current;
|
|
221
206
|
return /* @__PURE__ */ m(s, { scope: f, itemMap: h, collectionRef: y, children: g });
|
|
222
207
|
};
|
|
223
|
-
|
|
224
|
-
const
|
|
208
|
+
c.displayName = t;
|
|
209
|
+
const i = e + "CollectionSlot", l = O.forwardRef(
|
|
225
210
|
(b, f) => {
|
|
226
|
-
const { scope: g, children: y } = b, h = r(
|
|
211
|
+
const { scope: g, children: y } = b, h = r(i, g), w = Y(f, h.collectionRef);
|
|
227
212
|
return /* @__PURE__ */ m(Z, { ref: w, children: y });
|
|
228
213
|
}
|
|
229
214
|
);
|
|
230
|
-
l.displayName =
|
|
215
|
+
l.displayName = i;
|
|
231
216
|
const u = e + "CollectionItemSlot", _ = "data-radix-collection-item", d = O.forwardRef(
|
|
232
217
|
(b, f) => {
|
|
233
218
|
const { scope: g, children: y, ...h } = b, w = O.useRef(null), j = Y(f, w), C = r(u, g);
|
|
@@ -247,7 +232,7 @@ function ft(e) {
|
|
|
247
232
|
}, [f.collectionRef, f.itemMap]);
|
|
248
233
|
}
|
|
249
234
|
return [
|
|
250
|
-
{ Provider:
|
|
235
|
+
{ Provider: c, Slot: l, ItemSlot: d },
|
|
251
236
|
v,
|
|
252
237
|
o
|
|
253
238
|
];
|
|
@@ -280,12 +265,12 @@ var _t = [
|
|
|
280
265
|
"ul"
|
|
281
266
|
], $ = _t.reduce((e, t) => {
|
|
282
267
|
const n = a.forwardRef((o, s) => {
|
|
283
|
-
const { asChild: r, ...
|
|
284
|
-
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ m(
|
|
268
|
+
const { asChild: r, ...c } = o, i = r ? Z : t;
|
|
269
|
+
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ m(i, { ...c, ref: s });
|
|
285
270
|
});
|
|
286
271
|
return n.displayName = `Primitive.${t}`, { ...e, [t]: n };
|
|
287
272
|
}, {});
|
|
288
|
-
function
|
|
273
|
+
function ce(e) {
|
|
289
274
|
const t = a.useRef(e);
|
|
290
275
|
return a.useEffect(() => {
|
|
291
276
|
t.current = e;
|
|
@@ -300,23 +285,23 @@ function Se({
|
|
|
300
285
|
onChange: n = () => {
|
|
301
286
|
}
|
|
302
287
|
}) {
|
|
303
|
-
const [o, s] = vt({ defaultProp: t, onChange: n }), r = e !== void 0,
|
|
288
|
+
const [o, s] = vt({ defaultProp: t, onChange: n }), r = e !== void 0, c = r ? e : o, i = ce(n), l = a.useCallback(
|
|
304
289
|
(u) => {
|
|
305
290
|
if (r) {
|
|
306
291
|
const d = typeof u == "function" ? u(e) : u;
|
|
307
|
-
d !== e &&
|
|
292
|
+
d !== e && i(d);
|
|
308
293
|
} else
|
|
309
294
|
s(u);
|
|
310
295
|
},
|
|
311
|
-
[r, e, s,
|
|
296
|
+
[r, e, s, i]
|
|
312
297
|
);
|
|
313
|
-
return [
|
|
298
|
+
return [c, l];
|
|
314
299
|
}
|
|
315
300
|
function vt({
|
|
316
301
|
defaultProp: e,
|
|
317
302
|
onChange: t
|
|
318
303
|
}) {
|
|
319
|
-
const n = a.useState(e), [o] = n, s = a.useRef(o), r =
|
|
304
|
+
const n = a.useState(e), [o] = n, s = a.useRef(o), r = ce(t);
|
|
320
305
|
return a.useEffect(() => {
|
|
321
306
|
s.current !== o && (r(o), s.current = o);
|
|
322
307
|
}, [o, s, r]), n;
|
|
@@ -339,17 +324,17 @@ var It = a.forwardRef((e, t) => {
|
|
|
339
324
|
orientation: o,
|
|
340
325
|
loop: s = !1,
|
|
341
326
|
dir: r,
|
|
342
|
-
currentTabStopId:
|
|
343
|
-
defaultCurrentTabStopId:
|
|
327
|
+
currentTabStopId: c,
|
|
328
|
+
defaultCurrentTabStopId: i,
|
|
344
329
|
onCurrentTabStopIdChange: l,
|
|
345
330
|
onEntryFocus: u,
|
|
346
331
|
preventScrollOnEntryFocus: _ = !1,
|
|
347
332
|
...d
|
|
348
333
|
} = e, v = a.useRef(null), b = Y(t, v), f = Ne(r), [g = null, y] = Se({
|
|
349
|
-
prop:
|
|
350
|
-
defaultProp:
|
|
334
|
+
prop: c,
|
|
335
|
+
defaultProp: i,
|
|
351
336
|
onChange: l
|
|
352
|
-
}), [h, w] = a.useState(!1), j =
|
|
337
|
+
}), [h, w] = a.useState(!1), j = ce(u), C = Re(n), N = a.useRef(!1), [D, U] = a.useState(0);
|
|
353
338
|
return a.useEffect(() => {
|
|
354
339
|
const I = v.current;
|
|
355
340
|
if (I)
|
|
@@ -411,8 +396,8 @@ var It = a.forwardRef((e, t) => {
|
|
|
411
396
|
focusable: o = !0,
|
|
412
397
|
active: s = !1,
|
|
413
398
|
tabStopId: r,
|
|
414
|
-
...
|
|
415
|
-
} = e,
|
|
399
|
+
...c
|
|
400
|
+
} = e, i = Ie(), l = r || i, u = yt(Ee, n), _ = u.currentTabStopId === l, d = Re(n), { onFocusableItemAdd: v, onFocusableItemRemove: b } = u;
|
|
416
401
|
return a.useEffect(() => {
|
|
417
402
|
if (o)
|
|
418
403
|
return v(), () => b();
|
|
@@ -428,7 +413,7 @@ var It = a.forwardRef((e, t) => {
|
|
|
428
413
|
{
|
|
429
414
|
tabIndex: _ ? 0 : -1,
|
|
430
415
|
"data-orientation": u.orientation,
|
|
431
|
-
...
|
|
416
|
+
...c,
|
|
432
417
|
ref: t,
|
|
433
418
|
onMouseDown: A(e.onMouseDown, (f) => {
|
|
434
419
|
o ? u.onItemFocus(l) : f.preventDefault();
|
|
@@ -497,7 +482,7 @@ var Me = (e) => {
|
|
|
497
482
|
};
|
|
498
483
|
Me.displayName = "Presence";
|
|
499
484
|
function jt(e) {
|
|
500
|
-
const [t, n] = a.useState(), o = a.useRef({}), s = a.useRef(e), r = a.useRef("none"),
|
|
485
|
+
const [t, n] = a.useState(), o = a.useRef({}), s = a.useRef(e), r = a.useRef("none"), c = e ? "mounted" : "unmounted", [i, l] = At(c, {
|
|
501
486
|
mounted: {
|
|
502
487
|
UNMOUNT: "unmounted",
|
|
503
488
|
ANIMATION_OUT: "unmountSuspended"
|
|
@@ -512,8 +497,8 @@ function jt(e) {
|
|
|
512
497
|
});
|
|
513
498
|
return a.useEffect(() => {
|
|
514
499
|
const u = z(o.current);
|
|
515
|
-
r.current =
|
|
516
|
-
}, [
|
|
500
|
+
r.current = i === "mounted" ? u : "none";
|
|
501
|
+
}, [i]), re(() => {
|
|
517
502
|
const u = o.current, _ = s.current;
|
|
518
503
|
if (_ !== e) {
|
|
519
504
|
const v = r.current, b = z(u);
|
|
@@ -539,7 +524,7 @@ function jt(e) {
|
|
|
539
524
|
} else
|
|
540
525
|
l("ANIMATION_END");
|
|
541
526
|
}, [t, l]), {
|
|
542
|
-
isPresent: ["mounted", "unmountSuspended"].includes(
|
|
527
|
+
isPresent: ["mounted", "unmountSuspended"].includes(i),
|
|
543
528
|
ref: a.useCallback((u) => {
|
|
544
529
|
u && (o.current = getComputedStyle(u)), n(u);
|
|
545
530
|
}, [])
|
|
@@ -553,20 +538,20 @@ function Mt(e) {
|
|
|
553
538
|
let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
|
|
554
539
|
return n ? e.ref : (t = (s = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : s.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
|
|
555
540
|
}
|
|
556
|
-
var
|
|
541
|
+
var ie = "Tabs", [Pt, nn] = se(ie, [
|
|
557
542
|
Te
|
|
558
|
-
]), Pe = Te(), [Ot, ae] = Pt(
|
|
543
|
+
]), Pe = Te(), [Ot, ae] = Pt(ie), Oe = a.forwardRef(
|
|
559
544
|
(e, t) => {
|
|
560
545
|
const {
|
|
561
546
|
__scopeTabs: n,
|
|
562
547
|
value: o,
|
|
563
548
|
onValueChange: s,
|
|
564
549
|
defaultValue: r,
|
|
565
|
-
orientation:
|
|
566
|
-
dir:
|
|
550
|
+
orientation: c = "horizontal",
|
|
551
|
+
dir: i,
|
|
567
552
|
activationMode: l = "automatic",
|
|
568
553
|
...u
|
|
569
|
-
} = e, _ = Ne(
|
|
554
|
+
} = e, _ = Ne(i), [d, v] = Se({
|
|
570
555
|
prop: o,
|
|
571
556
|
onChange: s,
|
|
572
557
|
defaultProp: r
|
|
@@ -578,14 +563,14 @@ var ce = "Tabs", [Pt, nn] = se(ce, [
|
|
|
578
563
|
baseId: Ie(),
|
|
579
564
|
value: d,
|
|
580
565
|
onValueChange: v,
|
|
581
|
-
orientation:
|
|
566
|
+
orientation: c,
|
|
582
567
|
dir: _,
|
|
583
568
|
activationMode: l,
|
|
584
569
|
children: /* @__PURE__ */ m(
|
|
585
570
|
$.div,
|
|
586
571
|
{
|
|
587
572
|
dir: _,
|
|
588
|
-
"data-orientation":
|
|
573
|
+
"data-orientation": c,
|
|
589
574
|
...u,
|
|
590
575
|
ref: t
|
|
591
576
|
}
|
|
@@ -594,15 +579,15 @@ var ce = "Tabs", [Pt, nn] = se(ce, [
|
|
|
594
579
|
);
|
|
595
580
|
}
|
|
596
581
|
);
|
|
597
|
-
Oe.displayName =
|
|
582
|
+
Oe.displayName = ie;
|
|
598
583
|
var Fe = "TabsList", $e = a.forwardRef(
|
|
599
584
|
(e, t) => {
|
|
600
|
-
const { __scopeTabs: n, loop: o = !0, ...s } = e, r = ae(Fe, n),
|
|
585
|
+
const { __scopeTabs: n, loop: o = !0, ...s } = e, r = ae(Fe, n), c = Pe(n);
|
|
601
586
|
return /* @__PURE__ */ m(
|
|
602
587
|
xt,
|
|
603
588
|
{
|
|
604
589
|
asChild: !0,
|
|
605
|
-
...
|
|
590
|
+
...c,
|
|
606
591
|
orientation: r.orientation,
|
|
607
592
|
dir: r.dir,
|
|
608
593
|
loop: o,
|
|
@@ -622,12 +607,12 @@ var Fe = "TabsList", $e = a.forwardRef(
|
|
|
622
607
|
$e.displayName = Fe;
|
|
623
608
|
var De = "TabsTrigger", Le = a.forwardRef(
|
|
624
609
|
(e, t) => {
|
|
625
|
-
const { __scopeTabs: n, value: o, disabled: s = !1, ...r } = e,
|
|
610
|
+
const { __scopeTabs: n, value: o, disabled: s = !1, ...r } = e, c = ae(De, n), i = Pe(n), l = Ue(c.baseId, o), u = Ge(c.baseId, o), _ = o === c.value;
|
|
626
611
|
return /* @__PURE__ */ m(
|
|
627
612
|
Et,
|
|
628
613
|
{
|
|
629
614
|
asChild: !0,
|
|
630
|
-
...
|
|
615
|
+
...i,
|
|
631
616
|
focusable: !s,
|
|
632
617
|
active: _,
|
|
633
618
|
children: /* @__PURE__ */ m(
|
|
@@ -644,14 +629,14 @@ var De = "TabsTrigger", Le = a.forwardRef(
|
|
|
644
629
|
...r,
|
|
645
630
|
ref: t,
|
|
646
631
|
onMouseDown: A(e.onMouseDown, (d) => {
|
|
647
|
-
!s && d.button === 0 && d.ctrlKey === !1 ?
|
|
632
|
+
!s && d.button === 0 && d.ctrlKey === !1 ? c.onValueChange(o) : d.preventDefault();
|
|
648
633
|
}),
|
|
649
634
|
onKeyDown: A(e.onKeyDown, (d) => {
|
|
650
|
-
[" ", "Enter"].includes(d.key) &&
|
|
635
|
+
[" ", "Enter"].includes(d.key) && c.onValueChange(o);
|
|
651
636
|
}),
|
|
652
637
|
onFocus: A(e.onFocus, () => {
|
|
653
|
-
const d =
|
|
654
|
-
!_ && !s && d &&
|
|
638
|
+
const d = c.activationMode !== "manual";
|
|
639
|
+
!_ && !s && d && c.onValueChange(o);
|
|
655
640
|
})
|
|
656
641
|
}
|
|
657
642
|
)
|
|
@@ -662,7 +647,7 @@ var De = "TabsTrigger", Le = a.forwardRef(
|
|
|
662
647
|
Le.displayName = De;
|
|
663
648
|
var Ve = "TabsContent", Be = a.forwardRef(
|
|
664
649
|
(e, t) => {
|
|
665
|
-
const { __scopeTabs: n, value: o, forceMount: s, children: r, ...
|
|
650
|
+
const { __scopeTabs: n, value: o, forceMount: s, children: r, ...c } = e, i = ae(Ve, n), l = Ue(i.baseId, o), u = Ge(i.baseId, o), _ = o === i.value, d = a.useRef(_);
|
|
666
651
|
return a.useEffect(() => {
|
|
667
652
|
const v = requestAnimationFrame(() => d.current = !1);
|
|
668
653
|
return () => cancelAnimationFrame(v);
|
|
@@ -670,13 +655,13 @@ var Ve = "TabsContent", Be = a.forwardRef(
|
|
|
670
655
|
$.div,
|
|
671
656
|
{
|
|
672
657
|
"data-state": _ ? "active" : "inactive",
|
|
673
|
-
"data-orientation":
|
|
658
|
+
"data-orientation": i.orientation,
|
|
674
659
|
role: "tabpanel",
|
|
675
660
|
"aria-labelledby": l,
|
|
676
661
|
hidden: !v,
|
|
677
662
|
id: u,
|
|
678
663
|
tabIndex: 0,
|
|
679
|
-
...
|
|
664
|
+
...c,
|
|
680
665
|
ref: t,
|
|
681
666
|
style: {
|
|
682
667
|
...e.style,
|
|
@@ -710,9 +695,9 @@ function Bt() {
|
|
|
710
695
|
(function() {
|
|
711
696
|
var t = {}.hasOwnProperty;
|
|
712
697
|
function n() {
|
|
713
|
-
for (var r = "",
|
|
714
|
-
var
|
|
715
|
-
|
|
698
|
+
for (var r = "", c = 0; c < arguments.length; c++) {
|
|
699
|
+
var i = arguments[c];
|
|
700
|
+
i && (r = s(r, o.call(this, i)));
|
|
716
701
|
}
|
|
717
702
|
return r;
|
|
718
703
|
}
|
|
@@ -725,13 +710,13 @@ function Bt() {
|
|
|
725
710
|
return n.apply(this, r);
|
|
726
711
|
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
727
712
|
return r.toString();
|
|
728
|
-
var
|
|
729
|
-
for (var
|
|
730
|
-
t.call(r,
|
|
731
|
-
return
|
|
713
|
+
var c = "";
|
|
714
|
+
for (var i in r)
|
|
715
|
+
t.call(r, i) && r[i] && (c = s(c, this && this[i] || i));
|
|
716
|
+
return c;
|
|
732
717
|
}
|
|
733
|
-
function s(r,
|
|
734
|
-
return
|
|
718
|
+
function s(r, c) {
|
|
719
|
+
return c ? r ? r + " " + c : r + c : r;
|
|
735
720
|
}
|
|
736
721
|
e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
|
|
737
722
|
})();
|
|
@@ -742,22 +727,13 @@ const ue = /* @__PURE__ */ Vt(Ut), Gt = {
|
|
|
742
727
|
"purpur-tab-content": "_purpur-tab-content_1ugbi_1",
|
|
743
728
|
"purpur-tab-content--force-mount": "_purpur-tab-content--force-mount_1ugbi_15"
|
|
744
729
|
}, Wt = ue.bind(Gt), ge = "purpur-tab-content", kt = we(
|
|
745
|
-
({
|
|
746
|
-
children: e,
|
|
747
|
-
tabId: t,
|
|
748
|
-
"data-testid": n,
|
|
749
|
-
className: o,
|
|
750
|
-
disableForceMount: s,
|
|
751
|
-
...r
|
|
752
|
-
}, i) => /* @__PURE__ */ m(
|
|
730
|
+
({ children: e, tabId: t, "data-testid": n, className: o, disableForceMount: s, ...r }, c) => /* @__PURE__ */ m(
|
|
753
731
|
Lt,
|
|
754
732
|
{
|
|
755
|
-
ref:
|
|
756
|
-
className: Wt(
|
|
757
|
-
ge
|
|
758
|
-
|
|
759
|
-
{ [`${ge}--force-mount`]: !s }
|
|
760
|
-
]),
|
|
733
|
+
ref: c,
|
|
734
|
+
className: Wt(ge, o, {
|
|
735
|
+
[`${ge}--force-mount`]: !s
|
|
736
|
+
}),
|
|
761
737
|
"data-testid": n,
|
|
762
738
|
value: t,
|
|
763
739
|
forceMount: !s || void 0,
|
|
@@ -779,18 +755,18 @@ const ue = /* @__PURE__ */ Vt(Ut), Gt = {
|
|
|
779
755
|
negative: o,
|
|
780
756
|
onFocus: s,
|
|
781
757
|
"data-testid": r,
|
|
782
|
-
children:
|
|
783
|
-
},
|
|
758
|
+
children: c
|
|
759
|
+
}, i) => /* @__PURE__ */ m(
|
|
784
760
|
Dt,
|
|
785
761
|
{
|
|
786
762
|
id: `${t}-trigger`,
|
|
787
|
-
className: zt(
|
|
763
|
+
className: zt(he, `${he}--${n}${o ? "-negative" : ""}`),
|
|
788
764
|
value: t,
|
|
789
765
|
"data-testid": r,
|
|
790
766
|
"data-index": e,
|
|
791
|
-
ref:
|
|
767
|
+
ref: i,
|
|
792
768
|
onFocus: s,
|
|
793
|
-
children:
|
|
769
|
+
children: c
|
|
794
770
|
}
|
|
795
771
|
)
|
|
796
772
|
), Zt = {
|
|
@@ -813,9 +789,9 @@ const ue = /* @__PURE__ */ Vt(Ut), Gt = {
|
|
|
813
789
|
var l;
|
|
814
790
|
if (typeof (e == null ? void 0 : e.getBoundingClientRect) != "function" || typeof (t == null ? void 0 : t.scroll) != "function")
|
|
815
791
|
return;
|
|
816
|
-
const n = e.getBoundingClientRect(), o = t.getBoundingClientRect(), s = t.clientWidth, r = parseInt((l = getComputedStyle(t).borderLeftWidth) == null ? void 0 : l.split("px")[0], 10),
|
|
817
|
-
let
|
|
818
|
-
n.right > o.right && (
|
|
792
|
+
const n = e.getBoundingClientRect(), o = t.getBoundingClientRect(), s = t.clientWidth, r = parseInt((l = getComputedStyle(t).borderLeftWidth) == null ? void 0 : l.split("px")[0], 10), c = o.left + (isNaN(r) ? 0 : r);
|
|
793
|
+
let i;
|
|
794
|
+
n.right > o.right && (i = n.left + t.scrollLeft, i = i + n.width - s + s * 0.1, i = i - c), n.left < o.left && (i = n.left + t.scrollLeft, i = i - s * 0.1, i = i - c), i !== void 0 && t.scroll({ left: i, behavior: "smooth" });
|
|
819
795
|
}, Jt = ({
|
|
820
796
|
children: e,
|
|
821
797
|
variant: t = "line",
|
|
@@ -823,19 +799,19 @@ const ue = /* @__PURE__ */ Vt(Ut), Gt = {
|
|
|
823
799
|
fullWidth: o = !1,
|
|
824
800
|
onChange: s,
|
|
825
801
|
className: r,
|
|
826
|
-
defaultValue:
|
|
827
|
-
animateHeight:
|
|
802
|
+
defaultValue: c,
|
|
803
|
+
animateHeight: i = !1,
|
|
828
804
|
"data-testid": l,
|
|
829
805
|
value: u,
|
|
830
806
|
..._
|
|
831
807
|
}) => {
|
|
832
|
-
const d = Q(null), [v, b] = B(-1), [f, g] = B({}), [y, h] = B(0), [w, j] = B(0), C = K.toArray(e).filter(Kt), N = Q(null), D = Q(new Array(C.length)), U = 200, I = t === "line", H = P(
|
|
808
|
+
const d = Q(null), [v, b] = B(-1), [f, g] = B({}), [y, h] = B(0), [w, j] = B(0), C = K.toArray(e).filter(Kt), N = Q(null), D = Q(new Array(C.length)), U = 200, I = t === "line", H = P(
|
|
833
809
|
R,
|
|
834
810
|
`${R}--${t}${n ? "-negative" : ""}`,
|
|
835
811
|
{ [`${R}--fullWidth`]: o },
|
|
836
812
|
r
|
|
837
|
-
|
|
838
|
-
const p = F.findIndex((S) => S ===
|
|
813
|
+
), F = K.map(C, ({ props: { tabId: p } }) => p), L = () => {
|
|
814
|
+
const p = F.findIndex((S) => S === c);
|
|
839
815
|
return p >= 0 ? p : 0;
|
|
840
816
|
};
|
|
841
817
|
q(() => {
|
|
@@ -865,12 +841,12 @@ const ue = /* @__PURE__ */ Vt(Ut), Gt = {
|
|
|
865
841
|
"aria-hidden": "true",
|
|
866
842
|
tabIndex: -1,
|
|
867
843
|
"data-testid": W("scroll-button"),
|
|
868
|
-
children: /* @__PURE__ */ m(Ce, { svg: p === "left" ? st :
|
|
844
|
+
children: /* @__PURE__ */ m(Ce, { svg: p === "left" ? st : ct, size: "md" })
|
|
869
845
|
}
|
|
870
846
|
);
|
|
871
847
|
return q(() => {
|
|
872
848
|
const p = () => {
|
|
873
|
-
if (d.current &&
|
|
849
|
+
if (d.current && i) {
|
|
874
850
|
const M = d.current.offsetHeight;
|
|
875
851
|
b(M);
|
|
876
852
|
}
|
|
@@ -880,7 +856,7 @@ const ue = /* @__PURE__ */ Vt(Ut), Gt = {
|
|
|
880
856
|
return p(), window.addEventListener("resize", S), () => {
|
|
881
857
|
window.removeEventListener("resize", S);
|
|
882
858
|
};
|
|
883
|
-
}, [V,
|
|
859
|
+
}, [V, i]), q(() => {
|
|
884
860
|
k();
|
|
885
861
|
}, [V, o, C.length, t]), q(() => {
|
|
886
862
|
const p = (E) => {
|
|
@@ -910,14 +886,14 @@ const ue = /* @__PURE__ */ Vt(Ut), Gt = {
|
|
|
910
886
|
}, [C.length]), /* @__PURE__ */ m(
|
|
911
887
|
Ft,
|
|
912
888
|
{
|
|
913
|
-
defaultValue:
|
|
889
|
+
defaultValue: c ?? C[0].props.tabId,
|
|
914
890
|
onValueChange: x,
|
|
915
891
|
"data-testid": l,
|
|
916
892
|
className: H,
|
|
917
893
|
value: u,
|
|
918
894
|
..._,
|
|
919
895
|
children: /* @__PURE__ */ J("div", { className: P(`${R}__container`), children: [
|
|
920
|
-
/* @__PURE__ */ J("div", { className: P(
|
|
896
|
+
/* @__PURE__ */ J("div", { className: P(`${R}__wrapper`, f), children: [
|
|
921
897
|
/* @__PURE__ */ J(
|
|
922
898
|
$t,
|
|
923
899
|
{
|
|
@@ -966,8 +942,8 @@ const ue = /* @__PURE__ */ Vt(Ut), Gt = {
|
|
|
966
942
|
/* @__PURE__ */ m(
|
|
967
943
|
"div",
|
|
968
944
|
{
|
|
969
|
-
className:
|
|
970
|
-
style: { height:
|
|
945
|
+
className: i ? P(`${R}__content-wrapper`) : "",
|
|
946
|
+
style: { height: i && v > -1 ? `${v}px` : "auto" },
|
|
971
947
|
children: /* @__PURE__ */ m("div", { ref: d, className: P(`${R}__content-container`), children: K.map(C, (p) => p) })
|
|
972
948
|
}
|
|
973
949
|
)
|