import { jsx } from 'react/jsx-runtime';
import { forwardRef, useImperativeHandle } from 'react';
import * as index_esm from '../../node_modules/.pnpm/react-hook-form@7.64.0_react@18.3.1/node_modules/react-hook-form/dist/index.esm.js';

const Forms = ({ onSubmit, children, id, ...rest }, ref) => {
    const methods = index_esm.useForm(rest);
    const { handleSubmit } = methods;
    const extendedMethods = {
        ...methods,
        Form: index_esm,
    };
    useImperativeHandle(ref, () => ({
        submit: handleSubmit(onSubmit),
        ...extendedMethods,
    }));
    return (jsx("form", { id: id, onSubmit: handleSubmit(onSubmit), children: children(extendedMethods) }));
};
const ForwardedForms = forwardRef(Forms);

export { ForwardedForms as default };
//# sourceMappingURL=Forms.js.map
