@purpurds/radio-card-group 7.13.1 → 8.0.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as f, Fragment as le, jsxs as N } from "react/jsx-runtime";
|
|
2
2
|
import * as s from "react";
|
|
3
|
-
import A, { useState as
|
|
3
|
+
import A, { useState as je, forwardRef as fe, isValidElement as Ve, Children as ne, cloneElement as Ke } from "react";
|
|
4
4
|
import "react-dom";
|
|
5
5
|
function Be(e) {
|
|
6
6
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
@@ -45,7 +45,7 @@ function We() {
|
|
|
45
45
|
}(oe)), oe.exports;
|
|
46
46
|
}
|
|
47
47
|
var qe = We();
|
|
48
|
-
const He = /* @__PURE__ */ Be(qe),
|
|
48
|
+
const He = /* @__PURE__ */ Be(qe), M = {
|
|
49
49
|
"purpur-heading": "_purpur-heading_vo751_1",
|
|
50
50
|
"purpur-heading--hyphens": "_purpur-heading--hyphens_vo751_8",
|
|
51
51
|
"purpur-heading--negative": "_purpur-heading--negative_vo751_11",
|
|
@@ -78,11 +78,11 @@ const He = /* @__PURE__ */ Be(qe), $ = {
|
|
|
78
78
|
}) => {
|
|
79
79
|
const u = a, c = He([
|
|
80
80
|
t,
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
M[F],
|
|
82
|
+
M[`${F}--${r}`],
|
|
83
83
|
{
|
|
84
|
-
[
|
|
85
|
-
[
|
|
84
|
+
[M[`${F}--hyphens`]]: n,
|
|
85
|
+
[M[`${F}--negative`]]: o
|
|
86
86
|
}
|
|
87
87
|
]);
|
|
88
88
|
return /* @__PURE__ */ f(u, { className: c, ...i, children: e });
|
|
@@ -118,7 +118,7 @@ function me(...e) {
|
|
|
118
118
|
function P(...e) {
|
|
119
119
|
return s.useCallback(me(...e), e);
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function U(e, t = []) {
|
|
122
122
|
let n = [];
|
|
123
123
|
function o(r, i) {
|
|
124
124
|
const u = s.createContext(i), c = n.length;
|
|
@@ -222,7 +222,7 @@ var rr = [
|
|
|
222
222
|
"span",
|
|
223
223
|
"svg",
|
|
224
224
|
"ul"
|
|
225
|
-
],
|
|
225
|
+
], $ = rr.reduce((e, t) => {
|
|
226
226
|
const n = s.forwardRef((o, a) => {
|
|
227
227
|
const { asChild: r, ...i } = o, u = r ? L : t;
|
|
228
228
|
return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ f(u, { ...i, ref: a });
|
|
@@ -230,7 +230,7 @@ var rr = [
|
|
|
230
230
|
return n.displayName = `Primitive.${t}`, { ...e, [t]: n };
|
|
231
231
|
}, {});
|
|
232
232
|
function tr(e) {
|
|
233
|
-
const t = e + "CollectionProvider", [n, o] =
|
|
233
|
+
const t = e + "CollectionProvider", [n, o] = U(t), [a, r] = n(
|
|
234
234
|
t,
|
|
235
235
|
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
236
236
|
), i = (d) => {
|
|
@@ -269,12 +269,12 @@ function tr(e) {
|
|
|
269
269
|
o
|
|
270
270
|
];
|
|
271
271
|
}
|
|
272
|
-
var
|
|
272
|
+
var z = globalThis != null && globalThis.document ? s.useLayoutEffect : () => {
|
|
273
273
|
}, nr = s.useId || (() => {
|
|
274
274
|
}), or = 0;
|
|
275
275
|
function ar(e) {
|
|
276
276
|
const [t, n] = s.useState(nr());
|
|
277
|
-
return
|
|
277
|
+
return z(() => {
|
|
278
278
|
n((o) => o ?? String(or++));
|
|
279
279
|
}, [e]), t ? `radix-${t}` : "";
|
|
280
280
|
}
|
|
@@ -319,13 +319,13 @@ function he(e) {
|
|
|
319
319
|
const t = s.useContext(ur);
|
|
320
320
|
return e || t || "ltr";
|
|
321
321
|
}
|
|
322
|
-
var K = "rovingFocusGroup.onEntryFocus", sr = { bubbles: !1, cancelable: !0 },
|
|
323
|
-
|
|
322
|
+
var K = "rovingFocusGroup.onEntryFocus", sr = { bubbles: !1, cancelable: !0 }, j = "RovingFocusGroup", [Y, ve, cr] = tr(j), [pr, ye] = U(
|
|
323
|
+
j,
|
|
324
324
|
[cr]
|
|
325
|
-
), [dr, lr] = pr(
|
|
325
|
+
), [dr, lr] = pr(j), be = s.forwardRef(
|
|
326
326
|
(e, t) => /* @__PURE__ */ f(Y.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ f(Y.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ f(fr, { ...e, ref: t }) }) })
|
|
327
327
|
);
|
|
328
|
-
be.displayName =
|
|
328
|
+
be.displayName = j;
|
|
329
329
|
var fr = s.forwardRef((e, t) => {
|
|
330
330
|
const {
|
|
331
331
|
__scopeRovingFocusGroup: n,
|
|
@@ -369,7 +369,7 @@ var fr = s.forwardRef((e, t) => {
|
|
|
369
369
|
[]
|
|
370
370
|
),
|
|
371
371
|
children: /* @__PURE__ */ f(
|
|
372
|
-
|
|
372
|
+
$.div,
|
|
373
373
|
{
|
|
374
374
|
tabIndex: y || De === 0 ? -1 : 0,
|
|
375
375
|
"data-orientation": o,
|
|
@@ -384,10 +384,10 @@ var fr = s.forwardRef((e, t) => {
|
|
|
384
384
|
if (R.target === R.currentTarget && Ge && !y) {
|
|
385
385
|
const te = new CustomEvent(K, sr);
|
|
386
386
|
if (R.currentTarget.dispatchEvent(te), !te.defaultPrevented) {
|
|
387
|
-
const V = O().filter((w) => w.focusable), Le = V.find((w) => w.active),
|
|
387
|
+
const V = O().filter((w) => w.focusable), Le = V.find((w) => w.active), ze = V.find((w) => w.id === h), Ue = [Le, ze, ...V].filter(
|
|
388
388
|
Boolean
|
|
389
389
|
).map((w) => w.ref.current);
|
|
390
|
-
Se(
|
|
390
|
+
Se(Ue, m);
|
|
391
391
|
}
|
|
392
392
|
}
|
|
393
393
|
x.current = !1;
|
|
@@ -417,7 +417,7 @@ var fr = s.forwardRef((e, t) => {
|
|
|
417
417
|
focusable: o,
|
|
418
418
|
active: a,
|
|
419
419
|
children: /* @__PURE__ */ f(
|
|
420
|
-
|
|
420
|
+
$.span,
|
|
421
421
|
{
|
|
422
422
|
tabIndex: m ? 0 : -1,
|
|
423
423
|
"data-orientation": p.orientation,
|
|
@@ -483,7 +483,7 @@ function hr(e, t) {
|
|
|
483
483
|
var vr = be, yr = Ce;
|
|
484
484
|
function br(e) {
|
|
485
485
|
const [t, n] = s.useState(void 0);
|
|
486
|
-
return
|
|
486
|
+
return z(() => {
|
|
487
487
|
if (e) {
|
|
488
488
|
n({ width: e.offsetWidth, height: e.offsetHeight });
|
|
489
489
|
const o = new ResizeObserver((a) => {
|
|
@@ -532,13 +532,13 @@ function Sr(e) {
|
|
|
532
532
|
return s.useEffect(() => {
|
|
533
533
|
const p = k(o.current);
|
|
534
534
|
r.current = u === "mounted" ? p : "none";
|
|
535
|
-
}, [u]),
|
|
535
|
+
}, [u]), z(() => {
|
|
536
536
|
const p = o.current, m = a.current;
|
|
537
537
|
if (m !== e) {
|
|
538
538
|
const g = r.current, d = k(p);
|
|
539
539
|
e ? c("MOUNT") : d === "none" || (p == null ? void 0 : p.display) === "none" ? c("UNMOUNT") : c(m && g !== d ? "ANIMATION_OUT" : "UNMOUNT"), a.current = e;
|
|
540
540
|
}
|
|
541
|
-
}, [e, c]),
|
|
541
|
+
}, [e, c]), z(() => {
|
|
542
542
|
if (t) {
|
|
543
543
|
let p;
|
|
544
544
|
const m = t.ownerDocument.defaultView ?? window, _ = (d) => {
|
|
@@ -572,7 +572,7 @@ function Nr(e) {
|
|
|
572
572
|
let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning;
|
|
573
573
|
return n ? e.ref : (t = (a = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : a.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
|
|
574
574
|
}
|
|
575
|
-
var J = "Radio", [Ir, Ie] =
|
|
575
|
+
var J = "Radio", [Ir, Ie] = U(J), [wr, Ar] = Ir(J), we = s.forwardRef(
|
|
576
576
|
(e, t) => {
|
|
577
577
|
const {
|
|
578
578
|
__scopeRadio: n,
|
|
@@ -587,7 +587,7 @@ var J = "Radio", [Ir, Ie] = j(J), [wr, Ar] = Ir(J), we = s.forwardRef(
|
|
|
587
587
|
} = e, [_, g] = s.useState(null), d = P(t, (v) => g(v)), l = s.useRef(!1), h = _ ? p || !!_.closest("form") : !0;
|
|
588
588
|
return /* @__PURE__ */ N(wr, { scope: n, checked: a, disabled: i, children: [
|
|
589
589
|
/* @__PURE__ */ f(
|
|
590
|
-
|
|
590
|
+
$.button,
|
|
591
591
|
{
|
|
592
592
|
type: "button",
|
|
593
593
|
role: "radio",
|
|
@@ -625,7 +625,7 @@ var Ae = "RadioIndicator", Ee = s.forwardRef(
|
|
|
625
625
|
(e, t) => {
|
|
626
626
|
const { __scopeRadio: n, forceMount: o, ...a } = e, r = Ar(Ae, n);
|
|
627
627
|
return /* @__PURE__ */ f(Ne, { present: o || r.checked, children: /* @__PURE__ */ f(
|
|
628
|
-
|
|
628
|
+
$.span,
|
|
629
629
|
{
|
|
630
630
|
"data-state": Oe(r.checked),
|
|
631
631
|
"data-disabled": r.disabled ? "" : void 0,
|
|
@@ -667,7 +667,7 @@ var Er = (e) => {
|
|
|
667
667
|
function Oe(e) {
|
|
668
668
|
return e ? "checked" : "unchecked";
|
|
669
669
|
}
|
|
670
|
-
var Or = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], Q = "RadioGroup", [Pr, pt] =
|
|
670
|
+
var Or = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], Q = "RadioGroup", [Pr, pt] = U(Q, [
|
|
671
671
|
ye,
|
|
672
672
|
Ie
|
|
673
673
|
]), Pe = ye(), xe = Ie(), [xr, Tr] = Pr(Q), Te = s.forwardRef(
|
|
@@ -707,7 +707,7 @@ var Or = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], Q = "RadioGroup",
|
|
|
707
707
|
dir: l,
|
|
708
708
|
loop: m,
|
|
709
709
|
children: /* @__PURE__ */ f(
|
|
710
|
-
|
|
710
|
+
$.div,
|
|
711
711
|
{
|
|
712
712
|
role: "radiogroup",
|
|
713
713
|
"aria-required": i,
|
|
@@ -725,9 +725,9 @@ var Or = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], Q = "RadioGroup",
|
|
|
725
725
|
}
|
|
726
726
|
);
|
|
727
727
|
Te.displayName = Q;
|
|
728
|
-
var
|
|
728
|
+
var $e = "RadioGroupItem", Me = s.forwardRef(
|
|
729
729
|
(e, t) => {
|
|
730
|
-
const { __scopeRadioGroup: n, disabled: o, ...a } = e, r = Tr(
|
|
730
|
+
const { __scopeRadioGroup: n, disabled: o, ...a } = e, r = Tr($e, n), i = r.disabled || o, u = Pe(n), c = xe(n), p = s.useRef(null), m = P(t, p), _ = r.value === a.value, g = s.useRef(!1);
|
|
731
731
|
return s.useEffect(() => {
|
|
732
732
|
const d = (h) => {
|
|
733
733
|
Or.includes(h.key) && (g.current = !0);
|
|
@@ -766,15 +766,15 @@ var Me = "RadioGroupItem", $e = s.forwardRef(
|
|
|
766
766
|
);
|
|
767
767
|
}
|
|
768
768
|
);
|
|
769
|
-
|
|
770
|
-
var
|
|
769
|
+
Me.displayName = $e;
|
|
770
|
+
var $r = "RadioGroupIndicator", Fe = s.forwardRef(
|
|
771
771
|
(e, t) => {
|
|
772
772
|
const { __scopeRadioGroup: n, ...o } = e, a = xe(n);
|
|
773
773
|
return /* @__PURE__ */ f(Ee, { ...a, ...o, ref: t });
|
|
774
774
|
}
|
|
775
775
|
);
|
|
776
|
-
Fe.displayName =
|
|
777
|
-
var
|
|
776
|
+
Fe.displayName = $r;
|
|
777
|
+
var Mr = Te, Fr = Me, kr = Fe;
|
|
778
778
|
function Dr(e) {
|
|
779
779
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
780
780
|
}
|
|
@@ -818,7 +818,7 @@ function Gr() {
|
|
|
818
818
|
}(B)), B.exports;
|
|
819
819
|
}
|
|
820
820
|
var Lr = Gr();
|
|
821
|
-
const
|
|
821
|
+
const zr = /* @__PURE__ */ Dr(Lr), Ur = {
|
|
822
822
|
"purpur-radio-card-group": "_purpur-radio-card-group_19msf_1",
|
|
823
823
|
"purpur-radio-card-group--vertical": "_purpur-radio-card-group--vertical_19msf_5",
|
|
824
824
|
"purpur-radio-card-group--horizontal": "_purpur-radio-card-group--horizontal_19msf_9",
|
|
@@ -838,8 +838,8 @@ const Ur = /* @__PURE__ */ Dr(Lr), jr = {
|
|
|
838
838
|
"purpur-radio-card-group__item-image-placeholder": "_purpur-radio-card-group__item-image-placeholder_19msf_167",
|
|
839
839
|
"purpur-radio-card-group__item-image-placeholder--loaded": "_purpur-radio-card-group__item-image-placeholder--loaded_19msf_172",
|
|
840
840
|
"purpur-radio-card-group__item-children": "_purpur-radio-card-group__item-children_19msf_175"
|
|
841
|
-
}, C =
|
|
842
|
-
function
|
|
841
|
+
}, C = zr.bind(Ur);
|
|
842
|
+
function jr(e) {
|
|
843
843
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
844
844
|
}
|
|
845
845
|
var se = { exports: {} };
|
|
@@ -882,7 +882,7 @@ function Vr() {
|
|
|
882
882
|
}(se)), se.exports;
|
|
883
883
|
}
|
|
884
884
|
var Kr = Vr();
|
|
885
|
-
const Br = /* @__PURE__ */
|
|
885
|
+
const Br = /* @__PURE__ */ jr(Kr), Wr = {
|
|
886
886
|
"purpur-paragraph": "_purpur-paragraph_1rh57_1",
|
|
887
887
|
"purpur-paragraph--disabled": "_purpur-paragraph--disabled_1rh57_7",
|
|
888
888
|
"purpur-paragraph--hyphens": "_purpur-paragraph--hyphens_1rh57_10",
|
|
@@ -959,16 +959,16 @@ function Xr() {
|
|
|
959
959
|
}(pe)), pe.exports;
|
|
960
960
|
}
|
|
961
961
|
var Zr = Xr();
|
|
962
|
-
const Jr = /* @__PURE__ */ Yr(Zr), Qr = "
|
|
963
|
-
"purpur-skeleton": "_purpur-
|
|
962
|
+
const Jr = /* @__PURE__ */ Yr(Zr), Qr = "_loading_rzc29_1", et = {
|
|
963
|
+
"purpur-skeleton": "_purpur-skeleton_rzc29_1",
|
|
964
964
|
loading: Qr,
|
|
965
|
-
"purpur-skeleton--default": "_purpur-skeleton--
|
|
966
|
-
"purpur-skeleton--negative": "_purpur-skeleton--
|
|
967
|
-
"purpur-skeleton--xs": "_purpur-skeleton--
|
|
968
|
-
"purpur-skeleton--sm": "_purpur-skeleton--
|
|
969
|
-
"purpur-skeleton--md": "_purpur-skeleton--
|
|
970
|
-
"purpur-skeleton--lg": "_purpur-skeleton--
|
|
971
|
-
"purpur-skeleton--full": "_purpur-skeleton--
|
|
965
|
+
"purpur-skeleton--default": "_purpur-skeleton--default_rzc29_24",
|
|
966
|
+
"purpur-skeleton--negative": "_purpur-skeleton--negative_rzc29_30",
|
|
967
|
+
"purpur-skeleton--xs": "_purpur-skeleton--xs_rzc29_36",
|
|
968
|
+
"purpur-skeleton--sm": "_purpur-skeleton--sm_rzc29_39",
|
|
969
|
+
"purpur-skeleton--md": "_purpur-skeleton--md_rzc29_42",
|
|
970
|
+
"purpur-skeleton--lg": "_purpur-skeleton--lg_rzc29_45",
|
|
971
|
+
"purpur-skeleton--full": "_purpur-skeleton--full_rzc29_48"
|
|
972
972
|
}, rt = Jr.bind(et), W = "purpur-skeleton", ke = ({
|
|
973
973
|
className: e,
|
|
974
974
|
radius: t = "xs",
|
|
@@ -991,7 +991,7 @@ const D = "purpur-radio-card-group__item-image", tt = (e) => !!(e != null && e.s
|
|
|
991
991
|
loading: o = "lazy",
|
|
992
992
|
["data-testid"]: a
|
|
993
993
|
}) => {
|
|
994
|
-
const [r, i] =
|
|
994
|
+
const [r, i] = je(!1), u = () => i(!0), c = C(D, {
|
|
995
995
|
[`${D}--loaded`]: r
|
|
996
996
|
}), p = C(`${D}-placeholder`, {
|
|
997
997
|
[`${D}-placeholder--loaded`]: r
|
|
@@ -1086,7 +1086,7 @@ const ot = (e) => Ve(e) && (e == null ? void 0 : e.type) === ee, dt = ["horizont
|
|
|
1086
1086
|
}
|
|
1087
1087
|
),
|
|
1088
1088
|
(!!(a != null && a.length) || g.length) && /* @__PURE__ */ N(
|
|
1089
|
-
|
|
1089
|
+
Mr,
|
|
1090
1090
|
{
|
|
1091
1091
|
...m,
|
|
1092
1092
|
"aria-labelledby": t || (r ? `${m.id}-heading` : void 0),
|