import { ComponentType } from '@angular/cdk/portal'; import { ConfigurableFocusTrap } from '@angular/cdk/a11y'; import { OverlayRef } from '@angular/cdk/overlay'; import * as i0 from '@angular/core'; import { ComponentRef, InjectionToken, ElementRef } from '@angular/core'; import { Subject } from 'rxjs'; /** * @license * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE */ /** * Handle returned by `WrDialog.open()`. * * Wraps the underlying `OverlayRef` and tracks the close result. * * @example * ```ts * const ref = dialog.open(ConfirmComponent); * const result = await ref.awaitClose(); // boolean | undefined * ``` */ declare class WrDialogRef { private readonly _overlayRef; /** Emits the close result once and completes. */ readonly closed: Subject; /** @internal */ componentRef: ComponentRef | null; /** @internal */ focusTrap: ConfigurableFocusTrap | null; /** @internal */ previouslyFocused: HTMLElement | null; constructor(_overlayRef: OverlayRef); /** The instantiated dialog component. */ get componentInstance(): C; /** Close the dialog, optionally returning a result. */ close(result?: R): void; /** Resolves with the close result when the dialog is dismissed. */ awaitClose(): Promise; /** Underlying overlay ref — escape hatch for advanced cases. */ get overlayRef(): OverlayRef; } /** * @license * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE */ /** * Options accepted by `WrDialog.open()`. */ interface WrDialogOptions { /** Data payload exposed to the dialog content via `WR_DIALOG_DATA`. */ readonly data?: D; /** When `true`, clicks on the backdrop close the dialog. @default true */ readonly closeOnBackdropClick?: boolean; /** When `true`, the Escape key closes the dialog. @default true */ readonly closeOnEscape?: boolean; /** Width applied to the panel — any valid CSS length. */ readonly width?: string; /** Maximum width applied to the panel. */ readonly maxWidth?: string; /** Extra CSS class(es) added to the panel. */ readonly panelClass?: string | readonly string[]; /** * Present as a full-width bottom-sheet on small viewports instead of a * centred modal. `undefined` follows the app-wide * `provideWrResponsiveOverlays()` setting; `true`/`false` overrides it. */ readonly responsive?: boolean; } /** * Opens dialog components in an isolated NGWR overlay. * * Uses `WR_OVERLAY` so it composes cleanly with `provideWrOverlay()` * — dialogs render into NGWR's own overlay container and never collide * with other CDK consumers (Material, NG-ZORRO, etc.). * * @example * ```ts * const dialog = inject(WrDialog); * * const ref = dialog.open(ConfirmComponent, { * data: { message: 'Delete this item?' }, * width: '24rem', * }); * * const ok = await ref.awaitClose(); * if (ok) remove(); * ``` * * @see https://ngwr.dev/components/dialog */ declare class WrDialog { private readonly overlay; private readonly scrollStrategies; private readonly parentInjector; private readonly focusTrapFactory; private readonly isBrowser; private readonly responsiveConfig; open(component: ComponentType, options?: WrDialogOptions): WrDialogRef; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * @license * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE */ /** * Token that exposes the `data` payload passed to `WrDialog.open()`. * * @example * ```ts * @Component({...}) * export class ConfirmComponent { * readonly data = inject(WR_DIALOG_DATA); * } * ``` */ declare const WR_DIALOG_DATA: InjectionToken; /** * @license * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE */ /** * Styles a dialog title row. Use on a heading inside an opened dialog. * Auto-assigns an `id` so the dialog panel can reference it via * `aria-labelledby`. * * @example * ```html *

Confirm delete

* ``` */ declare class WrDialogTitle { /** Generated id used for `aria-labelledby` wiring. */ readonly id: string; /** @internal */ readonly elementRef: ElementRef; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * Styles the scrollable body section of a dialog. * * @example * ```html *
…body…
* ``` */ declare class WrDialogContent { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * Footer row, typically holding action buttons. * * @example * ```html *
* Cancel * Delete *
* ``` */ declare class WrDialogFooter { /** * Horizontal alignment of the children. * * @default 'end' */ readonly align: i0.InputSignal<"center" | "start" | "end">; protected readonly classes: i0.Signal; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * Closes the dialog when the host element is clicked. * * Optionally passes a `[wrDialogClose]` value as the close result. * * @example * ```html * Cancel * Confirm * ``` */ declare class WrDialogClose { /** * Value to pass to `close()`. When unset, the dialog closes with * `undefined`. */ readonly result: i0.InputSignal; private readonly ref; protected onClick(): void; static ɵfac: i0.ɵɵFactoryDeclaration, never>; static ɵdir: i0.ɵɵDirectiveDeclaration, "[wrDialogClose]", never, { "result": { "alias": "wrDialogClose"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>; } export { WR_DIALOG_DATA, WrDialog, WrDialogClose, WrDialogContent, WrDialogFooter, WrDialogRef, WrDialogTitle }; export type { WrDialogOptions };