import * as i0 from '@angular/core'; import { ViewContainerRef, Injector, EventEmitter, ComponentRef, InjectionToken, OnDestroy, Type, TemplateRef, OnInit, OnChanges, SimpleChanges } from '@angular/core'; import * as i1$1 from '@angular/cdk/dialog'; import { CdkDialogContainer, DialogRef } from '@angular/cdk/dialog'; import * as i2 from '@angular/cdk/overlay'; import { ScrollStrategy, Overlay } from '@angular/cdk/overlay'; import * as i1$2 from '@angular/cdk/portal'; import { ComponentType } from '@angular/cdk/portal'; import * as i1$3 from '@sbb-esta/angular/core'; import * as i3 from '@sbb-esta/angular/icon'; import { AnimationEvent, AnimationTriggerMetadata } from '@angular/animations'; import { FocusOrigin, _IdGenerator } from '@angular/cdk/a11y'; import { Observable, Subject } from 'rxjs'; import * as i1 from '@angular/cdk/scrolling'; /** Valid ARIA roles for a dialog element. */ type SbbDialogRole = 'dialog' | 'alertdialog'; /** Possible overrides for a dialog's position. */ interface SbbDialogPosition { /** Override for the dialog's top position. */ top?: string; /** Override for the dialog's bottom position. */ bottom?: string; /** Override for the dialog's left position. */ left?: string; /** Override for the dialog's right position. */ right?: string; } /** * Configuration for opening a modal dialog with the SbbDialog service. */ declare class SbbDialogConfig { /** * Where the attached component should live in Angular's *logical* component tree. * This affects what is available for injection and the change detection order for the * component instantiated inside of the dialog. This does not affect where the dialog * content will be rendered. */ viewContainerRef?: ViewContainerRef; /** * Injector used for the instantiation of the component to be attached. If provided, * takes precedence over the injector indirectly provided by `ViewContainerRef`. */ injector?: Injector; /** ID for the dialog. If omitted, a unique one will be generated. */ id?: string; /** The ARIA role of the dialog element. */ role?: SbbDialogRole; /** Custom class for the overlay pane. */ panelClass?: string | string[]; /** Whether the dialog has a backdrop. */ hasBackdrop?: boolean; /** Custom class for the backdrop. */ backdropClass?: string | string[]; /** Whether the user can use escape or clicking on the backdrop to close the modal. */ disableClose?: boolean; /** Width of the dialog. */ width?: string; /** Height of the dialog. */ height?: string; /** Min-width of the dialog. If a number is provided, assumes pixel units. */ minWidth?: number | string; /** Min-height of the dialog. If a number is provided, assumes pixel units. */ minHeight?: number | string; /** Max-width of the dialog. If a number is provided, assumes pixel units. Defaults to 80vw. */ maxWidth?: number | string; /** Max-height of the dialog. If a number is provided, assumes pixel units. */ maxHeight?: number | string; /** Position overrides. */ position?: SbbDialogPosition; /** Data being injected into the child component. */ data?: D | null; /** ID of the element that describes the dialog. */ ariaDescribedBy?: string | null; /** ID of the element that labels the dialog. */ ariaLabelledBy?: string | null; /** Aria label to assign to the dialog element. */ ariaLabel?: string | null; /** Whether this is a modal dialog. Used to set the `aria-modal` attribute. */ ariaModal?: boolean; /** Whether the dialog should focus the first focusable element on open. */ autoFocus?: boolean; /** * Whether the dialog should restore focus to the * previously-focused element, after it's closed. */ restoreFocus?: boolean; /** Whether to wait for the opening animation to finish before trapping focus. */ delayFocusTrap?: boolean; /** Scroll strategy to be used for the dialog. */ scrollStrategy?: ScrollStrategy; /** * Whether the dialog should close when the user goes backwards/forwards in history. * Note that this usually doesn't include clicking on links (unless the user is using * the `HashLocationStrategy`). */ closeOnNavigation?: boolean; /** Duration of the enter animation. Has to be a valid CSS value (e.g. 100ms). */ enterAnimationDuration?: string; /** Duration of the exit animation. Has to be a valid CSS value (e.g. 50ms). */ exitAnimationDuration?: string; } /** Event that captures the state of dialog container animations. */ interface DialogAnimationEvent { state: 'opened' | 'opening' | 'closing' | 'closed'; totalTime: number; } /** * Internal component that wraps user-provided dialog content. * @docs-private */ declare class SbbDialogContainer extends CdkDialogContainer { /** Emits when an animation state changes. */ _animationStateChanged: EventEmitter; /** State of the animation. */ _state: 'void' | 'enter' | 'exit'; /** Callback, invoked whenever an animation on the host completes. */ _onAnimationDone({ toState, totalTime }: AnimationEvent): void; /** Callback, invoked when an animation on the host starts. */ _onAnimationStart({ toState, totalTime }: AnimationEvent): void; /** Starts the dialog exit animation. */ _startExitAnimation(): void; /** Initializes the dialog container with the attached content. */ protected _captureInitialFocus(): void; _getAnimationState(): { value: "enter" | "void" | "exit"; params: { enterAnimationDuration: string; exitAnimationDuration: string; }; }; /** * Callback for when the open dialog animation has finished. Intended to * be called by sub-classes that use different animation implementations. */ protected _openAnimationDone(totalTime: number): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } /** Possible states of the lifecycle of a dialog. */ declare enum SbbDialogState { OPEN = 0, CLOSING = 1, CLOSED = 2 } /** * Reference to a dialog opened via the SbbDialog service. */ declare class SbbDialogRef { ref: DialogRef; _containerInstance: SbbDialogContainer; /** The instance of component opened into the dialog. */ componentInstance: T; /** * `ComponentRef` of the component opened into the dialog. Will be * null when the dialog is opened using a `TemplateRef`. */ readonly componentRef: ComponentRef | null; /** Whether the user is allowed to close the dialog. */ disableClose: boolean | undefined; /** Unique ID for the dialog. */ id: string; /** Subject for notifying the user that the dialog has finished opening. */ private readonly _afterOpened; /** Subject for notifying the user that the dialog has started closing. */ private readonly _beforeClosed; /** Result to be passed to afterClosed. */ private _result; /** Handle to the timeout that's running as a fallback in case the exit animation doesn't fire. */ private _closeFallbackTimeout; /** Current state of the dialog. */ private _state; /** Interaction that caused the dialog to close. */ private _closeInteractionType; constructor(ref: DialogRef, config: SbbDialogConfig, _containerInstance: SbbDialogContainer); /** * Close the dialog. * @param dialogResult Optional result to return to the dialog opener. */ close(dialogResult?: R): void; /** * Gets an observable that is notified when the dialog is finished opening. */ afterOpened(): Observable; /** * Gets an observable that is notified when the dialog is finished closing. */ afterClosed(): Observable; /** * Gets an observable that is notified when the dialog has started closing. */ beforeClosed(): Observable; /** * Gets an observable that emits when the overlay's backdrop has been clicked. */ backdropClick(): Observable; /** * Gets an observable that emits when keydown events are targeted on the overlay. */ keydownEvents(): Observable; /** * Updates the dialog's position. * @param position New dialog position. */ updatePosition(position?: SbbDialogPosition): this; /** * Updates the dialog's width and height. * @param width New width of the dialog. * @param height New height of the dialog. */ updateSize(width?: string, height?: string): this; /** Add a CSS class or an array of classes to the overlay pane. */ addPanelClass(classes: string | string[]): this; /** Remove a CSS class or an array of classes from the overlay pane. */ removePanelClass(classes: string | string[]): this; /** Gets the current state of the dialog's lifecycle. */ getState(): SbbDialogState; /** * Finishes the dialog close by updating the state of the dialog * and disposing the overlay. */ private _finishDialogClose; } /** * Closes the dialog with the specified interaction type. This is currently not part of * `SbbDialogRef` as that would conflict with custom dialog ref mocks provided in tests. * More details. See: https://github.com/angular/components/pull/9257#issuecomment-651342226. */ declare function _closeDialogVia(ref: SbbDialogRef, interactionType: FocusOrigin, result?: R): void; /** Injection token that can be used to access the data that was passed in to a dialog. */ declare const SBB_DIALOG_DATA: InjectionToken; /** Injection token that can be used to specify default dialog options. */ declare const SBB_DIALOG_DEFAULT_OPTIONS: InjectionToken>; /** Injection token that determines the scroll handling while the dialog is open. */ declare const SBB_DIALOG_SCROLL_STRATEGY: InjectionToken<() => ScrollStrategy>; /** * Base class for dialog services. The base dialog service allows * for arbitrary dialog refs and dialog container components. */ declare abstract class _SbbDialogBase = SbbDialogRef> implements OnDestroy { private _overlay; private _defaultOptions; private _parentDialog; private _dialogRefConstructor; private _dialogContainerType; private _dialogDataToken; private readonly _openDialogsAtThisLevel; private readonly _afterAllClosedAtThisLevel; private readonly _afterOpenedAtThisLevel; private _scrollStrategy; protected _idGenerator: _IdGenerator; protected _idPrefix: string; private _dialog; private _injector; /** Keeps track of the currently-open dialogs. */ get openDialogs(): F[]; /** Stream that emits when a dialog has been opened. */ get afterOpened(): Subject; private _getAfterAllClosed; /** * Stream that emits when all open dialog have finished closing. * Will emit on subscribe if there are no open dialogs to begin with. */ readonly afterAllClosed: Observable; constructor(_overlay: Overlay, injector: Injector, _defaultOptions: SbbDialogConfig | null, _parentDialog: _SbbDialogBase | null, scrollStrategy: any, _dialogRefConstructor: Type, _dialogContainerType: Type, _dialogDataToken: InjectionToken); /** * Opens a modal dialog containing the given template. * @param componentOrTemplateRef Component type or TemplateRef to instantiate as the dialog content. * @param config Extra configuration options. * @returns Reference to the newly-opened dialog. */ open(componentOrTemplateRef: ComponentType | TemplateRef, config?: SbbDialogConfig): SbbDialogRef; /** * Closes all of the currently-open dialogs. */ closeAll(): void; /** * Finds an open dialog by its id. * @param id ID to use when looking up the dialog. */ getDialogById(id: string): F | undefined; ngOnDestroy(): void; /** Closes all of the dialogs in an array. */ private _closeDialogs; static ɵfac: i0.ɵɵFactoryDeclaration<_SbbDialogBase, never>; static ɵprov: i0.ɵɵInjectableDeclaration<_SbbDialogBase>; } /** * Service to open modal dialogs. */ declare class SbbDialog extends _SbbDialogBase { constructor(...args: unknown[]); static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } /** * Button that will close the current dialog. */ declare class SbbDialogClose implements OnInit, OnChanges { private _elementRef; protected _dialogRef: SbbDialogRef; protected _dialog: SbbDialog; /** Screenreader label for the button. */ ariaLabel: string; /** Default to "button" to prevents accidental form submits. */ type: 'submit' | 'button' | 'reset'; /** Dialog close input. */ dialogResult: any; _sbbDialogClose: any; /** * Callback which is called before closing. * If returning true, dialog can close. * If returning false, dialog cannot close. */ _canCloseInterceptor: () => boolean; constructor(...args: unknown[]); ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; _onButtonClick(event: MouseEvent): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * Base class for dialog title. */ declare class _SbbDialogTitleBase implements OnInit, OnDestroy { protected _dialogRef: SbbDialogRef; protected _dialog: SbbDialog; private _elementRef; private _changeDetectorRef; /** Unique id for the dialog title. If none is supplied, it will be auto-generated. */ id: string; /** Arial label for the close button. */ closeAriaLabel: string; /** Whether the close button is enabled for the dialog. */ _closeEnabled: boolean; constructor(...args: unknown[]); ngOnInit(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration<_SbbDialogTitleBase, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<_SbbDialogTitleBase, never, never, { "id": { "alias": "id"; "required": false; }; "closeAriaLabel": { "alias": "closeAriaLabel"; "required": false; }; }, {}, never, never, true, never>; } /** * Title of a dialog element. Stays fixed to the top of the dialog when scrolling. */ declare class SbbDialogTitle extends _SbbDialogTitleBase { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } /** * Scrollable content container of a dialog. */ declare class SbbDialogContent { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } /** * Container for the bottom action buttons in a dialog. * Stays fixed to the bottom when scrolling. */ declare class SbbDialogActions { /** * Horizontal alignment of action buttons. */ align?: 'start' | 'center' | 'end'; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵdir: i0.ɵɵDirectiveDeclaration; } declare class SbbDialogModule { static ɵfac: i0.ɵɵFactoryDeclaration; static ɵmod: i0.ɵɵNgModuleDeclaration; static ɵinj: i0.ɵɵInjectorDeclaration; } /** * Animations used by SbbDialog. * @docs-private */ declare const sbbDialogAnimations: { readonly dialogContainer: AnimationTriggerMetadata; }; export { SBB_DIALOG_DATA, SBB_DIALOG_DEFAULT_OPTIONS, SBB_DIALOG_SCROLL_STRATEGY, SbbDialog, SbbDialogActions, SbbDialogClose, SbbDialogConfig, SbbDialogContainer, SbbDialogContent, SbbDialogModule, SbbDialogRef, SbbDialogState, SbbDialogTitle, _SbbDialogBase, _SbbDialogTitleBase, _closeDialogVia, sbbDialogAnimations }; export type { SbbDialogPosition, SbbDialogRole };