Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@react-aria/link

Package Overview
Dependencies
Maintainers
1
Versions
837
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-aria/link - npm Package Compare versions

Comparing version 3.0.0-alpha.1 to 3.0.0-nightly.672

dist/main.js.map

85

dist/main.js

@@ -1,7 +0,14 @@

var _babelRuntimeHelpersObjectSpread = $parcel$interopDefault(require("@babel/runtime/helpers/objectSpread2"));
var {
usePress
} = require("@react-aria/interactions");
var useId = require("@react-aria/utils").useId;
var {
filterDOMProps,
mergeProps
} = require("@react-aria/utils");
var usePress = require("@react-aria/interactions").usePress;
var _babelRuntimeHelpersObjectWithoutPropertiesLoose = $parcel$interopDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var _babelRuntimeHelpersExtends = $parcel$interopDefault(require("@babel/runtime/helpers/extends"));
function $parcel$interopDefault(a) {

@@ -11,41 +18,44 @@ return a && a.__esModule ? a.default : a;

function useLink(props) {
var id = props.id,
href = props.href,
_props$tabIndex = props.tabIndex,
tabIndex = _props$tabIndex === void 0 ? 0 : _props$tabIndex,
children = props.children,
onPress = props.onPress,
onPressStart = props.onPressStart,
onPressEnd = props.onPressEnd,
deprecatedOnClick = props.onClick,
isDisabled = props.isDisabled,
ref = props.ref;
var linkProps;
/**
* Provides the behavior and accessibility implementation for a link component.
* A link allows a user to navigate to another page or resource within a web page
* or application.
*/
function useLink(props, ref) {
let {
elementType = 'a',
onPress,
onPressStart,
onPressEnd,
// @ts-ignore
onClick: deprecatedOnClick,
isDisabled
} = props,
otherProps = _babelRuntimeHelpersObjectWithoutPropertiesLoose(props, ["elementType", "onPress", "onPressStart", "onPressEnd", "onClick", "isDisabled"]);
if (typeof children === 'string') {
let linkProps;
if (elementType !== 'a') {
linkProps = {
role: 'link',
tabIndex: !isDisabled ? tabIndex : undefined,
'aria-disabled': isDisabled || undefined
tabIndex: !isDisabled ? 0 : undefined
};
}
if (href) {
console.warn('href is deprecated, please use an anchor element as children');
}
var _usePress = usePress({
onPress: onPress,
onPressStart: onPressStart,
onPressEnd: onPressEnd,
isDisabled: isDisabled,
ref: ref
}),
pressProps = _usePress.pressProps;
let {
pressProps
} = usePress({
onPress,
onPressStart,
onPressEnd,
isDisabled,
ref
});
let domProps = filterDOMProps(otherProps, {
labelable: true
});
return {
linkProps: _babelRuntimeHelpersObjectSpread({}, pressProps, {}, linkProps, {
id: useId(id),
onClick: function onClick(e) {
linkProps: mergeProps(domProps, _babelRuntimeHelpersExtends({}, pressProps, linkProps, {
'aria-disabled': isDisabled || undefined,
onClick: e => {
pressProps.onClick(e);

@@ -58,6 +68,7 @@

}
})
}))
};
}
exports.useLink = useLink;
exports.useLink = useLink;
//# sourceMappingURL=main.js.map

@@ -1,31 +0,32 @@

import _babelRuntimeHelpersEsmObjectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import { useId } from "@react-aria/utils";
import { usePress } from "@react-aria/interactions";
export function useLink(props) {
import { filterDOMProps, mergeProps } from "@react-aria/utils";
import _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
import _babelRuntimeHelpersEsmExtends from "@babel/runtime/helpers/esm/extends";
/**
* Provides the behavior and accessibility implementation for a link component.
* A link allows a user to navigate to another page or resource within a web page
* or application.
*/
export function useLink(props, ref) {
let {
id,
href,
tabIndex = 0,
children,
elementType = 'a',
onPress,
onPressStart,
onPressEnd,
// @ts-ignore
onClick: deprecatedOnClick,
isDisabled,
ref
} = props;
isDisabled
} = props,
otherProps = _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose(props, ["elementType", "onPress", "onPressStart", "onPressEnd", "onClick", "isDisabled"]);
let linkProps;
if (typeof children === 'string') {
if (elementType !== 'a') {
linkProps = {
role: 'link',
tabIndex: !isDisabled ? tabIndex : undefined,
'aria-disabled': isDisabled || undefined
tabIndex: !isDisabled ? 0 : undefined
};
}
if (href) {
console.warn('href is deprecated, please use an anchor element as children');
}
let {

@@ -40,5 +41,8 @@ pressProps

});
let domProps = filterDOMProps(otherProps, {
labelable: true
});
return {
linkProps: _babelRuntimeHelpersEsmObjectSpread({}, pressProps, {}, linkProps, {
id: useId(id),
linkProps: mergeProps(domProps, _babelRuntimeHelpersEsmExtends({}, pressProps, linkProps, {
'aria-disabled': isDisabled || undefined,
onClick: e => {

@@ -52,4 +56,5 @@ pressProps.onClick(e);

}
})
}))
};
}
}
//# sourceMappingURL=module.js.map

@@ -1,17 +0,23 @@

import { DOMProps, PressEvent } from "@react-types/shared";
import { HTMLAttributes, RefObject, SyntheticEvent } from "react";
import { LinkProps } from "@react-types/link";
export interface AriaLinkProps extends LinkProps, DOMProps {
import { AriaLinkProps } from "@react-types/link";
import { HTMLAttributes, RefObject } from "react";
export interface AriaLinkOptions extends AriaLinkProps {
/** Whether the link is disabled. */
isDisabled?: boolean;
href?: string;
tabIndex?: number;
onPress?: (e: PressEvent) => void;
onClick?: (e: SyntheticEvent) => void;
ref: RefObject<HTMLElement | null>;
/**
* The HTML element used to render the link, e.g. 'a', or 'span'.
* @default 'a'
*/
elementType?: string;
}
export interface LinkAria {
linkProps: HTMLAttributes<HTMLDivElement>;
/** Props for the link element. */
linkProps: HTMLAttributes<HTMLElement>;
}
export function useLink(props: AriaLinkProps): LinkAria;
/**
* Provides the behavior and accessibility implementation for a link component.
* A link allows a user to navigate to another page or resource within a web page
* or application.
*/
export function useLink(props: AriaLinkOptions, ref: RefObject<HTMLElement>): LinkAria;
//# sourceMappingURL=types.d.ts.map
{
"name": "@react-aria/link",
"version": "3.0.0-alpha.1",
"version": "3.0.0-nightly.672+9853bacb",
"description": "Spectrum UI components in React",

@@ -11,3 +11,4 @@ "license": "Apache-2.0",

"files": [
"dist"
"dist",
"src"
],

@@ -17,10 +18,10 @@ "sideEffects": false,

"type": "git",
"url": "https://github.com/adobe-private/react-spectrum-v3"
"url": "https://github.com/adobe/react-spectrum"
},
"dependencies": {
"@babel/runtime": "^7.6.2",
"@react-aria/interactions": "^3.0.0-rc.2",
"@react-aria/utils": "^3.0.0-rc.2",
"@react-types/link": "^3.0.0-alpha.1",
"@react-types/shared": "^3.0.0-rc.2"
"@react-aria/interactions": "3.0.0-nightly.672+9853bacb",
"@react-aria/utils": "3.0.0-nightly.672+9853bacb",
"@react-types/link": "3.0.0-nightly.672+9853bacb",
"@react-types/shared": "3.0.0-nightly.672+9853bacb"
},

@@ -33,3 +34,3 @@ "peerDependencies": {

},
"gitHead": "207e6ee9076905c96638a7f81a367758872e1410"
"gitHead": "9853bacb98dd37c64faf573e5cb1a6493e2e6f08"
}
# @react-aria/link
This package is part of [react-spectrum](https://github.com/adobe-private/react-spectrum-v3). See the repo for more details.
This package is part of [react-spectrum](https://github.com/adobe/react-spectrum). See the repo for more details.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc