@react-aria/checkbox
Advanced tools
Comparing version 3.0.0-nightly-4baa1b08e-241029 to 3.0.0-nightly-4dd0993da-241224
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-4baa1b08e-241029", | ||
"version": "3.0.0-nightly-4dd0993da-241224", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,21 +25,20 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-aria/form": "^3.0.0-nightly-4baa1b08e-241029", | ||
"@react-aria/interactions": "^3.0.0-nightly-4baa1b08e-241029", | ||
"@react-aria/label": "^3.0.0-nightly-4baa1b08e-241029", | ||
"@react-aria/toggle": "^3.0.0-nightly-4baa1b08e-241029", | ||
"@react-aria/utils": "^3.0.0-nightly-4baa1b08e-241029", | ||
"@react-stately/checkbox": "^3.0.0-nightly-4baa1b08e-241029", | ||
"@react-stately/form": "^3.0.0-nightly-4baa1b08e-241029", | ||
"@react-stately/toggle": "^3.0.0-nightly-4baa1b08e-241029", | ||
"@react-types/checkbox": "^3.0.0-nightly-4baa1b08e-241029", | ||
"@react-types/shared": "^3.0.0-nightly-4baa1b08e-241029", | ||
"@react-aria/form": "3.0.0-nightly-4dd0993da-241224", | ||
"@react-aria/interactions": "3.0.0-nightly-4dd0993da-241224", | ||
"@react-aria/label": "3.0.0-nightly-4dd0993da-241224", | ||
"@react-aria/toggle": "3.0.0-nightly-4dd0993da-241224", | ||
"@react-aria/utils": "3.0.0-nightly-4dd0993da-241224", | ||
"@react-stately/checkbox": "3.0.0-nightly-4dd0993da-241224", | ||
"@react-stately/form": "3.0.0-nightly-4dd0993da-241224", | ||
"@react-stately/toggle": "3.0.0-nightly-4dd0993da-241224", | ||
"@react-types/checkbox": "3.0.0-nightly-4dd0993da-241224", | ||
"@react-types/shared": "3.0.0-nightly-4dd0993da-241224", | ||
"@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.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
92679
1045
+ Added@react-aria/focus@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-aria/form@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-aria/interactions@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-aria/label@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-aria/ssr@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-aria/toggle@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-aria/utils@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-stately/checkbox@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-stately/form@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-stately/toggle@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-stately/utils@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-types/checkbox@3.0.0-nightly-4dd0993da-241224(transitive)
+ Added@react-types/shared@3.0.0-nightly-4dd0993da-241224(transitive)
- Removed@react-aria/focus@3.19.1(transitive)
- Removed@react-aria/form@3.0.12(transitive)
- Removed@react-aria/interactions@3.23.0(transitive)
- Removed@react-aria/label@3.7.14(transitive)
- Removed@react-aria/ssr@3.9.7(transitive)
- Removed@react-aria/toggle@3.10.11(transitive)
- Removed@react-aria/utils@3.27.0(transitive)
- Removed@react-stately/checkbox@3.6.11(transitive)
- Removed@react-stately/form@3.1.1(transitive)
- Removed@react-stately/toggle@3.8.1(transitive)
- Removed@react-stately/utils@3.10.5(transitive)
- Removed@react-types/checkbox@3.9.1(transitive)
- Removed@react-types/shared@3.27.0(transitive)
Updated@react-aria/interactions@3.0.0-nightly-4dd0993da-241224
Updated@react-stately/checkbox@3.0.0-nightly-4dd0993da-241224