{"version":3,"sources":["components/tooltip/tooltip-definition.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAiC,UAAU,EAAE,MAAM,aAAa,CAAC;AAGxE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAG9D,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIhD;;;;GAIG;AACH,cACM,mBAAoB,SAAQ,wBAAsB;IACtD;;OAEG;IAEH,SAAS,oBAA4B;IAErC;;OAEG;IAEH,QAAQ,SAAM;IAEd;;OAEG;IAEH,SAAS,oBAA4B;IAErC,gBAAgB;IAOhB,MAAM;IAmBN,MAAM,CAAC,MAAM,MAAU;CACxB;AAED,eAAe,mBAAmB,CAAC","file":"tooltip-definition.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 FocusMixin from '../../globals/mixins/focus';\nimport { TOOLTIP_ALIGNMENT, TOOLTIP_DIRECTION } from './defs';\nimport styles from './tooltip.scss';\n\nexport { TOOLTIP_ALIGNMENT, TOOLTIP_DIRECTION };\n\nconst { prefix } = settings;\n\n/**\n * Definition tooltip.\n * @element bx-tooltip-definition\n * @slot body - The tooltip body content.\n */\n@customElement(`${prefix}-tooltip-definition`)\nclass BXTooltipDefinition extends FocusMixin(LitElement) {\n  /**\n   * How the tooltip is aligned to the trigger button.\n   */\n  @property()\n  alignment = TOOLTIP_ALIGNMENT.CENTER;\n\n  /**\n   * The text for the tooltip body.\n   */\n  @property({ attribute: 'body-text' })\n  bodyText = '';\n\n  /**\n   * The tooltip direction.\n   */\n  @property()\n  direction = TOOLTIP_DIRECTION.BOTTOM;\n\n  createRenderRoot() {\n    return this.attachShadow({\n      mode: 'open',\n      delegatesFocus: Number((/Safari\\/(\\d+)/.exec(navigator.userAgent) ?? ['', 0])[1]) <= 537,\n    });\n  }\n\n  render() {\n    const { alignment, bodyText, direction } = this;\n    const classes = classMap({\n      [`${prefix}--tooltip__trigger`]: true,\n      [`${prefix}--tooltip--a11y`]: true,\n      [`${prefix}--tooltip__trigger--definition`]: true,\n      [`${prefix}--tooltip--${direction}`]: direction,\n      [`${prefix}--tooltip--align-${alignment}`]: alignment,\n    });\n    return html`\n      <button class=\"${classes}\" aria-describedby=\"tooltip-body\">\n        <slot></slot>\n      </button>\n      <div class=\"${prefix}--assistive-text\" id=\"tooltip-body\" role=\"tooltip\">\n        <slot name=\"body\">${bodyText}</slot>\n      </div>\n    `;\n  }\n\n  static styles = styles;\n}\n\nexport default BXTooltipDefinition;\n"]}