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