@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.
- package/dist/RadioGroup.d.ts +1 -1
- package/dist/RadioGroup.js +190 -200
- package/package.json +1 -1
package/dist/RadioGroup.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export interface RadioGroupItemProps extends ComponentProps<typeof RadioGroupPri
|
|
|
21
21
|
value: string;
|
|
22
22
|
}
|
|
23
23
|
declare const RadioGroup: {
|
|
24
|
-
(
|
|
24
|
+
(allProps: RadioGroupProps & {
|
|
25
25
|
ref?: Ref<ComponentRef<typeof RadioGroupPrimitive.Root>>;
|
|
26
26
|
}): ReactElement;
|
|
27
27
|
displayName: string;
|
package/dist/RadioGroup.js
CHANGED
|
@@ -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
|
|
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
|
|
12
|
-
import { u as
|
|
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 },
|
|
18
|
-
|
|
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(
|
|
21
|
-
(e,
|
|
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 =
|
|
24
|
-
var Ke =
|
|
23
|
+
W.displayName = A;
|
|
24
|
+
var Ke = d.forwardRef((e, r) => {
|
|
25
25
|
const {
|
|
26
26
|
__scopeRovingFocusGroup: o,
|
|
27
|
-
orientation:
|
|
27
|
+
orientation: t,
|
|
28
28
|
loop: n = !1,
|
|
29
29
|
dir: s,
|
|
30
30
|
currentTabStopId: i,
|
|
31
|
-
defaultCurrentTabStopId:
|
|
32
|
-
onCurrentTabStopIdChange:
|
|
33
|
-
onEntryFocus:
|
|
34
|
-
preventScrollOnEntryFocus:
|
|
35
|
-
...
|
|
36
|
-
} = e,
|
|
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:
|
|
39
|
-
onChange:
|
|
40
|
-
caller:
|
|
41
|
-
}), [w, T] =
|
|
42
|
-
return
|
|
43
|
-
const g =
|
|
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:
|
|
51
|
-
dir:
|
|
50
|
+
orientation: t,
|
|
51
|
+
dir: v,
|
|
52
52
|
loop: n,
|
|
53
53
|
currentTabStopId: h,
|
|
54
|
-
onItemFocus:
|
|
55
|
-
(g) =>
|
|
56
|
-
[
|
|
54
|
+
onItemFocus: d.useCallback(
|
|
55
|
+
(g) => u(g),
|
|
56
|
+
[u]
|
|
57
57
|
),
|
|
58
|
-
onItemShiftTab:
|
|
59
|
-
onFocusableItemAdd:
|
|
58
|
+
onItemShiftTab: d.useCallback(() => T(!0), []),
|
|
59
|
+
onFocusableItemAdd: d.useCallback(
|
|
60
60
|
() => K((g) => g + 1),
|
|
61
61
|
[]
|
|
62
62
|
),
|
|
63
|
-
onFocusableItemRemove:
|
|
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":
|
|
72
|
-
...
|
|
73
|
-
ref:
|
|
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,
|
|
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 =
|
|
97
|
-
(e,
|
|
96
|
+
}), X = "RovingFocusGroupItem", J = d.forwardRef(
|
|
97
|
+
(e, r) => {
|
|
98
98
|
const {
|
|
99
99
|
__scopeRovingFocusGroup: o,
|
|
100
|
-
focusable:
|
|
100
|
+
focusable: t = !0,
|
|
101
101
|
active: n = !1,
|
|
102
102
|
tabStopId: s,
|
|
103
103
|
children: i,
|
|
104
|
-
...
|
|
105
|
-
} = e,
|
|
106
|
-
return
|
|
107
|
-
if (
|
|
108
|
-
return
|
|
109
|
-
}, [
|
|
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:
|
|
114
|
-
focusable:
|
|
113
|
+
id: l,
|
|
114
|
+
focusable: t,
|
|
115
115
|
active: n,
|
|
116
116
|
children: /* @__PURE__ */ a(
|
|
117
117
|
F.span,
|
|
118
118
|
{
|
|
119
|
-
tabIndex:
|
|
120
|
-
"data-orientation":
|
|
121
|
-
...
|
|
122
|
-
ref:
|
|
123
|
-
onMouseDown: y(e.onMouseDown, (
|
|
124
|
-
|
|
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, () =>
|
|
127
|
-
onKeyDown: y(e.onKeyDown, (
|
|
128
|
-
if (
|
|
129
|
-
|
|
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 (
|
|
133
|
-
const w = qe(
|
|
132
|
+
if (u.target !== u.currentTarget) return;
|
|
133
|
+
const w = qe(u, c.orientation, c.dir);
|
|
134
134
|
if (w !== void 0) {
|
|
135
|
-
if (
|
|
136
|
-
|
|
137
|
-
let I =
|
|
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(
|
|
142
|
-
I =
|
|
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:
|
|
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,
|
|
166
|
-
return
|
|
165
|
+
function Ve(e, r) {
|
|
166
|
+
return r !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
|
|
167
167
|
}
|
|
168
|
-
function qe(e,
|
|
169
|
-
const
|
|
170
|
-
if (!(
|
|
171
|
-
return Ue[
|
|
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,
|
|
173
|
+
function Q(e, r = !1) {
|
|
174
174
|
const o = document.activeElement;
|
|
175
|
-
for (const
|
|
176
|
-
if (
|
|
175
|
+
for (const t of e)
|
|
176
|
+
if (t === o || (t.focus({ preventScroll: r }), document.activeElement !== o)) return;
|
|
177
177
|
}
|
|
178
|
-
function Ye(e,
|
|
179
|
-
return e.map((o,
|
|
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 =
|
|
182
|
-
(e,
|
|
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:
|
|
185
|
+
name: t,
|
|
186
186
|
checked: n = !1,
|
|
187
187
|
required: s,
|
|
188
188
|
disabled: i,
|
|
189
|
-
value:
|
|
190
|
-
onCheck:
|
|
191
|
-
form:
|
|
192
|
-
...
|
|
193
|
-
} = e, [
|
|
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:
|
|
205
|
-
...
|
|
206
|
-
ref:
|
|
207
|
-
onClick: y(e.onClick, (
|
|
208
|
-
n ||
|
|
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:
|
|
216
|
-
bubbles: !
|
|
217
|
-
name:
|
|
218
|
-
value:
|
|
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:
|
|
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 =
|
|
231
|
-
(e,
|
|
232
|
-
const { __scopeRadio: o, forceMount:
|
|
233
|
-
return /* @__PURE__ */ a(_e, { present:
|
|
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:
|
|
239
|
+
ref: r
|
|
240
240
|
}
|
|
241
241
|
) });
|
|
242
242
|
}
|
|
243
243
|
);
|
|
244
244
|
te.displayName = oe;
|
|
245
|
-
var Xe = "RadioBubbleInput", re =
|
|
245
|
+
var Xe = "RadioBubbleInput", re = d.forwardRef(
|
|
246
246
|
({
|
|
247
247
|
__scopeRadio: e,
|
|
248
|
-
control:
|
|
248
|
+
control: r,
|
|
249
249
|
checked: o,
|
|
250
|
-
bubbles:
|
|
250
|
+
bubbles: t = !0,
|
|
251
251
|
...n
|
|
252
252
|
}, s) => {
|
|
253
|
-
const i =
|
|
254
|
-
return
|
|
255
|
-
const
|
|
256
|
-
if (!
|
|
257
|
-
const
|
|
258
|
-
|
|
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 (
|
|
262
|
-
const
|
|
263
|
-
|
|
261
|
+
if (b !== o && f) {
|
|
262
|
+
const v = new Event("click", { bubbles: t });
|
|
263
|
+
f.call(c, o), c.dispatchEvent(v);
|
|
264
264
|
}
|
|
265
|
-
}, [
|
|
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:
|
|
273
|
+
ref: R,
|
|
274
274
|
style: {
|
|
275
275
|
...n.style,
|
|
276
|
-
...
|
|
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 =
|
|
294
|
-
(e,
|
|
293
|
+
]), ne = z(), se = Z(), [Ze, eo] = Qe(P), ie = d.forwardRef(
|
|
294
|
+
(e, r) => {
|
|
295
295
|
const {
|
|
296
296
|
__scopeRadioGroup: o,
|
|
297
|
-
name:
|
|
297
|
+
name: t,
|
|
298
298
|
defaultValue: n,
|
|
299
299
|
value: s,
|
|
300
300
|
required: i = !1,
|
|
301
|
-
disabled:
|
|
302
|
-
orientation:
|
|
303
|
-
dir:
|
|
304
|
-
loop:
|
|
305
|
-
onValueChange:
|
|
306
|
-
...
|
|
307
|
-
} = e,
|
|
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:
|
|
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:
|
|
317
|
+
name: t,
|
|
318
318
|
required: i,
|
|
319
|
-
disabled:
|
|
319
|
+
disabled: R,
|
|
320
320
|
value: h,
|
|
321
|
-
onValueChange:
|
|
321
|
+
onValueChange: u,
|
|
322
322
|
children: /* @__PURE__ */ a(
|
|
323
323
|
$e,
|
|
324
324
|
{
|
|
325
325
|
asChild: !0,
|
|
326
|
-
...
|
|
327
|
-
orientation:
|
|
328
|
-
dir:
|
|
329
|
-
loop:
|
|
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":
|
|
336
|
-
"data-disabled":
|
|
337
|
-
dir:
|
|
338
|
-
...
|
|
339
|
-
ref:
|
|
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",
|
|
350
|
-
(e,
|
|
351
|
-
const { __scopeRadioGroup: o, disabled:
|
|
352
|
-
return
|
|
353
|
-
const
|
|
354
|
-
Je.includes(h.key) && (
|
|
355
|
-
},
|
|
356
|
-
return document.addEventListener("keydown",
|
|
357
|
-
document.removeEventListener("keydown",
|
|
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
|
-
...
|
|
363
|
+
...R,
|
|
364
364
|
focusable: !i,
|
|
365
|
-
active:
|
|
365
|
+
active: p,
|
|
366
366
|
children: /* @__PURE__ */ a(
|
|
367
367
|
ee,
|
|
368
368
|
{
|
|
369
369
|
disabled: i,
|
|
370
370
|
required: s.required,
|
|
371
|
-
checked:
|
|
372
|
-
...
|
|
371
|
+
checked: p,
|
|
372
|
+
...b,
|
|
373
373
|
...n,
|
|
374
374
|
name: s.name,
|
|
375
|
-
ref:
|
|
375
|
+
ref: c,
|
|
376
376
|
onCheck: () => s.onValueChange(n.value),
|
|
377
|
-
onKeyDown: y((
|
|
378
|
-
|
|
377
|
+
onKeyDown: y((f) => {
|
|
378
|
+
f.key === "Enter" && f.preventDefault();
|
|
379
379
|
}),
|
|
380
380
|
onFocus: y(n.onFocus, () => {
|
|
381
|
-
|
|
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
|
-
|
|
390
|
-
var oo = "RadioGroupIndicator",
|
|
391
|
-
(e,
|
|
392
|
-
const { __scopeRadioGroup: o, ...
|
|
393
|
-
return /* @__PURE__ */ a(te, { ...n, ...
|
|
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
|
-
|
|
397
|
-
var to = ie, O =
|
|
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
|
-
}),
|
|
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:
|
|
424
|
-
orientation:
|
|
425
|
-
selected:
|
|
426
|
-
variant:
|
|
413
|
+
itemClassName: n,
|
|
414
|
+
orientation: i,
|
|
415
|
+
selected: p,
|
|
416
|
+
variant: l
|
|
427
417
|
}),
|
|
428
|
-
[
|
|
418
|
+
[i, l, t, n, p]
|
|
429
419
|
);
|
|
430
|
-
return /* @__PURE__ */ a(le.Provider, { value:
|
|
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",
|
|
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:
|
|
436
|
-
onValueChange:
|
|
437
|
-
ref:
|
|
438
|
-
value:
|
|
439
|
-
...
|
|
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:
|
|
437
|
+
id: r,
|
|
448
438
|
isDisabled: o,
|
|
449
|
-
ref:
|
|
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 &&
|
|
450
|
+
o && N,
|
|
461
451
|
e
|
|
462
452
|
),
|
|
463
453
|
"data-testid": "spectral-radio-group-item",
|
|
464
454
|
disabled: o,
|
|
465
|
-
id:
|
|
466
|
-
ref:
|
|
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 &&
|
|
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:
|
|
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 &&
|
|
468
|
+
o && N,
|
|
479
469
|
e
|
|
480
470
|
),
|
|
481
471
|
"data-testid": "spectral-radio-group-item",
|
|
482
|
-
ref:
|
|
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:
|
|
482
|
+
className: r,
|
|
493
483
|
disabled: o,
|
|
494
|
-
ref:
|
|
484
|
+
ref: t,
|
|
495
485
|
value: n,
|
|
496
486
|
...s
|
|
497
487
|
}) => {
|
|
498
|
-
const { disabledValues: i, groupDisabled:
|
|
499
|
-
return
|
|
500
|
-
/* @__PURE__ */ a(fe, { ref:
|
|
501
|
-
e && /* @__PURE__ */ a(D, { className: E("text-md cursor-pointer font-normal",
|
|
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:
|
|
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",
|
|
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,
|