UNPKG

14.5 kBTypeScriptView Raw
1// Generated by dts-bundle v0.7.3
2// Dependencies for this module:
3// ../../@material/base/component
4// ../../@material/base/foundation
5
6declare module '@material/snackbar' {
7 /**
8 * @license
9 * Copyright 2019 Google Inc.
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a copy
12 * of this software and associated documentation files (the "Software"), to deal
13 * in the Software without restriction, including without limitation the rights
14 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 * copies of the Software, and to permit persons to whom the Software is
16 * furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included in
19 * all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
27 * THE SOFTWARE.
28 */
29 import * as util from '@material/snackbar/util';
30 export { util };
31 export * from '@material/snackbar/adapter';
32 export * from '@material/snackbar/component';
33 export * from '@material/snackbar/constants';
34 export * from '@material/snackbar/foundation';
35 export * from '@material/snackbar/types';
36}
37
38declare module '@material/snackbar/util' {
39 /**
40 * @license
41 * Copyright 2018 Google Inc.
42 *
43 * Permission is hereby granted, free of charge, to any person obtaining a copy
44 * of this software and associated documentation files (the "Software"), to deal
45 * in the Software without restriction, including without limitation the rights
46 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
47 * copies of the Software, and to permit persons to whom the Software is
48 * furnished to do so, subject to the following conditions:
49 *
50 * The above copyright notice and this permission notice shall be included in
51 * all copies or substantial portions of the Software.
52 *
53 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
54 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
55 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
56 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
57 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
58 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
59 * THE SOFTWARE.
60 */
61 function announce(ariaEl: Element, labelEl?: Element): void;
62 export { announce };
63}
64
65declare module '@material/snackbar/adapter' {
66 /**
67 * Defines the shape of the adapter expected by the foundation.
68 * Implement this adapter for your framework of choice to delegate updates to
69 * the component in your framework of choice. See architecture documentation
70 * for more details.
71 * https://github.com/material-components/material-components-web/blob/master/docs/code/architecture.md
72 */
73 export interface MDCSnackbarAdapter {
74 addClass(className: string): void;
75 announce(): void;
76 notifyClosed(reason: string): void;
77 notifyClosing(reason: string): void;
78 notifyOpened(): void;
79 notifyOpening(): void;
80 removeClass(className: string): void;
81 }
82}
83
84declare module '@material/snackbar/component' {
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 { MDCComponent } from '@material/base/component';
108 import { MDCSnackbarFoundation } from '@material/snackbar/foundation';
109 import { MDCSnackbarAnnouncerFactory } from '@material/snackbar/types';
110 export class MDCSnackbar extends MDCComponent<MDCSnackbarFoundation> {
111 static attachTo(root: Element): MDCSnackbar;
112 initialize(announcerFactory?: MDCSnackbarAnnouncerFactory): void;
113 initialSyncWithDOM(): void;
114 destroy(): void;
115 open(): void;
116 /**
117 * @param reason Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the
118 * `event.detail.reason` property. Standard values are REASON_ACTION and REASON_DISMISS, but custom
119 * client-specific values may also be used if desired.
120 */
121 close(reason?: string): void;
122 getDefaultFoundation(): MDCSnackbarFoundation;
123 get timeoutMs(): number;
124 set timeoutMs(timeoutMs: number);
125 get closeOnEscape(): boolean;
126 set closeOnEscape(closeOnEscape: boolean);
127 get isOpen(): boolean;
128 get labelText(): string;
129 set labelText(labelText: string);
130 get actionButtonText(): string;
131 set actionButtonText(actionButtonText: string);
132 }
133}
134
135declare module '@material/snackbar/constants' {
136 /**
137 * @license
138 * Copyright 2018 Google Inc.
139 *
140 * Permission is hereby granted, free of charge, to any person obtaining a copy
141 * of this software and associated documentation files (the "Software"), to deal
142 * in the Software without restriction, including without limitation the rights
143 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
144 * copies of the Software, and to permit persons to whom the Software is
145 * furnished to do so, subject to the following conditions:
146 *
147 * The above copyright notice and this permission notice shall be included in
148 * all copies or substantial portions of the Software.
149 *
150 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
151 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
152 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
153 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
154 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
155 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
156 * THE SOFTWARE.
157 */
158 const cssClasses: {
159 CLOSING: string;
160 OPEN: string;
161 OPENING: string;
162 };
163 const strings: {
164 ACTION_SELECTOR: string;
165 ARIA_LIVE_LABEL_TEXT_ATTR: string;
166 CLOSED_EVENT: string;
167 CLOSING_EVENT: string;
168 DISMISS_SELECTOR: string;
169 LABEL_SELECTOR: string;
170 OPENED_EVENT: string;
171 OPENING_EVENT: string;
172 REASON_ACTION: string;
173 REASON_DISMISS: string;
174 SURFACE_SELECTOR: string;
175 };
176 const numbers: {
177 DEFAULT_AUTO_DISMISS_TIMEOUT_MS: number;
178 INDETERMINATE: number;
179 MAX_AUTO_DISMISS_TIMEOUT_MS: number;
180 MIN_AUTO_DISMISS_TIMEOUT_MS: number;
181 SNACKBAR_ANIMATION_CLOSE_TIME_MS: number;
182 SNACKBAR_ANIMATION_OPEN_TIME_MS: number;
183 /**
184 * Number of milliseconds to wait between temporarily clearing the label text
185 * in the DOM and subsequently restoring it. This is necessary to force IE 11
186 * to pick up the `aria-live` content change and announce it to the user.
187 */
188 ARIA_LIVE_DELAY_MS: number;
189 };
190 export { cssClasses, strings, numbers };
191}
192
193declare module '@material/snackbar/foundation' {
194 /**
195 * @license
196 * Copyright 2018 Google Inc.
197 *
198 * Permission is hereby granted, free of charge, to any person obtaining a copy
199 * of this software and associated documentation files (the "Software"), to deal
200 * in the Software without restriction, including without limitation the rights
201 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
202 * copies of the Software, and to permit persons to whom the Software is
203 * furnished to do so, subject to the following conditions:
204 *
205 * The above copyright notice and this permission notice shall be included in
206 * all copies or substantial portions of the Software.
207 *
208 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
209 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
210 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
211 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
212 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
213 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
214 * THE SOFTWARE.
215 */
216 import { MDCFoundation } from '@material/base/foundation';
217 import { MDCSnackbarAdapter } from '@material/snackbar/adapter';
218 export class MDCSnackbarFoundation extends MDCFoundation<MDCSnackbarAdapter> {
219 static get cssClasses(): {
220 CLOSING: string;
221 OPEN: string;
222 OPENING: string;
223 };
224 static get strings(): {
225 ACTION_SELECTOR: string;
226 ARIA_LIVE_LABEL_TEXT_ATTR: string;
227 CLOSED_EVENT: string;
228 CLOSING_EVENT: string;
229 DISMISS_SELECTOR: string;
230 LABEL_SELECTOR: string;
231 OPENED_EVENT: string;
232 OPENING_EVENT: string;
233 REASON_ACTION: string;
234 REASON_DISMISS: string;
235 SURFACE_SELECTOR: string;
236 };
237 static get numbers(): {
238 DEFAULT_AUTO_DISMISS_TIMEOUT_MS: number;
239 INDETERMINATE: number;
240 MAX_AUTO_DISMISS_TIMEOUT_MS: number;
241 MIN_AUTO_DISMISS_TIMEOUT_MS: number;
242 SNACKBAR_ANIMATION_CLOSE_TIME_MS: number;
243 SNACKBAR_ANIMATION_OPEN_TIME_MS: number;
244 ARIA_LIVE_DELAY_MS: number;
245 };
246 static get defaultAdapter(): MDCSnackbarAdapter;
247 constructor(adapter?: Partial<MDCSnackbarAdapter>);
248 destroy(): void;
249 open(): void;
250 /**
251 * @param reason Why the snackbar was closed. Value will be passed to CLOSING_EVENT and CLOSED_EVENT via the
252 * `event.detail.reason` property. Standard values are REASON_ACTION and REASON_DISMISS, but custom
253 * client-specific values may also be used if desired.
254 */
255 close(reason?: string): void;
256 isOpen(): boolean;
257 getTimeoutMs(): number;
258 setTimeoutMs(timeoutMs: number): void;
259 getCloseOnEscape(): boolean;
260 setCloseOnEscape(closeOnEscape: boolean): void;
261 handleKeyDown(evt: KeyboardEvent): void;
262 handleActionButtonClick(_evt: MouseEvent): void;
263 handleActionIconClick(_evt: MouseEvent): void;
264 }
265 export default MDCSnackbarFoundation;
266}
267
268declare module '@material/snackbar/types' {
269 /**
270 * @license
271 * Copyright 2019 Google Inc.
272 *
273 * Permission is hereby granted, free of charge, to any person obtaining a copy
274 * of this software and associated documentation files (the "Software"), to deal
275 * in the Software without restriction, including without limitation the rights
276 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
277 * copies of the Software, and to permit persons to whom the Software is
278 * furnished to do so, subject to the following conditions:
279 *
280 * The above copyright notice and this permission notice shall be included in
281 * all copies or substantial portions of the Software.
282 *
283 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
284 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
285 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
286 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
287 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
288 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
289 * THE SOFTWARE.
290 */
291 export type MDCSnackbarAnnouncer = (ariaEl: Element, labelEl?: Element) => void;
292 export type MDCSnackbarAnnouncerFactory = () => MDCSnackbarAnnouncer;
293 export interface MDCSnackbarCloseEventDetail {
294 reason?: string;
295 }
296 export interface MDCSnackbarCloseEvent extends Event {
297 readonly detail: MDCSnackbarCloseEventDetail;
298 }
299}
300