import * as _angular_core from '@angular/core'; import { TemplateRef, Provider, FactoryProvider } from '@angular/core'; import { NumberInput } from '@angular/cdk/coercion'; import { ConnectedPosition } from '@angular/cdk/overlay'; import { BrnClassValue } from '@spartan-ng/brain/core'; type BrnTooltipPosition = 'top' | 'bottom' | 'left' | 'right'; /** Fallback order for each preferred position when it doesn't fit in the viewport. */ declare const BRN_TOOLTIP_FALLBACK_POSITIONS: Record; /** Map a resolved CDK ConnectedPosition back to a BrnTooltipPosition, or null if no match. */ declare function resolveTooltipPosition(pair: ConnectedPosition): BrnTooltipPosition | null; type BrnTooltipType = string | TemplateRef | null; declare class BrnTooltip { private readonly _config; private readonly _destroyRef; private readonly _document; private readonly _elementRef; private readonly _injector; private readonly _overlay; private readonly _overlayPositionBuilder; private readonly _renderer; private readonly _dir; private readonly _group; private _tooltipHovered; private _listenersRefs; private _delaySubject; private _componentRef; private _overlayRef; private _ariaEffectRef; private _positionChangeSub; /** Bumped on every close/show so a pending exit-animation teardown can detect it was superseded. */ private _closeGeneration; /** The position currently applied to the content - the CDK-resolved one after a flip, not the raw input. */ private _activePosition; readonly tooltipDisabled: _angular_core.InputSignalWithTransform; readonly mutableTooltipDisabled: _angular_core.WritableSignal; readonly position: _angular_core.InputSignal; readonly brnTooltip: _angular_core.InputSignal; readonly showDelay: _angular_core.InputSignalWithTransform; readonly hideDelay: _angular_core.InputSignalWithTransform; readonly sideOffset: _angular_core.InputSignalWithTransform; readonly show: _angular_core.OutputEmitterRef; readonly hide: _angular_core.OutputEmitterRef; private readonly _tooltipText; constructor(); /** * The `OverlayRef` (and its pane element in the CDK overlay container) is created lazily, on first * show, rather than eagerly for every `brnTooltip` instance. With hundreds/thousands of tooltips on a * page, most are never hovered/focused in a given session, so eagerly creating an overlay per * instance needlessly bloats the shared overlay container with empty panes. Deferring creation until * a tooltip is actually about to be shown keeps the container's DOM footprint proportional to the * tooltips a user actually triggers. * * Only listeners that require the overlay's host element (hover-tracking on the tooltip content * itself) belong here. Anything that must work before the overlay exists - e.g. Escape dismissing a * tooltip mid show-delay - is registered eagerly in the constructor instead. */ private _ensureOverlayRef; private _dismiss; /** Rebuild the positions from the current inputs and re-apply them to the overlay, if one exists. */ private _refreshOverlayPosition; private _updatePosition; private _buildPositionStrategy; /** Build [preferred, ...fallbacks] position array for viewport-aware auto-flip. */ private _getAllPositions; private _getAdjustedPositionFor; /** * Corrects overlay placement for the layout-vs-visual viewport mismatch on mobile browsers. * * Tooltips only open on hover/focus, but a hovering pen (e.g. Apple Pencil on iOS Safari) can open * one on a phone/tablet where this bites: as the browser's toolbars collapse the visual viewport * grows, yet `documentElement.clientHeight`/`clientWidth` stay frozen at the toolbar-expanded size. * CDK anchors bottom/right overlays from those stale dimensions (top/left overlays measure from the * pinned top-left edge and are unaffected), so a `position: 'top'` tooltip lands shifted by the delta. * * We fold that delta back in as an offset. It is 0 whenever the viewports match (desktop, or toolbar * expanded), so this is a no-op everywhere except the collapsed-toolbar case it targets. */ private _getVisualViewportCompensation; private _initTriggers; /** * Tooltips are supplementary labels for a trigger that already has its own action, so - like Radix * and Base UI - they open only on mouse/pen hover and keyboard focus, never on touch (a touch tap * would both fire the trigger's action and the tooltip). Touch pointers are ignored via * `_isHoverPointer`; use a popover when touch users need to see the content. */ private _initHoverListeners; private _isHoverPointer; /** Snapshot the group skip decision once, so the delay and the instant-open state agree even if a * sibling flips the window during the show delay. */ private _requestShow; private _initScrollListener; private _cleanupTriggerEvents; private delay; private _setupDelayMechanism; private _show; /** Apply text + position (and the position-derived classes) to the content, recording the position as * active. Pass `text = null` for a position-only update that keeps the content's existing text. */ private _applyContentProps; private _hide; /** * Keep the content mounted until its `data-[state=closed]` exit animation finishes, then tear it * down. A re-show (revive) bumps `_closeGeneration`, which cancels the pending detach. */ private _scheduleDetach; private _detach; private _clearAriaDescribedBy; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } declare class BrnTooltipContent { readonly id: _angular_core.InputSignal; readonly state: _angular_core.WritableSignal<"closed" | "open" | "instant-open">; protected readonly _tooltipClass: _angular_core.WritableSignal; protected readonly _arrowClass: _angular_core.WritableSignal; protected readonly _svgClass: _angular_core.WritableSignal; protected readonly _position: _angular_core.WritableSignal; protected readonly _tooltipText: _angular_core.WritableSignal; setProps(tooltipText: BrnTooltipType, position: BrnTooltipPosition, tooltipClasses: BrnClassValue, arrowClasses: BrnClassValue, svgClasses: BrnClassValue): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } interface BrnTooltipGroupOptions { /** Time (ms) after the last tooltip closes during which others open instantly. `0` disables it. */ skipDelayDuration: number; } /** Skip-delay coordinator for grouped tooltips; provide via `provideBrnTooltipGroup` on the wrapper. */ declare class BrnTooltipGroup { private readonly _options; private readonly _skipDelay; /** Whether the next tooltip waits for its show delay, or opens instantly within the skip window. */ readonly isOpenDelayed: _angular_core.Signal; onOpen(): void; onClose(): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵprov: _angular_core.ɵɵInjectableDeclaration; } declare function provideBrnTooltipGroup(options?: Partial): Provider[]; interface BrnTooltipOptions { /** Default delay when the tooltip is shown. */ showDelay: number; /** Default delay when the tooltip is hidden. */ hideDelay: number; /** Default distance in px between the tooltip and its trigger. */ sideOffset?: number; /** Default position for tooltips. */ position?: BrnTooltipPosition; /** Additional classes for the SVG element in the tooltip arrow. */ svgClasses: BrnClassValue; /** Additional classes for the tooltip arrow element based on position. */ arrowClasses: (position: BrnTooltipPosition) => BrnClassValue; /** Additional classes for the tooltip content element. */ tooltipContentClasses: BrnClassValue; } declare const defaultOptions: BrnTooltipOptions; /** * Provides tooltip options on top of the ones already provided above this injector (a parent * component, or the application config), so a nested provider such as `HlmTooltip`'s only * overrides the options it sets. */ declare function provideBrnTooltipDefaultOptions(options: Partial): FactoryProvider; declare function injectBrnTooltipDefaultOptions(): BrnTooltipOptions; declare const BrnTooltipImports: readonly [typeof BrnTooltip, typeof BrnTooltipContent]; export { BRN_TOOLTIP_FALLBACK_POSITIONS, BrnTooltip, BrnTooltipContent, BrnTooltipGroup, BrnTooltipImports, defaultOptions, injectBrnTooltipDefaultOptions, provideBrnTooltipDefaultOptions, provideBrnTooltipGroup, resolveTooltipPosition }; export type { BrnTooltipGroupOptions, BrnTooltipOptions, BrnTooltipPosition, BrnTooltipType };