UNPKG

5.12 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2017 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 { MDCDialogAdapter } from './adapter';
25import { DialogConfigOptions } from './types';
26export declare class MDCDialogFoundation extends MDCFoundation<MDCDialogAdapter> {
27 static get cssClasses(): {
28 CLOSING: string;
29 OPEN: string;
30 OPENING: string;
31 SCROLLABLE: string;
32 SCROLL_LOCK: string;
33 STACKED: string;
34 FULLSCREEN: string;
35 SCROLL_DIVIDER_HEADER: string;
36 SCROLL_DIVIDER_FOOTER: string;
37 SURFACE_SCRIM_SHOWN: string;
38 SURFACE_SCRIM_SHOWING: string;
39 SURFACE_SCRIM_HIDING: string;
40 SCRIM_HIDDEN: string;
41 };
42 static get strings(): {
43 ACTION_ATTRIBUTE: string;
44 BUTTON_DEFAULT_ATTRIBUTE: string;
45 BUTTON_SELECTOR: string;
46 CLOSED_EVENT: string;
47 CLOSE_ACTION: string;
48 CLOSING_EVENT: string;
49 CONTAINER_SELECTOR: string;
50 CONTENT_SELECTOR: string;
51 DESTROY_ACTION: string;
52 INITIAL_FOCUS_ATTRIBUTE: string;
53 OPENED_EVENT: string;
54 OPENING_EVENT: string;
55 SCRIM_SELECTOR: string;
56 SUPPRESS_DEFAULT_PRESS_SELECTOR: string;
57 SURFACE_SELECTOR: string;
58 };
59 static get numbers(): {
60 DIALOG_ANIMATION_CLOSE_TIME_MS: number;
61 DIALOG_ANIMATION_OPEN_TIME_MS: number;
62 };
63 static get defaultAdapter(): MDCDialogAdapter;
64 private dialogOpen;
65 private isFullscreen;
66 private animationFrame;
67 private animationTimer;
68 private escapeKeyAction;
69 private scrimClickAction;
70 private autoStackButtons;
71 private areButtonsStacked;
72 private suppressDefaultPressSelector;
73 private readonly contentScrollHandler;
74 private readonly animFrame;
75 private readonly windowResizeHandler;
76 private readonly windowOrientationChangeHandler;
77 constructor(adapter?: Partial<MDCDialogAdapter>);
78 init(): void;
79 destroy(): void;
80 open(dialogOptions?: DialogConfigOptions): void;
81 close(action?: string): void;
82 /**
83 * Used only in instances of showing a secondary dialog over a full-screen
84 * dialog. Shows the "surface scrim" displayed over the full-screen dialog.
85 */
86 showSurfaceScrim(): void;
87 /**
88 * Used only in instances of showing a secondary dialog over a full-screen
89 * dialog. Hides the "surface scrim" displayed over the full-screen dialog.
90 */
91 hideSurfaceScrim(): void;
92 /**
93 * Handles `transitionend` event triggered when surface scrim animation is
94 * finished.
95 */
96 handleSurfaceScrimTransitionEnd(): void;
97 isOpen(): boolean;
98 getEscapeKeyAction(): string;
99 setEscapeKeyAction(action: string): void;
100 getScrimClickAction(): string;
101 setScrimClickAction(action: string): void;
102 getAutoStackButtons(): boolean;
103 setAutoStackButtons(autoStack: boolean): void;
104 getSuppressDefaultPressSelector(): string;
105 setSuppressDefaultPressSelector(selector: string): void;
106 layout(): void;
107 /** Handles click on the dialog root element. */
108 handleClick(evt: MouseEvent): void;
109 /** Handles keydown on the dialog root element. */
110 handleKeydown(evt: KeyboardEvent): void;
111 /** Handles keydown on the document. */
112 handleDocumentKeydown(evt: KeyboardEvent): void;
113 /**
114 * Handles scroll event on the dialog's content element -- showing a scroll
115 * divider on the header or footer based on the scroll position. This handler
116 * should only be registered on full-screen dialogs with scrollable content.
117 */
118 private handleScrollEvent;
119 private layoutInternal;
120 private handleAnimationTimerEnd;
121 /**
122 * Runs the given logic on the next animation frame, using setTimeout to
123 * factor in Firefox reflow behavior.
124 */
125 private runNextAnimationFrame;
126 private detectStackedButtons;
127 private toggleScrollableClasses;
128 private toggleScrollDividerHeader;
129 private toggleScrollDividerFooter;
130}
131export default MDCDialogFoundation;