UNPKG

15.9 kBTypeScriptView Raw
1// Generated by dts-bundle v0.7.3
2// Dependencies for this module:
3// ../../@material/dom/focus-trap
4// ../../@material/base/component
5// ../../@material/list/component
6// ../../@material/base/foundation
7
8declare module '@material/drawer' {
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/drawer/util';
32 export { util };
33 export * from '@material/drawer/adapter';
34 export * from '@material/drawer/component';
35 export * from '@material/drawer/constants';
36 export * from '@material/drawer/dismissible/foundation';
37 export * from '@material/drawer/modal/foundation';
38}
39
40declare module '@material/drawer/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 MDCDrawerFocusTrapFactory = (element: HTMLElement, options: FocusOptions) => FocusTrap;
65 export function createFocusTrapInstance(surfaceEl: HTMLElement, focusTrapFactory: MDCDrawerFocusTrapFactory): FocusTrap;
66}
67
68declare module '@material/drawer/adapter' {
69 /**
70 * Defines the shape of the adapter expected by the foundation.
71 * Implement this adapter for your framework of choice to delegate updates to
72 * the component in your framework of choice. See architecture documentation
73 * for more details.
74 * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
75 */
76 export interface MDCDrawerAdapter {
77 /**
78 * Adds a class to the root Element.
79 */
80 addClass(className: string): void;
81 /**
82 * Removes a class from the root Element.
83 */
84 removeClass(className: string): void;
85 /**
86 * Returns true if the root Element contains the given class.
87 */
88 hasClass(className: string): boolean;
89 /**
90 * Returns true if the element contains the given class.
91 * @param element target element to verify class name
92 * @param className class name
93 */
94 elementHasClass(element: Element, className: string): boolean;
95 /**
96 * Saves the focus of currently active element.
97 */
98 saveFocus(): void;
99 /**
100 * Restores focus to element previously saved with 'saveFocus'.
101 */
102 restoreFocus(): void;
103 /**
104 * Focuses the active / selected navigation item.
105 */
106 focusActiveNavigationItem(): void;
107 /**
108 * Emits a custom event "MDCDrawer:closed" denoting the drawer has closed.
109 */
110 notifyClose(): void;
111 /**
112 * Emits a custom event "MDCDrawer:opened" denoting the drawer has opened.
113 */
114 notifyOpen(): void;
115 /**
116 * Traps focus on root element and focuses the active navigation element.
117 */
118 trapFocus(): void;
119 /**
120 * Releases focus trap from root element which was set by `trapFocus`
121 * and restores focus to where it was prior to calling `trapFocus`.
122 */
123 releaseFocus(): void;
124 }
125}
126
127declare module '@material/drawer/component' {
128 /**
129 * @license
130 * Copyright 2016 Google Inc.
131 *
132 * Permission is hereby granted, free of charge, to any person obtaining a copy
133 * of this software and associated documentation files (the "Software"), to deal
134 * in the Software without restriction, including without limitation the rights
135 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
136 * copies of the Software, and to permit persons to whom the Software is
137 * furnished to do so, subject to the following conditions:
138 *
139 * The above copyright notice and this permission notice shall be included in
140 * all copies or substantial portions of the Software.
141 *
142 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
143 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
144 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
145 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
146 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
147 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
148 * THE SOFTWARE.
149 */
150 import { MDCComponent } from '@material/base/component';
151 import { MDCList, MDCListFactory } from '@material/list/component';
152 import { MDCDismissibleDrawerFoundation } from '@material/drawer/dismissible/foundation';
153 import { MDCDrawerFocusTrapFactory } from '@material/drawer/util';
154 /**
155 * @events `MDCDrawer:closed {}` Emits when the navigation drawer has closed.
156 * @events `MDCDrawer:opened {}` Emits when the navigation drawer has opened.
157 */
158 export class MDCDrawer extends MDCComponent<MDCDismissibleDrawerFoundation> {
159 static attachTo(root: Element): MDCDrawer;
160 /**
161 * @return boolean Proxies to the foundation's `open`/`close` methods.
162 * Also returns true if drawer is in the open position.
163 */
164 get open(): boolean;
165 /**
166 * Toggles the drawer open and closed.
167 */
168 set open(isOpen: boolean);
169 get list(): MDCList | undefined;
170 initialize(focusTrapFactory?: MDCDrawerFocusTrapFactory, listFactory?: MDCListFactory): void;
171 initialSyncWithDOM(): void;
172 destroy(): void;
173 getDefaultFoundation(): MDCDismissibleDrawerFoundation;
174 }
175}
176
177declare module '@material/drawer/constants' {
178 /**
179 * @license
180 * Copyright 2016 Google Inc.
181 *
182 * Permission is hereby granted, free of charge, to any person obtaining a copy
183 * of this software and associated documentation files (the "Software"), to deal
184 * in the Software without restriction, including without limitation the rights
185 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
186 * copies of the Software, and to permit persons to whom the Software is
187 * furnished to do so, subject to the following conditions:
188 *
189 * The above copyright notice and this permission notice shall be included in
190 * all copies or substantial portions of the Software.
191 *
192 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
193 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
194 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
195 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
196 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
197 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
198 * THE SOFTWARE.
199 */
200 const cssClasses: {
201 ANIMATE: string;
202 CLOSING: string;
203 DISMISSIBLE: string;
204 MODAL: string;
205 OPEN: string;
206 OPENING: string;
207 ROOT: string;
208 };
209 const strings: {
210 APP_CONTENT_SELECTOR: string;
211 CLOSE_EVENT: string;
212 OPEN_EVENT: string;
213 SCRIM_SELECTOR: string;
214 LIST_SELECTOR: string;
215 LIST_ITEM_ACTIVATED_SELECTOR: string;
216 };
217 export { cssClasses, strings };
218}
219
220declare module '@material/drawer/dismissible/foundation' {
221 /**
222 * @license
223 * Copyright 2018 Google Inc.
224 *
225 * Permission is hereby granted, free of charge, to any person obtaining a copy
226 * of this software and associated documentation files (the "Software"), to deal
227 * in the Software without restriction, including without limitation the rights
228 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
229 * copies of the Software, and to permit persons to whom the Software is
230 * furnished to do so, subject to the following conditions:
231 *
232 * The above copyright notice and this permission notice shall be included in
233 * all copies or substantial portions of the Software.
234 *
235 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
236 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
237 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
238 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
239 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
240 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
241 * THE SOFTWARE.
242 */
243 import { MDCFoundation } from '@material/base/foundation';
244 import { MDCDrawerAdapter } from '@material/drawer/adapter';
245 export class MDCDismissibleDrawerFoundation extends MDCFoundation<MDCDrawerAdapter> {
246 static get strings(): {
247 APP_CONTENT_SELECTOR: string;
248 CLOSE_EVENT: string;
249 OPEN_EVENT: string;
250 SCRIM_SELECTOR: string;
251 LIST_SELECTOR: string;
252 LIST_ITEM_ACTIVATED_SELECTOR: string;
253 };
254 static get cssClasses(): {
255 ANIMATE: string;
256 CLOSING: string;
257 DISMISSIBLE: string;
258 MODAL: string;
259 OPEN: string;
260 OPENING: string;
261 ROOT: string;
262 };
263 static get defaultAdapter(): MDCDrawerAdapter;
264 constructor(adapter?: Partial<MDCDrawerAdapter>);
265 destroy(): void;
266 /**
267 * Opens the drawer from the closed state.
268 */
269 open(): void;
270 /**
271 * Closes the drawer from the open state.
272 */
273 close(): void;
274 /**
275 * Returns true if the drawer is in the open position.
276 * @return true if drawer is in open state.
277 */
278 isOpen(): boolean;
279 /**
280 * Returns true if the drawer is animating open.
281 * @return true if drawer is animating open.
282 */
283 isOpening(): boolean;
284 /**
285 * Returns true if the drawer is animating closed.
286 * @return true if drawer is animating closed.
287 */
288 isClosing(): boolean;
289 /**
290 * Keydown handler to close drawer when key is escape.
291 */
292 handleKeydown(evt: KeyboardEvent): void;
293 /**
294 * Handles the `transitionend` event when the drawer finishes opening/closing.
295 */
296 handleTransitionEnd(evt: TransitionEvent): void;
297 /**
298 * Extension point for when drawer finishes open animation.
299 */
300 protected opened(): void;
301 /**
302 * Extension point for when drawer finishes close animation.
303 */
304 protected closed(): void;
305 }
306 export default MDCDismissibleDrawerFoundation;
307}
308
309declare module '@material/drawer/modal/foundation' {
310 /**
311 * @license
312 * Copyright 2018 Google Inc.
313 *
314 * Permission is hereby granted, free of charge, to any person obtaining a copy
315 * of this software and associated documentation files (the "Software"), to deal
316 * in the Software without restriction, including without limitation the rights
317 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
318 * copies of the Software, and to permit persons to whom the Software is
319 * furnished to do so, subject to the following conditions:
320 *
321 * The above copyright notice and this permission notice shall be included in
322 * all copies or substantial portions of the Software.
323 *
324 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
325 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
326 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
327 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
328 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
329 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
330 * THE SOFTWARE.
331 */
332 import { MDCDismissibleDrawerFoundation } from '@material/drawer/dismissible/foundation';
333 export class MDCModalDrawerFoundation extends MDCDismissibleDrawerFoundation {
334 /**
335 * Handles click event on scrim.
336 */
337 handleScrimClick(): void;
338 /**
339 * Called when drawer finishes open animation.
340 */
341 protected opened(): void;
342 /**
343 * Called when drawer finishes close animation.
344 */
345 protected closed(): void;
346 }
347 export default MDCModalDrawerFoundation;
348}
349