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