import * as _angular_core from '@angular/core'; import { InjectionToken, Signal, Provider } from '@angular/core'; import * as forty_cdk_hover_card from 'forty-cdk/hover-card'; import { VetoableNativeEvent } from 'forty-cdk/core'; import { AnchoredPositioningContext, Point, AnchoredOverlayPositioningBase, AnchoredPositioningSeedDefaults, FloatingSide, FloatingAlign } from 'forty-cdk/core-overlay'; /** Why an open / close was scheduled. */ type HoverCardScheduleReason = 'hover-trigger' | 'hover-content' | 'focus' | 'escape'; /** * Read surface `[forHoverCard]` publishes through {@link FOR_HOVER_CARD_CONTEXT}, * including the shared anchored-positioning members. */ interface ForHoverCardContext extends AnchoredPositioningContext { readonly open: Signal; readonly disabled: Signal; /** Whether `prefers-reduced-motion: reduce` is active — reflected as `data-reduced-motion`. */ readonly reducedMotion: Signal; readonly trigger: Signal; readonly content: Signal; registerTrigger(el: HTMLElement): void; unregisterTrigger(el: HTMLElement): void; registerArrow(el: HTMLElement): void; unregisterArrow(el: HTMLElement): void; registerContent(el: HTMLElement): void; unregisterContent(el: HTMLElement): void; /** The pointer entered the trigger; opens after the resolved open delay. */ pointerEnterTrigger(): void; /** The pointer left the trigger; closes, or arms the pointer-grace bridge from `cursor`. */ pointerLeaveTrigger(cursor: Point): void; /** The trigger received keyboard focus; opens after the resolved open delay. */ focusTrigger(): void; /** The trigger lost focus; closes when nothing else keeps the card alive. */ blurTrigger(): void; /** The pointer entered the content; holds the card open. */ pointerEnterContent(): void; /** The pointer left the content; closes when nothing else keeps it alive. */ pointerLeaveContent(): void; /** * Schedule the card to open after `openDelay` ms (instant when delay is 0). * Hover-driven opens (`'hover-trigger'` / `'hover-content'`) are suppressed * while an ancestor scroll container is moving content under a stationary * cursor, so rows sliding past the pointer can't flicker cards open; the * `'focus'` path is never suppressed. */ scheduleOpen(reason: HoverCardScheduleReason): void; /** Schedule the card to close after `closeDelay` ms (instant on `escape`). */ scheduleClose(reason: HoverCardScheduleReason): 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 card * responds to Escape regardless of where focus lives — including a card * opened by hover while focus sits on an unrelated element. */ emitEscapeKeyDown(event: KeyboardEvent): void; } declare const FOR_HOVER_CARD_CONTEXT: InjectionToken; /** * Headless hover-preview card. Use it to surface rich, interactive previews * (profile snapshots, link previews, definition cards) on hover or focus * of an already-meaningful trigger (a link, a name). * * **Not a tooltip.** Hover-cards may contain interactive content * (clickable links, copy buttons, …); the trigger must convey full meaning * on its own so keyboard-only users miss nothing. * * Open / close delays default to 700 / 300 ms; the per-injector-scope * `provideForHoverCardDefaults` configures the cadence and the skip-delay * window for adjacent cards. * * @example * ```html * * Ada Lovelace * @if (card.open()) { *
* *

Ada Lovelace

*

Mathematician.

*
* } *
* ``` */ declare class ForHoverCard extends AnchoredOverlayPositioningBase implements ForHoverCardContext { #private; protected readonly positioningDefaults: forty_cdk_hover_card.ForHoverCardDefaults; /** * Two-way bindable. Whether the card is currently shown. The `model()` * change emitter (`(openChange)`) fires only on internal transitions * (delay-driven, escape, blur, and the force-close that runs when `disabled` * flips to true), never on consumer writes through `[(open)]`. */ readonly open: _angular_core.ModelSignal; /** * Padding (px) keeping `[forHoverCardArrow]` 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 `provideForHoverCardDefaults` for the surrounding scope, since * arrow geometry is a design-system-wide decision rather than a per-card one. */ readonly arrowPadding: _angular_core.InputSignalWithTransform; /** Per-card override for open delay (ms). Falls back to coordinator (700ms). */ readonly openDelay: _angular_core.InputSignal; /** Per-card override for close delay (ms). Falls back to coordinator (300ms). */ readonly closeDelay: _angular_core.InputSignal; /** When true, all hover / focus interaction is ignored and any open card is forced closed. */ readonly disabled: _angular_core.InputSignalWithTransform; /** * Fires when the user presses Escape while the card is open, regardless of * where focus currently lives — on the trigger, inside the portaled * content, or on an unrelated element (the common case for a card opened by * hover). Routed through the content's document-level dismissible layer. * Call `preventDefault()` on the emitted veto to suppress the automatic * close. 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. The card'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; readonly trigger: _angular_core.Signal; readonly arrow: _angular_core.Signal; readonly content: _angular_core.Signal; constructor(); registerTrigger(el: HTMLElement): void; unregisterTrigger(el: HTMLElement): void; registerArrow(el: HTMLElement): void; unregisterArrow(el: HTMLElement): void; registerContent(el: HTMLElement): void; unregisterContent(el: HTMLElement): void; pointerEnterTrigger(): void; pointerLeaveTrigger(cursor: Point): void; focusTrigger(): void; blurTrigger(): void; pointerEnterContent(): void; pointerLeaveContent(): void; scheduleOpen(reason: HoverCardScheduleReason): void; scheduleClose(reason: HoverCardScheduleReason): void; cancelPending(): void; /** * Emit `(escapeKeyDown)` and, unless the consumer calls `preventDefault()` * on the veto, close immediately. Driven by the content's document-level * dismissible layer so Escape works no matter where focus currently lives * — including a hover-opened card with focus on an unrelated element. */ emitEscapeKeyDown(event: KeyboardEvent): void; /** * Imperatively opens the card — for programmatic control beyond hover and * focus (e.g. a design-system wrapper opening the card from an external * event). 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 open: a no-op while `disabled`, 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 card, mirroring a hover-leave / blur close: * schedules the hide after the resolved `closeDelay` (instant when the delay * is `0`) and disarms the pointer-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 hover-card on hover or focus. Apply on a link, * a button, or any focusable element that already conveys the underlying * action (the card adds preview, not meaning). * * Reflects `data-state` so consumers can style the trigger when its card is * open (e.g. an underline that turns solid). * * A touch tap does not open the card: a `pointerenter` rejected by the shared * `isNonTouchPointer` predicate is ignored (a pen still hovers), and the focus * that a tap induces is ignored too — only keyboard focus (focus not preceded * by a pointer interaction) opens the card. Because the trigger must already convey full * meaning on its own, touch / keyboard-only users miss nothing when the * preview stays closed, and keyboard focus is the touch-accessible way to * reveal it. This mirrors `ForTooltipTrigger`. * * **Intentional ARIA exception.** The trigger exposes no `aria-controls`, * `aria-expanded`, or `aria-describedby`, and `[forHoverCardContent]` carries * no role. This is deliberate: the trigger must already be * self-meaningful (a link or button that conveys the underlying action on its * own — the card adds preview, not meaning), and the card is non-essential * supplementary content that is hover/focus-revealed and not part of the * accessibility relationship. Popover / Tooltip, whose content is meant to be * discovered via the trigger, do wire trigger ARIA — HoverCard intentionally * does not. * * Escape dismissal is owned by the content's document-level dismissible * layer (see `ForHoverCardContent`), so it works from the trigger and from * unrelated focus alike — the trigger carries no Escape listener of its own. * * The root is normally resolved via DI from the enclosing `[forHoverCard]`. * When the trigger is declared inside an `ng-template` stamped into the root * (e.g. via `ngTemplateOutlet`), DI resolves at the template's declaration * site and misses the root — pass it explicitly through the selector input, * `routerLink`-style: `[forHoverCardTrigger]="root"` with `#root="forHoverCard"`. */ declare class ForHoverCardTrigger { #private; /** * Optional explicit reference to the `[forHoverCard]` root, named after the * selector `routerLink`-style. The bare valueless attribute keeps resolving * the enclosing root via DI; pass the root explicitly * (`[forHoverCardTrigger]="root"`, with `#root="forHoverCard"`) when the * trigger is declared in an `ng-template` stamped inside the root — DI * resolves at the template's declaration site, so the enclosing root is * invisible there. The empty string (what the valueless attribute yields) * is treated as unset. */ readonly forHoverCardTrigger: _angular_core.InputSignal<"" | ForHoverCardContext>; protected readonly ctx: _angular_core.Signal; constructor(); protected onPointerEnter(event: PointerEvent): void; protected onPointerDown(event: PointerEvent): void; protected onPointerLeave(event: PointerEvent): void; protected onFocus(): void; protected onBlur(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * The hover-card surface. Portaled to `document.body` and positioned by * floating-ui. Pointer-enter * on the content cancels the pending close, so the user can move the * cursor from the trigger into the card to interact with its content * (links, buttons, copy targets). * * Mount / unmount via `@if (card.open())` on the consumer side so * `animate.enter` / `animate.leave` work natively. * * Escape is handled at the document level (outside dismissal stays * implicit, via pointer-leave timing), so it dismisses the card no matter * where focus lives when the * card was hover-opened. Initial-focus and return-focus bundles are * omitted because the surface is informational and never steals focus. * * **Intentional ARIA exception.** The content carries no role (only * `data-state` for styling) and the trigger exposes no ARIA linkage — the * card is non-essential supplementary content. See * `ForHoverCardTrigger` for the full rationale. */ declare class ForHoverCardContent { protected readonly ctx: forty_cdk_hover_card.ForHoverCardContext; constructor(); protected onPointerEnter(): void; protected onPointerLeave(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * Arrow pointing from the card back to its trigger. Floating-ui places it * along the right edge so the consumer only has to give it a size and a * background — no positioning math required. */ declare class ForHoverCardArrow { #private; constructor(); static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } /** * Defaults inherited by descendant hover-cards in the surrounding injector * scope. Configure with `provideForHoverCardDefaults` at the app root or in * any component's `providers`. */ interface ForHoverCardDefaults extends AnchoredPositioningSeedDefaults { /** Open delay (ms) for cards that don't override `openDelay` locally. */ openDelay: number; /** Close delay (ms) for cards that don't override `closeDelay` locally. */ closeDelay: number; /** * Window (ms) after a peer card in this scope closes during which the * next open is instant — useful for adjacent profile cards in a list, * so cursor movement doesn't feel sluggish. */ skipDelayDuration: number; /** * Side the card is anchored to for cards that don't override `side` * locally. Library fallback `'top'`. */ side: FloatingSide; /** * Alignment along the chosen `side` for cards that don't override `align` * locally. Library fallback `'center'`. */ align: FloatingAlign; /** * Gap (px) between trigger and card along the main axis for cards that * don't override `sideOffset` locally. * Library fallback `8`. */ sideOffset: number; /** * Padding (px) applied uniformly to the `flip`, `shift`, and `size` * middlewares for cards that don't override `collisionPadding` locally. * Library fallback `8`. */ collisionPadding: number; /** * Padding (px) keeping the `[forHoverCardArrow]` element that far from the * edges of the content, for cards that don't override `arrowPadding` * locally. Only consulted when an arrow is registered — floating-ui installs * the `arrow` middleware only then. Library fallback `0`. */ arrowPadding: number; } /** Token holding the resolved hover-card defaults for the current scope. */ declare const FOR_HOVER_CARD_DEFAULTS: _angular_core.InjectionToken; /** * Configures forty-cdk hover-card defaults for this injector scope. * Partial overrides inherit unspecified keys from the parent scope (or * library defaults at the root). Each call establishes a new coordinator * scope. */ declare function provideForHoverCardDefaults(defaults?: Partial): Provider[]; export { FOR_HOVER_CARD_CONTEXT, FOR_HOVER_CARD_DEFAULTS, ForHoverCard, ForHoverCardArrow, ForHoverCardContent, ForHoverCardTrigger, provideForHoverCardDefaults }; export type { ForHoverCardContext, ForHoverCardDefaults, HoverCardScheduleReason };