import { jsx as _jsx } from "react/jsx-runtime";
import { forwardRef, useImperativeHandle } from 'react';
import Form from './Form';
const Forms = ({ onSubmit, children, id, ...rest }, ref) => {
    const methods = Form.useForm(rest);
    const { handleSubmit } = methods;
    const extendedMethods = {
        ...methods,
        Form: Form,
    };
    useImperativeHandle(ref, () => ({
        submit: handleSubmit(onSubmit),
        ...extendedMethods,
    }));
    return (_jsx("form", { id: id, onSubmit: handleSubmit(onSubmit), children: children(extendedMethods) }));
};
const ForwardedForms = forwardRef(Forms);
export default ForwardedForms;
//# sourceMappingURL=Forms.js.map