import { Controller } from "react-hook-form";
import { Checkbox, CheckboxLabel } from "../Checkbox";
import { useFormContext } from "./context";
import { jsx } from "react/jsx-runtime";
function FormCheckbox({
  id,
  label,
  ...props
}) {
  const { control } = useFormContext();
  return /* @__PURE__ */ jsx(
    Controller,
    {
      control,
      name: id,
      render: ({ field }) => label ? /* @__PURE__ */ jsx(
        CheckboxLabel,
        {
          ...props,
          label,
          checked: field.value,
          onChange: field.onChange
        }
      ) : /* @__PURE__ */ jsx(
        Checkbox,
        {
          ...props,
          checked: field.value,
          onChange: field.onChange
        }
      )
    }
  );
}
export {
  FormCheckbox
};
//# sourceMappingURL=FormCheckbox.js.map
