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