import { LitElement, html } from 'lit'; import { customElement, property, state } from 'lit/decorators.js'; import { classMap } from 'lit/directives/class-map.js'; import TooltipScss from './tooltip.scss'; import '@kyndryl-design-system/shidoka-foundation/components/icon'; import infoIcon from '@carbon/icons/es/information/20'; /** * Tooltip. * @slot unnamed - Slot for tooltip content. * @slot anchor - Slot for custom anchor button content. */ @customElement('kyn-tooltip') export class Tooltip extends LitElement { static override styles = TooltipScss; @property({ type: Boolean }) open = false; /** Tooltip anchor position. `'start'`, `'end'`, or `'center'`. */ @property({ type: String }) anchorPosition = 'center'; /** Tooltip direction. `'top'`, `'bottom'`, `'left'`, or `'right'`. */ @property({ type: String }) direction = 'top'; /** Assistive text for anchor button. */ @property({ type: String }) assistiveText = 'Toggle Tooltip'; /** Timeout function to delay modal close. * @internal */ @state() timer: any; override render() { const classes = { content: true, open: this.open, 'anchor--start': this.anchorPosition === 'start', 'anchor--end': this.anchorPosition === 'end', 'anchor--center': this.anchorPosition === 'center', 'direction--top': this.direction === 'top', 'direction--bottom': this.direction === 'bottom', 'direction--left': this.direction === 'left', 'direction--right': this.direction === 'right', }; return html`