@purpurds/radio-card-group 6.6.0 → 6.6.1
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/LICENSE.txt +3 -3
- package/dist/radio-card-group.cjs.js +3 -3
- package/dist/radio-card-group.cjs.js.map +1 -1
- package/dist/radio-card-group.d.ts +5 -0
- package/dist/radio-card-group.d.ts.map +1 -1
- package/dist/radio-card-group.es.js +186 -185
- package/dist/radio-card-group.es.js.map +1 -1
- package/package.json +9 -9
- package/src/radio-card-group.test.tsx +27 -1
- package/src/radio-card-group.tsx +7 -2
|
@@ -73,7 +73,7 @@ const Xe = /* @__PURE__ */ We(Ye), M = {
|
|
|
73
73
|
variant: i = Ze.TITLE100,
|
|
74
74
|
...u
|
|
75
75
|
}) => {
|
|
76
|
-
const
|
|
76
|
+
const c = r, p = Xe([
|
|
77
77
|
n,
|
|
78
78
|
M[F],
|
|
79
79
|
M[`${F}--${i}`],
|
|
@@ -82,7 +82,7 @@ const Xe = /* @__PURE__ */ We(Ye), M = {
|
|
|
82
82
|
[M[`${F}--negative`]]: a
|
|
83
83
|
}
|
|
84
84
|
]);
|
|
85
|
-
return /* @__PURE__ */ f(
|
|
85
|
+
return /* @__PURE__ */ f(c, { ...u, className: p, "data-testid": e, children: t });
|
|
86
86
|
};
|
|
87
87
|
ge.displayName = "Heading";
|
|
88
88
|
function N(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
|
|
@@ -118,30 +118,30 @@ function P(...e) {
|
|
|
118
118
|
function j(e, t = []) {
|
|
119
119
|
let n = [];
|
|
120
120
|
function o(r, i) {
|
|
121
|
-
const u = s.createContext(i),
|
|
121
|
+
const u = s.createContext(i), c = n.length;
|
|
122
122
|
n = [...n, i];
|
|
123
|
-
const
|
|
123
|
+
const p = (m) => {
|
|
124
124
|
var y;
|
|
125
|
-
const { scope:
|
|
126
|
-
return /* @__PURE__ */ f(
|
|
125
|
+
const { scope: _, children: d, ...l } = m, h = ((y = _ == null ? void 0 : _[e]) == null ? void 0 : y[c]) || u, v = s.useMemo(() => l, Object.values(l));
|
|
126
|
+
return /* @__PURE__ */ f(h.Provider, { value: v, children: d });
|
|
127
127
|
};
|
|
128
|
-
|
|
129
|
-
function
|
|
130
|
-
var
|
|
131
|
-
const
|
|
132
|
-
if (
|
|
128
|
+
p.displayName = r + "Provider";
|
|
129
|
+
function g(m, _) {
|
|
130
|
+
var h;
|
|
131
|
+
const d = ((h = _ == null ? void 0 : _[e]) == null ? void 0 : h[c]) || u, l = s.useContext(d);
|
|
132
|
+
if (l) return l;
|
|
133
133
|
if (i !== void 0) return i;
|
|
134
|
-
throw new Error(`\`${
|
|
134
|
+
throw new Error(`\`${m}\` must be used within \`${r}\``);
|
|
135
135
|
}
|
|
136
|
-
return [
|
|
136
|
+
return [p, g];
|
|
137
137
|
}
|
|
138
138
|
const a = () => {
|
|
139
139
|
const r = n.map((i) => s.createContext(i));
|
|
140
140
|
return function(u) {
|
|
141
|
-
const
|
|
141
|
+
const c = (u == null ? void 0 : u[e]) || r;
|
|
142
142
|
return s.useMemo(
|
|
143
|
-
() => ({ [`__scope${e}`]: { ...u, [e]:
|
|
144
|
-
[u,
|
|
143
|
+
() => ({ [`__scope${e}`]: { ...u, [e]: c } }),
|
|
144
|
+
[u, c]
|
|
145
145
|
);
|
|
146
146
|
};
|
|
147
147
|
};
|
|
@@ -156,9 +156,9 @@ function Je(...e) {
|
|
|
156
156
|
scopeName: a.scopeName
|
|
157
157
|
}));
|
|
158
158
|
return function(r) {
|
|
159
|
-
const i = o.reduce((u, { useScope:
|
|
160
|
-
const
|
|
161
|
-
return { ...u, ...
|
|
159
|
+
const i = o.reduce((u, { useScope: c, scopeName: p }) => {
|
|
160
|
+
const m = c(r)[`__scope${p}`];
|
|
161
|
+
return { ...u, ...m };
|
|
162
162
|
}, {});
|
|
163
163
|
return s.useMemo(() => ({ [`__scope${t.scopeName}`]: i }), [i]);
|
|
164
164
|
};
|
|
@@ -168,7 +168,7 @@ function Je(...e) {
|
|
|
168
168
|
var q = s.forwardRef((e, t) => {
|
|
169
169
|
const { children: n, ...o } = e, a = s.Children.toArray(n), r = a.find(er);
|
|
170
170
|
if (r) {
|
|
171
|
-
const i = r.props.children, u = a.map((
|
|
171
|
+
const i = r.props.children, u = a.map((c) => c === r ? s.Children.count(i) > 1 ? s.Children.only(null) : s.isValidElement(i) ? i.props.children : null : c);
|
|
172
172
|
return /* @__PURE__ */ f(X, { ...o, ref: t, children: s.isValidElement(i) ? s.cloneElement(i, void 0, u) : null });
|
|
173
173
|
}
|
|
174
174
|
return /* @__PURE__ */ f(X, { ...o, ref: t, children: n });
|
|
@@ -230,39 +230,39 @@ function or(e) {
|
|
|
230
230
|
const t = e + "CollectionProvider", [n, o] = j(t), [a, r] = n(
|
|
231
231
|
t,
|
|
232
232
|
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
233
|
-
), i = (
|
|
234
|
-
const { scope:
|
|
235
|
-
return /* @__PURE__ */ f(a, { scope:
|
|
233
|
+
), i = (d) => {
|
|
234
|
+
const { scope: l, children: h } = d, v = A.useRef(null), y = A.useRef(/* @__PURE__ */ new Map()).current;
|
|
235
|
+
return /* @__PURE__ */ f(a, { scope: l, itemMap: y, collectionRef: v, children: h });
|
|
236
236
|
};
|
|
237
237
|
i.displayName = t;
|
|
238
|
-
const u = e + "CollectionSlot",
|
|
239
|
-
(
|
|
240
|
-
const { scope:
|
|
238
|
+
const u = e + "CollectionSlot", c = A.forwardRef(
|
|
239
|
+
(d, l) => {
|
|
240
|
+
const { scope: h, children: v } = d, y = r(u, h), b = P(l, y.collectionRef);
|
|
241
241
|
return /* @__PURE__ */ f(q, { ref: b, children: v });
|
|
242
242
|
}
|
|
243
243
|
);
|
|
244
|
-
|
|
245
|
-
const
|
|
246
|
-
(
|
|
247
|
-
const { scope:
|
|
248
|
-
return A.useEffect(() => (O.itemMap.set(b, { ref: b, ...y }), () => void O.itemMap.delete(b))), /* @__PURE__ */ f(q, { [
|
|
244
|
+
c.displayName = u;
|
|
245
|
+
const p = e + "CollectionItemSlot", g = "data-radix-collection-item", m = A.forwardRef(
|
|
246
|
+
(d, l) => {
|
|
247
|
+
const { scope: h, children: v, ...y } = d, b = A.useRef(null), E = P(l, b), O = r(p, h);
|
|
248
|
+
return A.useEffect(() => (O.itemMap.set(b, { ref: b, ...y }), () => void O.itemMap.delete(b))), /* @__PURE__ */ f(q, { [g]: "", ref: E, children: v });
|
|
249
249
|
}
|
|
250
250
|
);
|
|
251
|
-
|
|
252
|
-
function
|
|
253
|
-
const
|
|
251
|
+
m.displayName = p;
|
|
252
|
+
function _(d) {
|
|
253
|
+
const l = r(e + "CollectionConsumer", d);
|
|
254
254
|
return A.useCallback(() => {
|
|
255
|
-
const v =
|
|
255
|
+
const v = l.collectionRef.current;
|
|
256
256
|
if (!v) return [];
|
|
257
|
-
const y = Array.from(v.querySelectorAll(`[${
|
|
258
|
-
return Array.from(
|
|
257
|
+
const y = Array.from(v.querySelectorAll(`[${g}]`));
|
|
258
|
+
return Array.from(l.itemMap.values()).sort(
|
|
259
259
|
(O, x) => y.indexOf(O.ref.current) - y.indexOf(x.ref.current)
|
|
260
260
|
);
|
|
261
|
-
}, [
|
|
261
|
+
}, [l.collectionRef, l.itemMap]);
|
|
262
262
|
}
|
|
263
263
|
return [
|
|
264
|
-
{ Provider: i, Slot:
|
|
265
|
-
|
|
264
|
+
{ Provider: i, Slot: c, ItemSlot: m },
|
|
265
|
+
_,
|
|
266
266
|
o
|
|
267
267
|
];
|
|
268
268
|
}
|
|
@@ -290,17 +290,17 @@ function ve({
|
|
|
290
290
|
onChange: n = () => {
|
|
291
291
|
}
|
|
292
292
|
}) {
|
|
293
|
-
const [o, a] = sr({ defaultProp: t, onChange: n }), r = e !== void 0, i = r ? e : o, u = Q(n),
|
|
294
|
-
(
|
|
293
|
+
const [o, a] = sr({ defaultProp: t, onChange: n }), r = e !== void 0, i = r ? e : o, u = Q(n), c = s.useCallback(
|
|
294
|
+
(p) => {
|
|
295
295
|
if (r) {
|
|
296
|
-
const
|
|
297
|
-
|
|
296
|
+
const m = typeof p == "function" ? p(e) : p;
|
|
297
|
+
m !== e && u(m);
|
|
298
298
|
} else
|
|
299
|
-
a(
|
|
299
|
+
a(p);
|
|
300
300
|
},
|
|
301
301
|
[r, e, a, u]
|
|
302
302
|
);
|
|
303
|
-
return [i,
|
|
303
|
+
return [i, c];
|
|
304
304
|
}
|
|
305
305
|
function sr({
|
|
306
306
|
defaultProp: e,
|
|
@@ -331,17 +331,17 @@ var _r = s.forwardRef((e, t) => {
|
|
|
331
331
|
dir: r,
|
|
332
332
|
currentTabStopId: i,
|
|
333
333
|
defaultCurrentTabStopId: u,
|
|
334
|
-
onCurrentTabStopIdChange:
|
|
335
|
-
onEntryFocus:
|
|
336
|
-
preventScrollOnEntryFocus:
|
|
337
|
-
...
|
|
338
|
-
} = e,
|
|
334
|
+
onCurrentTabStopIdChange: c,
|
|
335
|
+
onEntryFocus: p,
|
|
336
|
+
preventScrollOnEntryFocus: g = !1,
|
|
337
|
+
...m
|
|
338
|
+
} = e, _ = s.useRef(null), d = P(t, _), l = ye(r), [h = null, v] = ve({
|
|
339
339
|
prop: i,
|
|
340
340
|
defaultProp: u,
|
|
341
|
-
onChange:
|
|
342
|
-
}), [y, b] = s.useState(!1), E = Q(
|
|
341
|
+
onChange: c
|
|
342
|
+
}), [y, b] = s.useState(!1), E = Q(p), O = be(n), x = s.useRef(!1), [Le, ne] = s.useState(0);
|
|
343
343
|
return s.useEffect(() => {
|
|
344
|
-
const R =
|
|
344
|
+
const R = _.current;
|
|
345
345
|
if (R)
|
|
346
346
|
return R.addEventListener(K, E), () => R.removeEventListener(K, E);
|
|
347
347
|
}, [E]), /* @__PURE__ */ f(
|
|
@@ -349,9 +349,9 @@ var _r = s.forwardRef((e, t) => {
|
|
|
349
349
|
{
|
|
350
350
|
scope: n,
|
|
351
351
|
orientation: o,
|
|
352
|
-
dir:
|
|
352
|
+
dir: l,
|
|
353
353
|
loop: a,
|
|
354
|
-
currentTabStopId:
|
|
354
|
+
currentTabStopId: h,
|
|
355
355
|
onItemFocus: s.useCallback(
|
|
356
356
|
(R) => v(R),
|
|
357
357
|
[v]
|
|
@@ -370,8 +370,8 @@ var _r = s.forwardRef((e, t) => {
|
|
|
370
370
|
{
|
|
371
371
|
tabIndex: y || Le === 0 ? -1 : 0,
|
|
372
372
|
"data-orientation": o,
|
|
373
|
-
...
|
|
374
|
-
ref:
|
|
373
|
+
...m,
|
|
374
|
+
ref: d,
|
|
375
375
|
style: { outline: "none", ...e.style },
|
|
376
376
|
onMouseDown: N(e.onMouseDown, () => {
|
|
377
377
|
x.current = !0;
|
|
@@ -381,10 +381,10 @@ var _r = s.forwardRef((e, t) => {
|
|
|
381
381
|
if (R.target === R.currentTarget && qe && !y) {
|
|
382
382
|
const oe = new CustomEvent(K, pr);
|
|
383
383
|
if (R.currentTarget.dispatchEvent(oe), !oe.defaultPrevented) {
|
|
384
|
-
const V = O().filter((w) => w.focusable), Ue = V.find((w) => w.active), je = V.find((w) => w.id ===
|
|
384
|
+
const V = O().filter((w) => w.focusable), Ue = V.find((w) => w.active), je = V.find((w) => w.id === h), ze = [Ue, je, ...V].filter(
|
|
385
385
|
Boolean
|
|
386
386
|
).map((w) => w.ref.current);
|
|
387
|
-
Ie(ze,
|
|
387
|
+
Ie(ze, g);
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
x.current = !1;
|
|
@@ -402,44 +402,44 @@ var _r = s.forwardRef((e, t) => {
|
|
|
402
402
|
active: a = !1,
|
|
403
403
|
tabStopId: r,
|
|
404
404
|
...i
|
|
405
|
-
} = e, u = ur(),
|
|
405
|
+
} = e, u = ur(), c = r || u, p = mr(Se, n), g = p.currentTabStopId === c, m = be(n), { onFocusableItemAdd: _, onFocusableItemRemove: d } = p;
|
|
406
406
|
return s.useEffect(() => {
|
|
407
407
|
if (o)
|
|
408
|
-
return
|
|
409
|
-
}, [o,
|
|
408
|
+
return _(), () => d();
|
|
409
|
+
}, [o, _, d]), /* @__PURE__ */ f(
|
|
410
410
|
Z.ItemSlot,
|
|
411
411
|
{
|
|
412
412
|
scope: n,
|
|
413
|
-
id:
|
|
413
|
+
id: c,
|
|
414
414
|
focusable: o,
|
|
415
415
|
active: a,
|
|
416
416
|
children: /* @__PURE__ */ f(
|
|
417
417
|
$.span,
|
|
418
418
|
{
|
|
419
|
-
tabIndex:
|
|
420
|
-
"data-orientation":
|
|
419
|
+
tabIndex: g ? 0 : -1,
|
|
420
|
+
"data-orientation": p.orientation,
|
|
421
421
|
...i,
|
|
422
422
|
ref: t,
|
|
423
|
-
onMouseDown: N(e.onMouseDown, (
|
|
424
|
-
o ?
|
|
423
|
+
onMouseDown: N(e.onMouseDown, (l) => {
|
|
424
|
+
o ? p.onItemFocus(c) : l.preventDefault();
|
|
425
425
|
}),
|
|
426
|
-
onFocus: N(e.onFocus, () =>
|
|
427
|
-
onKeyDown: N(e.onKeyDown, (
|
|
428
|
-
if (
|
|
429
|
-
|
|
426
|
+
onFocus: N(e.onFocus, () => p.onItemFocus(c)),
|
|
427
|
+
onKeyDown: N(e.onKeyDown, (l) => {
|
|
428
|
+
if (l.key === "Tab" && l.shiftKey) {
|
|
429
|
+
p.onItemShiftTab();
|
|
430
430
|
return;
|
|
431
431
|
}
|
|
432
|
-
if (
|
|
433
|
-
const
|
|
434
|
-
if (
|
|
435
|
-
if (
|
|
436
|
-
|
|
437
|
-
let y =
|
|
438
|
-
if (
|
|
439
|
-
else if (
|
|
440
|
-
|
|
441
|
-
const b = y.indexOf(
|
|
442
|
-
y =
|
|
432
|
+
if (l.target !== l.currentTarget) return;
|
|
433
|
+
const h = vr(l, p.orientation, p.dir);
|
|
434
|
+
if (h !== void 0) {
|
|
435
|
+
if (l.metaKey || l.ctrlKey || l.altKey || l.shiftKey) return;
|
|
436
|
+
l.preventDefault();
|
|
437
|
+
let y = m().filter((b) => b.focusable).map((b) => b.ref.current);
|
|
438
|
+
if (h === "last") y.reverse();
|
|
439
|
+
else if (h === "prev" || h === "next") {
|
|
440
|
+
h === "prev" && y.reverse();
|
|
441
|
+
const b = y.indexOf(l.currentTarget);
|
|
442
|
+
y = p.loop ? yr(y, b + 1) : y.slice(b + 1);
|
|
443
443
|
}
|
|
444
444
|
setTimeout(() => Ie(y));
|
|
445
445
|
}
|
|
@@ -489,8 +489,8 @@ function Cr(e) {
|
|
|
489
489
|
const r = a[0];
|
|
490
490
|
let i, u;
|
|
491
491
|
if ("borderBoxSize" in r) {
|
|
492
|
-
const
|
|
493
|
-
i =
|
|
492
|
+
const c = r.borderBoxSize, p = Array.isArray(c) ? c[0] : c;
|
|
493
|
+
i = p.inlineSize, u = p.blockSize;
|
|
494
494
|
} else
|
|
495
495
|
i = e.offsetWidth, u = e.offsetHeight;
|
|
496
496
|
n({ width: i, height: u });
|
|
@@ -513,7 +513,7 @@ var we = (e) => {
|
|
|
513
513
|
};
|
|
514
514
|
we.displayName = "Presence";
|
|
515
515
|
function Ir(e) {
|
|
516
|
-
const [t, n] = s.useState(), o = s.useRef({}), a = s.useRef(e), r = s.useRef("none"), i = e ? "mounted" : "unmounted", [u,
|
|
516
|
+
const [t, n] = s.useState(), o = s.useRef({}), a = s.useRef(e), r = s.useRef("none"), i = e ? "mounted" : "unmounted", [u, c] = Nr(i, {
|
|
517
517
|
mounted: {
|
|
518
518
|
UNMOUNT: "unmounted",
|
|
519
519
|
ANIMATION_OUT: "unmountSuspended"
|
|
@@ -527,37 +527,37 @@ function Ir(e) {
|
|
|
527
527
|
}
|
|
528
528
|
});
|
|
529
529
|
return s.useEffect(() => {
|
|
530
|
-
const
|
|
531
|
-
r.current = u === "mounted" ?
|
|
530
|
+
const p = D(o.current);
|
|
531
|
+
r.current = u === "mounted" ? p : "none";
|
|
532
532
|
}, [u]), U(() => {
|
|
533
|
-
const
|
|
534
|
-
if (
|
|
535
|
-
const
|
|
536
|
-
e ?
|
|
533
|
+
const p = o.current, g = a.current;
|
|
534
|
+
if (g !== e) {
|
|
535
|
+
const _ = r.current, d = D(p);
|
|
536
|
+
e ? c("MOUNT") : d === "none" || (p == null ? void 0 : p.display) === "none" ? c("UNMOUNT") : c(g && _ !== d ? "ANIMATION_OUT" : "UNMOUNT"), a.current = e;
|
|
537
537
|
}
|
|
538
|
-
}, [e,
|
|
538
|
+
}, [e, c]), U(() => {
|
|
539
539
|
if (t) {
|
|
540
|
-
let
|
|
541
|
-
const
|
|
542
|
-
const
|
|
543
|
-
if (
|
|
540
|
+
let p;
|
|
541
|
+
const g = t.ownerDocument.defaultView ?? window, m = (d) => {
|
|
542
|
+
const h = D(o.current).includes(d.animationName);
|
|
543
|
+
if (d.target === t && h && (c("ANIMATION_END"), !a.current)) {
|
|
544
544
|
const v = t.style.animationFillMode;
|
|
545
|
-
t.style.animationFillMode = "forwards",
|
|
545
|
+
t.style.animationFillMode = "forwards", p = g.setTimeout(() => {
|
|
546
546
|
t.style.animationFillMode === "forwards" && (t.style.animationFillMode = v);
|
|
547
547
|
});
|
|
548
548
|
}
|
|
549
|
-
},
|
|
550
|
-
|
|
549
|
+
}, _ = (d) => {
|
|
550
|
+
d.target === t && (r.current = D(o.current));
|
|
551
551
|
};
|
|
552
|
-
return t.addEventListener("animationstart",
|
|
553
|
-
|
|
552
|
+
return t.addEventListener("animationstart", _), t.addEventListener("animationcancel", m), t.addEventListener("animationend", m), () => {
|
|
553
|
+
g.clearTimeout(p), t.removeEventListener("animationstart", _), t.removeEventListener("animationcancel", m), t.removeEventListener("animationend", m);
|
|
554
554
|
};
|
|
555
555
|
} else
|
|
556
|
-
|
|
557
|
-
}, [t,
|
|
556
|
+
c("ANIMATION_END");
|
|
557
|
+
}, [t, c]), {
|
|
558
558
|
isPresent: ["mounted", "unmountSuspended"].includes(u),
|
|
559
|
-
ref: s.useCallback((
|
|
560
|
-
|
|
559
|
+
ref: s.useCallback((p) => {
|
|
560
|
+
p && (o.current = getComputedStyle(p)), n(p);
|
|
561
561
|
}, [])
|
|
562
562
|
};
|
|
563
563
|
}
|
|
@@ -578,10 +578,10 @@ var ee = "Radio", [Ar, Ae] = j(ee), [Er, Or] = Ar(ee), Ee = s.forwardRef(
|
|
|
578
578
|
required: r,
|
|
579
579
|
disabled: i,
|
|
580
580
|
value: u = "on",
|
|
581
|
-
onCheck:
|
|
582
|
-
form:
|
|
583
|
-
...
|
|
584
|
-
} = e, [
|
|
581
|
+
onCheck: c,
|
|
582
|
+
form: p,
|
|
583
|
+
...g
|
|
584
|
+
} = e, [m, _] = s.useState(null), d = P(t, (v) => _(v)), l = s.useRef(!1), h = m ? p || !!m.closest("form") : !0;
|
|
585
585
|
return /* @__PURE__ */ I(Er, { scope: n, checked: a, disabled: i, children: [
|
|
586
586
|
/* @__PURE__ */ f(
|
|
587
587
|
$.button,
|
|
@@ -593,24 +593,24 @@ var ee = "Radio", [Ar, Ae] = j(ee), [Er, Or] = Ar(ee), Ee = s.forwardRef(
|
|
|
593
593
|
"data-disabled": i ? "" : void 0,
|
|
594
594
|
disabled: i,
|
|
595
595
|
value: u,
|
|
596
|
-
...
|
|
597
|
-
ref:
|
|
596
|
+
...g,
|
|
597
|
+
ref: d,
|
|
598
598
|
onClick: N(e.onClick, (v) => {
|
|
599
|
-
a ||
|
|
599
|
+
a || c == null || c(), h && (l.current = v.isPropagationStopped(), l.current || v.stopPropagation());
|
|
600
600
|
})
|
|
601
601
|
}
|
|
602
602
|
),
|
|
603
|
-
|
|
603
|
+
h && /* @__PURE__ */ f(
|
|
604
604
|
Pr,
|
|
605
605
|
{
|
|
606
|
-
control:
|
|
607
|
-
bubbles: !
|
|
606
|
+
control: m,
|
|
607
|
+
bubbles: !l.current,
|
|
608
608
|
name: o,
|
|
609
609
|
value: u,
|
|
610
610
|
checked: a,
|
|
611
611
|
required: r,
|
|
612
612
|
disabled: i,
|
|
613
|
-
form:
|
|
613
|
+
form: p,
|
|
614
614
|
style: { transform: "translateX(-100%)" }
|
|
615
615
|
}
|
|
616
616
|
)
|
|
@@ -636,10 +636,10 @@ Pe.displayName = Oe;
|
|
|
636
636
|
var Pr = (e) => {
|
|
637
637
|
const { control: t, checked: n, bubbles: o = !0, ...a } = e, r = s.useRef(null), i = Sr(n), u = Cr(t);
|
|
638
638
|
return s.useEffect(() => {
|
|
639
|
-
const
|
|
640
|
-
if (i !== n &&
|
|
641
|
-
const
|
|
642
|
-
|
|
639
|
+
const c = r.current, p = window.HTMLInputElement.prototype, m = Object.getOwnPropertyDescriptor(p, "checked").set;
|
|
640
|
+
if (i !== n && m) {
|
|
641
|
+
const _ = new Event("click", { bubbles: o });
|
|
642
|
+
m.call(c, n), c.dispatchEvent(_);
|
|
643
643
|
}
|
|
644
644
|
}, [i, n, o]), /* @__PURE__ */ f(
|
|
645
645
|
"input",
|
|
@@ -676,15 +676,15 @@ var xr = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], re = "RadioGroup",
|
|
|
676
676
|
value: r,
|
|
677
677
|
required: i = !1,
|
|
678
678
|
disabled: u = !1,
|
|
679
|
-
orientation:
|
|
680
|
-
dir:
|
|
681
|
-
loop:
|
|
682
|
-
onValueChange:
|
|
683
|
-
...
|
|
684
|
-
} = e,
|
|
679
|
+
orientation: c,
|
|
680
|
+
dir: p,
|
|
681
|
+
loop: g = !0,
|
|
682
|
+
onValueChange: m,
|
|
683
|
+
..._
|
|
684
|
+
} = e, d = ke(n), l = ye(p), [h, v] = ve({
|
|
685
685
|
prop: r,
|
|
686
686
|
defaultProp: a,
|
|
687
|
-
onChange:
|
|
687
|
+
onChange: m
|
|
688
688
|
});
|
|
689
689
|
return /* @__PURE__ */ f(
|
|
690
690
|
Tr,
|
|
@@ -693,25 +693,25 @@ var xr = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], re = "RadioGroup",
|
|
|
693
693
|
name: o,
|
|
694
694
|
required: i,
|
|
695
695
|
disabled: u,
|
|
696
|
-
value:
|
|
696
|
+
value: h,
|
|
697
697
|
onValueChange: v,
|
|
698
698
|
children: /* @__PURE__ */ f(
|
|
699
699
|
br,
|
|
700
700
|
{
|
|
701
701
|
asChild: !0,
|
|
702
|
-
...
|
|
703
|
-
orientation:
|
|
704
|
-
dir:
|
|
705
|
-
loop:
|
|
702
|
+
...d,
|
|
703
|
+
orientation: c,
|
|
704
|
+
dir: l,
|
|
705
|
+
loop: g,
|
|
706
706
|
children: /* @__PURE__ */ f(
|
|
707
707
|
$.div,
|
|
708
708
|
{
|
|
709
709
|
role: "radiogroup",
|
|
710
710
|
"aria-required": i,
|
|
711
|
-
"aria-orientation":
|
|
711
|
+
"aria-orientation": c,
|
|
712
712
|
"data-disabled": u ? "" : void 0,
|
|
713
|
-
dir:
|
|
714
|
-
...
|
|
713
|
+
dir: l,
|
|
714
|
+
..._,
|
|
715
715
|
ref: t
|
|
716
716
|
}
|
|
717
717
|
)
|
|
@@ -724,13 +724,13 @@ var xr = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], re = "RadioGroup",
|
|
|
724
724
|
$e.displayName = re;
|
|
725
725
|
var Me = "RadioGroupItem", Fe = s.forwardRef(
|
|
726
726
|
(e, t) => {
|
|
727
|
-
const { __scopeRadioGroup: n, disabled: o, ...a } = e, r = $r(Me, n), i = r.disabled || o, u = ke(n),
|
|
727
|
+
const { __scopeRadioGroup: n, disabled: o, ...a } = e, r = $r(Me, n), i = r.disabled || o, u = ke(n), c = Te(n), p = s.useRef(null), g = P(t, p), m = r.value === a.value, _ = s.useRef(!1);
|
|
728
728
|
return s.useEffect(() => {
|
|
729
|
-
const
|
|
730
|
-
xr.includes(
|
|
731
|
-
},
|
|
732
|
-
return document.addEventListener("keydown",
|
|
733
|
-
document.removeEventListener("keydown",
|
|
729
|
+
const d = (h) => {
|
|
730
|
+
xr.includes(h.key) && (_.current = !0);
|
|
731
|
+
}, l = () => _.current = !1;
|
|
732
|
+
return document.addEventListener("keydown", d), document.addEventListener("keyup", l), () => {
|
|
733
|
+
document.removeEventListener("keydown", d), document.removeEventListener("keyup", l);
|
|
734
734
|
};
|
|
735
735
|
}, []), /* @__PURE__ */ f(
|
|
736
736
|
Rr,
|
|
@@ -738,24 +738,24 @@ var Me = "RadioGroupItem", Fe = s.forwardRef(
|
|
|
738
738
|
asChild: !0,
|
|
739
739
|
...u,
|
|
740
740
|
focusable: !i,
|
|
741
|
-
active:
|
|
741
|
+
active: m,
|
|
742
742
|
children: /* @__PURE__ */ f(
|
|
743
743
|
Ee,
|
|
744
744
|
{
|
|
745
745
|
disabled: i,
|
|
746
746
|
required: r.required,
|
|
747
|
-
checked:
|
|
748
|
-
...
|
|
747
|
+
checked: m,
|
|
748
|
+
...c,
|
|
749
749
|
...a,
|
|
750
750
|
name: r.name,
|
|
751
|
-
ref:
|
|
751
|
+
ref: g,
|
|
752
752
|
onCheck: () => r.onValueChange(a.value),
|
|
753
|
-
onKeyDown: N((
|
|
754
|
-
|
|
753
|
+
onKeyDown: N((d) => {
|
|
754
|
+
d.key === "Enter" && d.preventDefault();
|
|
755
755
|
}),
|
|
756
756
|
onFocus: N(a.onFocus, () => {
|
|
757
|
-
var
|
|
758
|
-
|
|
757
|
+
var d;
|
|
758
|
+
_.current && ((d = p.current) == null || d.click());
|
|
759
759
|
})
|
|
760
760
|
}
|
|
761
761
|
)
|
|
@@ -906,7 +906,7 @@ const Wr = /* @__PURE__ */ Vr(Br), k = {
|
|
|
906
906
|
variant: i = Hr.PARAGRAPH100,
|
|
907
907
|
...u
|
|
908
908
|
}) => {
|
|
909
|
-
const
|
|
909
|
+
const c = Wr([
|
|
910
910
|
n,
|
|
911
911
|
k[T],
|
|
912
912
|
k[`${T}--${i}`],
|
|
@@ -916,7 +916,7 @@ const Wr = /* @__PURE__ */ Vr(Br), k = {
|
|
|
916
916
|
[k[`${T}--negative`]]: r
|
|
917
917
|
}
|
|
918
918
|
]);
|
|
919
|
-
return /* @__PURE__ */ f("p", { ...u, className:
|
|
919
|
+
return /* @__PURE__ */ f("p", { ...u, className: c, "data-testid": e, children: t });
|
|
920
920
|
};
|
|
921
921
|
J.displayName = "Paragraph";
|
|
922
922
|
function Yr(e) {
|
|
@@ -996,9 +996,9 @@ const G = "purpur-radio-card-group__item-image", et = (e) => !!(e != null && e.s
|
|
|
996
996
|
loading: o = "lazy",
|
|
997
997
|
["data-testid"]: a
|
|
998
998
|
}) => {
|
|
999
|
-
const [r, i] = Ve(!1), u = () => i(!0),
|
|
999
|
+
const [r, i] = Ve(!1), u = () => i(!0), c = C(G, {
|
|
1000
1000
|
[`${G}--loaded`]: r
|
|
1001
|
-
}),
|
|
1001
|
+
}), p = C(`${G}-placeholder`, {
|
|
1002
1002
|
[`${G}-placeholder--loaded`]: r
|
|
1003
1003
|
});
|
|
1004
1004
|
return /* @__PURE__ */ I(me, { children: [
|
|
@@ -1006,14 +1006,14 @@ const G = "purpur-radio-card-group__item-image", et = (e) => !!(e != null && e.s
|
|
|
1006
1006
|
"img",
|
|
1007
1007
|
{
|
|
1008
1008
|
"data-testid": a,
|
|
1009
|
-
className:
|
|
1009
|
+
className: c,
|
|
1010
1010
|
src: e,
|
|
1011
1011
|
alt: t,
|
|
1012
1012
|
loading: o,
|
|
1013
1013
|
onLoad: u
|
|
1014
1014
|
}
|
|
1015
1015
|
),
|
|
1016
|
-
!n && /* @__PURE__ */ f(Ge, { className:
|
|
1016
|
+
!n && /* @__PURE__ */ f(Ge, { className: p })
|
|
1017
1017
|
] });
|
|
1018
1018
|
}, S = "purpur-radio-card-group__item", Y = (e, { disabled: t }) => typeof e == "function" ? e({ disabled: t }) : e, tt = ({ title: e, ...t }, n) => {
|
|
1019
1019
|
const {
|
|
@@ -1022,10 +1022,10 @@ const G = "purpur-radio-card-group__item-image", et = (e) => !!(e != null && e.s
|
|
|
1022
1022
|
children: r,
|
|
1023
1023
|
disabled: i,
|
|
1024
1024
|
id: u,
|
|
1025
|
-
image:
|
|
1026
|
-
required:
|
|
1027
|
-
value:
|
|
1028
|
-
} = t,
|
|
1025
|
+
image: c,
|
|
1026
|
+
required: p,
|
|
1027
|
+
value: g
|
|
1028
|
+
} = t, m = { ...t };
|
|
1029
1029
|
return /* @__PURE__ */ I("div", { className: C(`${S}-container`), ref: n, children: [
|
|
1030
1030
|
/* @__PURE__ */ I(
|
|
1031
1031
|
Dr,
|
|
@@ -1034,10 +1034,10 @@ const G = "purpur-radio-card-group__item-image", et = (e) => !!(e != null && e.s
|
|
|
1034
1034
|
"data-testid": o,
|
|
1035
1035
|
disabled: i,
|
|
1036
1036
|
id: u,
|
|
1037
|
-
required:
|
|
1038
|
-
value:
|
|
1037
|
+
required: p,
|
|
1038
|
+
value: g,
|
|
1039
1039
|
children: [
|
|
1040
|
-
|
|
1040
|
+
c && /* @__PURE__ */ f("span", { className: C(`${S}-image-container`), children: et(c) ? /* @__PURE__ */ f(rt, { ...c, "data-testid": o && `${o}-image` }) : Y(c, m) }),
|
|
1041
1041
|
/* @__PURE__ */ I("span", { className: C(`${S}-content`), children: [
|
|
1042
1042
|
/* @__PURE__ */ I("span", { className: C(`${S}-top-container`), children: [
|
|
1043
1043
|
typeof e == "string" ? /* @__PURE__ */ f(
|
|
@@ -1049,7 +1049,7 @@ const G = "purpur-radio-card-group__item-image", et = (e) => !!(e != null && e.s
|
|
|
1049
1049
|
disabled: i,
|
|
1050
1050
|
children: e
|
|
1051
1051
|
}
|
|
1052
|
-
) : Y(e,
|
|
1052
|
+
) : Y(e, m),
|
|
1053
1053
|
/* @__PURE__ */ f("span", { className: C(`${S}-radio`), children: /* @__PURE__ */ f(Gr, { className: C(`${S}-indicator`) }) })
|
|
1054
1054
|
] }),
|
|
1055
1055
|
a && /* @__PURE__ */ f("span", { className: C(`${S}-bottom-container`), children: typeof a == "string" ? /* @__PURE__ */ f(
|
|
@@ -1060,7 +1060,7 @@ const G = "purpur-radio-card-group__item-image", et = (e) => !!(e != null && e.s
|
|
|
1060
1060
|
disabled: i,
|
|
1061
1061
|
children: a
|
|
1062
1062
|
}
|
|
1063
|
-
) : Y(a,
|
|
1063
|
+
) : Y(a, m) })
|
|
1064
1064
|
] })
|
|
1065
1065
|
]
|
|
1066
1066
|
}
|
|
@@ -1076,48 +1076,49 @@ const nt = (e) => Ke(e) && (e == null ? void 0 : e.type) === te, dt = ["horizont
|
|
|
1076
1076
|
className: o,
|
|
1077
1077
|
items: a,
|
|
1078
1078
|
label: r,
|
|
1079
|
-
|
|
1080
|
-
|
|
1079
|
+
labelTag: i = "h2",
|
|
1080
|
+
loop: u = !0,
|
|
1081
|
+
orientation: c = "vertical",
|
|
1081
1082
|
radioPosition: p = "right",
|
|
1082
|
-
...
|
|
1083
|
-
},
|
|
1084
|
-
const
|
|
1085
|
-
return /* @__PURE__ */ I("div", { className: C(o, `${L}__container`), ref:
|
|
1083
|
+
...g
|
|
1084
|
+
}, m) => {
|
|
1085
|
+
const _ = ae.toArray(n).filter(nt);
|
|
1086
|
+
return /* @__PURE__ */ I("div", { className: C(o, `${L}__container`), ref: m, children: [
|
|
1086
1087
|
r && /* @__PURE__ */ f(
|
|
1087
1088
|
ge,
|
|
1088
1089
|
{
|
|
1089
1090
|
"data-testid": e ? `${e}-label` : void 0,
|
|
1090
|
-
id: `${
|
|
1091
|
-
tag:
|
|
1091
|
+
id: `${g.id}-label`,
|
|
1092
|
+
tag: i,
|
|
1092
1093
|
variant: "subsection-100",
|
|
1093
|
-
children: `${
|
|
1094
|
+
children: `${g.required ? "* " : ""}${r}`
|
|
1094
1095
|
}
|
|
1095
1096
|
),
|
|
1096
|
-
(!!(a != null && a.length) ||
|
|
1097
|
+
(!!(a != null && a.length) || _.length) && /* @__PURE__ */ I(
|
|
1097
1098
|
Fr,
|
|
1098
1099
|
{
|
|
1099
|
-
...
|
|
1100
|
-
"aria-labelledby": t || (r ? `${
|
|
1100
|
+
...g,
|
|
1101
|
+
"aria-labelledby": t || (r ? `${g.id}-label` : void 0),
|
|
1101
1102
|
className: C(
|
|
1102
1103
|
L,
|
|
1103
|
-
`${L}--${
|
|
1104
|
+
`${L}--${c}`,
|
|
1104
1105
|
`${L}--radio-${p}`
|
|
1105
1106
|
),
|
|
1106
1107
|
"data-testid": e,
|
|
1107
|
-
loop:
|
|
1108
|
+
loop: u,
|
|
1108
1109
|
children: [
|
|
1109
|
-
a == null ? void 0 : a.map((
|
|
1110
|
+
a == null ? void 0 : a.map((d) => /* @__PURE__ */ f(
|
|
1110
1111
|
te,
|
|
1111
1112
|
{
|
|
1112
|
-
...
|
|
1113
|
-
disabled:
|
|
1113
|
+
...d,
|
|
1114
|
+
disabled: d.disabled || g.disabled,
|
|
1114
1115
|
"data-testid": e ? `${e}-item` : void 0
|
|
1115
1116
|
},
|
|
1116
|
-
|
|
1117
|
+
d.id
|
|
1117
1118
|
)),
|
|
1118
1119
|
ae.map(
|
|
1119
|
-
|
|
1120
|
-
(
|
|
1120
|
+
_,
|
|
1121
|
+
(d) => Be(d, { disabled: d.props.disabled || g.disabled })
|
|
1121
1122
|
)
|
|
1122
1123
|
]
|
|
1123
1124
|
}
|