import type { CSSResultGroup } from 'lit'; import DSAPopup from '../popup/popup'; import { ShoelaceElement } from '../../internal/shoelace-element'; /** * @summary Tooltips display additional information based on a specific action. * @documentation https://dsa.service-public-autonomie.fr/latest/librairie-webcomponents/infobulle-tooltip/web-DM5OiRxt * * @dependency dsa-popup * * @slot - The tooltip's target element. Avoid slotting in more than one element, as subsequent ones will be ignored. * @slot content - The content to render in the tooltip. Alternatively, you can use the `content` attribute. * * @event dsa-show - Emitted when the tooltip begins to show. * @event dsa-after-show - Emitted after the tooltip has shown and all animations are complete. * @event dsa-hide - Emitted when the tooltip begins to hide. * @event dsa-after-hide - Emitted after the tooltip has hidden and all animations are complete. * * @cssproperty --max-width - The maximum width of the tooltip before its content will wrap. * @cssproperty --hide-delay - The amount of time to wait before hiding the tooltip when hovering. * @cssproperty --show-delay - The amount of time to wait before showing the tooltip when hovering. */ export default class DSATooltip extends ShoelaceElement { static styles: CSSResultGroup; static dependencies: { 'dsa-popup': typeof DSAPopup; }; private hoverTimeout; private readonly localize; defaultSlot: HTMLSlotElement; body: HTMLElement; popup: DSAPopup; /** The tooltip's content. If you need to display HTML, use the `content` slot instead. */ content: string; /** * The preferred placement of the tooltip. Note that the actual placement may vary as needed to keep the tooltip * inside of the viewport. */ placement: 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end'; /** Disables the tooltip so it won't show when triggered. */ disabled: boolean; /** The distance in pixels from which to offset the tooltip away from its target. */ distance: number; /** Indicates whether or not the tooltip is open. You can use this in lieu of the show/hide methods. */ open: boolean; /** The distance in pixels from which to offset the tooltip along its target. */ skidding: number; /** * Controls how the tooltip is activated. Possible options include `click`, `hover`, `focus`, and `manual`. Multiple * options can be passed by separating them with a space. When manual is used, the tooltip must be activated * programmatically. */ trigger: string; /** * Enable this option to prevent the tooltip from being clipped when the component is placed inside a container with * `overflow: auto|hidden|scroll`. Hoisting uses a fixed positioning strategy that works in many, but not all, * scenarios. */ hoist: boolean; connectedCallback(): void; firstUpdated(): void; disconnectedCallback(): void; private handleBlur; private handleClick; private handleFocus; private handleDocumentKeyDown; private handleMouseOver; private handleMouseOut; private hasTrigger; handleOpenChange(): Promise; handleOptionsChange(): Promise; handleDisabledChange(): void; /** Shows the tooltip. */ show(): Promise; /** Hides the tooltip */ hide(): Promise; /** Automatically adds an accessible description to the trigger element */ private handleDefaultSlotChange; render(): import("lit").TemplateResult<1>; } declare global { interface HTMLElementTagNameMap { 'dsa-tooltip': DSATooltip; } }