@react-aria/link 3.3.1 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +1 -19
- package/dist/main.js.map +1 -1
- package/dist/module.js +0 -6
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +4 -3
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/index.ts +2 -2
- package/src/useLink.ts +5 -4
package/dist/main.js
CHANGED
|
@@ -2,28 +2,11 @@ var $3NNeN$reactariautils = require("@react-aria/utils");
|
|
|
2
2
|
var $3NNeN$reactariafocus = require("@react-aria/focus");
|
|
3
3
|
var $3NNeN$reactariainteractions = require("@react-aria/interactions");
|
|
4
4
|
|
|
5
|
-
function $parcel$exportWildcard(dest, source) {
|
|
6
|
-
Object.keys(source).forEach(function(key) {
|
|
7
|
-
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
Object.defineProperty(dest, key, {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: function get() {
|
|
14
|
-
return source[key];
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
return dest;
|
|
20
|
-
}
|
|
21
5
|
function $parcel$export(e, n, v, s) {
|
|
22
6
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
23
7
|
}
|
|
24
|
-
var $fbe6b19572273b2f$exports = {};
|
|
25
8
|
|
|
26
|
-
$parcel$export(
|
|
9
|
+
$parcel$export(module.exports, "useLink", () => $fbe6b19572273b2f$export$dcf14c9974fe2767);
|
|
27
10
|
|
|
28
11
|
|
|
29
12
|
|
|
@@ -65,7 +48,6 @@ function $fbe6b19572273b2f$export$dcf14c9974fe2767(props, ref) {
|
|
|
65
48
|
}
|
|
66
49
|
|
|
67
50
|
|
|
68
|
-
$parcel$exportWildcard(module.exports, $fbe6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iB,EAAE,CAAC;oBACtB,iBAAiB,CAAC,CAAC;oBACnB,OAAO,CAAC,IAAI,CAAC,CAA2C;gBAC1D,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC","sources":["packages/@react-aria/link/src/index.ts","packages/@react-aria/link/src/useLink.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport type {AriaLinkOptions, LinkAria} from './useLink';\nexport {useLink} from './useLink';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLinkProps} from '@react-types/link';\nimport {DOMAttributes, FocusableElement} from '@react-types/shared';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {RefObject} from 'react';\nimport {useFocusable} from '@react-aria/focus';\nimport {usePress} from '@react-aria/interactions';\n\nexport interface AriaLinkOptions extends AriaLinkProps {\n /** Whether the link is disabled. */\n isDisabled?: boolean,\n /**\n * The HTML element used to render the link, e.g. 'a', or 'span'.\n * @default 'a'\n */\n elementType?: string\n}\n\nexport interface LinkAria {\n /** Props for the link element. */\n linkProps: DOMAttributes,\n /** Whether the link is currently pressed. */\n isPressed: boolean\n}\n\n/**\n * Provides the behavior and accessibility implementation for a link component.\n * A link allows a user to navigate to another page or resource within a web page\n * or application.\n */\nexport function useLink(props: AriaLinkOptions, ref: RefObject<FocusableElement>): LinkAria {\n let {\n elementType = 'a',\n onPress,\n onPressStart,\n onPressEnd,\n // @ts-ignore\n onClick: deprecatedOnClick,\n isDisabled,\n ...otherProps\n } = props;\n\n let linkProps: DOMAttributes;\n if (elementType !== 'a') {\n linkProps = {\n role: 'link',\n tabIndex: !isDisabled ? 0 : undefined\n };\n }\n let {focusableProps} = useFocusable(props, ref);\n let {pressProps, isPressed} = usePress({onPress, onPressStart, onPressEnd, isDisabled, ref});\n let domProps = filterDOMProps(otherProps, {labelable: true});\n let interactionHandlers = mergeProps(focusableProps, pressProps);\n\n return {\n isPressed, // Used to indicate press state for visual\n linkProps: mergeProps(domProps, {\n ...interactionHandlers,\n ...linkProps,\n 'aria-disabled': isDisabled || undefined,\n onClick: (e) => {\n pressProps.onClick(e);\n if (deprecatedOnClick) {\n deprecatedOnClick(e);\n console.warn('onClick is deprecated, please use onPress');\n }\n }\n })\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -2,12 +2,6 @@ import {filterDOMProps as $kKV4x$filterDOMProps, mergeProps as $kKV4x$mergeProps
|
|
|
2
2
|
import {useFocusable as $kKV4x$useFocusable} from "@react-aria/focus";
|
|
3
3
|
import {usePress as $kKV4x$usePress} from "@react-aria/interactions";
|
|
4
4
|
|
|
5
|
-
function $parcel$export(e, n, v, s) {
|
|
6
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
7
|
-
}
|
|
8
|
-
var $298d61e98472621b$exports = {};
|
|
9
|
-
|
|
10
|
-
$parcel$export($298d61e98472621b$exports, "useLink", () => $298d61e98472621b$export$dcf14c9974fe2767);
|
|
11
5
|
|
|
12
6
|
|
|
13
7
|
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+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ria/link/src/index.ts","packages/@react-aria/link/src/useLink.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport type {AriaLinkOptions, LinkAria} from './useLink';\nexport {useLink} from './useLink';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaLinkProps} from '@react-types/link';\nimport {DOMAttributes, FocusableElement} from '@react-types/shared';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {RefObject} from 'react';\nimport {useFocusable} from '@react-aria/focus';\nimport {usePress} from '@react-aria/interactions';\n\nexport interface AriaLinkOptions extends AriaLinkProps {\n /** Whether the link is disabled. */\n isDisabled?: boolean,\n /**\n * The HTML element used to render the link, e.g. 'a', or 'span'.\n * @default 'a'\n */\n elementType?: string\n}\n\nexport interface LinkAria {\n /** Props for the link element. */\n linkProps: DOMAttributes,\n /** Whether the link is currently pressed. */\n isPressed: boolean\n}\n\n/**\n * Provides the behavior and accessibility implementation for a link component.\n * A link allows a user to navigate to another page or resource within a web page\n * or application.\n */\nexport function useLink(props: AriaLinkOptions, ref: RefObject<FocusableElement>): LinkAria {\n let {\n elementType = 'a',\n onPress,\n onPressStart,\n onPressEnd,\n // @ts-ignore\n onClick: deprecatedOnClick,\n isDisabled,\n ...otherProps\n } = props;\n\n let linkProps: DOMAttributes;\n if (elementType !== 'a') {\n linkProps = {\n role: 'link',\n tabIndex: !isDisabled ? 0 : undefined\n };\n }\n let {focusableProps} = useFocusable(props, ref);\n let {pressProps, isPressed} = usePress({onPress, onPressStart, onPressEnd, isDisabled, ref});\n let domProps = filterDOMProps(otherProps, {labelable: true});\n let interactionHandlers = mergeProps(focusableProps, pressProps);\n\n return {\n isPressed, // Used to indicate press state for visual\n linkProps: mergeProps(domProps, {\n ...interactionHandlers,\n ...linkProps,\n 'aria-disabled': isDisabled || undefined,\n onClick: (e) => {\n pressProps.onClick(e);\n if (deprecatedOnClick) {\n deprecatedOnClick(e);\n console.warn('onClick is deprecated, please use onPress');\n }\n }\n })\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AriaLinkProps } from "@react-types/link";
|
|
2
|
-
import {
|
|
2
|
+
import { DOMAttributes, FocusableElement } from "@react-types/shared";
|
|
3
|
+
import { RefObject } from "react";
|
|
3
4
|
export interface AriaLinkOptions extends AriaLinkProps {
|
|
4
5
|
/** Whether the link is disabled. */
|
|
5
6
|
isDisabled?: boolean;
|
|
@@ -11,7 +12,7 @@ export interface AriaLinkOptions extends AriaLinkProps {
|
|
|
11
12
|
}
|
|
12
13
|
export interface LinkAria {
|
|
13
14
|
/** Props for the link element. */
|
|
14
|
-
linkProps:
|
|
15
|
+
linkProps: DOMAttributes;
|
|
15
16
|
/** Whether the link is currently pressed. */
|
|
16
17
|
isPressed: boolean;
|
|
17
18
|
}
|
|
@@ -20,6 +21,6 @@ export interface LinkAria {
|
|
|
20
21
|
* A link allows a user to navigate to another page or resource within a web page
|
|
21
22
|
* or application.
|
|
22
23
|
*/
|
|
23
|
-
export function useLink(props: AriaLinkOptions, ref: RefObject<
|
|
24
|
+
export function useLink(props: AriaLinkOptions, ref: RefObject<FocusableElement>): LinkAria;
|
|
24
25
|
|
|
25
26
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;AAmBA,gCAAiC,SAAQ,aAAa;IACpD,oCAAoC;IACpC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;IACE,kCAAkC;IAClC,SAAS,EAAE,aAAa,CAAC;IACzB,6CAA6C;IAC7C,SAAS,EAAE,OAAO,CAAA;CACnB;AAED;;;;GAIG;AACH,wBAAwB,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,UAAU,gBAAgB,CAAC,GAAG,QAAQ,CAuC1F","sources":["packages/@react-aria/link/src/packages/@react-aria/link/src/useLink.ts","packages/@react-aria/link/src/packages/@react-aria/link/src/index.ts","packages/@react-aria/link/src/index.ts"],"sourcesContent":[null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport type {AriaLinkOptions, LinkAria} from './useLink';\nexport {useLink} from './useLink';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/link",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.2",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/runtime": "^7.6.2",
|
|
21
|
-
"@react-aria/focus": "^3.
|
|
22
|
-
"@react-aria/interactions": "^3.
|
|
23
|
-
"@react-aria/utils": "^3.13.
|
|
24
|
-
"@react-types/link": "^3.3.
|
|
25
|
-
"@react-types/shared": "^3.
|
|
21
|
+
"@react-aria/focus": "^3.7.0",
|
|
22
|
+
"@react-aria/interactions": "^3.10.0",
|
|
23
|
+
"@react-aria/utils": "^3.13.2",
|
|
24
|
+
"@react-types/link": "^3.3.2",
|
|
25
|
+
"@react-types/shared": "^3.14.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "cd7c0ec917122c7612f653c22f8ed558f8b66ecd"
|
|
34
34
|
}
|
package/src/index.ts
CHANGED
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
export
|
|
12
|
+
export type {AriaLinkOptions, LinkAria} from './useLink';
|
|
13
|
+
export {useLink} from './useLink';
|
package/src/useLink.ts
CHANGED
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {AriaLinkProps} from '@react-types/link';
|
|
14
|
+
import {DOMAttributes, FocusableElement} from '@react-types/shared';
|
|
14
15
|
import {filterDOMProps, mergeProps} from '@react-aria/utils';
|
|
15
|
-
import {
|
|
16
|
+
import {RefObject} from 'react';
|
|
16
17
|
import {useFocusable} from '@react-aria/focus';
|
|
17
18
|
import {usePress} from '@react-aria/interactions';
|
|
18
19
|
|
|
@@ -28,7 +29,7 @@ export interface AriaLinkOptions extends AriaLinkProps {
|
|
|
28
29
|
|
|
29
30
|
export interface LinkAria {
|
|
30
31
|
/** Props for the link element. */
|
|
31
|
-
linkProps:
|
|
32
|
+
linkProps: DOMAttributes,
|
|
32
33
|
/** Whether the link is currently pressed. */
|
|
33
34
|
isPressed: boolean
|
|
34
35
|
}
|
|
@@ -38,7 +39,7 @@ export interface LinkAria {
|
|
|
38
39
|
* A link allows a user to navigate to another page or resource within a web page
|
|
39
40
|
* or application.
|
|
40
41
|
*/
|
|
41
|
-
export function useLink(props: AriaLinkOptions, ref: RefObject<
|
|
42
|
+
export function useLink(props: AriaLinkOptions, ref: RefObject<FocusableElement>): LinkAria {
|
|
42
43
|
let {
|
|
43
44
|
elementType = 'a',
|
|
44
45
|
onPress,
|
|
@@ -50,7 +51,7 @@ export function useLink(props: AriaLinkOptions, ref: RefObject<HTMLElement>): Li
|
|
|
50
51
|
...otherProps
|
|
51
52
|
} = props;
|
|
52
53
|
|
|
53
|
-
let linkProps:
|
|
54
|
+
let linkProps: DOMAttributes;
|
|
54
55
|
if (elementType !== 'a') {
|
|
55
56
|
linkProps = {
|
|
56
57
|
role: 'link',
|