@react-aria/link 3.7.8 → 3.7.10

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.
@@ -1 +1 @@
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,GAAG,IAAI,CAAC,GAAG,QAAQ,CAwDjG","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"}
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,aAAa,CAAC;IACzB,6CAA6C;IAC7C,SAAS,EAAE,OAAO,CAAA;CACnB;AAED;;;;GAIG;AACH,wBAAwB,KAAK,EAAE,eAAe,EAAE,GAAG,EAAE,UAAU,gBAAgB,GAAG,IAAI,CAAC,GAAG,QAAQ,CAwDjG","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"}
@@ -1,5 +1,4 @@
1
1
  var $8TwZf$reactariautils = require("@react-aria/utils");
2
- var $8TwZf$reactariafocus = require("@react-aria/focus");
3
2
  var $8TwZf$reactariainteractions = require("@react-aria/interactions");
4
3
 
5
4
 
@@ -20,7 +19,6 @@ $parcel$export(module.exports, "useLink", () => $fbe6b19572273b2f$export$dcf14c9
20
19
  * governing permissions and limitations under the License.
21
20
  */
22
21
 
23
-
24
22
  function $fbe6b19572273b2f$export$dcf14c9974fe2767(props, ref) {
25
23
  let { elementType: elementType = 'a', onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, // @ts-ignore
26
24
  onClick: deprecatedOnClick, isDisabled: isDisabled, ...otherProps } = props;
@@ -29,7 +27,7 @@ function $fbe6b19572273b2f$export$dcf14c9974fe2767(props, ref) {
29
27
  role: 'link',
30
28
  tabIndex: !isDisabled ? 0 : undefined
31
29
  };
32
- let { focusableProps: focusableProps } = (0, $8TwZf$reactariafocus.useFocusable)(props, ref);
30
+ let { focusableProps: focusableProps } = (0, $8TwZf$reactariainteractions.useFocusable)(props, ref);
33
31
  let { pressProps: pressProps, isPressed: isPressed } = (0, $8TwZf$reactariainteractions.usePress)({
34
32
  onPress: onPress,
35
33
  onPressStart: onPressStart,
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AA+BM,SAAS,0CAAQ,KAAsB,EAAE,GAAuC;IACrF,IAAI,eACF,cAAc,cACd,OAAO,gBACP,YAAY,cACZ,UAAU,EACV,aAAa;IACb,SAAS,iBAAiB,cAC1B,UAAU,EACV,GAAG,YACJ,GAAG;IAEJ,IAAI,YAA2B,CAAC;IAChC,IAAI,gBAAgB,KAClB,YAAY;QACV,MAAM;QACN,UAAU,CAAC,aAAa,IAAI;IAC9B;IAEF,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,kCAAW,EAAE,OAAO;IAC3C,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;iBAAC;sBAAS;oBAAc;oBAAY;aAAY;IAAG;IAC1F,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE,YAAY;QAAC,WAAW;IAAI;IAC1D,IAAI,sBAAsB,CAAA,GAAA,gCAAS,EAAE,gBAAgB;IACrD,IAAI,SAAS,CAAA,GAAA,+BAAQ;IACrB,IAAI,kBAAkB,CAAA,GAAA,kCAAW,EAAE;IAEnC,OAAO;mBACL;QACA,WAAW,CAAA,GAAA,gCAAS,EAAE,UAAU,iBAAiB;YAC/C,GAAG,mBAAmB;YACtB,GAAG,SAAS;YACZ,iBAAiB,cAAc;YAC/B,gBAAgB,KAAK,CAAC,eAAe;YACrC,SAAS,CAAC;oBACR;iBAAA,sBAAA,WAAW,OAAO,cAAlB,0CAAA,yBAAA,YAAqB;gBACrB,IAAI,mBAAmB;oBACrB,kBAAkB;oBAClB,QAAQ,IAAI,CAAC;gBACf;gBAEA,mGAAmG;gBACnG,IACE,CAAC,OAAO,QAAQ,IAChB,EAAE,aAAa,YAAY,qBAC3B,EAAE,aAAa,CAAC,IAAI,IACpB,0FAA0F;gBAC1F,CAAC,EAAE,kBAAkB,MACrB,CAAA,GAAA,0CAAmB,EAAE,EAAE,aAAa,EAAE,MACtC,MAAM,IAAI,EACV;oBACA,EAAE,cAAc;oBAChB,OAAO,IAAI,CAAC,EAAE,aAAa,EAAE,GAAG,MAAM,IAAI,EAAE,MAAM,aAAa;gBACjE;YACF;QACF;IACF;AACF","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 {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, shouldClientNavigate, useLinkProps, useRouter} from '@react-aria/utils';\nimport React 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 | null>): 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 let router = useRouter();\n let routerLinkProps = useLinkProps(props);\n\n return {\n isPressed, // Used to indicate press state for visual\n linkProps: mergeProps(domProps, routerLinkProps, {\n ...interactionHandlers,\n ...linkProps,\n 'aria-disabled': isDisabled || undefined,\n 'aria-current': props['aria-current'],\n onClick: (e: React.MouseEvent<HTMLAnchorElement>) => {\n pressProps.onClick?.(e);\n if (deprecatedOnClick) {\n deprecatedOnClick(e);\n console.warn('onClick is deprecated, please use onPress');\n }\n\n // If a custom router is provided, prevent default and forward if this link should client navigate.\n if (\n !router.isNative &&\n e.currentTarget instanceof HTMLAnchorElement &&\n e.currentTarget.href &&\n // If props are applied to a router Link component, it may have already prevented default.\n !e.isDefaultPrevented() &&\n shouldClientNavigate(e.currentTarget, e) &&\n props.href\n ) {\n e.preventDefault();\n router.open(e.currentTarget, e, props.href, props.routerOptions);\n }\n }\n })\n };\n}\n"],"names":[],"version":3,"file":"useLink.main.js.map"}
1
+ {"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AA8BM,SAAS,0CAAQ,KAAsB,EAAE,GAAuC;IACrF,IAAI,eACF,cAAc,cACd,OAAO,gBACP,YAAY,cACZ,UAAU,EACV,aAAa;IACb,SAAS,iBAAiB,cAC1B,UAAU,EACV,GAAG,YACJ,GAAG;IAEJ,IAAI,YAA2B,CAAC;IAChC,IAAI,gBAAgB,KAClB,YAAY;QACV,MAAM;QACN,UAAU,CAAC,aAAa,IAAI;IAC9B;IAEF,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,yCAAW,EAAE,OAAO;IAC3C,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;iBAAC;sBAAS;oBAAc;oBAAY;aAAY;IAAG;IAC1F,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE,YAAY;QAAC,WAAW;IAAI;IAC1D,IAAI,sBAAsB,CAAA,GAAA,gCAAS,EAAE,gBAAgB;IACrD,IAAI,SAAS,CAAA,GAAA,+BAAQ;IACrB,IAAI,kBAAkB,CAAA,GAAA,kCAAW,EAAE;IAEnC,OAAO;mBACL;QACA,WAAW,CAAA,GAAA,gCAAS,EAAE,UAAU,iBAAiB;YAC/C,GAAG,mBAAmB;YACtB,GAAG,SAAS;YACZ,iBAAiB,cAAc;YAC/B,gBAAgB,KAAK,CAAC,eAAe;YACrC,SAAS,CAAC;oBACR;iBAAA,sBAAA,WAAW,OAAO,cAAlB,0CAAA,yBAAA,YAAqB;gBACrB,IAAI,mBAAmB;oBACrB,kBAAkB;oBAClB,QAAQ,IAAI,CAAC;gBACf;gBAEA,mGAAmG;gBACnG,IACE,CAAC,OAAO,QAAQ,IAChB,EAAE,aAAa,YAAY,qBAC3B,EAAE,aAAa,CAAC,IAAI,IACpB,0FAA0F;gBAC1F,CAAC,EAAE,kBAAkB,MACrB,CAAA,GAAA,0CAAmB,EAAE,EAAE,aAAa,EAAE,MACtC,MAAM,IAAI,EACV;oBACA,EAAE,cAAc;oBAChB,OAAO,IAAI,CAAC,EAAE,aAAa,EAAE,GAAG,MAAM,IAAI,EAAE,MAAM,aAAa;gBACjE;YACF;QACF;IACF;AACF","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 {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, shouldClientNavigate, useLinkProps, useRouter} from '@react-aria/utils';\nimport React from 'react';\nimport {useFocusable, 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 | null>): 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 let router = useRouter();\n let routerLinkProps = useLinkProps(props);\n\n return {\n isPressed, // Used to indicate press state for visual\n linkProps: mergeProps(domProps, routerLinkProps, {\n ...interactionHandlers,\n ...linkProps,\n 'aria-disabled': isDisabled || undefined,\n 'aria-current': props['aria-current'],\n onClick: (e: React.MouseEvent<HTMLAnchorElement>) => {\n pressProps.onClick?.(e);\n if (deprecatedOnClick) {\n deprecatedOnClick(e);\n console.warn('onClick is deprecated, please use onPress');\n }\n\n // If a custom router is provided, prevent default and forward if this link should client navigate.\n if (\n !router.isNative &&\n e.currentTarget instanceof HTMLAnchorElement &&\n e.currentTarget.href &&\n // If props are applied to a router Link component, it may have already prevented default.\n !e.isDefaultPrevented() &&\n shouldClientNavigate(e.currentTarget, e) &&\n props.href\n ) {\n e.preventDefault();\n router.open(e.currentTarget, e, props.href, props.routerOptions);\n }\n }\n })\n };\n}\n"],"names":[],"version":3,"file":"useLink.main.js.map"}
package/dist/useLink.mjs CHANGED
@@ -1,6 +1,5 @@
1
1
  import {filterDOMProps as $5Ot33$filterDOMProps, mergeProps as $5Ot33$mergeProps, useRouter as $5Ot33$useRouter, useLinkProps as $5Ot33$useLinkProps, shouldClientNavigate as $5Ot33$shouldClientNavigate} from "@react-aria/utils";
2
- import {useFocusable as $5Ot33$useFocusable} from "@react-aria/focus";
3
- import {usePress as $5Ot33$usePress} from "@react-aria/interactions";
2
+ import {useFocusable as $5Ot33$useFocusable, usePress as $5Ot33$usePress} from "@react-aria/interactions";
4
3
 
5
4
  /*
6
5
  * Copyright 2020 Adobe. All rights reserved.
@@ -14,7 +13,6 @@ import {usePress as $5Ot33$usePress} from "@react-aria/interactions";
14
13
  * governing permissions and limitations under the License.
15
14
  */
16
15
 
17
-
18
16
  function $298d61e98472621b$export$dcf14c9974fe2767(props, ref) {
19
17
  let { elementType: elementType = 'a', onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, // @ts-ignore
20
18
  onClick: deprecatedOnClick, isDisabled: isDisabled, ...otherProps } = props;
@@ -1,6 +1,5 @@
1
1
  import {filterDOMProps as $5Ot33$filterDOMProps, mergeProps as $5Ot33$mergeProps, useRouter as $5Ot33$useRouter, useLinkProps as $5Ot33$useLinkProps, shouldClientNavigate as $5Ot33$shouldClientNavigate} from "@react-aria/utils";
2
- import {useFocusable as $5Ot33$useFocusable} from "@react-aria/focus";
3
- import {usePress as $5Ot33$usePress} from "@react-aria/interactions";
2
+ import {useFocusable as $5Ot33$useFocusable, usePress as $5Ot33$usePress} from "@react-aria/interactions";
4
3
 
5
4
  /*
6
5
  * Copyright 2020 Adobe. All rights reserved.
@@ -14,7 +13,6 @@ import {usePress as $5Ot33$usePress} from "@react-aria/interactions";
14
13
  * governing permissions and limitations under the License.
15
14
  */
16
15
 
17
-
18
16
  function $298d61e98472621b$export$dcf14c9974fe2767(props, ref) {
19
17
  let { elementType: elementType = 'a', onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, // @ts-ignore
20
18
  onClick: deprecatedOnClick, isDisabled: isDisabled, ...otherProps } = props;
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AA+BM,SAAS,0CAAQ,KAAsB,EAAE,GAAuC;IACrF,IAAI,eACF,cAAc,cACd,OAAO,gBACP,YAAY,cACZ,UAAU,EACV,aAAa;IACb,SAAS,iBAAiB,cAC1B,UAAU,EACV,GAAG,YACJ,GAAG;IAEJ,IAAI,YAA2B,CAAC;IAChC,IAAI,gBAAgB,KAClB,YAAY;QACV,MAAM;QACN,UAAU,CAAC,aAAa,IAAI;IAC9B;IAEF,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,mBAAW,EAAE,OAAO;IAC3C,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;iBAAC;sBAAS;oBAAc;oBAAY;aAAY;IAAG;IAC1F,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,YAAY;QAAC,WAAW;IAAI;IAC1D,IAAI,sBAAsB,CAAA,GAAA,iBAAS,EAAE,gBAAgB;IACrD,IAAI,SAAS,CAAA,GAAA,gBAAQ;IACrB,IAAI,kBAAkB,CAAA,GAAA,mBAAW,EAAE;IAEnC,OAAO;mBACL;QACA,WAAW,CAAA,GAAA,iBAAS,EAAE,UAAU,iBAAiB;YAC/C,GAAG,mBAAmB;YACtB,GAAG,SAAS;YACZ,iBAAiB,cAAc;YAC/B,gBAAgB,KAAK,CAAC,eAAe;YACrC,SAAS,CAAC;oBACR;iBAAA,sBAAA,WAAW,OAAO,cAAlB,0CAAA,yBAAA,YAAqB;gBACrB,IAAI,mBAAmB;oBACrB,kBAAkB;oBAClB,QAAQ,IAAI,CAAC;gBACf;gBAEA,mGAAmG;gBACnG,IACE,CAAC,OAAO,QAAQ,IAChB,EAAE,aAAa,YAAY,qBAC3B,EAAE,aAAa,CAAC,IAAI,IACpB,0FAA0F;gBAC1F,CAAC,EAAE,kBAAkB,MACrB,CAAA,GAAA,2BAAmB,EAAE,EAAE,aAAa,EAAE,MACtC,MAAM,IAAI,EACV;oBACA,EAAE,cAAc;oBAChB,OAAO,IAAI,CAAC,EAAE,aAAa,EAAE,GAAG,MAAM,IAAI,EAAE,MAAM,aAAa;gBACjE;YACF;QACF;IACF;AACF","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 {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, shouldClientNavigate, useLinkProps, useRouter} from '@react-aria/utils';\nimport React 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 | null>): 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 let router = useRouter();\n let routerLinkProps = useLinkProps(props);\n\n return {\n isPressed, // Used to indicate press state for visual\n linkProps: mergeProps(domProps, routerLinkProps, {\n ...interactionHandlers,\n ...linkProps,\n 'aria-disabled': isDisabled || undefined,\n 'aria-current': props['aria-current'],\n onClick: (e: React.MouseEvent<HTMLAnchorElement>) => {\n pressProps.onClick?.(e);\n if (deprecatedOnClick) {\n deprecatedOnClick(e);\n console.warn('onClick is deprecated, please use onPress');\n }\n\n // If a custom router is provided, prevent default and forward if this link should client navigate.\n if (\n !router.isNative &&\n e.currentTarget instanceof HTMLAnchorElement &&\n e.currentTarget.href &&\n // If props are applied to a router Link component, it may have already prevented default.\n !e.isDefaultPrevented() &&\n shouldClientNavigate(e.currentTarget, e) &&\n props.href\n ) {\n e.preventDefault();\n router.open(e.currentTarget, e, props.href, props.routerOptions);\n }\n }\n })\n };\n}\n"],"names":[],"version":3,"file":"useLink.module.js.map"}
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC;;AA8BM,SAAS,0CAAQ,KAAsB,EAAE,GAAuC;IACrF,IAAI,eACF,cAAc,cACd,OAAO,gBACP,YAAY,cACZ,UAAU,EACV,aAAa;IACb,SAAS,iBAAiB,cAC1B,UAAU,EACV,GAAG,YACJ,GAAG;IAEJ,IAAI,YAA2B,CAAC;IAChC,IAAI,gBAAgB,KAClB,YAAY;QACV,MAAM;QACN,UAAU,CAAC,aAAa,IAAI;IAC9B;IAEF,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,mBAAW,EAAE,OAAO;IAC3C,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;iBAAC;sBAAS;oBAAc;oBAAY;aAAY;IAAG;IAC1F,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,YAAY;QAAC,WAAW;IAAI;IAC1D,IAAI,sBAAsB,CAAA,GAAA,iBAAS,EAAE,gBAAgB;IACrD,IAAI,SAAS,CAAA,GAAA,gBAAQ;IACrB,IAAI,kBAAkB,CAAA,GAAA,mBAAW,EAAE;IAEnC,OAAO;mBACL;QACA,WAAW,CAAA,GAAA,iBAAS,EAAE,UAAU,iBAAiB;YAC/C,GAAG,mBAAmB;YACtB,GAAG,SAAS;YACZ,iBAAiB,cAAc;YAC/B,gBAAgB,KAAK,CAAC,eAAe;YACrC,SAAS,CAAC;oBACR;iBAAA,sBAAA,WAAW,OAAO,cAAlB,0CAAA,yBAAA,YAAqB;gBACrB,IAAI,mBAAmB;oBACrB,kBAAkB;oBAClB,QAAQ,IAAI,CAAC;gBACf;gBAEA,mGAAmG;gBACnG,IACE,CAAC,OAAO,QAAQ,IAChB,EAAE,aAAa,YAAY,qBAC3B,EAAE,aAAa,CAAC,IAAI,IACpB,0FAA0F;gBAC1F,CAAC,EAAE,kBAAkB,MACrB,CAAA,GAAA,2BAAmB,EAAE,EAAE,aAAa,EAAE,MACtC,MAAM,IAAI,EACV;oBACA,EAAE,cAAc;oBAChB,OAAO,IAAI,CAAC,EAAE,aAAa,EAAE,GAAG,MAAM,IAAI,EAAE,MAAM,aAAa;gBACjE;YACF;QACF;IACF;AACF","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 {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, shouldClientNavigate, useLinkProps, useRouter} from '@react-aria/utils';\nimport React from 'react';\nimport {useFocusable, 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 | null>): 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 let router = useRouter();\n let routerLinkProps = useLinkProps(props);\n\n return {\n isPressed, // Used to indicate press state for visual\n linkProps: mergeProps(domProps, routerLinkProps, {\n ...interactionHandlers,\n ...linkProps,\n 'aria-disabled': isDisabled || undefined,\n 'aria-current': props['aria-current'],\n onClick: (e: React.MouseEvent<HTMLAnchorElement>) => {\n pressProps.onClick?.(e);\n if (deprecatedOnClick) {\n deprecatedOnClick(e);\n console.warn('onClick is deprecated, please use onPress');\n }\n\n // If a custom router is provided, prevent default and forward if this link should client navigate.\n if (\n !router.isNative &&\n e.currentTarget instanceof HTMLAnchorElement &&\n e.currentTarget.href &&\n // If props are applied to a router Link component, it may have already prevented default.\n !e.isDefaultPrevented() &&\n shouldClientNavigate(e.currentTarget, e) &&\n props.href\n ) {\n e.preventDefault();\n router.open(e.currentTarget, e, props.href, props.routerOptions);\n }\n }\n })\n };\n}\n"],"names":[],"version":3,"file":"useLink.module.js.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/link",
3
- "version": "3.7.8",
3
+ "version": "3.7.10",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,11 +22,10 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-aria/focus": "^3.19.1",
26
- "@react-aria/interactions": "^3.23.0",
27
- "@react-aria/utils": "^3.27.0",
28
- "@react-types/link": "^3.5.10",
29
- "@react-types/shared": "^3.27.0",
25
+ "@react-aria/interactions": "^3.24.1",
26
+ "@react-aria/utils": "^3.28.1",
27
+ "@react-types/link": "^3.5.11",
28
+ "@react-types/shared": "^3.28.0",
30
29
  "@swc/helpers": "^0.5.0"
31
30
  },
32
31
  "peerDependencies": {
@@ -36,5 +35,5 @@
36
35
  "publishConfig": {
37
36
  "access": "public"
38
37
  },
39
- "gitHead": "09e7f44bebdc9d89122926b2b439a0a38a2814ea"
38
+ "gitHead": "9c4ebbc0c1972cc880febc29de995ca58caa3ba4"
40
39
  }
package/src/useLink.ts CHANGED
@@ -14,8 +14,7 @@ import {AriaLinkProps} from '@react-types/link';
14
14
  import {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared';
15
15
  import {filterDOMProps, mergeProps, shouldClientNavigate, useLinkProps, useRouter} from '@react-aria/utils';
16
16
  import React from 'react';
17
- import {useFocusable} from '@react-aria/focus';
18
- import {usePress} from '@react-aria/interactions';
17
+ import {useFocusable, usePress} from '@react-aria/interactions';
19
18
 
20
19
  export interface AriaLinkOptions extends AriaLinkProps {
21
20
  /** Whether the link is disabled. */