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AI,EAAE,YAAY,CAAC,cAAc;YACtC,GAAG,CAAA,GAAA,iBAAS,EAAE,aAAa,KAAK,EAAE,SAAS;YAC3C,2DAA2D;YAC3D,KAAK;QACP;IACF;IAEA,qBAAO,gCAAC,CAAA,GAAA,gBAAQ;QAAE,gBAAgB,CAAA,GAAA,yCAAS,EAAE,CAAA,GAAA,iDAAK,GAAG;OAAgB;AACvE","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   *\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    {\n      ...props,\n      elementType: !href && typeof children === 'string' ? 'span' : 'a'\n    },\n    ref\n  );\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  return <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>{link}</FocusRing>;\n}\n"],"names":[],"version":3,"file":"Link.mjs.map"}