{"version":3,"file":"TextLink.mjs","names":["ArrowUpRightOutlineIcon"],"sources":["../../../src/text-link/TextLink.tsx"],"sourcesContent":["/*!\n *\n *  Copyright (c) \"Neo4j\"\n *  Neo4j Sweden AB [http://neo4j.com]\n *\n *  This file is part of Neo4j.\n *\n *  Neo4j is free software: you can redistribute it and/or modify\n *  it under the terms of the GNU General Public License as published by\n *  the Free Software Foundation, either version 3 of the License, or\n *  (at your option) any later version.\n *\n *  This program is distributed in the hope that it will be useful,\n *  but WITHOUT ANY WARRANTY; without even the implied warranty of\n *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n *  GNU General Public License for more details.\n *\n *  You should have received a copy of the GNU General Public License\n *  along with this program.  If not, see <http://www.gnu.org/licenses/>.\n */\nimport classNames from 'classnames';\nimport type React from 'react';\n\nimport { type PolymorphicCommonProps } from '../_common/types';\nimport { ArrowUpRightOutlineIcon } from '../icons/generated/custom';\n\ntype TextLinkType = 'internal' | 'external';\n\ntype TextLinkProps = {\n  /** The content displayed inside the link */\n  children: React.ReactNode;\n\n  /** The URL the link points to */\n  href?: string;\n\n  /**\n   * The type of the text link.\n   * All types render with an underline and primary text color by default. Additional color styling can be applied via `className`.\n   * - 'internal': A link to another page within the application\n   * - 'external': A link to an external website. An external link icon is appended.\n   * @default 'internal'\n   */\n  type?: TextLinkType;\n\n  /** Specifies where to open the linked document. If omitted and `type` is `\"external\"` it defaults to `\"_blank\"`. */\n  target?: HTMLAnchorElement['target'];\n};\n\nexport const TextLink = <T extends React.ElementType = 'a'>({\n  children,\n  href,\n  type = 'internal',\n  as,\n  className,\n  target = type === 'external' ? '_blank' : '',\n  style,\n  htmlAttributes,\n  ref,\n  ...restProps\n}: PolymorphicCommonProps<T, TextLinkProps>) => {\n  const Component: React.ElementType = as ?? 'a';\n\n  const classes = classNames('ndl-text-link', className, {\n    'ndl-external-link': type === 'external',\n  });\n\n  return (\n    <Component\n      className={classes}\n      href={href}\n      ref={ref}\n      style={style}\n      target={target}\n      {...restProps}\n      {...htmlAttributes}\n    >\n      {children}\n      {type === 'external' && (\n        <ArrowUpRightOutlineIcon className=\"ndl-external-link-icon\" />\n      )}\n    </Component>\n  );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;AATF,MAAa,YAA+C,SAWZ;CAXY,IAAA,EAC1D,UACA,MACA,OAAO,YACP,IACA,WACA,SAAS,SAAS,aAAa,WAAW,IAC1C,OACA,gBACA,QAAA,MACG,YAAA,yBAAA,MAAA,SAAA;CAEH,MAAM,YAA+B,OAAA,QAAA,OAAA,KAAA,IAAA,KAAM;CAE3C,MAAM,UAAU,WAAW,iBAAiB,WAAW,EACrD,qBAAqB,SAAS,WAChC,CAAC;CAED,OACE,qBAAC,WAAA,eAAA,eAAA,eAAA;EACC,WAAW;EACL;EACD;EACE;EACC;CACJ,GAAA,SAAA,GACA,cAAA,GAAA,CAAA,GAAA,EAAA,UAPN,CASG,UACA,SAAS,cACR,oBAACA,wBAAD,EAAyB,WAAU,yBAA0B,CAAA,CAEtD,EAAA,CAAA,CAAA;AAEf"}