{"version":3,"sources":["components/link/link.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAiC,UAAU,EAAE,MAAM,aAAa,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQxE;;;GAGG;AACH,cACM,MAAO,SAAQ,WAAsB;IACzC;;;OAGG;IACH,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAE,UAAU;IAO5C;;OAEG;IAEH,QAAQ,UAAS;IAEjB;;OAEG;IAEH,QAAQ,EAAG,MAAM,CAAC;IAElB;;OAEG;IAEH,IAAI,EAAG,MAAM,CAAC;IAEd;;OAEG;IAEH,QAAQ,EAAG,MAAM,CAAC;IAElB;;OAEG;IAEH,IAAI,EAAG,MAAM,CAAC;IAEd;;OAEG;IAEH,GAAG,EAAG,MAAM,CAAC;IAEb;;OAEG;IAEH,MAAM,EAAG,MAAM,CAAC;IAEhB;;OAEG;IAEH,IAAI,EAAG,MAAM,CAAC;IAEd,gBAAgB;IAIhB,MAAM;IAyBN,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,MAAM,CAAC","file":"link.d.ts","sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2019, 2020\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { classMap } from 'lit-html/directives/class-map';\nimport { html, property, customElement, LitElement } from 'lit-element';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport ifNonNull from '../../globals/directives/if-non-null';\nimport FocusMixin from '../../globals/mixins/focus';\nimport styles from './link.scss';\n\nconst { prefix } = settings;\n\n/**\n * Link.\n * @element bx-link\n */\n@customElement(`${prefix}-link`)\nclass BXLink extends FocusMixin(LitElement) {\n  /**\n   * Handles `click` event on the `<a>.\n   * @param event The event.\n   */\n  protected _handleClickLink(event: MouseEvent) {\n    if (this.disabled) {\n      event.preventDefault(); // Stop following the link\n      event.stopPropagation(); // Stop firing `onClick`\n    }\n  }\n\n  /**\n   * `true` if the button should be disabled.\n   */\n  @property({ type: Boolean, reflect: true })\n  disabled = false;\n\n  /**\n   * The default file name, used if this button is rendered as `<a>`.\n   */\n  @property()\n  download!: string;\n\n  /**\n   * Link `href`. If present, this button is rendered as `<a>`.\n   */\n  @property()\n  href!: string;\n\n  /**\n   * The language of what `href` points to, if this button is rendered as `<a>`.\n   */\n  @property()\n  hreflang!: string;\n\n  /**\n   * URLs to ping, if this button is rendered as `<a>`.\n   */\n  @property()\n  ping!: string;\n\n  /**\n   * The link type, if this button is rendered as `<a>`.\n   */\n  @property()\n  rel!: string;\n\n  /**\n   * The link target, if this button is rendered as `<a>`.\n   */\n  @property()\n  target!: string;\n\n  /**\n   * The default behavior if the button is rendered as `<button>`. MIME type of the `target`if this button is rendered as `<a>`.\n   */\n  @property()\n  type!: string;\n\n  createRenderRoot() {\n    return this.attachShadow({ mode: 'open', delegatesFocus: true });\n  }\n\n  render() {\n    const { disabled, download, href, hreflang, ping, rel, target, type } = this;\n    const classes = classMap({\n      [`${prefix}--link`]: true,\n      [`${prefix}--link--disabled`]: disabled,\n    });\n    return html`\n      <a\n        id=\"button\"\n        role=\"button\"\n        class=\"${classes}\"\n        download=\"${ifNonNull(download)}\"\n        href=\"${ifNonNull(href)}\"\n        hreflang=\"${ifNonNull(hreflang)}\"\n        ping=\"${ifNonNull(ping)}\"\n        rel=\"${ifNonNull(rel)}\"\n        target=\"${ifNonNull(target)}\"\n        type=\"${ifNonNull(type)}\"\n        @click=\"${this._handleClickLink}\"\n      >\n        <slot></slot>\n      </a>\n    `;\n  }\n\n  static styles = styles; // `styles` here is a `CSSResult` generated by custom WebPack loader\n}\n\nexport default BXLink;\n"]}