@react-aria/checkbox
Advanced tools
Comparing version 3.0.0-nightly-12920fc91-241104 to 3.0.0-nightly-19bc0b845-241211
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-12920fc91-241104", | ||
"version": "3.0.0-nightly-19bc0b845-241211", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,16 +25,16 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-aria/form": "^3.0.0-nightly-12920fc91-241104", | ||
"@react-aria/interactions": "^3.0.0-nightly-12920fc91-241104", | ||
"@react-aria/label": "^3.0.0-nightly-12920fc91-241104", | ||
"@react-aria/toggle": "^3.0.0-nightly-12920fc91-241104", | ||
"@react-aria/utils": "^3.0.0-nightly-12920fc91-241104", | ||
"@react-stately/checkbox": "^3.0.0-nightly-12920fc91-241104", | ||
"@react-stately/form": "^3.0.0-nightly-12920fc91-241104", | ||
"@react-stately/toggle": "^3.0.0-nightly-12920fc91-241104", | ||
"@react-types/checkbox": "^3.0.0-nightly-12920fc91-241104", | ||
"@react-types/shared": "^3.0.0-nightly-12920fc91-241104", | ||
"@react-aria/form": "^3.0.0-nightly-19bc0b845-241211", | ||
"@react-aria/interactions": "^3.0.0-nightly-19bc0b845-241211", | ||
"@react-aria/label": "^3.0.0-nightly-19bc0b845-241211", | ||
"@react-aria/toggle": "^3.0.0-nightly-19bc0b845-241211", | ||
"@react-aria/utils": "^3.0.0-nightly-19bc0b845-241211", | ||
"@react-stately/checkbox": "^3.0.0-nightly-19bc0b845-241211", | ||
"@react-stately/form": "^3.0.0-nightly-19bc0b845-241211", | ||
"@react-stately/toggle": "^3.0.0-nightly-19bc0b845-241211", | ||
"@react-types/checkbox": "^3.0.0-nightly-19bc0b845-241211", | ||
"@react-types/shared": "^3.0.0-nightly-19bc0b845-241211", | ||
"@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" | ||
}, | ||
@@ -44,3 +44,3 @@ "publishConfig": { | ||
}, | ||
"stableVersion": "3.14.8" | ||
"stableVersion": "3.15.0" | ||
} |
@@ -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
92718
1045