@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,7 +22,5 @@ | ||
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; | ||
@@ -36,3 +33,2 @@ if (elementType === 'button') additionalProps = { | ||
role: 'button', | ||
tabIndex: isDisabled ? undefined : 0, | ||
href: elementType === 'a' && !isDisabled ? href : undefined, | ||
@@ -51,2 +47,3 @@ target: elementType === 'a' ? target : undefined, | ||
onPressUp: onPressUp, | ||
onClick: onClick, | ||
isDisabled: isDisabled, | ||
@@ -56,3 +53,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; | ||
@@ -69,8 +66,3 @@ 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'] | ||
}) | ||
@@ -77,0 +69,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,7 +16,5 @@ /* | ||
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; | ||
@@ -30,3 +27,2 @@ if (elementType === 'button') additionalProps = { | ||
role: 'button', | ||
tabIndex: isDisabled ? undefined : 0, | ||
href: elementType === 'a' && !isDisabled ? href : undefined, | ||
@@ -45,2 +41,3 @@ target: elementType === 'a' ? target : undefined, | ||
onPressUp: onPressUp, | ||
onClick: onClick, | ||
isDisabled: isDisabled, | ||
@@ -62,8 +59,3 @@ 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'] | ||
}) | ||
@@ -70,0 +62,0 @@ }; |
{ | ||
"name": "@react-aria/button", | ||
"version": "3.0.0-nightly-101d0772b-250113", | ||
"version": "3.0.0-nightly-104d441a1-250417", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,13 +25,13 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-aria/focus": "3.0.0-nightly-101d0772b-250113", | ||
"@react-aria/interactions": "3.0.0-nightly-101d0772b-250113", | ||
"@react-aria/toolbar": "3.0.0-nightly-101d0772b-250113", | ||
"@react-aria/utils": "3.0.0-nightly-101d0772b-250113", | ||
"@react-stately/toggle": "3.0.0-nightly-101d0772b-250113", | ||
"@react-types/button": "3.0.0-nightly-101d0772b-250113", | ||
"@react-types/shared": "3.0.0-nightly-101d0772b-250113", | ||
"@react-aria/interactions": "3.0.0-nightly-104d441a1-250417", | ||
"@react-aria/toolbar": "3.0.0-nightly-104d441a1-250417", | ||
"@react-aria/utils": "3.0.0-nightly-104d441a1-250417", | ||
"@react-stately/toggle": "3.0.0-nightly-104d441a1-250417", | ||
"@react-types/button": "3.0.0-nightly-104d441a1-250417", | ||
"@react-types/shared": "3.0.0-nightly-104d441a1-250417", | ||
"@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" | ||
}, | ||
@@ -38,0 +38,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, | ||
@@ -79,3 +77,2 @@ target, | ||
role: 'button', | ||
tabIndex: isDisabled ? undefined : 0, | ||
href: elementType === 'a' && !isDisabled ? href : undefined, | ||
@@ -96,2 +93,3 @@ target: elementType === 'a' ? target : undefined, | ||
onPressUp, | ||
onClick, | ||
isDisabled, | ||
@@ -115,10 +113,5 @@ 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'] | ||
}) | ||
}; | ||
} |
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
82120
-1.98%816
-3.32%+ 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