import { ref, createVNode } from 'vue'; import { t as propsFactory, v as makeComponentProps, aU as makeFormProps, l as genericComponent, aV as createForm, o as useRender, a4 as forwardRefs } from './server.mjs'; const makeVFormProps = propsFactory({ ...makeComponentProps(), ...makeFormProps() }, "VForm"); const VForm = genericComponent()({ name: "VForm", props: makeVFormProps(), emits: { "update:modelValue": (val) => true, submit: (e) => true }, setup(props, _ref) { let { slots, emit } = _ref; const form = createForm(props); const formRef = ref(); function onReset(e) { e.preventDefault(); form.reset(); } function onSubmit(_e) { const e = _e; const ready = form.validate(); e.then = ready.then.bind(ready); e.catch = ready.catch.bind(ready); e.finally = ready.finally.bind(ready); emit("submit", e); if (!e.defaultPrevented) { ready.then((_ref2) => { var _a; let { valid } = _ref2; if (valid) { (_a = formRef.value) == null ? void 0 : _a.submit(); } }); } e.preventDefault(); } useRender(() => { var _a; return createVNode("form", { "ref": formRef, "class": ["v-form", props.class], "style": props.style, "novalidate": true, "onReset": onReset, "onSubmit": onSubmit }, [(_a = slots.default) == null ? void 0 : _a.call(slots, form)]); }); return forwardRefs(form, formRef); } }); export { VForm as V }; //# sourceMappingURL=VForm-C-FITV-x.mjs.map