@purpurds/tabs 4.2.0 → 4.4.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 +2 -1
- package/dist/tab-header.d.ts +3 -2
- package/dist/tabs.cjs.js +3 -3
- package/dist/tabs.cjs.js.map +1 -1
- package/dist/tabs.d.ts +6 -4
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.es.js +353 -352
- package/dist/tabs.es.js.map +1 -1
- package/dist/tabs.utils.d.ts +2 -1
- package/package.json +11 -11
- package/src/tabs.stories.tsx +53 -2
- package/src/tabs.test.tsx +20 -2
- package/src/tabs.tsx +6 -2
package/dist/tabs.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { jsx as N, jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import { flushSync as
|
|
5
|
-
function
|
|
1
|
+
import { jsx as N, jsxs as Q } from "react/jsx-runtime";
|
|
2
|
+
import * as be from "react";
|
|
3
|
+
import A, { createContext as te, useMemo as Z, createElement as h, useContext as $e, useCallback as L, forwardRef as T, Children as E, isValidElement as K, cloneElement as ce, Fragment as Me, useLayoutEffect as Oe, useEffect as R, useRef as P, useState as O, useReducer as Fe } from "react";
|
|
4
|
+
import { flushSync as De } from "react-dom";
|
|
5
|
+
function qe(e) {
|
|
6
6
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
7
7
|
}
|
|
8
|
-
var
|
|
8
|
+
var ve = { exports: {} };
|
|
9
9
|
/*!
|
|
10
10
|
Copyright (c) 2018 Jed Watson.
|
|
11
11
|
Licensed under the MIT License (MIT), see
|
|
@@ -40,9 +40,9 @@ var be = { exports: {} };
|
|
|
40
40
|
}
|
|
41
41
|
e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
|
|
42
42
|
})();
|
|
43
|
-
})(
|
|
44
|
-
var
|
|
45
|
-
const
|
|
43
|
+
})(ve);
|
|
44
|
+
var Le = ve.exports;
|
|
45
|
+
const Ue = /* @__PURE__ */ qe(Le), Ve = {
|
|
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,36 +50,36 @@ const qe = /* @__PURE__ */ Oe(De), Le = {
|
|
|
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
|
+
}, Be = {
|
|
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"],
|
|
57
57
|
category: "utility"
|
|
58
|
-
},
|
|
58
|
+
}, je = {
|
|
59
59
|
name: "chevron-right",
|
|
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
|
+
}, Ge = Ue.bind(Ve), fe = "purpur-icon", ke = "md", ze = (e) => e.filter((t) => Object.keys(t).length >= 1).map((t) => `${t.name}="${t.value}"`).join(" "), Ke = ({ 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" },
|
|
67
67
|
{ name: "viewBox", value: "0 0 24 24" },
|
|
68
68
|
t ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
|
|
69
69
|
], o = t ? `<title>${t}</title>` : "";
|
|
70
|
-
return `<svg ${
|
|
71
|
-
},
|
|
70
|
+
return `<svg ${ze(n)}>${o}${e}</svg>`;
|
|
71
|
+
}, We = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), Ye = ({
|
|
72
72
|
["data-testid"]: e,
|
|
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
|
-
const c =
|
|
80
|
-
content:
|
|
79
|
+
const c = Ke({
|
|
80
|
+
content: We(t.svg),
|
|
81
81
|
title: n
|
|
82
|
-
}), a =
|
|
82
|
+
}), a = Ge(o, fe, `${fe}--${s}`);
|
|
83
83
|
return /* @__PURE__ */ N(
|
|
84
84
|
"span",
|
|
85
85
|
{
|
|
@@ -101,36 +101,36 @@ function y() {
|
|
|
101
101
|
return e;
|
|
102
102
|
}, y.apply(this, arguments);
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function M(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
|
|
105
105
|
return function(s) {
|
|
106
106
|
if (e == null || e(s), n === !1 || !s.defaultPrevented)
|
|
107
107
|
return t == null ? void 0 : t(s);
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function se(e, t = []) {
|
|
111
111
|
let n = [];
|
|
112
112
|
function o(r, c) {
|
|
113
|
-
const a = /* @__PURE__ */
|
|
113
|
+
const a = /* @__PURE__ */ te(c), u = n.length;
|
|
114
114
|
n = [
|
|
115
115
|
...n,
|
|
116
116
|
c
|
|
117
117
|
];
|
|
118
|
-
function i(
|
|
119
|
-
const { scope:
|
|
120
|
-
() =>
|
|
121
|
-
Object.values(
|
|
118
|
+
function i(d) {
|
|
119
|
+
const { scope: b, children: v, ...l } = d, $ = (b == null ? void 0 : b[e][u]) || a, g = Z(
|
|
120
|
+
() => l,
|
|
121
|
+
Object.values(l)
|
|
122
122
|
);
|
|
123
|
-
return /* @__PURE__ */
|
|
124
|
-
value:
|
|
125
|
-
},
|
|
123
|
+
return /* @__PURE__ */ h($.Provider, {
|
|
124
|
+
value: g
|
|
125
|
+
}, v);
|
|
126
126
|
}
|
|
127
|
-
function f(
|
|
128
|
-
const
|
|
129
|
-
if (
|
|
130
|
-
return
|
|
127
|
+
function f(d, b) {
|
|
128
|
+
const v = (b == null ? void 0 : b[e][u]) || a, l = $e(v);
|
|
129
|
+
if (l)
|
|
130
|
+
return l;
|
|
131
131
|
if (c !== void 0)
|
|
132
132
|
return c;
|
|
133
|
-
throw new Error(`\`${
|
|
133
|
+
throw new Error(`\`${d}\` must be used within \`${r}\``);
|
|
134
134
|
}
|
|
135
135
|
return i.displayName = r + "Provider", [
|
|
136
136
|
i,
|
|
@@ -138,10 +138,10 @@ function ce(e, t = []) {
|
|
|
138
138
|
];
|
|
139
139
|
}
|
|
140
140
|
const s = () => {
|
|
141
|
-
const r = n.map((c) => /* @__PURE__ */
|
|
141
|
+
const r = n.map((c) => /* @__PURE__ */ te(c));
|
|
142
142
|
return function(a) {
|
|
143
143
|
const u = (a == null ? void 0 : a[e]) || r;
|
|
144
|
-
return
|
|
144
|
+
return Z(
|
|
145
145
|
() => ({
|
|
146
146
|
[`__scope${e}`]: {
|
|
147
147
|
...a,
|
|
@@ -157,10 +157,10 @@ function ce(e, t = []) {
|
|
|
157
157
|
};
|
|
158
158
|
return s.scopeName = e, [
|
|
159
159
|
o,
|
|
160
|
-
|
|
160
|
+
Ze(s, ...t)
|
|
161
161
|
];
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function Ze(...e) {
|
|
164
164
|
const t = e[0];
|
|
165
165
|
if (e.length === 1)
|
|
166
166
|
return t;
|
|
@@ -173,13 +173,13 @@ function We(...e) {
|
|
|
173
173
|
);
|
|
174
174
|
return function(r) {
|
|
175
175
|
const c = o.reduce((a, { useScope: u, scopeName: i }) => {
|
|
176
|
-
const
|
|
176
|
+
const d = u(r)[`__scope${i}`];
|
|
177
177
|
return {
|
|
178
178
|
...a,
|
|
179
|
-
...
|
|
179
|
+
...d
|
|
180
180
|
};
|
|
181
181
|
}, {});
|
|
182
|
-
return
|
|
182
|
+
return Z(
|
|
183
183
|
() => ({
|
|
184
184
|
[`__scope${t.scopeName}`]: c
|
|
185
185
|
}),
|
|
@@ -191,43 +191,43 @@ function We(...e) {
|
|
|
191
191
|
};
|
|
192
192
|
return n.scopeName = t.scopeName, n;
|
|
193
193
|
}
|
|
194
|
-
function
|
|
194
|
+
function He(e, t) {
|
|
195
195
|
typeof e == "function" ? e(t) : e != null && (e.current = t);
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function me(...e) {
|
|
198
198
|
return (t) => e.forEach(
|
|
199
|
-
(n) =>
|
|
199
|
+
(n) => He(n, t)
|
|
200
200
|
);
|
|
201
201
|
}
|
|
202
202
|
function H(...e) {
|
|
203
|
-
return
|
|
203
|
+
return L(me(...e), e);
|
|
204
204
|
}
|
|
205
|
-
const
|
|
206
|
-
const { children: n, ...o } = e, s =
|
|
205
|
+
const X = /* @__PURE__ */ T((e, t) => {
|
|
206
|
+
const { children: n, ...o } = e, s = E.toArray(n), r = s.find(Je);
|
|
207
207
|
if (r) {
|
|
208
|
-
const c = r.props.children, a = s.map((u) => u === r ?
|
|
209
|
-
return /* @__PURE__ */
|
|
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__ */ h(ne, y({}, o, {
|
|
210
210
|
ref: t
|
|
211
|
-
}), /* @__PURE__ */
|
|
211
|
+
}), /* @__PURE__ */ K(c) ? /* @__PURE__ */ ce(c, void 0, a) : null);
|
|
212
212
|
}
|
|
213
|
-
return /* @__PURE__ */
|
|
213
|
+
return /* @__PURE__ */ h(ne, y({}, o, {
|
|
214
214
|
ref: t
|
|
215
215
|
}), n);
|
|
216
216
|
});
|
|
217
|
-
|
|
218
|
-
const
|
|
217
|
+
X.displayName = "Slot";
|
|
218
|
+
const ne = /* @__PURE__ */ T((e, t) => {
|
|
219
219
|
const { children: n, ...o } = e;
|
|
220
|
-
return /* @__PURE__ */
|
|
221
|
-
...
|
|
222
|
-
ref: t ?
|
|
223
|
-
}) :
|
|
220
|
+
return /* @__PURE__ */ K(n) ? /* @__PURE__ */ ce(n, {
|
|
221
|
+
...Qe(o, n.props),
|
|
222
|
+
ref: t ? me(t, n.ref) : n.ref
|
|
223
|
+
}) : E.count(n) > 1 ? E.only(null) : null;
|
|
224
224
|
});
|
|
225
|
-
|
|
226
|
-
const
|
|
227
|
-
function
|
|
228
|
-
return /* @__PURE__ */
|
|
225
|
+
ne.displayName = "SlotClone";
|
|
226
|
+
const Xe = ({ children: e }) => /* @__PURE__ */ h(Me, null, e);
|
|
227
|
+
function Je(e) {
|
|
228
|
+
return /* @__PURE__ */ K(e) && e.type === Xe;
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function Qe(e, t) {
|
|
231
231
|
const n = {
|
|
232
232
|
...t
|
|
233
233
|
};
|
|
@@ -248,74 +248,74 @@ function Xe(e, t) {
|
|
|
248
248
|
...n
|
|
249
249
|
};
|
|
250
250
|
}
|
|
251
|
-
function
|
|
252
|
-
const t = e + "CollectionProvider", [n, o] =
|
|
251
|
+
function et(e) {
|
|
252
|
+
const t = e + "CollectionProvider", [n, o] = se(t), [s, r] = n(t, {
|
|
253
253
|
collectionRef: {
|
|
254
254
|
current: null
|
|
255
255
|
},
|
|
256
256
|
itemMap: /* @__PURE__ */ new Map()
|
|
257
|
-
}), c = (
|
|
258
|
-
const { scope:
|
|
259
|
-
return /* @__PURE__ */
|
|
260
|
-
scope:
|
|
261
|
-
itemMap:
|
|
262
|
-
collectionRef:
|
|
263
|
-
},
|
|
264
|
-
}, a = e + "CollectionSlot", u = /* @__PURE__ */
|
|
265
|
-
const { scope:
|
|
266
|
-
return /* @__PURE__ */
|
|
267
|
-
ref:
|
|
268
|
-
},
|
|
269
|
-
}), i = e + "CollectionItemSlot", f = "data-radix-collection-item",
|
|
270
|
-
const { scope:
|
|
271
|
-
return
|
|
272
|
-
ref:
|
|
273
|
-
...
|
|
274
|
-
}), () => void
|
|
257
|
+
}), c = (v) => {
|
|
258
|
+
const { scope: l, children: $ } = v, g = A.useRef(null), m = A.useRef(/* @__PURE__ */ new Map()).current;
|
|
259
|
+
return /* @__PURE__ */ A.createElement(s, {
|
|
260
|
+
scope: l,
|
|
261
|
+
itemMap: m,
|
|
262
|
+
collectionRef: g
|
|
263
|
+
}, $);
|
|
264
|
+
}, a = e + "CollectionSlot", u = /* @__PURE__ */ A.forwardRef((v, l) => {
|
|
265
|
+
const { scope: $, children: g } = v, m = r(a, $), _ = H(l, m.collectionRef);
|
|
266
|
+
return /* @__PURE__ */ A.createElement(X, {
|
|
267
|
+
ref: _
|
|
268
|
+
}, g);
|
|
269
|
+
}), i = e + "CollectionItemSlot", f = "data-radix-collection-item", d = /* @__PURE__ */ A.forwardRef((v, l) => {
|
|
270
|
+
const { scope: $, children: g, ...m } = v, _ = A.useRef(null), U = H(l, _), S = r(i, $);
|
|
271
|
+
return A.useEffect(() => (S.itemMap.set(_, {
|
|
272
|
+
ref: _,
|
|
273
|
+
...m
|
|
274
|
+
}), () => void S.itemMap.delete(_))), /* @__PURE__ */ A.createElement(X, {
|
|
275
275
|
[f]: "",
|
|
276
|
-
ref:
|
|
277
|
-
},
|
|
276
|
+
ref: U
|
|
277
|
+
}, g);
|
|
278
278
|
});
|
|
279
|
-
function
|
|
280
|
-
const
|
|
281
|
-
return
|
|
282
|
-
const
|
|
283
|
-
if (!
|
|
279
|
+
function b(v) {
|
|
280
|
+
const l = r(e + "CollectionConsumer", v);
|
|
281
|
+
return A.useCallback(() => {
|
|
282
|
+
const g = l.collectionRef.current;
|
|
283
|
+
if (!g)
|
|
284
284
|
return [];
|
|
285
|
-
const
|
|
286
|
-
return Array.from(
|
|
287
|
-
(
|
|
285
|
+
const m = Array.from(g.querySelectorAll(`[${f}]`));
|
|
286
|
+
return Array.from(l.itemMap.values()).sort(
|
|
287
|
+
(S, j) => m.indexOf(S.ref.current) - m.indexOf(j.ref.current)
|
|
288
288
|
);
|
|
289
289
|
}, [
|
|
290
|
-
|
|
291
|
-
|
|
290
|
+
l.collectionRef,
|
|
291
|
+
l.itemMap
|
|
292
292
|
]);
|
|
293
293
|
}
|
|
294
294
|
return [
|
|
295
295
|
{
|
|
296
296
|
Provider: c,
|
|
297
297
|
Slot: u,
|
|
298
|
-
ItemSlot:
|
|
298
|
+
ItemSlot: d
|
|
299
299
|
},
|
|
300
|
-
|
|
300
|
+
b,
|
|
301
301
|
o
|
|
302
302
|
];
|
|
303
303
|
}
|
|
304
|
-
const
|
|
305
|
-
},
|
|
304
|
+
const re = globalThis != null && globalThis.document ? Oe : () => {
|
|
305
|
+
}, tt = be.useId || (() => {
|
|
306
306
|
});
|
|
307
|
-
let
|
|
308
|
-
function
|
|
309
|
-
const [t, n] =
|
|
310
|
-
return
|
|
307
|
+
let nt = 0;
|
|
308
|
+
function _e(e) {
|
|
309
|
+
const [t, n] = be.useState(tt());
|
|
310
|
+
return re(() => {
|
|
311
311
|
e || n(
|
|
312
|
-
(o) => o ?? String(
|
|
312
|
+
(o) => o ?? String(nt++)
|
|
313
313
|
);
|
|
314
314
|
}, [
|
|
315
315
|
e
|
|
316
316
|
]), e || (t ? `radix-${t}` : "");
|
|
317
317
|
}
|
|
318
|
-
const
|
|
318
|
+
const rt = [
|
|
319
319
|
"a",
|
|
320
320
|
"button",
|
|
321
321
|
"div",
|
|
@@ -332,12 +332,12 @@ const tt = [
|
|
|
332
332
|
"span",
|
|
333
333
|
"svg",
|
|
334
334
|
"ul"
|
|
335
|
-
],
|
|
335
|
+
], B = rt.reduce((e, t) => {
|
|
336
336
|
const n = /* @__PURE__ */ T((o, s) => {
|
|
337
|
-
const { asChild: r, ...c } = o, a = r ?
|
|
337
|
+
const { asChild: r, ...c } = o, a = r ? X : t;
|
|
338
338
|
return R(() => {
|
|
339
339
|
window[Symbol.for("radix-ui")] = !0;
|
|
340
|
-
}, []), /* @__PURE__ */
|
|
340
|
+
}, []), /* @__PURE__ */ h(a, y({}, c, {
|
|
341
341
|
ref: s
|
|
342
342
|
}));
|
|
343
343
|
});
|
|
@@ -346,11 +346,11 @@ const tt = [
|
|
|
346
346
|
[t]: n
|
|
347
347
|
};
|
|
348
348
|
}, {});
|
|
349
|
-
function
|
|
350
|
-
const t =
|
|
349
|
+
function ae(e) {
|
|
350
|
+
const t = P(e);
|
|
351
351
|
return R(() => {
|
|
352
352
|
t.current = e;
|
|
353
|
-
}),
|
|
353
|
+
}), Z(
|
|
354
354
|
() => (...n) => {
|
|
355
355
|
var o;
|
|
356
356
|
return (o = t.current) === null || o === void 0 ? void 0 : o.call(t, ...n);
|
|
@@ -358,15 +358,15 @@ function se(e) {
|
|
|
358
358
|
[]
|
|
359
359
|
);
|
|
360
360
|
}
|
|
361
|
-
function
|
|
361
|
+
function he({ prop: e, defaultProp: t, onChange: n = () => {
|
|
362
362
|
} }) {
|
|
363
|
-
const [o, s] =
|
|
363
|
+
const [o, s] = ot({
|
|
364
364
|
defaultProp: t,
|
|
365
365
|
onChange: n
|
|
366
|
-
}), r = e !== void 0, c = r ? e : o, a =
|
|
366
|
+
}), r = e !== void 0, c = r ? e : o, a = ae(n), u = L((i) => {
|
|
367
367
|
if (r) {
|
|
368
|
-
const
|
|
369
|
-
|
|
368
|
+
const d = typeof i == "function" ? i(e) : i;
|
|
369
|
+
d !== e && a(d);
|
|
370
370
|
} else
|
|
371
371
|
s(i);
|
|
372
372
|
}, [
|
|
@@ -380,8 +380,8 @@ function me({ prop: e, defaultProp: t, onChange: n = () => {
|
|
|
380
380
|
u
|
|
381
381
|
];
|
|
382
382
|
}
|
|
383
|
-
function
|
|
384
|
-
const n =
|
|
383
|
+
function ot({ defaultProp: e, onChange: t }) {
|
|
384
|
+
const n = O(e), [o] = n, s = P(o), r = ae(t);
|
|
385
385
|
return R(() => {
|
|
386
386
|
s.current !== o && (r(o), s.current = o);
|
|
387
387
|
}, [
|
|
@@ -390,157 +390,157 @@ function nt({ defaultProp: e, onChange: t }) {
|
|
|
390
390
|
r
|
|
391
391
|
]), n;
|
|
392
392
|
}
|
|
393
|
-
const
|
|
394
|
-
function
|
|
395
|
-
const t =
|
|
393
|
+
const ct = /* @__PURE__ */ te(void 0);
|
|
394
|
+
function ge(e) {
|
|
395
|
+
const t = $e(ct);
|
|
396
396
|
return e || t || "ltr";
|
|
397
397
|
}
|
|
398
|
-
const
|
|
398
|
+
const ee = "rovingFocusGroup.onEntryFocus", st = {
|
|
399
399
|
bubbles: !1,
|
|
400
400
|
cancelable: !0
|
|
401
|
-
},
|
|
402
|
-
|
|
403
|
-
]), [
|
|
401
|
+
}, ie = "RovingFocusGroup", [oe, xe, at] = et(ie), [it, Ce] = se(ie, [
|
|
402
|
+
at
|
|
403
|
+
]), [ut, lt] = it(ie), dt = /* @__PURE__ */ T((e, t) => /* @__PURE__ */ h(oe.Provider, {
|
|
404
404
|
scope: e.__scopeRovingFocusGroup
|
|
405
|
-
}, /* @__PURE__ */
|
|
405
|
+
}, /* @__PURE__ */ h(oe.Slot, {
|
|
406
406
|
scope: e.__scopeRovingFocusGroup
|
|
407
|
-
}, /* @__PURE__ */
|
|
407
|
+
}, /* @__PURE__ */ h(ft, y({}, e, {
|
|
408
408
|
ref: t
|
|
409
|
-
}))))),
|
|
410
|
-
const { __scopeRovingFocusGroup: n, orientation: o, loop: s = !1, dir: r, currentTabStopId: c, defaultCurrentTabStopId: a, onCurrentTabStopIdChange: u, onEntryFocus: i, ...f } = e,
|
|
409
|
+
}))))), ft = /* @__PURE__ */ T((e, t) => {
|
|
410
|
+
const { __scopeRovingFocusGroup: n, orientation: o, loop: s = !1, dir: r, currentTabStopId: c, defaultCurrentTabStopId: a, onCurrentTabStopIdChange: u, onEntryFocus: i, ...f } = e, d = P(null), b = H(t, d), v = ge(r), [l = null, $] = he({
|
|
411
411
|
prop: c,
|
|
412
412
|
defaultProp: a,
|
|
413
413
|
onChange: u
|
|
414
|
-
}), [
|
|
414
|
+
}), [g, m] = O(!1), _ = ae(i), U = xe(n), S = P(!1), [j, G] = O(0);
|
|
415
415
|
return R(() => {
|
|
416
|
-
const
|
|
417
|
-
if (
|
|
418
|
-
return
|
|
416
|
+
const C = d.current;
|
|
417
|
+
if (C)
|
|
418
|
+
return C.addEventListener(ee, _), () => C.removeEventListener(ee, _);
|
|
419
419
|
}, [
|
|
420
|
-
|
|
421
|
-
]), /* @__PURE__ */
|
|
420
|
+
_
|
|
421
|
+
]), /* @__PURE__ */ h(ut, {
|
|
422
422
|
scope: n,
|
|
423
423
|
orientation: o,
|
|
424
|
-
dir:
|
|
424
|
+
dir: v,
|
|
425
425
|
loop: s,
|
|
426
|
-
currentTabStopId:
|
|
427
|
-
onItemFocus:
|
|
428
|
-
(
|
|
426
|
+
currentTabStopId: l,
|
|
427
|
+
onItemFocus: L(
|
|
428
|
+
(C) => $(C),
|
|
429
429
|
[
|
|
430
|
-
|
|
430
|
+
$
|
|
431
431
|
]
|
|
432
432
|
),
|
|
433
|
-
onItemShiftTab:
|
|
434
|
-
() =>
|
|
433
|
+
onItemShiftTab: L(
|
|
434
|
+
() => m(!0),
|
|
435
435
|
[]
|
|
436
436
|
),
|
|
437
|
-
onFocusableItemAdd:
|
|
438
|
-
() =>
|
|
439
|
-
(
|
|
437
|
+
onFocusableItemAdd: L(
|
|
438
|
+
() => G(
|
|
439
|
+
(C) => C + 1
|
|
440
440
|
),
|
|
441
441
|
[]
|
|
442
442
|
),
|
|
443
|
-
onFocusableItemRemove:
|
|
444
|
-
() =>
|
|
445
|
-
(
|
|
443
|
+
onFocusableItemRemove: L(
|
|
444
|
+
() => G(
|
|
445
|
+
(C) => C - 1
|
|
446
446
|
),
|
|
447
447
|
[]
|
|
448
448
|
)
|
|
449
|
-
}, /* @__PURE__ */
|
|
450
|
-
tabIndex:
|
|
449
|
+
}, /* @__PURE__ */ h(B.div, y({
|
|
450
|
+
tabIndex: g || j === 0 ? -1 : 0,
|
|
451
451
|
"data-orientation": o
|
|
452
452
|
}, f, {
|
|
453
|
-
ref:
|
|
453
|
+
ref: b,
|
|
454
454
|
style: {
|
|
455
455
|
outline: "none",
|
|
456
456
|
...e.style
|
|
457
457
|
},
|
|
458
|
-
onMouseDown:
|
|
459
|
-
|
|
458
|
+
onMouseDown: M(e.onMouseDown, () => {
|
|
459
|
+
S.current = !0;
|
|
460
460
|
}),
|
|
461
|
-
onFocus:
|
|
462
|
-
const
|
|
463
|
-
if (
|
|
464
|
-
const
|
|
465
|
-
if (
|
|
466
|
-
const
|
|
467
|
-
(
|
|
468
|
-
),
|
|
469
|
-
(
|
|
470
|
-
),
|
|
471
|
-
(
|
|
472
|
-
),
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
...
|
|
461
|
+
onFocus: M(e.onFocus, (C) => {
|
|
462
|
+
const k = !S.current;
|
|
463
|
+
if (C.target === C.currentTarget && k && !g) {
|
|
464
|
+
const V = new CustomEvent(ee, st);
|
|
465
|
+
if (C.currentTarget.dispatchEvent(V), !V.defaultPrevented) {
|
|
466
|
+
const z = U().filter(
|
|
467
|
+
(x) => x.focusable
|
|
468
|
+
), J = z.find(
|
|
469
|
+
(x) => x.active
|
|
470
|
+
), W = z.find(
|
|
471
|
+
(x) => x.id === l
|
|
472
|
+
), I = [
|
|
473
|
+
J,
|
|
474
|
+
W,
|
|
475
|
+
...z
|
|
476
476
|
].filter(Boolean).map(
|
|
477
|
-
(
|
|
477
|
+
(x) => x.ref.current
|
|
478
478
|
);
|
|
479
|
-
|
|
479
|
+
Ie(I);
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
|
-
|
|
482
|
+
S.current = !1;
|
|
483
483
|
}),
|
|
484
|
-
onBlur:
|
|
484
|
+
onBlur: M(
|
|
485
485
|
e.onBlur,
|
|
486
|
-
() =>
|
|
486
|
+
() => m(!1)
|
|
487
487
|
)
|
|
488
488
|
})));
|
|
489
|
-
}),
|
|
490
|
-
const { __scopeRovingFocusGroup: n, focusable: o = !0, active: s = !1, tabStopId: r, ...c } = e, a =
|
|
489
|
+
}), pt = "RovingFocusGroupItem", bt = /* @__PURE__ */ T((e, t) => {
|
|
490
|
+
const { __scopeRovingFocusGroup: n, focusable: o = !0, active: s = !1, tabStopId: r, ...c } = e, a = _e(), u = r || a, i = lt(pt, n), f = i.currentTabStopId === u, d = xe(n), { onFocusableItemAdd: b, onFocusableItemRemove: v } = i;
|
|
491
491
|
return R(() => {
|
|
492
492
|
if (o)
|
|
493
|
-
return
|
|
493
|
+
return b(), () => v();
|
|
494
494
|
}, [
|
|
495
495
|
o,
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
]), /* @__PURE__ */
|
|
496
|
+
b,
|
|
497
|
+
v
|
|
498
|
+
]), /* @__PURE__ */ h(oe.ItemSlot, {
|
|
499
499
|
scope: n,
|
|
500
500
|
id: u,
|
|
501
501
|
focusable: o,
|
|
502
502
|
active: s
|
|
503
|
-
}, /* @__PURE__ */
|
|
503
|
+
}, /* @__PURE__ */ h(B.span, y({
|
|
504
504
|
tabIndex: f ? 0 : -1,
|
|
505
505
|
"data-orientation": i.orientation
|
|
506
506
|
}, c, {
|
|
507
507
|
ref: t,
|
|
508
|
-
onMouseDown:
|
|
509
|
-
o ? i.onItemFocus(u) :
|
|
508
|
+
onMouseDown: M(e.onMouseDown, (l) => {
|
|
509
|
+
o ? i.onItemFocus(u) : l.preventDefault();
|
|
510
510
|
}),
|
|
511
|
-
onFocus:
|
|
511
|
+
onFocus: M(
|
|
512
512
|
e.onFocus,
|
|
513
513
|
() => i.onItemFocus(u)
|
|
514
514
|
),
|
|
515
|
-
onKeyDown:
|
|
516
|
-
if (
|
|
515
|
+
onKeyDown: M(e.onKeyDown, (l) => {
|
|
516
|
+
if (l.key === "Tab" && l.shiftKey) {
|
|
517
517
|
i.onItemShiftTab();
|
|
518
518
|
return;
|
|
519
519
|
}
|
|
520
|
-
if (
|
|
520
|
+
if (l.target !== l.currentTarget)
|
|
521
521
|
return;
|
|
522
|
-
const
|
|
523
|
-
if (
|
|
524
|
-
|
|
525
|
-
let
|
|
526
|
-
(
|
|
522
|
+
const $ = mt(l, i.orientation, i.dir);
|
|
523
|
+
if ($ !== void 0) {
|
|
524
|
+
l.preventDefault();
|
|
525
|
+
let m = d().filter(
|
|
526
|
+
(_) => _.focusable
|
|
527
527
|
).map(
|
|
528
|
-
(
|
|
528
|
+
(_) => _.ref.current
|
|
529
529
|
);
|
|
530
|
-
if (
|
|
531
|
-
|
|
532
|
-
else if (
|
|
533
|
-
|
|
534
|
-
const
|
|
535
|
-
|
|
530
|
+
if ($ === "last")
|
|
531
|
+
m.reverse();
|
|
532
|
+
else if ($ === "prev" || $ === "next") {
|
|
533
|
+
$ === "prev" && m.reverse();
|
|
534
|
+
const _ = m.indexOf(l.currentTarget);
|
|
535
|
+
m = i.loop ? _t(m, _ + 1) : m.slice(_ + 1);
|
|
536
536
|
}
|
|
537
537
|
setTimeout(
|
|
538
|
-
() =>
|
|
538
|
+
() => Ie(m)
|
|
539
539
|
);
|
|
540
540
|
}
|
|
541
541
|
})
|
|
542
542
|
})));
|
|
543
|
-
}),
|
|
543
|
+
}), $t = {
|
|
544
544
|
ArrowLeft: "prev",
|
|
545
545
|
ArrowUp: "prev",
|
|
546
546
|
ArrowRight: "next",
|
|
@@ -550,11 +550,11 @@ const Q = "rovingFocusGroup.onEntryFocus", ot = {
|
|
|
550
550
|
PageDown: "last",
|
|
551
551
|
End: "last"
|
|
552
552
|
};
|
|
553
|
-
function
|
|
553
|
+
function vt(e, t) {
|
|
554
554
|
return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
|
|
555
555
|
}
|
|
556
|
-
function
|
|
557
|
-
const o =
|
|
556
|
+
function mt(e, t, n) {
|
|
557
|
+
const o = vt(e.key, n);
|
|
558
558
|
if (!(t === "vertical" && [
|
|
559
559
|
"ArrowLeft",
|
|
560
560
|
"ArrowRight"
|
|
@@ -562,37 +562,37 @@ function $t(e, t, n) {
|
|
|
562
562
|
"ArrowUp",
|
|
563
563
|
"ArrowDown"
|
|
564
564
|
].includes(o)))
|
|
565
|
-
return
|
|
565
|
+
return $t[o];
|
|
566
566
|
}
|
|
567
|
-
function
|
|
567
|
+
function Ie(e) {
|
|
568
568
|
const t = document.activeElement;
|
|
569
569
|
for (const n of e)
|
|
570
570
|
if (n === t || (n.focus(), document.activeElement !== t))
|
|
571
571
|
return;
|
|
572
572
|
}
|
|
573
|
-
function
|
|
573
|
+
function _t(e, t) {
|
|
574
574
|
return e.map(
|
|
575
575
|
(n, o) => e[(t + o) % e.length]
|
|
576
576
|
);
|
|
577
577
|
}
|
|
578
|
-
const
|
|
579
|
-
function
|
|
580
|
-
return
|
|
578
|
+
const ht = dt, gt = bt;
|
|
579
|
+
function xt(e, t) {
|
|
580
|
+
return Fe((n, o) => {
|
|
581
581
|
const s = t[n][o];
|
|
582
582
|
return s ?? n;
|
|
583
583
|
}, e);
|
|
584
584
|
}
|
|
585
|
-
const
|
|
586
|
-
const { present: t, children: n } = e, o =
|
|
585
|
+
const ye = (e) => {
|
|
586
|
+
const { present: t, children: n } = e, o = Ct(t), s = typeof n == "function" ? n({
|
|
587
587
|
present: o.isPresent
|
|
588
|
-
}) :
|
|
589
|
-
return typeof n == "function" || o.isPresent ? /* @__PURE__ */
|
|
588
|
+
}) : E.only(n), r = H(o.ref, s.ref);
|
|
589
|
+
return typeof n == "function" || o.isPresent ? /* @__PURE__ */ ce(s, {
|
|
590
590
|
ref: r
|
|
591
591
|
}) : null;
|
|
592
592
|
};
|
|
593
|
-
|
|
594
|
-
function
|
|
595
|
-
const [t, n] =
|
|
593
|
+
ye.displayName = "Presence";
|
|
594
|
+
function Ct(e) {
|
|
595
|
+
const [t, n] = O(), o = P({}), s = P(e), r = P("none"), c = e ? "mounted" : "unmounted", [a, u] = xt(c, {
|
|
596
596
|
mounted: {
|
|
597
597
|
UNMOUNT: "unmounted",
|
|
598
598
|
ANIMATION_OUT: "unmountSuspended"
|
|
@@ -606,28 +606,28 @@ function gt(e) {
|
|
|
606
606
|
}
|
|
607
607
|
});
|
|
608
608
|
return R(() => {
|
|
609
|
-
const i =
|
|
609
|
+
const i = Y(o.current);
|
|
610
610
|
r.current = a === "mounted" ? i : "none";
|
|
611
611
|
}, [
|
|
612
612
|
a
|
|
613
|
-
]),
|
|
613
|
+
]), re(() => {
|
|
614
614
|
const i = o.current, f = s.current;
|
|
615
615
|
if (f !== e) {
|
|
616
|
-
const
|
|
617
|
-
e ? u("MOUNT") :
|
|
616
|
+
const b = r.current, v = Y(i);
|
|
617
|
+
e ? u("MOUNT") : v === "none" || (i == null ? void 0 : i.display) === "none" ? u("UNMOUNT") : u(f && b !== v ? "ANIMATION_OUT" : "UNMOUNT"), s.current = e;
|
|
618
618
|
}
|
|
619
619
|
}, [
|
|
620
620
|
e,
|
|
621
621
|
u
|
|
622
|
-
]),
|
|
622
|
+
]), re(() => {
|
|
623
623
|
if (t) {
|
|
624
|
-
const i = (
|
|
625
|
-
const
|
|
626
|
-
|
|
624
|
+
const i = (d) => {
|
|
625
|
+
const v = Y(o.current).includes(d.animationName);
|
|
626
|
+
d.target === t && v && De(
|
|
627
627
|
() => u("ANIMATION_END")
|
|
628
628
|
);
|
|
629
|
-
}, f = (
|
|
630
|
-
|
|
629
|
+
}, f = (d) => {
|
|
630
|
+
d.target === t && (r.current = Y(o.current));
|
|
631
631
|
};
|
|
632
632
|
return t.addEventListener("animationstart", f), t.addEventListener("animationcancel", i), t.addEventListener("animationend", i), () => {
|
|
633
633
|
t.removeEventListener("animationstart", f), t.removeEventListener("animationcancel", i), t.removeEventListener("animationend", i);
|
|
@@ -642,58 +642,58 @@ function gt(e) {
|
|
|
642
642
|
"mounted",
|
|
643
643
|
"unmountSuspended"
|
|
644
644
|
].includes(a),
|
|
645
|
-
ref:
|
|
645
|
+
ref: L((i) => {
|
|
646
646
|
i && (o.current = getComputedStyle(i)), n(i);
|
|
647
647
|
}, [])
|
|
648
648
|
};
|
|
649
649
|
}
|
|
650
|
-
function
|
|
650
|
+
function Y(e) {
|
|
651
651
|
return (e == null ? void 0 : e.animationName) || "none";
|
|
652
652
|
}
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
]),
|
|
656
|
-
const { __scopeTabs: n, value: o, onValueChange: s, defaultValue: r, orientation: c = "horizontal", dir: a, activationMode: u = "automatic", ...i } = e, f =
|
|
653
|
+
const Se = "Tabs", [It, Qt] = se(Se, [
|
|
654
|
+
Ce
|
|
655
|
+
]), we = Ce(), [yt, ue] = It(Se), St = /* @__PURE__ */ T((e, t) => {
|
|
656
|
+
const { __scopeTabs: n, value: o, onValueChange: s, defaultValue: r, orientation: c = "horizontal", dir: a, activationMode: u = "automatic", ...i } = e, f = ge(a), [d, b] = he({
|
|
657
657
|
prop: o,
|
|
658
658
|
onChange: s,
|
|
659
659
|
defaultProp: r
|
|
660
660
|
});
|
|
661
|
-
return /* @__PURE__ */
|
|
661
|
+
return /* @__PURE__ */ h(yt, {
|
|
662
662
|
scope: n,
|
|
663
|
-
baseId:
|
|
664
|
-
value:
|
|
665
|
-
onValueChange:
|
|
663
|
+
baseId: _e(),
|
|
664
|
+
value: d,
|
|
665
|
+
onValueChange: b,
|
|
666
666
|
orientation: c,
|
|
667
667
|
dir: f,
|
|
668
668
|
activationMode: u
|
|
669
|
-
}, /* @__PURE__ */
|
|
669
|
+
}, /* @__PURE__ */ h(B.div, y({
|
|
670
670
|
dir: f,
|
|
671
671
|
"data-orientation": c
|
|
672
672
|
}, i, {
|
|
673
673
|
ref: t
|
|
674
674
|
})));
|
|
675
|
-
}),
|
|
676
|
-
const { __scopeTabs: n, loop: o = !0, ...s } = e, r =
|
|
677
|
-
return /* @__PURE__ */
|
|
675
|
+
}), wt = "TabsList", Tt = /* @__PURE__ */ T((e, t) => {
|
|
676
|
+
const { __scopeTabs: n, loop: o = !0, ...s } = e, r = ue(wt, n), c = we(n);
|
|
677
|
+
return /* @__PURE__ */ h(ht, y({
|
|
678
678
|
asChild: !0
|
|
679
679
|
}, c, {
|
|
680
680
|
orientation: r.orientation,
|
|
681
681
|
dir: r.dir,
|
|
682
682
|
loop: o
|
|
683
|
-
}), /* @__PURE__ */
|
|
683
|
+
}), /* @__PURE__ */ h(B.div, y({
|
|
684
684
|
role: "tablist",
|
|
685
685
|
"aria-orientation": r.orientation
|
|
686
686
|
}, s, {
|
|
687
687
|
ref: t
|
|
688
688
|
})));
|
|
689
|
-
}),
|
|
690
|
-
const { __scopeTabs: n, value: o, disabled: s = !1, ...r } = e, c =
|
|
691
|
-
return /* @__PURE__ */
|
|
689
|
+
}), Nt = "TabsTrigger", At = /* @__PURE__ */ T((e, t) => {
|
|
690
|
+
const { __scopeTabs: n, value: o, disabled: s = !1, ...r } = e, c = ue(Nt, n), a = we(n), u = Te(c.baseId, o), i = Ne(c.baseId, o), f = o === c.value;
|
|
691
|
+
return /* @__PURE__ */ h(gt, y({
|
|
692
692
|
asChild: !0
|
|
693
693
|
}, a, {
|
|
694
694
|
focusable: !s,
|
|
695
695
|
active: f
|
|
696
|
-
}), /* @__PURE__ */
|
|
696
|
+
}), /* @__PURE__ */ h(B.button, y({
|
|
697
697
|
type: "button",
|
|
698
698
|
role: "tab",
|
|
699
699
|
"aria-selected": f,
|
|
@@ -704,60 +704,60 @@ const Ie = "Tabs", [xt, Xt] = ce(Ie, [
|
|
|
704
704
|
id: u
|
|
705
705
|
}, r, {
|
|
706
706
|
ref: t,
|
|
707
|
-
onMouseDown:
|
|
708
|
-
!s &&
|
|
707
|
+
onMouseDown: M(e.onMouseDown, (d) => {
|
|
708
|
+
!s && d.button === 0 && d.ctrlKey === !1 ? c.onValueChange(o) : d.preventDefault();
|
|
709
709
|
}),
|
|
710
|
-
onKeyDown:
|
|
710
|
+
onKeyDown: M(e.onKeyDown, (d) => {
|
|
711
711
|
[
|
|
712
712
|
" ",
|
|
713
713
|
"Enter"
|
|
714
|
-
].includes(
|
|
714
|
+
].includes(d.key) && c.onValueChange(o);
|
|
715
715
|
}),
|
|
716
|
-
onFocus:
|
|
717
|
-
const
|
|
718
|
-
!f && !s &&
|
|
716
|
+
onFocus: M(e.onFocus, () => {
|
|
717
|
+
const d = c.activationMode !== "manual";
|
|
718
|
+
!f && !s && d && c.onValueChange(o);
|
|
719
719
|
})
|
|
720
720
|
})));
|
|
721
|
-
}),
|
|
722
|
-
const { __scopeTabs: n, value: o, forceMount: s, children: r, ...c } = e, a =
|
|
721
|
+
}), Et = "TabsContent", Rt = /* @__PURE__ */ T((e, t) => {
|
|
722
|
+
const { __scopeTabs: n, value: o, forceMount: s, children: r, ...c } = e, a = ue(Et, n), u = Te(a.baseId, o), i = Ne(a.baseId, o), f = o === a.value, d = P(f);
|
|
723
723
|
return R(() => {
|
|
724
|
-
const
|
|
725
|
-
() =>
|
|
724
|
+
const b = requestAnimationFrame(
|
|
725
|
+
() => d.current = !1
|
|
726
726
|
);
|
|
727
|
-
return () => cancelAnimationFrame(
|
|
728
|
-
}, []), /* @__PURE__ */
|
|
729
|
-
|
|
727
|
+
return () => cancelAnimationFrame(b);
|
|
728
|
+
}, []), /* @__PURE__ */ h(
|
|
729
|
+
ye,
|
|
730
730
|
{
|
|
731
731
|
present: s || f
|
|
732
732
|
},
|
|
733
|
-
({ present:
|
|
733
|
+
({ present: b }) => /* @__PURE__ */ h(B.div, y({
|
|
734
734
|
"data-state": f ? "active" : "inactive",
|
|
735
735
|
"data-orientation": a.orientation,
|
|
736
736
|
role: "tabpanel",
|
|
737
737
|
"aria-labelledby": u,
|
|
738
|
-
hidden:
|
|
738
|
+
hidden: !b,
|
|
739
739
|
id: i,
|
|
740
740
|
tabIndex: 0
|
|
741
741
|
}, c, {
|
|
742
742
|
ref: t,
|
|
743
743
|
style: {
|
|
744
744
|
...e.style,
|
|
745
|
-
animationDuration:
|
|
745
|
+
animationDuration: d.current ? "0s" : void 0
|
|
746
746
|
}
|
|
747
|
-
}),
|
|
747
|
+
}), b && r)
|
|
748
748
|
);
|
|
749
749
|
});
|
|
750
|
-
function
|
|
750
|
+
function Te(e, t) {
|
|
751
751
|
return `${e}-trigger-${t}`;
|
|
752
752
|
}
|
|
753
|
-
function
|
|
753
|
+
function Ne(e, t) {
|
|
754
754
|
return `${e}-content-${t}`;
|
|
755
755
|
}
|
|
756
|
-
const
|
|
757
|
-
function
|
|
756
|
+
const Pt = St, Mt = Tt, Ot = At, Ft = Rt;
|
|
757
|
+
function Dt(e) {
|
|
758
758
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
759
759
|
}
|
|
760
|
-
var
|
|
760
|
+
var Ae = { exports: {} };
|
|
761
761
|
/*!
|
|
762
762
|
Copyright (c) 2018 Jed Watson.
|
|
763
763
|
Licensed under the MIT License (MIT), see
|
|
@@ -792,34 +792,34 @@ var Te = { exports: {} };
|
|
|
792
792
|
}
|
|
793
793
|
e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
|
|
794
794
|
})();
|
|
795
|
-
})(
|
|
796
|
-
var
|
|
797
|
-
const
|
|
795
|
+
})(Ae);
|
|
796
|
+
var qt = Ae.exports;
|
|
797
|
+
const le = /* @__PURE__ */ Dt(qt), Lt = {
|
|
798
798
|
"purpur-tab-content": "_purpur-tab-content_rbfjg_1"
|
|
799
|
-
},
|
|
799
|
+
}, Ut = le.bind(Lt), Vt = "purpur-tab-content", Bt = T(
|
|
800
800
|
({ children: e, tabId: t, "data-testid": n, className: o, ...s }, r) => /* @__PURE__ */ N(
|
|
801
|
-
|
|
801
|
+
Ft,
|
|
802
802
|
{
|
|
803
803
|
ref: r,
|
|
804
|
-
className:
|
|
804
|
+
className: Ut([Vt, o]),
|
|
805
805
|
"data-testid": n,
|
|
806
806
|
value: t,
|
|
807
807
|
...s,
|
|
808
808
|
children: e
|
|
809
809
|
}
|
|
810
810
|
)
|
|
811
|
-
),
|
|
811
|
+
), jt = (e) => !!e && K(e) && !!e.props.name && !!e.props.tabId, Gt = {
|
|
812
812
|
"purpur-tab-header": "_purpur-tab-header_1hk4f_1",
|
|
813
813
|
"purpur-tab-header--contained": "_purpur-tab-header--contained_1hk4f_32",
|
|
814
814
|
"purpur-tab-header--contained-negative": "_purpur-tab-header--contained-negative_1hk4f_32",
|
|
815
815
|
"purpur-tab-header--line": "_purpur-tab-header--line_1hk4f_35",
|
|
816
816
|
"purpur-tab-header--line-negative": "_purpur-tab-header--line-negative_1hk4f_47"
|
|
817
|
-
},
|
|
817
|
+
}, kt = le.bind(Gt), pe = "purpur-tab-header", zt = T(
|
|
818
818
|
({ index: e, tabId: t, variant: n, onFocus: o, "data-testid": s, children: r }, c) => /* @__PURE__ */ N(
|
|
819
|
-
|
|
819
|
+
Ot,
|
|
820
820
|
{
|
|
821
821
|
id: `${t}-trigger`,
|
|
822
|
-
className:
|
|
822
|
+
className: kt([pe, `${pe}--${n}`]),
|
|
823
823
|
value: t,
|
|
824
824
|
"data-testid": s,
|
|
825
825
|
"data-index": e,
|
|
@@ -828,7 +828,7 @@ const ue = /* @__PURE__ */ Ft(Ot), Dt = {
|
|
|
828
828
|
children: r
|
|
829
829
|
}
|
|
830
830
|
)
|
|
831
|
-
),
|
|
831
|
+
), Kt = {
|
|
832
832
|
"purpur-tabs__wrapper": "_purpur-tabs__wrapper_1dpqy_1",
|
|
833
833
|
"purpur-tabs__scroll-button": "_purpur-tabs__scroll-button_1dpqy_9",
|
|
834
834
|
"purpur-tabs__scroll-button--left": "_purpur-tabs__scroll-button--left_1dpqy_63",
|
|
@@ -843,146 +843,147 @@ const ue = /* @__PURE__ */ Ft(Ot), Dt = {
|
|
|
843
843
|
"purpur-tabs--contained-negative": "_purpur-tabs--contained-negative_1dpqy_103",
|
|
844
844
|
"purpur-tabs__content-container": "_purpur-tabs__content-container_1dpqy_106",
|
|
845
845
|
"purpur-tabs--fullWidth": "_purpur-tabs--fullWidth_1dpqy_115"
|
|
846
|
-
},
|
|
846
|
+
}, en = ["line", "line-negative", "contained", "contained-negative"], Wt = (e) => new CustomEvent("tabChangeDetail", { detail: { value: e } }), q = le.bind(Kt), w = "purpur-tabs", Yt = (e, t) => {
|
|
847
847
|
var u;
|
|
848
848
|
if (typeof (e == null ? void 0 : e.getBoundingClientRect) != "function" || typeof (t == null ? void 0 : t.scroll) != "function")
|
|
849
849
|
return;
|
|
850
850
|
const n = e.getBoundingClientRect(), o = t.getBoundingClientRect(), s = t.clientWidth, r = parseInt((u = getComputedStyle(t).borderLeftWidth) == null ? void 0 : u.split("px")[0], 10), c = o.left + (isNaN(r) ? 0 : r);
|
|
851
851
|
let a;
|
|
852
852
|
n.right > o.right && (a = n.left + t.scrollLeft, a = a + n.width - s + s * 0.1, a = a - c), n.left < o.left && (a = n.left + t.scrollLeft, a = a - s * 0.1, a = a - c), a !== void 0 && t.scroll({ left: a, behavior: "smooth" });
|
|
853
|
-
},
|
|
853
|
+
}, Zt = ({
|
|
854
854
|
children: e,
|
|
855
855
|
variant: t = "line",
|
|
856
856
|
fullWidth: n = !1,
|
|
857
857
|
onChange: o,
|
|
858
858
|
className: s,
|
|
859
|
-
|
|
860
|
-
|
|
859
|
+
defaultValue: r,
|
|
860
|
+
"data-testid": c,
|
|
861
|
+
...a
|
|
861
862
|
}) => {
|
|
862
|
-
const [
|
|
863
|
+
const [u, i] = O({}), [f, d] = O(0), [b, v] = O(0), l = E.toArray(e).filter(jt), $ = P(), g = P(new Array(l.length)), m = 200, _ = t === "line" || t === "line-negative", U = q([
|
|
863
864
|
w,
|
|
864
865
|
`${w}--${t}`,
|
|
865
866
|
{ [`${w}--fullWidth`]: n },
|
|
866
867
|
s
|
|
867
|
-
]),
|
|
868
|
-
if (new Set(
|
|
868
|
+
]), S = E.map(l, ({ props: { tabId: p } }) => p), j = () => S.findIndex((p) => p === r) || 0, [G, C] = O(j);
|
|
869
|
+
if (new Set(S).size !== S.length)
|
|
869
870
|
throw new Error("tabId must be unique");
|
|
870
|
-
const
|
|
871
|
-
if (!
|
|
871
|
+
const k = (p, I) => I || c ? `${I || c}-${p}` : void 0, V = () => {
|
|
872
|
+
if (!_)
|
|
872
873
|
return;
|
|
873
|
-
const p =
|
|
874
|
-
|
|
875
|
-
},
|
|
876
|
-
|
|
877
|
-
},
|
|
878
|
-
if (
|
|
879
|
-
const { scrollLeft: I } =
|
|
880
|
-
|
|
874
|
+
const p = g.current[G];
|
|
875
|
+
d((p == null ? void 0 : p.offsetLeft) || 0), v((p == null ? void 0 : p.getBoundingClientRect().width) || 0);
|
|
876
|
+
}, z = (p) => {
|
|
877
|
+
_ && C(l.findIndex((I) => I.props.tabId === p)), o == null || o(Wt(p));
|
|
878
|
+
}, J = (p) => {
|
|
879
|
+
if ($ != null && $.current) {
|
|
880
|
+
const { scrollLeft: I } = $.current, x = p === "left" ? -m : m;
|
|
881
|
+
$.current.scroll({ left: I + x, behavior: "smooth" });
|
|
881
882
|
}
|
|
882
|
-
},
|
|
883
|
+
}, W = ({ side: p }) => /* @__PURE__ */ N(
|
|
883
884
|
"button",
|
|
884
885
|
{
|
|
885
|
-
className:
|
|
886
|
-
onClick: () =>
|
|
886
|
+
className: q(`${w}__scroll-button`, `${w}__scroll-button--${p}`),
|
|
887
|
+
onClick: () => J(p),
|
|
887
888
|
type: "button",
|
|
888
889
|
"aria-hidden": "true",
|
|
889
890
|
tabIndex: -1,
|
|
890
|
-
"data-testid":
|
|
891
|
-
children: /* @__PURE__ */ N(
|
|
891
|
+
"data-testid": k("scroll-button"),
|
|
892
|
+
children: /* @__PURE__ */ N(Ye, { svg: p === "left" ? Be : je, size: "md" })
|
|
892
893
|
}
|
|
893
894
|
);
|
|
894
|
-
return R(() => (window.addEventListener("resize",
|
|
895
|
-
window.removeEventListener("resize",
|
|
895
|
+
return R(() => (window.addEventListener("resize", V), () => {
|
|
896
|
+
window.removeEventListener("resize", V);
|
|
896
897
|
}), []), R(() => {
|
|
897
|
-
|
|
898
|
-
}, [
|
|
899
|
-
const p = (
|
|
900
|
-
if (
|
|
901
|
-
|
|
898
|
+
V();
|
|
899
|
+
}, [G, n, l, t]), R(() => {
|
|
900
|
+
const p = (x) => {
|
|
901
|
+
if (x.every((F) => F.isIntersecting) && x.length === l.length) {
|
|
902
|
+
i({});
|
|
902
903
|
return;
|
|
903
904
|
}
|
|
904
|
-
|
|
905
|
-
const
|
|
906
|
-
|
|
907
|
-
...
|
|
908
|
-
...
|
|
909
|
-
[`${w}__wrapper--scroll-end`]: !
|
|
905
|
+
x.forEach((F) => {
|
|
906
|
+
const D = Number(F.target.getAttribute("data-index")), Ee = D === 0, Re = D === l.length - 1;
|
|
907
|
+
i((Pe) => ({
|
|
908
|
+
...Pe,
|
|
909
|
+
...Ee && {
|
|
910
|
+
[`${w}__wrapper--scroll-end`]: !F.isIntersecting
|
|
910
911
|
},
|
|
911
|
-
...
|
|
912
|
-
[`${w}__wrapper--scroll-start`]: !
|
|
912
|
+
...Re && {
|
|
913
|
+
[`${w}__wrapper--scroll-start`]: !F.isIntersecting
|
|
913
914
|
}
|
|
914
915
|
}));
|
|
915
916
|
});
|
|
916
917
|
}, I = new IntersectionObserver(p, {
|
|
917
918
|
threshold: [0.99],
|
|
918
|
-
root:
|
|
919
|
+
root: $.current
|
|
919
920
|
});
|
|
920
|
-
return
|
|
921
|
-
|
|
921
|
+
return g.current.forEach((x) => I.observe(x)), () => {
|
|
922
|
+
g.current.forEach((x) => I.unobserve(x));
|
|
922
923
|
};
|
|
923
|
-
}, [
|
|
924
|
-
|
|
924
|
+
}, [l.length]), /* @__PURE__ */ N(
|
|
925
|
+
Pt,
|
|
925
926
|
{
|
|
926
|
-
defaultValue:
|
|
927
|
-
onValueChange:
|
|
928
|
-
"data-testid":
|
|
929
|
-
className:
|
|
930
|
-
...
|
|
931
|
-
children: /* @__PURE__ */
|
|
932
|
-
/* @__PURE__ */
|
|
933
|
-
/* @__PURE__ */
|
|
934
|
-
|
|
927
|
+
defaultValue: r,
|
|
928
|
+
onValueChange: z,
|
|
929
|
+
"data-testid": c,
|
|
930
|
+
className: U,
|
|
931
|
+
...a,
|
|
932
|
+
children: /* @__PURE__ */ Q("div", { className: q(`${w}__container`), children: [
|
|
933
|
+
/* @__PURE__ */ Q("div", { className: q([`${w}__wrapper`, u]), children: [
|
|
934
|
+
/* @__PURE__ */ Q(
|
|
935
|
+
Mt,
|
|
935
936
|
{
|
|
936
937
|
ref: (p) => {
|
|
937
|
-
|
|
938
|
+
$.current = p;
|
|
938
939
|
},
|
|
939
|
-
className:
|
|
940
|
+
className: q(`${w}__list`),
|
|
940
941
|
children: [
|
|
941
|
-
|
|
942
|
-
const { name:
|
|
942
|
+
E.map(l, (p, I) => {
|
|
943
|
+
const { name: x, tabId: de, "data-testid": F } = p.props;
|
|
943
944
|
return /* @__PURE__ */ N(
|
|
944
|
-
|
|
945
|
+
zt,
|
|
945
946
|
{
|
|
946
|
-
"data-testid":
|
|
947
|
+
"data-testid": k("header", F),
|
|
947
948
|
index: I,
|
|
948
|
-
tabId:
|
|
949
|
-
ref: (
|
|
950
|
-
|
|
949
|
+
tabId: de,
|
|
950
|
+
ref: (D) => {
|
|
951
|
+
D && (g.current[I] = D);
|
|
951
952
|
},
|
|
952
|
-
onFocus: (
|
|
953
|
-
|
|
953
|
+
onFocus: (D) => {
|
|
954
|
+
Yt(D.target, $.current);
|
|
954
955
|
},
|
|
955
956
|
variant: t,
|
|
956
|
-
children:
|
|
957
|
+
children: x
|
|
957
958
|
}
|
|
958
959
|
);
|
|
959
960
|
}),
|
|
960
|
-
|
|
961
|
+
_ && /* @__PURE__ */ N(
|
|
961
962
|
"div",
|
|
962
963
|
{
|
|
963
|
-
className:
|
|
964
|
+
className: q(`${w}__selected-border`),
|
|
964
965
|
style: {
|
|
965
|
-
width:
|
|
966
|
-
transform: `translateX(${
|
|
966
|
+
width: b,
|
|
967
|
+
transform: `translateX(${f}px)`
|
|
967
968
|
},
|
|
968
|
-
"data-testid":
|
|
969
|
+
"data-testid": k("selected-border")
|
|
969
970
|
}
|
|
970
971
|
)
|
|
971
972
|
]
|
|
972
973
|
}
|
|
973
974
|
),
|
|
974
|
-
/* @__PURE__ */ N(
|
|
975
|
-
/* @__PURE__ */ N(
|
|
975
|
+
/* @__PURE__ */ N(W, { side: "left" }),
|
|
976
|
+
/* @__PURE__ */ N(W, { side: "right" })
|
|
976
977
|
] }),
|
|
977
|
-
/* @__PURE__ */ N("div", { className:
|
|
978
|
+
/* @__PURE__ */ N("div", { className: q(`${w}__content-container`), children: E.map(l, (p) => p) })
|
|
978
979
|
] })
|
|
979
980
|
}
|
|
980
981
|
);
|
|
981
982
|
};
|
|
982
|
-
|
|
983
|
+
Zt.Content = Bt;
|
|
983
984
|
export {
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
985
|
+
Zt as Tabs,
|
|
986
|
+
Wt as createTabChangeDetailEvent,
|
|
987
|
+
en as tabsVariants
|
|
987
988
|
};
|
|
988
989
|
//# sourceMappingURL=tabs.es.js.map
|