@react-aria/link 3.1.3 → 3.2.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 CHANGED
@@ -1,75 +1,71 @@
1
- var {
2
- usePress
3
- } = require("@react-aria/interactions");
1
+ var $gi03o$reactariautils = require("@react-aria/utils");
2
+ var $gi03o$reactariafocus = require("@react-aria/focus");
3
+ var $gi03o$reactariainteractions = require("@react-aria/interactions");
4
4
 
5
- var {
6
- filterDOMProps,
7
- mergeProps
8
- } = require("@react-aria/utils");
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
+ }
9
10
 
10
- var _babelRuntimeHelpersObjectWithoutPropertiesLoose = $parcel$interopDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
11
-
12
- var _babelRuntimeHelpersExtends = $parcel$interopDefault(require("@babel/runtime/helpers/extends"));
11
+ Object.defineProperty(dest, key, {
12
+ enumerable: true,
13
+ get: function get() {
14
+ return source[key];
15
+ }
16
+ });
17
+ });
13
18
 
14
- function $parcel$interopDefault(a) {
15
- return a && a.__esModule ? a.default : a;
19
+ return dest;
16
20
  }
21
+ function $parcel$export(e, n, v, s) {
22
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
23
+ }
24
+ var $bdb64ee24c162605$exports = {};
25
+
26
+ $parcel$export($bdb64ee24c162605$exports, "useLink", () => $bdb64ee24c162605$export$dcf14c9974fe2767);
17
27
 
18
- /**
19
- * Provides the behavior and accessibility implementation for a link component.
20
- * A link allows a user to navigate to another page or resource within a web page
21
- * or application.
22
- */
23
- function useLink(props, ref) {
24
- let {
25
- elementType = 'a',
26
- onPress,
27
- onPressStart,
28
- onPressEnd,
29
- // @ts-ignore
30
- onClick: deprecatedOnClick,
31
- isDisabled
32
- } = props,
33
- otherProps = _babelRuntimeHelpersObjectWithoutPropertiesLoose(props, ["elementType", "onPress", "onPressStart", "onPressEnd", "onClick", "isDisabled"]);
34
28
 
35
- let linkProps;
36
29
 
37
- if (elementType !== 'a') {
38
- linkProps = {
39
- role: 'link',
40
- tabIndex: !isDisabled ? 0 : undefined
30
+ function $bdb64ee24c162605$export$dcf14c9974fe2767(props, ref) {
31
+ let { elementType: elementType = 'a' , onPress: onPress , onPressStart: onPressStart , onPressEnd: onPressEnd , // @ts-ignore
32
+ onClick: deprecatedOnClick , isDisabled: isDisabled , ...otherProps } = props;
33
+ let linkProps;
34
+ if (elementType !== 'a') linkProps = {
35
+ role: 'link',
36
+ tabIndex: !isDisabled ? 0 : undefined
37
+ };
38
+ let { focusableProps: focusableProps } = $gi03o$reactariafocus.useFocusable(props, ref);
39
+ let { pressProps: pressProps , isPressed: isPressed } = $gi03o$reactariainteractions.usePress({
40
+ onPress: onPress,
41
+ onPressStart: onPressStart,
42
+ onPressEnd: onPressEnd,
43
+ isDisabled: isDisabled,
44
+ ref: ref
45
+ });
46
+ let domProps = $gi03o$reactariautils.filterDOMProps(otherProps, {
47
+ labelable: true
48
+ });
49
+ let interactionHandlers = $gi03o$reactariautils.mergeProps(focusableProps, pressProps);
50
+ return {
51
+ isPressed: isPressed,
52
+ linkProps: $gi03o$reactariautils.mergeProps(domProps, {
53
+ ...interactionHandlers,
54
+ ...linkProps,
55
+ 'aria-disabled': isDisabled || undefined,
56
+ onClick: (e)=>{
57
+ pressProps.onClick(e);
58
+ if (deprecatedOnClick) {
59
+ deprecatedOnClick(e);
60
+ console.warn('onClick is deprecated, please use onPress');
61
+ }
62
+ }
63
+ })
41
64
  };
42
- }
65
+ }
43
66
 
44
- let {
45
- pressProps,
46
- isPressed
47
- } = usePress({
48
- onPress,
49
- onPressStart,
50
- onPressEnd,
51
- isDisabled,
52
- ref
53
- });
54
- let domProps = filterDOMProps(otherProps, {
55
- labelable: true
56
- });
57
- return {
58
- isPressed,
59
- // Used to indicate press state for visual
60
- linkProps: mergeProps(domProps, _babelRuntimeHelpersExtends({}, pressProps, linkProps, {
61
- 'aria-disabled': isDisabled || undefined,
62
- onClick: e => {
63
- pressProps.onClick(e);
64
67
 
65
- if (deprecatedOnClick) {
66
- deprecatedOnClick(e);
67
- console.warn('onClick is deprecated, please use onPress');
68
- }
69
- }
70
- }))
71
- };
72
- }
68
+ $parcel$exportWildcard(module.exports, $bdb64ee24c162605$exports);
69
+
73
70
 
74
- exports.useLink = useLink;
75
71
  //# sourceMappingURL=main.js.map
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;AAAA,SAASA,sBAAT,CAAgCC,CAAhC,EAAmC;AACjC,SAAOA,CAAC,IAAIA,CAAC,CAACC,UAAP,GAAoBD,CAAC,CAACE,OAAtB,GAAgCF,CAAvC;AACD;;ACgCD;;;;;AAKO,SAASG,OAAT,CAAiBC,KAAjB,EAAyCC,GAAzC,EAAgF;AACrF,MAAI;AACFC,IAAAA,WAAW,GAAG,GADZ;AAEFC,IAAAA,OAFE;AAGFC,IAAAA,YAHE;AAIFC,IAAAA,UAJE;AAKF;AACAC,IAAAA,OAAO,EAAEC,iBANP;AAOFC,IAAAA;AAPE,MASAR,KATJ;AAAA,MAQKS,UARL,oDASIT,KATJ;;AAWA,MAAIU,SAAJ;;AACA,MAAIR,WAAW,KAAK,GAApB,EAAyB;AACvBQ,IAAAA,SAAS,GAAG;AACVC,MAAAA,IAAI,EAAE,MADI;AAEVC,MAAAA,QAAQ,EAAE,CAACJ,UAAD,GAAc,CAAd,GAAkBK;AAFlB,KAAZ;AAID;;AAED,MAAI;AAACC,IAAAA,UAAD;AAAaC,IAAAA;AAAb,MAA0BC,QAAQ,CAAC;AAACb,IAAAA,OAAD;AAAUC,IAAAA,YAAV;AAAwBC,IAAAA,UAAxB;AAAoCG,IAAAA,UAApC;AAAgDP,IAAAA;AAAhD,GAAD,CAAtC;AACA,MAAIgB,QAAQ,GAAGC,cAAc,CAACT,UAAD,EAAa;AAACU,IAAAA,SAAS,EAAE;AAAZ,GAAb,CAA7B;AAEA,SAAO;AACLJ,IAAAA,SADK;AACM;AACXL,IAAAA,SAAS,EAAEU,UAAU,CAACH,QAAD,kCAChBH,UADgB,EAEhBJ,SAFgB;AAGnB,uBAAiBF,UAAU,IAAIK,SAHZ;AAInBP,MAAAA,OAAO,EAAGe,CAAD,IAAO;AACdP,QAAAA,UAAU,CAACR,OAAX,CAAmBe,CAAnB;;AACA,YAAId,iBAAJ,EAAuB;AACrBA,UAAAA,iBAAiB,CAACc,CAAD,CAAjB;AACAC,UAAAA,OAAO,CAACC,IAAR,CAAa,2CAAb;AACD;AACF;AAVkB;AAFhB,GAAP;AAeD","sources":["./node_modules/@parcel/scope-hoisting/lib/helpers.js","./packages/@react-aria/link/src/useLink.ts"],"sourcesContent":["function $parcel$interopDefault(a) {\n return a && a.__esModule ? a.default : a;\n}\n\nfunction $parcel$defineInteropFlag(a) {\n Object.defineProperty(a, '__esModule', {value: true});\n}\n\nfunction $parcel$exportWildcard(dest, source) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule') {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function get() {\n return source[key];\n },\n });\n });\n\n return dest;\n}\n\nfunction $parcel$missingModule(name) {\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n}\n\nvar $parcel$global =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\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 {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {HTMLAttributes, RefObject} from 'react';\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: HTMLAttributes<HTMLElement>,\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<HTMLElement>): 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: HTMLAttributes<HTMLElement>;\n if (elementType !== 'a') {\n linkProps = {\n role: 'link',\n tabIndex: !isDisabled ? 0 : undefined\n };\n }\n\n let {pressProps, isPressed} = usePress({onPress, onPressStart, onPressEnd, isDisabled, ref});\n let domProps = filterDOMProps(otherProps, {labelable: true});\n\n return {\n isPressed, // Used to indicate press state for visual\n linkProps: mergeProps(domProps, {\n ...pressProps,\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":["$parcel$interopDefault","a","__esModule","default","useLink","props","ref","elementType","onPress","onPressStart","onPressEnd","onClick","deprecatedOnClick","isDisabled","otherProps","linkProps","role","tabIndex","undefined","pressProps","isPressed","usePress","domProps","filterDOMProps","labelable","mergeProps","e","console","warn"],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;SCwCgB,yCAAO,CAAC,KAAsB,EAAE,GAA2B,EAAY,CAAC;IACtF,GAAG,CAAC,CAAC,cACH,WAAW,GAAG,CAAG,cACjB,OAAO,iBACP,YAAY,eACZ,UAAU,GACV,EAAa,AAAb,WAAa;IACb,OAAO,EAAE,iBAAiB,eAC1B,UAAU,MACP,UAAU,CACf,CAAC,GAAG,KAAK;IAET,GAAG,CAAC,SAAS;IACb,EAAE,EAAE,WAAW,KAAK,CAAG,IACrB,SAAS,GAAG,CAAC;QACX,IAAI,EAAE,CAAM;QACZ,QAAQ,GAAG,UAAU,GAAG,CAAC,GAAG,SAAS;IACvC,CAAC;IAEH,GAAG,CAAC,CAAC,iBAAA,cAAc,EAAA,CAAC,GAAG,kCAAY,CAAC,KAAK,EAAE,GAAG;IAC9C,GAAG,CAAC,CAAC,aAAA,UAAU,cAAE,SAAS,EAAA,CAAC,GAAG,qCAAQ,CAAC,CAAC;iBAAA,OAAO;sBAAE,YAAY;oBAAE,UAAU;oBAAE,UAAU;aAAE,GAAG;IAAA,CAAC;IAC3F,GAAG,CAAC,QAAQ,GAAG,oCAAc,CAAC,UAAU,EAAE,CAAC;QAAA,SAAS,EAAE,IAAI;IAAA,CAAC;IAC3D,GAAG,CAAC,mBAAmB,GAAG,gCAAU,CAAC,cAAc,EAAE,UAAU;IAE/D,MAAM,CAAC,CAAC;mBACN,SAAS;QACT,SAAS,EAAE,gCAAU,CAAC,QAAQ,EAAE,CAAC;eAC5B,mBAAmB;eACnB,SAAS;YACZ,CAAe,gBAAE,UAAU,IAAI,SAAS;YACxC,OAAO,GAAG,CAAC,GAAK,CAAC;gBACf,UAAU,CAAC,OAAO,CAAC,CAAC;gBACpB,EAAE,EAAE,iBAAiB,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 */\n\nexport * 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 {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {HTMLAttributes, 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: HTMLAttributes<HTMLElement>,\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<HTMLElement>): 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: HTMLAttributes<HTMLElement>;\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
@@ -1,61 +1,55 @@
1
- import { usePress } from "@react-aria/interactions";
2
- import { filterDOMProps, mergeProps } from "@react-aria/utils";
3
- import _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
4
- import _babelRuntimeHelpersEsmExtends from "@babel/runtime/helpers/esm/extends";
5
-
6
- /**
7
- * Provides the behavior and accessibility implementation for a link component.
8
- * A link allows a user to navigate to another page or resource within a web page
9
- * or application.
10
- */
11
- export function useLink(props, ref) {
12
- let {
13
- elementType = 'a',
14
- onPress,
15
- onPressStart,
16
- onPressEnd,
17
- // @ts-ignore
18
- onClick: deprecatedOnClick,
19
- isDisabled
20
- } = props,
21
- otherProps = _babelRuntimeHelpersEsmObjectWithoutPropertiesLoose(props, ["elementType", "onPress", "onPressStart", "onPressEnd", "onClick", "isDisabled"]);
22
-
23
- let linkProps;
24
-
25
- if (elementType !== 'a') {
26
- linkProps = {
27
- role: 'link',
28
- tabIndex: !isDisabled ? 0 : undefined
1
+ import {filterDOMProps as $k1pim$filterDOMProps, mergeProps as $k1pim$mergeProps} from "@react-aria/utils";
2
+ import {useFocusable as $k1pim$useFocusable} from "@react-aria/focus";
3
+ import {usePress as $k1pim$usePress} from "@react-aria/interactions";
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 $c80650969d556788$exports = {};
9
+
10
+ $parcel$export($c80650969d556788$exports, "useLink", () => $c80650969d556788$export$dcf14c9974fe2767);
11
+
12
+
13
+
14
+ function $c80650969d556788$export$dcf14c9974fe2767(props, ref) {
15
+ let { elementType: elementType = 'a' , onPress: onPress , onPressStart: onPressStart , onPressEnd: onPressEnd , // @ts-ignore
16
+ onClick: deprecatedOnClick , isDisabled: isDisabled , ...otherProps } = props;
17
+ let linkProps;
18
+ if (elementType !== 'a') linkProps = {
19
+ role: 'link',
20
+ tabIndex: !isDisabled ? 0 : undefined
21
+ };
22
+ let { focusableProps: focusableProps } = $k1pim$useFocusable(props, ref);
23
+ let { pressProps: pressProps , isPressed: isPressed } = $k1pim$usePress({
24
+ onPress: onPress,
25
+ onPressStart: onPressStart,
26
+ onPressEnd: onPressEnd,
27
+ isDisabled: isDisabled,
28
+ ref: ref
29
+ });
30
+ let domProps = $k1pim$filterDOMProps(otherProps, {
31
+ labelable: true
32
+ });
33
+ let interactionHandlers = $k1pim$mergeProps(focusableProps, pressProps);
34
+ return {
35
+ isPressed: isPressed,
36
+ linkProps: $k1pim$mergeProps(domProps, {
37
+ ...interactionHandlers,
38
+ ...linkProps,
39
+ 'aria-disabled': isDisabled || undefined,
40
+ onClick: (e)=>{
41
+ pressProps.onClick(e);
42
+ if (deprecatedOnClick) {
43
+ deprecatedOnClick(e);
44
+ console.warn('onClick is deprecated, please use onPress');
45
+ }
46
+ }
47
+ })
29
48
  };
30
- }
31
-
32
- let {
33
- pressProps,
34
- isPressed
35
- } = usePress({
36
- onPress,
37
- onPressStart,
38
- onPressEnd,
39
- isDisabled,
40
- ref
41
- });
42
- let domProps = filterDOMProps(otherProps, {
43
- labelable: true
44
- });
45
- return {
46
- isPressed,
47
- // Used to indicate press state for visual
48
- linkProps: mergeProps(domProps, _babelRuntimeHelpersEsmExtends({}, pressProps, linkProps, {
49
- 'aria-disabled': isDisabled || undefined,
50
- onClick: e => {
51
- pressProps.onClick(e);
52
-
53
- if (deprecatedOnClick) {
54
- deprecatedOnClick(e);
55
- console.warn('onClick is deprecated, please use onPress');
56
- }
57
- }
58
- }))
59
- };
60
49
  }
50
+
51
+
52
+
53
+
54
+ export {$c80650969d556788$export$dcf14c9974fe2767 as useLink};
61
55
  //# sourceMappingURL=module.js.map
@@ -1 +1 @@
1
- {"mappings":";;;;;AAkCA;;;;;OAKO,SAASA,OAAT,CAAiBC,KAAjB,EAAyCC,GAAzC,EAAgF;AACrF,MAAI;AACFC,IAAAA,WAAW,GAAG,GADZ;AAEFC,IAAAA,OAFE;AAGFC,IAAAA,YAHE;AAIFC,IAAAA,UAJE;AAKF;AACAC,IAAAA,OAAO,EAAEC,iBANP;AAOFC,IAAAA;AAPE,MASAR,KATJ;AAAA,MAQKS,UARL,uDASIT,KATJ;;AAWA,MAAIU,SAAJ;;AACA,MAAIR,WAAW,KAAK,GAApB,EAAyB;AACvBQ,IAAAA,SAAS,GAAG;AACVC,MAAAA,IAAI,EAAE,MADI;AAEVC,MAAAA,QAAQ,EAAE,CAACJ,UAAD,GAAc,CAAd,GAAkBK;AAFlB,KAAZ;AAID;;AAED,MAAI;AAACC,IAAAA,UAAD;AAAaC,IAAAA;AAAb,MAA0BC,QAAQ,CAAC;AAACb,IAAAA,OAAD;AAAUC,IAAAA,YAAV;AAAwBC,IAAAA,UAAxB;AAAoCG,IAAAA,UAApC;AAAgDP,IAAAA;AAAhD,GAAD,CAAtC;AACA,MAAIgB,QAAQ,GAAGC,cAAc,CAACT,UAAD,EAAa;AAACU,IAAAA,SAAS,EAAE;AAAZ,GAAb,CAA7B;AAEA,SAAO;AACLJ,IAAAA,SADK;AACM;AACXL,IAAAA,SAAS,EAAEU,UAAU,CAACH,QAAD,qCAChBH,UADgB,EAEhBJ,SAFgB;AAGnB,uBAAiBF,UAAU,IAAIK,SAHZ;AAInBP,MAAAA,OAAO,EAAGe,CAAD,IAAO;AACdP,QAAAA,UAAU,CAACR,OAAX,CAAmBe,CAAnB;;AACA,YAAId,iBAAJ,EAAuB;AACrBA,UAAAA,iBAAiB,CAACc,CAAD,CAAjB;AACAC,UAAAA,OAAO,CAACC,IAAR,CAAa,2CAAb;AACD;AACF;AAVkB;AAFhB,GAAP;AAeD","sources":["./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 */\n\nimport {AriaLinkProps} from '@react-types/link';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {HTMLAttributes, RefObject} from 'react';\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: HTMLAttributes<HTMLElement>,\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<HTMLElement>): 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: HTMLAttributes<HTMLElement>;\n if (elementType !== 'a') {\n linkProps = {\n role: 'link',\n tabIndex: !isDisabled ? 0 : undefined\n };\n }\n\n let {pressProps, isPressed} = usePress({onPress, onPressStart, onPressEnd, isDisabled, ref});\n let domProps = filterDOMProps(otherProps, {labelable: true});\n\n return {\n isPressed, // Used to indicate press state for visual\n linkProps: mergeProps(domProps, {\n ...pressProps,\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":["useLink","props","ref","elementType","onPress","onPressStart","onPressEnd","onClick","deprecatedOnClick","isDisabled","otherProps","linkProps","role","tabIndex","undefined","pressProps","isPressed","usePress","domProps","filterDOMProps","labelable","mergeProps","e","console","warn"],"version":3,"file":"module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;SCwCgB,yCAAO,CAAC,KAAsB,EAAE,GAA2B,EAAY,CAAC;IACtF,GAAG,CAAC,CAAC,cACH,WAAW,GAAG,CAAG,cACjB,OAAO,iBACP,YAAY,eACZ,UAAU,GACV,EAAa,AAAb,WAAa;IACb,OAAO,EAAE,iBAAiB,eAC1B,UAAU,MACP,UAAU,CACf,CAAC,GAAG,KAAK;IAET,GAAG,CAAC,SAAS;IACb,EAAE,EAAE,WAAW,KAAK,CAAG,IACrB,SAAS,GAAG,CAAC;QACX,IAAI,EAAE,CAAM;QACZ,QAAQ,GAAG,UAAU,GAAG,CAAC,GAAG,SAAS;IACvC,CAAC;IAEH,GAAG,CAAC,CAAC,iBAAA,cAAc,EAAA,CAAC,GAAG,mBAAY,CAAC,KAAK,EAAE,GAAG;IAC9C,GAAG,CAAC,CAAC,aAAA,UAAU,cAAE,SAAS,EAAA,CAAC,GAAG,eAAQ,CAAC,CAAC;iBAAA,OAAO;sBAAE,YAAY;oBAAE,UAAU;oBAAE,UAAU;aAAE,GAAG;IAAA,CAAC;IAC3F,GAAG,CAAC,QAAQ,GAAG,qBAAc,CAAC,UAAU,EAAE,CAAC;QAAA,SAAS,EAAE,IAAI;IAAA,CAAC;IAC3D,GAAG,CAAC,mBAAmB,GAAG,iBAAU,CAAC,cAAc,EAAE,UAAU;IAE/D,MAAM,CAAC,CAAC;mBACN,SAAS;QACT,SAAS,EAAE,iBAAU,CAAC,QAAQ,EAAE,CAAC;eAC5B,mBAAmB;eACnB,SAAS;YACZ,CAAe,gBAAE,UAAU,IAAI,SAAS;YACxC,OAAO,GAAG,CAAC,GAAK,CAAC;gBACf,UAAU,CAAC,OAAO,CAAC,CAAC;gBACpB,EAAE,EAAE,iBAAiB,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 */\n\nexport * 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 {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {HTMLAttributes, 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: HTMLAttributes<HTMLElement>,\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<HTMLElement>): 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: HTMLAttributes<HTMLElement>;\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"}
@@ -1 +1 @@
1
- {"mappings":"A;A;AAiBA,gCAAiC,SAAQ,aAAa;IACpD,oCAAoC;IACpC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;A;A;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;IACE,kCAAkC;IAClC,SAAS,EAAE,eAAe,WAAW,CAAC,CAAC;IACvC,6CAA6C;IAC7C,SAAS,EAAE,OAAO,CAAA;CACnB;AAED;A;A;A;GAIG;AACH,wBAAwB,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,UAAU,WAAW,CAAC,GAAG,QAAQ,CAsCrF","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"],"sourcesContent":[null,null],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;AAkBA,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,eAAe,WAAW,CAAC,CAAC;IACvC,6CAA6C;IAC7C,SAAS,EAAE,OAAO,CAAA;CACnB;AAED;;;;GAIG;AACH,wBAAwB,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,UAAU,WAAW,CAAC,GAAG,QAAQ,CAuCrF","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 */\n\nexport * 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.1.3",
3
+ "version": "3.2.2",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -18,10 +18,11 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@babel/runtime": "^7.6.2",
21
- "@react-aria/interactions": "^3.4.0",
22
- "@react-aria/utils": "^3.8.0",
23
- "@react-types/link": "^3.1.2",
24
- "@react-types/shared": "^3.6.0"
21
+ "@react-aria/focus": "^3.5.2",
22
+ "@react-aria/interactions": "^3.8.1",
23
+ "@react-aria/utils": "^3.11.2",
24
+ "@react-types/link": "^3.2.2",
25
+ "@react-types/shared": "^3.11.1"
25
26
  },
26
27
  "peerDependencies": {
27
28
  "react": "^16.8.0 || ^17.0.0-rc.1"
@@ -29,5 +30,5 @@
29
30
  "publishConfig": {
30
31
  "access": "public"
31
32
  },
32
- "gitHead": "3aae08e7d8a75382bedcddac7c86107e40db9296"
33
+ "gitHead": "404d41859b7d6f56201d7fc01bd9f22ae3512937"
33
34
  }
package/src/useLink.ts CHANGED
@@ -13,6 +13,7 @@
13
13
  import {AriaLinkProps} from '@react-types/link';
14
14
  import {filterDOMProps, mergeProps} from '@react-aria/utils';
15
15
  import {HTMLAttributes, RefObject} from 'react';
16
+ import {useFocusable} from '@react-aria/focus';
16
17
  import {usePress} from '@react-aria/interactions';
17
18
 
18
19
  export interface AriaLinkOptions extends AriaLinkProps {
@@ -56,14 +57,15 @@ export function useLink(props: AriaLinkOptions, ref: RefObject<HTMLElement>): Li
56
57
  tabIndex: !isDisabled ? 0 : undefined
57
58
  };
58
59
  }
59
-
60
+ let {focusableProps} = useFocusable(props, ref);
60
61
  let {pressProps, isPressed} = usePress({onPress, onPressStart, onPressEnd, isDisabled, ref});
61
62
  let domProps = filterDOMProps(otherProps, {labelable: true});
63
+ let interactionHandlers = mergeProps(focusableProps, pressProps);
62
64
 
63
65
  return {
64
66
  isPressed, // Used to indicate press state for visual
65
67
  linkProps: mergeProps(domProps, {
66
- ...pressProps,
68
+ ...interactionHandlers,
67
69
  ...linkProps,
68
70
  'aria-disabled': isDisabled || undefined,
69
71
  onClick: (e) => {