@react-aria/form
Advanced tools
Comparing version 3.0.0-nightly.4266 to 3.0.0-nightly.4274
@@ -38,3 +38,3 @@ var $4IpGD$react = require("react"); | ||
(0, $4IpGD$reactariautils.useLayoutEffect)(()=>{ | ||
if (validationBehavior === "native" && ref.current) { | ||
if (validationBehavior === "native" && (ref === null || ref === void 0 ? void 0 : ref.current)) { | ||
let errorMessage = state.realtimeValidation.isInvalid ? state.realtimeValidation.validationErrors.join(" ") || "Invalid value." : ""; | ||
@@ -57,4 +57,4 @@ ref.current.setCustomValidity(errorMessage); | ||
// Auto focus the first invalid input in a form, unless the error already had its default prevented. | ||
let form = (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.form; | ||
if (!e.defaultPrevented && form && $9da8e3f192aba981$var$getFirstInvalidInput(form) === ref.current) { | ||
let form = ref === null || ref === void 0 ? void 0 : (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.form; | ||
if (!e.defaultPrevented && ref && form && $9da8e3f192aba981$var$getFirstInvalidInput(form) === ref.current) { | ||
var _ref_current1; | ||
@@ -73,3 +73,3 @@ if (focus) focus(); | ||
(0, $4IpGD$react.useEffect)(()=>{ | ||
let input = ref.current; | ||
let input = ref === null || ref === void 0 ? void 0 : ref.current; | ||
if (!input) return; | ||
@@ -76,0 +76,0 @@ let form = input.form; |
@@ -32,3 +32,3 @@ import {useEffect as $2tWuM$useEffect} from "react"; | ||
(0, $2tWuM$useLayoutEffect)(()=>{ | ||
if (validationBehavior === "native" && ref.current) { | ||
if (validationBehavior === "native" && (ref === null || ref === void 0 ? void 0 : ref.current)) { | ||
let errorMessage = state.realtimeValidation.isInvalid ? state.realtimeValidation.validationErrors.join(" ") || "Invalid value." : ""; | ||
@@ -51,4 +51,4 @@ ref.current.setCustomValidity(errorMessage); | ||
// Auto focus the first invalid input in a form, unless the error already had its default prevented. | ||
let form = (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.form; | ||
if (!e.defaultPrevented && form && $e93e671b31057976$var$getFirstInvalidInput(form) === ref.current) { | ||
let form = ref === null || ref === void 0 ? void 0 : (_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.form; | ||
if (!e.defaultPrevented && ref && form && $e93e671b31057976$var$getFirstInvalidInput(form) === ref.current) { | ||
var _ref_current1; | ||
@@ -67,3 +67,3 @@ if (focus) focus(); | ||
(0, $2tWuM$useEffect)(()=>{ | ||
let input = ref.current; | ||
let input = ref === null || ref === void 0 ? void 0 : ref.current; | ||
if (!input) return; | ||
@@ -70,0 +70,0 @@ let form = input.form; |
@@ -8,4 +8,4 @@ import { FormValidationState } from "@react-stately/form"; | ||
} | ||
export function useFormValidation<T>(props: FormValidationProps<T>, state: FormValidationState, ref: RefObject<ValidatableElement>): void; | ||
export function useFormValidation<T>(props: FormValidationProps<T>, state: FormValidationState, ref: RefObject<ValidatableElement> | undefined): void; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@react-aria/form", | ||
"version": "3.0.0-nightly.4266+0b541f488", | ||
"version": "3.0.0-nightly.4274+6c61f5b1d", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,6 +25,6 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-aria/interactions": "3.0.0-nightly.2555+0b541f488", | ||
"@react-aria/utils": "3.0.0-nightly.2555+0b541f488", | ||
"@react-stately/form": "3.0.0-nightly.4266+0b541f488", | ||
"@react-types/shared": "3.0.0-nightly.2555+0b541f488", | ||
"@react-aria/interactions": "3.0.0-nightly.2563+6c61f5b1d", | ||
"@react-aria/utils": "3.0.0-nightly.2563+6c61f5b1d", | ||
"@react-stately/form": "3.0.0-nightly.4274+6c61f5b1d", | ||
"@react-types/shared": "3.0.0-nightly.2563+6c61f5b1d", | ||
"@swc/helpers": "^0.5.0" | ||
@@ -38,3 +38,3 @@ }, | ||
}, | ||
"gitHead": "0b541f48848eb43f74ae57e8b21dc4455d95040b" | ||
"gitHead": "6c61f5b1db5f52ebc654bf754a15594bb0662f6f" | ||
} |
@@ -25,3 +25,3 @@ /* | ||
export function useFormValidation<T>(props: FormValidationProps<T>, state: FormValidationState, ref: RefObject<ValidatableElement>) { | ||
export function useFormValidation<T>(props: FormValidationProps<T>, state: FormValidationState, ref: RefObject<ValidatableElement> | undefined) { | ||
let {validationBehavior, focus} = props; | ||
@@ -31,3 +31,3 @@ | ||
useLayoutEffect(() => { | ||
if (validationBehavior === 'native' && ref.current) { | ||
if (validationBehavior === 'native' && ref?.current) { | ||
let errorMessage = state.realtimeValidation.isInvalid ? state.realtimeValidation.validationErrors.join(' ') || 'Invalid value.' : ''; | ||
@@ -60,4 +60,4 @@ ref.current.setCustomValidity(errorMessage); | ||
// Auto focus the first invalid input in a form, unless the error already had its default prevented. | ||
let form = ref.current?.form; | ||
if (!e.defaultPrevented && form && getFirstInvalidInput(form) === ref.current) { | ||
let form = ref?.current?.form; | ||
if (!e.defaultPrevented && ref && form && getFirstInvalidInput(form) === ref.current) { | ||
if (focus) { | ||
@@ -82,3 +82,3 @@ focus(); | ||
useEffect(() => { | ||
let input = ref.current; | ||
let input = ref?.current; | ||
if (!input) { | ||
@@ -85,0 +85,0 @@ return; |
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
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
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
53449