import { jsx } from "react/jsx-runtime";
import { useFormContext } from "react-hook-form";
import { DSButtonV2 } from "@elliemae/ds-button";
const FormSubmitButton = ({ ...rest }) => {
  const {
    formState,
    formProps: { mode }
  } = useFormContext();
  return /* @__PURE__ */ jsx(
    DSButtonV2,
    {
      ...rest,
      type: "submit",
      disabled: mode !== "onSubmit" && (!formState.isDirty || formState.isDirty && !formState.isValid)
    }
  );
};
export {
  FormSubmitButton
};
