UNPKG

@blox/material

Version:

Material Components for Angular

70 lines (69 loc) 2.59 kB
import { Observable } from 'rxjs'; import { MdcSnackbarMessage } from './mdc.snackbar.message'; /** * This class provides information about a posted snackbar message. * It can also be used to subscribe to action clicks. */ export declare abstract class MdcSnackbarRef { /** * Subscribe to this observable to be informed when a user clicks the action * for the shown snackbar. Note that the observable will complete when the snackbar * disappears from screen, so there is no need to unsubscribe. */ abstract action(): Observable<void>; /** * Subscribe to this observable to be informed when the message is displayed. * Note that the observable will complete when the snackbar disappears from screen, * so there is no need to unsubscribe. */ abstract afterOpened(): Observable<void>; /** * Subscribe to this observable to be informed when the message has disappeared. * Note that the observable will complete immediately afterwards, so there is * no need to unsubscribe. * The observed value is the `reason` string that was provided for closing the snackbar. */ abstract afterClosed(): Observable<string>; } /** * A service for showing spec-aligned material design snackbar/toast messages. */ export declare class MdcSnackbarService { private onDestroy$; private closed; private root; private label; private actionButton; private actionLabel; private adapter; private handleActionClick; private handleKeyDown; private foundation; private queue; private document; constructor(doc: any); private init; /** * Show a snackbar/toast message. If a snackbar message is already showing, the new * message will be queued to show after earlier message have been shown. * The returned `MdcSnackbarRef` provides methods to subscribe to opened, closed, and * action click events. * * @param message Queue a snackbar message to show. */ show(message: MdcSnackbarMessage): MdcSnackbarRef; private showNext; private closeCurrent; private get current(); /** * Set this property to true to show snackbars start-aligned instead of center-aligned. Desktop and tablet only. */ get leading(): boolean; set leading(value: boolean); /** * By default the snackbar closes when the user presses ESC, while it's focused. Set this to * false to not close the snackbar when the user presses ESC. */ get closeOnEscape(): boolean; set closeOnEscape(value: boolean); }