@react-aria/checkbox
Advanced tools
Comparing version 3.0.0-nightly-a626c2596-240926 to 3.0.0-nightly-a98da553e-241116
var $ar5WQ$react = require("react"); | ||
var $ar5WQ$reactariautils = require("@react-aria/utils"); | ||
var $ar5WQ$reactstatelyform = require("@react-stately/form"); | ||
var $ar5WQ$reactariaform = require("@react-aria/form"); | ||
var $ar5WQ$reactstatelyform = require("@react-stately/form"); | ||
var $ar5WQ$reactariainteractions = require("@react-aria/interactions"); | ||
var $ar5WQ$reactariatoggle = require("@react-aria/toggle"); | ||
@@ -26,2 +28,4 @@ | ||
function $468c774d7db917b7$export$e375f10ce42261c5(props, state, inputRef) { | ||
@@ -45,4 +49,14 @@ // Create validation state here because it doesn't make sense to add to general useToggleState. | ||
}); | ||
// Reset validation state on label press for checkbox with a hidden input. | ||
let { pressProps: pressProps } = (0, $ar5WQ$reactariainteractions.usePress)({ | ||
isDisabled: isDisabled || isReadOnly, | ||
onPress () { | ||
// @ts-expect-error | ||
let { [(0, $ar5WQ$reactstatelyform.privateValidationStateProp)]: groupValidationState } = props; | ||
let { commitValidation: commitValidation } = groupValidationState ? groupValidationState : validationState; | ||
commitValidation(); | ||
} | ||
}); | ||
return { | ||
labelProps: labelProps, | ||
labelProps: (0, $ar5WQ$reactariautils.mergeProps)(labelProps, pressProps), | ||
inputProps: { | ||
@@ -49,0 +63,0 @@ ...inputProps, |
import {useEffect as $jNP0e$useEffect} from "react"; | ||
import {mergeProps as $jNP0e$mergeProps} from "@react-aria/utils"; | ||
import {useFormValidationState as $jNP0e$useFormValidationState, privateValidationStateProp as $jNP0e$privateValidationStateProp} from "@react-stately/form"; | ||
import {useFormValidation as $jNP0e$useFormValidation} from "@react-aria/form"; | ||
import {useFormValidationState as $jNP0e$useFormValidationState} from "@react-stately/form"; | ||
import {usePress as $jNP0e$usePress} from "@react-aria/interactions"; | ||
import {useToggle as $jNP0e$useToggle} from "@react-aria/toggle"; | ||
@@ -20,2 +22,4 @@ | ||
function $406796ff087fe49b$export$e375f10ce42261c5(props, state, inputRef) { | ||
@@ -39,4 +43,14 @@ // Create validation state here because it doesn't make sense to add to general useToggleState. | ||
}); | ||
// Reset validation state on label press for checkbox with a hidden input. | ||
let { pressProps: pressProps } = (0, $jNP0e$usePress)({ | ||
isDisabled: isDisabled || isReadOnly, | ||
onPress () { | ||
// @ts-expect-error | ||
let { [(0, $jNP0e$privateValidationStateProp)]: groupValidationState } = props; | ||
let { commitValidation: commitValidation } = groupValidationState ? groupValidationState : validationState; | ||
commitValidation(); | ||
} | ||
}); | ||
return { | ||
labelProps: labelProps, | ||
labelProps: (0, $jNP0e$mergeProps)(labelProps, pressProps), | ||
inputProps: { | ||
@@ -43,0 +57,0 @@ ...inputProps, |
{ | ||
"name": "@react-aria/checkbox", | ||
"version": "3.0.0-nightly-a626c2596-240926", | ||
"version": "3.0.0-nightly-a98da553e-241116", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,12 +25,12 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-aria/form": "^3.0.0-nightly-a626c2596-240926", | ||
"@react-aria/interactions": "^3.0.0-nightly-a626c2596-240926", | ||
"@react-aria/label": "^3.0.0-nightly-a626c2596-240926", | ||
"@react-aria/toggle": "^3.0.0-nightly-a626c2596-240926", | ||
"@react-aria/utils": "^3.0.0-nightly-a626c2596-240926", | ||
"@react-stately/checkbox": "^3.0.0-nightly-a626c2596-240926", | ||
"@react-stately/form": "^3.0.0-nightly-a626c2596-240926", | ||
"@react-stately/toggle": "^3.0.0-nightly-a626c2596-240926", | ||
"@react-types/checkbox": "^3.0.0-nightly-a626c2596-240926", | ||
"@react-types/shared": "^3.0.0-nightly-a626c2596-240926", | ||
"@react-aria/form": "^3.0.0-nightly-a98da553e-241116", | ||
"@react-aria/interactions": "^3.0.0-nightly-a98da553e-241116", | ||
"@react-aria/label": "^3.0.0-nightly-a98da553e-241116", | ||
"@react-aria/toggle": "^3.0.0-nightly-a98da553e-241116", | ||
"@react-aria/utils": "^3.0.0-nightly-a98da553e-241116", | ||
"@react-stately/checkbox": "^3.0.0-nightly-a98da553e-241116", | ||
"@react-stately/form": "^3.0.0-nightly-a98da553e-241116", | ||
"@react-stately/toggle": "^3.0.0-nightly-a98da553e-241116", | ||
"@react-types/checkbox": "^3.0.0-nightly-a98da553e-241116", | ||
"@react-types/shared": "^3.0.0-nightly-a98da553e-241116", | ||
"@swc/helpers": "^0.5.0" | ||
@@ -44,3 +44,3 @@ }, | ||
}, | ||
"stableVersion": "3.14.6" | ||
"stableVersion": "3.14.8" | ||
} |
@@ -15,6 +15,8 @@ /* | ||
import {InputHTMLAttributes, LabelHTMLAttributes, useEffect} from 'react'; | ||
import {mergeProps} from '@react-aria/utils'; | ||
import {privateValidationStateProp, useFormValidationState} from '@react-stately/form'; | ||
import {RefObject, ValidationResult} from '@react-types/shared'; | ||
import {ToggleState} from '@react-stately/toggle'; | ||
import {useFormValidation} from '@react-aria/form'; | ||
import {useFormValidationState} from '@react-stately/form'; | ||
import {usePress} from '@react-aria/interactions'; | ||
import {useToggle} from '@react-aria/toggle'; | ||
@@ -65,4 +67,19 @@ | ||
// Reset validation state on label press for checkbox with a hidden input. | ||
let {pressProps} = usePress({ | ||
isDisabled: isDisabled || isReadOnly, | ||
onPress() { | ||
// @ts-expect-error | ||
let {[privateValidationStateProp]: groupValidationState} = props; | ||
let {commitValidation} = groupValidationState | ||
? groupValidationState | ||
: validationState; | ||
commitValidation(); | ||
} | ||
}); | ||
return { | ||
labelProps, | ||
labelProps: mergeProps(labelProps, pressProps), | ||
inputProps: { | ||
@@ -69,0 +86,0 @@ ...inputProps, |
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
92713
1045
228