@hookform/resolvers 2.7.1 → 2.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/class-validator/src/__tests__/Form-native-validation.tsx +2 -2
- package/class-validator/src/__tests__/Form.tsx +2 -2
- package/computed-types/dist/computed-types.js.map +1 -1
- package/computed-types/dist/computed-types.modern.js.map +1 -1
- package/computed-types/dist/computed-types.module.js.map +1 -1
- package/computed-types/dist/computed-types.umd.js.map +1 -1
- package/computed-types/src/__tests__/__snapshots__/computed-types.ts.snap +1 -11
- package/computed-types/src/computed-types.ts +1 -1
- package/dist/resolvers.js.map +1 -1
- package/dist/resolvers.mjs.map +1 -0
- package/dist/resolvers.module.js.map +1 -1
- package/dist/resolvers.umd.js.map +1 -1
- package/dist/toNestError.d.ts +1 -1
- package/io-ts/dist/io-ts.js +1 -1
- package/io-ts/dist/io-ts.js.map +1 -1
- package/io-ts/dist/io-ts.mjs +1 -1
- package/io-ts/dist/io-ts.modern.js +1 -1
- package/io-ts/dist/io-ts.modern.js.map +1 -1
- package/io-ts/dist/io-ts.module.js +1 -1
- package/io-ts/dist/io-ts.module.js.map +1 -1
- package/io-ts/dist/io-ts.umd.js +1 -1
- package/io-ts/dist/io-ts.umd.js.map +1 -1
- package/io-ts/src/io-ts.ts +1 -1
- package/package.json +24 -24
- package/vest/dist/vest.js +1 -1
- package/vest/dist/vest.js.map +1 -1
- package/vest/dist/vest.umd.js +1 -1
- package/vest/dist/vest.umd.js.map +1 -1
- package/yup/dist/yup.js.map +1 -1
- package/yup/dist/yup.modern.js.map +1 -1
- package/yup/dist/yup.module.js.map +1 -1
- package/yup/dist/yup.umd.js.map +1 -1
- package/yup/src/yup.ts +1 -1
- package/zod/dist/types.d.ts +2 -3
- package/zod/dist/zod.js.map +1 -1
- package/zod/dist/zod.modern.js.map +1 -1
- package/zod/dist/zod.module.js.map +1 -1
- package/zod/dist/zod.umd.js.map +1 -1
- package/zod/src/__tests__/Form-native-validation.tsx +5 -5
- package/zod/src/__tests__/Form.tsx +5 -5
- package/zod/src/__tests__/__fixtures__/data.ts +4 -4
- package/zod/src/__tests__/__snapshots__/zod.ts.snap +14 -72
- package/zod/src/types.ts +3 -4
- package/zod/src/zod.ts +5 -5
- package/dist/resolvers.modern.js +0 -2
- package/dist/resolvers.modern.js.map +0 -1
package/dist/resolvers.modern.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{get as t,set as e}from"react-hook-form";const o=(e,o)=>{for(const r in o.fields){const i=o.fields[r];if(i&&i.ref&&"reportValidity"in i.ref){const o=t(e,r);i.ref.setCustomValidity(o&&o.message||""),i.ref.reportValidity()}}},r=(r,i)=>{i.shouldUseNativeValidation&&o(r,i);const s={};for(const o in r){const f=t(i.fields,o);e(s,o,Object.assign(r[o],{ref:f&&f.ref}))}return s};export{r as toNestError,o as validateFieldsNatively};
|
|
2
|
-
//# sourceMappingURL=resolvers.modern.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolvers.modern.js","sources":["../src/validateFieldsNatively.ts","../src/toNestError.ts"],"sourcesContent":["import { get, FieldError, ResolverOptions } from 'react-hook-form';\n\n// Native validation (web only)\nexport const validateFieldsNatively = <TFieldValues>(\n errors: Record<string, FieldError>,\n options: ResolverOptions<TFieldValues>,\n): void => {\n for (const fieldPath in options.fields) {\n const field = options.fields[fieldPath];\n\n if (field && field.ref && 'reportValidity' in field.ref) {\n const error = get(errors, fieldPath) as FieldError | undefined;\n\n field.ref.setCustomValidity((error && error.message) || '');\n\n field.ref.reportValidity();\n }\n }\n};\n","import {\n set,\n get,\n FieldError,\n FieldErrors,\n Field,\n ResolverOptions,\n} from 'react-hook-form';\nimport { validateFieldsNatively } from './validateFieldsNatively';\n\nexport const toNestError = <TFieldValues>(\n errors: Record<string, FieldError>,\n options: ResolverOptions<TFieldValues>,\n): FieldErrors<TFieldValues> => {\n options.shouldUseNativeValidation && validateFieldsNatively(errors, options);\n\n const fieldErrors: FieldErrors<TFieldValues> = {};\n for (const path in errors) {\n const field = get(options.fields, path) as Field['_f'] | undefined;\n\n set(\n fieldErrors,\n path,\n Object.assign(errors[path], { ref: field && field.ref }),\n );\n }\n\n return fieldErrors;\n};\n"],"names":["validateFieldsNatively","errors","options","fieldPath","fields","field","ref","error","get","setCustomValidity","message","reportValidity","toNestError","shouldUseNativeValidation","fieldErrors","path","set","Object","assign"],"mappings":"+CAGaA,MAAAA,EAAyB,CACpCC,EACAC,KAEA,IAAK,MAAMC,KAAaD,EAAQE,OAAQ,CACtC,MAAMC,EAAQH,EAAQE,OAAOD,GAE7B,GAAIE,GAASA,EAAMC,KAAO,mBAAoBD,EAAMC,IAAK,CACvD,MAAMC,EAAQC,EAAIP,EAAQE,GAE1BE,EAAMC,IAAIG,kBAAmBF,GAASA,EAAMG,SAAY,IAExDL,EAAMC,IAAIK,oBCLHC,EAAc,CACzBX,EACAC,KAEAA,EAAQW,2BAA6Bb,EAAuBC,EAAQC,GAEpE,MAAMY,EAAyC,GAC/C,IAAK,MAAMC,KAAQd,EAAQ,CACzB,MAAMI,EAAQG,EAAIN,EAAQE,OAAQW,GAElCC,EACEF,EACAC,EACAE,OAAOC,OAAOjB,EAAOc,GAAO,CAAET,IAAKD,GAASA,EAAMC,OAItD,OAAOQ"}
|