@react-aria/button
Advanced tools
Comparing version
var $lIlxZ$reactariautils = require("@react-aria/utils"); | ||
var $lIlxZ$reactariafocus = require("@react-aria/focus"); | ||
var $lIlxZ$reactariainteractions = require("@react-aria/interactions"); | ||
@@ -23,15 +22,20 @@ | ||
function $988353faa005faf8$export$ea18c227d4417cc3(props, ref) { | ||
let { elementType: elementType = 'button', isDisabled: isDisabled, onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, onPressUp: onPressUp, onPressChange: onPressChange, preventFocusOnPress: preventFocusOnPress, allowFocusWhenDisabled: // @ts-ignore - undocumented | ||
allowFocusWhenDisabled, // @ts-ignore | ||
onClick: deprecatedOnClick, href: href, target: target, rel: rel, type: type = 'button' } = props; | ||
allowFocusWhenDisabled, onClick: onClick, href: href, target: target, rel: rel, type: type = 'button' } = props; | ||
let additionalProps; | ||
if (elementType === 'button') additionalProps = { | ||
type: type, | ||
disabled: isDisabled | ||
disabled: isDisabled, | ||
form: props.form, | ||
formAction: props.formAction, | ||
formEncType: props.formEncType, | ||
formMethod: props.formMethod, | ||
formNoValidate: props.formNoValidate, | ||
formTarget: props.formTarget, | ||
name: props.name, | ||
value: props.value | ||
}; | ||
else additionalProps = { | ||
role: 'button', | ||
tabIndex: isDisabled ? undefined : 0, | ||
href: elementType === 'a' && !isDisabled ? href : undefined, | ||
@@ -50,2 +54,3 @@ target: elementType === 'a' ? target : undefined, | ||
onPressUp: onPressUp, | ||
onClick: onClick, | ||
isDisabled: isDisabled, | ||
@@ -55,3 +60,3 @@ preventFocusOnPress: preventFocusOnPress, | ||
}); | ||
let { focusableProps: focusableProps } = (0, $lIlxZ$reactariafocus.useFocusable)(props, ref); | ||
let { focusableProps: focusableProps } = (0, $lIlxZ$reactariainteractions.useFocusable)(props, ref); | ||
if (allowFocusWhenDisabled) focusableProps.tabIndex = isDisabled ? -1 : focusableProps.tabIndex; | ||
@@ -68,8 +73,4 @@ let buttonProps = (0, $lIlxZ$reactariautils.mergeProps)(focusableProps, pressProps, (0, $lIlxZ$reactariautils.filterDOMProps)(props, { | ||
'aria-pressed': props['aria-pressed'], | ||
onClick: (e)=>{ | ||
if (deprecatedOnClick) { | ||
deprecatedOnClick(e); | ||
console.warn('onClick is deprecated, please use onPress'); | ||
} | ||
} | ||
'aria-current': props['aria-current'], | ||
'aria-disabled': props['aria-disabled'] | ||
}) | ||
@@ -76,0 +77,0 @@ }; |
import {mergeProps as $bwqiF$mergeProps, filterDOMProps as $bwqiF$filterDOMProps} from "@react-aria/utils"; | ||
import {useFocusable as $bwqiF$useFocusable} from "@react-aria/focus"; | ||
import {usePress as $bwqiF$usePress} from "@react-aria/interactions"; | ||
import {usePress as $bwqiF$usePress, useFocusable as $bwqiF$useFocusable} from "@react-aria/interactions"; | ||
@@ -17,15 +16,20 @@ /* | ||
function $701a24aa0da5b062$export$ea18c227d4417cc3(props, ref) { | ||
let { elementType: elementType = 'button', isDisabled: isDisabled, onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, onPressUp: onPressUp, onPressChange: onPressChange, preventFocusOnPress: preventFocusOnPress, allowFocusWhenDisabled: // @ts-ignore - undocumented | ||
allowFocusWhenDisabled, // @ts-ignore | ||
onClick: deprecatedOnClick, href: href, target: target, rel: rel, type: type = 'button' } = props; | ||
allowFocusWhenDisabled, onClick: onClick, href: href, target: target, rel: rel, type: type = 'button' } = props; | ||
let additionalProps; | ||
if (elementType === 'button') additionalProps = { | ||
type: type, | ||
disabled: isDisabled | ||
disabled: isDisabled, | ||
form: props.form, | ||
formAction: props.formAction, | ||
formEncType: props.formEncType, | ||
formMethod: props.formMethod, | ||
formNoValidate: props.formNoValidate, | ||
formTarget: props.formTarget, | ||
name: props.name, | ||
value: props.value | ||
}; | ||
else additionalProps = { | ||
role: 'button', | ||
tabIndex: isDisabled ? undefined : 0, | ||
href: elementType === 'a' && !isDisabled ? href : undefined, | ||
@@ -44,2 +48,3 @@ target: elementType === 'a' ? target : undefined, | ||
onPressUp: onPressUp, | ||
onClick: onClick, | ||
isDisabled: isDisabled, | ||
@@ -61,8 +66,4 @@ preventFocusOnPress: preventFocusOnPress, | ||
'aria-pressed': props['aria-pressed'], | ||
onClick: (e)=>{ | ||
if (deprecatedOnClick) { | ||
deprecatedOnClick(e); | ||
console.warn('onClick is deprecated, please use onPress'); | ||
} | ||
} | ||
'aria-current': props['aria-current'], | ||
'aria-disabled': props['aria-disabled'] | ||
}) | ||
@@ -69,0 +70,0 @@ }; |
@@ -37,2 +37,3 @@ var $c49208f7d2aac50b$exports = require("./useToggleButton.main.js"); | ||
isSelected: state.selectedKeys.has(props.id), | ||
defaultSelected: false, | ||
setSelected (isSelected) { | ||
@@ -39,0 +40,0 @@ state.setSelected(props.id, isSelected); |
@@ -30,2 +30,3 @@ import {useToggleButton as $55f54f7887471b58$export$51e84d46ca0bc451} from "./useToggleButton.module.js"; | ||
isSelected: state.selectedKeys.has(props.id), | ||
defaultSelected: false, | ||
setSelected (isSelected) { | ||
@@ -32,0 +33,0 @@ state.setSelected(props.id, isSelected); |
{ | ||
"name": "@react-aria/button", | ||
"version": "3.0.0-nightly-326f48154-241216", | ||
"version": "3.0.0-nightly-341ae3f8a-250822", | ||
"description": "Spectrum UI components in React", | ||
@@ -9,3 +9,7 @@ "license": "Apache-2.0", | ||
"exports": { | ||
"types": "./dist/types.d.ts", | ||
"source": "./src/index.ts", | ||
"types": [ | ||
"./dist/types.d.ts", | ||
"./src/index.ts" | ||
], | ||
"import": "./dist/import.mjs", | ||
@@ -26,13 +30,13 @@ "require": "./dist/main.js" | ||
"dependencies": { | ||
"@react-aria/focus": "3.0.0-nightly-326f48154-241216", | ||
"@react-aria/interactions": "3.0.0-nightly-326f48154-241216", | ||
"@react-aria/toolbar": "3.0.0-nightly-326f48154-241216", | ||
"@react-aria/utils": "3.0.0-nightly-326f48154-241216", | ||
"@react-stately/toggle": "3.0.0-nightly-326f48154-241216", | ||
"@react-types/button": "3.0.0-nightly-326f48154-241216", | ||
"@react-types/shared": "3.0.0-nightly-326f48154-241216", | ||
"@react-aria/interactions": "3.0.0-nightly-341ae3f8a-250822", | ||
"@react-aria/toolbar": "3.0.0-nightly-341ae3f8a-250822", | ||
"@react-aria/utils": "3.0.0-nightly-341ae3f8a-250822", | ||
"@react-stately/toggle": "3.0.0-nightly-341ae3f8a-250822", | ||
"@react-types/button": "3.0.0-nightly-341ae3f8a-250822", | ||
"@react-types/shared": "3.0.0-nightly-341ae3f8a-250822", | ||
"@swc/helpers": "^0.5.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" | ||
"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" | ||
}, | ||
@@ -39,0 +43,0 @@ "publishConfig": { |
@@ -24,4 +24,3 @@ /* | ||
import {filterDOMProps, mergeProps} from '@react-aria/utils'; | ||
import {useFocusable} from '@react-aria/focus'; | ||
import {usePress} from '@react-aria/interactions'; | ||
import {useFocusable, usePress} from '@react-aria/interactions'; | ||
@@ -62,4 +61,3 @@ export interface AriaButtonOptions<E extends ElementType> extends Omit<AriaButtonProps<E>, 'children'> {} | ||
allowFocusWhenDisabled, | ||
// @ts-ignore | ||
onClick: deprecatedOnClick, | ||
onClick, | ||
href, | ||
@@ -74,3 +72,11 @@ target, | ||
type, | ||
disabled: isDisabled | ||
disabled: isDisabled, | ||
form: props.form, | ||
formAction: props.formAction, | ||
formEncType: props.formEncType, | ||
formMethod: props.formMethod, | ||
formNoValidate: props.formNoValidate, | ||
formTarget: props.formTarget, | ||
name: props.name, | ||
value: props.value | ||
}; | ||
@@ -80,3 +86,2 @@ } else { | ||
role: 'button', | ||
tabIndex: isDisabled ? undefined : 0, | ||
href: elementType === 'a' && !isDisabled ? href : undefined, | ||
@@ -97,2 +102,3 @@ target: elementType === 'a' ? target : undefined, | ||
onPressUp, | ||
onClick, | ||
isDisabled, | ||
@@ -116,10 +122,6 @@ preventFocusOnPress, | ||
'aria-pressed': props['aria-pressed'], | ||
onClick: (e) => { | ||
if (deprecatedOnClick) { | ||
deprecatedOnClick(e); | ||
console.warn('onClick is deprecated, please use onPress'); | ||
} | ||
} | ||
'aria-current': props['aria-current'], | ||
'aria-disabled': props['aria-disabled'] | ||
}) | ||
}; | ||
} |
@@ -71,2 +71,3 @@ /* | ||
isSelected: state.selectedKeys.has(props.id), | ||
defaultSelected: false, | ||
setSelected(isSelected) { | ||
@@ -73,0 +74,0 @@ state.setSelected(props.id, isSelected); |
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
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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 2 instances in 1 package
84748
1.16%856
1.42%4
100%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated