import { jsx } from "react/jsx-runtime";
import styled from "styled-components";
import {
  useForm,
  FormProvider
} from "react-hook-form";
const StyledForm = styled.form`
  width: 100%;
`;
const Form = ({
  /* eslint-disable indent */
  classname,
  reactHookFormProps = { mode: "onBlur" },
  children,
  onSubmit
}) => {
  const methods = useForm(reactHookFormProps);
  const formProps = {};
  if (onSubmit) formProps.onSubmit = methods.handleSubmit(onSubmit);
  const providerProps = Object.assign(methods, {
    // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
    formProps: reactHookFormProps
  });
  return /* @__PURE__ */ jsx(FormProvider, { ...providerProps, children: /* @__PURE__ */ jsx(StyledForm, { className: classname, ...formProps, children }) });
};
export {
  Form
};
