import { jsx } from "react/jsx-runtime";
import { DSControlledRadio } from "@elliemae/ds-controlled-form";
import {
  Controller
} from "react-hook-form";
const Radio = ({
  name,
  defaultChecked = false,
  rules = {},
  labelText,
  ...rest
}) => /* @__PURE__ */ jsx(
  Controller,
  {
    name,
    rules,
    defaultValue: defaultChecked,
    render: ({ field: { onChange, value, ...restProps } }) => /* @__PURE__ */ jsx(
      DSControlledRadio,
      {
        label: labelText,
        ...rest,
        ...restProps,
        value: rest.value ?? value.toString(),
        checked: value,
        onChange: (e) => onChange(!((e || {}).target || {}).checked)
      }
    )
  }
);
export {
  Radio
};
