@react-aria/toggle
Advanced tools
Comparing version 3.0.0-nightly-3f67667d5-241111 to 3.0.0-nightly-41ef71d18-250201
@@ -35,12 +35,9 @@ var $2jyrz$reactariautils = require("@react-aria/utils"); | ||
if (!hasChildren && !hasAriaLabel) console.warn('If you do not provide children, you must specify an aria-label for accessibility'); | ||
// This handles focusing the input on pointer down, which Safari does not do by default. | ||
// Handle press state for keyboard interactions and cases where labelProps is not used. | ||
let { pressProps: pressProps, isPressed: isPressed } = (0, $2jyrz$reactariainteractions.usePress)({ | ||
isDisabled: isDisabled | ||
}); | ||
// iOS does not toggle checkboxes if you drag off and back onto the label, so handle it ourselves. | ||
// Handle press state on the label. | ||
let { pressProps: labelProps, isPressed: isLabelPressed } = (0, $2jyrz$reactariainteractions.usePress)({ | ||
isDisabled: isDisabled || isReadOnly, | ||
onPress () { | ||
state.toggle(); | ||
} | ||
isDisabled: isDisabled || isReadOnly | ||
}); | ||
@@ -54,5 +51,3 @@ let { focusableProps: focusableProps } = (0, $2jyrz$reactariafocus.useFocusable)(props, ref); | ||
return { | ||
labelProps: (0, $2jyrz$reactariautils.mergeProps)(labelProps, { | ||
onClick: (e)=>e.preventDefault() | ||
}), | ||
labelProps: labelProps, | ||
inputProps: (0, $2jyrz$reactariautils.mergeProps)(domProps, { | ||
@@ -59,0 +54,0 @@ 'aria-invalid': isInvalid || validationState === 'invalid' || undefined, |
@@ -29,12 +29,9 @@ import {mergeProps as $bvdLj$mergeProps, filterDOMProps as $bvdLj$filterDOMProps, useFormReset as $bvdLj$useFormReset} from "@react-aria/utils"; | ||
if (!hasChildren && !hasAriaLabel) console.warn('If you do not provide children, you must specify an aria-label for accessibility'); | ||
// This handles focusing the input on pointer down, which Safari does not do by default. | ||
// Handle press state for keyboard interactions and cases where labelProps is not used. | ||
let { pressProps: pressProps, isPressed: isPressed } = (0, $bvdLj$usePress)({ | ||
isDisabled: isDisabled | ||
}); | ||
// iOS does not toggle checkboxes if you drag off and back onto the label, so handle it ourselves. | ||
// Handle press state on the label. | ||
let { pressProps: labelProps, isPressed: isLabelPressed } = (0, $bvdLj$usePress)({ | ||
isDisabled: isDisabled || isReadOnly, | ||
onPress () { | ||
state.toggle(); | ||
} | ||
isDisabled: isDisabled || isReadOnly | ||
}); | ||
@@ -48,5 +45,3 @@ let { focusableProps: focusableProps } = (0, $bvdLj$useFocusable)(props, ref); | ||
return { | ||
labelProps: (0, $bvdLj$mergeProps)(labelProps, { | ||
onClick: (e)=>e.preventDefault() | ||
}), | ||
labelProps: labelProps, | ||
inputProps: (0, $bvdLj$mergeProps)(domProps, { | ||
@@ -53,0 +48,0 @@ 'aria-invalid': isInvalid || validationState === 'invalid' || undefined, |
{ | ||
"name": "@react-aria/toggle", | ||
"version": "3.0.0-nightly-3f67667d5-241111", | ||
"version": "3.0.0-nightly-41ef71d18-250201", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,17 +25,17 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-aria/focus": "^3.0.0-nightly-3f67667d5-241111", | ||
"@react-aria/interactions": "^3.0.0-nightly-3f67667d5-241111", | ||
"@react-aria/utils": "^3.0.0-nightly-3f67667d5-241111", | ||
"@react-stately/toggle": "^3.0.0-nightly-3f67667d5-241111", | ||
"@react-types/checkbox": "^3.0.0-nightly-3f67667d5-241111", | ||
"@react-types/shared": "^3.0.0-nightly-3f67667d5-241111", | ||
"@react-aria/focus": "3.0.0-nightly-41ef71d18-250201", | ||
"@react-aria/interactions": "3.0.0-nightly-41ef71d18-250201", | ||
"@react-aria/utils": "3.0.0-nightly-41ef71d18-250201", | ||
"@react-stately/toggle": "3.0.0-nightly-41ef71d18-250201", | ||
"@react-types/checkbox": "3.0.0-nightly-41ef71d18-250201", | ||
"@react-types/shared": "3.0.0-nightly-41ef71d18-250201", | ||
"@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", | ||
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"stableVersion": "3.10.9" | ||
} | ||
} |
@@ -67,3 +67,3 @@ /* | ||
// This handles focusing the input on pointer down, which Safari does not do by default. | ||
// Handle press state for keyboard interactions and cases where labelProps is not used. | ||
let {pressProps, isPressed} = usePress({ | ||
@@ -73,8 +73,5 @@ isDisabled | ||
// iOS does not toggle checkboxes if you drag off and back onto the label, so handle it ourselves. | ||
// Handle press state on the label. | ||
let {pressProps: labelProps, isPressed: isLabelPressed} = usePress({ | ||
isDisabled: isDisabled || isReadOnly, | ||
onPress() { | ||
state.toggle(); | ||
} | ||
isDisabled: isDisabled || isReadOnly | ||
}); | ||
@@ -89,3 +86,3 @@ | ||
return { | ||
labelProps: mergeProps(labelProps, {onClick: e => e.preventDefault()}), | ||
labelProps, | ||
inputProps: mergeProps(domProps, { | ||
@@ -92,0 +89,0 @@ 'aria-invalid': isInvalid || validationState === 'invalid' || undefined, |
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
33489
9
373
+ Added@react-aria/focus@3.0.0-nightly-41ef71d18-250201(transitive)
+ Added@react-aria/interactions@3.0.0-nightly-41ef71d18-250201(transitive)
+ Added@react-aria/ssr@3.0.0-nightly-41ef71d18-250201(transitive)
+ Added@react-aria/utils@3.0.0-nightly-41ef71d18-250201(transitive)
+ Added@react-stately/toggle@3.0.0-nightly-41ef71d18-250201(transitive)
+ Added@react-stately/utils@3.0.0-nightly-41ef71d18-250201(transitive)
+ Added@react-types/checkbox@3.0.0-nightly-41ef71d18-250201(transitive)
+ Added@react-types/shared@3.0.0-nightly-41ef71d18-250201(transitive)
- Removed@react-aria/focus@3.19.1(transitive)
- Removed@react-aria/interactions@3.23.0(transitive)
- Removed@react-aria/ssr@3.9.7(transitive)
- Removed@react-aria/utils@3.27.0(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-41ef71d18-250201