@spear-ai/spectral 1.6.17 → 1.8.0

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.
Files changed (149) hide show
  1. package/dist/.js +201 -200
  2. package/dist/Accordion.d.ts +13 -15
  3. package/dist/Accordion.js +184 -179
  4. package/dist/Alert/AlertBase.d.ts +7 -7
  5. package/dist/Alert/AlertBase.js +21 -21
  6. package/dist/Alert.d.ts +2 -2
  7. package/dist/Alert.js +31 -31
  8. package/dist/Avatar.d.ts +2 -2
  9. package/dist/Avatar.js +30 -22
  10. package/dist/Badge.d.ts +1 -1
  11. package/dist/Badge.js +3 -2
  12. package/dist/Button.d.ts +3 -3
  13. package/dist/Button.js +108 -46
  14. package/dist/ButtonGroup/ButtonGroupButton.d.ts +1 -1
  15. package/dist/ButtonGroup/ButtonGroupButton.js +5 -5
  16. package/dist/ButtonGroup.d.ts +5 -5
  17. package/dist/ButtonGroup.js +21 -21
  18. package/dist/ButtonIcon.d.ts +2 -2
  19. package/dist/ButtonIcon.js +30 -31
  20. package/dist/Checkbox/CheckboxBase.d.ts +2 -2
  21. package/dist/Checkbox/CheckboxBase.js +50 -57
  22. package/dist/Checkbox.js +15 -19
  23. package/dist/DataCard/Card.d.ts +1 -1
  24. package/dist/DataCard/Card.js +1 -1
  25. package/dist/DataCard.js +1 -1
  26. package/dist/DateTimePicker/Calendar.d.ts +4 -4
  27. package/dist/DateTimePicker/Calendar.js +3 -3
  28. package/dist/DateTimePicker/DateTimeDisplayInput.js +126 -136
  29. package/dist/DateTimePicker/DateTimeInput.js +4 -4
  30. package/dist/DateTimePicker/DateTimeUtils.d.ts +31 -31
  31. package/dist/DateTimePicker/DateTimeUtils.js +139 -197
  32. package/dist/DateTimePicker/TimePicker.d.ts +4 -4
  33. package/dist/DateTimePicker/TimePicker.js +3 -3
  34. package/dist/DateTimePicker.d.ts +5 -5
  35. package/dist/DateTimePicker.js +90 -70
  36. package/dist/Dialog.d.ts +13 -13
  37. package/dist/Dialog.js +57 -84
  38. package/dist/Drawer.d.ts +2 -2
  39. package/dist/Drawer.js +8 -8
  40. package/dist/HoverCard.d.ts +6 -5
  41. package/dist/HoverCard.js +64 -64
  42. package/dist/Icons/PolygonIcon.d.ts +5 -0
  43. package/dist/Icons/PolygonIcon.js +40 -0
  44. package/dist/Icons/index.d.ts +1 -1
  45. package/dist/Icons.js +34 -34
  46. package/dist/IconsAnimated/PanelLeftCloseIcon.js +2 -2
  47. package/dist/IconsAnimated/PanelLeftOpenIcon.js +2 -2
  48. package/dist/Input/InputUtils.d.ts +2 -2
  49. package/dist/Input/InputUtils.js +4 -4
  50. package/dist/Input.d.ts +1 -1
  51. package/dist/Input.js +19 -19
  52. package/dist/InputOTP.d.ts +10 -10
  53. package/dist/InputOTP.js +114 -114
  54. package/dist/Kbd.d.ts +8 -5
  55. package/dist/Kbd.js +85 -20
  56. package/dist/Label.d.ts +4 -2
  57. package/dist/Label.js +3 -3
  58. package/dist/MultiSelect/MultiSelectBase.d.ts +1 -1
  59. package/dist/MultiSelect/MultiSelectBase.js +278 -202
  60. package/dist/MultiSelect.d.ts +6 -6
  61. package/dist/MultiSelect.js +9 -9
  62. package/dist/Popover.js +22 -237
  63. package/dist/RadioButtonGroup/RadioButtonGroupBase.d.ts +11 -11
  64. package/dist/RadioButtonGroup/RadioButtonGroupBase.js +28 -28
  65. package/dist/RadioButtonGroup.d.ts +1 -1
  66. package/dist/RadioGroup.d.ts +15 -15
  67. package/dist/RadioGroup.js +253 -236
  68. package/dist/Select.d.ts +3 -1
  69. package/dist/Select.js +91 -88
  70. package/dist/Separator.js +4 -4
  71. package/dist/Skeleton.d.ts +1 -2
  72. package/dist/Skeleton.js +2 -4
  73. package/dist/Slider.d.ts +6 -6
  74. package/dist/Slider.js +78 -78
  75. package/dist/Switch/SwitchBase.d.ts +4 -4
  76. package/dist/Switch/SwitchBase.js +75 -111
  77. package/dist/Switch.d.ts +4 -4
  78. package/dist/Switch.js +122 -33
  79. package/dist/Tabs/TabsBase.js +39 -38
  80. package/dist/Tabs/tabsUtils.js +7 -7
  81. package/dist/Tabs.d.ts +0 -4
  82. package/dist/Tabs.js +62 -66
  83. package/dist/Textarea/TextareaUtils.d.ts +7 -7
  84. package/dist/Textarea/TextareaUtils.js +13 -13
  85. package/dist/Textarea.js +28 -18
  86. package/dist/Toast.d.ts +43 -0
  87. package/dist/Toast.js +883 -0
  88. package/dist/Toggle/ToggleBase.d.ts +4 -4
  89. package/dist/Toggle/ToggleBase.js +32 -33
  90. package/dist/Toggle.d.ts +1 -1
  91. package/dist/Toggle.js +7 -12
  92. package/dist/ToggleGroup/ToggleGroupBase.d.ts +5 -5
  93. package/dist/ToggleGroup/ToggleGroupBase.js +30 -30
  94. package/dist/ToggleGroup.d.ts +1 -1
  95. package/dist/ToggleGroup.js +27 -30
  96. package/dist/Tooltip.d.ts +1 -1
  97. package/dist/Tooltip.js +97 -97
  98. package/dist/Tray.d.ts +9 -9
  99. package/dist/Tray.js +71 -70
  100. package/dist/hooks/useAccordionAutoScroll.d.ts.map +1 -1
  101. package/dist/hooks/useAccordionAutoScroll.js +42 -39
  102. package/dist/hooks/useControllableState.d.ts +2 -2
  103. package/dist/hooks/useControllableState.d.ts.map +1 -1
  104. package/dist/hooks/useControllableState.js +2 -2
  105. package/dist/index-C12FUuIW.js +13 -0
  106. package/dist/{index-yU8jOTzS.js → index-CpovUAO-.js} +1 -1
  107. package/dist/{index-BdS7Ix8W.js → index-CqbPiOid.js} +1 -1
  108. package/dist/{index-B3UpsZ2x.js → index-CrjD9cAD.js} +1 -1
  109. package/dist/index-DEYs15GP.js +66 -0
  110. package/dist/index-DdFoGvON.js +146 -0
  111. package/dist/index-Q3N6lgwg.js +225 -0
  112. package/dist/index.d.ts +3 -3
  113. package/dist/index.d.ts.map +1 -1
  114. package/dist/primitives/button.d.ts +1 -1
  115. package/dist/primitives/button.js +4 -4
  116. package/dist/primitives/input.d.ts.map +1 -1
  117. package/dist/primitives/input.js +8 -5
  118. package/dist/primitives/select.d.ts +12 -13
  119. package/dist/primitives/select.d.ts.map +1 -1
  120. package/dist/primitives/select.js +59 -88
  121. package/dist/primitives/slot.d.ts +5 -5
  122. package/dist/primitives/slot.d.ts.map +1 -1
  123. package/dist/primitives/slot.js +24 -33
  124. package/dist/primitives/textarea.d.ts.map +1 -1
  125. package/dist/primitives/textarea.js +4 -3
  126. package/dist/{proxy-Cukf-VVj.js → proxy-CgaCj1WQ.js} +7 -3
  127. package/dist/styles/base-colors.css +30 -30
  128. package/dist/styles/horizon/base-colors.css +30 -30
  129. package/dist/styles/horizon/colors.css +43 -13
  130. package/dist/styles/horizon/utilities.css +26 -3
  131. package/dist/styles/main.css +1 -1
  132. package/dist/styles/spectral.css +2 -2
  133. package/dist/styles/theme.css +99 -46
  134. package/dist/{use-animation-zNd5Nq85.js → use-animation-CR-SdV2l.js} +1 -1
  135. package/dist/utils/formFieldUtils.d.ts +2 -2
  136. package/dist/utils/formFieldUtils.d.ts.map +1 -1
  137. package/dist/utils/formFieldUtils.js +14 -11
  138. package/dist/utils/sharedUtils.d.ts +3 -3
  139. package/dist/utils/sharedUtils.d.ts.map +1 -1
  140. package/dist/utils/sharedUtils.js +1 -4
  141. package/dist/utils/twUtils.d.ts +1 -1
  142. package/dist/utils/twUtils.d.ts.map +1 -1
  143. package/dist/utils/twUtils.js +1 -4
  144. package/package.json +6 -1
  145. package/dist/Icons/LineToolIcon2.d.ts +0 -5
  146. package/dist/Icons/LineToolIcon2.js +0 -49
  147. package/dist/createLucideIcon-D4r5Phnh.js +0 -70
  148. package/dist/index-CeP1E2kK.js +0 -209
  149. package/dist/index-Dy-Hzr7y.js +0 -13
@@ -1,156 +1,158 @@
1
1
  "use client";
2
2
  import "./styles/main.css";
3
- import { jsx as n, jsxs as N } from "react/jsx-runtime";
4
- import { Label as _ } from "./Label.js";
3
+ import { jsx as a, jsxs as Y } from "react/jsx-runtime";
4
+ import { Label as D } from "./Label.js";
5
5
  import * as c from "react";
6
- import { createContext as be, memo as Re, useMemo as ge, useContext as he } from "react";
7
- import { c as B, P as S, b as w, u as G, e as q } from "./index-OnYbwQjk.js";
8
- import { c as Ie, u as Y } from "./index-DSXuB1g3.js";
9
- import { u as we } from "./index-Dy-Hzr7y.js";
10
- import { u as ye } from "./index-0ioNhtNM.js";
11
- import { u as Ce } from "./index-ZExQO1ax.js";
12
- import { u as Ee } from "./index-BZPx6jYI.js";
13
- import { P as Fe } from "./index-D6HcSXrq.js";
14
- import { cn as F } from "./utils/twUtils.js";
15
- var L = "rovingFocusGroup.onEntryFocus", Se = { bubbles: !1, cancelable: !0 }, x = "RovingFocusGroup", [O, j, xe] = Ie(x), [Ne, z] = B(
16
- x,
17
- [xe]
18
- ), [_e, Ae] = Ne(x), H = c.forwardRef(
19
- (e, t) => /* @__PURE__ */ n(O.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ n(O.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ n(Ge, { ...e, ref: t }) }) })
6
+ import { useState as ge, createContext as he, memo as Ie, useMemo as ye, useContext as we, useId as Ce } from "react";
7
+ import { c as L, P as F, b as y, u as _, e as $ } from "./index-OnYbwQjk.js";
8
+ import { c as Ee, u as j } from "./index-DSXuB1g3.js";
9
+ import { u as Se } from "./index-C12FUuIW.js";
10
+ import { u as Fe } from "./index-0ioNhtNM.js";
11
+ import { u as Ae } from "./index-ZExQO1ax.js";
12
+ import { u as Ne } from "./index-BZPx6jYI.js";
13
+ import { P as _e } from "./index-D6HcSXrq.js";
14
+ import { cn as E } from "./utils/twUtils.js";
15
+ import { h as Pe, c as Te, p as xe, w as Ge, m as V } from "./proxy-CgaCj1WQ.js";
16
+ import { A as ke } from "./index-DdFoGvON.js";
17
+ var k = "rovingFocusGroup.onEntryFocus", De = { bubbles: !1, cancelable: !0 }, N = "RovingFocusGroup", [M, H, Me] = Ee(N), [Oe, z] = L(
18
+ N,
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
22
  );
21
- H.displayName = x;
22
- var Ge = c.forwardRef((e, t) => {
23
+ W.displayName = N;
24
+ var Ke = c.forwardRef((e, t) => {
23
25
  const {
24
26
  __scopeRovingFocusGroup: o,
25
27
  orientation: r,
26
- loop: a = !1,
28
+ loop: n = !1,
27
29
  dir: s,
28
30
  currentTabStopId: i,
29
31
  defaultCurrentTabStopId: m,
30
- onCurrentTabStopIdChange: b,
32
+ onCurrentTabStopIdChange: v,
31
33
  onEntryFocus: f,
32
- preventScrollOnEntryFocus: d = !1,
34
+ preventScrollOnEntryFocus: u = !1,
33
35
  ...R
34
- } = e, g = c.useRef(null), l = G(t, g), p = Y(s), [v, u] = q({
36
+ } = e, b = c.useRef(null), l = _(t, b), p = j(s), [h, d] = $({
35
37
  prop: i,
36
38
  defaultProp: m ?? null,
37
- onChange: b,
38
- caller: x
39
- }), [y, T] = c.useState(!1), I = ye(f), C = j(o), k = c.useRef(!1), [le, U] = c.useState(0);
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);
40
42
  return c.useEffect(() => {
41
- const h = g.current;
42
- if (h)
43
- return h.addEventListener(L, I), () => h.removeEventListener(L, I);
44
- }, [I]), /* @__PURE__ */ n(
45
- _e,
43
+ const g = b.current;
44
+ if (g)
45
+ return g.addEventListener(k, I), () => g.removeEventListener(k, I);
46
+ }, [I]), /* @__PURE__ */ a(
47
+ Le,
46
48
  {
47
49
  scope: o,
48
50
  orientation: r,
49
51
  dir: p,
50
- loop: a,
51
- currentTabStopId: v,
52
+ loop: n,
53
+ currentTabStopId: h,
52
54
  onItemFocus: c.useCallback(
53
- (h) => u(h),
54
- [u]
55
+ (g) => d(g),
56
+ [d]
55
57
  ),
56
58
  onItemShiftTab: c.useCallback(() => T(!0), []),
57
59
  onFocusableItemAdd: c.useCallback(
58
- () => U((h) => h + 1),
60
+ () => K((g) => g + 1),
59
61
  []
60
62
  ),
61
63
  onFocusableItemRemove: c.useCallback(
62
- () => U((h) => h - 1),
64
+ () => K((g) => g - 1),
63
65
  []
64
66
  ),
65
- children: /* @__PURE__ */ n(
66
- S.div,
67
+ children: /* @__PURE__ */ a(
68
+ F.div,
67
69
  {
68
- tabIndex: y || le === 0 ? -1 : 0,
70
+ tabIndex: w || pe === 0 ? -1 : 0,
69
71
  "data-orientation": r,
70
72
  ...R,
71
73
  ref: l,
72
74
  style: { outline: "none", ...e.style },
73
- onMouseDown: w(e.onMouseDown, () => {
74
- k.current = !0;
75
+ onMouseDown: y(e.onMouseDown, () => {
76
+ x.current = !0;
75
77
  }),
76
- onFocus: w(e.onFocus, (h) => {
77
- const fe = !k.current;
78
- if (h.target === h.currentTarget && fe && !y) {
79
- const V = new CustomEvent(L, Se);
80
- if (h.currentTarget.dispatchEvent(V), !V.defaultPrevented) {
81
- const D = C().filter((E) => E.focusable), pe = D.find((E) => E.active), me = D.find((E) => E.id === v), ve = [pe, me, ...D].filter(
78
+ onFocus: y(e.onFocus, (g) => {
79
+ const me = !x.current;
80
+ if (g.target === g.currentTarget && me && !w) {
81
+ const U = new CustomEvent(k, De);
82
+ if (g.currentTarget.dispatchEvent(U), !U.defaultPrevented) {
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(
82
84
  Boolean
83
- ).map((E) => E.ref.current);
84
- X(ve, d);
85
+ ).map((S) => S.ref.current);
86
+ Q(Re, u);
85
87
  }
86
88
  }
87
- k.current = !1;
89
+ x.current = !1;
88
90
  }),
89
- onBlur: w(e.onBlur, () => T(!1))
91
+ onBlur: y(e.onBlur, () => T(!1))
90
92
  }
91
93
  )
92
94
  }
93
95
  );
94
- }), $ = "RovingFocusGroupItem", W = c.forwardRef(
96
+ }), X = "RovingFocusGroupItem", J = c.forwardRef(
95
97
  (e, t) => {
96
98
  const {
97
99
  __scopeRovingFocusGroup: o,
98
100
  focusable: r = !0,
99
- active: a = !1,
101
+ active: n = !1,
100
102
  tabStopId: s,
101
103
  children: i,
102
104
  ...m
103
- } = e, b = we(), f = s || b, d = Ae($, o), R = d.currentTabStopId === f, g = j(o), { onFocusableItemAdd: l, onFocusableItemRemove: p, currentTabStopId: v } = d;
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;
104
106
  return c.useEffect(() => {
105
107
  if (r)
106
108
  return l(), () => p();
107
- }, [r, l, p]), /* @__PURE__ */ n(
108
- O.ItemSlot,
109
+ }, [r, l, p]), /* @__PURE__ */ a(
110
+ M.ItemSlot,
109
111
  {
110
112
  scope: o,
111
113
  id: f,
112
114
  focusable: r,
113
- active: a,
114
- children: /* @__PURE__ */ n(
115
- S.span,
115
+ active: n,
116
+ children: /* @__PURE__ */ a(
117
+ F.span,
116
118
  {
117
119
  tabIndex: R ? 0 : -1,
118
- "data-orientation": d.orientation,
120
+ "data-orientation": u.orientation,
119
121
  ...m,
120
122
  ref: t,
121
- onMouseDown: w(e.onMouseDown, (u) => {
122
- r ? d.onItemFocus(f) : u.preventDefault();
123
+ onMouseDown: y(e.onMouseDown, (d) => {
124
+ r ? u.onItemFocus(f) : d.preventDefault();
123
125
  }),
124
- onFocus: w(e.onFocus, () => d.onItemFocus(f)),
125
- onKeyDown: w(e.onKeyDown, (u) => {
126
- if (u.key === "Tab" && u.shiftKey) {
127
- d.onItemShiftTab();
126
+ onFocus: y(e.onFocus, () => u.onItemFocus(f)),
127
+ onKeyDown: y(e.onKeyDown, (d) => {
128
+ if (d.key === "Tab" && d.shiftKey) {
129
+ u.onItemShiftTab();
128
130
  return;
129
131
  }
130
- if (u.target !== u.currentTarget) return;
131
- const y = ke(u, d.orientation, d.dir);
132
- if (y !== void 0) {
133
- if (u.metaKey || u.ctrlKey || u.altKey || u.shiftKey) return;
134
- u.preventDefault();
135
- let I = g().filter((C) => C.focusable).map((C) => C.ref.current);
136
- if (y === "last") I.reverse();
137
- else if (y === "prev" || y === "next") {
138
- y === "prev" && I.reverse();
139
- const C = I.indexOf(u.currentTarget);
140
- I = d.loop ? De(I, C + 1) : I.slice(C + 1);
132
+ if (d.target !== d.currentTarget) return;
133
+ const w = qe(d, u.orientation, u.dir);
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);
138
+ if (w === "last") I.reverse();
139
+ else if (w === "prev" || w === "next") {
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
143
  }
142
- setTimeout(() => X(I));
144
+ setTimeout(() => Q(I));
143
145
  }
144
146
  }),
145
- children: typeof i == "function" ? i({ isCurrentTabStop: R, hasTabStop: v != null }) : i
147
+ children: typeof i == "function" ? i({ isCurrentTabStop: R, hasTabStop: h != null }) : i
146
148
  }
147
149
  )
148
150
  }
149
151
  );
150
152
  }
151
153
  );
152
- W.displayName = $;
153
- var Pe = {
154
+ J.displayName = X;
155
+ var Ue = {
154
156
  ArrowLeft: "prev",
155
157
  ArrowUp: "prev",
156
158
  ArrowRight: "next",
@@ -160,61 +162,61 @@ var Pe = {
160
162
  PageDown: "last",
161
163
  End: "last"
162
164
  };
163
- function Te(e, t) {
165
+ function Ve(e, t) {
164
166
  return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
165
167
  }
166
- function ke(e, t, o) {
167
- const r = Te(e.key, o);
168
+ function qe(e, t, o) {
169
+ const r = Ve(e.key, o);
168
170
  if (!(t === "vertical" && ["ArrowLeft", "ArrowRight"].includes(r)) && !(t === "horizontal" && ["ArrowUp", "ArrowDown"].includes(r)))
169
- return Pe[r];
171
+ return Ue[r];
170
172
  }
171
- function X(e, t = !1) {
173
+ function Q(e, t = !1) {
172
174
  const o = document.activeElement;
173
175
  for (const r of e)
174
176
  if (r === o || (r.focus({ preventScroll: t }), document.activeElement !== o)) return;
175
177
  }
176
- function De(e, t) {
178
+ function Ye(e, t) {
177
179
  return e.map((o, r) => e[(t + r) % e.length]);
178
180
  }
179
- var Le = H, Oe = W, K = "Radio", [Me, J] = B(K), [Be, Ke] = Me(K), Q = c.forwardRef(
181
+ var $e = W, je = J, B = "Radio", [He, Z] = L(B), [ze, We] = He(B), ee = c.forwardRef(
180
182
  (e, t) => {
181
183
  const {
182
184
  __scopeRadio: o,
183
185
  name: r,
184
- checked: a = !1,
186
+ checked: n = !1,
185
187
  required: s,
186
188
  disabled: i,
187
189
  value: m = "on",
188
- onCheck: b,
190
+ onCheck: v,
189
191
  form: f,
190
- ...d
191
- } = e, [R, g] = c.useState(null), l = G(t, (u) => g(u)), p = c.useRef(!1), v = R ? f || !!R.closest("form") : !0;
192
- return /* @__PURE__ */ N(Be, { scope: o, checked: a, disabled: i, children: [
193
- /* @__PURE__ */ n(
194
- S.button,
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;
194
+ return /* @__PURE__ */ Y(ze, { scope: o, checked: n, disabled: i, children: [
195
+ /* @__PURE__ */ a(
196
+ F.button,
195
197
  {
196
198
  type: "button",
197
199
  role: "radio",
198
- "aria-checked": a,
199
- "data-state": te(a),
200
+ "aria-checked": n,
201
+ "data-state": ae(n),
200
202
  "data-disabled": i ? "" : void 0,
201
203
  disabled: i,
202
204
  value: m,
203
- ...d,
205
+ ...u,
204
206
  ref: l,
205
- onClick: w(e.onClick, (u) => {
206
- a || b?.(), v && (p.current = u.isPropagationStopped(), p.current || u.stopPropagation());
207
+ onClick: y(e.onClick, (d) => {
208
+ n || v?.(), h && (p.current = d.isPropagationStopped(), p.current || d.stopPropagation());
207
209
  })
208
210
  }
209
211
  ),
210
- v && /* @__PURE__ */ n(
211
- oe,
212
+ h && /* @__PURE__ */ a(
213
+ re,
212
214
  {
213
215
  control: R,
214
216
  bubbles: !p.current,
215
217
  name: r,
216
218
  value: m,
217
- checked: a,
219
+ checked: n,
218
220
  required: s,
219
221
  disabled: i,
220
222
  form: f,
@@ -224,53 +226,53 @@ var Le = H, Oe = W, K = "Radio", [Me, J] = B(K), [Be, Ke] = Me(K), Q = c.forward
224
226
  ] });
225
227
  }
226
228
  );
227
- Q.displayName = K;
228
- var Z = "RadioIndicator", ee = c.forwardRef(
229
+ ee.displayName = B;
230
+ var oe = "RadioIndicator", te = c.forwardRef(
229
231
  (e, t) => {
230
- const { __scopeRadio: o, forceMount: r, ...a } = e, s = Ke(Z, o);
231
- return /* @__PURE__ */ n(Fe, { present: r || s.checked, children: /* @__PURE__ */ n(
232
- S.span,
232
+ const { __scopeRadio: o, forceMount: r, ...n } = e, s = We(oe, o);
233
+ return /* @__PURE__ */ a(_e, { present: r || s.checked, children: /* @__PURE__ */ a(
234
+ F.span,
233
235
  {
234
- "data-state": te(s.checked),
236
+ "data-state": ae(s.checked),
235
237
  "data-disabled": s.disabled ? "" : void 0,
236
- ...a,
238
+ ...n,
237
239
  ref: t
238
240
  }
239
241
  ) });
240
242
  }
241
243
  );
242
- ee.displayName = Z;
243
- var Ue = "RadioBubbleInput", oe = c.forwardRef(
244
+ te.displayName = oe;
245
+ var Xe = "RadioBubbleInput", re = c.forwardRef(
244
246
  ({
245
247
  __scopeRadio: e,
246
248
  control: t,
247
249
  checked: o,
248
250
  bubbles: r = !0,
249
- ...a
251
+ ...n
250
252
  }, s) => {
251
- const i = c.useRef(null), m = G(i, s), b = Ee(o), f = Ce(t);
253
+ const i = c.useRef(null), m = _(i, s), v = Ne(o), f = Ae(t);
252
254
  return c.useEffect(() => {
253
- const d = i.current;
254
- if (!d) return;
255
+ const u = i.current;
256
+ if (!u) return;
255
257
  const R = window.HTMLInputElement.prototype, l = Object.getOwnPropertyDescriptor(
256
258
  R,
257
259
  "checked"
258
260
  ).set;
259
- if (b !== o && l) {
261
+ if (v !== o && l) {
260
262
  const p = new Event("click", { bubbles: r });
261
- l.call(d, o), d.dispatchEvent(p);
263
+ l.call(u, o), u.dispatchEvent(p);
262
264
  }
263
- }, [b, o, r]), /* @__PURE__ */ n(
264
- S.input,
265
+ }, [v, o, r]), /* @__PURE__ */ a(
266
+ F.input,
265
267
  {
266
268
  type: "radio",
267
269
  "aria-hidden": !0,
268
270
  defaultChecked: o,
269
- ...a,
271
+ ...n,
270
272
  tabIndex: -1,
271
273
  ref: m,
272
274
  style: {
273
- ...a.style,
275
+ ...n.style,
274
276
  ...f,
275
277
  position: "absolute",
276
278
  pointerEvents: "none",
@@ -281,59 +283,59 @@ var Ue = "RadioBubbleInput", oe = c.forwardRef(
281
283
  );
282
284
  }
283
285
  );
284
- oe.displayName = Ue;
285
- function te(e) {
286
+ re.displayName = Xe;
287
+ function ae(e) {
286
288
  return e ? "checked" : "unchecked";
287
289
  }
288
- var Ve = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], P = "RadioGroup", [qe] = B(P, [
290
+ var Je = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], P = "RadioGroup", [Qe] = L(P, [
289
291
  z,
290
- J
291
- ]), re = z(), ae = J(), [Ye, je] = qe(P), ne = c.forwardRef(
292
+ Z
293
+ ]), ne = z(), se = Z(), [Ze, eo] = Qe(P), ie = c.forwardRef(
292
294
  (e, t) => {
293
295
  const {
294
296
  __scopeRadioGroup: o,
295
297
  name: r,
296
- defaultValue: a,
298
+ defaultValue: n,
297
299
  value: s,
298
300
  required: i = !1,
299
301
  disabled: m = !1,
300
- orientation: b,
302
+ orientation: v,
301
303
  dir: f,
302
- loop: d = !0,
304
+ loop: u = !0,
303
305
  onValueChange: R,
304
- ...g
305
- } = e, l = re(o), p = Y(f), [v, u] = q({
306
+ ...b
307
+ } = e, l = ne(o), p = j(f), [h, d] = $({
306
308
  prop: s,
307
- defaultProp: a ?? null,
309
+ defaultProp: n ?? null,
308
310
  onChange: R,
309
311
  caller: P
310
312
  });
311
- return /* @__PURE__ */ n(
312
- Ye,
313
+ return /* @__PURE__ */ a(
314
+ Ze,
313
315
  {
314
316
  scope: o,
315
317
  name: r,
316
318
  required: i,
317
319
  disabled: m,
318
- value: v,
319
- onValueChange: u,
320
- children: /* @__PURE__ */ n(
321
- Le,
320
+ value: h,
321
+ onValueChange: d,
322
+ children: /* @__PURE__ */ a(
323
+ $e,
322
324
  {
323
325
  asChild: !0,
324
326
  ...l,
325
- orientation: b,
327
+ orientation: v,
326
328
  dir: p,
327
- loop: d,
328
- children: /* @__PURE__ */ n(
329
- S.div,
329
+ loop: u,
330
+ children: /* @__PURE__ */ a(
331
+ F.div,
330
332
  {
331
333
  role: "radiogroup",
332
334
  "aria-required": i,
333
- "aria-orientation": b,
335
+ "aria-orientation": v,
334
336
  "data-disabled": m ? "" : void 0,
335
337
  dir: p,
336
- ...g,
338
+ ...b,
337
339
  ref: t
338
340
  }
339
341
  )
@@ -343,40 +345,40 @@ var Ve = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], P = "RadioGroup",
343
345
  );
344
346
  }
345
347
  );
346
- ne.displayName = P;
347
- var se = "RadioGroupItem", ie = c.forwardRef(
348
+ ie.displayName = P;
349
+ var ce = "RadioGroupItem", ue = c.forwardRef(
348
350
  (e, t) => {
349
- const { __scopeRadioGroup: o, disabled: r, ...a } = e, s = je(se, o), i = s.disabled || r, m = re(o), b = ae(o), f = c.useRef(null), d = G(t, f), R = s.value === a.value, g = c.useRef(!1);
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);
350
352
  return c.useEffect(() => {
351
- const l = (v) => {
352
- Ve.includes(v.key) && (g.current = !0);
353
- }, p = () => g.current = !1;
353
+ const l = (h) => {
354
+ Je.includes(h.key) && (b.current = !0);
355
+ }, p = () => b.current = !1;
354
356
  return document.addEventListener("keydown", l), document.addEventListener("keyup", p), () => {
355
357
  document.removeEventListener("keydown", l), document.removeEventListener("keyup", p);
356
358
  };
357
- }, []), /* @__PURE__ */ n(
358
- Oe,
359
+ }, []), /* @__PURE__ */ a(
360
+ je,
359
361
  {
360
362
  asChild: !0,
361
363
  ...m,
362
364
  focusable: !i,
363
365
  active: R,
364
- children: /* @__PURE__ */ n(
365
- Q,
366
+ children: /* @__PURE__ */ a(
367
+ ee,
366
368
  {
367
369
  disabled: i,
368
370
  required: s.required,
369
371
  checked: R,
370
- ...b,
371
- ...a,
372
+ ...v,
373
+ ...n,
372
374
  name: s.name,
373
- ref: d,
374
- onCheck: () => s.onValueChange(a.value),
375
- onKeyDown: w((l) => {
375
+ ref: u,
376
+ onCheck: () => s.onValueChange(n.value),
377
+ onKeyDown: y((l) => {
376
378
  l.key === "Enter" && l.preventDefault();
377
379
  }),
378
- onFocus: w(a.onFocus, () => {
379
- g.current && f.current?.click();
380
+ onFocus: y(n.onFocus, () => {
381
+ b.current && f.current?.click();
380
382
  })
381
383
  }
382
384
  )
@@ -384,115 +386,130 @@ var se = "RadioGroupItem", ie = c.forwardRef(
384
386
  );
385
387
  }
386
388
  );
387
- ie.displayName = se;
388
- var ze = "RadioGroupIndicator", ce = c.forwardRef(
389
+ ue.displayName = ce;
390
+ var oo = "RadioGroupIndicator", de = c.forwardRef(
389
391
  (e, t) => {
390
- const { __scopeRadioGroup: o, ...r } = e, a = ae(o);
391
- return /* @__PURE__ */ n(ee, { ...a, ...r, ref: t });
392
+ const { __scopeRadioGroup: o, ...r } = e, n = se(o);
393
+ return /* @__PURE__ */ a(te, { ...n, ...r, ref: t });
392
394
  }
393
395
  );
394
- ce.displayName = ze;
395
- var He = ne, ue = ie, $e = ce;
396
- const de = be({
397
- orientation: "vertical",
398
- variant: "default",
396
+ de.displayName = oo;
397
+ var to = ie, O = ue, q = de;
398
+ function ro() {
399
+ !Pe.current && Te();
400
+ const [e] = ge(xe.current);
401
+ return process.env.NODE_ENV !== "production" && Ge(e !== !0, "You have Reduced Motion enabled on your device. Animations may not appear as expected.", "reduced-motion-disabled"), e;
402
+ }
403
+ const le = he({
399
404
  disabledValues: [],
400
- groupDisabled: !1
401
- }), A = "pointer-events-none opacity-60", We = ({
402
- ref: e,
403
- className: t,
405
+ groupDisabled: !1,
406
+ orientation: "vertical",
407
+ variant: "default"
408
+ }), A = "pointer-events-none opacity-60", ao = ({
409
+ className: e,
410
+ disabled: t,
404
411
  itemClassName: o,
405
412
  onValueChange: r,
406
- orientation: a = "vertical",
407
- disabled: s,
413
+ orientation: n = "vertical",
414
+ ref: s,
408
415
  selected: i,
409
416
  variant: m = "default",
410
- ...b
417
+ ...v
411
418
  }) => {
412
- const f = ge(
419
+ const f = ye(
413
420
  () => ({
414
- orientation: a,
415
- variant: m,
416
- disabledValues: Array.isArray(s) ? s : [],
417
- groupDisabled: typeof s == "boolean" ? s : !1,
421
+ disabledValues: Array.isArray(t) ? t : [],
422
+ groupDisabled: typeof t == "boolean" ? t : !1,
418
423
  itemClassName: o,
419
- selected: i
424
+ orientation: n,
425
+ selected: i,
426
+ variant: m
420
427
  }),
421
- [a, m, s, o, i]
428
+ [n, m, t, o, i]
422
429
  );
423
- return /* @__PURE__ */ n(de.Provider, { value: f, children: /* @__PURE__ */ n(
424
- He,
430
+ return /* @__PURE__ */ a(le.Provider, { value: f, children: /* @__PURE__ */ a(
431
+ to,
425
432
  {
426
- className: F("text-text-primary flex w-full", a === "vertical" ? "flex-col gap-4" : "flex-row gap-5", m === "unstyled" && "w-fit gap-2.5", t),
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),
427
434
  "data-testid": "spectral-radio-group",
428
435
  disabled: f.groupDisabled,
429
436
  onValueChange: r,
430
- ref: e,
437
+ ref: s,
431
438
  value: i,
432
- ...b
439
+ ...v
433
440
  }
434
441
  ) });
435
442
  };
436
- We.displayName = "RadioGroup";
437
- const M = Re(
443
+ ao.displayName = "RadioGroup";
444
+ const no = { type: "spring", stiffness: 200, damping: 16 }, fe = Ie(
438
445
  ({
439
- ref: e,
440
- value: t,
441
- id: o,
442
- isDisabled: r,
443
- className: a,
444
- ...s
445
- }) => /* @__PURE__ */ n(
446
- ue,
446
+ className: e,
447
+ id: t,
448
+ isDisabled: o,
449
+ ref: r,
450
+ transition: n = no,
451
+ value: s,
452
+ ...i
453
+ }) => ro() ? /* @__PURE__ */ a(
454
+ O,
447
455
  {
448
- ref: e,
456
+ className: E(
457
+ "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
+ "hover:border-radio-border--hover focus-visible:outline-accent focus-visible:outline-1 focus-visible:outline-offset-2",
459
+ "data-[state=checked]:border-radio-border--selected data-[state=checked]:bg-radio-bg",
460
+ o && A,
461
+ e
462
+ ),
449
463
  "data-testid": "spectral-radio-group-item",
450
- className: F(
464
+ disabled: o,
465
+ id: t,
466
+ ref: r,
467
+ value: s,
468
+ ...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) })
470
+ }
471
+ ) : /* @__PURE__ */ a(O, { value: s, id: t, disabled: o, asChild: !0, ...i, children: /* @__PURE__ */ a(
472
+ V.button,
473
+ {
474
+ className: E(
451
475
  "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",
452
476
  "hover:border-radio-border--hover focus-visible:outline-accent focus-visible:outline-1 focus-visible:outline-offset-2",
453
- "[&[data-state=checked]]:border-radio-border--selected [&[data-state=checked]]:bg-radio-bg",
454
- r && A,
455
- a
477
+ "data-[state=checked]:border-radio-border--selected data-[state=checked]:bg-radio-bg",
478
+ o && A,
479
+ e
456
480
  ),
457
- disabled: r,
458
- value: t,
459
- id: o,
460
- ...s,
461
- children: /* @__PURE__ */ n($e, { className: "after:bg-radio-bg--selected transition-colors after:absolute after:inset-0 after:m-auto after:h-2.5 after:w-2.5 after:rounded-full after:content-['']" })
481
+ "data-testid": "spectral-radio-group-item",
482
+ ref: r,
483
+ whileHover: { scale: 1.05 },
484
+ whileTap: { scale: 0.95 },
485
+ 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") }) })
462
486
  }
463
- )
487
+ ) })
464
488
  );
465
- M.displayName = "RadioButton";
466
- const Xe = ({
467
- ref: e,
489
+ fe.displayName = "RadioButton";
490
+ const so = ({
491
+ children: e,
468
492
  className: t,
469
- children: o,
470
- value: r,
471
- description: a,
472
- disabled: s,
473
- ...i
493
+ disabled: o,
494
+ ref: r,
495
+ value: n,
496
+ ...s
474
497
  }) => {
475
- const { disabledValues: m, groupDisabled: b, itemClassName: f, variant: d, selected: R, orientation: g } = he(de), l = r.toString(), p = i.id?.toString() || l, v = b || m.includes(l) || !!s, u = R === l;
476
- return d === "tiles" ? /* @__PURE__ */ n(_, { htmlFor: p, className: F("border-border-subtle flex w-full cursor-pointer items-start rounded-xl border p-4", u && "border-tile-border--selected bg-tile-bg--selected", v && A, f, t), children: /* @__PURE__ */ N("div", { className: "flex w-full items-start justify-between gap-4", children: [
477
- /* @__PURE__ */ n("div", { className: "relative top-0.75 mr-3 flex-shrink-0", children: /* @__PURE__ */ n(M, { ref: e, value: l, id: p, isDisabled: v, ...i }) }),
478
- /* @__PURE__ */ N("div", { className: "flex flex-grow flex-col", children: [
479
- /* @__PURE__ */ n("div", { className: "font-bold", children: o }),
480
- a && /* @__PURE__ */ n("div", { className: "mt-1 text-sm", children: a })
481
- ] })
482
- ] }) }) : d === "unstyled" ? /* @__PURE__ */ n(ue, { ref: e, value: l, id: p, disabled: v, asChild: !0, ...i, children: /* @__PURE__ */ n(_, { htmlFor: p, className: F("[&[data-state=checked]]:border-radio-border--selected flex h-fit w-fit rounded border-2 border-transparent", v && A, f, t), children: o }) }) : /* @__PURE__ */ N("div", { className: F("flex items-center", v && A, f, t, g), children: [
483
- /* @__PURE__ */ n(M, { ref: e, value: l, id: p, isDisabled: v, ...i }),
484
- o && /* @__PURE__ */ n(_, { className: F("text-md cursor-pointer font-normal", g === "vertical" ? "ml-2" : "ml-1"), htmlFor: p, children: o })
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 })
485
502
  ] });
486
503
  };
487
- Xe.displayName = "RadioGroup.Item";
488
- const Je = ({
504
+ so.displayName = "RadioGroup.Item";
505
+ const io = ({
489
506
  ref: e,
490
507
  className: t,
491
508
  ...o
492
- }) => /* @__PURE__ */ n(_, { ref: e, "data-testid": "spectral-radio-group-label", className: F("text-md block font-medium", t), ...o });
493
- Je.displayName = "RadioGroup.Label";
509
+ }) => /* @__PURE__ */ a(D, { ref: e, "data-testid": "spectral-radio-group-label", className: E("text-md block font-medium", t), ...o });
510
+ io.displayName = "RadioGroup.Label";
494
511
  export {
495
- We as RadioGroup,
496
- Xe as RadioGroupItem,
497
- Je as RadioGroupLabel
512
+ ao as RadioGroup,
513
+ so as RadioGroupItem,
514
+ io as RadioGroupLabel
498
515
  };