@react-aria/link 3.7.0 → 3.7.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/types.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { AriaLinkProps } from "@react-types/link";
2
- import { DOMAttributes, FocusableElement } from "@react-types/shared";
3
- import { RefObject } from "react";
2
+ import { DOMAttributes, FocusableElement, RefObject } from "@react-types/shared";
4
3
  export interface AriaLinkOptions extends AriaLinkProps {
5
4
  /** Whether the link is disabled. */
6
5
  isDisabled?: boolean;
@@ -21,6 +20,6 @@ export interface LinkAria {
21
20
  * A link allows a user to navigate to another page or resource within a web page
22
21
  * or application.
23
22
  */
24
- export function useLink(props: AriaLinkOptions, ref: RefObject<FocusableElement>): LinkAria;
23
+ export function useLink(props: AriaLinkOptions, ref: RefObject<FocusableElement | null>): LinkAria;
25
24
 
26
25
  //# sourceMappingURL=types.d.ts.map
@@ -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,CAAC,GAAG,QAAQ,CAwD1F","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":";;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"}
@@ -22,11 +22,11 @@ $parcel$export(module.exports, "useLink", () => $fbe6b19572273b2f$export$dcf14c9
22
22
 
23
23
 
24
24
  function $fbe6b19572273b2f$export$dcf14c9974fe2767(props, ref) {
25
- let { elementType: elementType = "a", onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, // @ts-ignore
25
+ let { elementType: elementType = 'a', onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, // @ts-ignore
26
26
  onClick: deprecatedOnClick, isDisabled: isDisabled, ...otherProps } = props;
27
27
  let linkProps = {};
28
- if (elementType !== "a") linkProps = {
29
- role: "link",
28
+ if (elementType !== 'a') linkProps = {
29
+ role: 'link',
30
30
  tabIndex: !isDisabled ? 0 : undefined
31
31
  };
32
32
  let { focusableProps: focusableProps } = (0, $8TwZf$reactariafocus.useFocusable)(props, ref);
@@ -48,14 +48,14 @@ function $fbe6b19572273b2f$export$dcf14c9974fe2767(props, ref) {
48
48
  linkProps: (0, $8TwZf$reactariautils.mergeProps)(domProps, routerLinkProps, {
49
49
  ...interactionHandlers,
50
50
  ...linkProps,
51
- "aria-disabled": isDisabled || undefined,
52
- "aria-current": props["aria-current"],
51
+ 'aria-disabled': isDisabled || undefined,
52
+ 'aria-current': props['aria-current'],
53
53
  onClick: (e)=>{
54
54
  var _pressProps_onClick;
55
55
  (_pressProps_onClick = pressProps.onClick) === null || _pressProps_onClick === void 0 ? void 0 : _pressProps_onClick.call(pressProps, e);
56
56
  if (deprecatedOnClick) {
57
57
  deprecatedOnClick(e);
58
- console.warn("onClick is deprecated, please use onPress");
58
+ console.warn('onClick is deprecated, please use onPress');
59
59
  }
60
60
  // If a custom router is provided, prevent default and forward if this link should client navigate.
61
61
  if (!router.isNative && e.currentTarget instanceof HTMLAnchorElement && e.currentTarget.href && // If props are applied to a router Link component, it may have already prevented default.
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;AA+BM,SAAS,0CAAQ,KAAsB,EAAE,GAAgC;IAC9E,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} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, shouldClientNavigate, useLinkProps, useRouter} from '@react-aria/utils';\nimport React, {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 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;;;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"}
package/dist/useLink.mjs CHANGED
@@ -16,11 +16,11 @@ import {usePress as $5Ot33$usePress} from "@react-aria/interactions";
16
16
 
17
17
 
18
18
  function $298d61e98472621b$export$dcf14c9974fe2767(props, ref) {
19
- let { elementType: elementType = "a", onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, // @ts-ignore
19
+ let { elementType: elementType = 'a', onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, // @ts-ignore
20
20
  onClick: deprecatedOnClick, isDisabled: isDisabled, ...otherProps } = props;
21
21
  let linkProps = {};
22
- if (elementType !== "a") linkProps = {
23
- role: "link",
22
+ if (elementType !== 'a') linkProps = {
23
+ role: 'link',
24
24
  tabIndex: !isDisabled ? 0 : undefined
25
25
  };
26
26
  let { focusableProps: focusableProps } = (0, $5Ot33$useFocusable)(props, ref);
@@ -42,14 +42,14 @@ function $298d61e98472621b$export$dcf14c9974fe2767(props, ref) {
42
42
  linkProps: (0, $5Ot33$mergeProps)(domProps, routerLinkProps, {
43
43
  ...interactionHandlers,
44
44
  ...linkProps,
45
- "aria-disabled": isDisabled || undefined,
46
- "aria-current": props["aria-current"],
45
+ 'aria-disabled': isDisabled || undefined,
46
+ 'aria-current': props['aria-current'],
47
47
  onClick: (e)=>{
48
48
  var _pressProps_onClick;
49
49
  (_pressProps_onClick = pressProps.onClick) === null || _pressProps_onClick === void 0 ? void 0 : _pressProps_onClick.call(pressProps, e);
50
50
  if (deprecatedOnClick) {
51
51
  deprecatedOnClick(e);
52
- console.warn("onClick is deprecated, please use onPress");
52
+ console.warn('onClick is deprecated, please use onPress');
53
53
  }
54
54
  // If a custom router is provided, prevent default and forward if this link should client navigate.
55
55
  if (!router.isNative && e.currentTarget instanceof HTMLAnchorElement && e.currentTarget.href && // If props are applied to a router Link component, it may have already prevented default.
@@ -64,4 +64,4 @@ function $298d61e98472621b$export$dcf14c9974fe2767(props, ref) {
64
64
 
65
65
 
66
66
  export {$298d61e98472621b$export$dcf14c9974fe2767 as useLink};
67
- //# sourceMappingURL=useLink.mjs.map
67
+ //# sourceMappingURL=useLink.module.js.map
@@ -16,11 +16,11 @@ import {usePress as $5Ot33$usePress} from "@react-aria/interactions";
16
16
 
17
17
 
18
18
  function $298d61e98472621b$export$dcf14c9974fe2767(props, ref) {
19
- let { elementType: elementType = "a", onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, // @ts-ignore
19
+ let { elementType: elementType = 'a', onPress: onPress, onPressStart: onPressStart, onPressEnd: onPressEnd, // @ts-ignore
20
20
  onClick: deprecatedOnClick, isDisabled: isDisabled, ...otherProps } = props;
21
21
  let linkProps = {};
22
- if (elementType !== "a") linkProps = {
23
- role: "link",
22
+ if (elementType !== 'a') linkProps = {
23
+ role: 'link',
24
24
  tabIndex: !isDisabled ? 0 : undefined
25
25
  };
26
26
  let { focusableProps: focusableProps } = (0, $5Ot33$useFocusable)(props, ref);
@@ -42,14 +42,14 @@ function $298d61e98472621b$export$dcf14c9974fe2767(props, ref) {
42
42
  linkProps: (0, $5Ot33$mergeProps)(domProps, routerLinkProps, {
43
43
  ...interactionHandlers,
44
44
  ...linkProps,
45
- "aria-disabled": isDisabled || undefined,
46
- "aria-current": props["aria-current"],
45
+ 'aria-disabled': isDisabled || undefined,
46
+ 'aria-current': props['aria-current'],
47
47
  onClick: (e)=>{
48
48
  var _pressProps_onClick;
49
49
  (_pressProps_onClick = pressProps.onClick) === null || _pressProps_onClick === void 0 ? void 0 : _pressProps_onClick.call(pressProps, e);
50
50
  if (deprecatedOnClick) {
51
51
  deprecatedOnClick(e);
52
- console.warn("onClick is deprecated, please use onPress");
52
+ console.warn('onClick is deprecated, please use onPress');
53
53
  }
54
54
  // If a custom router is provided, prevent default and forward if this link should client navigate.
55
55
  if (!router.isNative && e.currentTarget instanceof HTMLAnchorElement && e.currentTarget.href && // If props are applied to a router Link component, it may have already prevented default.
@@ -1 +1 @@
1
- {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AA+BM,SAAS,0CAAQ,KAAsB,EAAE,GAAgC;IAC9E,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} from '@react-types/shared';\nimport {filterDOMProps, mergeProps, shouldClientNavigate, useLinkProps, useRouter} from '@react-aria/utils';\nimport React, {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 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;;;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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-aria/link",
3
- "version": "3.7.0",
3
+ "version": "3.7.2",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -22,18 +22,18 @@
22
22
  "url": "https://github.com/adobe/react-spectrum"
23
23
  },
24
24
  "dependencies": {
25
- "@react-aria/focus": "^3.17.0",
26
- "@react-aria/interactions": "^3.21.2",
27
- "@react-aria/utils": "^3.24.0",
28
- "@react-types/link": "^3.5.4",
29
- "@react-types/shared": "^3.23.0",
25
+ "@react-aria/focus": "^3.18.0",
26
+ "@react-aria/interactions": "^3.22.0",
27
+ "@react-aria/utils": "^3.25.0",
28
+ "@react-types/link": "^3.5.6",
29
+ "@react-types/shared": "^3.24.0",
30
30
  "@swc/helpers": "^0.5.0"
31
31
  },
32
32
  "peerDependencies": {
33
- "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
33
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
34
34
  },
35
35
  "publishConfig": {
36
36
  "access": "public"
37
37
  },
38
- "gitHead": "f645f29edc1322153fd60af4640cbcab1d992dbd"
38
+ "gitHead": "86d80e3216bc32e75108831cf3a5a720bc849206"
39
39
  }
package/src/useLink.ts CHANGED
@@ -11,9 +11,9 @@
11
11
  */
12
12
 
13
13
  import {AriaLinkProps} from '@react-types/link';
14
- import {DOMAttributes, FocusableElement} from '@react-types/shared';
14
+ import {DOMAttributes, FocusableElement, RefObject} from '@react-types/shared';
15
15
  import {filterDOMProps, mergeProps, shouldClientNavigate, useLinkProps, useRouter} from '@react-aria/utils';
16
- import React, {RefObject} from 'react';
16
+ import React from 'react';
17
17
  import {useFocusable} from '@react-aria/focus';
18
18
  import {usePress} from '@react-aria/interactions';
19
19
 
@@ -39,7 +39,7 @@ export interface LinkAria {
39
39
  * A link allows a user to navigate to another page or resource within a web page
40
40
  * or application.
41
41
  */
42
- export function useLink(props: AriaLinkOptions, ref: RefObject<FocusableElement>): LinkAria {
42
+ export function useLink(props: AriaLinkOptions, ref: RefObject<FocusableElement | null>): LinkAria {
43
43
  let {
44
44
  elementType = 'a',
45
45
  onPress,