From f9d7722e8c30550f869be90ca661071f79b128da Mon Sep 17 00:00:00 2001 From: Romain Hamel Date: Mon, 31 Jul 2023 17:42:28 +0200 Subject: [PATCH 1/4] fix(Form): return state on validate --- src/runtime/components/forms/Form.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/runtime/components/forms/Form.ts b/src/runtime/components/forms/Form.ts index 9a5c8b38b2..68dccd283f 100644 --- a/src/runtime/components/forms/Form.ts +++ b/src/runtime/components/forms/Form.ts @@ -68,6 +68,8 @@ export default defineComponent({ `Form validation failed: ${JSON.stringify(errors.value, null, 2)}` ) } + + return props.state } expose({ From 676fe3b55ee8bed9c0e4d81ac0b4ecc2c7c4fc85 Mon Sep 17 00:00:00 2001 From: Romain Hamel Date: Mon, 31 Jul 2023 17:59:23 +0200 Subject: [PATCH 2/4] docs(Form): fixed vuelidate example --- docs/content/3.forms/10.form.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/docs/content/3.forms/10.form.md b/docs/content/3.forms/10.form.md index 6a180296db..10a7375d43 100644 --- a/docs/content/3.forms/10.form.md +++ b/docs/content/3.forms/10.form.md @@ -301,11 +301,7 @@ defineExpose({ From fdaaa3c4b52f3e773bf9c36b7c0ed6ddae1d8cb4 Mon Sep 17 00:00:00 2001 From: Romain Hamel Date: Mon, 31 Jul 2023 21:07:40 +0200 Subject: [PATCH 3/4] docs(Form): fixed yup, zod and joi examples --- docs/components/content/examples/FormExampleJoi.vue | 4 ++-- docs/components/content/examples/FormExampleYup.vue | 4 ++-- docs/components/content/examples/FormExampleZod.vue | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/components/content/examples/FormExampleJoi.vue b/docs/components/content/examples/FormExampleJoi.vue index ebcbf84986..7519a90ffb 100644 --- a/docs/components/content/examples/FormExampleJoi.vue +++ b/docs/components/content/examples/FormExampleJoi.vue @@ -29,11 +29,11 @@ async function submit () { :state="state" @submit.prevent="submit" > - + - + diff --git a/docs/components/content/examples/FormExampleYup.vue b/docs/components/content/examples/FormExampleYup.vue index b7ba81e5f5..44b11447e1 100644 --- a/docs/components/content/examples/FormExampleYup.vue +++ b/docs/components/content/examples/FormExampleYup.vue @@ -32,11 +32,11 @@ async function submit () { :state="state" @submit.prevent="submit" > - + - + diff --git a/docs/components/content/examples/FormExampleZod.vue b/docs/components/content/examples/FormExampleZod.vue index 5a6c5968f5..5053f7eab0 100644 --- a/docs/components/content/examples/FormExampleZod.vue +++ b/docs/components/content/examples/FormExampleZod.vue @@ -30,11 +30,11 @@ async function submit () { :state="state" @submit.prevent="submit" > - + - + From 131d82143cf4b1b6db4708880f9b1fffdd38ffc8 Mon Sep 17 00:00:00 2001 From: Romain Hamel Date: Tue, 1 Aug 2023 12:44:43 +0200 Subject: [PATCH 4/4] docs(Form): fixed duplicate id warnings --- docs/components/content/examples/FormExampleJoi.vue | 8 ++++---- docs/components/content/examples/FormExampleYup.vue | 8 ++++---- docs/components/content/examples/FormExampleZod.vue | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/components/content/examples/FormExampleJoi.vue b/docs/components/content/examples/FormExampleJoi.vue index 7519a90ffb..486f7586cc 100644 --- a/docs/components/content/examples/FormExampleJoi.vue +++ b/docs/components/content/examples/FormExampleJoi.vue @@ -3,8 +3,8 @@ import { ref } from 'vue' import Joi from 'joi' const schema = Joi.object({ - email: Joi.string().required(), - password: Joi.string() + emailJoi: Joi.string().required(), + passwordJoi: Joi.string() .min(8) .required() }) @@ -29,11 +29,11 @@ async function submit () { :state="state" @submit.prevent="submit" > - + - + diff --git a/docs/components/content/examples/FormExampleYup.vue b/docs/components/content/examples/FormExampleYup.vue index 44b11447e1..37de1bdc09 100644 --- a/docs/components/content/examples/FormExampleYup.vue +++ b/docs/components/content/examples/FormExampleYup.vue @@ -4,8 +4,8 @@ import { object, string, InferType } from 'yup' import type { Form } from '@nuxthq/ui/dist/runtime/types' const schema = object({ - email: string().email('Invalid email').required('Required'), - password: string() + emailYup: string().email('Invalid email').required('Required'), + passwordYup: string() .min(8, 'Must be at least 8 characters') .required('Required') }) @@ -32,11 +32,11 @@ async function submit () { :state="state" @submit.prevent="submit" > - + - + diff --git a/docs/components/content/examples/FormExampleZod.vue b/docs/components/content/examples/FormExampleZod.vue index 5053f7eab0..7cb2040d94 100644 --- a/docs/components/content/examples/FormExampleZod.vue +++ b/docs/components/content/examples/FormExampleZod.vue @@ -4,8 +4,8 @@ import { z } from 'zod' import type { Form } from '@nuxthq/ui/dist/runtime/types' const schema = z.object({ - email: z.string().email('Invalid email'), - password: z.string().min(8, 'Must be at least 8 characters') + emailZod: z.string().email('Invalid email'), + passwordZod: z.string().min(8, 'Must be at least 8 characters') }) type Schema = z.output @@ -30,11 +30,11 @@ async function submit () { :state="state" @submit.prevent="submit" > - + - +