@react-aria/link
Advanced tools
Comparing version 3.0.0-alpha.1 to 3.0.0-nightly.672
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28663
11
217
239
1
80
2
31
- Removed@react-aria/interactions@3.22.5(transitive)
- Removed@react-aria/ssr@3.9.7(transitive)
- Removed@react-aria/utils@3.26.0(transitive)
- Removed@react-stately/utils@3.10.5(transitive)
- Removed@react-types/link@3.5.9(transitive)
- Removed@react-types/shared@3.26.0(transitive)
- Removed@swc/helpers@0.5.15(transitive)
- Removedclsx@2.1.1(transitive)
- Removedtslib@2.8.1(transitive)