@react-aria/link
Advanced tools
Comparing version
var $8TwZf$reactariautils = require("@react-aria/utils"); | ||
var $8TwZf$reactariafocus = require("@react-aria/focus"); | ||
var $8TwZf$reactariainteractions = require("@react-aria/interactions"); | ||
@@ -23,6 +22,4 @@ | ||
function $fbe6b19572273b2f$export$dcf14c9974fe2767(props, ref) { | ||
let { elementType: elementType = 'a', onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, // @ts-ignore | ||
onClick: deprecatedOnClick, isDisabled: isDisabled, ...otherProps } = props; | ||
let { elementType: elementType = 'a', onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, onClick: onClick, isDisabled: isDisabled, ...otherProps } = props; | ||
let linkProps = {}; | ||
@@ -33,3 +30,3 @@ if (elementType !== 'a') linkProps = { | ||
}; | ||
let { focusableProps: focusableProps } = (0, $8TwZf$reactariafocus.useFocusable)(props, ref); | ||
let { focusableProps: focusableProps } = (0, $8TwZf$reactariainteractions.useFocusable)(props, ref); | ||
let { pressProps: pressProps, isPressed: isPressed } = (0, $8TwZf$reactariainteractions.usePress)({ | ||
@@ -39,2 +36,3 @@ onPress: onPress, | ||
onPressEnd: onPressEnd, | ||
onClick: onClick, | ||
isDisabled: isDisabled, | ||
@@ -59,12 +57,3 @@ ref: ref | ||
(_pressProps_onClick = pressProps.onClick) === null || _pressProps_onClick === void 0 ? void 0 : _pressProps_onClick.call(pressProps, e); | ||
if (deprecatedOnClick) { | ||
deprecatedOnClick(e); | ||
console.warn('onClick is deprecated, please use onPress'); | ||
} | ||
// If a custom router is provided, prevent default and forward if this link should client navigate. | ||
if (!router.isNative && e.currentTarget instanceof HTMLAnchorElement && e.currentTarget.href && // If props are applied to a router Link component, it may have already prevented default. | ||
!e.isDefaultPrevented() && (0, $8TwZf$reactariautils.shouldClientNavigate)(e.currentTarget, e) && props.href) { | ||
e.preventDefault(); | ||
router.open(e.currentTarget, e, props.href, props.routerOptions); | ||
} | ||
(0, $8TwZf$reactariautils.handleLinkClick)(e, router, props.href, props.routerOptions); | ||
} | ||
@@ -71,0 +60,0 @@ }) |
@@ -1,4 +0,3 @@ | ||
import {filterDOMProps as $5Ot33$filterDOMProps, mergeProps as $5Ot33$mergeProps, useRouter as $5Ot33$useRouter, useLinkProps as $5Ot33$useLinkProps, shouldClientNavigate as $5Ot33$shouldClientNavigate} from "@react-aria/utils"; | ||
import {useFocusable as $5Ot33$useFocusable} from "@react-aria/focus"; | ||
import {usePress as $5Ot33$usePress} from "@react-aria/interactions"; | ||
import {filterDOMProps as $5Ot33$filterDOMProps, mergeProps as $5Ot33$mergeProps, useRouter as $5Ot33$useRouter, useLinkProps as $5Ot33$useLinkProps, handleLinkClick as $5Ot33$handleLinkClick} from "@react-aria/utils"; | ||
import {useFocusable as $5Ot33$useFocusable, usePress as $5Ot33$usePress} from "@react-aria/interactions"; | ||
@@ -17,6 +16,4 @@ /* | ||
function $298d61e98472621b$export$dcf14c9974fe2767(props, ref) { | ||
let { elementType: elementType = 'a', onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, // @ts-ignore | ||
onClick: deprecatedOnClick, isDisabled: isDisabled, ...otherProps } = props; | ||
let { elementType: elementType = 'a', onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, onClick: onClick, isDisabled: isDisabled, ...otherProps } = props; | ||
let linkProps = {}; | ||
@@ -32,2 +29,3 @@ if (elementType !== 'a') linkProps = { | ||
onPressEnd: onPressEnd, | ||
onClick: onClick, | ||
isDisabled: isDisabled, | ||
@@ -52,12 +50,3 @@ ref: ref | ||
(_pressProps_onClick = pressProps.onClick) === null || _pressProps_onClick === void 0 ? void 0 : _pressProps_onClick.call(pressProps, e); | ||
if (deprecatedOnClick) { | ||
deprecatedOnClick(e); | ||
console.warn('onClick is deprecated, please use onPress'); | ||
} | ||
// If a custom router is provided, prevent default and forward if this link should client navigate. | ||
if (!router.isNative && e.currentTarget instanceof HTMLAnchorElement && e.currentTarget.href && // If props are applied to a router Link component, it may have already prevented default. | ||
!e.isDefaultPrevented() && (0, $5Ot33$shouldClientNavigate)(e.currentTarget, e) && props.href) { | ||
e.preventDefault(); | ||
router.open(e.currentTarget, e, props.href, props.routerOptions); | ||
} | ||
(0, $5Ot33$handleLinkClick)(e, router, props.href, props.routerOptions); | ||
} | ||
@@ -64,0 +53,0 @@ }) |
{ | ||
"name": "@react-aria/link", | ||
"version": "3.0.0-nightly-d87cc4422-250109", | ||
"version": "3.0.0-nightly-da4ef7644-250826", | ||
"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,11 +30,11 @@ "require": "./dist/main.js" | ||
"dependencies": { | ||
"@react-aria/focus": "3.0.0-nightly-d87cc4422-250109", | ||
"@react-aria/interactions": "3.0.0-nightly-d87cc4422-250109", | ||
"@react-aria/utils": "3.0.0-nightly-d87cc4422-250109", | ||
"@react-types/link": "3.0.0-nightly-d87cc4422-250109", | ||
"@react-types/shared": "3.0.0-nightly-d87cc4422-250109", | ||
"@react-aria/interactions": "3.0.0-nightly-da4ef7644-250826", | ||
"@react-aria/utils": "3.0.0-nightly-da4ef7644-250826", | ||
"@react-types/link": "3.0.0-nightly-da4ef7644-250826", | ||
"@react-types/shared": "3.0.0-nightly-da4ef7644-250826", | ||
"@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" | ||
}, | ||
@@ -37,0 +41,0 @@ "publishConfig": { |
@@ -15,6 +15,5 @@ /* | ||
import {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared'; | ||
import {filterDOMProps, mergeProps, shouldClientNavigate, useLinkProps, useRouter} from '@react-aria/utils'; | ||
import {filterDOMProps, handleLinkClick, mergeProps, useLinkProps, useRouter} from '@react-aria/utils'; | ||
import React from 'react'; | ||
import {useFocusable} from '@react-aria/focus'; | ||
import {usePress} from '@react-aria/interactions'; | ||
import {useFocusable, usePress} from '@react-aria/interactions'; | ||
@@ -49,4 +48,3 @@ export interface AriaLinkOptions extends AriaLinkProps { | ||
onPressEnd, | ||
// @ts-ignore | ||
onClick: deprecatedOnClick, | ||
onClick, | ||
isDisabled, | ||
@@ -64,3 +62,3 @@ ...otherProps | ||
let {focusableProps} = useFocusable(props, ref); | ||
let {pressProps, isPressed} = usePress({onPress, onPressStart, onPressEnd, isDisabled, ref}); | ||
let {pressProps, isPressed} = usePress({onPress, onPressStart, onPressEnd, onClick, isDisabled, ref}); | ||
let domProps = filterDOMProps(otherProps, {labelable: true}); | ||
@@ -80,20 +78,3 @@ let interactionHandlers = mergeProps(focusableProps, pressProps); | ||
pressProps.onClick?.(e); | ||
if (deprecatedOnClick) { | ||
deprecatedOnClick(e); | ||
console.warn('onClick is deprecated, please use onPress'); | ||
} | ||
// If a custom router is provided, prevent default and forward if this link should client navigate. | ||
if ( | ||
!router.isNative && | ||
e.currentTarget instanceof HTMLAnchorElement && | ||
e.currentTarget.href && | ||
// If props are applied to a router Link component, it may have already prevented default. | ||
!e.isDefaultPrevented() && | ||
shouldClientNavigate(e.currentTarget, e) && | ||
props.href | ||
) { | ||
e.preventDefault(); | ||
router.open(e.currentTarget, e, props.href, props.routerOptions); | ||
} | ||
handleLinkClick(e, router, props.href, props.routerOptions); | ||
} | ||
@@ -100,0 +81,0 @@ }) |
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 1 instance in 1 package
27140
-15.2%1
Infinity%80
-20%314
-13.26%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated