@purpurds/tabs 8.2.2 → 8.2.3

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