mirror of
https://github.com/LukeHagar/form.git
synced 2025-12-09 20:37:47 +00:00
feat: Add Yup and Zod validator support (#462)
* chore: first pass * chore: onto something I think * chore: closer but no cigar * chore: infer validator * chore: infer zod * feat: add validation transformer logic * chore: fix typings for react adapter * chore: fix issue with `this` not being defined properly * chore: mostly update FieldInfo types from Vue * chore: work on fixing type inferencing * fix: make ValidatorType optional * chore: make TName restriction easier to grok * chore: fix React types * chore: fix Vue types * chore: fix typing issues * chore: fix various linting items * chore: fix ESlint and validation logic * chore: fix inferencing from formdata * chore: fix form inferencing * chore: fix React TS types to match form validator logic * chore: fix Vue types * chore: migrate zod validation to dedicated package * chore: add first integration test for zod adapter * chore: enable non-validator types to be passed to validator * feat: add yup 1.x adapter * chore: add functionality and tests for form-wide validators * chore: fix typings of async validation types * fix: async validation should now run as-expected more often * chore: add async tests for Yup validator * chore: rename packages to match naming schema better * chore: add Zod examples for React and Vue * chore: add React and Vue Yup support * chore: fix formatting * chore: fix CI types * chore: initial work to drastically improve docs * docs: improve docs for validation * docs: add adapter validation docs
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vue Form Example</title>
|
||||
<title>TanStack Form Vue Simple Example App</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
@@ -11,8 +11,7 @@
|
||||
"dependencies": {
|
||||
"@tanstack/form-core": "0.3.7",
|
||||
"@tanstack/vue-form": "0.3.7",
|
||||
"vue": "^3.3.4",
|
||||
"@tanstack/react-form": "0.3.7"
|
||||
"vue": "^3.3.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^4.3.4",
|
||||
|
||||
@@ -34,7 +34,7 @@ async function onChangeFirstName(value: string) {
|
||||
<div>
|
||||
<form.Field
|
||||
name="firstName"
|
||||
:onChange="
|
||||
@change="
|
||||
(value) =>
|
||||
!value
|
||||
? `A first name is required`
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { FieldApi } from '@tanstack/vue-form'
|
||||
|
||||
const props = defineProps<{
|
||||
state: FieldApi<any, any>['state']
|
||||
state: FieldApi<any, any, unknown, unknown>['state']
|
||||
}>()
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user