import * as _angular_core from '@angular/core'; import { InjectionToken, Signal, Provider } from '@angular/core'; import * as forty_cdk_tooltip from 'forty-cdk/tooltip'; import { VetoableNativeEvent } from 'forty-cdk/core'; import { AnchoredPositioningContext, Point, AnchoredOverlayPositioningBase, AnchoredPositioningSeedDefaults, FloatingSide, FloatingAlign } from 'forty-cdk/core-overlay'; /** Reason a show / hide was scheduled — `escape` and `press` bypass the close delay. */ type TooltipScheduleReason = 'hover' | 'focus' | 'escape' | 'press'; /** * Coordination contract owned by `ForTooltip`. Trigger and content register * their host elements so floating-ui can compute position; the optional arrow * registers itself so the `arrow` middleware can offset it inside the bubble. * * The trigger and content forward their host hover / focus events through the * `pointerEnter*` / `pointerLeave*` / `focusTrigger` / `blurTrigger` methods; * the root owns the single open / close decision so all keep-alive sources * (trigger hover, trigger focus, and — under `hoverableContent` — content * hover) are reconciled in one place. */ interface ForTooltipContext extends AnchoredPositioningContext { readonly open: Signal; readonly disabled: Signal; /** Whether the pointer may move into the content without dismissing the tooltip. */ readonly hoverableContent: Signal; /** Whether `prefers-reduced-motion: reduce` is active — reflected as `data-reduced-motion`. */ readonly reducedMotion: Signal; /** Trigger element id — a consumer-set host `id` is adopted, else a generated one. */ readonly triggerId: Signal; /** Content element id — a consumer-set host `id` is adopted, else a generated one. Referenced by the trigger's `aria-describedby` while open. */ readonly contentId: Signal; readonly trigger: Signal; registerTrigger(el: HTMLElement): void; unregisterTrigger(el: HTMLElement): void; /** Registers the content host element so the hoverable-content grace polygon can measure it. */ registerContent(el: HTMLElement): void; unregisterContent(el: HTMLElement): void; /** Adopts a consumer-set static `id` on the content host into `contentId`. */ adoptContentId(el: HTMLElement): void; registerArrow(el: HTMLElement): void; unregisterArrow(el: HTMLElement): void; /** The pointer entered the trigger; opens after the resolved open delay (gated by `showOnOverflow`). */ pointerEnterTrigger(): void; /** The pointer left the trigger; closes, or arms the hoverable-content bridge from `cursor`. */ pointerLeaveTrigger(cursor: Point): void; /** The trigger received focus; opens after the resolved open delay (gated by `showOnOverflow`). */ focusTrigger(): void; /** The trigger lost focus; closes when nothing else keeps the tooltip alive. */ blurTrigger(): void; /** The pointer entered the content (`hoverableContent`); holds the tooltip open. */ pointerEnterContent(): void; /** The pointer left the content (`hoverableContent`); closes when nothing else keeps it alive. */ pointerLeaveContent(): void; /** * Schedule the tooltip to open after `openDelay` ms (instant when delay is 0). * Hover-driven opens are suppressed while an ancestor scroll container is * moving content under a stationary cursor, so a row sliding past the pointer * can't flicker a tooltip open; the `'focus'` path is never suppressed. */ scheduleOpen(reason: TooltipScheduleReason): void; /** Schedule the tooltip to close after `closeDelay` ms (instant on `escape` and `press`). */ scheduleClose(reason: TooltipScheduleReason): void; /** Cancel any pending open/close timer without changing state. */ cancelPending(): void; /** * Emit the public `(escapeKeyDown)` output and, unless prevented, close. * Driven by the content's document-level dismissible layer, so the tooltip * responds to Escape regardless of where focus lives — including a * hover-opened tooltip while focus sits on an unrelated element (WCAG 2.1 SC * 1.4.13) — and dismisses topmost-first when layered over a dialog. */ emitEscapeKeyDown(event: KeyboardEvent): void; } declare const FOR_TOOLTIP_CONTEXT: InjectionToken; /** * Headless implementation of the [WAI-ARIA Tooltip pattern](https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/). * * Wrapper directive that owns open / closed state, hover / focus delays, and * placement. Provides the shared context to `ForTooltipTrigger`, * `ForTooltipContent`, and the optional `ForTooltipArrow`. * * Tooltip content is portaled to `document.body` and positioned via * `@floating-ui/dom`. Per APG, content must NOT be interactive — for * interactive popups use a Popover primitive. */ declare class ForTooltip extends AnchoredOverlayPositioningBase implements ForTooltipContext { #private; protected readonly positioningDefaults: forty_cdk_tooltip.ForTooltipDefaults; /** * Two-way bindable. Whether the tooltip is currently shown. The `model()` * change emitter (`(openChange)`) fires only on internal transitions * (hover/focus delays, Escape, and the force-close that runs when `disabled` * flips to true), never on consumer writes through `[(open)]` — observe * state changes without binding back. */ readonly open: _angular_core.ModelSignal; /** * Padding (px) keeping `[forTooltipArrow]` that far from the edges of the * content. Only consulted when an arrow is registered, since floating-ui * installs the `arrow` middleware only then — which is why the input is * declared here rather than on the shared positioning base. The default is * read from `provideForTooltipDefaults` for the surrounding scope, since arrow * geometry is a design-system-wide decision rather than a per-tooltip one. */ readonly arrowPadding: _angular_core.InputSignalWithTransform; /** * Per-tooltip override for the open delay (ms). When `undefined` * (default), falls back to `ForTooltipDefaults.openDelay` from the * surrounding `provideForTooltipDefaults` scope (700ms unless configured). */ readonly openDelay: _angular_core.InputSignal; /** * Per-tooltip override for the close delay (ms) after hover or focus * leaves. `Escape` ignores this. When `undefined` (default), falls back to * `ForTooltipDefaults.closeDelay` from the surrounding * `provideForTooltipDefaults` scope (300ms unless configured). */ readonly closeDelay: _angular_core.InputSignal; /** When true, all hover / focus interaction is ignored and any open tooltip is forced closed. */ readonly disabled: _angular_core.InputSignalWithTransform; /** * Per-tooltip override for whether the tooltip shows only when the * trigger's own text is truncated (`scrollWidth > clientWidth`) — the * common pattern for ellipsized labels where the tooltip adds nothing once * the full text is visible. When `undefined` (default), falls back to * `ForTooltipDefaults.showOnOverflow` from the surrounding * `provideForTooltipDefaults` scope (`false` unless configured). * * The input is aliased to `showOnOverflow`; consumers bind * `[showOnOverflow]="..."` (or the bare attribute) and read the effective * value via the public `showOnOverflow` computed below. */ readonly _showOnOverflowInput: _angular_core.InputSignalWithTransform; /** Effective overflow gate: the `showOnOverflow` input when set, else the scope default. */ readonly showOnOverflow: _angular_core.Signal; /** * Per-tooltip override for whether the pointer may move into the content * without dismissing the tooltip. When `true`, the content drops its * default `pointer-events: none` while open and a pointer-grace "safe * triangle" bridges the gap between trigger and content so a slow diagonal * traversal doesn't close it. When `undefined` (default), falls back to * `ForTooltipDefaults.hoverableContent` from the surrounding * `provideForTooltipDefaults` scope (`true` unless configured). * * Per APG the content must stay non-interactive; this only allows the * pointer to rest over descriptive text (e.g. to select it). * * The input is aliased to `hoverableContent`; consumers bind * `[hoverableContent]="..."` (or the bare attribute) and read the effective * value via the public `hoverableContent` computed below. */ readonly _hoverableContentInput: _angular_core.InputSignalWithTransform; /** Effective hoverable-content flag: the `hoverableContent` input when set, else the scope default. */ readonly hoverableContent: _angular_core.Signal; /** * Fires when the user presses Escape while the tooltip is open, regardless of * where focus currently lives — on the trigger or on an unrelated element (the * common case for a hover-opened tooltip). Routed through the content's * document-level dismissible layer. Call `preventDefault()` on the emitted * veto to keep the tooltip open. The native `KeyboardEvent` is on `.event`. */ readonly escapeKeyDown: _angular_core.OutputEmitterRef>; /** * Whether the user has requested reduced motion via the OS * `prefers-reduced-motion: reduce` media query. Reflected as the boolean * `data-reduced-motion` attribute on the root and content so consumers can * disable their own `animate.enter` / `animate.leave` and CSS transitions * without re-deriving the media query. Tooltip's JS-coordinated timing (the * open / close hover-intent delays) is intent debouncing, not motion, so it * is unchanged under reduced motion. */ readonly reducedMotion: _angular_core.Signal; /** * Id of the trigger element. A consumer-set `id` on the trigger host is * adopted at registration and preserved; the generated * `for-tooltip-trigger-*` id is only assigned when the host has none. */ readonly triggerId: _angular_core.WritableSignal; /** Generated id of the content element, wired to the trigger's `aria-describedby` while open. */ readonly contentId: _angular_core.WritableSignal; readonly trigger: _angular_core.Signal; readonly arrow: _angular_core.Signal; constructor(); /** * Registers the trigger host element. Adopts a pre-existing consumer-set * `id` as the trigger id so external references (anchors, `aria-labelledby`, * label `for`) keep resolving; falls back to the generated id otherwise. */ registerTrigger(el: HTMLElement): void; unregisterTrigger(el: HTMLElement): void; /** Registers the content host element so the hoverable-content grace polygon can measure it. */ registerContent(el: HTMLElement): void; unregisterContent(el: HTMLElement): void; /** Adopts a consumer-set static `id` on the content host into `contentId`. */ adoptContentId(el: HTMLElement): void; registerArrow(el: HTMLElement): void; unregisterArrow(el: HTMLElement): void; pointerEnterTrigger(): void; pointerLeaveTrigger(cursor: Point): void; focusTrigger(): void; blurTrigger(): void; pointerEnterContent(): void; pointerLeaveContent(): void; scheduleOpen(reason: TooltipScheduleReason): void; scheduleClose(reason: TooltipScheduleReason): void; cancelPending(): void; /** * Emit the public `(escapeKeyDown)` output and, unless the consumer calls * `preventDefault()` on the veto, close the tooltip immediately. Driven by the * content's document-level dismissible layer so Escape dismisses the tooltip * regardless of where focus currently lives — including a hover-opened tooltip * with focus on an unrelated element (WCAG 2.1 SC 1.4.13) — and so a tooltip * layered over a dialog is dismissed by the first Escape while the dialog * stays open (topmost layer first). A no-op when nothing is open. */ emitEscapeKeyDown(event: KeyboardEvent): void; /** * Imperatively opens the tooltip — for programmatic control beyond hover and * focus (e.g. a design-system wrapper driving the tooltip from a * text-truncation observer). Schedules the show after the resolved * `openDelay` (instant when the delay is `0` or the scope's skip-delay window * is active) and applies the same gates as a hover / focus open: a no-op * while `disabled`, a no-op under `showOnOverflow` when the trigger's own * text is not truncated, and a no-op while an ancestor is scrolling (the * scroll-dismiss suppression window). For an instant, unconditional open that * bypasses the delay and every gate, write the `[(open)]` model directly * (`open.set(true)`). */ show(): void; /** * Imperatively closes the tooltip, mirroring a hover-leave / blur close: * schedules the hide after the resolved `closeDelay` (instant when the delay * is `0`) and disarms the hoverable-content grace bridge. For an instant * close that ignores `closeDelay`, write the `[(open)]` model directly * (`open.set(false)`). */ hide(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * Element that activates the tooltip on pointer hover or keyboard focus. Apply * on a focusable element — preferably a `