{"version":3,"file":"link.cjs","sources":["../../../components/link/link.tsx"],"sourcesContent":["import { useRender } from '@base-ui/react';\nimport { cx } from 'class-variance-authority';\nimport { Text, type TextBaseProps } from '../text';\nimport styles from './link.module.css';\n\nexport interface LinkProps\n  extends TextBaseProps,\n    useRender.ComponentProps<'a'> {\n  external?: boolean;\n  download?: boolean | string;\n}\n\nexport function Link({\n  children,\n  className,\n  variant = 'accent',\n  size = 'small',\n  external,\n  download,\n  render = <a />,\n  ...props\n}: LinkProps) {\n  const userAriaLabel = props['aria-label'];\n  const textLabel = typeof children === 'string' ? children : undefined;\n\n  const externalProps = external\n    ? {\n        target: '_blank',\n        rel: 'noopener noreferrer',\n        'aria-label':\n          userAriaLabel ??\n          (textLabel ? `${textLabel} (opens in new tab)` : undefined)\n      }\n    : {};\n\n  const downloadProps = download\n    ? {\n        download: typeof download === 'string' ? download : true,\n        'aria-label':\n          userAriaLabel ?? (textLabel ? `${textLabel} (download)` : undefined)\n      }\n    : {};\n\n  return (\n    <Text\n      data-slot='link'\n      className={cx(styles.link, className)}\n      variant={variant}\n      size={size}\n      {...externalProps}\n      {...downloadProps}\n      {...props}\n      render={render}\n    >\n      {children}\n    </Text>\n  );\n}\n\nLink.displayName = 'Link';\n"],"names":["_jsx","Text","cx","styles"],"mappings":";;;;;;;AAYM,SAAU,IAAI,CAAC,EACnB,QAAQ,EACR,SAAS,EACT,OAAO,GAAG,QAAQ,EAClB,IAAI,GAAG,OAAO,EACd,QAAQ,EACR,QAAQ,EACR,MAAM,GAAGA,cAAK,CAAA,GAAA,EAAA,EAAA,CAAA,EACd,GAAG,KAAK,EACE,EAAA;AACV,IAAA,MAAM,aAAa,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;AAC1C,IAAA,MAAM,SAAS,GAAG,OAAO,QAAQ,KAAK,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IAEtE,MAAM,aAAa,GAAG,QAAQ;AAC5B,UAAE;AACE,YAAA,MAAM,EAAE,QAAQ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