@heroui/use-aria-button
Advanced tools
Comparing version
@@ -26,3 +26,2 @@ "use strict"; | ||
module.exports = __toCommonJS(index_exports); | ||
var import_shared_utils = require("@heroui/shared-utils"); | ||
var import_utils = require("@react-aria/utils"); | ||
@@ -43,4 +42,3 @@ var import_focus = require("@react-aria/focus"); | ||
allowFocusWhenDisabled, | ||
// @ts-ignore | ||
onClick: deprecatedOnClick, | ||
onClick, | ||
href, | ||
@@ -50,4 +48,3 @@ target, | ||
type = "button", | ||
allowTextSelectionOnPress, | ||
role | ||
allowTextSelectionOnPress | ||
} = props; | ||
@@ -71,22 +68,8 @@ let additionalProps; | ||
} | ||
let isMobile = (0, import_utils.isIOS)() || (0, import_utils.isAndroid)(); | ||
if (deprecatedOnClick && typeof deprecatedOnClick === "function" && // bypass since onClick is passed from <Link as={Button} /> internally | ||
role !== "link" && // bypass since onClick is passed from useDisclosure's `getButtonProps` internally | ||
!(props.hasOwnProperty("aria-expanded") && props.hasOwnProperty("aria-controls"))) { | ||
(0, import_shared_utils.warn)( | ||
"onClick is deprecated, please use onPress instead. See: https://github.com/heroui-inc/heroui/issues/4292", | ||
"useButton" | ||
); | ||
} | ||
const handlePress = (e) => { | ||
if (isMobile) { | ||
deprecatedOnClick == null ? void 0 : deprecatedOnClick(e); | ||
} | ||
onPress == null ? void 0 : onPress(e); | ||
}; | ||
let { pressProps, isPressed } = (0, import_interactions.usePress)({ | ||
onClick, | ||
onPressStart, | ||
onPressEnd, | ||
onPressChange, | ||
onPress: handlePress, | ||
onPress, | ||
isDisabled, | ||
@@ -114,9 +97,3 @@ preventFocusOnPress, | ||
"aria-pressed": props["aria-pressed"], | ||
"aria-current": props["aria-current"], | ||
onClick: (e) => { | ||
if (type === "button" && isMobile) { | ||
return; | ||
} | ||
deprecatedOnClick == null ? void 0 : deprecatedOnClick(e); | ||
} | ||
"aria-current": props["aria-current"] | ||
}) | ||
@@ -123,0 +100,0 @@ }; |
{ | ||
"name": "@heroui/use-aria-button", | ||
"version": "2.2.12-beta.2", | ||
"version": "2.2.12", | ||
"description": "Internal hook to handle button a11y and events, this is based on react-aria button hook but without the onClick warning", | ||
@@ -31,8 +31,8 @@ "keywords": [ | ||
"dependencies": { | ||
"@react-aria/focus": "3.20.1", | ||
"@react-aria/interactions": "3.24.1", | ||
"@react-aria/utils": "3.28.1", | ||
"@react-types/button": "3.11.0", | ||
"@react-types/shared": "3.28.0", | ||
"@heroui/shared-utils": "2.1.9-beta.2" | ||
"@react-aria/focus": "3.20.2", | ||
"@react-aria/interactions": "3.25.0", | ||
"@react-aria/utils": "3.28.2", | ||
"@react-types/button": "3.12.0", | ||
"@react-types/shared": "3.29.0", | ||
"@heroui/shared-utils": "2.1.8" | ||
}, | ||
@@ -39,0 +39,0 @@ "clean-package": "../../../clean-package.config.json", |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
0
-100%0
-100%11545
-14.95%196
-19.01%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated
Updated
Updated
Updated