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CAAA,GAAA,sCAAI,EAAE,YAAY,CAAC,cAAc;YACtC,GAAG,CAAA,GAAA,qCAAS,EAAE,aAAa,KAAK,EAAE,SAAS;YAC3C,2DAA2D;YAC3D,KAAK;QACP;IACF;IAGA,qBACE,0DAAC,CAAA,GAAA,mCAAQ;QAAE,gBAAgB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OAC3C;AAGP","sources":["packages/@adobe/react-spectrum/src/link/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 {AriaLinkProps, useLink} from 'react-aria/useLink';\n\nimport {classNames} from '../utils/classNames';\nimport {FocusRing} from 'react-aria/FocusRing';\nimport {getWrappedElement} from '../utils/getWrappedElement';\nimport {mergeProps} from 'react-aria/mergeProps';\nimport {mergeRefs} from 'react-aria/mergeRefs';\nimport React, {ForwardedRef, JSX, MutableRefObject, ReactNode, useRef} from 'react';\nimport {StyleProps} from '@react-types/shared';\nimport styles from '@adobe/spectrum-css-temp/components/link/vars.css';\nimport {useHover} from 'react-aria/useHover';\nimport {useProviderProps} from '../provider/Provider';\nimport {useSlotProps} from '../utils/Slots';\nimport {useStyleProps} from '../utils/styleProps';\n\nexport interface SpectrumLinkProps extends Omit<AriaLinkProps, 'onClick'>, StyleProps {\n  /** The content to display in the link. */\n  children: ReactNode,\n  /**\n   * The [visual style](https://spectrum.adobe.com/page/link/#Options) of the link.\n   * @default 'primary'\n   */\n  variant?: 'primary' | 'secondary' | 'overBackground',\n  /** Whether the link should be displayed with a quiet style. */\n  isQuiet?: boolean\n}\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): JSX.Element {\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.cjs.map"}