import { jsx } from "react/jsx-runtime";
import {
  DSControlledToggle
} from "@elliemae/ds-controlled-form";
import {
  Controller
} from "react-hook-form";
const Toggle = ({
  name,
  defaultValue = false,
  rules = {},
  ...rest
}) => /* @__PURE__ */ jsx(
  Controller,
  {
    name,
    rules,
    defaultValue,
    render: ({ field: { value, onChange, ...restProps } }) => /* @__PURE__ */ jsx(
      DSControlledToggle,
      {
        ...rest,
        ...restProps,
        checked: value,
        value: value.toString(),
        onChange: () => onChange(!value)
      }
    )
  }
);
export {
  Toggle
};
