@react-spectrum/link 3.6.7 → 3.6.8

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/Link.main.js CHANGED
@@ -36,6 +36,7 @@ $parcel$export(module.exports, "Link", () => $1148fb7fc40f1ce2$export$a6c7ac8248
36
36
 
37
37
 
38
38
 
39
+ let $1148fb7fc40f1ce2$var$isOldReact = parseInt((0, ($parcel$interopDefault($jQffG$react))).version, 10) <= 18;
39
40
  function $1148fb7fc40f1ce2$export$a6c7ac8248d6e38a(props) {
40
41
  props = (0, $jQffG$reactspectrumprovider.useProviderProps)(props);
41
42
  props = (0, $jQffG$reactspectrumutils.useSlotProps)(props, 'link');
@@ -63,10 +64,15 @@ function $1148fb7fc40f1ce2$export$a6c7ac8248d6e38a(props) {
63
64
  else {
64
65
  // Backward compatibility.
65
66
  let wrappedChild = (0, $jQffG$reactspectrumutils.getWrappedElement)(children);
67
+ let mergedRef = ref;
68
+ if ($1148fb7fc40f1ce2$var$isOldReact) // @ts-ignore
69
+ mergedRef = (0, $jQffG$reactariautils.mergeRefs)(ref, wrappedChild.ref);
70
+ else // @ts-ignore
71
+ mergedRef = (0, $jQffG$reactariautils.mergeRefs)(ref, wrappedChild.props.ref);
66
72
  link = /*#__PURE__*/ (0, ($parcel$interopDefault($jQffG$react))).cloneElement(wrappedChild, {
67
73
  ...(0, $jQffG$reactariautils.mergeProps)(wrappedChild.props, domProps),
68
74
  // @ts-ignore https://github.com/facebook/react/issues/8873
69
- ref: wrappedChild.ref ? (0, $jQffG$reactariautils.mergeRefs)(ref, wrappedChild.ref) : ref
75
+ ref: mergedRef
70
76
  });
71
77
  }
72
78
  return /*#__PURE__*/ (0, ($parcel$interopDefault($jQffG$react))).createElement((0, $jQffG$reactariafocus.FocusRing), {
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAgBM,SAAS,0CAAK,KAAwB;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spectrum/link/src/Link.tsx"],"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 {classNames, getWrappedElement, useSlotProps, useStyleProps} from '@react-spectrum/utils';\nimport {FocusRing} from '@react-aria/focus';\nimport {mergeProps, mergeRefs} from '@react-aria/utils';\nimport React, {JSX, useRef} from 'react';\nimport {SpectrumLinkProps} from '@react-types/link';\nimport styles from '@adobe/spectrum-css-temp/components/link/vars.css';\nimport {useHover} from '@react-aria/interactions';\nimport {useLink} from '@react-aria/link';\nimport {useProviderProps} from '@react-spectrum/provider';\n\n/**\n * Links allow users to navigate to a different location.\n * They can be presented inline inside a paragraph or as standalone text.\n */\nexport function Link(props: SpectrumLinkProps) {\n props = useProviderProps(props);\n props = useSlotProps(props, 'link');\n let {\n variant = 'primary',\n isQuiet,\n children,\n // @ts-ignore\n href\n } = props;\n let {styleProps} = useStyleProps(props);\n let {hoverProps, isHovered} = useHover({});\n\n let ref = useRef(null);\n let {linkProps} = useLink({\n ...props,\n elementType: !href && typeof children === 'string' ? 'span' : 'a'\n }, ref);\n\n let domProps = {\n ...styleProps,\n ...mergeProps(linkProps, hoverProps),\n ref,\n className: classNames(\n styles,\n 'spectrum-Link',\n {\n 'spectrum-Link--quiet': isQuiet,\n [`spectrum-Link--${variant}`]: variant,\n 'is-hovered': isHovered\n },\n styleProps.className\n )\n };\n\n let link: JSX.Element;\n if (href) {\n link = <a {...domProps}>{children}</a>;\n } else {\n // Backward compatibility.\n let wrappedChild = getWrappedElement(children);\n link = React.cloneElement(wrappedChild, {\n ...mergeProps(wrappedChild.props, domProps),\n // @ts-ignore https://github.com/facebook/react/issues/8873\n ref: wrappedChild.ref ? mergeRefs(ref, wrappedChild.ref) : ref\n });\n }\n\n\n return (\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n {link}\n </FocusRing>\n );\n}\n"],"names":[],"version":3,"file":"Link.main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAYD,IAAI,mCAAa,SAAS,CAAA,GAAA,sCAAI,EAAE,OAAO,EAAE,OAAO;AAKzC,SAAS,0CAAK,KAAwB;IAC3C,QAAQ,CAAA,GAAA,6CAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,sCAAW,EAAE,OAAO;IAC5B,IAAI,WACF,UAAU,oBACV,OAAO,YACP,QAAQ,QACR,aAAa;IACb,IAAI,EACL,GAAG;IACJ,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,uCAAY,EAAE;IACjC,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE,CAAC;IAExC,IAAI,MAAM,CAAA,GAAA,mBAAK,EAAE;IACjB,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,4BAAM,EAAE;QACxB,GAAG,KAAK;QACR,aAAa,CAAC,QAAQ,OAAO,aAAa,WAAW,SAAS;IAChE,GAAG;IAEH,IAAI,WAAW;QACb,GAAG,UAAU;QACb,GAAG,CAAA,GAAA,gCAAS,EAAE,WAAW,WAAW;aACpC;QACA,WAAW,CAAA,GAAA,oCAAS,EAClB,CAAA,GAAA,mDAAK,GACL,iBACA;YACE,wBAAwB;YACxB,CAAC,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,EAAE;YAC/B,cAAc;QAChB,GACA,WAAW,SAAS;IAExB;IAEA,IAAI;IACJ,IAAI,MACF,qBAAO,0DAAC,KAAM,UAAW;SACpB;QACL,0BAA0B;QAC1B,IAAI,eAAe,CAAA,GAAA,2CAAgB,EAAE;QACrC,IAAI,YAAuD;QAC3D,IAAI,kCACF,aAAa;QACb,YAAY,CAAA,GAAA,+BAAQ,EAAE,KAAK,aAAa,GAAG;aAE3C,aAAa;QACb,YAAY,CAAA,GAAA,+BAAQ,EAAE,KAAK,aAAa,KAAK,CAAC,GAAG;QAEnD,qBAAO,CAAA,GAAA,sCAAI,EAAE,YAAY,CAAC,cAAc;YACtC,GAAG,CAAA,GAAA,gCAAS,EAAE,aAAa,KAAK,EAAE,SAAS;YAC3C,2DAA2D;YAC3D,KAAK;QACP;IACF;IAGA,qBACE,0DAAC,CAAA,GAAA,+BAAQ;QAAE,gBAAgB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OAC3C;AAGP","sources":["packages/@react-spectrum/link/src/Link.tsx"],"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 {classNames, getWrappedElement, useSlotProps, useStyleProps} from '@react-spectrum/utils';\nimport {FocusRing} from '@react-aria/focus';\nimport {mergeProps, mergeRefs} from '@react-aria/utils';\nimport React, {ForwardedRef, JSX, MutableRefObject, useRef} from 'react';\nimport {SpectrumLinkProps} from '@react-types/link';\nimport styles from '@adobe/spectrum-css-temp/components/link/vars.css';\nimport {useHover} from '@react-aria/interactions';\nimport {useLink} from '@react-aria/link';\nimport {useProviderProps} from '@react-spectrum/provider';\n\nlet isOldReact = parseInt(React.version, 10) <= 18;\n/**\n * Links allow users to navigate to a different location.\n * They can be presented inline inside a paragraph or as standalone text.\n */\nexport function Link(props: SpectrumLinkProps) {\n props = useProviderProps(props);\n props = useSlotProps(props, 'link');\n let {\n variant = 'primary',\n isQuiet,\n children,\n // @ts-ignore\n href\n } = props;\n let {styleProps} = useStyleProps(props);\n let {hoverProps, isHovered} = useHover({});\n\n let ref = useRef(null);\n let {linkProps} = useLink({\n ...props,\n elementType: !href && typeof children === 'string' ? 'span' : 'a'\n }, ref);\n\n let domProps = {\n ...styleProps,\n ...mergeProps(linkProps, hoverProps),\n ref,\n className: classNames(\n styles,\n 'spectrum-Link',\n {\n 'spectrum-Link--quiet': isQuiet,\n [`spectrum-Link--${variant}`]: variant,\n 'is-hovered': isHovered\n },\n styleProps.className\n )\n };\n\n let link: JSX.Element;\n if (href) {\n link = <a {...domProps}>{children}</a>;\n } else {\n // Backward compatibility.\n let wrappedChild = getWrappedElement(children);\n let mergedRef: MutableRefObject<any> | ForwardedRef<any> = ref;\n if (isOldReact) {\n // @ts-ignore\n mergedRef = mergeRefs(ref, wrappedChild.ref);\n } else {\n // @ts-ignore\n mergedRef = mergeRefs(ref, wrappedChild.props.ref);\n }\n link = React.cloneElement(wrappedChild, {\n ...mergeProps(wrappedChild.props, domProps),\n // @ts-ignore https://github.com/facebook/react/issues/8873\n ref: mergedRef\n });\n }\n\n\n return (\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n {link}\n </FocusRing>\n );\n}\n"],"names":[],"version":3,"file":"Link.main.js.map"}
package/dist/Link.mjs CHANGED
@@ -30,6 +30,7 @@ function $parcel$interopDefault(a) {
30
30
 
31
31
 
32
32
 
33
+ let $3c5235ac12f2c9bb$var$isOldReact = parseInt((0, $35Vau$react).version, 10) <= 18;
33
34
  function $3c5235ac12f2c9bb$export$a6c7ac8248d6e38a(props) {
34
35
  props = (0, $35Vau$useProviderProps)(props);
35
36
  props = (0, $35Vau$useSlotProps)(props, 'link');
@@ -57,10 +58,15 @@ function $3c5235ac12f2c9bb$export$a6c7ac8248d6e38a(props) {
57
58
  else {
58
59
  // Backward compatibility.
59
60
  let wrappedChild = (0, $35Vau$getWrappedElement)(children);
61
+ let mergedRef = ref;
62
+ if ($3c5235ac12f2c9bb$var$isOldReact) // @ts-ignore
63
+ mergedRef = (0, $35Vau$mergeRefs)(ref, wrappedChild.ref);
64
+ else // @ts-ignore
65
+ mergedRef = (0, $35Vau$mergeRefs)(ref, wrappedChild.props.ref);
60
66
  link = /*#__PURE__*/ (0, $35Vau$react).cloneElement(wrappedChild, {
61
67
  ...(0, $35Vau$mergeProps)(wrappedChild.props, domProps),
62
68
  // @ts-ignore https://github.com/facebook/react/issues/8873
63
- ref: wrappedChild.ref ? (0, $35Vau$mergeRefs)(ref, wrappedChild.ref) : ref
69
+ ref: mergedRef
64
70
  });
65
71
  }
66
72
  return /*#__PURE__*/ (0, $35Vau$react).createElement((0, $35Vau$FocusRing), {
@@ -30,6 +30,7 @@ function $parcel$interopDefault(a) {
30
30
 
31
31
 
32
32
 
33
+ let $3c5235ac12f2c9bb$var$isOldReact = parseInt((0, $35Vau$react).version, 10) <= 18;
33
34
  function $3c5235ac12f2c9bb$export$a6c7ac8248d6e38a(props) {
34
35
  props = (0, $35Vau$useProviderProps)(props);
35
36
  props = (0, $35Vau$useSlotProps)(props, 'link');
@@ -57,10 +58,15 @@ function $3c5235ac12f2c9bb$export$a6c7ac8248d6e38a(props) {
57
58
  else {
58
59
  // Backward compatibility.
59
60
  let wrappedChild = (0, $35Vau$getWrappedElement)(children);
61
+ let mergedRef = ref;
62
+ if ($3c5235ac12f2c9bb$var$isOldReact) // @ts-ignore
63
+ mergedRef = (0, $35Vau$mergeRefs)(ref, wrappedChild.ref);
64
+ else // @ts-ignore
65
+ mergedRef = (0, $35Vau$mergeRefs)(ref, wrappedChild.props.ref);
60
66
  link = /*#__PURE__*/ (0, $35Vau$react).cloneElement(wrappedChild, {
61
67
  ...(0, $35Vau$mergeProps)(wrappedChild.props, domProps),
62
68
  // @ts-ignore https://github.com/facebook/react/issues/8873
63
- ref: wrappedChild.ref ? (0, $35Vau$mergeRefs)(ref, wrappedChild.ref) : ref
69
+ ref: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AAQ,EAAE,KAAK,aAAa,GAAG,IAAI;QAC7D;IACF;IAGA,qBACE,gCAAC,CAAA,GAAA,gBAAQ;QAAE,gBAAgB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;OAC3C;AAGP","sources":["packages/@react-spectrum/link/src/Link.tsx"],"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 {classNames, getWrappedElement, useSlotProps, useStyleProps} from '@react-spectrum/utils';\nimport {FocusRing} from '@react-aria/focus';\nimport {mergeProps, mergeRefs} from '@react-aria/utils';\nimport React, {JSX, useRef} from 'react';\nimport {SpectrumLinkProps} from '@react-types/link';\nimport styles from '@adobe/spectrum-css-temp/components/link/vars.css';\nimport {useHover} from '@react-aria/interactions';\nimport {useLink} from '@react-aria/link';\nimport {useProviderProps} from '@react-spectrum/provider';\n\n/**\n * Links allow users to navigate to a different location.\n * They can be presented inline inside a paragraph or as standalone text.\n */\nexport function Link(props: SpectrumLinkProps) {\n props = useProviderProps(props);\n props = useSlotProps(props, 'link');\n let {\n variant = 'primary',\n isQuiet,\n children,\n // @ts-ignore\n href\n } = props;\n let {styleProps} = useStyleProps(props);\n let {hoverProps, isHovered} = useHover({});\n\n let ref = useRef(null);\n let {linkProps} = useLink({\n ...props,\n elementType: !href && typeof children === 'string' ? 'span' : 'a'\n }, ref);\n\n let domProps = {\n ...styleProps,\n ...mergeProps(linkProps, hoverProps),\n ref,\n className: classNames(\n styles,\n 'spectrum-Link',\n {\n 'spectrum-Link--quiet': isQuiet,\n [`spectrum-Link--${variant}`]: variant,\n 'is-hovered': isHovered\n },\n styleProps.className\n )\n };\n\n let link: JSX.Element;\n if (href) {\n link = <a {...domProps}>{children}</a>;\n } else {\n // Backward compatibility.\n let wrappedChild = getWrappedElement(children);\n link = React.cloneElement(wrappedChild, {\n ...mergeProps(wrappedChild.props, domProps),\n // @ts-ignore https://github.com/facebook/react/issues/8873\n ref: wrappedChild.ref ? mergeRefs(ref, wrappedChild.ref) : ref\n });\n }\n\n\n return (\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n {link}\n </FocusRing>\n );\n}\n"],"names":[],"version":3,"file":"Link.module.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;AAYD,IAAI,mCAAa,SAAS,CAAA,GAAA,YAAI,EAAE,OAAO,EAAE,OAAO;AAKzC,SAAS,0CAAK,KAAwB;IAC3C,QAAQ,CAAA,GAAA,uBAAe,EAAE;IACzB,QAAQ,CAAA,GAAA,mBAAW,EAAE,OAAO;IAC5B,IAAI,WACF,UAAU,oBACV,OAAO,YACP,QAAQ,QACR,aAAa;IACb,IAAI,EACL,GAAG;IACJ,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE;IACjC,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE,CAAC;IAExC,IAAI,MAAM,CAAA,GAAA,aAAK,EAAE;IACjB,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,cAAM,EAAE;QACxB,GAAG,KAAK;QACR,aAAa,CAAC,QAAQ,OAAO,aAAa,WAAW,SAAS;IAChE,GAAG;IAEH,IAAI,WAAW;QACb,GAAG,UAAU;QACb,GAAG,CAAA,GAAA,iBAAS,EAAE,WAAW,WAAW;aACpC;QACA,WAAW,CAAA,GAAA,iBAAS,EAClB,CAAA,GAAA,sDAAK,GACL,iBACA;YACE,wBAAwB;YACxB,CAAC,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,EAAE;YAC/B,cAAc;QAChB,GACA,WAAW,SAAS;IAExB;IAEA,IAAI;IACJ,IAAI,MACF,qBAAO,gCAAC,KAAM,UAAW;SACpB;QACL,0BAA0B;QAC1B,IAAI,eAAe,CAAA,GAAA,wBAAgB,EAAE;QACrC,IAAI,YAAuD;QAC3D,IAAI,kCACF,aAAa;QACb,YAAY,CAAA,GAAA,gBAAQ,EAAE,KAAK,aAAa,GAAG;aAE3C,aAAa;QACb,YAAY,CAAA,GAAA,gBAAQ,EAAE,KAAK,aAAa,KAAK,CAAC,GAAG;QAEnD,qBAAO,CAAA,GAAA,YAAI,EAAE,YAAY,CAAC,cAAc;YACtC,GAAG,CAAA,GAAA,iBAAS,EAAE,aAAa,KAAK,EAAE,SAAS;YAC3C,2DAA2D;YAC3D,KAAK;QACP;IACF;IAGA,qBACE,gCAAC,CAAA,GAAA,gBAAQ;QAAE,gBAAgB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;OAC3C;AAGP","sources":["packages/@react-spectrum/link/src/Link.tsx"],"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 {classNames, getWrappedElement, useSlotProps, useStyleProps} from '@react-spectrum/utils';\nimport {FocusRing} from '@react-aria/focus';\nimport {mergeProps, mergeRefs} from '@react-aria/utils';\nimport React, {ForwardedRef, JSX, MutableRefObject, useRef} from 'react';\nimport {SpectrumLinkProps} from '@react-types/link';\nimport styles from '@adobe/spectrum-css-temp/components/link/vars.css';\nimport {useHover} from '@react-aria/interactions';\nimport {useLink} from '@react-aria/link';\nimport {useProviderProps} from '@react-spectrum/provider';\n\nlet isOldReact = parseInt(React.version, 10) <= 18;\n/**\n * Links allow users to navigate to a different location.\n * They can be presented inline inside a paragraph or as standalone text.\n */\nexport function Link(props: SpectrumLinkProps) {\n props = useProviderProps(props);\n props = useSlotProps(props, 'link');\n let {\n variant = 'primary',\n isQuiet,\n children,\n // @ts-ignore\n href\n } = props;\n let {styleProps} = useStyleProps(props);\n let {hoverProps, isHovered} = useHover({});\n\n let ref = useRef(null);\n let {linkProps} = useLink({\n ...props,\n elementType: !href && typeof children === 'string' ? 'span' : 'a'\n }, ref);\n\n let domProps = {\n ...styleProps,\n ...mergeProps(linkProps, hoverProps),\n ref,\n className: classNames(\n styles,\n 'spectrum-Link',\n {\n 'spectrum-Link--quiet': isQuiet,\n [`spectrum-Link--${variant}`]: variant,\n 'is-hovered': isHovered\n },\n styleProps.className\n )\n };\n\n let link: JSX.Element;\n if (href) {\n link = <a {...domProps}>{children}</a>;\n } else {\n // Backward compatibility.\n let wrappedChild = getWrappedElement(children);\n let mergedRef: MutableRefObject<any> | ForwardedRef<any> = ref;\n if (isOldReact) {\n // @ts-ignore\n mergedRef = mergeRefs(ref, wrappedChild.ref);\n } else {\n // @ts-ignore\n mergedRef = mergeRefs(ref, wrappedChild.props.ref);\n }\n link = React.cloneElement(wrappedChild, {\n ...mergeProps(wrappedChild.props, domProps),\n // @ts-ignore https://github.com/facebook/react/issues/8873\n ref: mergedRef\n });\n }\n\n\n return (\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n {link}\n </FocusRing>\n );\n}\n"],"names":[],"version":3,"file":"Link.module.js.map"}
@@ -1 +1 @@
1
- {"mappings":";;AAsBA;;;GAGG;AACH,qBAAqB,KAAK,EAAE,iBAAiB,eAsD5C;ACjED,YAAY,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC","sources":["packages/@react-spectrum/link/src/packages/@react-spectrum/link/src/Link.tsx","packages/@react-spectrum/link/src/packages/@react-spectrum/link/src/index.ts","packages/@react-spectrum/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\n/// <reference types=\"css-module-types\" />\n\nexport {Link} from './Link';\nexport type {SpectrumLinkProps} from '@react-types/link';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
1
+ {"mappings":";;AAuBA;;;GAGG;AACH,qBAAqB,KAAK,EAAE,iBAAiB,eA8D5C;AC1ED,YAAY,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAC","sources":["packages/@react-spectrum/link/src/packages/@react-spectrum/link/src/Link.tsx","packages/@react-spectrum/link/src/packages/@react-spectrum/link/src/index.ts","packages/@react-spectrum/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\n/// <reference types=\"css-module-types\" />\n\nexport {Link} from './Link';\nexport type {SpectrumLinkProps} from '@react-types/link';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-spectrum/link",
3
- "version": "3.6.7",
3
+ "version": "3.6.8",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
@@ -36,12 +36,13 @@
36
36
  "url": "https://github.com/adobe/react-spectrum"
37
37
  },
38
38
  "dependencies": {
39
- "@react-aria/focus": "^3.17.1",
40
- "@react-aria/interactions": "^3.21.3",
41
- "@react-aria/link": "^3.7.1",
42
- "@react-aria/utils": "^3.24.1",
43
- "@react-spectrum/utils": "^3.11.7",
44
- "@react-types/link": "^3.5.5",
39
+ "@react-aria/focus": "^3.18.0",
40
+ "@react-aria/interactions": "^3.22.0",
41
+ "@react-aria/link": "^3.7.2",
42
+ "@react-aria/utils": "^3.25.0",
43
+ "@react-spectrum/utils": "^3.11.8",
44
+ "@react-types/link": "^3.5.6",
45
+ "@react-types/shared": "^3.24.0",
45
46
  "@swc/helpers": "^0.5.0"
46
47
  },
47
48
  "devDependencies": {
@@ -49,10 +50,10 @@
49
50
  },
50
51
  "peerDependencies": {
51
52
  "@react-spectrum/provider": "^3.0.0",
52
- "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0"
53
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
53
54
  },
54
55
  "publishConfig": {
55
56
  "access": "public"
56
57
  },
57
- "gitHead": "b77d7d594dff4dcfb5359bffbcfd18142b146433"
58
+ "gitHead": "86d80e3216bc32e75108831cf3a5a720bc849206"
58
59
  }
package/src/Link.tsx CHANGED
@@ -13,13 +13,14 @@
13
13
  import {classNames, getWrappedElement, useSlotProps, useStyleProps} from '@react-spectrum/utils';
14
14
  import {FocusRing} from '@react-aria/focus';
15
15
  import {mergeProps, mergeRefs} from '@react-aria/utils';
16
- import React, {JSX, useRef} from 'react';
16
+ import React, {ForwardedRef, JSX, MutableRefObject, useRef} from 'react';
17
17
  import {SpectrumLinkProps} from '@react-types/link';
18
18
  import styles from '@adobe/spectrum-css-temp/components/link/vars.css';
19
19
  import {useHover} from '@react-aria/interactions';
20
20
  import {useLink} from '@react-aria/link';
21
21
  import {useProviderProps} from '@react-spectrum/provider';
22
22
 
23
+ let isOldReact = parseInt(React.version, 10) <= 18;
23
24
  /**
24
25
  * Links allow users to navigate to a different location.
25
26
  * They can be presented inline inside a paragraph or as standalone text.
@@ -65,10 +66,18 @@ export function Link(props: SpectrumLinkProps) {
65
66
  } else {
66
67
  // Backward compatibility.
67
68
  let wrappedChild = getWrappedElement(children);
69
+ let mergedRef: MutableRefObject<any> | ForwardedRef<any> = ref;
70
+ if (isOldReact) {
71
+ // @ts-ignore
72
+ mergedRef = mergeRefs(ref, wrappedChild.ref);
73
+ } else {
74
+ // @ts-ignore
75
+ mergedRef = mergeRefs(ref, wrappedChild.props.ref);
76
+ }
68
77
  link = React.cloneElement(wrappedChild, {
69
78
  ...mergeProps(wrappedChild.props, domProps),
70
79
  // @ts-ignore https://github.com/facebook/react/issues/8873
71
- ref: wrappedChild.ref ? mergeRefs(ref, wrappedChild.ref) : ref
80
+ ref: mergedRef
72
81
  });
73
82
  }
74
83