prometeo-design-system 9.3.0 → 9.4.2

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.
@@ -0,0 +1,6 @@
1
+ export * from './exports/FormField'
2
+ export {}
3
+ import PrometeoDesignSystem from './exports/FormField'
4
+ export default PrometeoDesignSystem
5
+ export * from './exports/FormField'
6
+ export {}
@@ -0,0 +1,62 @@
1
+ import { j as e } from "./jsx-runtime-CqQglQKg.js";
2
+ import { c as p } from "./cn-B6yFEsav.js";
3
+ import { memo as b, useId as j } from "react";
4
+ import I from "./HelperComponent.es.js";
5
+ import { f as g } from "./fieldVariants-Ci6QYhCb.js";
6
+ import { F as N } from "./FormFieldContext-H8_osEEP.js";
7
+ import { u as E } from "./FormFieldContext-H8_osEEP.js";
8
+ const y = b(function(f) {
9
+ const {
10
+ label: l,
11
+ supportingText: o,
12
+ showSupportingText: u,
13
+ state: r = "default",
14
+ disabled: t = !1,
15
+ required: d = !1,
16
+ htmlFor: m,
17
+ children: x,
18
+ className: h
19
+ } = f, s = j(), a = l ? `${s}-label` : void 0, i = `${s}-helper`, F = m ?? `${s}-control`, c = typeof o == "function" ? o() : o, n = u ?? c != null, v = {
20
+ labelId: a,
21
+ helperId: n ? i : void 0,
22
+ labelledBy: a,
23
+ describedBy: n ? i : void 0,
24
+ controlId: F,
25
+ state: r,
26
+ disabled: t,
27
+ required: d
28
+ };
29
+ return /* @__PURE__ */ e.jsx(N.Provider, { value: v, children: /* @__PURE__ */ e.jsxs("div", { className: p("relative flex w-full flex-col gap-1", h), children: [
30
+ l ? /* @__PURE__ */ e.jsx(
31
+ "label",
32
+ {
33
+ id: a,
34
+ htmlFor: m,
35
+ className: p(
36
+ g({ state: r, disabled: t }),
37
+ "relative z-10",
38
+ d && "after:ml-0.5 after:content-['*']"
39
+ ),
40
+ children: l
41
+ }
42
+ ) : null,
43
+ x,
44
+ n ? /* @__PURE__ */ e.jsx(
45
+ I,
46
+ {
47
+ id: i,
48
+ variant: r,
49
+ disabled: t,
50
+ className: "min-h-4",
51
+ children: c
52
+ }
53
+ ) : null
54
+ ] }) });
55
+ });
56
+ y.displayName = "FormField";
57
+ export {
58
+ y as FormField,
59
+ N as FormFieldContext,
60
+ y as default,
61
+ E as useFormField
62
+ };
@@ -0,0 +1,11 @@
1
+ import { createContext as t, useContext as e } from "react";
2
+ const o = t(
3
+ null
4
+ );
5
+ function r() {
6
+ return e(o);
7
+ }
8
+ export {
9
+ o as F,
10
+ r as u
11
+ };
@@ -1,12 +1,12 @@
1
1
  import { j as s } from "./jsx-runtime-CqQglQKg.js";
2
2
  import { c as r } from "./cn-B6yFEsav.js";
3
3
  import { c as i } from "./index-BOQuZ0gG.js";
4
- import { memo as d } from "react";
5
- import { Warning as c } from "./Icon-Warning.es.js";
6
- import { CheckCircle as o } from "./Icon-CheckCircle.es.js";
7
- import { Error as u } from "./Icon-Error.es.js";
8
- import { Info as f } from "./Icon-Info.es.js";
9
- const m = i("truncate", {
4
+ import { memo as c } from "react";
5
+ import { Warning as o } from "./Icon-Warning.es.js";
6
+ import { CheckCircle as u } from "./Icon-CheckCircle.es.js";
7
+ import { Error as f } from "./Icon-Error.es.js";
8
+ import { Info as m } from "./Icon-Info.es.js";
9
+ const b = i("truncate", {
10
10
  variants: {
11
11
  variant: {
12
12
  default: "text-neutral-tertiary-default",
@@ -23,7 +23,7 @@ const m = i("truncate", {
23
23
  variant: "default",
24
24
  disabled: !1
25
25
  }
26
- }), b = i("min-h-4 shrink-0", {
26
+ }), v = i("min-h-4 shrink-0", {
27
27
  variants: {
28
28
  variant: {
29
29
  default: "",
@@ -50,23 +50,23 @@ const m = i("truncate", {
50
50
  variant: "default",
51
51
  disabled: !1
52
52
  }
53
- }), v = (a, t) => {
53
+ }), x = (a, t) => {
54
54
  const e = {
55
- default: f,
56
- error: u,
57
- success: o,
58
- warning: c
55
+ default: m,
56
+ error: f,
57
+ success: u,
58
+ warning: o
59
59
  }[a];
60
- return /* @__PURE__ */ s.jsx(e, { size: 16, className: r(b({ variant: a, disabled: t })) });
61
- }, x = "*:text-disabled-default *:icon-disabled-default", l = (a) => {
62
- const { variant: t, className: n, disabled: e } = a;
63
- return /* @__PURE__ */ s.jsxs("div", { ref: a.ref, className: r("flex gap-0.5 px-3 items-center prometeo-fonts-body-small", e && x, n), children: [
64
- a.children && v(t, e ?? !1),
65
- typeof a.children == "string" ? /* @__PURE__ */ s.jsx("p", { title: a.children, className: r(" prometeo-fonts-body-small", m({ variant: t, disabled: e })), children: a.children }) : a.children
60
+ return /* @__PURE__ */ s.jsx(e, { size: 16, className: r(v({ variant: a, disabled: t })) });
61
+ }, p = "*:text-disabled-default *:icon-disabled-default", l = (a) => {
62
+ const { variant: t, className: n, disabled: e, id: d } = a;
63
+ return /* @__PURE__ */ s.jsxs("div", { id: d, ref: a.ref, className: r("flex gap-0.5 px-3 items-center prometeo-fonts-body-small", e && p, n), children: [
64
+ a.children && x(t, e ?? !1),
65
+ typeof a.children == "string" ? /* @__PURE__ */ s.jsx("p", { title: a.children, className: r(" prometeo-fonts-body-small", b({ variant: t, disabled: e })), children: a.children }) : a.children
66
66
  ] });
67
67
  };
68
68
  l.displayName = "HelperText";
69
- const V = d(l);
69
+ const H = c(l);
70
70
  export {
71
- V as default
71
+ H as default
72
72
  };
@@ -1,15 +1,16 @@
1
- import { j as d } from "./jsx-runtime-CqQglQKg.js";
1
+ import { j as u } from "./jsx-runtime-CqQglQKg.js";
2
2
  import { c as m } from "./cn-B6yFEsav.js";
3
- import { c as X } from "./index-BOQuZ0gG.js";
4
- import G, { useSyncExternalStore as tt, useId as nt, useRef as f, useState as S, useLayoutEffect as V, useEffect as z } from "react";
5
- import { useDragScroll as ot } from "./useDragScroll.es.js";
6
- import { PlainTooltip as rt } from "./PlainTooltip.es.js";
7
- const Te = "(prefers-reduced-motion: reduce)", lt = () => !1, at = () => typeof window > "u" ? !1 : window.matchMedia(Te).matches, st = (a) => {
3
+ import { c as H } from "./index-BOQuZ0gG.js";
4
+ import X, { useSyncExternalStore as it, useId as st, useRef as f, useState as O, useLayoutEffect as V, useEffect as S } from "react";
5
+ import { useDragScroll as ct } from "./useDragScroll.es.js";
6
+ import { u as dt } from "./FormFieldContext-H8_osEEP.js";
7
+ import { PlainTooltip as ut } from "./PlainTooltip.es.js";
8
+ const Ie = "(prefers-reduced-motion: reduce)", ft = () => !1, mt = () => typeof window > "u" ? !1 : window.matchMedia(Ie).matches, pt = (a) => {
8
9
  if (typeof window > "u") return () => {
9
10
  };
10
- const r = window.matchMedia(Te);
11
- return r.addEventListener("change", a), () => r.removeEventListener("change", a);
12
- }, it = () => tt(st, at, lt), ct = (a, r, y) => y ? { commit: null, pending: r } : a && a.left === r.left && a.right === r.right ? { commit: null, pending: null } : { commit: r, pending: null }, ut = {
11
+ const o = window.matchMedia(Ie);
12
+ return o.addEventListener("change", a), () => o.removeEventListener("change", a);
13
+ }, bt = () => it(pt, mt, ft), gt = (a, o, v) => v ? { commit: null, pending: o } : a && a.left === o.left && a.right === o.right ? { commit: null, pending: null } : { commit: o, pending: null }, ht = {
13
14
  default: "brand",
14
15
  danger: "error"
15
16
  }, n = {
@@ -68,29 +69,29 @@ const Te = "(prefers-reduced-motion: reduce)", lt = () => !1, at = () => typeof
68
69
  option: "px-3 py-1 min-h-7 pyrion-fonts-body-small"
69
70
  },
70
71
  medium: {
71
- container: "py-[3px] px-[3px]",
72
+ container: "py-[3px] px-[3px] radius-large",
72
73
  pill: "py-2 min-h-[34px] radius-medium",
73
74
  option: "px-3 py-2 min-h-[34px] pyrion-fonts-body-medium"
74
75
  },
75
76
  large: {
76
- container: "py-[3px] px-[3px]",
77
+ container: "py-[3px] px-[3px] radius-large",
77
78
  pill: "py-2.5 radius-medium",
78
79
  option: "px-4 py-2 min-h-10 pyrion-fonts-body-medium"
79
80
  }
80
- }, D = 20, xe = 4, we = 8, dt = { small: 280, medium: 320, large: 360 }, ft = 300, N = "cubic-bezier(0.2,0,0,1)", mt = "cubic-bezier(0.34,1.4,0.64,1)", pt = "cubic-bezier(0.3,0,0.2,1)", ve = {
81
+ }, D = 20, we = 4, ve = 8, xt = { small: 280, medium: 320, large: 360 }, yt = 300, N = "cubic-bezier(0.2,0,0,1)", wt = "cubic-bezier(0.34,1.4,0.64,1)", vt = "cubic-bezier(0.3,0,0.2,1)", Te = {
81
82
  natural: "auto-cols-[minmax(0,max-content)]",
82
83
  equal: "auto-cols-[minmax(0,1fr)]"
83
- }, bt = "[transition:var(--sb-motion)] motion-reduce:transition-none", gt = "[transition:var(--sb-motion-text)] motion-reduce:transition-none", ht = "[transition:var(--sb-motion-weight)] motion-reduce:transition-none", xt = "[transition:var(--sb-motion-slot)] motion-reduce:transition-none", ye = (a, r, y) => Math.min(y, Math.max(r, a)), wt = (a, r) => typeof a == "function" ? G.createElement(a, {
84
+ }, Tt = "[transition:var(--sb-motion)] motion-reduce:transition-none", Rt = "[transition:var(--sb-motion-text)] motion-reduce:transition-none", It = "[transition:var(--sb-motion-weight)] motion-reduce:transition-none", Nt = "[transition:var(--sb-motion-slot)] motion-reduce:transition-none", Re = (a, o, v) => Math.min(v, Math.max(o, a)), Et = (a, o) => typeof a == "function" ? X.createElement(a, {
84
85
  size: D,
85
- className: m(r, "shrink-0!")
86
- }) : G.cloneElement(
86
+ className: m(o, "shrink-0!")
87
+ }) : X.cloneElement(
87
88
  a,
88
89
  {
89
90
  size: D,
90
- className: m(r, "shrink-0!")
91
+ className: m(o, "shrink-0!")
91
92
  }
92
- ), vt = X(
93
- "relative border inline-flex bg-neutral-default-default border-neutral-default-default radius-large shadow-[var(--dropshadow-inset-100)]",
93
+ ), Ct = H(
94
+ "relative border inline-flex bg-neutral-default-default border-neutral-default-default shadow-[var(--dropshadow-inset-100)]",
94
95
  {
95
96
  variants: {
96
97
  size: {
@@ -120,7 +121,7 @@ const Te = "(prefers-reduced-motion: reduce)", lt = () => !1, at = () => typeof
120
121
  color: "brand"
121
122
  }
122
123
  }
123
- ), yt = X(
124
+ ), Mt = H(
124
125
  "absolute top-0 bottom-0 z-10",
125
126
  {
126
127
  variants: {
@@ -151,7 +152,7 @@ const Te = "(prefers-reduced-motion: reduce)", lt = () => !1, at = () => typeof
151
152
  color: "brand"
152
153
  }
153
154
  }
154
- ), Tt = X("relative flex items-center justify-center", {
155
+ ), Bt = H("relative flex items-center justify-center", {
155
156
  variants: {
156
157
  size: {
157
158
  small: h.small.option,
@@ -179,217 +180,222 @@ const Te = "(prefers-reduced-motion: reduce)", lt = () => !1, at = () => typeof
179
180
  size: "medium",
180
181
  color: "brand"
181
182
  }
182
- }), Ot = (a) => {
183
+ }), kt = (a) => {
183
184
  const {
184
- size: r = "medium",
185
- color: y = "default",
185
+ size: o = "medium",
186
+ color: v = "default",
186
187
  options: E,
187
- value: Re,
188
- name: H,
189
- ariaLabel: Ie,
190
- onChange: Ne,
191
- icon: P,
192
- allowExpand: Q,
193
- equalWidth: Ee,
188
+ value: Ne,
189
+ name: Q,
190
+ ariaLabel: Ee,
191
+ ariaLabelledBy: Ce,
192
+ ariaDescribedBy: Me,
193
+ onChange: Be,
194
+ icon: F,
195
+ allowExpand: Y,
196
+ equalWidth: Le,
194
197
  overflow: C = "truncate",
195
- collapseAt: Ce,
196
- disableAnimation: Me = !1,
197
- animationDuration: Oe,
198
- animationIntensity: Le,
199
- disabled: $ = !1,
200
- className: Se,
201
- pillClassName: ze,
202
- iconClassName: $e,
203
- optionClassName: _e,
204
- optionIconClassName: Be
205
- } = a, je = `segmented-${nt()}`, Y = f(null), Z = f(null), J = f(null), ee = f(null), _ = f([]), [U, ke] = S(null), te = f(null), T = f(!1), M = f(null), W = f(!1), [b, Ae] = S(!1), [ne, Ve] = S(null), [F, oe] = S(!1), [q, re] = S(!1), le = f(0), O = f(null), De = it(), i = Me || De, c = i ? 0 : ye(Oe ?? ft, 0, 2e3), R = i ? 0 : ye(Le ?? 1, 0, 2), ae = Ee ?? (Q === !0 ? !1 : Q === !1 ? !0 : void 0), w = ae === "fill", B = ae === !0, I = C === "scroll" && !w, L = C === "collapse", Pe = C === "truncate" || C === "scroll" && w, se = E.every((e) => !!(e.icon ?? P)), Ue = Ce ?? dt[r], K = L && se && ne !== null && ne < Ue, v = $ ? "disabled" : ut[y] ?? y, l = Math.max(E.findIndex((e) => e.value === Re), 0), We = w ? "w-full" : "w-max max-w-full", Fe = I ? "overflow-x-auto overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden" : "", qe = I && !B ? "auto-cols-max" : w || B ? ve.equal : ve.natural, Ke = i ? "none" : `color ${c}ms ${N}`, Ge = i ? "none" : `font-weight ${c}ms ${N}`, Xe = i ? "none" : `width ${c}ms ${N}, opacity ${c}ms ${N}`, ie = q ? Math.round(c * 0.4) : c, He = i ? "none" : `left ${ie}ms ${N}, right ${ie}ms ${N}, transform ${Math.round(F ? c * 0.4 : c * 0.9)}ms ${F ? pt : mt}`, Qe = le.current * 10 * R, Ye = F && R > 0 ? `translateX(${Qe}px) scaleX(${1 + 0.05 * R}) scaleY(${1 - 0.05 * R})` : void 0, ce = (e) => {
206
- te.current = e, ke(
198
+ collapseAt: Oe,
199
+ disableAnimation: Se = !1,
200
+ animationDuration: ze,
201
+ animationIntensity: $e,
202
+ disabled: z = !1,
203
+ className: _e,
204
+ pillClassName: je,
205
+ iconClassName: ke,
206
+ optionClassName: Ae,
207
+ optionIconClassName: Ve
208
+ } = a, De = `segmented-${st()}`, P = dt(), Z = Ce ?? P?.labelledBy, Fe = Me ?? P?.describedBy, Pe = P?.required || void 0, J = f(null), ee = f(null), te = f(null), ne = f(null), $ = f([]), [q, qe] = O(null), re = f(null), T = f(!1), M = f(null), U = f(!1), [b, Ue] = O(!1), [oe, We] = O(null), [W, le] = O(!1), [K, ae] = O(!1), ie = f(0), B = f(null), Ke = bt(), s = Se || Ke, c = s ? 0 : Re(ze ?? yt, 0, 2e3), R = s ? 0 : Re($e ?? 1, 0, 2), se = Le ?? (Y === !0 ? !1 : Y === !1 ? !0 : void 0), y = se === "fill", _ = se === !0, I = C === "scroll" && !y, L = C === "collapse", Ge = C === "truncate" || C === "scroll" && y, ce = E.every((e) => !!(e.icon ?? F)), Xe = Oe ?? xt[o], G = L && ce && oe !== null && oe < Xe, w = z ? "disabled" : ht[v] ?? v, l = Math.max(E.findIndex((e) => e.value === Ne), 0), He = y ? "w-full" : "w-max max-w-full", Qe = I ? "overflow-x-auto overscroll-x-contain [scrollbar-width:none] [&::-webkit-scrollbar]:hidden" : "", Ye = I && !_ ? "auto-cols-max" : y || _ ? Te.equal : Te.natural, Ze = s ? "none" : `color ${c}ms ${N}`, Je = s ? "none" : `font-weight ${c}ms ${N}`, et = s ? "none" : `width ${c}ms ${N}, opacity ${c}ms ${N}`, de = K ? Math.round(c * 0.4) : c, tt = s ? "none" : `left ${de}ms ${N}, right ${de}ms ${N}, transform ${Math.round(W ? c * 0.4 : c * 0.9)}ms ${W ? vt : wt}`, nt = ie.current * 10 * R, rt = W && R > 0 ? `translateX(${nt}px) scaleX(${1 + 0.05 * R}) scaleY(${1 - 0.05 * R})` : void 0, ue = (e) => {
209
+ re.current = e, qe(
207
210
  (t) => t && t.left === e.left && t.right === e.right ? t : e
208
211
  );
209
- }, ue = () => {
212
+ }, fe = () => {
210
213
  if (!T.current) return;
211
214
  T.current = !1;
212
215
  const e = M.current;
213
- M.current = null, e && (re(!0), ce(e));
216
+ M.current = null, e && (ae(!0), ue(e));
214
217
  };
215
218
  V(() => {
216
- const e = J.current;
219
+ const e = te.current;
217
220
  if (!L || !e) return;
218
221
  const t = () => {
219
- const s = e.getBoundingClientRect().width;
220
- Ve((p) => p === s ? p : s);
222
+ const i = e.getBoundingClientRect().width;
223
+ We((p) => p === i ? p : i);
221
224
  };
222
225
  t();
223
- const o = new ResizeObserver(t);
224
- return o.observe(e), () => o.disconnect();
226
+ const r = new ResizeObserver(t);
227
+ return r.observe(e), () => r.disconnect();
225
228
  }, [L]), V(() => {
226
- if (O.current === null) {
227
- O.current = l;
229
+ if (B.current === null) {
230
+ B.current = l;
228
231
  return;
229
232
  }
230
- O.current !== l && (le.current = l > O.current ? 1 : -1, O.current = l, M.current = null, T.current = !1, W.current = !i);
231
- }, [l, i]);
232
- const de = f(null), { bind: Ze, ref: Je } = ot({
233
+ B.current !== l && (ie.current = l > B.current ? 1 : -1, B.current = l, M.current = null, T.current = !1, U.current = !s);
234
+ }, [l, s]);
235
+ const me = f(null), { bind: ot, ref: lt } = ct({
233
236
  axis: "x",
234
237
  cursor: { idle: "default", dragging: "grabbing" },
235
238
  disabled: !I
236
- }), fe = (e, t) => e.icon ?? (t ? P : void 0) ? D + (e.label != null && !K ? xe : 0) : 0;
239
+ }), pe = (e, t) => e.icon ?? (t ? F : void 0) ? D + (e.label != null && !G ? we : 0) : 0;
237
240
  V(() => {
238
- const e = Z.current, t = _.current[l];
241
+ const e = ee.current, t = $.current[l];
239
242
  if (!e || !t) return;
240
- const o = de.current, s = !w && !B && o !== null && o !== l ? E.map(
241
- (u, x) => fe(u, x === l) - fe(u, x === o)
242
- ) : null, p = (u = !1) => {
243
+ const r = me.current, i = !y && !_ && r !== null && r !== l ? E.map(
244
+ (d, x) => pe(d, x === l) - pe(d, x === r)
245
+ ) : null, p = (d = !1) => {
243
246
  const x = e.getBoundingClientRect(), j = t.getBoundingClientRect();
244
247
  let k = {
245
248
  left: j.left - x.left,
246
249
  right: x.right - j.right
247
250
  };
248
- if (u && s) {
249
- let pe = 0, be = 0;
250
- s.forEach((ge, he) => {
251
- he < l ? pe += ge : he > l && (be += ge);
252
- }), k = { left: k.left + pe, right: k.right + be };
251
+ if (d && i) {
252
+ let ge = 0, he = 0;
253
+ i.forEach((xe, ye) => {
254
+ ye < l ? ge += xe : ye > l && (he += xe);
255
+ }), k = { left: k.left + ge, right: k.right + he };
253
256
  }
254
- const A = ct(
255
- te.current,
257
+ const A = gt(
258
+ re.current,
256
259
  k,
257
260
  T.current
258
261
  );
259
- A.pending && (M.current = A.pending), A.commit && ce(A.commit);
262
+ A.pending && (M.current = A.pending), A.commit && ue(A.commit);
260
263
  };
261
- p(!0), de.current = l;
264
+ p(!0), me.current = l;
262
265
  const g = new ResizeObserver(() => p());
263
- return g.observe(e), _.current.forEach((u) => {
264
- u && g.observe(u);
266
+ return g.observe(e), $.current.forEach((d) => {
267
+ d && g.observe(d);
265
268
  }), () => g.disconnect();
266
269
  }, [
267
270
  l,
268
271
  E.length,
269
- r,
270
- w,
271
- B,
272
+ o,
273
+ y,
274
+ _,
272
275
  C,
273
- K
276
+ G
274
277
  ]), V(() => {
275
- W.current && (W.current = !1, T.current = !0);
276
- }, [l, i]), z(() => {
277
- U && !b && Ae(!0);
278
- }, [U, b]), z(() => {
279
- if (!q) return;
278
+ U.current && (U.current = !1, T.current = !0);
279
+ }, [l, s]), S(() => {
280
+ q && !b && Ue(!0);
281
+ }, [q, b]), S(() => {
282
+ if (!K) return;
280
283
  const e = window.setTimeout(
281
- () => re(!1),
284
+ () => ae(!1),
282
285
  Math.max(80, Math.round(c * 0.4))
283
286
  );
284
287
  return () => window.clearTimeout(e);
285
- }, [q, c]), z(() => {
286
- const e = ee.current;
288
+ }, [K, c]), S(() => {
289
+ const e = ne.current;
287
290
  if (!e) return;
288
- const t = (o) => {
289
- o.propertyName !== "left" && o.propertyName !== "right" || ue();
291
+ const t = (r) => {
292
+ r.propertyName !== "left" && r.propertyName !== "right" || fe();
290
293
  };
291
294
  return e.addEventListener("transitionend", t), () => e.removeEventListener("transitionend", t);
292
- }), z(() => {
293
- if (i || !T.current) return;
295
+ }), S(() => {
296
+ if (s || !T.current) return;
294
297
  let e, t;
295
- return R > 0 && (oe(!0), e = window.setTimeout(
296
- () => oe(!1),
298
+ return R > 0 && (le(!0), e = window.setTimeout(
299
+ () => le(!1),
297
300
  Math.max(80, Math.round(c * 0.45))
298
- )), t = window.setTimeout(ue, c + 80), () => {
301
+ )), t = window.setTimeout(fe, c + 80), () => {
299
302
  e !== void 0 && window.clearTimeout(e), t !== void 0 && window.clearTimeout(t), M.current = null;
300
303
  };
301
- }, [l, i, c, R]), z(() => {
304
+ }, [l, s, c, R]), S(() => {
302
305
  if (!I) return;
303
- const e = Y.current, t = _.current[l];
306
+ const e = J.current, t = $.current[l];
304
307
  if (!e || !t) return;
305
- const o = e.getBoundingClientRect(), s = t.getBoundingClientRect(), p = b && !i ? "smooth" : "auto", g = s.right - o.right + we, u = o.left - s.left + we;
306
- g > 0 ? e.scrollBy({ left: g, behavior: p }) : u > 0 && e.scrollBy({ left: -u, behavior: p });
307
- }, [I, l, b, i]);
308
- const et = {
309
- "--sb-motion": b ? He : "none",
310
- "--sb-motion-text": b ? Ke : "none",
311
- "--sb-motion-weight": b ? Ge : "none",
312
- "--sb-motion-slot": b ? Xe : "none"
313
- }, me = /* @__PURE__ */ d.jsx(
308
+ const r = e.getBoundingClientRect(), i = t.getBoundingClientRect(), p = b && !s ? "smooth" : "auto", g = i.right - r.right + ve, d = r.left - i.left + ve;
309
+ g > 0 ? e.scrollBy({ left: g, behavior: p }) : d > 0 && e.scrollBy({ left: -d, behavior: p });
310
+ }, [I, l, b, s]);
311
+ const at = {
312
+ "--sb-motion": b ? tt : "none",
313
+ "--sb-motion-text": b ? Ze : "none",
314
+ "--sb-motion-weight": b ? Je : "none",
315
+ "--sb-motion-slot": b ? et : "none"
316
+ }, be = /* @__PURE__ */ u.jsx(
314
317
  "div",
315
318
  {
316
319
  ref: (e) => {
317
- Y.current = e, Je.current = e;
320
+ J.current = e, lt.current = e;
318
321
  },
319
322
  role: "radiogroup",
320
- "aria-label": Ie ?? H,
321
- "aria-disabled": $ || void 0,
323
+ "aria-labelledby": Z,
324
+ "aria-label": Z ? void 0 : Ee ?? Q,
325
+ "aria-describedby": Fe,
326
+ "aria-required": Pe,
327
+ "aria-disabled": z || void 0,
322
328
  className: m(
323
- vt({ size: r, color: v }),
324
- We,
325
- Fe,
326
- Se
329
+ Ct({ size: o, color: w }),
330
+ He,
331
+ Qe,
332
+ _e
327
333
  ),
328
- style: et,
329
- ...Ze,
330
- children: /* @__PURE__ */ d.jsxs(
334
+ style: at,
335
+ ...ot,
336
+ children: /* @__PURE__ */ u.jsxs(
331
337
  "div",
332
338
  {
333
- ref: Z,
339
+ ref: ee,
334
340
  className: m(
335
341
  "relative grid grid-flow-col items-stretch",
336
- qe,
337
- w && "w-full",
342
+ Ye,
343
+ y && "w-full",
338
344
  I && "w-max"
339
345
  ),
340
346
  children: [
341
- /* @__PURE__ */ d.jsx(
347
+ /* @__PURE__ */ u.jsx(
342
348
  "div",
343
349
  {
344
- ref: ee,
350
+ ref: ne,
345
351
  "aria-hidden": !0,
346
352
  className: m(
347
- yt({ size: r, color: v }),
353
+ Mt({ size: o, color: w }),
348
354
  "pointer-events-none",
349
- b && bt,
350
- ze
355
+ b && Tt,
356
+ je
351
357
  ),
352
358
  style: {
353
- ...U ?? {},
354
- transform: Ye
359
+ ...q ?? {},
360
+ transform: rt
355
361
  }
356
362
  }
357
363
  ),
358
364
  E.map((e, t) => {
359
- const o = t === l, s = e.icon ?? (o ? P : void 0), p = e.label != null && !K, g = Pe || L && !se ? "truncate" : "text-nowrap", u = o ? m(n[v].icon, $e) : m(n[v].optionIcon, Be), x = /* @__PURE__ */ d.jsxs(
365
+ const r = t === l, i = e.icon ?? (r ? F : void 0), p = e.label != null && !G, g = Ge || L && !ce ? "truncate" : "text-nowrap", d = r ? m(n[w].icon, ke) : m(n[w].optionIcon, Ve), x = /* @__PURE__ */ u.jsxs(
360
366
  "label",
361
367
  {
362
368
  ref: (j) => {
363
- _.current[t] = j;
369
+ $.current[t] = j;
364
370
  },
365
371
  title: e.tooltipText ? void 0 : e.label ?? e.ariaLabel,
366
372
  className: m(
367
- Tt({ size: r, color: v }),
373
+ Bt({ size: o, color: w }),
368
374
  "relative z-20 min-w-0 select-none",
369
- gt,
370
- o ? n[v].pillText : n[v].option,
375
+ Rt,
376
+ r ? n[w].pillText : n[w].option,
371
377
  "has-[input:focus-visible]:outline-2 has-[input:focus-visible]:-outline-offset-2 has-[input:focus-visible]:outline-[color:var(--border-brand-onneutral-default)]",
372
- _e
378
+ Ae
373
379
  ),
374
380
  children: [
375
- /* @__PURE__ */ d.jsx(
381
+ /* @__PURE__ */ u.jsx(
376
382
  "span",
377
383
  {
378
- "aria-hidden": !s,
379
- className: m("flex items-center overflow-hidden shrink-0", xt),
384
+ "aria-hidden": !i,
385
+ className: m("flex items-center overflow-hidden shrink-0", Nt),
380
386
  style: {
381
- width: s ? D + (p ? xe : 0) : 0,
382
- opacity: s ? 1 : 0
387
+ width: i ? D + (p ? we : 0) : 0,
388
+ opacity: i ? 1 : 0
383
389
  },
384
- children: s ? wt(s, u) : null
390
+ children: i ? Et(i, d) : null
385
391
  }
386
392
  ),
387
- p && /* @__PURE__ */ d.jsxs(
393
+ p && /* @__PURE__ */ u.jsxs(
388
394
  "span",
389
395
  {
390
396
  className: "grid grid-cols-[minmax(0,1fr)] min-w-0",
391
397
  children: [
392
- /* @__PURE__ */ d.jsx(
398
+ /* @__PURE__ */ u.jsx(
393
399
  "span",
394
400
  {
395
401
  "aria-hidden": !0,
@@ -400,7 +406,7 @@ const Te = "(prefers-reduced-motion: reduce)", lt = () => !1, at = () => typeof
400
406
  children: e.label
401
407
  }
402
408
  ),
403
- /* @__PURE__ */ d.jsx(
409
+ /* @__PURE__ */ u.jsx(
404
410
  "span",
405
411
  {
406
412
  className: m(
@@ -409,8 +415,8 @@ const Te = "(prefers-reduced-motion: reduce)", lt = () => !1, at = () => typeof
409
415
  // `text-center` keeps the shorter regular weight centered
410
416
  // inside the semibold reserve.
411
417
  "col-start-1 row-start-1 min-w-0 text-center",
412
- ht,
413
- o ? "font-semibold" : "font-normal",
418
+ It,
419
+ r ? "font-semibold" : "font-normal",
414
420
  g
415
421
  ),
416
422
  children: e.label
@@ -419,35 +425,35 @@ const Te = "(prefers-reduced-motion: reduce)", lt = () => !1, at = () => typeof
419
425
  ]
420
426
  }
421
427
  ),
422
- /* @__PURE__ */ d.jsx(
428
+ /* @__PURE__ */ u.jsx(
423
429
  "input",
424
430
  {
425
431
  type: "radio",
426
- name: je,
432
+ name: De,
427
433
  value: String(e.value),
428
- checked: o,
429
- disabled: $,
430
- onChange: () => Ne?.(H, e.value),
434
+ checked: r,
435
+ disabled: z,
436
+ onChange: () => Be?.(Q, e.value),
431
437
  "aria-label": e.ariaLabel ?? e.label,
432
438
  className: m(
433
439
  "absolute inset-0 z-30 m-0 h-full w-full opacity-0",
434
- $ ? "cursor-default" : "cursor-pointer"
440
+ z ? "cursor-default" : "cursor-pointer"
435
441
  )
436
442
  }
437
443
  )
438
444
  ]
439
445
  }
440
446
  );
441
- return e.tooltipText ? /* @__PURE__ */ d.jsx(rt, { title: e.tooltipText, asChild: !0, children: x }, e.value) : /* @__PURE__ */ d.jsx(G.Fragment, { children: x }, e.value);
447
+ return e.tooltipText ? /* @__PURE__ */ u.jsx(ut, { title: e.tooltipText, asChild: !0, children: x }, e.value) : /* @__PURE__ */ u.jsx(X.Fragment, { children: x }, e.value);
442
448
  })
443
449
  ]
444
450
  }
445
451
  )
446
452
  }
447
453
  );
448
- return L ? /* @__PURE__ */ d.jsx("div", { ref: J, className: "w-full min-w-0", children: me }) : me;
454
+ return L ? /* @__PURE__ */ u.jsx("div", { ref: te, className: "w-full min-w-0", children: be }) : be;
449
455
  };
450
456
  export {
451
- Ot as SegmentedButton,
452
- Ot as default
457
+ kt as SegmentedButton,
458
+ kt as default
453
459
  };