@conform-to/yup
Advanced tools
Comparing version 0.7.4 to 0.8.0-pre.0
@@ -6,7 +6,2 @@ import { type FieldsetConstraint, type Submission } from '@conform-to/dom'; | ||
schema: Schema | ((intent: string) => Schema); | ||
acceptMultipleErrors?: ({ name, intent, payload, }: { | ||
name: string; | ||
intent: string; | ||
payload: Record<string, any>; | ||
}) => boolean; | ||
async?: false; | ||
@@ -16,8 +11,3 @@ }): Submission<yup.InferType<Schema>>; | ||
schema: Schema | ((intent: string) => Schema); | ||
acceptMultipleErrors?: ({ name, intent, payload, }: { | ||
name: string; | ||
intent: string; | ||
payload: Record<string, any>; | ||
}) => boolean; | ||
async: true; | ||
}): Promise<Submission<yup.InferType<Schema>>>; |
12
index.js
@@ -102,13 +102,5 @@ 'use strict'; | ||
error: error.inner.reduce((result, e) => { | ||
var _e$path, _config$acceptMultipl; | ||
var _e$path, _result$name; | ||
var name = (_e$path = e.path) !== null && _e$path !== void 0 ? _e$path : ''; | ||
if (typeof result[name] === 'undefined') { | ||
result[name] = e.message; | ||
} else if ((_config$acceptMultipl = config.acceptMultipleErrors) !== null && _config$acceptMultipl !== void 0 && _config$acceptMultipl.call(config, { | ||
name, | ||
intent, | ||
payload | ||
})) { | ||
result[name] = [].concat(result[name], e.message); | ||
} | ||
result[name] = [...((_result$name = result[name]) !== null && _result$name !== void 0 ? _result$name : []), e.message]; | ||
return result; | ||
@@ -115,0 +107,0 @@ }, {}) |
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "0.7.4", | ||
"version": "0.8.0-pre.0", | ||
"main": "index.js", | ||
@@ -29,3 +29,3 @@ "module": "index.mjs", | ||
"peerDependencies": { | ||
"@conform-to/dom": "0.7.4", | ||
"@conform-to/dom": "0.8.0-pre.0", | ||
"yup": ">=0.32.0" | ||
@@ -32,0 +32,0 @@ }, |
@@ -68,3 +68,3 @@ # @conform-to/yup | ||
```tsx | ||
import { useForm } from '@conform-to/react'; | ||
import { useForm, report } from '@conform-to/react'; | ||
import { parse } from '@conform-to/yup'; | ||
@@ -88,3 +88,3 @@ import * as yup from 'yup'; | ||
if (!submission.value || submission.intent !== 'submit') { | ||
return submission; | ||
return report(submission); | ||
} | ||
@@ -91,0 +91,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13719
236