@spear-ai/spectral 1.8.8 → 1.8.9

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.
@@ -21,7 +21,7 @@ export interface RadioGroupItemProps extends ComponentProps<typeof RadioGroupPri
21
21
  value: string;
22
22
  }
23
23
  declare const RadioGroup: {
24
- ({ className, disabled, itemClassName, onValueChange, orientation, ref, selected, variant, ...props }: RadioGroupProps & {
24
+ (allProps: RadioGroupProps & {
25
25
  ref?: Ref<ComponentRef<typeof RadioGroupPrimitive.Root>>;
26
26
  }): ReactElement;
27
27
  displayName: string;
@@ -2,65 +2,65 @@
2
2
  import "./styles/main.css";
3
3
  import { jsx as a, jsxs as Y } from "react/jsx-runtime";
4
4
  import { Label as D } from "./Label.js";
5
- import * as c from "react";
5
+ import * as d from "react";
6
6
  import { useState as ge, createContext as he, memo as Ie, useMemo as ye, useContext as we, useId as Ce } from "react";
7
7
  import { P as F, c as y, a as L, u as _, e as $ } from "./index-9OmOYyjJ.js";
8
8
  import { c as Ee, u as j } from "./index-Cgdmxb3F.js";
9
9
  import { u as Se } from "./index-obMGvcdD.js";
10
10
  import { u as Fe } from "./index-0ioNhtNM.js";
11
- import { u as Ae } from "./index-WBfSMXvE.js";
12
- import { u as Ne } from "./index-BZPx6jYI.js";
11
+ import { u as Ne } from "./index-WBfSMXvE.js";
12
+ import { u as Ae } from "./index-BZPx6jYI.js";
13
13
  import { P as _e } from "./index-CtqlhLRO.js";
14
14
  import { cn as E } from "./utils/twUtils.js";
15
15
  import { h as Pe, c as Te, p as xe, w as Ge, m as V } from "./proxy-CO_-Vget.js";
16
16
  import { A as ke } from "./index-Cl8VeY0o.js";
17
- var k = "rovingFocusGroup.onEntryFocus", De = { bubbles: !1, cancelable: !0 }, N = "RovingFocusGroup", [M, H, Me] = Ee(N), [Oe, z] = L(
18
- N,
17
+ var k = "rovingFocusGroup.onEntryFocus", De = { bubbles: !1, cancelable: !0 }, A = "RovingFocusGroup", [M, H, Me] = Ee(A), [Oe, z] = L(
18
+ A,
19
19
  [Me]
20
- ), [Le, Be] = Oe(N), W = c.forwardRef(
21
- (e, t) => /* @__PURE__ */ a(M.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ a(M.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ a(Ke, { ...e, ref: t }) }) })
20
+ ), [Le, Be] = Oe(A), W = d.forwardRef(
21
+ (e, r) => /* @__PURE__ */ a(M.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ a(M.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ a(Ke, { ...e, ref: r }) }) })
22
22
  );
23
- W.displayName = N;
24
- var Ke = c.forwardRef((e, t) => {
23
+ W.displayName = A;
24
+ var Ke = d.forwardRef((e, r) => {
25
25
  const {
26
26
  __scopeRovingFocusGroup: o,
27
- orientation: r,
27
+ orientation: t,
28
28
  loop: n = !1,
29
29
  dir: s,
30
30
  currentTabStopId: i,
31
- defaultCurrentTabStopId: m,
32
- onCurrentTabStopIdChange: v,
33
- onEntryFocus: f,
34
- preventScrollOnEntryFocus: u = !1,
35
- ...R
36
- } = e, b = c.useRef(null), l = _(t, b), p = j(s), [h, d] = $({
31
+ defaultCurrentTabStopId: R,
32
+ onCurrentTabStopIdChange: b,
33
+ onEntryFocus: l,
34
+ preventScrollOnEntryFocus: c = !1,
35
+ ...p
36
+ } = e, m = d.useRef(null), f = _(r, m), v = j(s), [h, u] = $({
37
37
  prop: i,
38
- defaultProp: m ?? null,
39
- onChange: v,
40
- caller: N
41
- }), [w, T] = c.useState(!1), I = Fe(f), C = H(o), x = c.useRef(!1), [pe, K] = c.useState(0);
42
- return c.useEffect(() => {
43
- const g = b.current;
38
+ defaultProp: R ?? null,
39
+ onChange: b,
40
+ caller: A
41
+ }), [w, T] = d.useState(!1), I = Fe(l), C = H(o), x = d.useRef(!1), [pe, K] = d.useState(0);
42
+ return d.useEffect(() => {
43
+ const g = m.current;
44
44
  if (g)
45
45
  return g.addEventListener(k, I), () => g.removeEventListener(k, I);
46
46
  }, [I]), /* @__PURE__ */ a(
47
47
  Le,
48
48
  {
49
49
  scope: o,
50
- orientation: r,
51
- dir: p,
50
+ orientation: t,
51
+ dir: v,
52
52
  loop: n,
53
53
  currentTabStopId: h,
54
- onItemFocus: c.useCallback(
55
- (g) => d(g),
56
- [d]
54
+ onItemFocus: d.useCallback(
55
+ (g) => u(g),
56
+ [u]
57
57
  ),
58
- onItemShiftTab: c.useCallback(() => T(!0), []),
59
- onFocusableItemAdd: c.useCallback(
58
+ onItemShiftTab: d.useCallback(() => T(!0), []),
59
+ onFocusableItemAdd: d.useCallback(
60
60
  () => K((g) => g + 1),
61
61
  []
62
62
  ),
63
- onFocusableItemRemove: c.useCallback(
63
+ onFocusableItemRemove: d.useCallback(
64
64
  () => K((g) => g - 1),
65
65
  []
66
66
  ),
@@ -68,9 +68,9 @@ var Ke = c.forwardRef((e, t) => {
68
68
  F.div,
69
69
  {
70
70
  tabIndex: w || pe === 0 ? -1 : 0,
71
- "data-orientation": r,
72
- ...R,
73
- ref: l,
71
+ "data-orientation": t,
72
+ ...p,
73
+ ref: f,
74
74
  style: { outline: "none", ...e.style },
75
75
  onMouseDown: y(e.onMouseDown, () => {
76
76
  x.current = !0;
@@ -83,7 +83,7 @@ var Ke = c.forwardRef((e, t) => {
83
83
  const G = C().filter((S) => S.focusable), ve = G.find((S) => S.active), be = G.find((S) => S.id === h), Re = [ve, be, ...G].filter(
84
84
  Boolean
85
85
  ).map((S) => S.ref.current);
86
- Q(Re, u);
86
+ Q(Re, c);
87
87
  }
88
88
  }
89
89
  x.current = !1;
@@ -93,58 +93,58 @@ var Ke = c.forwardRef((e, t) => {
93
93
  )
94
94
  }
95
95
  );
96
- }), X = "RovingFocusGroupItem", J = c.forwardRef(
97
- (e, t) => {
96
+ }), X = "RovingFocusGroupItem", J = d.forwardRef(
97
+ (e, r) => {
98
98
  const {
99
99
  __scopeRovingFocusGroup: o,
100
- focusable: r = !0,
100
+ focusable: t = !0,
101
101
  active: n = !1,
102
102
  tabStopId: s,
103
103
  children: i,
104
- ...m
105
- } = e, v = Se(), f = s || v, u = Be(X, o), R = u.currentTabStopId === f, b = H(o), { onFocusableItemAdd: l, onFocusableItemRemove: p, currentTabStopId: h } = u;
106
- return c.useEffect(() => {
107
- if (r)
108
- return l(), () => p();
109
- }, [r, l, p]), /* @__PURE__ */ a(
104
+ ...R
105
+ } = e, b = Se(), l = s || b, c = Be(X, o), p = c.currentTabStopId === l, m = H(o), { onFocusableItemAdd: f, onFocusableItemRemove: v, currentTabStopId: h } = c;
106
+ return d.useEffect(() => {
107
+ if (t)
108
+ return f(), () => v();
109
+ }, [t, f, v]), /* @__PURE__ */ a(
110
110
  M.ItemSlot,
111
111
  {
112
112
  scope: o,
113
- id: f,
114
- focusable: r,
113
+ id: l,
114
+ focusable: t,
115
115
  active: n,
116
116
  children: /* @__PURE__ */ a(
117
117
  F.span,
118
118
  {
119
- tabIndex: R ? 0 : -1,
120
- "data-orientation": u.orientation,
121
- ...m,
122
- ref: t,
123
- onMouseDown: y(e.onMouseDown, (d) => {
124
- r ? u.onItemFocus(f) : d.preventDefault();
119
+ tabIndex: p ? 0 : -1,
120
+ "data-orientation": c.orientation,
121
+ ...R,
122
+ ref: r,
123
+ onMouseDown: y(e.onMouseDown, (u) => {
124
+ t ? c.onItemFocus(l) : u.preventDefault();
125
125
  }),
126
- onFocus: y(e.onFocus, () => u.onItemFocus(f)),
127
- onKeyDown: y(e.onKeyDown, (d) => {
128
- if (d.key === "Tab" && d.shiftKey) {
129
- u.onItemShiftTab();
126
+ onFocus: y(e.onFocus, () => c.onItemFocus(l)),
127
+ onKeyDown: y(e.onKeyDown, (u) => {
128
+ if (u.key === "Tab" && u.shiftKey) {
129
+ c.onItemShiftTab();
130
130
  return;
131
131
  }
132
- if (d.target !== d.currentTarget) return;
133
- const w = qe(d, u.orientation, u.dir);
132
+ if (u.target !== u.currentTarget) return;
133
+ const w = qe(u, c.orientation, c.dir);
134
134
  if (w !== void 0) {
135
- if (d.metaKey || d.ctrlKey || d.altKey || d.shiftKey) return;
136
- d.preventDefault();
137
- let I = b().filter((C) => C.focusable).map((C) => C.ref.current);
135
+ if (u.metaKey || u.ctrlKey || u.altKey || u.shiftKey) return;
136
+ u.preventDefault();
137
+ let I = m().filter((C) => C.focusable).map((C) => C.ref.current);
138
138
  if (w === "last") I.reverse();
139
139
  else if (w === "prev" || w === "next") {
140
140
  w === "prev" && I.reverse();
141
- const C = I.indexOf(d.currentTarget);
142
- I = u.loop ? Ye(I, C + 1) : I.slice(C + 1);
141
+ const C = I.indexOf(u.currentTarget);
142
+ I = c.loop ? Ye(I, C + 1) : I.slice(C + 1);
143
143
  }
144
144
  setTimeout(() => Q(I));
145
145
  }
146
146
  }),
147
- children: typeof i == "function" ? i({ isCurrentTabStop: R, hasTabStop: h != null }) : i
147
+ children: typeof i == "function" ? i({ isCurrentTabStop: p, hasTabStop: h != null }) : i
148
148
  }
149
149
  )
150
150
  }
@@ -162,35 +162,35 @@ var Ue = {
162
162
  PageDown: "last",
163
163
  End: "last"
164
164
  };
165
- function Ve(e, t) {
166
- return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
165
+ function Ve(e, r) {
166
+ return r !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
167
167
  }
168
- function qe(e, t, o) {
169
- const r = Ve(e.key, o);
170
- if (!(t === "vertical" && ["ArrowLeft", "ArrowRight"].includes(r)) && !(t === "horizontal" && ["ArrowUp", "ArrowDown"].includes(r)))
171
- return Ue[r];
168
+ function qe(e, r, o) {
169
+ const t = Ve(e.key, o);
170
+ if (!(r === "vertical" && ["ArrowLeft", "ArrowRight"].includes(t)) && !(r === "horizontal" && ["ArrowUp", "ArrowDown"].includes(t)))
171
+ return Ue[t];
172
172
  }
173
- function Q(e, t = !1) {
173
+ function Q(e, r = !1) {
174
174
  const o = document.activeElement;
175
- for (const r of e)
176
- if (r === o || (r.focus({ preventScroll: t }), document.activeElement !== o)) return;
175
+ for (const t of e)
176
+ if (t === o || (t.focus({ preventScroll: r }), document.activeElement !== o)) return;
177
177
  }
178
- function Ye(e, t) {
179
- return e.map((o, r) => e[(t + r) % e.length]);
178
+ function Ye(e, r) {
179
+ return e.map((o, t) => e[(r + t) % e.length]);
180
180
  }
181
- var $e = W, je = J, B = "Radio", [He, Z] = L(B), [ze, We] = He(B), ee = c.forwardRef(
182
- (e, t) => {
181
+ var $e = W, je = J, B = "Radio", [He, Z] = L(B), [ze, We] = He(B), ee = d.forwardRef(
182
+ (e, r) => {
183
183
  const {
184
184
  __scopeRadio: o,
185
- name: r,
185
+ name: t,
186
186
  checked: n = !1,
187
187
  required: s,
188
188
  disabled: i,
189
- value: m = "on",
190
- onCheck: v,
191
- form: f,
192
- ...u
193
- } = e, [R, b] = c.useState(null), l = _(t, (d) => b(d)), p = c.useRef(!1), h = R ? f || !!R.closest("form") : !0;
189
+ value: R = "on",
190
+ onCheck: b,
191
+ form: l,
192
+ ...c
193
+ } = e, [p, m] = d.useState(null), f = _(r, (u) => m(u)), v = d.useRef(!1), h = p ? l || !!p.closest("form") : !0;
194
194
  return /* @__PURE__ */ Y(ze, { scope: o, checked: n, disabled: i, children: [
195
195
  /* @__PURE__ */ a(
196
196
  F.button,
@@ -201,25 +201,25 @@ var $e = W, je = J, B = "Radio", [He, Z] = L(B), [ze, We] = He(B), ee = c.forwar
201
201
  "data-state": ae(n),
202
202
  "data-disabled": i ? "" : void 0,
203
203
  disabled: i,
204
- value: m,
205
- ...u,
206
- ref: l,
207
- onClick: y(e.onClick, (d) => {
208
- n || v?.(), h && (p.current = d.isPropagationStopped(), p.current || d.stopPropagation());
204
+ value: R,
205
+ ...c,
206
+ ref: f,
207
+ onClick: y(e.onClick, (u) => {
208
+ n || b?.(), h && (v.current = u.isPropagationStopped(), v.current || u.stopPropagation());
209
209
  })
210
210
  }
211
211
  ),
212
212
  h && /* @__PURE__ */ a(
213
213
  re,
214
214
  {
215
- control: R,
216
- bubbles: !p.current,
217
- name: r,
218
- value: m,
215
+ control: p,
216
+ bubbles: !v.current,
217
+ name: t,
218
+ value: R,
219
219
  checked: n,
220
220
  required: s,
221
221
  disabled: i,
222
- form: f,
222
+ form: l,
223
223
  style: { transform: "translateX(-100%)" }
224
224
  }
225
225
  )
@@ -227,42 +227,42 @@ var $e = W, je = J, B = "Radio", [He, Z] = L(B), [ze, We] = He(B), ee = c.forwar
227
227
  }
228
228
  );
229
229
  ee.displayName = B;
230
- var oe = "RadioIndicator", te = c.forwardRef(
231
- (e, t) => {
232
- const { __scopeRadio: o, forceMount: r, ...n } = e, s = We(oe, o);
233
- return /* @__PURE__ */ a(_e, { present: r || s.checked, children: /* @__PURE__ */ a(
230
+ var oe = "RadioIndicator", te = d.forwardRef(
231
+ (e, r) => {
232
+ const { __scopeRadio: o, forceMount: t, ...n } = e, s = We(oe, o);
233
+ return /* @__PURE__ */ a(_e, { present: t || s.checked, children: /* @__PURE__ */ a(
234
234
  F.span,
235
235
  {
236
236
  "data-state": ae(s.checked),
237
237
  "data-disabled": s.disabled ? "" : void 0,
238
238
  ...n,
239
- ref: t
239
+ ref: r
240
240
  }
241
241
  ) });
242
242
  }
243
243
  );
244
244
  te.displayName = oe;
245
- var Xe = "RadioBubbleInput", re = c.forwardRef(
245
+ var Xe = "RadioBubbleInput", re = d.forwardRef(
246
246
  ({
247
247
  __scopeRadio: e,
248
- control: t,
248
+ control: r,
249
249
  checked: o,
250
- bubbles: r = !0,
250
+ bubbles: t = !0,
251
251
  ...n
252
252
  }, s) => {
253
- const i = c.useRef(null), m = _(i, s), v = Ne(o), f = Ae(t);
254
- return c.useEffect(() => {
255
- const u = i.current;
256
- if (!u) return;
257
- const R = window.HTMLInputElement.prototype, l = Object.getOwnPropertyDescriptor(
258
- R,
253
+ const i = d.useRef(null), R = _(i, s), b = Ae(o), l = Ne(r);
254
+ return d.useEffect(() => {
255
+ const c = i.current;
256
+ if (!c) return;
257
+ const p = window.HTMLInputElement.prototype, f = Object.getOwnPropertyDescriptor(
258
+ p,
259
259
  "checked"
260
260
  ).set;
261
- if (v !== o && l) {
262
- const p = new Event("click", { bubbles: r });
263
- l.call(u, o), u.dispatchEvent(p);
261
+ if (b !== o && f) {
262
+ const v = new Event("click", { bubbles: t });
263
+ f.call(c, o), c.dispatchEvent(v);
264
264
  }
265
- }, [v, o, r]), /* @__PURE__ */ a(
265
+ }, [b, o, t]), /* @__PURE__ */ a(
266
266
  F.input,
267
267
  {
268
268
  type: "radio",
@@ -270,10 +270,10 @@ var Xe = "RadioBubbleInput", re = c.forwardRef(
270
270
  defaultChecked: o,
271
271
  ...n,
272
272
  tabIndex: -1,
273
- ref: m,
273
+ ref: R,
274
274
  style: {
275
275
  ...n.style,
276
- ...f,
276
+ ...l,
277
277
  position: "absolute",
278
278
  pointerEvents: "none",
279
279
  opacity: 0,
@@ -290,53 +290,53 @@ function ae(e) {
290
290
  var Je = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], P = "RadioGroup", [Qe] = L(P, [
291
291
  z,
292
292
  Z
293
- ]), ne = z(), se = Z(), [Ze, eo] = Qe(P), ie = c.forwardRef(
294
- (e, t) => {
293
+ ]), ne = z(), se = Z(), [Ze, eo] = Qe(P), ie = d.forwardRef(
294
+ (e, r) => {
295
295
  const {
296
296
  __scopeRadioGroup: o,
297
- name: r,
297
+ name: t,
298
298
  defaultValue: n,
299
299
  value: s,
300
300
  required: i = !1,
301
- disabled: m = !1,
302
- orientation: v,
303
- dir: f,
304
- loop: u = !0,
305
- onValueChange: R,
306
- ...b
307
- } = e, l = ne(o), p = j(f), [h, d] = $({
301
+ disabled: R = !1,
302
+ orientation: b,
303
+ dir: l,
304
+ loop: c = !0,
305
+ onValueChange: p,
306
+ ...m
307
+ } = e, f = ne(o), v = j(l), [h, u] = $({
308
308
  prop: s,
309
309
  defaultProp: n ?? null,
310
- onChange: R,
310
+ onChange: p,
311
311
  caller: P
312
312
  });
313
313
  return /* @__PURE__ */ a(
314
314
  Ze,
315
315
  {
316
316
  scope: o,
317
- name: r,
317
+ name: t,
318
318
  required: i,
319
- disabled: m,
319
+ disabled: R,
320
320
  value: h,
321
- onValueChange: d,
321
+ onValueChange: u,
322
322
  children: /* @__PURE__ */ a(
323
323
  $e,
324
324
  {
325
325
  asChild: !0,
326
- ...l,
327
- orientation: v,
328
- dir: p,
329
- loop: u,
326
+ ...f,
327
+ orientation: b,
328
+ dir: v,
329
+ loop: c,
330
330
  children: /* @__PURE__ */ a(
331
331
  F.div,
332
332
  {
333
333
  role: "radiogroup",
334
334
  "aria-required": i,
335
- "aria-orientation": v,
336
- "data-disabled": m ? "" : void 0,
337
- dir: p,
338
- ...b,
339
- ref: t
335
+ "aria-orientation": b,
336
+ "data-disabled": R ? "" : void 0,
337
+ dir: v,
338
+ ...m,
339
+ ref: r
340
340
  }
341
341
  )
342
342
  }
@@ -346,39 +346,39 @@ var Je = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], P = "RadioGroup",
346
346
  }
347
347
  );
348
348
  ie.displayName = P;
349
- var ce = "RadioGroupItem", ue = c.forwardRef(
350
- (e, t) => {
351
- const { __scopeRadioGroup: o, disabled: r, ...n } = e, s = eo(ce, o), i = s.disabled || r, m = ne(o), v = se(o), f = c.useRef(null), u = _(t, f), R = s.value === n.value, b = c.useRef(!1);
352
- return c.useEffect(() => {
353
- const l = (h) => {
354
- Je.includes(h.key) && (b.current = !0);
355
- }, p = () => b.current = !1;
356
- return document.addEventListener("keydown", l), document.addEventListener("keyup", p), () => {
357
- document.removeEventListener("keydown", l), document.removeEventListener("keyup", p);
349
+ var ce = "RadioGroupItem", de = d.forwardRef(
350
+ (e, r) => {
351
+ const { __scopeRadioGroup: o, disabled: t, ...n } = e, s = eo(ce, o), i = s.disabled || t, R = ne(o), b = se(o), l = d.useRef(null), c = _(r, l), p = s.value === n.value, m = d.useRef(!1);
352
+ return d.useEffect(() => {
353
+ const f = (h) => {
354
+ Je.includes(h.key) && (m.current = !0);
355
+ }, v = () => m.current = !1;
356
+ return document.addEventListener("keydown", f), document.addEventListener("keyup", v), () => {
357
+ document.removeEventListener("keydown", f), document.removeEventListener("keyup", v);
358
358
  };
359
359
  }, []), /* @__PURE__ */ a(
360
360
  je,
361
361
  {
362
362
  asChild: !0,
363
- ...m,
363
+ ...R,
364
364
  focusable: !i,
365
- active: R,
365
+ active: p,
366
366
  children: /* @__PURE__ */ a(
367
367
  ee,
368
368
  {
369
369
  disabled: i,
370
370
  required: s.required,
371
- checked: R,
372
- ...v,
371
+ checked: p,
372
+ ...b,
373
373
  ...n,
374
374
  name: s.name,
375
- ref: u,
375
+ ref: c,
376
376
  onCheck: () => s.onValueChange(n.value),
377
- onKeyDown: y((l) => {
378
- l.key === "Enter" && l.preventDefault();
377
+ onKeyDown: y((f) => {
378
+ f.key === "Enter" && f.preventDefault();
379
379
  }),
380
380
  onFocus: y(n.onFocus, () => {
381
- b.current && f.current?.click();
381
+ m.current && l.current?.click();
382
382
  })
383
383
  }
384
384
  )
@@ -386,15 +386,15 @@ var ce = "RadioGroupItem", ue = c.forwardRef(
386
386
  );
387
387
  }
388
388
  );
389
- ue.displayName = ce;
390
- var oo = "RadioGroupIndicator", de = c.forwardRef(
391
- (e, t) => {
392
- const { __scopeRadioGroup: o, ...r } = e, n = se(o);
393
- return /* @__PURE__ */ a(te, { ...n, ...r, ref: t });
389
+ de.displayName = ce;
390
+ var oo = "RadioGroupIndicator", ue = d.forwardRef(
391
+ (e, r) => {
392
+ const { __scopeRadioGroup: o, ...t } = e, n = se(o);
393
+ return /* @__PURE__ */ a(te, { ...n, ...t, ref: r });
394
394
  }
395
395
  );
396
- de.displayName = oo;
397
- var to = ie, O = ue, q = de;
396
+ ue.displayName = oo;
397
+ var to = ie, O = de, q = ue;
398
398
  function ro() {
399
399
  !Pe.current && Te();
400
400
  const [e] = ge(xe.current);
@@ -405,38 +405,28 @@ const le = he({
405
405
  groupDisabled: !1,
406
406
  orientation: "vertical",
407
407
  variant: "default"
408
- }), A = "pointer-events-none opacity-60", ao = ({
409
- className: e,
410
- disabled: t,
411
- itemClassName: o,
412
- onValueChange: r,
413
- orientation: n = "vertical",
414
- ref: s,
415
- selected: i,
416
- variant: m = "default",
417
- ...v
418
- }) => {
419
- const f = ye(
408
+ }), N = "pointer-events-none opacity-60", ao = (e) => {
409
+ const r = "selected" in e, { className: o, disabled: t, itemClassName: n, onValueChange: s, orientation: i = "vertical", ref: R, selected: b, variant: l = "default", ...c } = e, p = r ? b ?? "" : b, m = ye(
420
410
  () => ({
421
411
  disabledValues: Array.isArray(t) ? t : [],
422
412
  groupDisabled: typeof t == "boolean" ? t : !1,
423
- itemClassName: o,
424
- orientation: n,
425
- selected: i,
426
- variant: m
413
+ itemClassName: n,
414
+ orientation: i,
415
+ selected: p,
416
+ variant: l
427
417
  }),
428
- [n, m, t, o, i]
418
+ [i, l, t, n, p]
429
419
  );
430
- return /* @__PURE__ */ a(le.Provider, { value: f, children: /* @__PURE__ */ a(
420
+ return /* @__PURE__ */ a(le.Provider, { value: m, children: /* @__PURE__ */ a(
431
421
  to,
432
422
  {
433
- className: E("text-text-primary flex w-full", n === "vertical" ? "flex-col gap-4" : "flex-row gap-5", m === "unstyled" && "w-fit gap-2.5", e),
423
+ className: E("text-text-primary flex w-full", i === "vertical" ? "flex-col gap-4" : "flex-row gap-5", l === "unstyled" && "w-fit gap-2.5", o),
434
424
  "data-testid": "spectral-radio-group",
435
- disabled: f.groupDisabled,
436
- onValueChange: r,
437
- ref: s,
438
- value: i,
439
- ...v
425
+ disabled: m.groupDisabled,
426
+ onValueChange: s,
427
+ ref: R,
428
+ value: p,
429
+ ...c
440
430
  }
441
431
  ) });
442
432
  };
@@ -444,9 +434,9 @@ ao.displayName = "RadioGroup";
444
434
  const no = { type: "spring", stiffness: 200, damping: 16 }, fe = Ie(
445
435
  ({
446
436
  className: e,
447
- id: t,
437
+ id: r,
448
438
  isDisabled: o,
449
- ref: r,
439
+ ref: t,
450
440
  transition: n = no,
451
441
  value: s,
452
442
  ...i
@@ -457,29 +447,29 @@ const no = { type: "spring", stiffness: 200, damping: 16 }, fe = Ie(
457
447
  "border-border-subtle bg-radio-bg relative aspect-square h-4.5 w-4.5 cursor-pointer rounded-full border-2 ring-black transition-colors",
458
448
  "hover:border-radio-border--hover focus-visible:outline-accent focus-visible:outline-1 focus-visible:outline-offset-2",
459
449
  "data-[state=checked]:border-radio-border--selected data-[state=checked]:bg-radio-bg",
460
- o && A,
450
+ o && N,
461
451
  e
462
452
  ),
463
453
  "data-testid": "spectral-radio-group-item",
464
454
  disabled: o,
465
- id: t,
466
- ref: r,
455
+ id: r,
456
+ ref: t,
467
457
  value: s,
468
458
  ...i,
469
- children: /* @__PURE__ */ a(q, { className: E("after:bg-radio-bg--selected after:absolute after:inset-0 after:m-auto after:h-2.5 after:w-2.5 after:rounded-full after:content-['']", o && A) })
459
+ children: /* @__PURE__ */ a(q, { className: E("after:bg-radio-bg--selected after:absolute after:inset-0 after:m-auto after:h-2.5 after:w-2.5 after:rounded-full after:content-['']", o && N) })
470
460
  }
471
- ) : /* @__PURE__ */ a(O, { value: s, id: t, disabled: o, asChild: !0, ...i, children: /* @__PURE__ */ a(
461
+ ) : /* @__PURE__ */ a(O, { value: s, id: r, disabled: o, asChild: !0, ...i, children: /* @__PURE__ */ a(
472
462
  V.button,
473
463
  {
474
464
  className: E(
475
465
  "border-border-subtle bg-radio-bg relative aspect-square h-4.5 w-4.5 cursor-pointer rounded-full border-2 ring-black transition-colors",
476
466
  "hover:border-radio-border--hover focus-visible:outline-accent focus-visible:outline-1 focus-visible:outline-offset-2",
477
467
  "data-[state=checked]:border-radio-border--selected data-[state=checked]:bg-radio-bg",
478
- o && A,
468
+ o && N,
479
469
  e
480
470
  ),
481
471
  "data-testid": "spectral-radio-group-item",
482
- ref: r,
472
+ ref: t,
483
473
  whileHover: { scale: 1.05 },
484
474
  whileTap: { scale: 0.95 },
485
475
  children: /* @__PURE__ */ a(q, { className: "relative flex items-center justify-center", children: /* @__PURE__ */ a(ke, { children: /* @__PURE__ */ a(V.div, { animate: { opacity: 1, scale: 1 }, className: "bg-radio-bg--selected absolute h-2.5 w-2.5 rounded-full", exit: { opacity: 0, scale: 0 }, initial: { opacity: 0, scale: 0 }, transition: n }, "radio-indicator") }) })
@@ -489,24 +479,24 @@ const no = { type: "spring", stiffness: 200, damping: 16 }, fe = Ie(
489
479
  fe.displayName = "RadioButton";
490
480
  const so = ({
491
481
  children: e,
492
- className: t,
482
+ className: r,
493
483
  disabled: o,
494
- ref: r,
484
+ ref: t,
495
485
  value: n,
496
486
  ...s
497
487
  }) => {
498
- const { disabledValues: i, groupDisabled: m, itemClassName: v, variant: f, orientation: u } = we(le), R = Ce(), b = n.toString(), l = s.id?.toString() ?? `${b}-${R}`, p = m || i.includes(b) || !!o;
499
- return f === "unstyled" ? /* @__PURE__ */ a(O, { asChild: !0, "data-testid": "spectral-radio-group-item", disabled: p, id: l, ref: r, value: b, ...s, children: /* @__PURE__ */ a(D, { className: E("data-[state=checked]:border-radio-border--selected flex h-fit w-fit rounded border-2 border-transparent", p && A, v, t), "data-testid": "spectral-radio-group-item-label", htmlFor: l, children: e }) }) : /* @__PURE__ */ Y("div", { className: E("flex items-center", p && A, v, t, u), children: [
500
- /* @__PURE__ */ a(fe, { ref: r, value: b, id: l, isDisabled: p, ...s }),
501
- e && /* @__PURE__ */ a(D, { className: E("text-md cursor-pointer font-normal", u === "vertical" ? "ml-2" : "ml-1"), htmlFor: l, children: e })
488
+ const { disabledValues: i, groupDisabled: R, itemClassName: b, variant: l, orientation: c } = we(le), p = Ce(), m = n.toString(), f = s.id?.toString() ?? `${m}-${p}`, v = R || i.includes(m) || !!o;
489
+ return l === "unstyled" ? /* @__PURE__ */ a(O, { asChild: !0, "data-testid": "spectral-radio-group-item", disabled: v, id: f, ref: t, value: m, ...s, children: /* @__PURE__ */ a(D, { className: E("data-[state=checked]:border-radio-border--selected flex h-fit w-fit rounded border-2 border-transparent", v && N, b, r), "data-testid": "spectral-radio-group-item-label", htmlFor: f, children: e }) }) : /* @__PURE__ */ Y("div", { className: E("flex items-center", v && N, b, r, c), children: [
490
+ /* @__PURE__ */ a(fe, { ref: t, value: m, id: f, isDisabled: v, ...s }),
491
+ e && /* @__PURE__ */ a(D, { className: E("text-md cursor-pointer font-normal", c === "vertical" ? "ml-2" : "ml-1"), htmlFor: f, children: e })
502
492
  ] });
503
493
  };
504
494
  so.displayName = "RadioGroup.Item";
505
495
  const io = ({
506
496
  ref: e,
507
- className: t,
497
+ className: r,
508
498
  ...o
509
- }) => /* @__PURE__ */ a(D, { ref: e, "data-testid": "spectral-radio-group-label", className: E("text-md block font-medium", t), ...o });
499
+ }) => /* @__PURE__ */ a(D, { ref: e, "data-testid": "spectral-radio-group-label", className: E("text-md block font-medium", r), ...o });
510
500
  io.displayName = "RadioGroup.Label";
511
501
  export {
512
502
  ao as RadioGroup,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spear-ai/spectral",
3
- "version": "1.8.8",
3
+ "version": "1.8.9",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "repository": {