import { PropertyValues } from 'lit'; import { SpectrumElement } from '../../element/index.js'; import { HoverControllerHost } from '../../controllers/hover-controller/index.js'; import { TooltipPlacement, TooltipVariant } from './Tooltip.types.js'; /** * Abstract base class for the Tooltip component. * Handles all non-rendering logic: property declarations, popover lifecycle, * event dispatch, trigger resolution, ARIA wiring, `HoverController` integration * (hover/focus open/close), and `PlacementController` integration (pixel positioning). * * @slot - Text label displayed in the tooltip. */ export declare abstract class TooltipBase extends SpectrumElement implements HoverControllerHost { /** * @internal * * All valid variants for the tooltip. */ static readonly VARIANTS: readonly string[]; /** * @internal * * All valid placement values: physical cardinals (`top`, `bottom`, `left`, `right`) * and logical inline values (`start`, `end`). */ static readonly PLACEMENTS: readonly string[]; /** * The semantic variant of the tooltip. * * @default 'neutral' */ variant: TooltipVariant; /** * Preferred placement of the tooltip relative to its trigger. This is always * the consumer's requested side; the resolved physical side (after any * viewport-driven flip) is reflected as `actual-placement`. * * @default 'top' */ placement: TooltipPlacement; /** * Whether the tooltip is visible. * * @default false */ open: boolean; /** * The `id` of the trigger element in the same document tree root. */ for: string | undefined; /** * Explicit trigger element reference; overrides `for` when set. * Use when `getElementById` cannot reach the trigger, such as across a shadow boundary. * * @default null */ triggerElement: HTMLElement | null; /** * Warm-up delay in milliseconds before the tooltip opens on pointer hover. * Set to `0` to open immediately. Keyboard focus always opens immediately. * * @default 1500 */ delay: number; /** * When set, the tooltip does not respond to hover or focus events and cannot * be opened. `disabled` takes priority over `open`: setting `open` to `true` * while disabled is a no-op, and disabling an open tooltip closes it. Applies * in `manual` mode as well. * * @default false */ disabled: boolean; /** * Suppresses automatic hover and focus wiring. * The consumer manages visibility via the `open` property or the popover API. * * @default false */ manual: boolean; /** * Pixel gap along the placement axis between the trigger and the tooltip bubble. * * @default 4 */ offset: number; /** * Slide along the trigger edge perpendicular to the placement direction, in pixels. * * @default 0 */ crossOffset: number; /** * Minimum inset from the viewport edge, in pixels, for collision detection. * * @default 12 */ containerPadding: number; /** * Whether the tooltip may reposition to the opposite side when the requested * placement does not fit within the viewport. * * @default true */ shouldFlip: boolean; /** * When set, the tooltip acts as the trigger's accessible name rather than its description. * Use for icon-only triggers where the tooltip text is the sole accessible name. * * @default false */ labeling: boolean; private readonly hoverController; private readonly placementController; private afterEventPending; private afterEventFallbackTimer; private _lastWiredTrigger; /** * Returns the tip arrow element to pass to `PlacementController` so the * `arrow` middleware keeps the tip aligned with the trigger when the bubble * is shifted (e.g. via `crossOffset` or viewport `shift`). * * Returns `null` in the base class; the SWC rendering layer overrides this * to return the actual `.swc-Tooltip-tip` element from the shadow DOM. */ protected get tipElement(): HTMLElement | null; private get isPopoverOpen(); /** * {@link HoverControllerHost} contract. `open` is the single source of truth * for visibility; the controller asks to open via this method rather than * driving the Popover API directly. `updated()` then reconciles the popover. */ requestOpen(): void; /** * {@link HoverControllerHost} contract. Asks the tooltip to close by setting * `open`; `updated()` reconciles the popover. */ requestClose(): void; private setDeclaredActualPlacement; private startPlacement; private resolveTrigger; private clearAriaRelationship; private syncAriaRelationship; private clearPositioningState; private dispatchAfterEvent; private readonly handleBeforeToggle; private readonly handleToggle; private readonly handleTransitionEnd; private readonly handleKeyDown; protected willUpdate(changedProperties: PropertyValues): void; protected updated(changedProperties: PropertyValues): void; connectedCallback(): void; disconnectedCallback(): void; }