koval-ui
Version:
React components collection with minimalistic design. Supports theming, layout, and input validation.
72 lines (71 loc) • 1.46 kB
JavaScript
"use client";
import { jsxs as j, jsx as t } from "react/jsx-runtime";
import { forwardRef as w, useCallback as y } from "react";
import i from "classnames";
import { useInternalId as C } from "../../internal/hooks/useInternalId.js";
import a from "./InputRadio.module.css.js";
const g = w(
({
className: l,
disabled: m,
value: n,
onChange: r = () => {
},
onFocus: p = () => {
},
onBlur: c = () => {
},
onKeyDown: d = () => {
},
onKeyUp: u = () => {
},
checked: f,
defaultChecked: h,
id: N,
label: s,
required: e,
...I
}, x) => {
const o = C(N), R = y(
(b) => {
r(b);
},
[r]
);
return /* @__PURE__ */ j("div", { className: i(a.wrapper, l), children: [
/* @__PURE__ */ t(
"input",
{
...I,
className: a.input,
ref: x,
disabled: m,
type: "radio",
id: o,
value: n,
checked: f,
defaultChecked: h,
onChange: R,
onBlur: c,
onFocus: p,
onKeyUp: u,
onKeyDown: d,
required: e
}
),
s && /* @__PURE__ */ t(
"label",
{
className: i(a.label, { [a.required]: e }),
htmlFor: o,
children: s
}
)
] });
}
);
g.displayName = "InputRadio";
export {
g as InputRadio
};
//# sourceMappingURL=InputRadio.js.map