import { type Placement } from '../shared/position.js'; import type { OpenDetail, CloseDetail } from '../shared/events.js'; import { UiElement } from '../shared/element.js'; declare const UiPopover_base: (new (...args: any[]) => import("../shared/align.ts").AlignAlias) & typeof UiElement; /** * Carbon `Popover`: the floating box primitive behind tooltips, toggletips and menus, for when * you need your own content next to a trigger. Put the trigger in slot `trigger` and the content * in the default slot; set `open` yourself (or use `auto-close` to let Escape and outside clicks * close it). Variants: `caret` (default on, 12×6, 10px offset), `drop-shadow` (default on), * `high-contrast` (inverse colours), `tab-tip` (square, flush under the trigger, no caret). * Lives in the top layer at document coordinates and flips when it does not fit. * Beyond Carbon, `open-on-hover` lets it open itself, as a hover preview: see `openOnHover`. * * @slot trigger - The element the box is positioned against * @slot - Box content * @fires ui-toggle - detail: { open } after it opens or closes * @fires ui-request-close - cancelable; `auto-close` fires it before closing on Escape / outside click * @csspart content - The floating box * @csspart caret - The arrow * @attr align - Carbon's name for `placement` (same values) * @cssprop --ui-menu-border / --ui-menu-radius - Border and corners of the bubble (the menu settings) */ export declare class UiPopover extends UiPopover_base { static readonly styles: import("lit").CSSResult[]; open: boolean; placement: Placement; /** On by default; `caret="false"` hides it. */ caret: boolean; /** On by default; `drop-shadow="false"` removes it. */ dropShadow: boolean; highContrast: boolean; /** Carbon `isTabTip`: square box flush against the trigger (toolbar settings panels). */ tabTip: boolean; /** Close on Escape and on clicks outside the trigger and the box. */ autoClose: boolean; /** Accessible name of the box (`role=group`). */ label: string; /** * Beyond Carbon (its Popover has no hover mode; the tooltip's timings): the popover opens and closes itself. A * mouse resting on the trigger opens it after 100ms, and leaving the trigger and the box closes it after 300ms * (the pointer can move onto the box, WCAG 1.4.13); keyboard focus on the trigger opens it at once, and focus * leaving the trigger and the box closes it; a tap (touch, pen) on the trigger toggles it; Escape and a press * outside close it. While focus is in the box, or on the trigger by keyboard, it stays open. */ openOnHover: boolean; private readonly content; private readonly triggers; private readonly contentId; connectedCallback(): void; disconnectedCallback(): void; show(): void; hide(): void; private get anchor(); protected updated(changed: Map): void; /** * aria-expanded on the trigger (`expanded` on a ``, whose own button carries it). No * aria-controls: the box is in this shadow root, which an id in the trigger's tree can't point into. */ private syncTrigger; private untrack?; private stopOutside?; private stopTracking; private readonly reposition; /** `auto-close` asks first (`ui-request-close`); `open-on-hover` alone closes. */ private dismiss; private requestClose; /** * Escape from inside the popover (trigger or content) closes it and returns focus to the trigger. * Listening on the host, bubbling, lets a nested dropdown / date picker handle its own Escape first * (it calls preventDefault) instead of every popover on the page swallowing the key. */ private readonly onKeydown; private readonly onPointerDown; /** Focus back on the trigger after Escape: with `open-on-hover`, not a new keyboard focus that opens it again. */ private refocusTrigger; /** The trigger the hover listeners are on. */ private hoverTrigger?; private hoverTimer?; private blurTimer?; /** The mouse is on the trigger or the box. */ private hovered; /** The pointer type of the last press on the trigger: its click toggles when it was a tap. */ private pressType; private refocusing; private pageEscape; /** Hover listeners on the current trigger (none when the option is off or the element is gone); Escape on the page while open. */ private syncHoverMode; private readonly onTriggerSlotChange; private hoverLater; /** Closes unless the mouse is on the trigger or the box, or focus holds it. */ private closeUnlessHeld; /** Focus in the box holds it open, and on the trigger by keyboard (a click or a tap there doesn't). */ private focusHolds; private readonly onTriggerEnter; private readonly onContentEnter; private readonly onHoverLeave; /** Keyboard focus only, as the tooltip: a click or a tap has its own rule. */ private readonly onTriggerFocus; /** Focus left the trigger or the box: a tick later it has landed (between shadow parts relatedTarget can be null). */ private readonly onHoverBlur; private readonly onTriggerPress; private readonly onTriggerClick; /** Escape from elsewhere on the page (the mouse showed it, focus is not inside): closes this box only, as the tooltip. */ private readonly onPageEscape; render(): import("lit-html").TemplateResult<1>; } export type PopoverCloseReason = 'escape' | 'outside'; export interface UiPopoverEventMap extends HTMLElementEventMap { 'ui-toggle': CustomEvent; 'ui-request-close': CustomEvent>; } /** Typed listeners for UiPopover's events (declaration merging with the class). */ export interface UiPopover { addEventListener(type: K, listener: (this: UiPopover, event: UiPopoverEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: UiPopover, event: UiPopoverEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void; removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; } declare global { interface HTMLElementTagNameMap { 'ui-popover': UiPopover; } } export {};