@clubmed/trident-ui
Version:
Shared ClubMed React UI components
64 lines (63 loc) • 1.69 kB
JavaScript
import { jsxs as r, jsx as e } from "react/jsx-runtime";
import { c as C } from "../../../chunks/clsx.js";
import { useId as N } from "react";
import { useValue as b } from "../../hooks/useValue.js";
/* empty css */
function k(d) {
const n = N(), {
id: o = n,
name: l = o,
className: c,
dataTestId: m,
disabled: a,
checked: h = !1,
value: i,
size: t = 24,
tabIndex: f = 0,
children: p,
onChange: u,
...v
} = d, { value: s, setValue: x } = b({
name: l,
initialValue: h,
onChange(g, y) {
u?.(g, i !== void 0 ? i : y);
}
});
return /* @__PURE__ */ r(
"label",
{
className: C(c, "relative flex items-center gap-8", {
"text-grey": a
}),
children: [
/* @__PURE__ */ r("span", { className: "relative", children: [
/* @__PURE__ */ e(
"input",
{
...v,
name: l,
"data-testid": m,
type: "radio",
tabIndex: f,
onChange: () => {
a || x(!s);
},
defaultChecked: s,
"data-name": "Radio",
disabled: a,
value: i
}
),
/* @__PURE__ */ e("span", { style: { height: t, width: t }, children: /* @__PURE__ */ e("svg", { viewBox: "0 0 16 16", width: t * 2 / 3, className: "overflow-visible", children: /* @__PURE__ */ e("circle", { cx: "8", cy: "8", r: "8px", style: { fill: "var(--color-saffron)" } }) }) })
] }),
p
]
}
);
}
k.displayName = "Radio";
export {
k as Radio
};
//# sourceMappingURL=Radio.js.map