UNPKG

20.2 kBTypeScriptView Raw
1// Generated by dts-bundle v0.7.3
2// Dependencies for this module:
3// ../../@material/dom/focus-trap
4// ../../@material/base/types
5// ../../@material/base/component
6// ../../@material/base/foundation
7
8declare module '@material/dialog' {
9 /**
10 * @license
11 * Copyright 2019 Google Inc.
12 *
13 * Permission is hereby granted, free of charge, to any person obtaining a copy
14 * of this software and associated documentation files (the "Software"), to deal
15 * in the Software without restriction, including without limitation the rights
16 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17 * copies of the Software, and to permit persons to whom the Software is
18 * furnished to do so, subject to the following conditions:
19 *
20 * The above copyright notice and this permission notice shall be included in
21 * all copies or substantial portions of the Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
29 * THE SOFTWARE.
30 */
31 import * as util from '@material/dialog/util';
32 export { util };
33 export * from '@material/dialog/adapter';
34 export * from '@material/dialog/component';
35 export * from '@material/dialog/constants';
36 export * from '@material/dialog/foundation';
37 export * from '@material/dialog/types';
38}
39
40declare module '@material/dialog/util' {
41 /**
42 * @license
43 * Copyright 2016 Google Inc.
44 *
45 * Permission is hereby granted, free of charge, to any person obtaining a copy
46 * of this software and associated documentation files (the "Software"), to deal
47 * in the Software without restriction, including without limitation the rights
48 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
49 * copies of the Software, and to permit persons to whom the Software is
50 * furnished to do so, subject to the following conditions:
51 *
52 * The above copyright notice and this permission notice shall be included in
53 * all copies or substantial portions of the Software.
54 *
55 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
56 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
57 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
58 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
59 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
60 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
61 * THE SOFTWARE.
62 */
63 import { FocusOptions, FocusTrap } from '@material/dom/focus-trap';
64 export type MDCDialogFocusTrapFactory = (element: HTMLElement, options: FocusOptions) => FocusTrap;
65 export function createFocusTrapInstance(surfaceEl: HTMLElement, focusTrapFactory: MDCDialogFocusTrapFactory, initialFocusEl?: HTMLElement): FocusTrap;
66 export function isScrollable(el: HTMLElement | null): boolean;
67 /**
68 * For scrollable content, returns true if the content has not been scrolled
69 * (that is, the scroll content is as the "top"). This is used in full-screen
70 * dialogs, where the scroll divider is expected only to appear once the
71 * content has been scrolled "underneath" the header bar.
72 */
73 export function isScrollAtTop(el: HTMLElement | null): boolean;
74 /**
75 * For scrollable content, returns true if the content has been scrolled all the
76 * way to the bottom. This is used in full-screen dialogs, where the footer
77 * scroll divider is expected only to appear when the content is "cut-off" by
78 * the footer bar.
79 */
80 export function isScrollAtBottom(el: HTMLElement | null): boolean;
81 export function areTopsMisaligned(els: HTMLElement[]): boolean;
82}
83
84declare module '@material/dialog/adapter' {
85 /**
86 * @license
87 * Copyright 2018 Google Inc.
88 *
89 * Permission is hereby granted, free of charge, to any person obtaining a copy
90 * of this software and associated documentation files (the "Software"), to deal
91 * in the Software without restriction, including without limitation the rights
92 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
93 * copies of the Software, and to permit persons to whom the Software is
94 * furnished to do so, subject to the following conditions:
95 *
96 * The above copyright notice and this permission notice shall be included in
97 * all copies or substantial portions of the Software.
98 *
99 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
100 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
101 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
102 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
103 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
104 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
105 * THE SOFTWARE.
106 */
107 import { EventType, SpecificEventListener, SpecificWindowEventListener, WindowEventType } from '@material/base/types';
108 /**
109 * Defines the shape of the adapter expected by the foundation.
110 * Implement this adapter for your framework of choice to delegate updates to
111 * the component in your framework of choice. See architecture documentation
112 * for more details.
113 * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
114 */
115 export interface MDCDialogAdapter {
116 addClass(className: string): void;
117 removeClass(className: string): void;
118 hasClass(className: string): boolean;
119 addBodyClass(className: string): void;
120 removeBodyClass(className: string): void;
121 eventTargetMatches(target: EventTarget | null, selector: string): boolean;
122 isContentScrollable(): boolean;
123 areButtonsStacked(): boolean;
124 getActionFromEvent(evt: Event): string | null;
125 trapFocus(focusElement: HTMLElement | null): void;
126 releaseFocus(): void;
127 getInitialFocusEl(): HTMLElement | null;
128 clickDefaultButton(): void;
129 reverseButtons(): void;
130 notifyOpening(): void;
131 notifyOpened(): void;
132 notifyClosing(action: string): void;
133 notifyClosed(action: string): void;
134 /**
135 * Registers an event listener on the dialog's content element (indicated
136 * with the 'mdc-dialog__content' class).
137 */
138 registerContentEventHandler<K extends EventType>(evtType: K, handler: SpecificEventListener<K>): void;
139 /**
140 * Deregisters an event listener on the dialog's content element.
141 */
142 deregisterContentEventHandler<K extends EventType>(evtType: K, handler: SpecificEventListener<K>): void;
143 /**
144 * @return true if the content has been scrolled (that is, for
145 * scrollable content, if it is at the "top"). This is used in full-screen
146 * dialogs, where the scroll divider is expected only to appear once the
147 * content has been scrolled "underneath" the header bar.
148 */
149 isScrollableContentAtTop(): boolean;
150 /**
151 * @return true if the content has been scrolled all
152 * the way to the bottom. This is used in full-screen dialogs, where the
153 * footer scroll divider is expected only to appear when the content is
154 * "cut-off" by the footer bar.
155 */
156 isScrollableContentAtBottom(): boolean;
157 /**
158 * Registers an event listener to the window.
159 */
160 registerWindowEventHandler<K extends WindowEventType>(evtType: K, handler: SpecificWindowEventListener<K>): void;
161 /**
162 * Deregisters an event listener to the window.
163 */
164 deregisterWindowEventHandler<K extends WindowEventType>(evtType: K, handler: SpecificWindowEventListener<K>): void;
165 }
166}
167
168declare module '@material/dialog/component' {
169 /**
170 * @license
171 * Copyright 2017 Google Inc.
172 *
173 * Permission is hereby granted, free of charge, to any person obtaining a copy
174 * of this software and associated documentation files (the "Software"), to deal
175 * in the Software without restriction, including without limitation the rights
176 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
177 * copies of the Software, and to permit persons to whom the Software is
178 * furnished to do so, subject to the following conditions:
179 *
180 * The above copyright notice and this permission notice shall be included in
181 * all copies or substantial portions of the Software.
182 *
183 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
184 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
185 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
186 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
187 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
188 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
189 * THE SOFTWARE.
190 */
191 import { MDCComponent } from '@material/base/component';
192 import { MDCDialogFoundation } from '@material/dialog/foundation';
193 import { MDCDialogFocusTrapFactory } from '@material/dialog/util';
194 export class MDCDialog extends MDCComponent<MDCDialogFoundation> {
195 get isOpen(): boolean;
196 get escapeKeyAction(): string;
197 set escapeKeyAction(action: string);
198 get scrimClickAction(): string;
199 set scrimClickAction(action: string);
200 get autoStackButtons(): boolean;
201 set autoStackButtons(autoStack: boolean);
202 static attachTo(root: Element): MDCDialog;
203 initialize(focusTrapFactory?: MDCDialogFocusTrapFactory): void;
204 initialSyncWithDOM(): void;
205 destroy(): void;
206 layout(): void;
207 open(): void;
208 close(action?: string): void;
209 getDefaultFoundation(): MDCDialogFoundation;
210 }
211}
212
213declare module '@material/dialog/constants' {
214 /**
215 * @license
216 * Copyright 2016 Google Inc.
217 *
218 * Permission is hereby granted, free of charge, to any person obtaining a copy
219 * of this software and associated documentation files (the "Software"), to deal
220 * in the Software without restriction, including without limitation the rights
221 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
222 * copies of the Software, and to permit persons to whom the Software is
223 * furnished to do so, subject to the following conditions:
224 *
225 * The above copyright notice and this permission notice shall be included in
226 * all copies or substantial portions of the Software.
227 *
228 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
229 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
230 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
231 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
232 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
233 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
234 * THE SOFTWARE.
235 */
236 export const cssClasses: {
237 CLOSING: string;
238 OPEN: string;
239 OPENING: string;
240 SCROLLABLE: string;
241 SCROLL_LOCK: string;
242 STACKED: string;
243 FULLSCREEN: string;
244 SCROLL_DIVIDER_HEADER: string;
245 SCROLL_DIVIDER_FOOTER: string;
246 SURFACE_SCRIM_SHOWN: string;
247 SURFACE_SCRIM_SHOWING: string;
248 SURFACE_SCRIM_HIDING: string;
249 SCRIM_HIDDEN: string;
250 };
251 export const strings: {
252 ACTION_ATTRIBUTE: string;
253 BUTTON_DEFAULT_ATTRIBUTE: string;
254 BUTTON_SELECTOR: string;
255 CLOSED_EVENT: string;
256 CLOSE_ACTION: string;
257 CLOSING_EVENT: string;
258 CONTAINER_SELECTOR: string;
259 CONTENT_SELECTOR: string;
260 DESTROY_ACTION: string;
261 INITIAL_FOCUS_ATTRIBUTE: string;
262 OPENED_EVENT: string;
263 OPENING_EVENT: string;
264 SCRIM_SELECTOR: string;
265 SUPPRESS_DEFAULT_PRESS_SELECTOR: string;
266 SURFACE_SELECTOR: string;
267 };
268 export const numbers: {
269 DIALOG_ANIMATION_CLOSE_TIME_MS: number;
270 DIALOG_ANIMATION_OPEN_TIME_MS: number;
271 };
272}
273
274declare module '@material/dialog/foundation' {
275 /**
276 * @license
277 * Copyright 2017 Google Inc.
278 *
279 * Permission is hereby granted, free of charge, to any person obtaining a copy
280 * of this software and associated documentation files (the "Software"), to deal
281 * in the Software without restriction, including without limitation the rights
282 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
283 * copies of the Software, and to permit persons to whom the Software is
284 * furnished to do so, subject to the following conditions:
285 *
286 * The above copyright notice and this permission notice shall be included in
287 * all copies or substantial portions of the Software.
288 *
289 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
290 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
291 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
292 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
293 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
294 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
295 * THE SOFTWARE.
296 */
297 import { MDCFoundation } from '@material/base/foundation';
298 import { MDCDialogAdapter } from '@material/dialog/adapter';
299 import { DialogConfigOptions } from '@material/dialog/types';
300 export class MDCDialogFoundation extends MDCFoundation<MDCDialogAdapter> {
301 static get cssClasses(): {
302 CLOSING: string;
303 OPEN: string;
304 OPENING: string;
305 SCROLLABLE: string;
306 SCROLL_LOCK: string;
307 STACKED: string;
308 FULLSCREEN: string;
309 SCROLL_DIVIDER_HEADER: string;
310 SCROLL_DIVIDER_FOOTER: string;
311 SURFACE_SCRIM_SHOWN: string;
312 SURFACE_SCRIM_SHOWING: string;
313 SURFACE_SCRIM_HIDING: string;
314 SCRIM_HIDDEN: string;
315 };
316 static get strings(): {
317 ACTION_ATTRIBUTE: string;
318 BUTTON_DEFAULT_ATTRIBUTE: string;
319 BUTTON_SELECTOR: string;
320 CLOSED_EVENT: string;
321 CLOSE_ACTION: string;
322 CLOSING_EVENT: string;
323 CONTAINER_SELECTOR: string;
324 CONTENT_SELECTOR: string;
325 DESTROY_ACTION: string;
326 INITIAL_FOCUS_ATTRIBUTE: string;
327 OPENED_EVENT: string;
328 OPENING_EVENT: string;
329 SCRIM_SELECTOR: string;
330 SUPPRESS_DEFAULT_PRESS_SELECTOR: string;
331 SURFACE_SELECTOR: string;
332 };
333 static get numbers(): {
334 DIALOG_ANIMATION_CLOSE_TIME_MS: number;
335 DIALOG_ANIMATION_OPEN_TIME_MS: number;
336 };
337 static get defaultAdapter(): MDCDialogAdapter;
338 constructor(adapter?: Partial<MDCDialogAdapter>);
339 init(): void;
340 destroy(): void;
341 open(dialogOptions?: DialogConfigOptions): void;
342 close(action?: string): void;
343 /**
344 * Used only in instances of showing a secondary dialog over a full-screen
345 * dialog. Shows the "surface scrim" displayed over the full-screen dialog.
346 */
347 showSurfaceScrim(): void;
348 /**
349 * Used only in instances of showing a secondary dialog over a full-screen
350 * dialog. Hides the "surface scrim" displayed over the full-screen dialog.
351 */
352 hideSurfaceScrim(): void;
353 /**
354 * Handles `transitionend` event triggered when surface scrim animation is
355 * finished.
356 */
357 handleSurfaceScrimTransitionEnd(): void;
358 isOpen(): boolean;
359 getEscapeKeyAction(): string;
360 setEscapeKeyAction(action: string): void;
361 getScrimClickAction(): string;
362 setScrimClickAction(action: string): void;
363 getAutoStackButtons(): boolean;
364 setAutoStackButtons(autoStack: boolean): void;
365 getSuppressDefaultPressSelector(): string;
366 setSuppressDefaultPressSelector(selector: string): void;
367 layout(): void;
368 /** Handles click on the dialog root element. */
369 handleClick(evt: MouseEvent): void;
370 /** Handles keydown on the dialog root element. */
371 handleKeydown(evt: KeyboardEvent): void;
372 /** Handles keydown on the document. */
373 handleDocumentKeydown(evt: KeyboardEvent): void;
374 }
375 export default MDCDialogFoundation;
376}
377
378declare module '@material/dialog/types' {
379 /**
380 * @license
381 * Copyright 2019 Google Inc.
382 *
383 * Permission is hereby granted, free of charge, to any person obtaining a copy
384 * of this software and associated documentation files (the "Software"), to deal
385 * in the Software without restriction, including without limitation the rights
386 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
387 * copies of the Software, and to permit persons to whom the Software is
388 * furnished to do so, subject to the following conditions:
389 *
390 * The above copyright notice and this permission notice shall be included in
391 * all copies or substantial portions of the Software.
392 *
393 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
394 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
395 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
396 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
397 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
398 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
399 * THE SOFTWARE.
400 */
401 export interface MDCDialogCloseEventDetail {
402 action?: string;
403 }
404 export interface MDCDialogCloseEvent extends Event {
405 readonly detail: MDCDialogCloseEventDetail;
406 }
407 /**
408 * Options for how to configure the dialog.
409 */
410 export interface DialogConfigOptions {
411 isAboveFullscreenDialog?: boolean;
412 }
413}
414