@purpurds/tabs 6.3.0 → 6.3.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.es.js +275 -269
- package/dist/tabs.es.js.map +1 -1
- package/package.json +10 -10
package/dist/tabs.es.js
CHANGED
|
@@ -1,48 +1,51 @@
|
|
|
1
|
-
import { jsx as m, Fragment as
|
|
1
|
+
import { jsx as m, Fragment as Ge, jsxs as X } from "react/jsx-runtime";
|
|
2
2
|
import * as a from "react";
|
|
3
|
-
import P, { forwardRef as
|
|
3
|
+
import P, { forwardRef as ge, isValidElement as We, useState as B, Children as U, useRef as ue, useEffect as j } from "react";
|
|
4
4
|
import "react-dom";
|
|
5
|
-
function
|
|
5
|
+
function ke(e) {
|
|
6
6
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
7
7
|
}
|
|
8
|
-
var
|
|
8
|
+
var le = { exports: {} };
|
|
9
9
|
/*!
|
|
10
10
|
Copyright (c) 2018 Jed Watson.
|
|
11
11
|
Licensed under the MIT License (MIT), see
|
|
12
12
|
http://jedwatson.github.io/classnames
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
var de;
|
|
15
|
+
function Ke() {
|
|
16
|
+
return de || (de = 1, function(e) {
|
|
17
|
+
(function() {
|
|
18
|
+
var t = {}.hasOwnProperty;
|
|
19
|
+
function n() {
|
|
20
|
+
for (var r = "", i = 0; i < arguments.length; i++) {
|
|
21
|
+
var c = arguments[i];
|
|
22
|
+
c && (r = s(r, o.call(this, c)));
|
|
23
|
+
}
|
|
24
|
+
return r;
|
|
21
25
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const ke = /* @__PURE__ */ Ge(We), Ke = {
|
|
26
|
+
function o(r) {
|
|
27
|
+
if (typeof r == "string" || typeof r == "number")
|
|
28
|
+
return this && this[r] || r;
|
|
29
|
+
if (typeof r != "object")
|
|
30
|
+
return "";
|
|
31
|
+
if (Array.isArray(r))
|
|
32
|
+
return n.apply(this, r);
|
|
33
|
+
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
34
|
+
return r.toString();
|
|
35
|
+
var i = "";
|
|
36
|
+
for (var c in r)
|
|
37
|
+
t.call(r, c) && r[c] && (i = s(i, this && this[c] || c));
|
|
38
|
+
return i;
|
|
39
|
+
}
|
|
40
|
+
function s(r, i) {
|
|
41
|
+
return i ? r ? r + " " + i : r + i : r;
|
|
42
|
+
}
|
|
43
|
+
e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
|
|
44
|
+
})();
|
|
45
|
+
}(le)), le.exports;
|
|
46
|
+
}
|
|
47
|
+
var ze = Ke();
|
|
48
|
+
const Ye = /* @__PURE__ */ ke(ze), Ze = {
|
|
46
49
|
"purpur-icon": "_purpur-icon_8u1lq_1",
|
|
47
50
|
"purpur-icon--xxs": "_purpur-icon--xxs_8u1lq_4",
|
|
48
51
|
"purpur-icon--xs": "_purpur-icon--xs_8u1lq_8",
|
|
@@ -50,26 +53,26 @@ const ke = /* @__PURE__ */ Ge(We), Ke = {
|
|
|
50
53
|
"purpur-icon--md": "_purpur-icon--md_8u1lq_16",
|
|
51
54
|
"purpur-icon--lg": "_purpur-icon--lg_8u1lq_20",
|
|
52
55
|
"purpur-icon--xl": "_purpur-icon--xl_8u1lq_24"
|
|
53
|
-
},
|
|
56
|
+
}, Xe = Ye.bind(Ze), fe = "purpur-icon", Je = "md", Qe = (e) => e.filter((t) => Object.keys(t).length >= 1).map((t) => `${t.name}="${t.value}"`).join(" "), He = ({ content: e = "", title: t } = {}) => {
|
|
54
57
|
const n = [
|
|
55
58
|
{ name: "xmlns", value: "http://www.w3.org/2000/svg" },
|
|
56
59
|
{ name: "fill", value: "currentColor" },
|
|
57
60
|
{ name: "viewBox", value: "0 0 24 24" },
|
|
58
61
|
t ? { name: "role", value: "img" } : { name: "aria-hidden", value: "true" }
|
|
59
62
|
], o = t ? `<title>${t}</title>` : "";
|
|
60
|
-
return `<svg ${
|
|
61
|
-
},
|
|
63
|
+
return `<svg ${Qe(n)}>${o}${e}</svg>`;
|
|
64
|
+
}, et = (e) => e.replace(/<(\/?)svg([^>]*)>/g, "").trim(), be = ({
|
|
62
65
|
["data-testid"]: e,
|
|
63
66
|
svg: t,
|
|
64
67
|
allyTitle: n,
|
|
65
68
|
className: o,
|
|
66
|
-
size: s =
|
|
69
|
+
size: s = Je,
|
|
67
70
|
...r
|
|
68
71
|
}) => {
|
|
69
|
-
const i =
|
|
70
|
-
content:
|
|
72
|
+
const i = He({
|
|
73
|
+
content: et(t.svg),
|
|
71
74
|
title: n
|
|
72
|
-
}), c =
|
|
75
|
+
}), c = Xe(o, fe, `${fe}--${s}`);
|
|
73
76
|
return /* @__PURE__ */ m(
|
|
74
77
|
"span",
|
|
75
78
|
{
|
|
@@ -81,13 +84,13 @@ const ke = /* @__PURE__ */ Ge(We), Ke = {
|
|
|
81
84
|
}
|
|
82
85
|
);
|
|
83
86
|
};
|
|
84
|
-
|
|
85
|
-
const
|
|
87
|
+
be.displayName = "Icon";
|
|
88
|
+
const tt = {
|
|
86
89
|
name: "chevron-left",
|
|
87
90
|
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>',
|
|
88
91
|
keywords: ["chevron-left"],
|
|
89
92
|
category: "utility"
|
|
90
|
-
},
|
|
93
|
+
}, nt = {
|
|
91
94
|
name: "chevron-right",
|
|
92
95
|
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>',
|
|
93
96
|
keywords: ["chevron-right"],
|
|
@@ -99,25 +102,25 @@ function x(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
|
|
|
99
102
|
return t == null ? void 0 : t(s);
|
|
100
103
|
};
|
|
101
104
|
}
|
|
102
|
-
function
|
|
105
|
+
function ne(e, t = []) {
|
|
103
106
|
let n = [];
|
|
104
107
|
function o(r, i) {
|
|
105
108
|
const c = a.createContext(i), u = n.length;
|
|
106
109
|
n = [...n, i];
|
|
107
110
|
const l = (d) => {
|
|
108
111
|
var _;
|
|
109
|
-
const { scope:
|
|
110
|
-
return /* @__PURE__ */ m(y.Provider, { value:
|
|
112
|
+
const { scope: g, children: h, ...f } = d, y = ((_ = g == null ? void 0 : g[e]) == null ? void 0 : _[u]) || c, b = a.useMemo(() => f, Object.values(f));
|
|
113
|
+
return /* @__PURE__ */ m(y.Provider, { value: b, children: h });
|
|
111
114
|
};
|
|
112
115
|
l.displayName = r + "Provider";
|
|
113
|
-
function
|
|
116
|
+
function v(d, g) {
|
|
114
117
|
var y;
|
|
115
|
-
const h = ((y =
|
|
118
|
+
const h = ((y = g == null ? void 0 : g[e]) == null ? void 0 : y[u]) || c, f = a.useContext(h);
|
|
116
119
|
if (f) return f;
|
|
117
120
|
if (i !== void 0) return i;
|
|
118
121
|
throw new Error(`\`${d}\` must be used within \`${r}\``);
|
|
119
122
|
}
|
|
120
|
-
return [l,
|
|
123
|
+
return [l, v];
|
|
121
124
|
}
|
|
122
125
|
const s = () => {
|
|
123
126
|
const r = n.map((i) => a.createContext(i));
|
|
@@ -129,9 +132,9 @@ function te(e, t = []) {
|
|
|
129
132
|
);
|
|
130
133
|
};
|
|
131
134
|
};
|
|
132
|
-
return s.scopeName = e, [o,
|
|
135
|
+
return s.scopeName = e, [o, rt(s, ...t)];
|
|
133
136
|
}
|
|
134
|
-
function
|
|
137
|
+
function rt(...e) {
|
|
135
138
|
const t = e[0];
|
|
136
139
|
if (e.length === 1) return t;
|
|
137
140
|
const n = () => {
|
|
@@ -149,53 +152,53 @@ function et(...e) {
|
|
|
149
152
|
};
|
|
150
153
|
return n.scopeName = t.scopeName, n;
|
|
151
154
|
}
|
|
152
|
-
function
|
|
155
|
+
function pe(e, t) {
|
|
153
156
|
if (typeof e == "function")
|
|
154
157
|
return e(t);
|
|
155
158
|
e != null && (e.current = t);
|
|
156
159
|
}
|
|
157
|
-
function
|
|
160
|
+
function he(...e) {
|
|
158
161
|
return (t) => {
|
|
159
162
|
let n = !1;
|
|
160
163
|
const o = e.map((s) => {
|
|
161
|
-
const r =
|
|
164
|
+
const r = pe(s, t);
|
|
162
165
|
return !n && typeof r == "function" && (n = !0), r;
|
|
163
166
|
});
|
|
164
167
|
if (n)
|
|
165
168
|
return () => {
|
|
166
169
|
for (let s = 0; s < o.length; s++) {
|
|
167
170
|
const r = o[s];
|
|
168
|
-
typeof r == "function" ? r() :
|
|
171
|
+
typeof r == "function" ? r() : pe(e[s], null);
|
|
169
172
|
}
|
|
170
173
|
};
|
|
171
174
|
};
|
|
172
175
|
}
|
|
173
176
|
function W(...e) {
|
|
174
|
-
return a.useCallback(
|
|
177
|
+
return a.useCallback(he(...e), e);
|
|
175
178
|
}
|
|
176
179
|
var k = a.forwardRef((e, t) => {
|
|
177
|
-
const { children: n, ...o } = e, s = a.Children.toArray(n), r = s.find(
|
|
180
|
+
const { children: n, ...o } = e, s = a.Children.toArray(n), r = s.find(st);
|
|
178
181
|
if (r) {
|
|
179
182
|
const i = r.props.children, c = s.map((u) => u === r ? a.Children.count(i) > 1 ? a.Children.only(null) : a.isValidElement(i) ? i.props.children : null : u);
|
|
180
|
-
return /* @__PURE__ */ m(
|
|
183
|
+
return /* @__PURE__ */ m(H, { ...o, ref: t, children: a.isValidElement(i) ? a.cloneElement(i, void 0, c) : null });
|
|
181
184
|
}
|
|
182
|
-
return /* @__PURE__ */ m(
|
|
185
|
+
return /* @__PURE__ */ m(H, { ...o, ref: t, children: n });
|
|
183
186
|
});
|
|
184
187
|
k.displayName = "Slot";
|
|
185
|
-
var
|
|
188
|
+
var H = a.forwardRef((e, t) => {
|
|
186
189
|
const { children: n, ...o } = e;
|
|
187
190
|
if (a.isValidElement(n)) {
|
|
188
|
-
const s =
|
|
189
|
-
return n.type !== a.Fragment && (r.ref = t ?
|
|
191
|
+
const s = ct(n), r = it(o, n.props);
|
|
192
|
+
return n.type !== a.Fragment && (r.ref = t ? he(t, s) : s), a.cloneElement(n, r);
|
|
190
193
|
}
|
|
191
194
|
return a.Children.count(n) > 1 ? a.Children.only(null) : null;
|
|
192
195
|
});
|
|
193
|
-
|
|
194
|
-
var
|
|
195
|
-
function
|
|
196
|
-
return a.isValidElement(e) && e.type ===
|
|
196
|
+
H.displayName = "SlotClone";
|
|
197
|
+
var ot = ({ children: e }) => /* @__PURE__ */ m(Ge, { children: e });
|
|
198
|
+
function st(e) {
|
|
199
|
+
return a.isValidElement(e) && e.type === ot;
|
|
197
200
|
}
|
|
198
|
-
function
|
|
201
|
+
function it(e, t) {
|
|
199
202
|
const n = { ...t };
|
|
200
203
|
for (const o in t) {
|
|
201
204
|
const s = e[o], r = t[o];
|
|
@@ -205,40 +208,40 @@ function rt(e, t) {
|
|
|
205
208
|
}
|
|
206
209
|
return { ...e, ...n };
|
|
207
210
|
}
|
|
208
|
-
function
|
|
211
|
+
function ct(e) {
|
|
209
212
|
var o, s;
|
|
210
213
|
let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
|
|
211
214
|
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);
|
|
212
215
|
}
|
|
213
|
-
function
|
|
214
|
-
const t = e + "CollectionProvider", [n, o] =
|
|
216
|
+
function at(e) {
|
|
217
|
+
const t = e + "CollectionProvider", [n, o] = ne(t), [s, r] = n(
|
|
215
218
|
t,
|
|
216
219
|
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
217
220
|
), i = (h) => {
|
|
218
|
-
const { scope: f, children: y } = h,
|
|
219
|
-
return /* @__PURE__ */ m(s, { scope: f, itemMap: _, collectionRef:
|
|
221
|
+
const { scope: f, children: y } = h, b = P.useRef(null), _ = P.useRef(/* @__PURE__ */ new Map()).current;
|
|
222
|
+
return /* @__PURE__ */ m(s, { scope: f, itemMap: _, collectionRef: b, children: y });
|
|
220
223
|
};
|
|
221
224
|
i.displayName = t;
|
|
222
225
|
const c = e + "CollectionSlot", u = P.forwardRef(
|
|
223
226
|
(h, f) => {
|
|
224
|
-
const { scope: y, children:
|
|
225
|
-
return /* @__PURE__ */ m(k, { ref: w, children:
|
|
227
|
+
const { scope: y, children: b } = h, _ = r(c, y), w = W(f, _.collectionRef);
|
|
228
|
+
return /* @__PURE__ */ m(k, { ref: w, children: b });
|
|
226
229
|
}
|
|
227
230
|
);
|
|
228
231
|
u.displayName = c;
|
|
229
|
-
const l = e + "CollectionItemSlot",
|
|
232
|
+
const l = e + "CollectionItemSlot", v = "data-radix-collection-item", d = P.forwardRef(
|
|
230
233
|
(h, f) => {
|
|
231
|
-
const { scope: y, children:
|
|
232
|
-
return P.useEffect(() => (N.itemMap.set(w, { ref: w, ..._ }), () => void N.itemMap.delete(w))), /* @__PURE__ */ m(k, { [
|
|
234
|
+
const { scope: y, children: b, ..._ } = h, w = P.useRef(null), E = W(f, w), N = r(l, y);
|
|
235
|
+
return P.useEffect(() => (N.itemMap.set(w, { ref: w, ..._ }), () => void N.itemMap.delete(w))), /* @__PURE__ */ m(k, { [v]: "", ref: E, children: b });
|
|
233
236
|
}
|
|
234
237
|
);
|
|
235
238
|
d.displayName = l;
|
|
236
|
-
function
|
|
239
|
+
function g(h) {
|
|
237
240
|
const f = r(e + "CollectionConsumer", h);
|
|
238
241
|
return P.useCallback(() => {
|
|
239
|
-
const
|
|
240
|
-
if (!
|
|
241
|
-
const _ = Array.from(
|
|
242
|
+
const b = f.collectionRef.current;
|
|
243
|
+
if (!b) return [];
|
|
244
|
+
const _ = Array.from(b.querySelectorAll(`[${v}]`));
|
|
242
245
|
return Array.from(f.itemMap.values()).sort(
|
|
243
246
|
(N, A) => _.indexOf(N.ref.current) - _.indexOf(A.ref.current)
|
|
244
247
|
);
|
|
@@ -246,20 +249,20 @@ function st(e) {
|
|
|
246
249
|
}
|
|
247
250
|
return [
|
|
248
251
|
{ Provider: i, Slot: u, ItemSlot: d },
|
|
249
|
-
|
|
252
|
+
g,
|
|
250
253
|
o
|
|
251
254
|
];
|
|
252
255
|
}
|
|
253
|
-
var
|
|
254
|
-
},
|
|
255
|
-
}),
|
|
256
|
-
function
|
|
257
|
-
const [t, n] = a.useState(
|
|
258
|
-
return
|
|
259
|
-
|
|
260
|
-
}, [e]),
|
|
256
|
+
var ee = globalThis != null && globalThis.document ? a.useLayoutEffect : () => {
|
|
257
|
+
}, ut = a.useId || (() => {
|
|
258
|
+
}), lt = 0;
|
|
259
|
+
function ye(e) {
|
|
260
|
+
const [t, n] = a.useState(ut());
|
|
261
|
+
return ee(() => {
|
|
262
|
+
n((o) => o ?? String(lt++));
|
|
263
|
+
}, [e]), t ? `radix-${t}` : "";
|
|
261
264
|
}
|
|
262
|
-
var
|
|
265
|
+
var dt = [
|
|
263
266
|
"a",
|
|
264
267
|
"button",
|
|
265
268
|
"div",
|
|
@@ -276,14 +279,14 @@ var at = [
|
|
|
276
279
|
"span",
|
|
277
280
|
"svg",
|
|
278
281
|
"ul"
|
|
279
|
-
], D =
|
|
282
|
+
], D = dt.reduce((e, t) => {
|
|
280
283
|
const n = a.forwardRef((o, s) => {
|
|
281
284
|
const { asChild: r, ...i } = o, c = r ? k : t;
|
|
282
285
|
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ m(c, { ...i, ref: s });
|
|
283
286
|
});
|
|
284
287
|
return n.displayName = `Primitive.${t}`, { ...e, [t]: n };
|
|
285
288
|
}, {});
|
|
286
|
-
function
|
|
289
|
+
function re(e) {
|
|
287
290
|
const t = a.useRef(e);
|
|
288
291
|
return a.useEffect(() => {
|
|
289
292
|
t.current = e;
|
|
@@ -292,13 +295,13 @@ function ne(e) {
|
|
|
292
295
|
return (o = t.current) == null ? void 0 : o.call(t, ...n);
|
|
293
296
|
}, []);
|
|
294
297
|
}
|
|
295
|
-
function
|
|
298
|
+
function Ce({
|
|
296
299
|
prop: e,
|
|
297
300
|
defaultProp: t,
|
|
298
301
|
onChange: n = () => {
|
|
299
302
|
}
|
|
300
303
|
}) {
|
|
301
|
-
const [o, s] =
|
|
304
|
+
const [o, s] = ft({ defaultProp: t, onChange: n }), r = e !== void 0, i = r ? e : o, c = re(n), u = a.useCallback(
|
|
302
305
|
(l) => {
|
|
303
306
|
if (r) {
|
|
304
307
|
const d = typeof l == "function" ? l(e) : l;
|
|
@@ -310,28 +313,28 @@ function ve({
|
|
|
310
313
|
);
|
|
311
314
|
return [i, u];
|
|
312
315
|
}
|
|
313
|
-
function
|
|
316
|
+
function ft({
|
|
314
317
|
defaultProp: e,
|
|
315
318
|
onChange: t
|
|
316
319
|
}) {
|
|
317
|
-
const n = a.useState(e), [o] = n, s = a.useRef(o), r =
|
|
320
|
+
const n = a.useState(e), [o] = n, s = a.useRef(o), r = re(t);
|
|
318
321
|
return a.useEffect(() => {
|
|
319
322
|
s.current !== o && (r(o), s.current = o);
|
|
320
323
|
}, [o, s, r]), n;
|
|
321
324
|
}
|
|
322
|
-
var
|
|
323
|
-
function
|
|
324
|
-
const t = a.useContext(
|
|
325
|
+
var pt = a.createContext(void 0);
|
|
326
|
+
function we(e) {
|
|
327
|
+
const t = a.useContext(pt);
|
|
325
328
|
return e || t || "ltr";
|
|
326
329
|
}
|
|
327
|
-
var J = "rovingFocusGroup.onEntryFocus",
|
|
330
|
+
var J = "rovingFocusGroup.onEntryFocus", mt = { bubbles: !1, cancelable: !0 }, K = "RovingFocusGroup", [te, Ie, _t] = at(K), [vt, Se] = ne(
|
|
328
331
|
K,
|
|
329
|
-
[
|
|
330
|
-
), [
|
|
331
|
-
(e, t) => /* @__PURE__ */ m(
|
|
332
|
+
[_t]
|
|
333
|
+
), [gt, bt] = vt(K), Ne = a.forwardRef(
|
|
334
|
+
(e, t) => /* @__PURE__ */ m(te.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ m(te.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ m(ht, { ...e, ref: t }) }) })
|
|
332
335
|
);
|
|
333
|
-
|
|
334
|
-
var
|
|
336
|
+
Ne.displayName = K;
|
|
337
|
+
var ht = a.forwardRef((e, t) => {
|
|
335
338
|
const {
|
|
336
339
|
__scopeRovingFocusGroup: n,
|
|
337
340
|
orientation: o,
|
|
@@ -341,19 +344,19 @@ var gt = a.forwardRef((e, t) => {
|
|
|
341
344
|
defaultCurrentTabStopId: c,
|
|
342
345
|
onCurrentTabStopIdChange: u,
|
|
343
346
|
onEntryFocus: l,
|
|
344
|
-
preventScrollOnEntryFocus:
|
|
347
|
+
preventScrollOnEntryFocus: v = !1,
|
|
345
348
|
...d
|
|
346
|
-
} = e,
|
|
349
|
+
} = e, g = a.useRef(null), h = W(t, g), f = we(r), [y = null, b] = Ce({
|
|
347
350
|
prop: i,
|
|
348
351
|
defaultProp: c,
|
|
349
352
|
onChange: u
|
|
350
|
-
}), [_, w] = a.useState(!1), E =
|
|
353
|
+
}), [_, w] = a.useState(!1), E = re(l), N = Ie(n), A = a.useRef(!1), [q, L] = a.useState(0);
|
|
351
354
|
return a.useEffect(() => {
|
|
352
|
-
const I =
|
|
355
|
+
const I = g.current;
|
|
353
356
|
if (I)
|
|
354
357
|
return I.addEventListener(J, E), () => I.removeEventListener(J, E);
|
|
355
358
|
}, [E]), /* @__PURE__ */ m(
|
|
356
|
-
|
|
359
|
+
gt,
|
|
357
360
|
{
|
|
358
361
|
scope: n,
|
|
359
362
|
orientation: o,
|
|
@@ -361,22 +364,22 @@ var gt = a.forwardRef((e, t) => {
|
|
|
361
364
|
loop: s,
|
|
362
365
|
currentTabStopId: y,
|
|
363
366
|
onItemFocus: a.useCallback(
|
|
364
|
-
(I) =>
|
|
365
|
-
[
|
|
367
|
+
(I) => b(I),
|
|
368
|
+
[b]
|
|
366
369
|
),
|
|
367
370
|
onItemShiftTab: a.useCallback(() => w(!0), []),
|
|
368
371
|
onFocusableItemAdd: a.useCallback(
|
|
369
|
-
() =>
|
|
372
|
+
() => L((I) => I + 1),
|
|
370
373
|
[]
|
|
371
374
|
),
|
|
372
375
|
onFocusableItemRemove: a.useCallback(
|
|
373
|
-
() =>
|
|
376
|
+
() => L((I) => I - 1),
|
|
374
377
|
[]
|
|
375
378
|
),
|
|
376
379
|
children: /* @__PURE__ */ m(
|
|
377
380
|
D.div,
|
|
378
381
|
{
|
|
379
|
-
tabIndex: _ ||
|
|
382
|
+
tabIndex: _ || q === 0 ? -1 : 0,
|
|
380
383
|
"data-orientation": o,
|
|
381
384
|
...d,
|
|
382
385
|
ref: h,
|
|
@@ -387,12 +390,12 @@ var gt = a.forwardRef((e, t) => {
|
|
|
387
390
|
onFocus: x(e.onFocus, (I) => {
|
|
388
391
|
const V = !A.current;
|
|
389
392
|
if (I.target === I.currentTarget && V && !_) {
|
|
390
|
-
const F = new CustomEvent(J,
|
|
393
|
+
const F = new CustomEvent(J, mt);
|
|
391
394
|
if (I.currentTarget.dispatchEvent(F), !F.defaultPrevented) {
|
|
392
395
|
const M = N().filter((C) => C.focusable), z = M.find((C) => C.active), Y = M.find((C) => C.id === y), p = [z, Y, ...M].filter(
|
|
393
396
|
Boolean
|
|
394
397
|
).map((C) => C.ref.current);
|
|
395
|
-
|
|
398
|
+
xe(p, v);
|
|
396
399
|
}
|
|
397
400
|
}
|
|
398
401
|
A.current = !1;
|
|
@@ -402,7 +405,7 @@ var gt = a.forwardRef((e, t) => {
|
|
|
402
405
|
)
|
|
403
406
|
}
|
|
404
407
|
);
|
|
405
|
-
}),
|
|
408
|
+
}), Re = "RovingFocusGroupItem", Te = a.forwardRef(
|
|
406
409
|
(e, t) => {
|
|
407
410
|
const {
|
|
408
411
|
__scopeRovingFocusGroup: n,
|
|
@@ -410,12 +413,12 @@ var gt = a.forwardRef((e, t) => {
|
|
|
410
413
|
active: s = !1,
|
|
411
414
|
tabStopId: r,
|
|
412
415
|
...i
|
|
413
|
-
} = e, c =
|
|
416
|
+
} = e, c = ye(), u = r || c, l = bt(Re, n), v = l.currentTabStopId === u, d = Ie(n), { onFocusableItemAdd: g, onFocusableItemRemove: h } = l;
|
|
414
417
|
return a.useEffect(() => {
|
|
415
418
|
if (o)
|
|
416
|
-
return
|
|
417
|
-
}, [o,
|
|
418
|
-
|
|
419
|
+
return g(), () => h();
|
|
420
|
+
}, [o, g, h]), /* @__PURE__ */ m(
|
|
421
|
+
te.ItemSlot,
|
|
419
422
|
{
|
|
420
423
|
scope: n,
|
|
421
424
|
id: u,
|
|
@@ -424,7 +427,7 @@ var gt = a.forwardRef((e, t) => {
|
|
|
424
427
|
children: /* @__PURE__ */ m(
|
|
425
428
|
D.span,
|
|
426
429
|
{
|
|
427
|
-
tabIndex:
|
|
430
|
+
tabIndex: v ? 0 : -1,
|
|
428
431
|
"data-orientation": l.orientation,
|
|
429
432
|
...i,
|
|
430
433
|
ref: t,
|
|
@@ -438,7 +441,7 @@ var gt = a.forwardRef((e, t) => {
|
|
|
438
441
|
return;
|
|
439
442
|
}
|
|
440
443
|
if (f.target !== f.currentTarget) return;
|
|
441
|
-
const y =
|
|
444
|
+
const y = wt(f, l.orientation, l.dir);
|
|
442
445
|
if (y !== void 0) {
|
|
443
446
|
if (f.metaKey || f.ctrlKey || f.altKey || f.shiftKey) return;
|
|
444
447
|
f.preventDefault();
|
|
@@ -447,9 +450,9 @@ var gt = a.forwardRef((e, t) => {
|
|
|
447
450
|
else if (y === "prev" || y === "next") {
|
|
448
451
|
y === "prev" && _.reverse();
|
|
449
452
|
const w = _.indexOf(f.currentTarget);
|
|
450
|
-
_ = l.loop ?
|
|
453
|
+
_ = l.loop ? It(_, w + 1) : _.slice(w + 1);
|
|
451
454
|
}
|
|
452
|
-
setTimeout(() =>
|
|
455
|
+
setTimeout(() => xe(_));
|
|
453
456
|
}
|
|
454
457
|
})
|
|
455
458
|
}
|
|
@@ -458,8 +461,8 @@ var gt = a.forwardRef((e, t) => {
|
|
|
458
461
|
);
|
|
459
462
|
}
|
|
460
463
|
);
|
|
461
|
-
|
|
462
|
-
var
|
|
464
|
+
Te.displayName = Re;
|
|
465
|
+
var yt = {
|
|
463
466
|
ArrowLeft: "prev",
|
|
464
467
|
ArrowUp: "prev",
|
|
465
468
|
ArrowRight: "next",
|
|
@@ -469,33 +472,33 @@ var bt = {
|
|
|
469
472
|
PageDown: "last",
|
|
470
473
|
End: "last"
|
|
471
474
|
};
|
|
472
|
-
function
|
|
475
|
+
function Ct(e, t) {
|
|
473
476
|
return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
|
|
474
477
|
}
|
|
475
|
-
function
|
|
476
|
-
const o =
|
|
478
|
+
function wt(e, t, n) {
|
|
479
|
+
const o = Ct(e.key, n);
|
|
477
480
|
if (!(t === "vertical" && ["ArrowLeft", "ArrowRight"].includes(o)) && !(t === "horizontal" && ["ArrowUp", "ArrowDown"].includes(o)))
|
|
478
|
-
return
|
|
481
|
+
return yt[o];
|
|
479
482
|
}
|
|
480
|
-
function
|
|
483
|
+
function xe(e, t = !1) {
|
|
481
484
|
const n = document.activeElement;
|
|
482
485
|
for (const o of e)
|
|
483
486
|
if (o === n || (o.focus({ preventScroll: t }), document.activeElement !== n)) return;
|
|
484
487
|
}
|
|
485
|
-
function
|
|
488
|
+
function It(e, t) {
|
|
486
489
|
return e.map((n, o) => e[(t + o) % e.length]);
|
|
487
490
|
}
|
|
488
|
-
var
|
|
489
|
-
function
|
|
491
|
+
var St = Ne, Nt = Te;
|
|
492
|
+
function Rt(e, t) {
|
|
490
493
|
return a.useReducer((n, o) => t[n][o] ?? n, e);
|
|
491
494
|
}
|
|
492
|
-
var
|
|
493
|
-
const { present: t, children: n } = e, o =
|
|
495
|
+
var Ee = (e) => {
|
|
496
|
+
const { present: t, children: n } = e, o = Tt(t), s = typeof n == "function" ? n({ present: o.isPresent }) : a.Children.only(n), r = W(o.ref, xt(s));
|
|
494
497
|
return typeof n == "function" || o.isPresent ? a.cloneElement(s, { ref: r }) : null;
|
|
495
498
|
};
|
|
496
|
-
|
|
497
|
-
function
|
|
498
|
-
const [t, n] = a.useState(), o = a.useRef({}), s = a.useRef(e), r = a.useRef("none"), i = e ? "mounted" : "unmounted", [c, u] =
|
|
499
|
+
Ee.displayName = "Presence";
|
|
500
|
+
function Tt(e) {
|
|
501
|
+
const [t, n] = a.useState(), o = a.useRef({}), s = a.useRef(e), r = a.useRef("none"), i = e ? "mounted" : "unmounted", [c, u] = Rt(i, {
|
|
499
502
|
mounted: {
|
|
500
503
|
UNMOUNT: "unmounted",
|
|
501
504
|
ANIMATION_OUT: "unmountSuspended"
|
|
@@ -511,28 +514,28 @@ function St(e) {
|
|
|
511
514
|
return a.useEffect(() => {
|
|
512
515
|
const l = G(o.current);
|
|
513
516
|
r.current = c === "mounted" ? l : "none";
|
|
514
|
-
}, [c]),
|
|
515
|
-
const l = o.current,
|
|
516
|
-
if (
|
|
517
|
-
const
|
|
518
|
-
e ? u("MOUNT") : h === "none" || (l == null ? void 0 : l.display) === "none" ? u("UNMOUNT") : u(
|
|
517
|
+
}, [c]), ee(() => {
|
|
518
|
+
const l = o.current, v = s.current;
|
|
519
|
+
if (v !== e) {
|
|
520
|
+
const g = r.current, h = G(l);
|
|
521
|
+
e ? u("MOUNT") : h === "none" || (l == null ? void 0 : l.display) === "none" ? u("UNMOUNT") : u(v && g !== h ? "ANIMATION_OUT" : "UNMOUNT"), s.current = e;
|
|
519
522
|
}
|
|
520
|
-
}, [e, u]),
|
|
523
|
+
}, [e, u]), ee(() => {
|
|
521
524
|
if (t) {
|
|
522
525
|
let l;
|
|
523
|
-
const
|
|
526
|
+
const v = t.ownerDocument.defaultView ?? window, d = (h) => {
|
|
524
527
|
const y = G(o.current).includes(h.animationName);
|
|
525
528
|
if (h.target === t && y && (u("ANIMATION_END"), !s.current)) {
|
|
526
|
-
const
|
|
527
|
-
t.style.animationFillMode = "forwards", l =
|
|
528
|
-
t.style.animationFillMode === "forwards" && (t.style.animationFillMode =
|
|
529
|
+
const b = t.style.animationFillMode;
|
|
530
|
+
t.style.animationFillMode = "forwards", l = v.setTimeout(() => {
|
|
531
|
+
t.style.animationFillMode === "forwards" && (t.style.animationFillMode = b);
|
|
529
532
|
});
|
|
530
533
|
}
|
|
531
|
-
},
|
|
534
|
+
}, g = (h) => {
|
|
532
535
|
h.target === t && (r.current = G(o.current));
|
|
533
536
|
};
|
|
534
|
-
return t.addEventListener("animationstart",
|
|
535
|
-
|
|
537
|
+
return t.addEventListener("animationstart", g), t.addEventListener("animationcancel", d), t.addEventListener("animationend", d), () => {
|
|
538
|
+
v.clearTimeout(l), t.removeEventListener("animationstart", g), t.removeEventListener("animationcancel", d), t.removeEventListener("animationend", d);
|
|
536
539
|
};
|
|
537
540
|
} else
|
|
538
541
|
u("ANIMATION_END");
|
|
@@ -546,14 +549,14 @@ function St(e) {
|
|
|
546
549
|
function G(e) {
|
|
547
550
|
return (e == null ? void 0 : e.animationName) || "none";
|
|
548
551
|
}
|
|
549
|
-
function
|
|
552
|
+
function xt(e) {
|
|
550
553
|
var o, s;
|
|
551
554
|
let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
|
|
552
555
|
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);
|
|
553
556
|
}
|
|
554
|
-
var
|
|
555
|
-
|
|
556
|
-
]),
|
|
557
|
+
var oe = "Tabs", [Et, Qt] = ne(oe, [
|
|
558
|
+
Se
|
|
559
|
+
]), Ae = Se(), [At, se] = Et(oe), Me = a.forwardRef(
|
|
557
560
|
(e, t) => {
|
|
558
561
|
const {
|
|
559
562
|
__scopeTabs: n,
|
|
@@ -564,25 +567,25 @@ var re = "Tabs", [Rt, Yt] = te(re, [
|
|
|
564
567
|
dir: c,
|
|
565
568
|
activationMode: u = "automatic",
|
|
566
569
|
...l
|
|
567
|
-
} = e,
|
|
570
|
+
} = e, v = we(c), [d, g] = Ce({
|
|
568
571
|
prop: o,
|
|
569
572
|
onChange: s,
|
|
570
573
|
defaultProp: r
|
|
571
574
|
});
|
|
572
575
|
return /* @__PURE__ */ m(
|
|
573
|
-
|
|
576
|
+
At,
|
|
574
577
|
{
|
|
575
578
|
scope: n,
|
|
576
|
-
baseId:
|
|
579
|
+
baseId: ye(),
|
|
577
580
|
value: d,
|
|
578
|
-
onValueChange:
|
|
581
|
+
onValueChange: g,
|
|
579
582
|
orientation: i,
|
|
580
|
-
dir:
|
|
583
|
+
dir: v,
|
|
581
584
|
activationMode: u,
|
|
582
585
|
children: /* @__PURE__ */ m(
|
|
583
586
|
D.div,
|
|
584
587
|
{
|
|
585
|
-
dir:
|
|
588
|
+
dir: v,
|
|
586
589
|
"data-orientation": i,
|
|
587
590
|
...l,
|
|
588
591
|
ref: t
|
|
@@ -592,12 +595,12 @@ var re = "Tabs", [Rt, Yt] = te(re, [
|
|
|
592
595
|
);
|
|
593
596
|
}
|
|
594
597
|
);
|
|
595
|
-
|
|
596
|
-
var
|
|
598
|
+
Me.displayName = oe;
|
|
599
|
+
var Pe = "TabsList", Oe = a.forwardRef(
|
|
597
600
|
(e, t) => {
|
|
598
|
-
const { __scopeTabs: n, loop: o = !0, ...s } = e, r =
|
|
601
|
+
const { __scopeTabs: n, loop: o = !0, ...s } = e, r = se(Pe, n), i = Ae(n);
|
|
599
602
|
return /* @__PURE__ */ m(
|
|
600
|
-
|
|
603
|
+
St,
|
|
601
604
|
{
|
|
602
605
|
asChild: !0,
|
|
603
606
|
...i,
|
|
@@ -617,25 +620,25 @@ var Ee = "TabsList", Ae = a.forwardRef(
|
|
|
617
620
|
);
|
|
618
621
|
}
|
|
619
622
|
);
|
|
620
|
-
|
|
621
|
-
var
|
|
623
|
+
Oe.displayName = Pe;
|
|
624
|
+
var Fe = "TabsTrigger", $e = a.forwardRef(
|
|
622
625
|
(e, t) => {
|
|
623
|
-
const { __scopeTabs: n, value: o, disabled: s = !1, ...r } = e, i =
|
|
626
|
+
const { __scopeTabs: n, value: o, disabled: s = !1, ...r } = e, i = se(Fe, n), c = Ae(n), u = Le(i.baseId, o), l = Ve(i.baseId, o), v = o === i.value;
|
|
624
627
|
return /* @__PURE__ */ m(
|
|
625
|
-
|
|
628
|
+
Nt,
|
|
626
629
|
{
|
|
627
630
|
asChild: !0,
|
|
628
631
|
...c,
|
|
629
632
|
focusable: !s,
|
|
630
|
-
active:
|
|
633
|
+
active: v,
|
|
631
634
|
children: /* @__PURE__ */ m(
|
|
632
635
|
D.button,
|
|
633
636
|
{
|
|
634
637
|
type: "button",
|
|
635
638
|
role: "tab",
|
|
636
|
-
"aria-selected":
|
|
639
|
+
"aria-selected": v,
|
|
637
640
|
"aria-controls": l,
|
|
638
|
-
"data-state":
|
|
641
|
+
"data-state": v ? "active" : "inactive",
|
|
639
642
|
"data-disabled": s ? "" : void 0,
|
|
640
643
|
disabled: s,
|
|
641
644
|
id: u,
|
|
@@ -649,7 +652,7 @@ var Me = "TabsTrigger", Pe = a.forwardRef(
|
|
|
649
652
|
}),
|
|
650
653
|
onFocus: x(e.onFocus, () => {
|
|
651
654
|
const d = i.activationMode !== "manual";
|
|
652
|
-
!
|
|
655
|
+
!v && !s && d && i.onValueChange(o);
|
|
653
656
|
})
|
|
654
657
|
}
|
|
655
658
|
)
|
|
@@ -657,21 +660,21 @@ var Me = "TabsTrigger", Pe = a.forwardRef(
|
|
|
657
660
|
);
|
|
658
661
|
}
|
|
659
662
|
);
|
|
660
|
-
|
|
661
|
-
var
|
|
663
|
+
$e.displayName = Fe;
|
|
664
|
+
var De = "TabsContent", qe = a.forwardRef(
|
|
662
665
|
(e, t) => {
|
|
663
|
-
const { __scopeTabs: n, value: o, forceMount: s, children: r, ...i } = e, c =
|
|
666
|
+
const { __scopeTabs: n, value: o, forceMount: s, children: r, ...i } = e, c = se(De, n), u = Le(c.baseId, o), l = Ve(c.baseId, o), v = o === c.value, d = a.useRef(v);
|
|
664
667
|
return a.useEffect(() => {
|
|
665
|
-
const
|
|
666
|
-
return () => cancelAnimationFrame(
|
|
667
|
-
}, []), /* @__PURE__ */ m(
|
|
668
|
+
const g = requestAnimationFrame(() => d.current = !1);
|
|
669
|
+
return () => cancelAnimationFrame(g);
|
|
670
|
+
}, []), /* @__PURE__ */ m(Ee, { present: s || v, children: ({ present: g }) => /* @__PURE__ */ m(
|
|
668
671
|
D.div,
|
|
669
672
|
{
|
|
670
|
-
"data-state":
|
|
673
|
+
"data-state": v ? "active" : "inactive",
|
|
671
674
|
"data-orientation": c.orientation,
|
|
672
675
|
role: "tabpanel",
|
|
673
676
|
"aria-labelledby": u,
|
|
674
|
-
hidden: !
|
|
677
|
+
hidden: !g,
|
|
675
678
|
id: l,
|
|
676
679
|
tabIndex: 0,
|
|
677
680
|
...i,
|
|
@@ -680,63 +683,66 @@ var Oe = "TabsContent", Fe = a.forwardRef(
|
|
|
680
683
|
...e.style,
|
|
681
684
|
animationDuration: d.current ? "0s" : void 0
|
|
682
685
|
},
|
|
683
|
-
children:
|
|
686
|
+
children: g && r
|
|
684
687
|
}
|
|
685
688
|
) });
|
|
686
689
|
}
|
|
687
690
|
);
|
|
688
|
-
|
|
689
|
-
function
|
|
691
|
+
qe.displayName = De;
|
|
692
|
+
function Le(e, t) {
|
|
690
693
|
return `${e}-trigger-${t}`;
|
|
691
694
|
}
|
|
692
|
-
function
|
|
695
|
+
function Ve(e, t) {
|
|
693
696
|
return `${e}-content-${t}`;
|
|
694
697
|
}
|
|
695
|
-
var
|
|
696
|
-
function
|
|
698
|
+
var Mt = Me, Pt = Oe, Ot = $e, Ft = qe;
|
|
699
|
+
function $t(e) {
|
|
697
700
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
698
701
|
}
|
|
699
|
-
var
|
|
702
|
+
var Q = { exports: {} };
|
|
700
703
|
/*!
|
|
701
704
|
Copyright (c) 2018 Jed Watson.
|
|
702
705
|
Licensed under the MIT License (MIT), see
|
|
703
706
|
http://jedwatson.github.io/classnames
|
|
704
707
|
*/
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
function
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
708
|
+
var me;
|
|
709
|
+
function Dt() {
|
|
710
|
+
return me || (me = 1, function(e) {
|
|
711
|
+
(function() {
|
|
712
|
+
var t = {}.hasOwnProperty;
|
|
713
|
+
function n() {
|
|
714
|
+
for (var r = "", i = 0; i < arguments.length; i++) {
|
|
715
|
+
var c = arguments[i];
|
|
716
|
+
c && (r = s(r, o.call(this, c)));
|
|
717
|
+
}
|
|
718
|
+
return r;
|
|
712
719
|
}
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
const se = /* @__PURE__ */ Pt(Ot), Ft = {
|
|
720
|
+
function o(r) {
|
|
721
|
+
if (typeof r == "string" || typeof r == "number")
|
|
722
|
+
return this && this[r] || r;
|
|
723
|
+
if (typeof r != "object")
|
|
724
|
+
return "";
|
|
725
|
+
if (Array.isArray(r))
|
|
726
|
+
return n.apply(this, r);
|
|
727
|
+
if (r.toString !== Object.prototype.toString && !r.toString.toString().includes("[native code]"))
|
|
728
|
+
return r.toString();
|
|
729
|
+
var i = "";
|
|
730
|
+
for (var c in r)
|
|
731
|
+
t.call(r, c) && r[c] && (i = s(i, this && this[c] || c));
|
|
732
|
+
return i;
|
|
733
|
+
}
|
|
734
|
+
function s(r, i) {
|
|
735
|
+
return i ? r ? r + " " + i : r + i : r;
|
|
736
|
+
}
|
|
737
|
+
e.exports ? (n.default = n, e.exports = n) : window.classNames = n;
|
|
738
|
+
})();
|
|
739
|
+
}(Q)), Q.exports;
|
|
740
|
+
}
|
|
741
|
+
var qt = Dt();
|
|
742
|
+
const ie = /* @__PURE__ */ $t(qt), Lt = {
|
|
737
743
|
"purpur-tab-content": "_purpur-tab-content_1ugbi_1",
|
|
738
744
|
"purpur-tab-content--force-mount": "_purpur-tab-content--force-mount_1ugbi_15"
|
|
739
|
-
},
|
|
745
|
+
}, Vt = ie.bind(Lt), _e = "purpur-tab-content", Bt = ge(
|
|
740
746
|
({
|
|
741
747
|
children: e,
|
|
742
748
|
tabId: t,
|
|
@@ -745,13 +751,13 @@ const se = /* @__PURE__ */ Pt(Ot), Ft = {
|
|
|
745
751
|
disableForceMount: s,
|
|
746
752
|
...r
|
|
747
753
|
}, i) => /* @__PURE__ */ m(
|
|
748
|
-
|
|
754
|
+
Ft,
|
|
749
755
|
{
|
|
750
756
|
ref: i,
|
|
751
|
-
className:
|
|
752
|
-
|
|
757
|
+
className: Vt([
|
|
758
|
+
_e,
|
|
753
759
|
o,
|
|
754
|
-
{ [`${
|
|
760
|
+
{ [`${_e}--force-mount`]: !s }
|
|
755
761
|
]),
|
|
756
762
|
"data-testid": n,
|
|
757
763
|
value: t,
|
|
@@ -760,13 +766,13 @@ const se = /* @__PURE__ */ Pt(Ot), Ft = {
|
|
|
760
766
|
children: e
|
|
761
767
|
}
|
|
762
768
|
)
|
|
763
|
-
),
|
|
769
|
+
), Ut = (e) => !!e && We(e) && !!e.props.name && !!e.props.tabId, jt = {
|
|
764
770
|
"purpur-tab-header": "_purpur-tab-header_18g3c_1",
|
|
765
771
|
"purpur-tab-header--contained": "_purpur-tab-header--contained_18g3c_33",
|
|
766
772
|
"purpur-tab-header--contained-negative": "_purpur-tab-header--contained-negative_18g3c_33",
|
|
767
773
|
"purpur-tab-header--line": "_purpur-tab-header--line_18g3c_36",
|
|
768
774
|
"purpur-tab-header--line-negative": "_purpur-tab-header--line-negative_18g3c_48"
|
|
769
|
-
},
|
|
775
|
+
}, Gt = ie.bind(jt), ve = "purpur-tab-header", Wt = ge(
|
|
770
776
|
({
|
|
771
777
|
index: e,
|
|
772
778
|
tabId: t,
|
|
@@ -776,10 +782,10 @@ const se = /* @__PURE__ */ Pt(Ot), Ft = {
|
|
|
776
782
|
"data-testid": r,
|
|
777
783
|
children: i
|
|
778
784
|
}, c) => /* @__PURE__ */ m(
|
|
779
|
-
|
|
785
|
+
Ot,
|
|
780
786
|
{
|
|
781
787
|
id: `${t}-trigger`,
|
|
782
|
-
className:
|
|
788
|
+
className: Gt([ve, `${ve}--${n}${o ? "-negative" : ""}`]),
|
|
783
789
|
value: t,
|
|
784
790
|
"data-testid": r,
|
|
785
791
|
"data-index": e,
|
|
@@ -788,7 +794,7 @@ const se = /* @__PURE__ */ Pt(Ot), Ft = {
|
|
|
788
794
|
children: i
|
|
789
795
|
}
|
|
790
796
|
)
|
|
791
|
-
),
|
|
797
|
+
), kt = {
|
|
792
798
|
"purpur-tabs__wrapper": "_purpur-tabs__wrapper_1dpqy_1",
|
|
793
799
|
"purpur-tabs__scroll-button": "_purpur-tabs__scroll-button_1dpqy_9",
|
|
794
800
|
"purpur-tabs__scroll-button--left": "_purpur-tabs__scroll-button--left_1dpqy_63",
|
|
@@ -803,14 +809,14 @@ const se = /* @__PURE__ */ Pt(Ot), Ft = {
|
|
|
803
809
|
"purpur-tabs--contained-negative": "_purpur-tabs--contained-negative_1dpqy_103",
|
|
804
810
|
"purpur-tabs__content-container": "_purpur-tabs__content-container_1dpqy_106",
|
|
805
811
|
"purpur-tabs--fullWidth": "_purpur-tabs--fullWidth_1dpqy_115"
|
|
806
|
-
},
|
|
812
|
+
}, Ht = ["line", "contained"], Kt = (e) => new CustomEvent("tabChangeDetail", { detail: { value: e } }), O = ie.bind(kt), S = "purpur-tabs", zt = (e, t) => {
|
|
807
813
|
var u;
|
|
808
814
|
if (typeof (e == null ? void 0 : e.getBoundingClientRect) != "function" || typeof (t == null ? void 0 : t.scroll) != "function")
|
|
809
815
|
return;
|
|
810
816
|
const n = e.getBoundingClientRect(), o = t.getBoundingClientRect(), s = t.clientWidth, r = parseInt((u = getComputedStyle(t).borderLeftWidth) == null ? void 0 : u.split("px")[0], 10), i = o.left + (isNaN(r) ? 0 : r);
|
|
811
817
|
let c;
|
|
812
818
|
n.right > o.right && (c = n.left + t.scrollLeft, c = c + n.width - s + s * 0.1, c = c - i), n.left < o.left && (c = n.left + t.scrollLeft, c = c - s * 0.1, c = c - i), c !== void 0 && t.scroll({ left: c, behavior: "smooth" });
|
|
813
|
-
},
|
|
819
|
+
}, Yt = ({
|
|
814
820
|
children: e,
|
|
815
821
|
variant: t = "line",
|
|
816
822
|
negative: n = !1,
|
|
@@ -822,20 +828,20 @@ const se = /* @__PURE__ */ Pt(Ot), Ft = {
|
|
|
822
828
|
value: u,
|
|
823
829
|
...l
|
|
824
830
|
}) => {
|
|
825
|
-
const [
|
|
831
|
+
const [v, d] = B({}), [g, h] = B(0), [f, y] = B(0), b = U.toArray(e).filter(Ut), _ = ue(null), w = ue(new Array(b.length)), E = 200, N = t === "line", A = O([
|
|
826
832
|
S,
|
|
827
833
|
`${S}--${t}${n ? "-negative" : ""}`,
|
|
828
834
|
{ [`${S}--fullWidth`]: o },
|
|
829
835
|
r
|
|
830
|
-
]),
|
|
831
|
-
const p =
|
|
836
|
+
]), q = U.map(b, ({ props: { tabId: p } }) => p), L = () => {
|
|
837
|
+
const p = q.findIndex((C) => C === i);
|
|
832
838
|
return p >= 0 ? p : 0;
|
|
833
839
|
};
|
|
834
840
|
j(() => {
|
|
835
|
-
u && V(
|
|
836
|
-
}, [
|
|
837
|
-
const [I, V] =
|
|
838
|
-
if (new Set(
|
|
841
|
+
u && V(b.findIndex((p) => p.props.tabId === u));
|
|
842
|
+
}, [b, u]);
|
|
843
|
+
const [I, V] = B(L);
|
|
844
|
+
if (new Set(q).size !== q.length)
|
|
839
845
|
throw new Error("tabId must be unique");
|
|
840
846
|
const F = (p, C) => C || c ? `${C || c}-${p}` : void 0, M = () => {
|
|
841
847
|
if (!N)
|
|
@@ -843,7 +849,7 @@ const se = /* @__PURE__ */ Pt(Ot), Ft = {
|
|
|
843
849
|
const p = w.current[I];
|
|
844
850
|
h((p == null ? void 0 : p.offsetLeft) || 0), y((p == null ? void 0 : p.getBoundingClientRect().width) || 0);
|
|
845
851
|
}, z = (p) => {
|
|
846
|
-
N && !u && V(
|
|
852
|
+
N && !u && V(b.findIndex((C) => C.props.tabId === p)), s == null || s(Kt(p));
|
|
847
853
|
}, Y = (p) => {
|
|
848
854
|
if (_ != null && _.current) {
|
|
849
855
|
const { scrollLeft: C } = _.current, $ = p === "left" ? -200 : E;
|
|
@@ -858,27 +864,27 @@ const se = /* @__PURE__ */ Pt(Ot), Ft = {
|
|
|
858
864
|
"aria-hidden": "true",
|
|
859
865
|
tabIndex: -1,
|
|
860
866
|
"data-testid": F("scroll-button"),
|
|
861
|
-
children: /* @__PURE__ */ m(
|
|
867
|
+
children: /* @__PURE__ */ m(be, { svg: p === "left" ? tt : nt, size: "md" })
|
|
862
868
|
}
|
|
863
869
|
);
|
|
864
870
|
return j(() => (window.addEventListener("resize", M), () => {
|
|
865
871
|
window.removeEventListener("resize", M);
|
|
866
872
|
}), []), j(() => {
|
|
867
873
|
M();
|
|
868
|
-
}, [I, o,
|
|
874
|
+
}, [I, o, b.length, t]), j(() => {
|
|
869
875
|
const p = (T) => {
|
|
870
|
-
if (T.every((R) => R.isIntersecting) && T.length ===
|
|
876
|
+
if (T.every((R) => R.isIntersecting) && T.length === b.length) {
|
|
871
877
|
d({});
|
|
872
878
|
return;
|
|
873
879
|
}
|
|
874
880
|
T.forEach((R) => {
|
|
875
|
-
const
|
|
876
|
-
d((
|
|
877
|
-
...
|
|
878
|
-
...
|
|
881
|
+
const ae = Number(R.target.getAttribute("data-index")), Be = ae === 0, Ue = ae === b.length - 1;
|
|
882
|
+
d((je) => ({
|
|
883
|
+
...je,
|
|
884
|
+
...Be && {
|
|
879
885
|
[`${S}__wrapper--scroll-end`]: !R.isIntersecting
|
|
880
886
|
},
|
|
881
|
-
...
|
|
887
|
+
...Ue && {
|
|
882
888
|
[`${S}__wrapper--scroll-start`]: !R.isIntersecting
|
|
883
889
|
}
|
|
884
890
|
}));
|
|
@@ -890,38 +896,38 @@ const se = /* @__PURE__ */ Pt(Ot), Ft = {
|
|
|
890
896
|
return $.forEach((T) => C.observe(T)), () => {
|
|
891
897
|
$.forEach((T) => C.unobserve(T));
|
|
892
898
|
};
|
|
893
|
-
}, [
|
|
894
|
-
|
|
899
|
+
}, [b.length]), /* @__PURE__ */ m(
|
|
900
|
+
Mt,
|
|
895
901
|
{
|
|
896
|
-
defaultValue: i ??
|
|
902
|
+
defaultValue: i ?? b[0].props.tabId,
|
|
897
903
|
onValueChange: z,
|
|
898
904
|
"data-testid": c,
|
|
899
905
|
className: A,
|
|
900
906
|
value: u,
|
|
901
907
|
...l,
|
|
902
908
|
children: /* @__PURE__ */ X("div", { className: O(`${S}__container`), children: [
|
|
903
|
-
/* @__PURE__ */ X("div", { className: O([`${S}__wrapper`,
|
|
909
|
+
/* @__PURE__ */ X("div", { className: O([`${S}__wrapper`, v]), children: [
|
|
904
910
|
/* @__PURE__ */ X(
|
|
905
|
-
|
|
911
|
+
Pt,
|
|
906
912
|
{
|
|
907
913
|
ref: (p) => {
|
|
908
914
|
_.current = p;
|
|
909
915
|
},
|
|
910
916
|
className: O(`${S}__list`),
|
|
911
917
|
children: [
|
|
912
|
-
|
|
913
|
-
const { name: $, tabId: T, "data-testid":
|
|
918
|
+
U.map(b, (p, C) => {
|
|
919
|
+
const { name: $, tabId: T, "data-testid": ce } = p.props;
|
|
914
920
|
return /* @__PURE__ */ m(
|
|
915
|
-
|
|
921
|
+
Wt,
|
|
916
922
|
{
|
|
917
|
-
"data-testid": F("header",
|
|
923
|
+
"data-testid": F("header", ce),
|
|
918
924
|
index: C,
|
|
919
925
|
tabId: T,
|
|
920
926
|
ref: (R) => {
|
|
921
927
|
R && (w.current[C] = R);
|
|
922
928
|
},
|
|
923
929
|
onFocus: (R) => {
|
|
924
|
-
|
|
930
|
+
zt(R.target, _.current);
|
|
925
931
|
},
|
|
926
932
|
variant: t,
|
|
927
933
|
negative: n,
|
|
@@ -935,7 +941,7 @@ const se = /* @__PURE__ */ Pt(Ot), Ft = {
|
|
|
935
941
|
className: O(`${S}__selected-border`),
|
|
936
942
|
style: {
|
|
937
943
|
width: f,
|
|
938
|
-
transform: `translateX(${
|
|
944
|
+
transform: `translateX(${g}px)`
|
|
939
945
|
},
|
|
940
946
|
"data-testid": F("selected-border")
|
|
941
947
|
}
|
|
@@ -946,15 +952,15 @@ const se = /* @__PURE__ */ Pt(Ot), Ft = {
|
|
|
946
952
|
/* @__PURE__ */ m(Z, { side: "left" }),
|
|
947
953
|
/* @__PURE__ */ m(Z, { side: "right" })
|
|
948
954
|
] }),
|
|
949
|
-
/* @__PURE__ */ m("div", { className: O(`${S}__content-container`), children:
|
|
955
|
+
/* @__PURE__ */ m("div", { className: O(`${S}__content-container`), children: U.map(b, (p) => p) })
|
|
950
956
|
] })
|
|
951
957
|
}
|
|
952
958
|
);
|
|
953
959
|
};
|
|
954
|
-
|
|
960
|
+
Yt.Content = Bt;
|
|
955
961
|
export {
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
962
|
+
Yt as Tabs,
|
|
963
|
+
Kt as createTabChangeDetailEvent,
|
|
964
|
+
Ht as tabsVariants
|
|
959
965
|
};
|
|
960
966
|
//# sourceMappingURL=tabs.es.js.map
|