@nextui-org/use-aria-button
Advanced tools
Comparing version 0.0.0-canary-20241208124331 to 0.0.0-canary-20241210210712
@@ -26,2 +26,3 @@ "use strict"; | ||
module.exports = __toCommonJS(src_exports); | ||
var import_shared_utils = require("@nextui-org/shared-utils"); | ||
var import_utils = require("@react-aria/utils"); | ||
@@ -57,3 +58,3 @@ var import_focus = require("@react-aria/focus"); | ||
tabIndex: isDisabled ? void 0 : 0, | ||
href: elementType === "a" && isDisabled ? void 0 : href, | ||
href: elementType === "a" && !isDisabled ? href : void 0, | ||
target: elementType === "a" ? target : void 0, | ||
@@ -66,2 +67,15 @@ type: elementType === "input" ? type : void 0, | ||
} | ||
let isMobile = (0, import_utils.isIOS)() || (0, import_utils.isAndroid)(); | ||
if (deprecatedOnClick && typeof deprecatedOnClick === "function") { | ||
(0, import_shared_utils.warn)( | ||
"onClick is deprecated, please use onPress instead. See: https://github.com/nextui-org/nextui/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)({ | ||
@@ -71,3 +85,3 @@ onPressStart, | ||
onPressChange, | ||
onPress, | ||
onPress: handlePress, | ||
isDisabled, | ||
@@ -95,2 +109,5 @@ preventFocusOnPress, | ||
onClick: (e) => { | ||
if (type === "button" && isMobile) { | ||
return; | ||
} | ||
deprecatedOnClick == null ? void 0 : deprecatedOnClick(e); | ||
@@ -97,0 +114,0 @@ } |
{ | ||
"name": "@nextui-org/use-aria-button", | ||
"version": "0.0.0-canary-20241208124331", | ||
"version": "0.0.0-canary-20241210210712", | ||
"description": "Internal hook to handle button a11y and events, this is based on react-aria button hook but without the onClick warning", | ||
@@ -35,3 +35,4 @@ "keywords": [ | ||
"@react-types/button": "3.10.1", | ||
"@react-types/shared": "3.26.0" | ||
"@react-types/shared": "3.26.0", | ||
"@nextui-org/shared-utils": "2.1.1" | ||
}, | ||
@@ -38,0 +39,0 @@ "clean-package": "../../../clean-package.config.json", |
Sorry, the diff of this file is not supported yet
11111
226
7
+ Added@nextui-org/shared-utils@2.1.1(transitive)