UNPKG

3.42 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2018 Google Inc.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 * THE SOFTWARE.
22 */
23import { MDCFoundation } from '@material/base/foundation';
24import { MDCSnackbarAdapter } from './adapter';
25export declare class MDCSnackbarFoundation extends MDCFoundation<MDCSnackbarAdapter> {
26 static get cssClasses(): {
27 CLOSING: string;
28 OPEN: string;
29 OPENING: string;
30 };
31 static get strings(): {
32 ACTION_SELECTOR: string;
33 ARIA_LIVE_LABEL_TEXT_ATTR: string;
34 CLOSED_EVENT: string;
35 CLOSING_EVENT: string;
36 DISMISS_SELECTOR: string;
37 LABEL_SELECTOR: string;
38 OPENED_EVENT: string;
39 OPENING_EVENT: string;
40 REASON_ACTION: string;
41 REASON_DISMISS: string;
42 SURFACE_SELECTOR: string;
43 };
44 static get numbers(): {
45 DEFAULT_AUTO_DISMISS_TIMEOUT_MS: number;
46 INDETERMINATE: number;
47 MAX_AUTO_DISMISS_TIMEOUT_MS: number;
48 MIN_AUTO_DISMISS_TIMEOUT_MS: number;
49 SNACKBAR_ANIMATION_CLOSE_TIME_MS: number;
50 SNACKBAR_ANIMATION_OPEN_TIME_MS: number;
51 ARIA_LIVE_DELAY_MS: number;
52 };
53 static get defaultAdapter(): MDCSnackbarAdapter;
54 private opened;
55 private animationFrame;
56 private animationTimer;
57 private autoDismissTimer;
58 private autoDismissTimeoutMs;
59 private closeOnEscape;
60 constructor(adapter?: Partial<MDCSnackbarAdapter>);
61 destroy(): void;
62 open(): void;
63 /**
64 * @param reason Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the
65 * `event.detail.reason` property. Standard values are REASON_ACTION and REASON_DISMISS, but custom
66 * client-specific values may also be used if desired.
67 */
68 close(reason?: string): void;
69 isOpen(): boolean;
70 getTimeoutMs(): number;
71 setTimeoutMs(timeoutMs: number): void;
72 getCloseOnEscape(): boolean;
73 setCloseOnEscape(closeOnEscape: boolean): void;
74 handleKeyDown(evt: KeyboardEvent): void;
75 handleActionButtonClick(_evt: MouseEvent): void;
76 handleActionIconClick(_evt: MouseEvent): void;
77 private clearAutoDismissTimer;
78 private handleAnimationTimerEnd;
79 /**
80 * Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior.
81 */
82 private runNextAnimationFrame;
83}
84export default MDCSnackbarFoundation;