@react-stately/form
Advanced tools
Comparing version 3.0.0-nightly-fb28ab3b4-241024 to 3.0.0-nightly-fee532d6a-241217
@@ -10,3 +10,3 @@ import { Validation, ValidationErrors, ValidationResult } from "@react-types/shared"; | ||
name?: string | string[]; | ||
value: T; | ||
value: T | null; | ||
} | ||
@@ -13,0 +13,0 @@ export interface FormValidationState { |
@@ -76,7 +76,11 @@ var $kFCAu$react = require("react"); | ||
// Perform custom client side validation. | ||
let clientError = (0, $kFCAu$react.useMemo)(()=>$5d10129a174740d4$var$getValidationResult($5d10129a174740d4$var$runValidate(validate, value)), [ | ||
let clientError = (0, $kFCAu$react.useMemo)(()=>{ | ||
if (!validate || value == null) return null; | ||
let validateErrors = $5d10129a174740d4$var$runValidate(validate, value); | ||
return $5d10129a174740d4$var$getValidationResult(validateErrors); | ||
}, [ | ||
validate, | ||
value | ||
]); | ||
if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid) builtinValidation = null; | ||
if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid) builtinValidation = undefined; | ||
// Get relevant server errors from the form. | ||
@@ -173,3 +177,3 @@ let serverErrors = (0, $kFCAu$react.useContext)($5d10129a174740d4$export$571b5131b7e65c11); | ||
if (a === b) return true; | ||
return a && b && a.isInvalid === b.isInvalid && a.validationErrors.length === b.validationErrors.length && a.validationErrors.every((a, i)=>a === b.validationErrors[i]) && Object.entries(a.validationDetails).every(([k, v])=>b.validationDetails[k] === v); | ||
return !!a && !!b && a.isInvalid === b.isInvalid && a.validationErrors.length === b.validationErrors.length && a.validationErrors.every((a, i)=>a === b.validationErrors[i]) && Object.entries(a.validationDetails).every(([k, v])=>b.validationDetails[k] === v); | ||
} | ||
@@ -176,0 +180,0 @@ function $5d10129a174740d4$export$75ee7c75d68f5b0e(...results) { |
@@ -65,7 +65,11 @@ import {createContext as $69F46$createContext, useMemo as $69F46$useMemo, useContext as $69F46$useContext, useState as $69F46$useState, useRef as $69F46$useRef, useEffect as $69F46$useEffect} from "react"; | ||
// Perform custom client side validation. | ||
let clientError = (0, $69F46$useMemo)(()=>$e5be200c675c3b3a$var$getValidationResult($e5be200c675c3b3a$var$runValidate(validate, value)), [ | ||
let clientError = (0, $69F46$useMemo)(()=>{ | ||
if (!validate || value == null) return null; | ||
let validateErrors = $e5be200c675c3b3a$var$runValidate(validate, value); | ||
return $e5be200c675c3b3a$var$getValidationResult(validateErrors); | ||
}, [ | ||
validate, | ||
value | ||
]); | ||
if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid) builtinValidation = null; | ||
if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid) builtinValidation = undefined; | ||
// Get relevant server errors from the form. | ||
@@ -162,3 +166,3 @@ let serverErrors = (0, $69F46$useContext)($e5be200c675c3b3a$export$571b5131b7e65c11); | ||
if (a === b) return true; | ||
return a && b && a.isInvalid === b.isInvalid && a.validationErrors.length === b.validationErrors.length && a.validationErrors.every((a, i)=>a === b.validationErrors[i]) && Object.entries(a.validationDetails).every(([k, v])=>b.validationDetails[k] === v); | ||
return !!a && !!b && a.isInvalid === b.isInvalid && a.validationErrors.length === b.validationErrors.length && a.validationErrors.every((a, i)=>a === b.validationErrors[i]) && Object.entries(a.validationDetails).every(([k, v])=>b.validationDetails[k] === v); | ||
} | ||
@@ -165,0 +169,0 @@ function $e5be200c675c3b3a$export$75ee7c75d68f5b0e(...results) { |
{ | ||
"name": "@react-stately/form", | ||
"version": "3.0.0-nightly-fb28ab3b4-241024", | ||
"version": "3.0.0-nightly-fee532d6a-241217", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,12 +25,11 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-types/shared": "^3.0.0-nightly-fb28ab3b4-241024", | ||
"@react-types/shared": "3.0.0-nightly-fee532d6a-241217", | ||
"@swc/helpers": "^0.5.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0" | ||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"stableVersion": "3.0.6" | ||
} | ||
} |
@@ -49,3 +49,3 @@ /* | ||
name?: string | string[], | ||
value: T | ||
value: T | null | ||
} | ||
@@ -93,6 +93,12 @@ | ||
// Perform custom client side validation. | ||
let clientError: ValidationResult | null = useMemo(() => getValidationResult(runValidate(validate, value)), [validate, value]); | ||
let clientError: ValidationResult | null = useMemo(() => { | ||
if (!validate || value == null) { | ||
return null; | ||
} | ||
let validateErrors = runValidate(validate, value); | ||
return getValidationResult(validateErrors); | ||
}, [validate, value]); | ||
if (builtinValidation?.validationDetails.valid) { | ||
builtinValidation = null; | ||
builtinValidation = undefined; | ||
} | ||
@@ -222,3 +228,3 @@ | ||
return a && b | ||
return !!a && !!b | ||
&& a.isInvalid === b.isInvalid | ||
@@ -225,0 +231,0 @@ && a.validationErrors.length === b.validationErrors.length |
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
77844
891
+ Added@react-types/shared@3.0.0-nightly-fee532d6a-241217(transitive)
- Removed@react-types/shared@3.26.0(transitive)