@uva-glass/component-library
Version:
React components UvA
53 lines (52 loc) • 1.76 kB
JavaScript
import { jsxs as u, jsx as i } from "react/jsx-runtime";
import { useState as m } from "react";
import { c as h } from "../../clsx-OuTLNxxd.js";
import { RadioButton as j } from "../RadioButton/RadioButton.js";
import '../../assets/RadioGroup.css';const r = {
"radio-group__wrapper": "_radio-group__wrapper_jcssv_1",
"radio-group__header": "_radio-group__header_jcssv_7",
"radio-group": "_radio-group_jcssv_1",
"radio-group__option": "_radio-group__option_jcssv_21",
"radio-group__option--disabled": "_radio-group__option--disabled_jcssv_36"
}, x = ({ label: s, options: d, onChange: t, disabled: _ }) => {
const [n, c] = m(null), p = (o) => {
_ || (c(o), t(o));
};
return /* @__PURE__ */ u("div", { className: r["radio-group__wrapper"], children: [
/* @__PURE__ */ i("h2", { className: r["radio-group__header"], children: s }),
/* @__PURE__ */ i("div", { className: r["radio-group"], children: d.map(({ id: o, descriptionLabel: g, titleLabel: l, value: e }) => /* @__PURE__ */ i(
"div",
{
className: h(r["radio-group__option"], {
[r["radio-group__option--disabled"]]: _
}),
onClick: () => p(e),
onKeyDown: (a) => {
(a.key === "Enter" || a.key === " ") && p(e);
},
role: "presentation",
children: /* @__PURE__ */ i(
j,
{
id: o,
label: l,
description: g,
name: s,
onChange: (a) => {
p(a.target.value);
},
value: e,
checked: n === e,
disabled: _,
gap: "large"
}
)
},
o
)) })
] });
};
export {
x as RadioGroup
};
//# sourceMappingURL=RadioGroup.js.map