import { Observable } from 'rxjs'; import { OverlayRef, PositionStrategy, ScrollStrategy } from '@angular/cdk/overlay'; import * as i0 from '@angular/core'; import { Injector, ViewContainerRef, StaticProvider, TemplateRef, OnInit, WritableSignal, InputSignal, InjectionToken, Provider } from '@angular/core'; import { ComponentType } from '@angular/cdk/portal'; import { VariantProps } from 'class-variance-authority'; /** * Reference to an open dialog instance. * Returned by `ComDialog.open()` for programmatic control. */ declare class ComDialogRef { private readonly afterClosedSubject; private readonly backdropClickSubject; private closed; /** @internal */ _overlayRef: OverlayRef | null; /** @internal */ _closeFn: ((result?: R) => void) | null; /** * Close the dialog, optionally passing a result value. */ close(result?: R): void; /** * Emits the result once after the dialog is fully closed and disposed. */ afterClosed(): Observable; /** * Emits each time the backdrop is clicked. */ backdropClick(): Observable; /** * Proxies keydown events from the overlay. */ keydownEvents(): Observable; /** @internal Called by the service after exit animation completes. */ _notifyClosed(result?: R): void; /** @internal Forward backdrop click from overlay. */ _notifyBackdropClick(event: MouseEvent): void; } /** Available dialog size variants. */ type ComDialogSize = 'sm' | 'md' | 'lg' | 'xl' | 'full'; /** ARIA role for the dialog panel. */ type ComDialogRole = 'dialog' | 'alertdialog'; /** Where to restore focus after the dialog closes. */ type ComRestoreFocusTarget = boolean | string | HTMLElement; /** Configuration for opening a dialog. */ interface ComDialogConfig { /** Data to inject via COM_DIALOG_DATA. */ data?: D; /** Dialog panel width variant. */ size?: ComDialogSize; /** Prevent Escape and backdrop click from closing. */ disableClose?: boolean; /** Show backdrop overlay. */ hasBackdrop?: boolean; /** Additional CSS class(es) on the backdrop. */ backdropClass?: string | string[]; /** Additional CSS class(es) on the container panel. */ panelClass?: string | string[]; /** Where to send focus on open. */ autoFocus?: 'first-tabbable' | 'dialog' | false; /** * Controls focus restoration after the dialog closes. * - `true`: restore focus to the previously focused element (default). * - `false`: do not restore focus. * - `string`: CSS selector — the first matching element receives focus. * - `HTMLElement`: the specific element receives focus. */ restoreFocus?: ComRestoreFocusTarget; /** Fallback aria-label if no comDialogTitle is projected. */ ariaLabel?: string; /** ARIA role on the dialog panel. Use `'alertdialog'` for confirmations/destructive actions. */ role?: ComDialogRole; /** * Custom parent injector for dialog content. * Takes precedence over `viewContainerRef` injector. */ injector?: Injector; /** * Determines logical Angular tree placement for DI resolution. * Its injector is used as parent when `injector` is not set. */ viewContainerRef?: ViewContainerRef; /** Additional providers injected into the dialog content's injector. */ providers?: StaticProvider[]; /** Custom CDK position strategy. Defaults to globally centered. */ positionStrategy?: PositionStrategy; /** Custom CDK scroll strategy. Defaults to block scroll. */ scrollStrategy?: ScrollStrategy; /** Explicit CSS width on the panel (e.g. `'600px'`, `'80vw'`). Overrides size variant width. */ width?: string; /** Explicit CSS height on the panel. */ height?: string; /** CSS min-width on the panel. Numbers are treated as pixels. */ minWidth?: string | number; /** CSS min-height on the panel. Numbers are treated as pixels. */ minHeight?: string | number; /** CSS max-width on the panel. Numbers are treated as pixels. Overrides size variant max-width. */ maxWidth?: string | number; /** CSS max-height on the panel. Numbers are treated as pixels. Overrides size variant max-height. */ maxHeight?: string | number; } /** Content that can be opened in a dialog. */ type ComDialogContent$1 = ComponentType | TemplateRef; /** Template context when opening a TemplateRef dialog. */ interface ComDialogTemplateContext { $implicit: ComDialogRef; data: D; } /** * Service for opening dialog modals imperatively. * * @example * ```typescript * const dialog = inject(ComDialog); * * // Open a component * const ref = dialog.open(ConfirmComponent, { data: { id: 123 } }); * ref.afterClosed().subscribe(result => { * if (result) performAction(); * }); * * // Open a template * dialog.open(templateRef, { size: 'sm' }); * ``` */ declare class ComDialog { private readonly overlay; private readonly injector; private readonly platformId; private readonly document; private readonly globalConfig; private readonly openDialogs; /** * Open a dialog with the given component or template. * * @param content - The component class or TemplateRef to render inside the dialog. * @param config - Optional dialog configuration. * @returns A reference to the opened dialog. */ open(content: ComDialogContent$1, config?: ComDialogConfig): ComDialogRef; /** Close all open dialogs. */ closeAll(): void; /** Number of currently open dialogs. */ get openDialogCount(): number; private resolveConfig; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Marks an element as the dialog title. Sets up aria-labelledby * binding on the dialog container. * * @example * ```html *

Delete item

* ``` * * @tokens `--color-foreground` */ declare class ComDialogTitle implements OnInit { private readonly containerRef; /** Unique ID for aria-labelledby binding. */ readonly id: WritableSignal; /** Computed CSS classes. */ readonly classes: WritableSignal; ngOnInit(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * Marks an element as the dialog content area. Sets up aria-describedby * binding on the dialog container. * * @example * ```html *
*

Are you sure you want to delete this item?

*
* ``` * * @tokens `--color-muted-foreground` */ declare class ComDialogContent implements OnInit { private readonly containerRef; /** Unique ID for aria-describedby binding. */ readonly id: WritableSignal; /** Computed CSS classes. */ readonly classes: WritableSignal; ngOnInit(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * Marks an element as the dialog actions area (footer with buttons). * * @tokens none * * @example * ```html *
* * *
* ``` */ declare class ComDialogActions { /** Computed CSS classes. */ readonly classes: WritableSignal; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * Closes the nearest dialog when the host element is clicked. * Optionally passes a result value. * * @tokens none * * @example * ```html * * * ``` */ declare class ComDialogClose { private readonly dialogRef; /** The result value to pass when closing the dialog. */ readonly comDialogClose: InputSignal; protected onClick(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * Injection token for data passed to a dialog component. * * @example * ```typescript * readonly data = inject(COM_DIALOG_DATA); * ``` */ declare const COM_DIALOG_DATA: InjectionToken; /** * Injection token for global dialog configuration defaults. * @internal */ declare const COM_DIALOG_CONFIG: InjectionToken; /** * Provides global dialog configuration defaults. * * @example * ```typescript * bootstrapApplication(AppComponent, { * providers: [ * provideComDialogConfig({ size: 'lg', hasBackdrop: true }), * ], * }); * ``` */ declare function provideComDialogConfig(config: ComDialogConfig): Provider; /** * CVA variants for the dialog backdrop. * * @tokens `--color-backdrop` */ declare const dialogBackdropVariants: (props?: { visible?: boolean; }) => string; /** * CVA variants for the dialog panel container. * * @tokens `--color-popover`, `--color-popover-foreground`, `--color-border`, * `--shadow-dialog`, `--radius-overlay` */ declare const dialogPanelVariants: (props?: { size?: 'sm' | 'md' | 'lg' | 'xl' | 'full'; visible?: boolean; }) => string; /** Type helper for dialog panel variant props. */ type DialogPanelVariantProps = VariantProps; /** * CVA variants for the dialog title. * * @tokens `--color-foreground` */ declare const dialogTitleVariants: () => string; /** * CVA variants for the dialog content area. * * @tokens `--color-muted-foreground` */ declare const dialogContentVariants: () => string; /** * CVA variants for the dialog actions area. */ declare const dialogActionsVariants: () => string; export { COM_DIALOG_CONFIG, COM_DIALOG_DATA, ComDialog, ComDialogActions, ComDialogClose, ComDialogContent, ComDialogRef, ComDialogTitle, dialogActionsVariants, dialogBackdropVariants, dialogContentVariants, dialogPanelVariants, dialogTitleVariants, provideComDialogConfig }; export type { ComDialogConfig, ComDialogRole, ComDialogSize, ComDialogTemplateContext, ComRestoreFocusTarget, DialogPanelVariantProps };