1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | (function webpackUniversalModuleDefinition(root, factory) {
|
9 | if(typeof exports === 'object' && typeof module === 'object')
|
10 | module.exports = factory();
|
11 | else if(typeof define === 'function' && define.amd)
|
12 | define("@material/snackbar", [], factory);
|
13 | else if(typeof exports === 'object')
|
14 | exports["snackbar"] = factory();
|
15 | else
|
16 | root["mdc"] = root["mdc"] || {}, root["mdc"]["snackbar"] = factory();
|
17 | })(this, function() {
|
18 | return (function(modules) {
|
19 |
|
20 | var installedModules = {};
|
21 |
|
22 |
|
23 | function __webpack_require__(moduleId) {
|
24 |
|
25 |
|
26 | if(installedModules[moduleId]) {
|
27 | return installedModules[moduleId].exports;
|
28 | }
|
29 |
|
30 | var module = installedModules[moduleId] = {
|
31 | i: moduleId,
|
32 | l: false,
|
33 | exports: {}
|
34 | };
|
35 |
|
36 |
|
37 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
38 |
|
39 |
|
40 | module.l = true;
|
41 |
|
42 |
|
43 | return module.exports;
|
44 | }
|
45 |
|
46 |
|
47 |
|
48 | __webpack_require__.m = modules;
|
49 |
|
50 |
|
51 | __webpack_require__.c = installedModules;
|
52 |
|
53 |
|
54 | __webpack_require__.d = function(exports, name, getter) {
|
55 | if(!__webpack_require__.o(exports, name)) {
|
56 | Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
57 | }
|
58 | };
|
59 |
|
60 |
|
61 | __webpack_require__.r = function(exports) {
|
62 | if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
63 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
64 | }
|
65 | Object.defineProperty(exports, '__esModule', { value: true });
|
66 | };
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 | __webpack_require__.t = function(value, mode) {
|
74 | if(mode & 1) value = __webpack_require__(value);
|
75 | if(mode & 8) return value;
|
76 | if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
77 | var ns = Object.create(null);
|
78 | __webpack_require__.r(ns);
|
79 | Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
80 | if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
81 | return ns;
|
82 | };
|
83 |
|
84 |
|
85 | __webpack_require__.n = function(module) {
|
86 | var getter = module && module.__esModule ?
|
87 | function getDefault() { return module['default']; } :
|
88 | function getModuleExports() { return module; };
|
89 | __webpack_require__.d(getter, 'a', getter);
|
90 | return getter;
|
91 | };
|
92 |
|
93 |
|
94 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
95 |
|
96 |
|
97 | __webpack_require__.p = "";
|
98 |
|
99 |
|
100 |
|
101 | return __webpack_require__(__webpack_require__.s = "./packages/mdc-snackbar/index.ts");
|
102 | })
|
103 |
|
104 | ({
|
105 |
|
106 | "./packages/mdc-base/component.ts":
|
107 |
|
108 |
|
109 |
|
110 |
|
111 | (function(module, exports, __webpack_require__) {
|
112 |
|
113 | "use strict";
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 | var __read = this && this.__read || function (o, n) {
|
139 | var m = typeof Symbol === "function" && o[Symbol.iterator];
|
140 | if (!m) return o;
|
141 | var i = m.call(o),
|
142 | r,
|
143 | ar = [],
|
144 | e;
|
145 | try {
|
146 | while ((n === void 0 || n-- > 0) && !(r = i.next()).done) {
|
147 | ar.push(r.value);
|
148 | }
|
149 | } catch (error) {
|
150 | e = { error: error };
|
151 | } finally {
|
152 | try {
|
153 | if (r && !r.done && (m = i["return"])) m.call(i);
|
154 | } finally {
|
155 | if (e) throw e.error;
|
156 | }
|
157 | }
|
158 | return ar;
|
159 | };
|
160 | var __spreadArray = this && this.__spreadArray || function (to, from) {
|
161 | for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) {
|
162 | to[j] = from[i];
|
163 | }return to;
|
164 | };
|
165 | Object.defineProperty(exports, "__esModule", { value: true });
|
166 | exports.MDCComponent = void 0;
|
167 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
168 | var MDCComponent = function () {
|
169 | function MDCComponent(root, foundation) {
|
170 | var args = [];
|
171 | for (var _i = 2; _i < arguments.length; _i++) {
|
172 | args[_i - 2] = arguments[_i];
|
173 | }
|
174 | this.root = root;
|
175 | this.initialize.apply(this, __spreadArray([], __read(args)));
|
176 |
|
177 |
|
178 |
|
179 | this.foundation = foundation === undefined ? this.getDefaultFoundation() : foundation;
|
180 | this.foundation.init();
|
181 | this.initialSyncWithDOM();
|
182 | }
|
183 | MDCComponent.attachTo = function (root) {
|
184 |
|
185 |
|
186 |
|
187 |
|
188 | return new MDCComponent(root, new foundation_1.MDCFoundation({}));
|
189 | };
|
190 |
|
191 | MDCComponent.prototype.initialize = function () {
|
192 | var _args = [];
|
193 | for (var _i = 0; _i < arguments.length; _i++) {
|
194 | _args[_i] = arguments[_i];
|
195 | }
|
196 |
|
197 |
|
198 |
|
199 | };
|
200 | MDCComponent.prototype.getDefaultFoundation = function () {
|
201 |
|
202 |
|
203 | throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class');
|
204 | };
|
205 | MDCComponent.prototype.initialSyncWithDOM = function () {
|
206 |
|
207 |
|
208 |
|
209 |
|
210 | };
|
211 | MDCComponent.prototype.destroy = function () {
|
212 |
|
213 |
|
214 | this.foundation.destroy();
|
215 | };
|
216 | MDCComponent.prototype.listen = function (evtType, handler, options) {
|
217 | this.root.addEventListener(evtType, handler, options);
|
218 | };
|
219 | MDCComponent.prototype.unlisten = function (evtType, handler, options) {
|
220 | this.root.removeEventListener(evtType, handler, options);
|
221 | };
|
222 | |
223 |
|
224 |
|
225 | MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) {
|
226 | if (shouldBubble === void 0) {
|
227 | shouldBubble = false;
|
228 | }
|
229 | var evt;
|
230 | if (typeof CustomEvent === 'function') {
|
231 | evt = new CustomEvent(evtType, {
|
232 | bubbles: shouldBubble,
|
233 | detail: evtData
|
234 | });
|
235 | } else {
|
236 | evt = document.createEvent('CustomEvent');
|
237 | evt.initCustomEvent(evtType, shouldBubble, false, evtData);
|
238 | }
|
239 | this.root.dispatchEvent(evt);
|
240 | };
|
241 | return MDCComponent;
|
242 | }();
|
243 | exports.MDCComponent = MDCComponent;
|
244 |
|
245 | exports.default = MDCComponent;
|
246 |
|
247 | }),
|
248 |
|
249 | "./packages/mdc-base/foundation.ts":
|
250 |
|
251 |
|
252 |
|
253 |
|
254 | (function(module, exports, __webpack_require__) {
|
255 |
|
256 | "use strict";
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 |
|
280 |
|
281 | Object.defineProperty(exports, "__esModule", { value: true });
|
282 | exports.MDCFoundation = void 0;
|
283 | var MDCFoundation = function () {
|
284 | function MDCFoundation(adapter) {
|
285 | if (adapter === void 0) {
|
286 | adapter = {};
|
287 | }
|
288 | this.adapter = adapter;
|
289 | }
|
290 | Object.defineProperty(MDCFoundation, "cssClasses", {
|
291 | get: function get() {
|
292 |
|
293 |
|
294 | return {};
|
295 | },
|
296 | enumerable: false,
|
297 | configurable: true
|
298 | });
|
299 | Object.defineProperty(MDCFoundation, "strings", {
|
300 | get: function get() {
|
301 |
|
302 |
|
303 | return {};
|
304 | },
|
305 | enumerable: false,
|
306 | configurable: true
|
307 | });
|
308 | Object.defineProperty(MDCFoundation, "numbers", {
|
309 | get: function get() {
|
310 |
|
311 |
|
312 | return {};
|
313 | },
|
314 | enumerable: false,
|
315 | configurable: true
|
316 | });
|
317 | Object.defineProperty(MDCFoundation, "defaultAdapter", {
|
318 | get: function get() {
|
319 |
|
320 |
|
321 |
|
322 | return {};
|
323 | },
|
324 | enumerable: false,
|
325 | configurable: true
|
326 | });
|
327 | MDCFoundation.prototype.init = function () {
|
328 |
|
329 | };
|
330 | MDCFoundation.prototype.destroy = function () {
|
331 |
|
332 | };
|
333 | return MDCFoundation;
|
334 | }();
|
335 | exports.MDCFoundation = MDCFoundation;
|
336 |
|
337 | exports.default = MDCFoundation;
|
338 |
|
339 | }),
|
340 |
|
341 | "./packages/mdc-dom/ponyfill.ts":
|
342 |
|
343 |
|
344 |
|
345 |
|
346 | (function(module, exports, __webpack_require__) {
|
347 |
|
348 | "use strict";
|
349 |
|
350 |
|
351 |
|
352 |
|
353 |
|
354 |
|
355 |
|
356 |
|
357 |
|
358 |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 |
|
372 |
|
373 | Object.defineProperty(exports, "__esModule", { value: true });
|
374 | exports.estimateScrollWidth = exports.matches = exports.closest = void 0;
|
375 |
|
376 |
|
377 |
|
378 |
|
379 | function closest(element, selector) {
|
380 | if (element.closest) {
|
381 | return element.closest(selector);
|
382 | }
|
383 | var el = element;
|
384 | while (el) {
|
385 | if (matches(el, selector)) {
|
386 | return el;
|
387 | }
|
388 | el = el.parentElement;
|
389 | }
|
390 | return null;
|
391 | }
|
392 | exports.closest = closest;
|
393 | function matches(element, selector) {
|
394 | var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector;
|
395 | return nativeMatches.call(element, selector);
|
396 | }
|
397 | exports.matches = matches;
|
398 |
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 |
|
406 | function estimateScrollWidth(element) {
|
407 |
|
408 |
|
409 |
|
410 |
|
411 | var htmlEl = element;
|
412 | if (htmlEl.offsetParent !== null) {
|
413 | return htmlEl.scrollWidth;
|
414 | }
|
415 | var clone = htmlEl.cloneNode(true);
|
416 | clone.style.setProperty('position', 'absolute');
|
417 | clone.style.setProperty('transform', 'translate(-9999px, -9999px)');
|
418 | document.documentElement.appendChild(clone);
|
419 | var scrollWidth = clone.scrollWidth;
|
420 | document.documentElement.removeChild(clone);
|
421 | return scrollWidth;
|
422 | }
|
423 | exports.estimateScrollWidth = estimateScrollWidth;
|
424 |
|
425 | }),
|
426 |
|
427 | "./packages/mdc-snackbar/adapter.ts":
|
428 |
|
429 |
|
430 |
|
431 |
|
432 | (function(module, exports, __webpack_require__) {
|
433 |
|
434 | "use strict";
|
435 |
|
436 |
|
437 |
|
438 |
|
439 |
|
440 |
|
441 |
|
442 |
|
443 |
|
444 |
|
445 |
|
446 |
|
447 |
|
448 |
|
449 |
|
450 |
|
451 |
|
452 |
|
453 |
|
454 |
|
455 |
|
456 |
|
457 |
|
458 |
|
459 | Object.defineProperty(exports, "__esModule", { value: true });
|
460 |
|
461 | }),
|
462 |
|
463 | "./packages/mdc-snackbar/component.ts":
|
464 |
|
465 |
|
466 |
|
467 |
|
468 | (function(module, exports, __webpack_require__) {
|
469 |
|
470 | "use strict";
|
471 |
|
472 |
|
473 |
|
474 |
|
475 |
|
476 |
|
477 |
|
478 |
|
479 |
|
480 |
|
481 |
|
482 |
|
483 |
|
484 |
|
485 |
|
486 |
|
487 |
|
488 |
|
489 |
|
490 |
|
491 |
|
492 |
|
493 |
|
494 |
|
495 | var __extends = this && this.__extends || function () {
|
496 | var _extendStatics = function extendStatics(d, b) {
|
497 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
498 | d.__proto__ = b;
|
499 | } || function (d, b) {
|
500 | for (var p in b) {
|
501 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
502 | }
|
503 | };
|
504 | return _extendStatics(d, b);
|
505 | };
|
506 | return function (d, b) {
|
507 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
508 | _extendStatics(d, b);
|
509 | function __() {
|
510 | this.constructor = d;
|
511 | }
|
512 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
513 | };
|
514 | }();
|
515 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
516 | if (k2 === undefined) k2 = k;
|
517 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
518 | return m[k];
|
519 | } });
|
520 | } : function (o, m, k, k2) {
|
521 | if (k2 === undefined) k2 = k;
|
522 | o[k2] = m[k];
|
523 | });
|
524 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
525 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
526 | } : function (o, v) {
|
527 | o["default"] = v;
|
528 | });
|
529 | var __importStar = this && this.__importStar || function (mod) {
|
530 | if (mod && mod.__esModule) return mod;
|
531 | var result = {};
|
532 | if (mod != null) for (var k in mod) {
|
533 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
534 | }__setModuleDefault(result, mod);
|
535 | return result;
|
536 | };
|
537 | Object.defineProperty(exports, "__esModule", { value: true });
|
538 | exports.MDCSnackbar = void 0;
|
539 | var component_1 = __webpack_require__( "./packages/mdc-base/component.ts");
|
540 | var ponyfill_1 = __webpack_require__( "./packages/mdc-dom/ponyfill.ts");
|
541 | var constants_1 = __webpack_require__( "./packages/mdc-snackbar/constants.ts");
|
542 | var foundation_1 = __webpack_require__( "./packages/mdc-snackbar/foundation.ts");
|
543 | var util = __importStar(__webpack_require__( "./packages/mdc-snackbar/util.ts"));
|
544 | var SURFACE_SELECTOR = constants_1.strings.SURFACE_SELECTOR,
|
545 | LABEL_SELECTOR = constants_1.strings.LABEL_SELECTOR,
|
546 | ACTION_SELECTOR = constants_1.strings.ACTION_SELECTOR,
|
547 | DISMISS_SELECTOR = constants_1.strings.DISMISS_SELECTOR,
|
548 | OPENING_EVENT = constants_1.strings.OPENING_EVENT,
|
549 | OPENED_EVENT = constants_1.strings.OPENED_EVENT,
|
550 | CLOSING_EVENT = constants_1.strings.CLOSING_EVENT,
|
551 | CLOSED_EVENT = constants_1.strings.CLOSED_EVENT;
|
552 | var MDCSnackbar = function (_super) {
|
553 | __extends(MDCSnackbar, _super);
|
554 | function MDCSnackbar() {
|
555 | return _super !== null && _super.apply(this, arguments) || this;
|
556 | }
|
557 | MDCSnackbar.attachTo = function (root) {
|
558 | return new MDCSnackbar(root);
|
559 | };
|
560 | MDCSnackbar.prototype.initialize = function (announcerFactory) {
|
561 | if (announcerFactory === void 0) {
|
562 | announcerFactory = function announcerFactory() {
|
563 | return util.announce;
|
564 | };
|
565 | }
|
566 | this.announce = announcerFactory();
|
567 | };
|
568 | MDCSnackbar.prototype.initialSyncWithDOM = function () {
|
569 | var _this = this;
|
570 | this.surfaceEl = this.root.querySelector(SURFACE_SELECTOR);
|
571 | this.labelEl = this.root.querySelector(LABEL_SELECTOR);
|
572 | this.actionEl = this.root.querySelector(ACTION_SELECTOR);
|
573 | this.handleKeyDown = function (evt) {
|
574 | _this.foundation.handleKeyDown(evt);
|
575 | };
|
576 | this.handleSurfaceClick = function (evt) {
|
577 | var target = evt.target;
|
578 | if (_this.isActionButton(target)) {
|
579 | _this.foundation.handleActionButtonClick(evt);
|
580 | } else if (_this.isActionIcon(target)) {
|
581 | _this.foundation.handleActionIconClick(evt);
|
582 | }
|
583 | };
|
584 | this.registerKeyDownHandler(this.handleKeyDown);
|
585 | this.registerSurfaceClickHandler(this.handleSurfaceClick);
|
586 | };
|
587 | MDCSnackbar.prototype.destroy = function () {
|
588 | _super.prototype.destroy.call(this);
|
589 | this.deregisterKeyDownHandler(this.handleKeyDown);
|
590 | this.deregisterSurfaceClickHandler(this.handleSurfaceClick);
|
591 | };
|
592 | MDCSnackbar.prototype.open = function () {
|
593 | this.foundation.open();
|
594 | };
|
595 | |
596 |
|
597 |
|
598 |
|
599 |
|
600 | MDCSnackbar.prototype.close = function (reason) {
|
601 | if (reason === void 0) {
|
602 | reason = '';
|
603 | }
|
604 | this.foundation.close(reason);
|
605 | };
|
606 | MDCSnackbar.prototype.getDefaultFoundation = function () {
|
607 | var _this = this;
|
608 |
|
609 |
|
610 | var adapter = {
|
611 | addClass: function addClass(className) {
|
612 | _this.root.classList.add(className);
|
613 | },
|
614 | announce: function announce() {
|
615 | _this.announce(_this.labelEl);
|
616 | },
|
617 | notifyClosed: function notifyClosed(reason) {
|
618 | return _this.emit(CLOSED_EVENT, reason ? { reason: reason } : {});
|
619 | },
|
620 | notifyClosing: function notifyClosing(reason) {
|
621 | return _this.emit(CLOSING_EVENT, reason ? { reason: reason } : {});
|
622 | },
|
623 | notifyOpened: function notifyOpened() {
|
624 | return _this.emit(OPENED_EVENT, {});
|
625 | },
|
626 | notifyOpening: function notifyOpening() {
|
627 | return _this.emit(OPENING_EVENT, {});
|
628 | },
|
629 | removeClass: function removeClass(className) {
|
630 | return _this.root.classList.remove(className);
|
631 | }
|
632 | };
|
633 | return new foundation_1.MDCSnackbarFoundation(adapter);
|
634 | };
|
635 | Object.defineProperty(MDCSnackbar.prototype, "timeoutMs", {
|
636 | get: function get() {
|
637 | return this.foundation.getTimeoutMs();
|
638 | },
|
639 | set: function set(timeoutMs) {
|
640 | this.foundation.setTimeoutMs(timeoutMs);
|
641 | },
|
642 | enumerable: false,
|
643 | configurable: true
|
644 | });
|
645 | Object.defineProperty(MDCSnackbar.prototype, "closeOnEscape", {
|
646 | get: function get() {
|
647 | return this.foundation.getCloseOnEscape();
|
648 | },
|
649 | set: function set(closeOnEscape) {
|
650 | this.foundation.setCloseOnEscape(closeOnEscape);
|
651 | },
|
652 | enumerable: false,
|
653 | configurable: true
|
654 | });
|
655 | Object.defineProperty(MDCSnackbar.prototype, "isOpen", {
|
656 | get: function get() {
|
657 | return this.foundation.isOpen();
|
658 | },
|
659 | enumerable: false,
|
660 | configurable: true
|
661 | });
|
662 | Object.defineProperty(MDCSnackbar.prototype, "labelText", {
|
663 | get: function get() {
|
664 |
|
665 |
|
666 | return this.labelEl.textContent;
|
667 | },
|
668 | set: function set(labelText) {
|
669 | this.labelEl.textContent = labelText;
|
670 | },
|
671 | enumerable: false,
|
672 | configurable: true
|
673 | });
|
674 | Object.defineProperty(MDCSnackbar.prototype, "actionButtonText", {
|
675 | get: function get() {
|
676 | return this.actionEl.textContent;
|
677 | },
|
678 | set: function set(actionButtonText) {
|
679 | this.actionEl.textContent = actionButtonText;
|
680 | },
|
681 | enumerable: false,
|
682 | configurable: true
|
683 | });
|
684 | MDCSnackbar.prototype.registerKeyDownHandler = function (handler) {
|
685 | this.listen('keydown', handler);
|
686 | };
|
687 | MDCSnackbar.prototype.deregisterKeyDownHandler = function (handler) {
|
688 | this.unlisten('keydown', handler);
|
689 | };
|
690 | MDCSnackbar.prototype.registerSurfaceClickHandler = function (handler) {
|
691 | this.surfaceEl.addEventListener('click', handler);
|
692 | };
|
693 | MDCSnackbar.prototype.deregisterSurfaceClickHandler = function (handler) {
|
694 | this.surfaceEl.removeEventListener('click', handler);
|
695 | };
|
696 | MDCSnackbar.prototype.isActionButton = function (target) {
|
697 | return Boolean(ponyfill_1.closest(target, ACTION_SELECTOR));
|
698 | };
|
699 | MDCSnackbar.prototype.isActionIcon = function (target) {
|
700 | return Boolean(ponyfill_1.closest(target, DISMISS_SELECTOR));
|
701 | };
|
702 | return MDCSnackbar;
|
703 | }(component_1.MDCComponent);
|
704 | exports.MDCSnackbar = MDCSnackbar;
|
705 |
|
706 | }),
|
707 |
|
708 | "./packages/mdc-snackbar/constants.ts":
|
709 |
|
710 |
|
711 |
|
712 |
|
713 | (function(module, exports, __webpack_require__) {
|
714 |
|
715 | "use strict";
|
716 |
|
717 |
|
718 |
|
719 |
|
720 |
|
721 |
|
722 |
|
723 |
|
724 |
|
725 |
|
726 |
|
727 |
|
728 |
|
729 |
|
730 |
|
731 |
|
732 |
|
733 |
|
734 |
|
735 |
|
736 |
|
737 |
|
738 |
|
739 |
|
740 | Object.defineProperty(exports, "__esModule", { value: true });
|
741 | exports.numbers = exports.strings = exports.cssClasses = void 0;
|
742 | var cssClasses = {
|
743 | CLOSING: 'mdc-snackbar--closing',
|
744 | OPEN: 'mdc-snackbar--open',
|
745 | OPENING: 'mdc-snackbar--opening'
|
746 | };
|
747 | exports.cssClasses = cssClasses;
|
748 | var strings = {
|
749 | ACTION_SELECTOR: '.mdc-snackbar__action',
|
750 | ARIA_LIVE_LABEL_TEXT_ATTR: 'data-mdc-snackbar-label-text',
|
751 | CLOSED_EVENT: 'MDCSnackbar:closed',
|
752 | CLOSING_EVENT: 'MDCSnackbar:closing',
|
753 | DISMISS_SELECTOR: '.mdc-snackbar__dismiss',
|
754 | LABEL_SELECTOR: '.mdc-snackbar__label',
|
755 | OPENED_EVENT: 'MDCSnackbar:opened',
|
756 | OPENING_EVENT: 'MDCSnackbar:opening',
|
757 | REASON_ACTION: 'action',
|
758 | REASON_DISMISS: 'dismiss',
|
759 | SURFACE_SELECTOR: '.mdc-snackbar__surface'
|
760 | };
|
761 | exports.strings = strings;
|
762 | var numbers = {
|
763 | DEFAULT_AUTO_DISMISS_TIMEOUT_MS: 5000,
|
764 | INDETERMINATE: -1,
|
765 | MAX_AUTO_DISMISS_TIMEOUT_MS: 10000,
|
766 | MIN_AUTO_DISMISS_TIMEOUT_MS: 4000,
|
767 |
|
768 | SNACKBAR_ANIMATION_CLOSE_TIME_MS: 75,
|
769 | SNACKBAR_ANIMATION_OPEN_TIME_MS: 150,
|
770 | |
771 |
|
772 |
|
773 |
|
774 |
|
775 | ARIA_LIVE_DELAY_MS: 1000
|
776 | };
|
777 | exports.numbers = numbers;
|
778 |
|
779 | }),
|
780 |
|
781 | "./packages/mdc-snackbar/foundation.ts":
|
782 |
|
783 |
|
784 |
|
785 |
|
786 | (function(module, exports, __webpack_require__) {
|
787 |
|
788 | "use strict";
|
789 |
|
790 |
|
791 |
|
792 |
|
793 |
|
794 |
|
795 |
|
796 |
|
797 |
|
798 |
|
799 |
|
800 |
|
801 |
|
802 |
|
803 |
|
804 |
|
805 |
|
806 |
|
807 |
|
808 |
|
809 |
|
810 |
|
811 |
|
812 |
|
813 | var __extends = this && this.__extends || function () {
|
814 | var _extendStatics = function extendStatics(d, b) {
|
815 | _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
|
816 | d.__proto__ = b;
|
817 | } || function (d, b) {
|
818 | for (var p in b) {
|
819 | if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
820 | }
|
821 | };
|
822 | return _extendStatics(d, b);
|
823 | };
|
824 | return function (d, b) {
|
825 | if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
826 | _extendStatics(d, b);
|
827 | function __() {
|
828 | this.constructor = d;
|
829 | }
|
830 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
831 | };
|
832 | }();
|
833 | var __assign = this && this.__assign || function () {
|
834 | __assign = Object.assign || function (t) {
|
835 | for (var s, i = 1, n = arguments.length; i < n; i++) {
|
836 | s = arguments[i];
|
837 | for (var p in s) {
|
838 | if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
839 | }
|
840 | }
|
841 | return t;
|
842 | };
|
843 | return __assign.apply(this, arguments);
|
844 | };
|
845 | Object.defineProperty(exports, "__esModule", { value: true });
|
846 | exports.MDCSnackbarFoundation = void 0;
|
847 | var foundation_1 = __webpack_require__( "./packages/mdc-base/foundation.ts");
|
848 | var constants_1 = __webpack_require__( "./packages/mdc-snackbar/constants.ts");
|
849 | var OPENING = constants_1.cssClasses.OPENING,
|
850 | OPEN = constants_1.cssClasses.OPEN,
|
851 | CLOSING = constants_1.cssClasses.CLOSING;
|
852 | var REASON_ACTION = constants_1.strings.REASON_ACTION,
|
853 | REASON_DISMISS = constants_1.strings.REASON_DISMISS;
|
854 | var MDCSnackbarFoundation = function (_super) {
|
855 | __extends(MDCSnackbarFoundation, _super);
|
856 | function MDCSnackbarFoundation(adapter) {
|
857 | var _this = _super.call(this, __assign(__assign({}, MDCSnackbarFoundation.defaultAdapter), adapter)) || this;
|
858 | _this.opened = false;
|
859 | _this.animationFrame = 0;
|
860 | _this.animationTimer = 0;
|
861 | _this.autoDismissTimer = 0;
|
862 | _this.autoDismissTimeoutMs = constants_1.numbers.DEFAULT_AUTO_DISMISS_TIMEOUT_MS;
|
863 | _this.closeOnEscape = true;
|
864 | return _this;
|
865 | }
|
866 | Object.defineProperty(MDCSnackbarFoundation, "cssClasses", {
|
867 | get: function get() {
|
868 | return constants_1.cssClasses;
|
869 | },
|
870 | enumerable: false,
|
871 | configurable: true
|
872 | });
|
873 | Object.defineProperty(MDCSnackbarFoundation, "strings", {
|
874 | get: function get() {
|
875 | return constants_1.strings;
|
876 | },
|
877 | enumerable: false,
|
878 | configurable: true
|
879 | });
|
880 | Object.defineProperty(MDCSnackbarFoundation, "numbers", {
|
881 | get: function get() {
|
882 | return constants_1.numbers;
|
883 | },
|
884 | enumerable: false,
|
885 | configurable: true
|
886 | });
|
887 | Object.defineProperty(MDCSnackbarFoundation, "defaultAdapter", {
|
888 | get: function get() {
|
889 | return {
|
890 | addClass: function addClass() {
|
891 | return undefined;
|
892 | },
|
893 | announce: function announce() {
|
894 | return undefined;
|
895 | },
|
896 | notifyClosed: function notifyClosed() {
|
897 | return undefined;
|
898 | },
|
899 | notifyClosing: function notifyClosing() {
|
900 | return undefined;
|
901 | },
|
902 | notifyOpened: function notifyOpened() {
|
903 | return undefined;
|
904 | },
|
905 | notifyOpening: function notifyOpening() {
|
906 | return undefined;
|
907 | },
|
908 | removeClass: function removeClass() {
|
909 | return undefined;
|
910 | }
|
911 | };
|
912 | },
|
913 | enumerable: false,
|
914 | configurable: true
|
915 | });
|
916 | MDCSnackbarFoundation.prototype.destroy = function () {
|
917 | this.clearAutoDismissTimer();
|
918 | cancelAnimationFrame(this.animationFrame);
|
919 | this.animationFrame = 0;
|
920 | clearTimeout(this.animationTimer);
|
921 | this.animationTimer = 0;
|
922 | this.adapter.removeClass(OPENING);
|
923 | this.adapter.removeClass(OPEN);
|
924 | this.adapter.removeClass(CLOSING);
|
925 | };
|
926 | MDCSnackbarFoundation.prototype.open = function () {
|
927 | var _this = this;
|
928 | this.clearAutoDismissTimer();
|
929 | this.opened = true;
|
930 | this.adapter.notifyOpening();
|
931 | this.adapter.removeClass(CLOSING);
|
932 | this.adapter.addClass(OPENING);
|
933 | this.adapter.announce();
|
934 |
|
935 | this.runNextAnimationFrame(function () {
|
936 | _this.adapter.addClass(OPEN);
|
937 | _this.animationTimer = setTimeout(function () {
|
938 | var timeoutMs = _this.getTimeoutMs();
|
939 | _this.handleAnimationTimerEnd();
|
940 | _this.adapter.notifyOpened();
|
941 | if (timeoutMs !== constants_1.numbers.INDETERMINATE) {
|
942 | _this.autoDismissTimer = setTimeout(function () {
|
943 | _this.close(REASON_DISMISS);
|
944 | }, timeoutMs);
|
945 | }
|
946 | }, constants_1.numbers.SNACKBAR_ANIMATION_OPEN_TIME_MS);
|
947 | });
|
948 | };
|
949 | |
950 |
|
951 |
|
952 |
|
953 |
|
954 | MDCSnackbarFoundation.prototype.close = function (reason) {
|
955 | var _this = this;
|
956 | if (reason === void 0) {
|
957 | reason = '';
|
958 | }
|
959 | if (!this.opened) {
|
960 |
|
961 | return;
|
962 | }
|
963 | cancelAnimationFrame(this.animationFrame);
|
964 | this.animationFrame = 0;
|
965 | this.clearAutoDismissTimer();
|
966 | this.opened = false;
|
967 | this.adapter.notifyClosing(reason);
|
968 | this.adapter.addClass(constants_1.cssClasses.CLOSING);
|
969 | this.adapter.removeClass(constants_1.cssClasses.OPEN);
|
970 | this.adapter.removeClass(constants_1.cssClasses.OPENING);
|
971 | clearTimeout(this.animationTimer);
|
972 | this.animationTimer = setTimeout(function () {
|
973 | _this.handleAnimationTimerEnd();
|
974 | _this.adapter.notifyClosed(reason);
|
975 | }, constants_1.numbers.SNACKBAR_ANIMATION_CLOSE_TIME_MS);
|
976 | };
|
977 | MDCSnackbarFoundation.prototype.isOpen = function () {
|
978 | return this.opened;
|
979 | };
|
980 | MDCSnackbarFoundation.prototype.getTimeoutMs = function () {
|
981 | return this.autoDismissTimeoutMs;
|
982 | };
|
983 | MDCSnackbarFoundation.prototype.setTimeoutMs = function (timeoutMs) {
|
984 |
|
985 | var minValue = constants_1.numbers.MIN_AUTO_DISMISS_TIMEOUT_MS;
|
986 | var maxValue = constants_1.numbers.MAX_AUTO_DISMISS_TIMEOUT_MS;
|
987 | var indeterminateValue = constants_1.numbers.INDETERMINATE;
|
988 | if (timeoutMs === constants_1.numbers.INDETERMINATE || timeoutMs <= maxValue && timeoutMs >= minValue) {
|
989 | this.autoDismissTimeoutMs = timeoutMs;
|
990 | } else {
|
991 | throw new Error("\n timeoutMs must be an integer in the range " + minValue + "\u2013" + maxValue + "\n (or " + indeterminateValue + " to disable), but got '" + timeoutMs + "'");
|
992 | }
|
993 | };
|
994 | MDCSnackbarFoundation.prototype.getCloseOnEscape = function () {
|
995 | return this.closeOnEscape;
|
996 | };
|
997 | MDCSnackbarFoundation.prototype.setCloseOnEscape = function (closeOnEscape) {
|
998 | this.closeOnEscape = closeOnEscape;
|
999 | };
|
1000 | MDCSnackbarFoundation.prototype.handleKeyDown = function (evt) {
|
1001 | var isEscapeKey = evt.key === 'Escape' || evt.keyCode === 27;
|
1002 | if (isEscapeKey && this.getCloseOnEscape()) {
|
1003 | this.close(REASON_DISMISS);
|
1004 | }
|
1005 | };
|
1006 | MDCSnackbarFoundation.prototype.handleActionButtonClick = function (_evt) {
|
1007 | this.close(REASON_ACTION);
|
1008 | };
|
1009 | MDCSnackbarFoundation.prototype.handleActionIconClick = function (_evt) {
|
1010 | this.close(REASON_DISMISS);
|
1011 | };
|
1012 | MDCSnackbarFoundation.prototype.clearAutoDismissTimer = function () {
|
1013 | clearTimeout(this.autoDismissTimer);
|
1014 | this.autoDismissTimer = 0;
|
1015 | };
|
1016 | MDCSnackbarFoundation.prototype.handleAnimationTimerEnd = function () {
|
1017 | this.animationTimer = 0;
|
1018 | this.adapter.removeClass(constants_1.cssClasses.OPENING);
|
1019 | this.adapter.removeClass(constants_1.cssClasses.CLOSING);
|
1020 | };
|
1021 | |
1022 |
|
1023 |
|
1024 | MDCSnackbarFoundation.prototype.runNextAnimationFrame = function (callback) {
|
1025 | var _this = this;
|
1026 | cancelAnimationFrame(this.animationFrame);
|
1027 | this.animationFrame = requestAnimationFrame(function () {
|
1028 | _this.animationFrame = 0;
|
1029 | clearTimeout(_this.animationTimer);
|
1030 | _this.animationTimer = setTimeout(callback, 0);
|
1031 | });
|
1032 | };
|
1033 | return MDCSnackbarFoundation;
|
1034 | }(foundation_1.MDCFoundation);
|
1035 | exports.MDCSnackbarFoundation = MDCSnackbarFoundation;
|
1036 |
|
1037 | exports.default = MDCSnackbarFoundation;
|
1038 |
|
1039 | }),
|
1040 |
|
1041 | "./packages/mdc-snackbar/index.ts":
|
1042 |
|
1043 |
|
1044 |
|
1045 |
|
1046 | (function(module, exports, __webpack_require__) {
|
1047 |
|
1048 | "use strict";
|
1049 |
|
1050 |
|
1051 |
|
1052 |
|
1053 |
|
1054 |
|
1055 |
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 |
|
1061 |
|
1062 |
|
1063 |
|
1064 |
|
1065 |
|
1066 |
|
1067 |
|
1068 |
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 | var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
1074 | if (k2 === undefined) k2 = k;
|
1075 | Object.defineProperty(o, k2, { enumerable: true, get: function get() {
|
1076 | return m[k];
|
1077 | } });
|
1078 | } : function (o, m, k, k2) {
|
1079 | if (k2 === undefined) k2 = k;
|
1080 | o[k2] = m[k];
|
1081 | });
|
1082 | var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
|
1083 | Object.defineProperty(o, "default", { enumerable: true, value: v });
|
1084 | } : function (o, v) {
|
1085 | o["default"] = v;
|
1086 | });
|
1087 | var __importStar = this && this.__importStar || function (mod) {
|
1088 | if (mod && mod.__esModule) return mod;
|
1089 | var result = {};
|
1090 | if (mod != null) for (var k in mod) {
|
1091 | if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
1092 | }__setModuleDefault(result, mod);
|
1093 | return result;
|
1094 | };
|
1095 | var __exportStar = this && this.__exportStar || function (m, exports) {
|
1096 | for (var p in m) {
|
1097 | if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
1098 | }
|
1099 | };
|
1100 | Object.defineProperty(exports, "__esModule", { value: true });
|
1101 | exports.util = void 0;
|
1102 | var util = __importStar(__webpack_require__( "./packages/mdc-snackbar/util.ts"));
|
1103 | exports.util = util;
|
1104 | __exportStar(__webpack_require__( "./packages/mdc-snackbar/adapter.ts"), exports);
|
1105 | __exportStar(__webpack_require__( "./packages/mdc-snackbar/component.ts"), exports);
|
1106 | __exportStar(__webpack_require__( "./packages/mdc-snackbar/constants.ts"), exports);
|
1107 | __exportStar(__webpack_require__( "./packages/mdc-snackbar/foundation.ts"), exports);
|
1108 | __exportStar(__webpack_require__( "./packages/mdc-snackbar/types.ts"), exports);
|
1109 |
|
1110 | }),
|
1111 |
|
1112 | "./packages/mdc-snackbar/types.ts":
|
1113 |
|
1114 |
|
1115 |
|
1116 |
|
1117 | (function(module, exports, __webpack_require__) {
|
1118 |
|
1119 | "use strict";
|
1120 |
|
1121 |
|
1122 |
|
1123 |
|
1124 |
|
1125 |
|
1126 |
|
1127 |
|
1128 |
|
1129 |
|
1130 |
|
1131 |
|
1132 |
|
1133 |
|
1134 |
|
1135 |
|
1136 |
|
1137 |
|
1138 |
|
1139 |
|
1140 |
|
1141 |
|
1142 |
|
1143 |
|
1144 | Object.defineProperty(exports, "__esModule", { value: true });
|
1145 |
|
1146 | }),
|
1147 |
|
1148 | "./packages/mdc-snackbar/util.ts":
|
1149 |
|
1150 |
|
1151 |
|
1152 |
|
1153 | (function(module, exports, __webpack_require__) {
|
1154 |
|
1155 | "use strict";
|
1156 |
|
1157 |
|
1158 |
|
1159 |
|
1160 |
|
1161 |
|
1162 |
|
1163 |
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 |
|
1173 |
|
1174 |
|
1175 |
|
1176 |
|
1177 |
|
1178 |
|
1179 |
|
1180 | Object.defineProperty(exports, "__esModule", { value: true });
|
1181 | exports.announce = void 0;
|
1182 | var constants_1 = __webpack_require__( "./packages/mdc-snackbar/constants.ts");
|
1183 | var ARIA_LIVE_DELAY_MS = constants_1.numbers.ARIA_LIVE_DELAY_MS;
|
1184 | var ARIA_LIVE_LABEL_TEXT_ATTR = constants_1.strings.ARIA_LIVE_LABEL_TEXT_ATTR;
|
1185 | function announce(ariaEl, labelEl) {
|
1186 | if (labelEl === void 0) {
|
1187 | labelEl = ariaEl;
|
1188 | }
|
1189 | var priority = ariaEl.getAttribute('aria-live');
|
1190 |
|
1191 |
|
1192 | var labelText = labelEl.textContent.trim();
|
1193 | if (!labelText || !priority) {
|
1194 | return;
|
1195 | }
|
1196 |
|
1197 | ariaEl.setAttribute('aria-live', 'off');
|
1198 |
|
1199 |
|
1200 |
|
1201 |
|
1202 |
|
1203 |
|
1204 |
|
1205 |
|
1206 |
|
1207 |
|
1208 |
|
1209 |
|
1210 |
|
1211 |
|
1212 |
|
1213 |
|
1214 |
|
1215 |
|
1216 |
|
1217 |
|
1218 |
|
1219 |
|
1220 |
|
1221 |
|
1222 |
|
1223 |
|
1224 |
|
1225 | labelEl.textContent = '';
|
1226 | labelEl.innerHTML = '<span style="display: inline-block; width: 0; height: 1px;"> </span>';
|
1227 |
|
1228 |
|
1229 |
|
1230 |
|
1231 | labelEl.setAttribute(ARIA_LIVE_LABEL_TEXT_ATTR, labelText);
|
1232 | setTimeout(function () {
|
1233 |
|
1234 | ariaEl.setAttribute('aria-live', priority);
|
1235 |
|
1236 | labelEl.removeAttribute(ARIA_LIVE_LABEL_TEXT_ATTR);
|
1237 |
|
1238 | labelEl.textContent = labelText;
|
1239 | }, ARIA_LIVE_DELAY_MS);
|
1240 | }
|
1241 | exports.announce = announce;
|
1242 |
|
1243 | })
|
1244 |
|
1245 | });
|
1246 | });
|
1247 |
|
\ | No newline at end of file |