@react-aria/link 3.3.4 → 3.3.6
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 +31 -11
- package/dist/main.js.map +1 -1
- package/dist/module.js +31 -11
- package/dist/module.js.map +1 -1
- package/package.json +8 -8
package/dist/main.js
CHANGED
|
@@ -7,40 +7,60 @@ function $parcel$export(e, n, v, s) {
|
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
$parcel$export(module.exports, "useLink", () => $fbe6b19572273b2f$export$dcf14c9974fe2767);
|
|
10
|
-
|
|
10
|
+
/*
|
|
11
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
12
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
14
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
17
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
18
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
19
|
+
* governing permissions and limitations under the License.
|
|
20
|
+
*/ /*
|
|
21
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
22
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
23
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
24
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
25
|
+
*
|
|
26
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
27
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
28
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
29
|
+
* governing permissions and limitations under the License.
|
|
30
|
+
*/
|
|
11
31
|
|
|
12
32
|
|
|
13
33
|
function $fbe6b19572273b2f$export$dcf14c9974fe2767(props, ref) {
|
|
14
|
-
let { elementType: elementType =
|
|
34
|
+
let { elementType: elementType = "a" , onPress: onPress , onPressStart: onPressStart , onPressEnd: onPressEnd , // @ts-ignore
|
|
15
35
|
onClick: deprecatedOnClick , isDisabled: isDisabled , ...otherProps } = props;
|
|
16
36
|
let linkProps;
|
|
17
|
-
if (elementType !==
|
|
18
|
-
role:
|
|
37
|
+
if (elementType !== "a") linkProps = {
|
|
38
|
+
role: "link",
|
|
19
39
|
tabIndex: !isDisabled ? 0 : undefined
|
|
20
40
|
};
|
|
21
|
-
let { focusableProps: focusableProps } = $3NNeN$reactariafocus.useFocusable(props, ref);
|
|
22
|
-
let { pressProps: pressProps , isPressed: isPressed } = $3NNeN$reactariainteractions.usePress({
|
|
41
|
+
let { focusableProps: focusableProps } = (0, $3NNeN$reactariafocus.useFocusable)(props, ref);
|
|
42
|
+
let { pressProps: pressProps , isPressed: isPressed } = (0, $3NNeN$reactariainteractions.usePress)({
|
|
23
43
|
onPress: onPress,
|
|
24
44
|
onPressStart: onPressStart,
|
|
25
45
|
onPressEnd: onPressEnd,
|
|
26
46
|
isDisabled: isDisabled,
|
|
27
47
|
ref: ref
|
|
28
48
|
});
|
|
29
|
-
let domProps = $3NNeN$reactariautils.filterDOMProps(otherProps, {
|
|
49
|
+
let domProps = (0, $3NNeN$reactariautils.filterDOMProps)(otherProps, {
|
|
30
50
|
labelable: true
|
|
31
51
|
});
|
|
32
|
-
let interactionHandlers = $3NNeN$reactariautils.mergeProps(focusableProps, pressProps);
|
|
52
|
+
let interactionHandlers = (0, $3NNeN$reactariautils.mergeProps)(focusableProps, pressProps);
|
|
33
53
|
return {
|
|
34
54
|
isPressed: isPressed,
|
|
35
|
-
linkProps: $3NNeN$reactariautils.mergeProps(domProps, {
|
|
55
|
+
linkProps: (0, $3NNeN$reactariautils.mergeProps)(domProps, {
|
|
36
56
|
...interactionHandlers,
|
|
37
57
|
...linkProps,
|
|
38
|
-
|
|
58
|
+
"aria-disabled": isDisabled || undefined,
|
|
39
59
|
onClick: (e)=>{
|
|
40
60
|
pressProps.onClick(e);
|
|
41
61
|
if (deprecatedOnClick) {
|
|
42
62
|
deprecatedOnClick(e);
|
|
43
|
-
console.warn(
|
|
63
|
+
console.warn("onClick is deprecated, please use onPress");
|
|
44
64
|
}
|
|
45
65
|
}
|
|
46
66
|
})
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;;;AA6BO,SAAS,0CAAQ,KAAsB,EAAE,GAAgC,EAAY;IAC1F,IAAI,eACF,cAAc,eACd,QAAO,gBACP,aAAY,cACZ,WAAU,EACV,aAAa;IACb,SAAS,kBAAiB,cAC1B,WAAU,EACV,GAAG,YACJ,GAAG;IAEJ,IAAI;IACJ,IAAI,gBAAgB,KAClB,YAAY;QACV,MAAM;QACN,UAAU,CAAC,aAAa,IAAI,SAAS;IACvC;IAEF,IAAI,kBAAC,eAAc,EAAC,GAAG,CAAA,GAAA,kCAAW,EAAE,OAAO;IAC3C,IAAI,cAAC,WAAU,aAAE,UAAS,EAAC,GAAG,CAAA,GAAA,qCAAQ,AAAD,EAAE;iBAAC;sBAAS;oBAAc;oBAAY;aAAY;IAAG;IAC1F,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE,YAAY;QAAC,WAAW,IAAI;IAAA;IAC1D,IAAI,sBAAsB,CAAA,GAAA,gCAAS,EAAE,gBAAgB;IAErD,OAAO;mBACL;QACA,WAAW,CAAA,GAAA,gCAAU,AAAD,EAAE,UAAU;YAC9B,GAAG,mBAAmB;YACtB,GAAG,SAAS;YACZ,iBAAiB,cAAc;YAC/B,SAAS,CAAC,IAAM;gBACd,WAAW,OAAO,CAAC;gBACnB,IAAI,mBAAmB;oBACrB,kBAAkB;oBAClB,QAAQ,IAAI,CAAC;gBACf,CAAC;YACH;QACF;IACF;AACF;;CDtEC,GACD","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,40 +2,60 @@ 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
|
-
|
|
5
|
+
/*
|
|
6
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
7
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
+
* governing permissions and limitations under the License.
|
|
15
|
+
*/ /*
|
|
16
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
17
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
18
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
19
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
20
|
+
*
|
|
21
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
22
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
23
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
24
|
+
* governing permissions and limitations under the License.
|
|
25
|
+
*/
|
|
6
26
|
|
|
7
27
|
|
|
8
28
|
function $298d61e98472621b$export$dcf14c9974fe2767(props, ref) {
|
|
9
|
-
let { elementType: elementType =
|
|
29
|
+
let { elementType: elementType = "a" , onPress: onPress , onPressStart: onPressStart , onPressEnd: onPressEnd , // @ts-ignore
|
|
10
30
|
onClick: deprecatedOnClick , isDisabled: isDisabled , ...otherProps } = props;
|
|
11
31
|
let linkProps;
|
|
12
|
-
if (elementType !==
|
|
13
|
-
role:
|
|
32
|
+
if (elementType !== "a") linkProps = {
|
|
33
|
+
role: "link",
|
|
14
34
|
tabIndex: !isDisabled ? 0 : undefined
|
|
15
35
|
};
|
|
16
|
-
let { focusableProps: focusableProps } = $kKV4x$useFocusable(props, ref);
|
|
17
|
-
let { pressProps: pressProps , isPressed: isPressed } = $kKV4x$usePress({
|
|
36
|
+
let { focusableProps: focusableProps } = (0, $kKV4x$useFocusable)(props, ref);
|
|
37
|
+
let { pressProps: pressProps , isPressed: isPressed } = (0, $kKV4x$usePress)({
|
|
18
38
|
onPress: onPress,
|
|
19
39
|
onPressStart: onPressStart,
|
|
20
40
|
onPressEnd: onPressEnd,
|
|
21
41
|
isDisabled: isDisabled,
|
|
22
42
|
ref: ref
|
|
23
43
|
});
|
|
24
|
-
let domProps = $kKV4x$filterDOMProps(otherProps, {
|
|
44
|
+
let domProps = (0, $kKV4x$filterDOMProps)(otherProps, {
|
|
25
45
|
labelable: true
|
|
26
46
|
});
|
|
27
|
-
let interactionHandlers = $kKV4x$mergeProps(focusableProps, pressProps);
|
|
47
|
+
let interactionHandlers = (0, $kKV4x$mergeProps)(focusableProps, pressProps);
|
|
28
48
|
return {
|
|
29
49
|
isPressed: isPressed,
|
|
30
|
-
linkProps: $kKV4x$mergeProps(domProps, {
|
|
50
|
+
linkProps: (0, $kKV4x$mergeProps)(domProps, {
|
|
31
51
|
...interactionHandlers,
|
|
32
52
|
...linkProps,
|
|
33
|
-
|
|
53
|
+
"aria-disabled": isDisabled || undefined,
|
|
34
54
|
onClick: (e)=>{
|
|
35
55
|
pressProps.onClick(e);
|
|
36
56
|
if (deprecatedOnClick) {
|
|
37
57
|
deprecatedOnClick(e);
|
|
38
|
-
console.warn(
|
|
58
|
+
console.warn("onClick is deprecated, please use onPress");
|
|
39
59
|
}
|
|
40
60
|
}
|
|
41
61
|
})
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;AAAA;;;;;;;;;;ACAA;;;;;;;;;;CAUC,GAED;;;AA6BO,SAAS,0CAAQ,KAAsB,EAAE,GAAgC,EAAY;IAC1F,IAAI,eACF,cAAc,eACd,QAAO,gBACP,aAAY,cACZ,WAAU,EACV,aAAa;IACb,SAAS,kBAAiB,cAC1B,WAAU,EACV,GAAG,YACJ,GAAG;IAEJ,IAAI;IACJ,IAAI,gBAAgB,KAClB,YAAY;QACV,MAAM;QACN,UAAU,CAAC,aAAa,IAAI,SAAS;IACvC;IAEF,IAAI,kBAAC,eAAc,EAAC,GAAG,CAAA,GAAA,mBAAW,EAAE,OAAO;IAC3C,IAAI,cAAC,WAAU,aAAE,UAAS,EAAC,GAAG,CAAA,GAAA,eAAQ,AAAD,EAAE;iBAAC;sBAAS;oBAAc;oBAAY;aAAY;IAAG;IAC1F,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,YAAY;QAAC,WAAW,IAAI;IAAA;IAC1D,IAAI,sBAAsB,CAAA,GAAA,iBAAS,EAAE,gBAAgB;IAErD,OAAO;mBACL;QACA,WAAW,CAAA,GAAA,iBAAU,AAAD,EAAE,UAAU;YAC9B,GAAG,mBAAmB;YACtB,GAAG,SAAS;YACZ,iBAAiB,cAAc;YAC/B,SAAS,CAAC,IAAM;gBACd,WAAW,OAAO,CAAC;gBACnB,IAAI,mBAAmB;oBACrB,kBAAkB;oBAClB,QAAQ,IAAI,CAAC;gBACf,CAAC;YACH;QACF;IACF;AACF;;CDtEC,GACD","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":"module.js.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.6",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"url": "https://github.com/adobe/react-spectrum"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@
|
|
21
|
-
"@react-aria/
|
|
22
|
-
"@react-aria/
|
|
23
|
-
"@react-
|
|
24
|
-
"@react-types/
|
|
25
|
-
"@
|
|
20
|
+
"@react-aria/focus": "^3.10.1",
|
|
21
|
+
"@react-aria/interactions": "^3.13.1",
|
|
22
|
+
"@react-aria/utils": "^3.14.2",
|
|
23
|
+
"@react-types/link": "^3.3.6",
|
|
24
|
+
"@react-types/shared": "^3.16.0",
|
|
25
|
+
"@swc/helpers": "^0.4.14"
|
|
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": "5480d76bd815e239366f92852c76b6831ad2a4fd"
|
|
34
34
|
}
|