welcome-ui 10.0.0-alpha.11 → 10.0.0-alpha.12

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.js CHANGED
@@ -1,125 +1,125 @@
1
1
  "use client";
2
2
  import './Tabs.css';
3
- import { jsx as _, jsxs as Ie } from "react/jsx-runtime";
4
- import { C as ee, a as te, h as q, b as Se, j as xe } from "./SBSPVDDI-CmtnvvUX.js";
5
- import { e as oe, y as ge, f as F, c as W, b as j, _ as H, i as K, l as se, F as he, d as g, a as v, u as V, k as ne, af as Ce, v as Te, Z as _e, M as Pe, A, z as k, B as O, V as G, C as J } from "./OE2EFRVA-Dg1R6gaC.js";
6
- import { b as z, m as Ee, o as Q, c as ye, s as B, d as y, f as Ne, u as re, a as X } from "./RTNCFSKZ-BywELldk.js";
7
- import ae, { useCallback as ce, useRef as D, useEffect as Y, useState as U, createContext as ie, useMemo as we, cloneElement as Re, forwardRef as le } from "react";
8
- import { c as M } from "./index-PAaZGbyz.js";
9
- import { f as $e } from "./forwardRefWithAs-8eP3ZN15.js";
10
- import { u as Le, b as ke } from "./OLVWQA7U-Dia3UUnG.js";
11
- import { m as Oe, g as Be, u as ze } from "./useForkRef-D807AV7D.js";
12
- import { u as Ae, a as Me } from "./use-viewport-CgrficYB.js";
13
- import { u as Ve, d as De } from "./T22PY7TE-gLuJpoOm.js";
14
- import { P as Fe, b as We } from "./Y67KZUMI-BwLWwpNF.js";
15
- import { c as je, a as He, u as Ke } from "./B7UTNDHN-BghjolIs.js";
16
- var Z = oe(
17
- [te],
18
- [ee]
19
- ), Ue = Z.useScopedContext, de = Z.useProviderContext, ue = Z.ScopedContextProvider, Ze = "button", qe = W(function(r) {
20
- var t = r, {
3
+ import { jsx as T, jsxs as pe } from "react/jsx-runtime";
4
+ import { C as X, a as Y, h as A, b as fe, j as ve } from "./SBSPVDDI-CmtnvvUX.js";
5
+ import { e as ee, y as Ie, f as F, c as W, b as j, _ as B, i as H, l as te, F as ge, d as S, a as f, u as $, k as oe, af as xe, v as Se, Z as Pe, M as Ce, A as M, z as O, B as V, V as U, C as Z } from "./OE2EFRVA-Dg1R6gaC.js";
6
+ import { u as Te, b as _e } from "./OLVWQA7U-Dia3UUnG.js";
7
+ import he, { useCallback as ne, useRef as q, useEffect as G, useState as ke, createContext as re, useMemo as ye, forwardRef as se, cloneElement as Ee, isValidElement as we } from "react";
8
+ import { c as ae } from "./index-PAaZGbyz.js";
9
+ import { b as D, m as Ne, o as J, c as Re, s as z, d as y, f as Le, u as ce, a as Q } from "./RTNCFSKZ-BywELldk.js";
10
+ import { Badge as Oe } from "./Badge.js";
11
+ import { f as Ve } from "./forwardRefWithAs-8eP3ZN15.js";
12
+ import { Icon as ze } from "./Icon.js";
13
+ import { u as De, d as Me } from "./T22PY7TE-gLuJpoOm.js";
14
+ import { P as $e, b as Fe } from "./Y67KZUMI-BwLWwpNF.js";
15
+ import { c as We, a as je, u as Be } from "./B7UTNDHN-BghjolIs.js";
16
+ var K = ee(
17
+ [Y],
18
+ [X]
19
+ ), He = K.useScopedContext, ie = K.useProviderContext, le = K.ScopedContextProvider, Ke = "button", Ae = W(function(s) {
20
+ var t = s, {
21
21
  store: e,
22
- getItem: s
23
- } = t, n = H(t, [
22
+ getItem: n
23
+ } = t, a = B(t, [
24
24
  "store",
25
25
  "getItem"
26
- ]), m;
27
- const i = Ue();
28
- e = e || i, K(
26
+ ]), b;
27
+ const c = He();
28
+ e = e || c, H(
29
29
  e,
30
30
  process.env.NODE_ENV !== "production" && "Tab must be wrapped in a TabList component."
31
31
  );
32
- const d = se(), a = n.id || d, h = he(n), c = ce(
33
- (f) => {
34
- const N = g(v({}, f), { dimmed: h });
35
- return s ? s(N) : N;
32
+ const u = te(), r = a.id || u, _ = ge(a), i = ne(
33
+ (m) => {
34
+ const E = S(f({}, m), { dimmed: _ });
35
+ return n ? n(E) : E;
36
36
  },
37
- [h, s]
38
- ), b = n.onClick, x = V((f) => {
39
- b == null || b(f), !f.defaultPrevented && (e == null || e.setSelectedId(a));
40
- }), u = e.panels.useState(
41
- (f) => {
42
- var N;
43
- return (N = f.items.find((l) => l.tabId === a)) == null ? void 0 : N.id;
37
+ [_, n]
38
+ ), v = a.onClick, I = $((m) => {
39
+ v == null || v(m), !m.defaultPrevented && (e == null || e.setSelectedId(r));
40
+ }), d = e.panels.useState(
41
+ (m) => {
42
+ var E;
43
+ return (E = m.items.find((l) => l.tabId === r)) == null ? void 0 : E.id;
44
44
  }
45
- ), p = d ? n.shouldRegisterItem : !1, I = e.useState((f) => !!a && f.activeId === a), S = e.useState((f) => !!a && f.selectedId === a), P = e.useState((f) => !!e.item(f.activeId)), C = I || S && !P, w = S || ((m = n.accessibleWhenDisabled) != null ? m : !0);
46
- if (z(
45
+ ), p = u ? a.shouldRegisterItem : !1, g = e.useState((m) => !!r && m.activeId === r), x = e.useState((m) => !!r && m.selectedId === r), h = e.useState((m) => !!e.item(m.activeId)), P = g || x && !h, w = x || ((b = a.accessibleWhenDisabled) != null ? b : !0);
46
+ if (D(
47
47
  e.combobox || e.composite,
48
48
  "virtualFocus"
49
- ) && (n = g(v({}, n), {
49
+ ) && (a = S(f({}, a), {
50
50
  tabIndex: -1
51
- })), n = g(v({
52
- id: a,
51
+ })), a = S(f({
52
+ id: r,
53
53
  role: "tab",
54
- "aria-selected": S,
55
- "aria-controls": u || void 0
56
- }, n), {
57
- onClick: x
54
+ "aria-selected": x,
55
+ "aria-controls": d || void 0
56
+ }, a), {
57
+ onClick: I
58
58
  }), e.composite) {
59
- const f = {
60
- id: a,
59
+ const m = {
60
+ id: r,
61
61
  accessibleWhenDisabled: w,
62
62
  store: e.composite,
63
- shouldRegisterItem: C && p,
64
- rowId: n.rowId,
65
- render: n.render
63
+ shouldRegisterItem: P && p,
64
+ rowId: a.rowId,
65
+ render: a.render
66
66
  };
67
- n = g(v({}, n), {
68
- render: /* @__PURE__ */ _(
69
- q,
70
- g(v({}, f), {
71
- render: e.combobox && e.composite !== e.combobox ? /* @__PURE__ */ _(q, g(v({}, f), { store: e.combobox })) : f.render
67
+ a = S(f({}, a), {
68
+ render: /* @__PURE__ */ T(
69
+ A,
70
+ S(f({}, m), {
71
+ render: e.combobox && e.composite !== e.combobox ? /* @__PURE__ */ T(A, S(f({}, m), { store: e.combobox })) : m.render
72
72
  })
73
73
  )
74
74
  });
75
75
  }
76
- return n = Se(g(v({
76
+ return a = fe(S(f({
77
77
  store: e
78
- }, n), {
78
+ }, a), {
79
79
  accessibleWhenDisabled: w,
80
- getItem: c,
80
+ getItem: i,
81
81
  shouldRegisterItem: p
82
- })), n;
83
- }), Ge = ge(
84
- F(function(r) {
85
- const t = qe(r);
86
- return j(Ze, t);
82
+ })), a;
83
+ }), Ue = Ie(
84
+ F(function(s) {
85
+ const t = Ae(s);
86
+ return j(Ke, t);
87
87
  })
88
- ), Je = "div", Qe = W(
89
- function(r) {
90
- var t = r, { store: e } = t, s = H(t, ["store"]);
91
- const n = de();
92
- e = e || n, K(
88
+ ), Ze = "div", qe = W(
89
+ function(s) {
90
+ var t = s, { store: e } = t, n = B(t, ["store"]);
91
+ const a = ie();
92
+ e = e || a, H(
93
93
  e,
94
94
  process.env.NODE_ENV !== "production" && "TabList must receive a `store` prop or be wrapped in a TabProvider component."
95
95
  );
96
- const m = e.useState(
97
- (i) => i.orientation === "both" ? void 0 : i.orientation
96
+ const b = e.useState(
97
+ (c) => c.orientation === "both" ? void 0 : c.orientation
98
98
  );
99
- return s = ne(
100
- s,
101
- (i) => /* @__PURE__ */ _(ue, { value: e, children: i }),
99
+ return n = oe(
100
+ n,
101
+ (c) => /* @__PURE__ */ T(le, { value: e, children: c }),
102
102
  [e]
103
- ), e.composite && (s = v({
103
+ ), e.composite && (n = f({
104
104
  focusable: !1
105
- }, s)), s = v({
105
+ }, n)), n = f({
106
106
  role: "tablist",
107
- "aria-orientation": m
108
- }, s), s = Le(v({ store: e }, s)), s;
107
+ "aria-orientation": b
108
+ }, n), n = Te(f({ store: e }, n)), n;
109
109
  }
110
- ), Xe = F(function(r) {
111
- const t = Qe(r);
112
- return j(Je, t);
113
- }), Ye = "div", et = W(
114
- function(r) {
115
- var t = r, {
110
+ ), Ge = F(function(s) {
111
+ const t = qe(s);
112
+ return j(Ze, t);
113
+ }), Je = "div", Qe = W(
114
+ function(s) {
115
+ var t = s, {
116
116
  store: e,
117
- unmountOnHide: s,
118
- tabId: n,
119
- getItem: m,
120
- scrollRestoration: i,
121
- scrollElement: d
122
- } = t, a = H(t, [
117
+ unmountOnHide: n,
118
+ tabId: a,
119
+ getItem: b,
120
+ scrollRestoration: c,
121
+ scrollElement: u
122
+ } = t, r = B(t, [
123
123
  "store",
124
124
  "unmountOnHide",
125
125
  "tabId",
@@ -127,109 +127,109 @@ var Z = oe(
127
127
  "scrollRestoration",
128
128
  "scrollElement"
129
129
  ]);
130
- const h = de();
131
- e = e || h, K(
130
+ const _ = ie();
131
+ e = e || _, H(
132
132
  e,
133
133
  process.env.NODE_ENV !== "production" && "TabPanel must receive a `store` prop or be wrapped in a TabProvider component."
134
134
  );
135
- const c = D(null), b = se(a.id), x = z(
135
+ const i = q(null), v = te(r.id), I = D(
136
136
  e.panels,
137
137
  () => {
138
138
  var l;
139
- return n || ((l = e == null ? void 0 : e.panels.item(b)) == null ? void 0 : l.tabId);
139
+ return a || ((l = e == null ? void 0 : e.panels.item(v)) == null ? void 0 : l.tabId);
140
140
  }
141
- ), u = z(
141
+ ), d = D(
142
142
  e,
143
- (l) => !!x && l.selectedId === x
144
- ), p = Ve({ open: u }), I = z(p, "mounted"), S = D(
143
+ (l) => !!I && l.selectedId === I
144
+ ), p = De({ open: d }), g = D(p, "mounted"), x = q(
145
145
  /* @__PURE__ */ new Map()
146
- ), P = V(() => {
147
- const l = c.current;
148
- return l ? d ? typeof d == "function" ? d(l) : "current" in d ? d.current : d : l : null;
146
+ ), h = $(() => {
147
+ const l = i.current;
148
+ return l ? u ? typeof u == "function" ? u(l) : "current" in u ? u.current : u : l : null;
149
149
  });
150
- Y(() => {
151
- var l, E;
152
- if (!i || !I) return;
153
- const T = P();
154
- if (!T) return;
155
- if (i === "reset") {
156
- T.scroll(0, 0);
150
+ G(() => {
151
+ var l, k;
152
+ if (!c || !g) return;
153
+ const C = h();
154
+ if (!C) return;
155
+ if (c === "reset") {
156
+ C.scroll(0, 0);
157
157
  return;
158
158
  }
159
- if (!x) return;
160
- const R = S.current.get(x);
161
- T.scroll((l = R == null ? void 0 : R.x) != null ? l : 0, (E = R == null ? void 0 : R.y) != null ? E : 0);
159
+ if (!I) return;
160
+ const N = x.current.get(I);
161
+ C.scroll((l = N == null ? void 0 : N.x) != null ? l : 0, (k = N == null ? void 0 : N.y) != null ? k : 0);
162
162
  const L = () => {
163
- S.current.set(x, {
164
- x: T.scrollLeft,
165
- y: T.scrollTop
163
+ x.current.set(I, {
164
+ x: C.scrollLeft,
165
+ y: C.scrollTop
166
166
  });
167
167
  };
168
- return T.addEventListener("scroll", L), () => {
169
- T.removeEventListener("scroll", L);
168
+ return C.addEventListener("scroll", L), () => {
169
+ C.removeEventListener("scroll", L);
170
170
  };
171
- }, [i, I, x, P, e]);
172
- const [C, w] = U(!1);
173
- Y(() => {
174
- const l = c.current;
171
+ }, [c, g, I, h, e]);
172
+ const [P, w] = ke(!1);
173
+ G(() => {
174
+ const l = i.current;
175
175
  if (!l) return;
176
- const E = Ce(l);
177
- w(!!E.length);
176
+ const k = xe(l);
177
+ w(!!k.length);
178
178
  }, []);
179
- const $ = ce(
179
+ const R = ne(
180
180
  (l) => {
181
- const E = g(v({}, l), { id: b || l.id, tabId: n });
182
- return m ? m(E) : E;
181
+ const k = S(f({}, l), { id: v || l.id, tabId: a });
182
+ return b ? b(k) : k;
183
183
  },
184
- [b, n, m]
185
- ), f = a.onKeyDown, N = V((l) => {
186
- if (f == null || f(l), l.defaultPrevented || !(e != null && e.composite)) return;
187
- const T = {
184
+ [v, a, b]
185
+ ), m = r.onKeyDown, E = $((l) => {
186
+ if (m == null || m(l), l.defaultPrevented || !(e != null && e.composite)) return;
187
+ const C = {
188
188
  ArrowLeft: e.previous,
189
189
  ArrowRight: e.next,
190
190
  Home: e.first,
191
191
  End: e.last
192
192
  }[l.key];
193
- if (!T) return;
194
- const { selectedId: R } = e.getState(), L = T({ activeId: R });
193
+ if (!C) return;
194
+ const { selectedId: N } = e.getState(), L = C({ activeId: N });
195
195
  L && (l.preventDefault(), e.move(L));
196
196
  });
197
- return a = ne(
198
- a,
199
- (l) => /* @__PURE__ */ _(ue, { value: e, children: l }),
197
+ return r = oe(
198
+ r,
199
+ (l) => /* @__PURE__ */ T(le, { value: e, children: l }),
200
200
  [e]
201
- ), a = g(v({
202
- id: b,
201
+ ), r = S(f({
202
+ id: v,
203
203
  role: "tabpanel",
204
- "aria-labelledby": x || void 0
205
- }, a), {
206
- children: s && !I ? null : a.children,
207
- ref: Te(c, a.ref),
208
- onKeyDown: N
209
- }), a = _e(v({
204
+ "aria-labelledby": I || void 0
205
+ }, r), {
206
+ children: n && !g ? null : r.children,
207
+ ref: Se(i, r.ref),
208
+ onKeyDown: E
209
+ }), r = Pe(f({
210
210
  // If the tab panel is rendered as part of another composite widget such
211
211
  // as combobox, it should not be focusable.
212
- focusable: !e.composite && !C
213
- }, a)), a = De(v({ store: p }, a)), a = xe(g(v({ store: e.panels }, a), { getItem: $ })), a;
212
+ focusable: !e.composite && !P
213
+ }, r)), r = Me(f({ store: p }, r)), r = ve(S(f({ store: e.panels }, r), { getItem: R })), r;
214
214
  }
215
- ), tt = F(function(r) {
216
- const t = et(r);
217
- return j(Ye, t);
218
- }), ot = oe(
219
- [We, te],
220
- [Fe, ee]
221
- ), st = ot.useContext;
222
- ie(!1);
223
- ie(null);
224
- function nt(o = {}) {
225
- var r = o, {
215
+ ), Xe = F(function(s) {
216
+ const t = Qe(s);
217
+ return j(Je, t);
218
+ }), Ye = ee(
219
+ [Fe, Y],
220
+ [$e, X]
221
+ ), et = Ye.useContext;
222
+ re(!1);
223
+ re(null);
224
+ function tt(o = {}) {
225
+ var s = o, {
226
226
  composite: t,
227
227
  combobox: e
228
- } = r, s = Pe(r, [
228
+ } = s, n = Ce(s, [
229
229
  "composite",
230
230
  "combobox"
231
231
  ]);
232
- const n = [
232
+ const a = [
233
233
  "items",
234
234
  "renderedItems",
235
235
  "moves",
@@ -240,224 +240,225 @@ function nt(o = {}) {
240
240
  "focusLoop",
241
241
  "focusShift",
242
242
  "focusWrap"
243
- ], m = Ee(
244
- s.store,
245
- Q(t, n),
246
- Q(e, n)
247
- ), i = m == null ? void 0 : m.getState(), d = je(A(O({}, s), {
248
- store: m,
243
+ ], b = Ne(
244
+ n.store,
245
+ J(t, a),
246
+ J(e, a)
247
+ ), c = b == null ? void 0 : b.getState(), u = We(M(V({}, n), {
248
+ store: b,
249
249
  // We need to explicitly set the default value of `includesBaseElement` to
250
250
  // `false` since we don't want the composite store to default it to `true`
251
251
  // when the activeId state is null, which could be the case when rendering
252
252
  // combobox with tab.
253
- includesBaseElement: k(
254
- s.includesBaseElement,
255
- i == null ? void 0 : i.includesBaseElement,
253
+ includesBaseElement: O(
254
+ n.includesBaseElement,
255
+ c == null ? void 0 : c.includesBaseElement,
256
256
  !1
257
257
  ),
258
- orientation: k(
259
- s.orientation,
260
- i == null ? void 0 : i.orientation,
258
+ orientation: O(
259
+ n.orientation,
260
+ c == null ? void 0 : c.orientation,
261
261
  "horizontal"
262
262
  ),
263
- focusLoop: k(s.focusLoop, i == null ? void 0 : i.focusLoop, !0)
264
- })), a = He(), h = A(O({}, d.getState()), {
265
- selectedId: k(
266
- s.selectedId,
267
- i == null ? void 0 : i.selectedId,
268
- s.defaultSelectedId
263
+ focusLoop: O(n.focusLoop, c == null ? void 0 : c.focusLoop, !0)
264
+ })), r = je(), _ = M(V({}, u.getState()), {
265
+ selectedId: O(
266
+ n.selectedId,
267
+ c == null ? void 0 : c.selectedId,
268
+ n.defaultSelectedId
269
269
  ),
270
- selectOnMove: k(
271
- s.selectOnMove,
272
- i == null ? void 0 : i.selectOnMove,
270
+ selectOnMove: O(
271
+ n.selectOnMove,
272
+ c == null ? void 0 : c.selectOnMove,
273
273
  !0
274
274
  )
275
- }), c = ye(h, d, m);
276
- B(
277
- c,
278
- () => y(c, ["moves"], () => {
279
- const { activeId: u, selectOnMove: p } = c.getState();
280
- if (!p || !u) return;
281
- const I = d.item(u);
282
- I && (I.dimmed || I.disabled || c.setState("selectedId", I.id));
275
+ }), i = Re(_, u, b);
276
+ z(
277
+ i,
278
+ () => y(i, ["moves"], () => {
279
+ const { activeId: d, selectOnMove: p } = i.getState();
280
+ if (!p || !d) return;
281
+ const g = u.item(d);
282
+ g && (g.dimmed || g.disabled || i.setState("selectedId", g.id));
283
283
  })
284
284
  );
285
- let b = !0;
286
- B(
287
- c,
288
- () => Ne(c, ["selectedId"], (u, p) => {
289
- if (!b) {
290
- b = !0;
285
+ let v = !0;
286
+ z(
287
+ i,
288
+ () => Le(i, ["selectedId"], (d, p) => {
289
+ if (!v) {
290
+ v = !0;
291
291
  return;
292
292
  }
293
- t && u.selectedId === p.selectedId || c.setState("activeId", u.selectedId);
293
+ t && d.selectedId === p.selectedId || i.setState("activeId", d.selectedId);
294
294
  })
295
- ), B(
296
- c,
297
- () => y(c, ["selectedId", "renderedItems"], (u) => {
298
- if (u.selectedId !== void 0) return;
299
- const { activeId: p, renderedItems: I } = c.getState(), S = d.item(p);
300
- if (S && !S.disabled && !S.dimmed)
301
- c.setState("selectedId", S.id);
295
+ ), z(
296
+ i,
297
+ () => y(i, ["selectedId", "renderedItems"], (d) => {
298
+ if (d.selectedId !== void 0) return;
299
+ const { activeId: p, renderedItems: g } = i.getState(), x = u.item(p);
300
+ if (x && !x.disabled && !x.dimmed)
301
+ i.setState("selectedId", x.id);
302
302
  else {
303
- const P = I.find(
304
- (C) => !C.disabled && !C.dimmed
303
+ const h = g.find(
304
+ (P) => !P.disabled && !P.dimmed
305
305
  );
306
- c.setState("selectedId", P == null ? void 0 : P.id);
306
+ i.setState("selectedId", h == null ? void 0 : h.id);
307
307
  }
308
308
  })
309
- ), B(
310
- c,
311
- () => y(c, ["renderedItems"], (u) => {
312
- const p = u.renderedItems;
309
+ ), z(
310
+ i,
311
+ () => y(i, ["renderedItems"], (d) => {
312
+ const p = d.renderedItems;
313
313
  if (p.length)
314
- return y(a, ["renderedItems"], (I) => {
315
- const S = I.renderedItems;
316
- S.some((C) => !C.tabId) && S.forEach((C, w) => {
317
- if (C.tabId) return;
318
- const $ = p[w];
319
- $ && a.renderItem(A(O({}, C), { tabId: $.id }));
314
+ return y(r, ["renderedItems"], (g) => {
315
+ const x = g.renderedItems;
316
+ x.some((P) => !P.tabId) && x.forEach((P, w) => {
317
+ if (P.tabId) return;
318
+ const R = p[w];
319
+ R && r.renderItem(M(V({}, P), { tabId: R.id }));
320
320
  });
321
321
  });
322
322
  })
323
323
  );
324
- let x = null;
325
- return B(c, () => {
326
- const u = () => {
327
- x = c.getState().selectedId;
324
+ let I = null;
325
+ return z(i, () => {
326
+ const d = () => {
327
+ I = i.getState().selectedId;
328
328
  }, p = () => {
329
- b = !1, c.setState("selectedId", x);
329
+ v = !1, i.setState("selectedId", I);
330
330
  };
331
331
  if (t && "setSelectElement" in t)
332
- return G(
333
- y(t, ["value"], u),
332
+ return U(
333
+ y(t, ["value"], d),
334
334
  y(t, ["mounted"], p)
335
335
  );
336
336
  if (e)
337
- return G(
338
- y(e, ["selectedValue"], u),
337
+ return U(
338
+ y(e, ["selectedValue"], d),
339
339
  y(e, ["mounted"], p)
340
340
  );
341
- }), A(O(O({}, d), c), {
342
- panels: a,
343
- setSelectedId: (u) => c.setState("selectedId", u),
344
- select: (u) => {
345
- c.setState("selectedId", u), d.move(u);
341
+ }), M(V(V({}, u), i), {
342
+ panels: r,
343
+ setSelectedId: (d) => i.setState("selectedId", d),
344
+ select: (d) => {
345
+ i.setState("selectedId", d), u.move(d);
346
346
  }
347
347
  });
348
348
  }
349
- function rt(o, r, t) {
350
- J(r, [t.composite, t.combobox]), o = Ke(o, r, t), X(o, t, "selectedId", "setSelectedId"), X(o, t, "selectOnMove");
351
- const [e, s] = re(() => o.panels, {});
352
- return J(s, [o, s]), Object.assign(
353
- we(() => g(v({}, o), { panels: e }), [o, e]),
349
+ function ot(o, s, t) {
350
+ Z(s, [t.composite, t.combobox]), o = Be(o, s, t), Q(o, t, "selectedId", "setSelectedId"), Q(o, t, "selectOnMove");
351
+ const [e, n] = ce(() => o.panels, {});
352
+ return Z(n, [o, n]), Object.assign(
353
+ ye(() => S(f({}, o), { panels: e }), [o, e]),
354
354
  { composite: t.composite, combobox: t.combobox }
355
355
  );
356
356
  }
357
- function kt(o = {}) {
358
- const r = ke(), t = st() || r;
359
- o = g(v({}, o), {
357
+ function St(o = {}) {
358
+ const s = _e(), t = et() || s;
359
+ o = S(f({}, o), {
360
360
  composite: o.composite !== void 0 ? o.composite : t,
361
- combobox: o.combobox !== void 0 ? o.combobox : r
361
+ combobox: o.combobox !== void 0 ? o.combobox : s
362
362
  });
363
- const [e, s] = re(nt, o);
364
- return rt(e, s, o);
365
- }
366
- const me = (o) => {
367
- if (!o || typeof window > "u") return 1;
368
- const r = Number(window.getComputedStyle(o).scale);
369
- return isNaN(r) ? me(o.parentElement) : r;
370
- };
371
- function at(o, r) {
372
- const [t, e] = U(null), s = ae.Children.map(r, (n) => n.props.id === o ? Re(n, {
373
- ...n.props,
374
- ref: Oe(e, Be(n))
375
- }) : n);
376
- return { activeTab: t, tabs: s };
363
+ const [e, n] = ce(tt, o);
364
+ return ot(e, n, o);
377
365
  }
378
- const ct = "_root_156xk_2", it = {
379
- root: ct
366
+ const nt = "_root_nt8z5_2", de = {
367
+ root: nt,
368
+ "size-lg": "_size-lg_nt8z5_55",
369
+ "size-md": "_size-md_nt8z5_62",
370
+ "tab-list": "_tab-list_nt8z5_72"
380
371
  };
381
- function lt({ activeTab: o, listRef: r, orientation: t }) {
382
- const [e, s] = U({}), { height: n, width: m } = Ae();
383
- return Me(() => {
384
- const i = r.current;
385
- if (!i || !o) return;
386
- const d = i.getBoundingClientRect(), a = o.getBoundingClientRect(), h = me(i);
387
- if (t === "vertical") {
388
- const c = a.top - d.top, b = a.height;
389
- s({
390
- offset: c,
391
- orientation: t,
392
- size: b
393
- });
394
- } else {
395
- const c = (a.left - d.left + i.scrollLeft) / h, b = a.width / h;
396
- s({
397
- offset: isNaN(c) ? 0 : c,
398
- orientation: t,
399
- size: isNaN(b) ? 0 : b
400
- });
372
+ function rt({
373
+ icon: o,
374
+ iconColor: s,
375
+ isActive: t
376
+ }) {
377
+ if (!o) return null;
378
+ if (typeof o != "string") return o;
379
+ const e = (() => {
380
+ switch (s) {
381
+ case "blue":
382
+ return t ? "text-background-accent-blue-strong" : "text-background-accent-blue-primary";
383
+ case "green":
384
+ return t ? "text-background-accent-green-strong" : "text-background-accent-green-primary";
385
+ case "orange":
386
+ return t ? "text-background-accent-orange-strong" : "text-background-accent-orange-primary";
387
+ case "pink":
388
+ return t ? "text-background-accent-pink-strong" : "text-background-accent-pink-primary";
389
+ case "teal":
390
+ return t ? "text-background-accent-teal-strong" : "text-background-accent-teal-primary";
391
+ case "violet":
392
+ return t ? "text-background-accent-violet-strong" : "text-background-accent-violet-primary";
393
+ case "warm":
394
+ return t ? "text-background-accent-warm-strong" : "text-background-accent-warm-primary";
395
+ default:
396
+ return "";
401
397
  }
402
- }, [r, o, m, n, t]), e;
398
+ })();
399
+ return /* @__PURE__ */ T(ze, { className: e, name: o });
403
400
  }
404
- const dt = M(it), fe = ({ activeTab: o, listRef: r, orientation: t }) => {
405
- const e = lt({ activeTab: o, listRef: r, orientation: t }), s = {
406
- "--activeBarOffset": `${e.offset}px`,
407
- "--activeBarSize": `${e.size}px`
408
- };
409
- return /* @__PURE__ */ _("span", { className: dt("root", `orientation-${t}`), style: s });
410
- };
411
- fe.displayName = "Tab.ActiveBar";
412
- const ut = "_root_3pg7f_2", mt = {
413
- root: ut,
414
- "size-md": "_size-md_3pg7f_20",
415
- "size-sm": "_size-sm_3pg7f_23"
416
- }, ft = M(mt), be = le(
417
- ({ children: o, className: r, size: t = "md", store: e, ...s }, n) => {
418
- const m = D(), [, i] = ze(n, m), { orientation: d, selectedId: a } = z(e), { activeTab: h, tabs: c } = at(a, o), b = ae.Children.count(o) > 1;
419
- return /* @__PURE__ */ Ie(
420
- Xe,
401
+ const st = ae(de), ue = Ve(
402
+ ({
403
+ as: o,
404
+ badge: s,
405
+ children: t,
406
+ className: e,
407
+ icon: n,
408
+ iconColor: a = "violet",
409
+ id: b,
410
+ size: c = "lg",
411
+ store: u,
412
+ ...r
413
+ }, _) => {
414
+ const { selectedId: i } = D(u), v = i === b, I = rt({
415
+ icon: n,
416
+ iconColor: a,
417
+ isActive: v
418
+ }), d = v ? "neutral" : "warm";
419
+ return /* @__PURE__ */ pe(
420
+ Ue,
421
421
  {
422
- className: ft("root", `size-${t}`, r),
423
- ref: i,
424
- store: e,
425
- ...s,
422
+ className: st("root", `size-${c}`, e),
423
+ id: b,
424
+ ref: _,
425
+ render: o ? /* @__PURE__ */ T(o, {}) : void 0,
426
+ store: u,
427
+ ...r,
426
428
  children: [
427
- c,
428
- b ? /* @__PURE__ */ _(fe, { activeTab: h, listRef: m, orientation: d }) : null
429
+ I,
430
+ t,
431
+ s ? /* @__PURE__ */ T(Oe, { size: c, variant: d, children: s }) : null
429
432
  ]
430
433
  }
431
434
  );
432
435
  }
433
436
  );
434
- be.displayName = "Tab.List";
435
- const bt = "_root_etkg6_2", pt = {
436
- root: bt
437
- }, vt = M(pt), pe = le(
438
- ({ children: o, store: r, tabId: t, ...e }, s) => /* @__PURE__ */ _(tt, { className: vt("root"), ref: s, store: r, tabId: t, ...e, children: o })
439
- );
440
- pe.displayName = "Tab.Panel";
441
- const It = "_root_86cgt_2", St = {
442
- root: It
443
- }, xt = M(St), ve = $e(
444
- ({ as: o, children: r, className: t, id: e, store: s, ...n }, m) => /* @__PURE__ */ _(
445
- Ge,
446
- {
447
- className: xt("root", t),
448
- id: e,
449
- ref: m,
450
- render: o ? /* @__PURE__ */ _(o, {}) : void 0,
451
- store: s,
452
- ...n,
453
- children: r
454
- }
455
- )
437
+ ue.displayName = "Tabs.Tab";
438
+ const me = se(({ children: o, ...s }, t) => /* @__PURE__ */ T(Xe, { ref: t, ...s, children: o }));
439
+ me.displayName = "Tabs.Panel";
440
+ const at = ae(de), be = se(
441
+ ({ children: o, className: s, size: t = "lg", store: e, ...n }, a) => {
442
+ const b = he.Children.map(
443
+ o,
444
+ (c) => we(c) ? Ee(c, { size: t }) : c
445
+ );
446
+ return /* @__PURE__ */ T(
447
+ Ge,
448
+ {
449
+ className: at("tab-list", `size-${t}`, s),
450
+ ref: a,
451
+ store: e,
452
+ ...n,
453
+ children: b
454
+ }
455
+ );
456
+ }
456
457
  );
457
- ve.displayName = "Tab";
458
- const Ot = Object.assign(ve, { List: be, Panel: pe });
458
+ be.displayName = "Tabs";
459
+ const Pt = Object.assign(be, { Panel: me, Tab: ue });
459
460
  export {
460
- Ot as Tab,
461
- ve as TabComponent,
462
- kt as useTab
461
+ Pt as Tabs,
462
+ be as TabsComponent,
463
+ St as useTab
463
464
  };