import { NgpOffset, NgpPlacement, NgpFlip, NgpDismissGuard, NgpShift, NgpOverlayArrowState, NgpOverlayArrowProps, NgpOverlayContent, NgpOffsetInput, NgpFlipInput, NgpShiftInput, NgpDismissGuardInput, NgpOverlayFinalFocus, NgpOverlay } from 'ng-primitives/portal'; export { NgpOverlayArrowProps as NgpPopoverArrowProps, NgpOverlayArrowState as NgpPopoverArrowState, injectOverlayContext as injectPopoverContext } from 'ng-primitives/portal'; import * as _angular_core from '@angular/core'; import { Provider, Signal, WritableSignal, ElementRef } from '@angular/core'; import { NumberInput, BooleanInput } from '@angular/cdk/coercion'; import * as ng_primitives_state from 'ng-primitives/state'; import { StateInjectionOptions } from 'ng-primitives/state'; import * as ng_primitives_popover from 'ng-primitives/popover'; import { FocusOrigin } from '@angular/cdk/a11y'; import * as i1 from 'ng-primitives/focus-trap'; interface NgpPopoverConfig { /** * Define the offset of the popover relative to the trigger. * Can be a number (applies to mainAxis) or an object with mainAxis, crossAxis, and alignmentAxis. * @default 4 */ offset: NgpOffset; /** * Define the placement of the popover relative to the trigger. * @default 'bottom' */ placement: NgpPlacement; /** * Define the delay before the popover is shown. * @default 0 */ showDelay: number; /** * Define the delay before the popover is hidden. * @default 0 */ hideDelay: number; /** * Define whether the popover should flip when there is not enough space for the popover. * Can be a boolean to enable/disable, or an object with padding and fallbackPlacements options. * @default true */ flip: NgpFlip; /** * Define the container element or selector in to which the popover should be attached. * @default 'body' */ container: HTMLElement | string | null; /** * Define whether the popover should close when clicking outside of it, or a guard function. * @default true */ closeOnOutsideClick: NgpDismissGuard; /** * Define whether the popover should close when the escape key is pressed, or a guard function. * @default true */ closeOnEscape: NgpDismissGuard; /** * Defines how the popover behaves when the window is scrolled. * @default scroll */ scrollBehavior: 'reposition' | 'block' | 'close'; /** * Whether the popover is modal. While it is open the rest of the page is `inert`, so a pointer * press outside does not reach it: the click that ends the press closes the popover, unless * `closeOnOutsideClick` says not to. A click from the keyboard or from code is left alone. The * trigger, the anchor, exempt elements and overlays opened above the popover stay usable. * @default false */ modal: boolean; /** * Configure shift behavior to keep the popover in view. * Can be a boolean to enable/disable, or an object with padding and limiter options. * @default undefined (enabled by default in overlay) */ shift: NgpShift; /** * Whether to track the trigger element position on every animation frame. * Useful for moving elements like slider thumbs. * @default false */ trackPosition: boolean; /** * Cooldown duration in milliseconds. * When moving from one popover to another within this duration, * the showDelay is skipped for the new popover. * @default 0 */ cooldown: number; /** * When true, hiding the popover removes its content from the DOM but keeps the * underlying component/view instance alive in memory instead of destroying it - a * later show reuses the same instance rather than creating a new one, so the content * is not re-instantiated and any one-time setup (e.g. a network fetch) is not repeated. * The kept-alive view stays attached to change detection while it is hidden. * @default false */ keepMounted: boolean; } /** * Provide the default Popover configuration * @param config The Popover configuration * @returns The provider */ declare function providePopoverConfig(config: Partial): Provider[]; declare class NgpPopoverArrow { /** * Padding between the arrow and the edges of the popover. * This prevents the arrow from overflowing the rounded corners. */ readonly padding: _angular_core.InputSignalWithTransform; private readonly state; /** * Set the padding between the arrow and the edges of the popover. * @param value The padding value in pixels */ setPadding(value: number | undefined): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } declare const NgpPopoverArrowStateToken: _angular_core.InjectionToken<_angular_core.WritableSignal>; declare const ngpPopoverArrow: ({ padding }: NgpOverlayArrowProps) => NgpOverlayArrowState; declare const injectPopoverArrowState: { (): _angular_core.Signal; (options: ng_primitives_state.StateInjectionOptions): _angular_core.Signal; (options?: ng_primitives_state.StateInjectionOptions): _angular_core.Signal | _angular_core.Signal; }; declare const providePopoverArrowState: (opts?: { inherit?: boolean; }) => _angular_core.FactoryProvider; /** * Apply the `ngpPopoverTrigger` directive to an element that triggers the popover to show. */ declare class NgpPopoverTrigger { /** * Access the global popover configuration. */ private readonly config; /** * Access the popover template ref. */ readonly popover: _angular_core.InputSignal | undefined>; /** * Define if the trigger should be disabled. * @default false */ readonly disabled: _angular_core.InputSignalWithTransform; /** * Define the placement of the popover relative to the trigger. * @default 'top' */ readonly placement: _angular_core.InputSignal; /** * Define the offset of the popover relative to the trigger. * Can be a number (applies to mainAxis) or an object with mainAxis, crossAxis, and alignmentAxis. * @default 0 */ readonly offset: _angular_core.InputSignalWithTransform; /** * Define the delay before the popover is displayed. * @default 0 */ readonly showDelay: _angular_core.InputSignalWithTransform; /** * Define the delay before the popover is hidden. * @default 0 */ readonly hideDelay: _angular_core.InputSignalWithTransform; /** * Define whether the popover should flip when there is not enough space for the popover. * Can be a boolean to enable/disable, or an object with padding and fallbackPlacements options. * @default true */ readonly flip: _angular_core.InputSignalWithTransform; /** * Configure shift behavior to keep the popover in view. * Can be a boolean to enable/disable, or an object with padding and limiter options. * @default undefined (enabled by default in overlay) */ readonly shift: _angular_core.InputSignalWithTransform; /** * Define the container in which the popover should be attached. * @default document.body */ readonly container: _angular_core.InputSignal; /** * Define whether the popover should close when clicking outside of it, or a guard function. * @default true */ readonly closeOnOutsideClick: _angular_core.InputSignalWithTransform, NgpDismissGuardInput>; /** * Define whether the popover should close when the escape key is pressed, or a guard function. * @default true */ readonly closeOnEscape: _angular_core.InputSignalWithTransform, NgpDismissGuardInput>; /** * Defines how the popover behaves when the window is scrolled. * @default 'reposition' */ readonly scrollBehavior: _angular_core.InputSignal<"reposition" | "block" | "close">; /** * Whether the popover is modal. While it is open the rest of the page is `inert`, so a pointer * press outside does not reach it: the click that ends the press closes the popover, unless * `closeOnOutsideClick` says not to. A click from the keyboard or from code is left alone. The * trigger, the anchor, exempt elements and overlays opened above the popover stay usable. * Read each time the popover opens. * @default false */ readonly modal: _angular_core.InputSignalWithTransform; /** * Provide context to the popover. This can be used to pass data to the popover content. */ readonly context: _angular_core.InputSignal; /** * Define an anchor element for positioning the popover. * If provided, the popover will be positioned relative to this element instead of the trigger. * * The anchor is live, so rebinding it moves an open popover. * * An input only reaches this directive on the next change detection pass, which a press * can outrun - use `setAnchor()` instead when the anchor is claimed during one. */ readonly anchor: _angular_core.InputSignal; /** * Define whether to track the trigger element position on every animation frame. * Useful for moving elements like slider thumbs. * @default false */ readonly trackPosition: _angular_core.InputSignalWithTransform; /** * Define the cooldown duration in milliseconds. * When moving from one popover to another within this duration, * the showDelay is skipped for the new popover. * @default 0 */ readonly cooldown: _angular_core.InputSignalWithTransform; /** * When true, hiding the popover removes its content from the DOM but keeps the * underlying component/view instance alive in memory instead of destroying it - a * later show reuses the same instance rather than creating a new one, so the content * is not re-instantiated and any one-time setup (e.g. a network fetch) is not repeated. * The kept-alive view stays attached to change detection while it is hidden. * @default false */ readonly keepMounted: _angular_core.InputSignalWithTransform; /** * Event emitted when the popover open state changes. */ readonly openChange: _angular_core.OutputEmitterRef; /** * The popover trigger state. */ protected readonly state: ng_primitives_popover.NgpPopoverTriggerState; /** * Show the popover. * @returns A promise that resolves when the popover has been shown */ show(): Promise; /** * @internal * Hide the popover. * @returns A promise that resolves when the popover has been hidden */ hide(origin?: FocusOrigin): Promise; /** * Set the anchor the popover is positioned against, taking effect immediately rather than * on the next change detection pass. * * Reach for this over `ngpPopoverTriggerAnchor` when the anchor is claimed during a press. * Outside-press dismissal is decided on a capture-phase `mouseup`, which a fast tap can * deliver in the same frame as the `pointerdown` that claimed the anchor - before the * binding has reached this directive, so the press dismisses the popover instead of moving * it. Writing the anchor here is visible to that check straight away. * @param anchor - The new anchor element */ setAnchor(anchor: Element | null): void; static ɵfac: _angular_core.ɵɵFactoryDeclaration, never>; static ɵdir: _angular_core.ɵɵDirectiveDeclaration, "[ngpPopoverTrigger]", ["ngpPopoverTrigger"], { "popover": { "alias": "ngpPopoverTrigger"; "required": false; "isSignal": true; }; "disabled": { "alias": "ngpPopoverTriggerDisabled"; "required": false; "isSignal": true; }; "placement": { "alias": "ngpPopoverTriggerPlacement"; "required": false; "isSignal": true; }; "offset": { "alias": "ngpPopoverTriggerOffset"; "required": false; "isSignal": true; }; "showDelay": { "alias": "ngpPopoverTriggerShowDelay"; "required": false; "isSignal": true; }; "hideDelay": { "alias": "ngpPopoverTriggerHideDelay"; "required": false; "isSignal": true; }; "flip": { "alias": "ngpPopoverTriggerFlip"; "required": false; "isSignal": true; }; "shift": { "alias": "ngpPopoverTriggerShift"; "required": false; "isSignal": true; }; "container": { "alias": "ngpPopoverTriggerContainer"; "required": false; "isSignal": true; }; "closeOnOutsideClick": { "alias": "ngpPopoverTriggerCloseOnOutsideClick"; "required": false; "isSignal": true; }; "closeOnEscape": { "alias": "ngpPopoverTriggerCloseOnEscape"; "required": false; "isSignal": true; }; "scrollBehavior": { "alias": "ngpPopoverTriggerScrollBehavior"; "required": false; "isSignal": true; }; "modal": { "alias": "ngpPopoverTriggerModal"; "required": false; "isSignal": true; }; "context": { "alias": "ngpPopoverTriggerContext"; "required": false; "isSignal": true; }; "anchor": { "alias": "ngpPopoverTriggerAnchor"; "required": false; "isSignal": true; }; "trackPosition": { "alias": "ngpPopoverTriggerTrackPosition"; "required": false; "isSignal": true; }; "cooldown": { "alias": "ngpPopoverTriggerCooldown"; "required": false; "isSignal": true; }; "keepMounted": { "alias": "ngpPopoverTriggerKeepMounted"; "required": false; "isSignal": true; }; }, { "openChange": "ngpPopoverTriggerOpenChange"; }, never, never, true, never>; } /** * Apply the `ngpPopover` directive to an element that represents the popover. This typically would be a `div` inside an `ng-template`. */ declare class NgpPopover { /** * The unique id of the tooltip. */ readonly id: _angular_core.InputSignal; /** * Where focus goes when the popover closes: an element, `false` to leave focus where it is, * `null` or `true` for the default (the element focused when it opened, usually the trigger), * or a function that receives the close origin and returns one of these. * @default null */ readonly finalFocus: _angular_core.InputSignal; protected readonly state: { id: _angular_core.WritableSignal; }; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵdir: _angular_core.ɵɵDirectiveDeclaration; } interface NgpPopoverState { /** The unique id of the tooltip. */ readonly id: Signal; } interface NgpPopoverProps { /** The unique id of the tooltip. */ readonly id?: Signal; /** Where focus goes when the popover closes. */ readonly finalFocus?: Signal; } declare const NgpPopoverStateToken: _angular_core.InjectionToken<_angular_core.WritableSignal<{ id: _angular_core.WritableSignal; }>>; declare const ngpPopover: ({ id: _id, finalFocus, }: NgpPopoverProps) => { id: _angular_core.WritableSignal; }; declare const injectPopoverState: { (): Signal<{ id: _angular_core.WritableSignal; }>; (options: ng_primitives_state.StateInjectionOptions): Signal<{ id: _angular_core.WritableSignal; } | null>; (options?: ng_primitives_state.StateInjectionOptions): Signal<{ id: _angular_core.WritableSignal; }> | Signal<{ id: _angular_core.WritableSignal; } | null>; }; declare const providePopoverState: (opts?: { inherit?: boolean; }) => _angular_core.FactoryProvider; interface NgpPopoverTriggerState { /** Access the trigger element. */ readonly elementRef: ElementRef; /** Access the popover template ref. */ readonly popover: WritableSignal | undefined>; /** * Define if the trigger should be disabled. * @default false */ readonly disabled: WritableSignal; /** * Define the placement of the popover relative to the trigger. * @default 'bottom' */ readonly placement: WritableSignal; /** * Define the offset of the popover relative to the trigger. * Can be a number (applies to mainAxis) or an object with mainAxis, crossAxis, and alignmentAxis. * @default 4 */ readonly offset: WritableSignal; /** * Define the delay before the popover is displayed. * @default 0 */ readonly showDelay: WritableSignal; /** * Define the delay before the popover is hidden. * @default 0 */ readonly hideDelay: WritableSignal; /** * Define whether the popover should flip when there is not enough space for the popover. * Can be a boolean to enable/disable, or an object with padding and fallbackPlacements options. * @default true */ readonly flip: WritableSignal; /** * Configure shift behavior to keep the popover in view. * Can be a boolean to enable/disable, or an object with padding and limiter options. * @default undefined (enabled by default in overlay) */ readonly shift: WritableSignal; /** * Define the container in which the popover should be attached. * @default document.body */ readonly container: WritableSignal; /** * Define whether the popover should close when clicking outside of it, or a guard function. * @default true */ readonly closeOnOutsideClick: WritableSignal>; /** * Define whether the popover should close when the escape key is pressed, or a guard function. * @default true */ readonly closeOnEscape: WritableSignal>; /** * Defines how the popover behaves when the window is scrolled. * @default 'reposition' */ readonly scrollBehavior: WritableSignal<'reposition' | 'block' | 'close'>; /** * Whether the popover is modal. While it is open the rest of the page is `inert`, so a pointer * press outside does not reach it: the click that ends the press closes the popover, unless * `closeOnOutsideClick` says not to. A click from the keyboard or from code is left alone. The * trigger, the anchor, exempt elements and overlays opened above the popover stay usable. * Read each time the popover opens. * @default false */ readonly modal: Signal; /** * Provide context to the popover. This can be used to pass data to the popover content. */ readonly context: WritableSignal; /** * Define an anchor element for positioning the popover. * If provided, the popover will be positioned relative to this element instead of the trigger. */ readonly anchor: WritableSignal; /** * Define whether to track the trigger element position on every animation frame. * Useful for moving elements like slider thumbs. * @default false */ readonly trackPosition: WritableSignal; /** * Define the cooldown duration in milliseconds. * When moving from one popover to another within this duration, * the showDelay is skipped for the new popover. * @default 0 */ readonly cooldown: WritableSignal; /** * When true, hiding the popover removes its content from the DOM but keeps the * underlying component/view instance alive in memory instead of destroying it - a * later show reuses the same instance rather than creating a new one, so the content * is not re-instantiated and any one-time setup (e.g. a network fetch) is not repeated. * The kept-alive view stays attached to change detection while it is hidden. * @default false */ readonly keepMounted: Signal; /** * The overlay that manages the popover * @internal */ readonly overlay: Signal | null>; /** * The open state of the popover. * @internal */ readonly open: Signal; /** Set the popover content. */ setPopover: (popover: NgpOverlayContent | undefined) => void; /** Set whether the trigger is disabled. */ setDisabled: (disabled: boolean) => void; /** Set the placement of the popover relative to the trigger. */ setPlacement: (placement: NgpPlacement) => void; /** Set the offset of the popover relative to the trigger. */ setOffset: (offset: NgpOffset) => void; /** Set the delay before the popover is displayed. */ setShowDelay: (showDelay: number) => void; /** Set the delay before the popover is hidden. */ setHideDelay: (hideDelay: number) => void; /** Set the flip behaviour. */ setFlip: (flip: NgpFlip) => void; /** Set the shift behaviour. */ setShift: (shift: NgpShift) => void; /** Set the container in which the popover should be attached. */ setContainer: (container: HTMLElement | string | null) => void; /** Set whether the popover closes when clicking outside of it, or a guard function. */ setCloseOnOutsideClick: (closeOnOutsideClick: NgpDismissGuard) => void; /** Set whether the popover closes when the escape key is pressed, or a guard function. */ setCloseOnEscape: (closeOnEscape: NgpDismissGuard) => void; /** Set how the popover behaves when the window is scrolled. */ setScrollBehavior: (scrollBehavior: 'reposition' | 'block' | 'close') => void; /** Set whether the popover is modal, from the next time it opens. */ setModal: (modal: boolean) => void; /** Set the context passed to the popover content. */ setContext: (context: T | undefined) => void; /** Set the anchor element the popover is positioned against. */ setAnchor: (anchor: Element | null) => void; /** Set whether the trigger position is tracked on every animation frame. */ setTrackPosition: (trackPosition: boolean) => void; /** Set the cooldown duration in milliseconds. */ setCooldown: (cooldown: number) => void; /** Set whether hiding the popover keeps its content mounted instead of destroying it. */ setKeepMounted: (keepMounted: boolean) => void; /** * Show the popover. * @returns A promise that resolves when the popover has been shown */ show: () => Promise; /** * @internal * Hide the popover. * @returns A promise that resolves when the popover has been hidden */ hide: (origin?: FocusOrigin) => Promise; } interface NgpPopoverTriggerProps { /** Access the popover template ref. */ readonly popover?: Signal | undefined>; /** * Define if the trigger should be disabled. * @default false */ readonly disabled?: Signal; /** * Define the placement of the popover relative to the trigger. * @default 'bottom' */ readonly placement?: Signal; /** * Define the offset of the popover relative to the trigger. * Can be a number (applies to mainAxis) or an object with mainAxis, crossAxis, and alignmentAxis. * @default 4 */ readonly offset?: Signal; /** * Define the delay before the popover is displayed. * @default 0 */ readonly showDelay?: Signal; /** * Define the delay before the popover is hidden. * @default 0 */ readonly hideDelay?: Signal; /** * Define whether the popover should flip when there is not enough space for the popover. * Can be a boolean to enable/disable, or an object with padding and fallbackPlacements options. * @default true */ readonly flip?: Signal; /** * Configure shift behavior to keep the popover in view. * Can be a boolean to enable/disable, or an object with padding and limiter options. * @default undefined (enabled by default in overlay) */ readonly shift?: Signal; /** * Define the container in which the popover should be attached. * @default document.body */ readonly container?: Signal; /** * Define whether the popover should close when clicking outside of it, or a guard function. * @default true */ readonly closeOnOutsideClick?: Signal>; /** * Define whether the popover should close when the escape key is pressed, or a guard function. * @default true */ readonly closeOnEscape?: Signal>; /** * Defines how the popover behaves when the window is scrolled. * @default 'reposition' */ readonly scrollBehavior?: Signal<'reposition' | 'block' | 'close'>; /** * Whether the popover is modal. While it is open the rest of the page is `inert`, so a pointer * press outside does not reach it: the click that ends the press closes the popover, unless * `closeOnOutsideClick` says not to. A click from the keyboard or from code is left alone. The * trigger, the anchor, exempt elements and overlays opened above the popover stay usable. * Read each time the popover opens. * @default false */ readonly modal?: Signal; /** * Provide context to the popover. This can be used to pass data to the popover content. */ readonly context?: Signal; /** * Define an anchor element for positioning the popover. * If provided, the popover will be positioned relative to this element instead of the trigger. */ readonly anchor?: Signal; /** * Define whether to track the trigger element position on every animation frame. * Useful for moving elements like slider thumbs. * @default false */ readonly trackPosition?: Signal; /** * Define the cooldown duration in milliseconds. * When moving from one popover to another within this duration, * the showDelay is skipped for the new popover. * @default 0 */ readonly cooldown?: Signal; /** * When true, hiding the popover removes its content from the DOM but keeps the * underlying component/view instance alive in memory instead of destroying it - a * later show reuses the same instance rather than creating a new one, so the content * is not re-instantiated and any one-time setup (e.g. a network fetch) is not repeated. * The kept-alive view stays attached to change detection while it is hidden. * @default false */ readonly keepMounted?: Signal; /** Callback fired when the open state changes. */ readonly onOpenChange?: (value: boolean) => void; } declare const NgpPopoverTriggerStateToken: _angular_core.InjectionToken>>; declare const ngpPopoverTrigger: ({ popover: _popover, disabled: _disabled, placement: _placement, offset: _offset, showDelay: _showDelay, hideDelay: _hideDelay, flip: _flip, shift: _shift, container: _container, closeOnOutsideClick: _closeOnOutsideClick, closeOnEscape: _closeOnEscape, scrollBehavior: _scrollBehavior, modal: _modal, context: _context, anchor: _anchor, trackPosition: _trackPosition, cooldown: _cooldown, keepMounted: _keepMounted, onOpenChange, }: NgpPopoverTriggerProps) => NgpPopoverTriggerState; declare const providePopoverTriggerState: (opts?: { inherit?: boolean; }) => _angular_core.FactoryProvider; declare function injectPopoverTriggerState(options?: StateInjectionOptions): Signal>; /** * Where the popover is placed relative to its trigger. * @deprecated Identical to `NgpPlacement` from `ng-primitives/portal` - use that instead. * Will be removed in a future major. */ type NgpPopoverPlacement = NgpPlacement; export { NgpPopover, NgpPopoverArrow, NgpPopoverArrowStateToken, NgpPopoverStateToken, NgpPopoverTrigger, NgpPopoverTriggerStateToken, injectPopoverArrowState, injectPopoverState, injectPopoverTriggerState, ngpPopover, ngpPopoverArrow, ngpPopoverTrigger, providePopoverArrowState, providePopoverConfig, providePopoverState, providePopoverTriggerState }; export type { NgpPopoverConfig, NgpPopoverPlacement, NgpPopoverProps, NgpPopoverState, NgpPopoverTriggerProps, NgpPopoverTriggerState };