UNPKG

carbon-custom-elements

Version:

A Carbon Design System variant that's as easy to use as native HTML elements, with no framework tax, no framework silo.

1 lines 1.57 kB
{"version":3,"sources":["components/tooltip/tooltip-icon.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAItD;;;;GAIG;AACH,cACM,aAAc,SAAQ,kBAAkB;IAC5C,MAAM;CAiBP;AAED,eAAe,aAAa,CAAC","file":"tooltip-icon.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, customElement } from 'lit-element';\nimport settings from 'carbon-components/es/globals/js/settings';\nimport BXTooltipDefintion from './tooltip-definition';\n\nconst { prefix } = settings;\n\n/**\n * Icon tooltip.\n * @element bx-tooltip-icon\n * @slot body - The tooltip body content.\n */\n@customElement(`${prefix}-tooltip-icon`)\nclass BXTooltipIcon extends BXTooltipDefintion {\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--${direction}`]: direction,\n [`${prefix}--tooltip--align-${alignment}`]: alignment,\n });\n return html`\n <button class=\"${classes}\" aria-describedby=\"tooltip-body\">\n <span class=\"${prefix}--assistive-text\" id=\"tooltip-body\" role=\"tooltip\">\n <slot name=\"body\">${bodyText}</slot>\n </span>\n <slot></slot>\n </button>\n `;\n }\n}\n\nexport default BXTooltipIcon;\n"]}