import { useTranslation } from "react-i18next"; import { Form, Formik, FormikConfig, FormikErrors, FormikProps } from "formik"; import { Button, Divider } from "@mantine/core"; //formik is defined as //export declare function Formik(props: FormikConfig & ExtraProps): React.JSX.Element; //we just want to proxy it basically export function FormikForm({ data = {} as Values, onSubmit, submitText = "Submit", schema, onDelete = null, closeModal = null, createForm = null, children, ...props }: Omit, "initialValues"> & { data?: Values; submitText?: string; schema?: any; onDelete?: () => void; closeModal?: () => void; createForm?: (values, handleChange, errors, touched) => React.ReactNode; children?: React.ReactNode; }): JSX.Element { const { t } = useTranslation(); return initialValues={data} onSubmit={onSubmit} validationSchema={schema} {...props} > {({ values, handleChange, errors, touched, ...other }) => (
{createForm && createForm(values, handleChange, errors, touched)} {children}
{onDelete && } {closeModal && }
)} ; }