blob: 2f8d29601fdbd5f8ea72e22b0602058f8e037545 [file] [log] [blame]
import { AnimationEvent } from '@angular/animations';
import { FocusMonitor, FocusOrigin, FocusTrapFactory } from '@angular/cdk/a11y';
import { BasePortalOutlet, CdkPortalOutlet, ComponentPortal, DomPortal, TemplatePortal } from '@angular/cdk/portal';
import { ChangeDetectorRef, ComponentRef, ElementRef, EmbeddedViewRef, EventEmitter } from '@angular/core';
import { CovalentSideSheetConfig } from './side-sheet.config';
export declare function _getFocusedElementPierceShadowDom(): HTMLElement | null;
/**
* Base class for the `CovalentSideSheetContainer`. The base class does not implement
* animations as these are left to implementers of the side-sheet container.
*/
export declare abstract class _CovalentSideSheetContainerBase extends BasePortalOutlet {
protected _elementRef: ElementRef;
protected _focusTrapFactory: FocusTrapFactory;
protected _changeDetectorRef: ChangeDetectorRef;
/** The side-sheet configuration. */
_config: CovalentSideSheetConfig;
private _focusMonitor?;
protected _document: Document;
/** The portal outlet inside of this container into which the side-sheet content will be loaded. */
_portalOutlet: CdkPortalOutlet;
/** The class that traps and manages focus within the side-sheet. */
private _focusTrap;
/** Emits when an animation state changes. */
_animationStateChanged: EventEmitter<{
state: 'opened' | 'opening' | 'closing' | 'closed';
totalTime: number;
}>;
/** Element that was focused before the side-sheet was opened. Save this to restore upon close. */
private _elementFocusedBeforeSideSheetWasOpened;
/**
* Type of interaction that led to the side-sheet being closed. This is used to determine
* whether the focus style will be applied when returning focus to its original location
* after the side-sheet is closed.
*/
_closeInteractionType: FocusOrigin | null;
/** ID of the element that should be considered as the side-sheet's label. */
_ariaLabelledBy: string | null;
/** ID for the container DOM element. */
_id: string;
constructor(_elementRef: ElementRef, _focusTrapFactory: FocusTrapFactory, _changeDetectorRef: ChangeDetectorRef, _document: any,
/** The side-sheet configuration. */
_config: CovalentSideSheetConfig, _focusMonitor?: FocusMonitor);
/** Starts the side-sheet exit animation. */
abstract _startExitAnimation(): void;
/** Initializes the side-sheet container with the attached content. */
_initializeWithAttachedContent(): void;
/**
* Attach a ComponentPortal as content to this side-sheet container.
* @param portal Portal to be attached as the side-sheet content.
*/
attachComponentPortal<T>(portal: ComponentPortal<T>): ComponentRef<T>;
/**
* Attach a TemplatePortal as content to this side-sheet container.
* @param portal Portal to be attached as the side-sheet content.
*/
attachTemplatePortal<C>(portal: TemplatePortal<C>): EmbeddedViewRef<C>;
/**
* Attaches a DOM portal to the side-sheet container.
* @param portal Portal to be attached.
* @deprecated To be turned into a method.
*/
attachDomPortal: (portal: DomPortal) => void;
/** Moves focus back into the side-sheet if it was moved out. */
_recaptureFocus(): void;
/**
* Moves the focus inside the focus trap. When autoFocus is not set to 'side-sheet', if focus
* cannot be moved then focus will go to the side-sheet container.
*/
protected _trapFocus(): void;
/** Restores focus to the element that was focused before the side-sheet opened. */
protected _restoreFocus(): void;
/** Sets up the focus trap. */
private _setupFocusTrap;
/** Captures the element that was focused before the side-sheet was opened. */
private _capturePreviouslyFocusedElement;
/** Focuses the side-sheet container. */
private _focusSideSheetContainer;
/** Returns whether focus is inside the side-sheet. */
private _containsFocus;
}
/**
* Internal component that wraps the generated side-sheet content.
* This animation below is the only reason for duplicating most of the Material dialog code
*/
export declare class CovalentSideSheetContainer extends _CovalentSideSheetContainerBase {
/** State of the side-sheet 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 side-sheet exit animation. */
_startExitAnimation(): void;
}