@mantine/form
Advanced tools
Comparing version 5.10.2 to 5.10.3
@@ -6,5 +6,4 @@ 'use strict'; | ||
function zodResolver(schema) { | ||
const _schema = schema; | ||
return (values) => { | ||
const parsed = _schema.safeParse(values); | ||
const parsed = schema.safeParse(values); | ||
if (parsed.success) { | ||
@@ -11,0 +10,0 @@ return {}; |
@@ -8,3 +8,3 @@ 'use strict'; | ||
function isEmail(error) { | ||
return matches.matches(/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/, error); | ||
return matches.matches(/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,63})+$/, error); | ||
} | ||
@@ -11,0 +11,0 @@ |
function zodResolver(schema) { | ||
const _schema = schema; | ||
return (values) => { | ||
const parsed = _schema.safeParse(values); | ||
const parsed = schema.safeParse(values); | ||
if (parsed.success) { | ||
@@ -6,0 +5,0 @@ return {}; |
import { matches } from '../matches/matches.js'; | ||
function isEmail(error) { | ||
return matches(/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/, error); | ||
return matches(/^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,63})+$/, error); | ||
} | ||
@@ -6,0 +6,0 @@ |
import type { FormErrors } from '../../types'; | ||
export declare function zodResolver<T extends Record<string, any>>(schema: any): (values: T) => FormErrors; | ||
interface ZodError { | ||
path: (string | number)[]; | ||
message: string; | ||
} | ||
interface ZodParseSuccess { | ||
success: true; | ||
} | ||
interface ZodParseError { | ||
success: false; | ||
error: { | ||
errors: ZodError[]; | ||
}; | ||
} | ||
interface ZodSchema<T extends Record<string, any>> { | ||
safeParse(values: T): ZodParseSuccess | ZodParseError; | ||
} | ||
export declare function zodResolver<T extends Record<string, any>>(schema: ZodSchema<T>): (values: T) => FormErrors; | ||
export {}; | ||
//# sourceMappingURL=zod-resolver.d.ts.map |
@@ -41,2 +41,3 @@ /// <reference types="react" /> | ||
onFocus?: any; | ||
onBlur?: any; | ||
}; | ||
@@ -43,0 +44,0 @@ export type SetFieldValue<Values> = <Field extends LooseKeys<Values>>(path: Field, value: Field extends keyof Values ? Values[Field] : unknown) => void; |
{ | ||
"name": "@mantine/form", | ||
"description": "Mantine form management library", | ||
"version": "5.10.2", | ||
"version": "5.10.3", | ||
"main": "cjs/index.js", | ||
@@ -6,0 +6,0 @@ "module": "esm/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
177604
1550