UNPKG

224 kBJavaScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://github.com/material-components/material-components-web/blob/master/LICENSE
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/textfield", [], factory);
13 else if(typeof exports === 'object')
14 exports["textfield"] = factory();
15 else
16 root["mdc"] = root["mdc"] || {}, root["mdc"]["textfield"] = factory();
17})(this, function() {
18return /******/ (function(modules) { // webpackBootstrap
19/******/ // The module cache
20/******/ var installedModules = {};
21/******/
22/******/ // The require function
23/******/ function __webpack_require__(moduleId) {
24/******/
25/******/ // Check if module is in cache
26/******/ if(installedModules[moduleId]) {
27/******/ return installedModules[moduleId].exports;
28/******/ }
29/******/ // Create a new module (and put it into the cache)
30/******/ var module = installedModules[moduleId] = {
31/******/ i: moduleId,
32/******/ l: false,
33/******/ exports: {}
34/******/ };
35/******/
36/******/ // Execute the module function
37/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
38/******/
39/******/ // Flag the module as loaded
40/******/ module.l = true;
41/******/
42/******/ // Return the exports of the module
43/******/ return module.exports;
44/******/ }
45/******/
46/******/
47/******/ // expose the modules object (__webpack_modules__)
48/******/ __webpack_require__.m = modules;
49/******/
50/******/ // expose the module cache
51/******/ __webpack_require__.c = installedModules;
52/******/
53/******/ // define getter function for harmony exports
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/******/ // define __esModule on exports
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/******/ // create a fake namespace object
69/******/ // mode & 1: value is a module id, require it
70/******/ // mode & 2: merge all properties of value into the ns
71/******/ // mode & 4: return value when already ns object
72/******/ // mode & 8|1: behave like require
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/******/ // getDefaultExport function for compatibility with non-harmony modules
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/******/ // Object.prototype.hasOwnProperty.call
94/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
95/******/
96/******/ // __webpack_public_path__
97/******/ __webpack_require__.p = "";
98/******/
99/******/
100/******/ // Load entry module and return exports
101/******/ return __webpack_require__(__webpack_require__.s = "./packages/mdc-textfield/index.ts");
102/******/ })
103/************************************************************************/
104/******/ ({
105
106/***/ "./packages/mdc-base/component.ts":
107/*!****************************************!*\
108 !*** ./packages/mdc-base/component.ts ***!
109 \****************************************/
110/*! no static exports found */
111/***/ (function(module, exports, __webpack_require__) {
112
113"use strict";
114
115/**
116 * @license
117 * Copyright 2016 Google Inc.
118 *
119 * Permission is hereby granted, free of charge, to any person obtaining a copy
120 * of this software and associated documentation files (the "Software"), to deal
121 * in the Software without restriction, including without limitation the rights
122 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
123 * copies of the Software, and to permit persons to whom the Software is
124 * furnished to do so, subject to the following conditions:
125 *
126 * The above copyright notice and this permission notice shall be included in
127 * all copies or substantial portions of the Software.
128 *
129 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
130 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
131 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
132 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
133 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
134 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
135 * THE SOFTWARE.
136 */
137
138var __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};
160var __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};
165Object.defineProperty(exports, "__esModule", { value: true });
166exports.MDCComponent = void 0;
167var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-base/foundation.ts");
168var MDCComponent = /** @class */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 // Note that we initialize foundation here and not within the constructor's
177 // default param so that this.root is defined and can be used within the
178 // foundation class.
179 this.foundation = foundation === undefined ? this.getDefaultFoundation() : foundation;
180 this.foundation.init();
181 this.initialSyncWithDOM();
182 }
183 MDCComponent.attachTo = function (root) {
184 // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and
185 // returns an instantiated component with its root set to that element. Also note that in the cases of
186 // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized
187 // from getDefaultFoundation().
188 return new MDCComponent(root, new foundation_1.MDCFoundation({}));
189 };
190 /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */
191 MDCComponent.prototype.initialize = function () {
192 var _args = [];
193 for (var _i = 0; _i < arguments.length; _i++) {
194 _args[_i] = arguments[_i];
195 }
196 // Subclasses can override this to do any additional setup work that would be considered part of a
197 // "constructor". Essentially, it is a hook into the parent constructor before the foundation is
198 // initialized. Any additional arguments besides root and foundation will be passed in here.
199 };
200 MDCComponent.prototype.getDefaultFoundation = function () {
201 // Subclasses must override this method to return a properly configured foundation class for the
202 // component.
203 throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class');
204 };
205 MDCComponent.prototype.initialSyncWithDOM = function () {
206 // Subclasses should override this method if they need to perform work to synchronize with a host DOM
207 // object. An example of this would be a form control wrapper that needs to synchronize its internal state
208 // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM
209 // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor.
210 };
211 MDCComponent.prototype.destroy = function () {
212 // Subclasses may implement this method to release any resources / deregister any listeners they have
213 // attached. An example of this might be deregistering a resize event from the window object.
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 * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data.
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}();
243exports.MDCComponent = MDCComponent;
244// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
245exports.default = MDCComponent;
246
247/***/ }),
248
249/***/ "./packages/mdc-base/foundation.ts":
250/*!*****************************************!*\
251 !*** ./packages/mdc-base/foundation.ts ***!
252 \*****************************************/
253/*! no static exports found */
254/***/ (function(module, exports, __webpack_require__) {
255
256"use strict";
257
258/**
259 * @license
260 * Copyright 2016 Google Inc.
261 *
262 * Permission is hereby granted, free of charge, to any person obtaining a copy
263 * of this software and associated documentation files (the "Software"), to deal
264 * in the Software without restriction, including without limitation the rights
265 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
266 * copies of the Software, and to permit persons to whom the Software is
267 * furnished to do so, subject to the following conditions:
268 *
269 * The above copyright notice and this permission notice shall be included in
270 * all copies or substantial portions of the Software.
271 *
272 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
273 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
274 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
275 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
276 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
277 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
278 * THE SOFTWARE.
279 */
280
281Object.defineProperty(exports, "__esModule", { value: true });
282exports.MDCFoundation = void 0;
283var MDCFoundation = /** @class */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 // Classes extending MDCFoundation should implement this method to return an object which exports every
293 // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}
294 return {};
295 },
296 enumerable: false,
297 configurable: true
298 });
299 Object.defineProperty(MDCFoundation, "strings", {
300 get: function get() {
301 // Classes extending MDCFoundation should implement this method to return an object which exports all
302 // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
303 return {};
304 },
305 enumerable: false,
306 configurable: true
307 });
308 Object.defineProperty(MDCFoundation, "numbers", {
309 get: function get() {
310 // Classes extending MDCFoundation should implement this method to return an object which exports all
311 // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}
312 return {};
313 },
314 enumerable: false,
315 configurable: true
316 });
317 Object.defineProperty(MDCFoundation, "defaultAdapter", {
318 get: function get() {
319 // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient
320 // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter
321 // validation.
322 return {};
323 },
324 enumerable: false,
325 configurable: true
326 });
327 MDCFoundation.prototype.init = function () {
328 // Subclasses should override this method to perform initialization routines (registering events, etc.)
329 };
330 MDCFoundation.prototype.destroy = function () {
331 // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
332 };
333 return MDCFoundation;
334}();
335exports.MDCFoundation = MDCFoundation;
336// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
337exports.default = MDCFoundation;
338
339/***/ }),
340
341/***/ "./packages/mdc-dom/events.ts":
342/*!************************************!*\
343 !*** ./packages/mdc-dom/events.ts ***!
344 \************************************/
345/*! no static exports found */
346/***/ (function(module, exports, __webpack_require__) {
347
348"use strict";
349
350/**
351 * @license
352 * Copyright 2019 Google Inc.
353 *
354 * Permission is hereby granted, free of charge, to any person obtaining a copy
355 * of this software and associated documentation files (the "Software"), to deal
356 * in the Software without restriction, including without limitation the rights
357 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
358 * copies of the Software, and to permit persons to whom the Software is
359 * furnished to do so, subject to the following conditions:
360 *
361 * The above copyright notice and this permission notice shall be included in
362 * all copies or substantial portions of the Software.
363 *
364 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
365 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
366 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
367 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
368 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
369 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
370 * THE SOFTWARE.
371 */
372
373Object.defineProperty(exports, "__esModule", { value: true });
374exports.applyPassive = void 0;
375/**
376 * Determine whether the current browser supports passive event listeners, and
377 * if so, use them.
378 */
379function applyPassive(globalObj) {
380 if (globalObj === void 0) {
381 globalObj = window;
382 }
383 return supportsPassiveOption(globalObj) ? { passive: true } : false;
384}
385exports.applyPassive = applyPassive;
386function supportsPassiveOption(globalObj) {
387 if (globalObj === void 0) {
388 globalObj = window;
389 }
390 // See
391 // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
392 var passiveSupported = false;
393 try {
394 var options = {
395 // This function will be called when the browser
396 // attempts to access the passive property.
397 get passive() {
398 passiveSupported = true;
399 return false;
400 }
401 };
402 var handler = function handler() {};
403 globalObj.document.addEventListener('test', handler, options);
404 globalObj.document.removeEventListener('test', handler, options);
405 } catch (err) {
406 passiveSupported = false;
407 }
408 return passiveSupported;
409}
410
411/***/ }),
412
413/***/ "./packages/mdc-dom/ponyfill.ts":
414/*!**************************************!*\
415 !*** ./packages/mdc-dom/ponyfill.ts ***!
416 \**************************************/
417/*! no static exports found */
418/***/ (function(module, exports, __webpack_require__) {
419
420"use strict";
421
422/**
423 * @license
424 * Copyright 2018 Google Inc.
425 *
426 * Permission is hereby granted, free of charge, to any person obtaining a copy
427 * of this software and associated documentation files (the "Software"), to deal
428 * in the Software without restriction, including without limitation the rights
429 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
430 * copies of the Software, and to permit persons to whom the Software is
431 * furnished to do so, subject to the following conditions:
432 *
433 * The above copyright notice and this permission notice shall be included in
434 * all copies or substantial portions of the Software.
435 *
436 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
437 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
438 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
439 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
440 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
441 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
442 * THE SOFTWARE.
443 */
444
445Object.defineProperty(exports, "__esModule", { value: true });
446exports.estimateScrollWidth = exports.matches = exports.closest = void 0;
447/**
448 * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain.
449 * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC.
450 */
451function closest(element, selector) {
452 if (element.closest) {
453 return element.closest(selector);
454 }
455 var el = element;
456 while (el) {
457 if (matches(el, selector)) {
458 return el;
459 }
460 el = el.parentElement;
461 }
462 return null;
463}
464exports.closest = closest;
465function matches(element, selector) {
466 var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector;
467 return nativeMatches.call(element, selector);
468}
469exports.matches = matches;
470/**
471 * Used to compute the estimated scroll width of elements. When an element is
472 * hidden due to display: none; being applied to a parent element, the width is
473 * returned as 0. However, the element will have a true width once no longer
474 * inside a display: none context. This method computes an estimated width when
475 * the element is hidden or returns the true width when the element is visble.
476 * @param {Element} element the element whose width to estimate
477 */
478function estimateScrollWidth(element) {
479 // Check the offsetParent. If the element inherits display: none from any
480 // parent, the offsetParent property will be null (see
481 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent).
482 // This check ensures we only clone the node when necessary.
483 var htmlEl = element;
484 if (htmlEl.offsetParent !== null) {
485 return htmlEl.scrollWidth;
486 }
487 var clone = htmlEl.cloneNode(true);
488 clone.style.setProperty('position', 'absolute');
489 clone.style.setProperty('transform', 'translate(-9999px, -9999px)');
490 document.documentElement.appendChild(clone);
491 var scrollWidth = clone.scrollWidth;
492 document.documentElement.removeChild(clone);
493 return scrollWidth;
494}
495exports.estimateScrollWidth = estimateScrollWidth;
496
497/***/ }),
498
499/***/ "./packages/mdc-floating-label/component.ts":
500/*!**************************************************!*\
501 !*** ./packages/mdc-floating-label/component.ts ***!
502 \**************************************************/
503/*! no static exports found */
504/***/ (function(module, exports, __webpack_require__) {
505
506"use strict";
507
508/**
509 * @license
510 * Copyright 2016 Google Inc.
511 *
512 * Permission is hereby granted, free of charge, to any person obtaining a copy
513 * of this software and associated documentation files (the "Software"), to deal
514 * in the Software without restriction, including without limitation the rights
515 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
516 * copies of the Software, and to permit persons to whom the Software is
517 * furnished to do so, subject to the following conditions:
518 *
519 * The above copyright notice and this permission notice shall be included in
520 * all copies or substantial portions of the Software.
521 *
522 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
523 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
524 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
525 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
526 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
527 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
528 * THE SOFTWARE.
529 */
530
531var __extends = this && this.__extends || function () {
532 var _extendStatics = function extendStatics(d, b) {
533 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
534 d.__proto__ = b;
535 } || function (d, b) {
536 for (var p in b) {
537 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
538 }
539 };
540 return _extendStatics(d, b);
541 };
542 return function (d, b) {
543 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
544 _extendStatics(d, b);
545 function __() {
546 this.constructor = d;
547 }
548 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
549 };
550}();
551Object.defineProperty(exports, "__esModule", { value: true });
552exports.MDCFloatingLabel = void 0;
553var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
554var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
555var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-floating-label/foundation.ts");
556var MDCFloatingLabel = /** @class */function (_super) {
557 __extends(MDCFloatingLabel, _super);
558 function MDCFloatingLabel() {
559 return _super !== null && _super.apply(this, arguments) || this;
560 }
561 MDCFloatingLabel.attachTo = function (root) {
562 return new MDCFloatingLabel(root);
563 };
564 /**
565 * Styles the label to produce the label shake for errors.
566 * @param shouldShake If true, shakes the label by adding a CSS class; otherwise, stops shaking by removing the class.
567 */
568 MDCFloatingLabel.prototype.shake = function (shouldShake) {
569 this.foundation.shake(shouldShake);
570 };
571 /**
572 * Styles the label to float/dock.
573 * @param shouldFloat If true, floats the label by adding a CSS class; otherwise, docks it by removing the class.
574 */
575 MDCFloatingLabel.prototype.float = function (shouldFloat) {
576 this.foundation.float(shouldFloat);
577 };
578 /**
579 * Styles the label as required.
580 * @param isRequired If true, adds an asterisk to the label, indicating that it is required.
581 */
582 MDCFloatingLabel.prototype.setRequired = function (isRequired) {
583 this.foundation.setRequired(isRequired);
584 };
585 MDCFloatingLabel.prototype.getWidth = function () {
586 return this.foundation.getWidth();
587 };
588 MDCFloatingLabel.prototype.getDefaultFoundation = function () {
589 var _this = this;
590 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
591 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
592 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
593 var adapter = {
594 addClass: function addClass(className) {
595 return _this.root.classList.add(className);
596 },
597 removeClass: function removeClass(className) {
598 return _this.root.classList.remove(className);
599 },
600 getWidth: function getWidth() {
601 return ponyfill_1.estimateScrollWidth(_this.root);
602 },
603 registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
604 return _this.listen(evtType, handler);
605 },
606 deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
607 return _this.unlisten(evtType, handler);
608 }
609 };
610 // tslint:enable:object-literal-sort-keys
611 return new foundation_1.MDCFloatingLabelFoundation(adapter);
612 };
613 return MDCFloatingLabel;
614}(component_1.MDCComponent);
615exports.MDCFloatingLabel = MDCFloatingLabel;
616
617/***/ }),
618
619/***/ "./packages/mdc-floating-label/constants.ts":
620/*!**************************************************!*\
621 !*** ./packages/mdc-floating-label/constants.ts ***!
622 \**************************************************/
623/*! no static exports found */
624/***/ (function(module, exports, __webpack_require__) {
625
626"use strict";
627
628/**
629 * @license
630 * Copyright 2016 Google Inc.
631 *
632 * Permission is hereby granted, free of charge, to any person obtaining a copy
633 * of this software and associated documentation files (the "Software"), to deal
634 * in the Software without restriction, including without limitation the rights
635 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
636 * copies of the Software, and to permit persons to whom the Software is
637 * furnished to do so, subject to the following conditions:
638 *
639 * The above copyright notice and this permission notice shall be included in
640 * all copies or substantial portions of the Software.
641 *
642 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
643 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
644 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
645 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
646 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
647 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
648 * THE SOFTWARE.
649 */
650
651Object.defineProperty(exports, "__esModule", { value: true });
652exports.cssClasses = void 0;
653exports.cssClasses = {
654 LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above',
655 LABEL_REQUIRED: 'mdc-floating-label--required',
656 LABEL_SHAKE: 'mdc-floating-label--shake',
657 ROOT: 'mdc-floating-label'
658};
659
660/***/ }),
661
662/***/ "./packages/mdc-floating-label/foundation.ts":
663/*!***************************************************!*\
664 !*** ./packages/mdc-floating-label/foundation.ts ***!
665 \***************************************************/
666/*! no static exports found */
667/***/ (function(module, exports, __webpack_require__) {
668
669"use strict";
670
671/**
672 * @license
673 * Copyright 2016 Google Inc.
674 *
675 * Permission is hereby granted, free of charge, to any person obtaining a copy
676 * of this software and associated documentation files (the "Software"), to deal
677 * in the Software without restriction, including without limitation the rights
678 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
679 * copies of the Software, and to permit persons to whom the Software is
680 * furnished to do so, subject to the following conditions:
681 *
682 * The above copyright notice and this permission notice shall be included in
683 * all copies or substantial portions of the Software.
684 *
685 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
686 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
687 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
688 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
689 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
690 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
691 * THE SOFTWARE.
692 */
693
694var __extends = this && this.__extends || function () {
695 var _extendStatics = function extendStatics(d, b) {
696 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
697 d.__proto__ = b;
698 } || function (d, b) {
699 for (var p in b) {
700 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
701 }
702 };
703 return _extendStatics(d, b);
704 };
705 return function (d, b) {
706 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
707 _extendStatics(d, b);
708 function __() {
709 this.constructor = d;
710 }
711 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
712 };
713}();
714var __assign = this && this.__assign || function () {
715 __assign = Object.assign || function (t) {
716 for (var s, i = 1, n = arguments.length; i < n; i++) {
717 s = arguments[i];
718 for (var p in s) {
719 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
720 }
721 }
722 return t;
723 };
724 return __assign.apply(this, arguments);
725};
726Object.defineProperty(exports, "__esModule", { value: true });
727exports.MDCFloatingLabelFoundation = void 0;
728var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
729var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-floating-label/constants.ts");
730var MDCFloatingLabelFoundation = /** @class */function (_super) {
731 __extends(MDCFloatingLabelFoundation, _super);
732 function MDCFloatingLabelFoundation(adapter) {
733 var _this = _super.call(this, __assign(__assign({}, MDCFloatingLabelFoundation.defaultAdapter), adapter)) || this;
734 _this.shakeAnimationEndHandler = function () {
735 _this.handleShakeAnimationEnd();
736 };
737 return _this;
738 }
739 Object.defineProperty(MDCFloatingLabelFoundation, "cssClasses", {
740 get: function get() {
741 return constants_1.cssClasses;
742 },
743 enumerable: false,
744 configurable: true
745 });
746 Object.defineProperty(MDCFloatingLabelFoundation, "defaultAdapter", {
747 /**
748 * See {@link MDCFloatingLabelAdapter} for typing information on parameters and return types.
749 */
750 get: function get() {
751 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
752 return {
753 addClass: function addClass() {
754 return undefined;
755 },
756 removeClass: function removeClass() {
757 return undefined;
758 },
759 getWidth: function getWidth() {
760 return 0;
761 },
762 registerInteractionHandler: function registerInteractionHandler() {
763 return undefined;
764 },
765 deregisterInteractionHandler: function deregisterInteractionHandler() {
766 return undefined;
767 }
768 };
769 // tslint:enable:object-literal-sort-keys
770 },
771 enumerable: false,
772 configurable: true
773 });
774 MDCFloatingLabelFoundation.prototype.init = function () {
775 this.adapter.registerInteractionHandler('animationend', this.shakeAnimationEndHandler);
776 };
777 MDCFloatingLabelFoundation.prototype.destroy = function () {
778 this.adapter.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler);
779 };
780 /**
781 * Returns the width of the label element.
782 */
783 MDCFloatingLabelFoundation.prototype.getWidth = function () {
784 return this.adapter.getWidth();
785 };
786 /**
787 * Styles the label to produce a shake animation to indicate an error.
788 * @param shouldShake If true, adds the shake CSS class; otherwise, removes shake class.
789 */
790 MDCFloatingLabelFoundation.prototype.shake = function (shouldShake) {
791 var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
792 if (shouldShake) {
793 this.adapter.addClass(LABEL_SHAKE);
794 } else {
795 this.adapter.removeClass(LABEL_SHAKE);
796 }
797 };
798 /**
799 * Styles the label to float or dock.
800 * @param shouldFloat If true, adds the float CSS class; otherwise, removes float and shake classes to dock the label.
801 */
802 MDCFloatingLabelFoundation.prototype.float = function (shouldFloat) {
803 var _a = MDCFloatingLabelFoundation.cssClasses,
804 LABEL_FLOAT_ABOVE = _a.LABEL_FLOAT_ABOVE,
805 LABEL_SHAKE = _a.LABEL_SHAKE;
806 if (shouldFloat) {
807 this.adapter.addClass(LABEL_FLOAT_ABOVE);
808 } else {
809 this.adapter.removeClass(LABEL_FLOAT_ABOVE);
810 this.adapter.removeClass(LABEL_SHAKE);
811 }
812 };
813 /**
814 * Styles the label as required.
815 * @param isRequired If true, adds an asterisk to the label, indicating that it is required.
816 */
817 MDCFloatingLabelFoundation.prototype.setRequired = function (isRequired) {
818 var LABEL_REQUIRED = MDCFloatingLabelFoundation.cssClasses.LABEL_REQUIRED;
819 if (isRequired) {
820 this.adapter.addClass(LABEL_REQUIRED);
821 } else {
822 this.adapter.removeClass(LABEL_REQUIRED);
823 }
824 };
825 MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd = function () {
826 var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
827 this.adapter.removeClass(LABEL_SHAKE);
828 };
829 return MDCFloatingLabelFoundation;
830}(foundation_1.MDCFoundation);
831exports.MDCFloatingLabelFoundation = MDCFloatingLabelFoundation;
832// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
833exports.default = MDCFloatingLabelFoundation;
834
835/***/ }),
836
837/***/ "./packages/mdc-line-ripple/component.ts":
838/*!***********************************************!*\
839 !*** ./packages/mdc-line-ripple/component.ts ***!
840 \***********************************************/
841/*! no static exports found */
842/***/ (function(module, exports, __webpack_require__) {
843
844"use strict";
845
846/**
847 * @license
848 * Copyright 2018 Google Inc.
849 *
850 * Permission is hereby granted, free of charge, to any person obtaining a copy
851 * of this software and associated documentation files (the "Software"), to deal
852 * in the Software without restriction, including without limitation the rights
853 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
854 * copies of the Software, and to permit persons to whom the Software is
855 * furnished to do so, subject to the following conditions:
856 *
857 * The above copyright notice and this permission notice shall be included in
858 * all copies or substantial portions of the Software.
859 *
860 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
861 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
862 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
863 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
864 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
865 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
866 * THE SOFTWARE.
867 */
868
869var __extends = this && this.__extends || function () {
870 var _extendStatics = function extendStatics(d, b) {
871 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
872 d.__proto__ = b;
873 } || function (d, b) {
874 for (var p in b) {
875 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
876 }
877 };
878 return _extendStatics(d, b);
879 };
880 return function (d, b) {
881 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
882 _extendStatics(d, b);
883 function __() {
884 this.constructor = d;
885 }
886 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
887 };
888}();
889Object.defineProperty(exports, "__esModule", { value: true });
890exports.MDCLineRipple = void 0;
891var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
892var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-line-ripple/foundation.ts");
893var MDCLineRipple = /** @class */function (_super) {
894 __extends(MDCLineRipple, _super);
895 function MDCLineRipple() {
896 return _super !== null && _super.apply(this, arguments) || this;
897 }
898 MDCLineRipple.attachTo = function (root) {
899 return new MDCLineRipple(root);
900 };
901 /**
902 * Activates the line ripple
903 */
904 MDCLineRipple.prototype.activate = function () {
905 this.foundation.activate();
906 };
907 /**
908 * Deactivates the line ripple
909 */
910 MDCLineRipple.prototype.deactivate = function () {
911 this.foundation.deactivate();
912 };
913 /**
914 * Sets the transform origin given a user's click location.
915 * The `rippleCenter` is the x-coordinate of the middle of the ripple.
916 */
917 MDCLineRipple.prototype.setRippleCenter = function (xCoordinate) {
918 this.foundation.setRippleCenter(xCoordinate);
919 };
920 MDCLineRipple.prototype.getDefaultFoundation = function () {
921 var _this = this;
922 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
923 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
924 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
925 var adapter = {
926 addClass: function addClass(className) {
927 return _this.root.classList.add(className);
928 },
929 removeClass: function removeClass(className) {
930 return _this.root.classList.remove(className);
931 },
932 hasClass: function hasClass(className) {
933 return _this.root.classList.contains(className);
934 },
935 setStyle: function setStyle(propertyName, value) {
936 return _this.root.style.setProperty(propertyName, value);
937 },
938 registerEventHandler: function registerEventHandler(evtType, handler) {
939 return _this.listen(evtType, handler);
940 },
941 deregisterEventHandler: function deregisterEventHandler(evtType, handler) {
942 return _this.unlisten(evtType, handler);
943 }
944 };
945 // tslint:enable:object-literal-sort-keys
946 return new foundation_1.MDCLineRippleFoundation(adapter);
947 };
948 return MDCLineRipple;
949}(component_1.MDCComponent);
950exports.MDCLineRipple = MDCLineRipple;
951
952/***/ }),
953
954/***/ "./packages/mdc-line-ripple/constants.ts":
955/*!***********************************************!*\
956 !*** ./packages/mdc-line-ripple/constants.ts ***!
957 \***********************************************/
958/*! no static exports found */
959/***/ (function(module, exports, __webpack_require__) {
960
961"use strict";
962
963/**
964 * @license
965 * Copyright 2018 Google Inc.
966 *
967 * Permission is hereby granted, free of charge, to any person obtaining a copy
968 * of this software and associated documentation files (the "Software"), to deal
969 * in the Software without restriction, including without limitation the rights
970 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
971 * copies of the Software, and to permit persons to whom the Software is
972 * furnished to do so, subject to the following conditions:
973 *
974 * The above copyright notice and this permission notice shall be included in
975 * all copies or substantial portions of the Software.
976 *
977 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
978 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
979 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
980 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
981 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
982 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
983 * THE SOFTWARE.
984 */
985
986Object.defineProperty(exports, "__esModule", { value: true });
987exports.cssClasses = void 0;
988var cssClasses = {
989 LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active',
990 LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating'
991};
992exports.cssClasses = cssClasses;
993
994/***/ }),
995
996/***/ "./packages/mdc-line-ripple/foundation.ts":
997/*!************************************************!*\
998 !*** ./packages/mdc-line-ripple/foundation.ts ***!
999 \************************************************/
1000/*! no static exports found */
1001/***/ (function(module, exports, __webpack_require__) {
1002
1003"use strict";
1004
1005/**
1006 * @license
1007 * Copyright 2018 Google Inc.
1008 *
1009 * Permission is hereby granted, free of charge, to any person obtaining a copy
1010 * of this software and associated documentation files (the "Software"), to deal
1011 * in the Software without restriction, including without limitation the rights
1012 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1013 * copies of the Software, and to permit persons to whom the Software is
1014 * furnished to do so, subject to the following conditions:
1015 *
1016 * The above copyright notice and this permission notice shall be included in
1017 * all copies or substantial portions of the Software.
1018 *
1019 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1020 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1021 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1022 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1023 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1024 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1025 * THE SOFTWARE.
1026 */
1027
1028var __extends = this && this.__extends || function () {
1029 var _extendStatics = function extendStatics(d, b) {
1030 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
1031 d.__proto__ = b;
1032 } || function (d, b) {
1033 for (var p in b) {
1034 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
1035 }
1036 };
1037 return _extendStatics(d, b);
1038 };
1039 return function (d, b) {
1040 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
1041 _extendStatics(d, b);
1042 function __() {
1043 this.constructor = d;
1044 }
1045 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1046 };
1047}();
1048var __assign = this && this.__assign || function () {
1049 __assign = Object.assign || function (t) {
1050 for (var s, i = 1, n = arguments.length; i < n; i++) {
1051 s = arguments[i];
1052 for (var p in s) {
1053 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
1054 }
1055 }
1056 return t;
1057 };
1058 return __assign.apply(this, arguments);
1059};
1060Object.defineProperty(exports, "__esModule", { value: true });
1061exports.MDCLineRippleFoundation = void 0;
1062var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
1063var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-line-ripple/constants.ts");
1064var MDCLineRippleFoundation = /** @class */function (_super) {
1065 __extends(MDCLineRippleFoundation, _super);
1066 function MDCLineRippleFoundation(adapter) {
1067 var _this = _super.call(this, __assign(__assign({}, MDCLineRippleFoundation.defaultAdapter), adapter)) || this;
1068 _this.transitionEndHandler = function (evt) {
1069 _this.handleTransitionEnd(evt);
1070 };
1071 return _this;
1072 }
1073 Object.defineProperty(MDCLineRippleFoundation, "cssClasses", {
1074 get: function get() {
1075 return constants_1.cssClasses;
1076 },
1077 enumerable: false,
1078 configurable: true
1079 });
1080 Object.defineProperty(MDCLineRippleFoundation, "defaultAdapter", {
1081 /**
1082 * See {@link MDCLineRippleAdapter} for typing information on parameters and return types.
1083 */
1084 get: function get() {
1085 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
1086 return {
1087 addClass: function addClass() {
1088 return undefined;
1089 },
1090 removeClass: function removeClass() {
1091 return undefined;
1092 },
1093 hasClass: function hasClass() {
1094 return false;
1095 },
1096 setStyle: function setStyle() {
1097 return undefined;
1098 },
1099 registerEventHandler: function registerEventHandler() {
1100 return undefined;
1101 },
1102 deregisterEventHandler: function deregisterEventHandler() {
1103 return undefined;
1104 }
1105 };
1106 // tslint:enable:object-literal-sort-keys
1107 },
1108 enumerable: false,
1109 configurable: true
1110 });
1111 MDCLineRippleFoundation.prototype.init = function () {
1112 this.adapter.registerEventHandler('transitionend', this.transitionEndHandler);
1113 };
1114 MDCLineRippleFoundation.prototype.destroy = function () {
1115 this.adapter.deregisterEventHandler('transitionend', this.transitionEndHandler);
1116 };
1117 MDCLineRippleFoundation.prototype.activate = function () {
1118 this.adapter.removeClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
1119 this.adapter.addClass(constants_1.cssClasses.LINE_RIPPLE_ACTIVE);
1120 };
1121 MDCLineRippleFoundation.prototype.setRippleCenter = function (xCoordinate) {
1122 this.adapter.setStyle('transform-origin', xCoordinate + "px center");
1123 };
1124 MDCLineRippleFoundation.prototype.deactivate = function () {
1125 this.adapter.addClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
1126 };
1127 MDCLineRippleFoundation.prototype.handleTransitionEnd = function (evt) {
1128 // Wait for the line ripple to be either transparent or opaque
1129 // before emitting the animation end event
1130 var isDeactivating = this.adapter.hasClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
1131 if (evt.propertyName === 'opacity') {
1132 if (isDeactivating) {
1133 this.adapter.removeClass(constants_1.cssClasses.LINE_RIPPLE_ACTIVE);
1134 this.adapter.removeClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING);
1135 }
1136 }
1137 };
1138 return MDCLineRippleFoundation;
1139}(foundation_1.MDCFoundation);
1140exports.MDCLineRippleFoundation = MDCLineRippleFoundation;
1141// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
1142exports.default = MDCLineRippleFoundation;
1143
1144/***/ }),
1145
1146/***/ "./packages/mdc-notched-outline/component.ts":
1147/*!***************************************************!*\
1148 !*** ./packages/mdc-notched-outline/component.ts ***!
1149 \***************************************************/
1150/*! no static exports found */
1151/***/ (function(module, exports, __webpack_require__) {
1152
1153"use strict";
1154
1155/**
1156 * @license
1157 * Copyright 2017 Google Inc.
1158 *
1159 * Permission is hereby granted, free of charge, to any person obtaining a copy
1160 * of this software and associated documentation files (the "Software"), to deal
1161 * in the Software without restriction, including without limitation the rights
1162 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1163 * copies of the Software, and to permit persons to whom the Software is
1164 * furnished to do so, subject to the following conditions:
1165 *
1166 * The above copyright notice and this permission notice shall be included in
1167 * all copies or substantial portions of the Software.
1168 *
1169 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1170 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1171 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1172 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1173 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1174 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1175 * THE SOFTWARE.
1176 */
1177
1178var __extends = this && this.__extends || function () {
1179 var _extendStatics = function extendStatics(d, b) {
1180 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
1181 d.__proto__ = b;
1182 } || function (d, b) {
1183 for (var p in b) {
1184 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
1185 }
1186 };
1187 return _extendStatics(d, b);
1188 };
1189 return function (d, b) {
1190 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
1191 _extendStatics(d, b);
1192 function __() {
1193 this.constructor = d;
1194 }
1195 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1196 };
1197}();
1198Object.defineProperty(exports, "__esModule", { value: true });
1199exports.MDCNotchedOutline = void 0;
1200var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
1201var foundation_1 = __webpack_require__(/*! @material/floating-label/foundation */ "./packages/mdc-floating-label/foundation.ts");
1202var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts");
1203var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-notched-outline/foundation.ts");
1204var MDCNotchedOutline = /** @class */function (_super) {
1205 __extends(MDCNotchedOutline, _super);
1206 function MDCNotchedOutline() {
1207 return _super !== null && _super.apply(this, arguments) || this;
1208 }
1209 MDCNotchedOutline.attachTo = function (root) {
1210 return new MDCNotchedOutline(root);
1211 };
1212 MDCNotchedOutline.prototype.initialSyncWithDOM = function () {
1213 this.notchElement = this.root.querySelector(constants_1.strings.NOTCH_ELEMENT_SELECTOR);
1214 var label = this.root.querySelector('.' + foundation_1.MDCFloatingLabelFoundation.cssClasses.ROOT);
1215 if (label) {
1216 label.style.transitionDuration = '0s';
1217 this.root.classList.add(constants_1.cssClasses.OUTLINE_UPGRADED);
1218 requestAnimationFrame(function () {
1219 label.style.transitionDuration = '';
1220 });
1221 } else {
1222 this.root.classList.add(constants_1.cssClasses.NO_LABEL);
1223 }
1224 };
1225 /**
1226 * Updates classes and styles to open the notch to the specified width.
1227 * @param notchWidth The notch width in the outline.
1228 */
1229 MDCNotchedOutline.prototype.notch = function (notchWidth) {
1230 this.foundation.notch(notchWidth);
1231 };
1232 /**
1233 * Updates classes and styles to close the notch.
1234 */
1235 MDCNotchedOutline.prototype.closeNotch = function () {
1236 this.foundation.closeNotch();
1237 };
1238 MDCNotchedOutline.prototype.getDefaultFoundation = function () {
1239 var _this = this;
1240 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
1241 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
1242 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
1243 var adapter = {
1244 addClass: function addClass(className) {
1245 return _this.root.classList.add(className);
1246 },
1247 removeClass: function removeClass(className) {
1248 return _this.root.classList.remove(className);
1249 },
1250 setNotchWidthProperty: function setNotchWidthProperty(width) {
1251 _this.notchElement.style.setProperty('width', width + 'px');
1252 },
1253 removeNotchWidthProperty: function removeNotchWidthProperty() {
1254 _this.notchElement.style.removeProperty('width');
1255 }
1256 };
1257 // tslint:enable:object-literal-sort-keys
1258 return new foundation_2.MDCNotchedOutlineFoundation(adapter);
1259 };
1260 return MDCNotchedOutline;
1261}(component_1.MDCComponent);
1262exports.MDCNotchedOutline = MDCNotchedOutline;
1263
1264/***/ }),
1265
1266/***/ "./packages/mdc-notched-outline/constants.ts":
1267/*!***************************************************!*\
1268 !*** ./packages/mdc-notched-outline/constants.ts ***!
1269 \***************************************************/
1270/*! no static exports found */
1271/***/ (function(module, exports, __webpack_require__) {
1272
1273"use strict";
1274
1275/**
1276 * @license
1277 * Copyright 2018 Google Inc.
1278 *
1279 * Permission is hereby granted, free of charge, to any person obtaining a copy
1280 * of this software and associated documentation files (the "Software"), to deal
1281 * in the Software without restriction, including without limitation the rights
1282 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1283 * copies of the Software, and to permit persons to whom the Software is
1284 * furnished to do so, subject to the following conditions:
1285 *
1286 * The above copyright notice and this permission notice shall be included in
1287 * all copies or substantial portions of the Software.
1288 *
1289 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1290 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1291 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1292 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1293 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1294 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1295 * THE SOFTWARE.
1296 */
1297
1298Object.defineProperty(exports, "__esModule", { value: true });
1299exports.strings = exports.numbers = exports.cssClasses = void 0;
1300var strings = {
1301 NOTCH_ELEMENT_SELECTOR: '.mdc-notched-outline__notch'
1302};
1303exports.strings = strings;
1304var numbers = {
1305 // This should stay in sync with $mdc-notched-outline-padding * 2.
1306 NOTCH_ELEMENT_PADDING: 8
1307};
1308exports.numbers = numbers;
1309var cssClasses = {
1310 NO_LABEL: 'mdc-notched-outline--no-label',
1311 OUTLINE_NOTCHED: 'mdc-notched-outline--notched',
1312 OUTLINE_UPGRADED: 'mdc-notched-outline--upgraded'
1313};
1314exports.cssClasses = cssClasses;
1315
1316/***/ }),
1317
1318/***/ "./packages/mdc-notched-outline/foundation.ts":
1319/*!****************************************************!*\
1320 !*** ./packages/mdc-notched-outline/foundation.ts ***!
1321 \****************************************************/
1322/*! no static exports found */
1323/***/ (function(module, exports, __webpack_require__) {
1324
1325"use strict";
1326
1327/**
1328 * @license
1329 * Copyright 2017 Google Inc.
1330 *
1331 * Permission is hereby granted, free of charge, to any person obtaining a copy
1332 * of this software and associated documentation files (the "Software"), to deal
1333 * in the Software without restriction, including without limitation the rights
1334 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1335 * copies of the Software, and to permit persons to whom the Software is
1336 * furnished to do so, subject to the following conditions:
1337 *
1338 * The above copyright notice and this permission notice shall be included in
1339 * all copies or substantial portions of the Software.
1340 *
1341 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1342 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1343 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1344 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1345 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1346 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1347 * THE SOFTWARE.
1348 */
1349
1350var __extends = this && this.__extends || function () {
1351 var _extendStatics = function extendStatics(d, b) {
1352 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
1353 d.__proto__ = b;
1354 } || function (d, b) {
1355 for (var p in b) {
1356 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
1357 }
1358 };
1359 return _extendStatics(d, b);
1360 };
1361 return function (d, b) {
1362 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
1363 _extendStatics(d, b);
1364 function __() {
1365 this.constructor = d;
1366 }
1367 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1368 };
1369}();
1370var __assign = this && this.__assign || function () {
1371 __assign = Object.assign || function (t) {
1372 for (var s, i = 1, n = arguments.length; i < n; i++) {
1373 s = arguments[i];
1374 for (var p in s) {
1375 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
1376 }
1377 }
1378 return t;
1379 };
1380 return __assign.apply(this, arguments);
1381};
1382Object.defineProperty(exports, "__esModule", { value: true });
1383exports.MDCNotchedOutlineFoundation = void 0;
1384var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
1385var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-notched-outline/constants.ts");
1386var MDCNotchedOutlineFoundation = /** @class */function (_super) {
1387 __extends(MDCNotchedOutlineFoundation, _super);
1388 function MDCNotchedOutlineFoundation(adapter) {
1389 return _super.call(this, __assign(__assign({}, MDCNotchedOutlineFoundation.defaultAdapter), adapter)) || this;
1390 }
1391 Object.defineProperty(MDCNotchedOutlineFoundation, "strings", {
1392 get: function get() {
1393 return constants_1.strings;
1394 },
1395 enumerable: false,
1396 configurable: true
1397 });
1398 Object.defineProperty(MDCNotchedOutlineFoundation, "cssClasses", {
1399 get: function get() {
1400 return constants_1.cssClasses;
1401 },
1402 enumerable: false,
1403 configurable: true
1404 });
1405 Object.defineProperty(MDCNotchedOutlineFoundation, "numbers", {
1406 get: function get() {
1407 return constants_1.numbers;
1408 },
1409 enumerable: false,
1410 configurable: true
1411 });
1412 Object.defineProperty(MDCNotchedOutlineFoundation, "defaultAdapter", {
1413 /**
1414 * See {@link MDCNotchedOutlineAdapter} for typing information on parameters and return types.
1415 */
1416 get: function get() {
1417 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
1418 return {
1419 addClass: function addClass() {
1420 return undefined;
1421 },
1422 removeClass: function removeClass() {
1423 return undefined;
1424 },
1425 setNotchWidthProperty: function setNotchWidthProperty() {
1426 return undefined;
1427 },
1428 removeNotchWidthProperty: function removeNotchWidthProperty() {
1429 return undefined;
1430 }
1431 };
1432 // tslint:enable:object-literal-sort-keys
1433 },
1434 enumerable: false,
1435 configurable: true
1436 });
1437 /**
1438 * Adds the outline notched selector and updates the notch width calculated based off of notchWidth.
1439 */
1440 MDCNotchedOutlineFoundation.prototype.notch = function (notchWidth) {
1441 var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
1442 if (notchWidth > 0) {
1443 notchWidth += constants_1.numbers.NOTCH_ELEMENT_PADDING; // Add padding from left/right.
1444 }
1445 this.adapter.setNotchWidthProperty(notchWidth);
1446 this.adapter.addClass(OUTLINE_NOTCHED);
1447 };
1448 /**
1449 * Removes notched outline selector to close the notch in the outline.
1450 */
1451 MDCNotchedOutlineFoundation.prototype.closeNotch = function () {
1452 var OUTLINE_NOTCHED = MDCNotchedOutlineFoundation.cssClasses.OUTLINE_NOTCHED;
1453 this.adapter.removeClass(OUTLINE_NOTCHED);
1454 this.adapter.removeNotchWidthProperty();
1455 };
1456 return MDCNotchedOutlineFoundation;
1457}(foundation_1.MDCFoundation);
1458exports.MDCNotchedOutlineFoundation = MDCNotchedOutlineFoundation;
1459// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
1460exports.default = MDCNotchedOutlineFoundation;
1461
1462/***/ }),
1463
1464/***/ "./packages/mdc-ripple/component.ts":
1465/*!******************************************!*\
1466 !*** ./packages/mdc-ripple/component.ts ***!
1467 \******************************************/
1468/*! no static exports found */
1469/***/ (function(module, exports, __webpack_require__) {
1470
1471"use strict";
1472
1473/**
1474 * @license
1475 * Copyright 2016 Google Inc.
1476 *
1477 * Permission is hereby granted, free of charge, to any person obtaining a copy
1478 * of this software and associated documentation files (the "Software"), to deal
1479 * in the Software without restriction, including without limitation the rights
1480 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1481 * copies of the Software, and to permit persons to whom the Software is
1482 * furnished to do so, subject to the following conditions:
1483 *
1484 * The above copyright notice and this permission notice shall be included in
1485 * all copies or substantial portions of the Software.
1486 *
1487 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1488 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1489 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1490 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1491 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1492 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1493 * THE SOFTWARE.
1494 */
1495
1496var __extends = this && this.__extends || function () {
1497 var _extendStatics = function extendStatics(d, b) {
1498 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
1499 d.__proto__ = b;
1500 } || function (d, b) {
1501 for (var p in b) {
1502 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
1503 }
1504 };
1505 return _extendStatics(d, b);
1506 };
1507 return function (d, b) {
1508 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
1509 _extendStatics(d, b);
1510 function __() {
1511 this.constructor = d;
1512 }
1513 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1514 };
1515}();
1516var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
1517 if (k2 === undefined) k2 = k;
1518 Object.defineProperty(o, k2, { enumerable: true, get: function get() {
1519 return m[k];
1520 } });
1521} : function (o, m, k, k2) {
1522 if (k2 === undefined) k2 = k;
1523 o[k2] = m[k];
1524});
1525var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
1526 Object.defineProperty(o, "default", { enumerable: true, value: v });
1527} : function (o, v) {
1528 o["default"] = v;
1529});
1530var __importStar = this && this.__importStar || function (mod) {
1531 if (mod && mod.__esModule) return mod;
1532 var result = {};
1533 if (mod != null) for (var k in mod) {
1534 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
1535 }__setModuleDefault(result, mod);
1536 return result;
1537};
1538Object.defineProperty(exports, "__esModule", { value: true });
1539exports.MDCRipple = void 0;
1540var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
1541var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
1542var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
1543var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-ripple/foundation.ts");
1544var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts"));
1545var MDCRipple = /** @class */function (_super) {
1546 __extends(MDCRipple, _super);
1547 function MDCRipple() {
1548 var _this = _super !== null && _super.apply(this, arguments) || this;
1549 _this.disabled = false;
1550 return _this;
1551 }
1552 MDCRipple.attachTo = function (root, opts) {
1553 if (opts === void 0) {
1554 opts = {
1555 isUnbounded: undefined
1556 };
1557 }
1558 var ripple = new MDCRipple(root);
1559 // Only override unbounded behavior if option is explicitly specified
1560 if (opts.isUnbounded !== undefined) {
1561 ripple.unbounded = opts.isUnbounded;
1562 }
1563 return ripple;
1564 };
1565 MDCRipple.createAdapter = function (instance) {
1566 return {
1567 addClass: function addClass(className) {
1568 return instance.root.classList.add(className);
1569 },
1570 browserSupportsCssVars: function browserSupportsCssVars() {
1571 return util.supportsCssVariables(window);
1572 },
1573 computeBoundingRect: function computeBoundingRect() {
1574 return instance.root.getBoundingClientRect();
1575 },
1576 containsEventTarget: function containsEventTarget(target) {
1577 return instance.root.contains(target);
1578 },
1579 deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) {
1580 return document.documentElement.removeEventListener(evtType, handler, events_1.applyPassive());
1581 },
1582 deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
1583 return instance.root.removeEventListener(evtType, handler, events_1.applyPassive());
1584 },
1585 deregisterResizeHandler: function deregisterResizeHandler(handler) {
1586 return window.removeEventListener('resize', handler);
1587 },
1588 getWindowPageOffset: function getWindowPageOffset() {
1589 return { x: window.pageXOffset, y: window.pageYOffset };
1590 },
1591 isSurfaceActive: function isSurfaceActive() {
1592 return ponyfill_1.matches(instance.root, ':active');
1593 },
1594 isSurfaceDisabled: function isSurfaceDisabled() {
1595 return Boolean(instance.disabled);
1596 },
1597 isUnbounded: function isUnbounded() {
1598 return Boolean(instance.unbounded);
1599 },
1600 registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) {
1601 return document.documentElement.addEventListener(evtType, handler, events_1.applyPassive());
1602 },
1603 registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
1604 return instance.root.addEventListener(evtType, handler, events_1.applyPassive());
1605 },
1606 registerResizeHandler: function registerResizeHandler(handler) {
1607 return window.addEventListener('resize', handler);
1608 },
1609 removeClass: function removeClass(className) {
1610 return instance.root.classList.remove(className);
1611 },
1612 updateCssVariable: function updateCssVariable(varName, value) {
1613 return instance.root.style.setProperty(varName, value);
1614 }
1615 };
1616 };
1617 Object.defineProperty(MDCRipple.prototype, "unbounded", {
1618 get: function get() {
1619 return Boolean(this.isUnbounded);
1620 },
1621 set: function set(unbounded) {
1622 this.isUnbounded = Boolean(unbounded);
1623 this.setUnbounded();
1624 },
1625 enumerable: false,
1626 configurable: true
1627 });
1628 MDCRipple.prototype.activate = function () {
1629 this.foundation.activate();
1630 };
1631 MDCRipple.prototype.deactivate = function () {
1632 this.foundation.deactivate();
1633 };
1634 MDCRipple.prototype.layout = function () {
1635 this.foundation.layout();
1636 };
1637 MDCRipple.prototype.getDefaultFoundation = function () {
1638 return new foundation_1.MDCRippleFoundation(MDCRipple.createAdapter(this));
1639 };
1640 MDCRipple.prototype.initialSyncWithDOM = function () {
1641 var root = this.root;
1642 this.isUnbounded = 'mdcRippleIsUnbounded' in root.dataset;
1643 };
1644 /**
1645 * Closure Compiler throws an access control error when directly accessing a
1646 * protected or private property inside a getter/setter, like unbounded above.
1647 * By accessing the protected property inside a method, we solve that problem.
1648 * That's why this function exists.
1649 */
1650 MDCRipple.prototype.setUnbounded = function () {
1651 this.foundation.setUnbounded(Boolean(this.isUnbounded));
1652 };
1653 return MDCRipple;
1654}(component_1.MDCComponent);
1655exports.MDCRipple = MDCRipple;
1656
1657/***/ }),
1658
1659/***/ "./packages/mdc-ripple/constants.ts":
1660/*!******************************************!*\
1661 !*** ./packages/mdc-ripple/constants.ts ***!
1662 \******************************************/
1663/*! no static exports found */
1664/***/ (function(module, exports, __webpack_require__) {
1665
1666"use strict";
1667
1668/**
1669 * @license
1670 * Copyright 2016 Google Inc.
1671 *
1672 * Permission is hereby granted, free of charge, to any person obtaining a copy
1673 * of this software and associated documentation files (the "Software"), to deal
1674 * in the Software without restriction, including without limitation the rights
1675 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1676 * copies of the Software, and to permit persons to whom the Software is
1677 * furnished to do so, subject to the following conditions:
1678 *
1679 * The above copyright notice and this permission notice shall be included in
1680 * all copies or substantial portions of the Software.
1681 *
1682 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1683 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1684 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1685 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1686 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1687 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1688 * THE SOFTWARE.
1689 */
1690
1691Object.defineProperty(exports, "__esModule", { value: true });
1692exports.numbers = exports.strings = exports.cssClasses = void 0;
1693exports.cssClasses = {
1694 // Ripple is a special case where the "root" component is really a "mixin" of sorts,
1695 // given that it's an 'upgrade' to an existing component. That being said it is the root
1696 // CSS class that all other CSS classes derive from.
1697 BG_FOCUSED: 'mdc-ripple-upgraded--background-focused',
1698 FG_ACTIVATION: 'mdc-ripple-upgraded--foreground-activation',
1699 FG_DEACTIVATION: 'mdc-ripple-upgraded--foreground-deactivation',
1700 ROOT: 'mdc-ripple-upgraded',
1701 UNBOUNDED: 'mdc-ripple-upgraded--unbounded'
1702};
1703exports.strings = {
1704 VAR_FG_SCALE: '--mdc-ripple-fg-scale',
1705 VAR_FG_SIZE: '--mdc-ripple-fg-size',
1706 VAR_FG_TRANSLATE_END: '--mdc-ripple-fg-translate-end',
1707 VAR_FG_TRANSLATE_START: '--mdc-ripple-fg-translate-start',
1708 VAR_LEFT: '--mdc-ripple-left',
1709 VAR_TOP: '--mdc-ripple-top'
1710};
1711exports.numbers = {
1712 DEACTIVATION_TIMEOUT_MS: 225,
1713 FG_DEACTIVATION_MS: 150,
1714 INITIAL_ORIGIN_SCALE: 0.6,
1715 PADDING: 10,
1716 TAP_DELAY_MS: 300 };
1717
1718/***/ }),
1719
1720/***/ "./packages/mdc-ripple/foundation.ts":
1721/*!*******************************************!*\
1722 !*** ./packages/mdc-ripple/foundation.ts ***!
1723 \*******************************************/
1724/*! no static exports found */
1725/***/ (function(module, exports, __webpack_require__) {
1726
1727"use strict";
1728
1729/**
1730 * @license
1731 * Copyright 2016 Google Inc.
1732 *
1733 * Permission is hereby granted, free of charge, to any person obtaining a copy
1734 * of this software and associated documentation files (the "Software"), to deal
1735 * in the Software without restriction, including without limitation the rights
1736 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1737 * copies of the Software, and to permit persons to whom the Software is
1738 * furnished to do so, subject to the following conditions:
1739 *
1740 * The above copyright notice and this permission notice shall be included in
1741 * all copies or substantial portions of the Software.
1742 *
1743 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1744 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1745 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1746 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1747 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1748 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1749 * THE SOFTWARE.
1750 */
1751
1752var __extends = this && this.__extends || function () {
1753 var _extendStatics = function extendStatics(d, b) {
1754 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
1755 d.__proto__ = b;
1756 } || function (d, b) {
1757 for (var p in b) {
1758 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
1759 }
1760 };
1761 return _extendStatics(d, b);
1762 };
1763 return function (d, b) {
1764 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
1765 _extendStatics(d, b);
1766 function __() {
1767 this.constructor = d;
1768 }
1769 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1770 };
1771}();
1772var __assign = this && this.__assign || function () {
1773 __assign = Object.assign || function (t) {
1774 for (var s, i = 1, n = arguments.length; i < n; i++) {
1775 s = arguments[i];
1776 for (var p in s) {
1777 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
1778 }
1779 }
1780 return t;
1781 };
1782 return __assign.apply(this, arguments);
1783};
1784var __values = this && this.__values || function (o) {
1785 var s = typeof Symbol === "function" && Symbol.iterator,
1786 m = s && o[s],
1787 i = 0;
1788 if (m) return m.call(o);
1789 if (o && typeof o.length === "number") return {
1790 next: function next() {
1791 if (o && i >= o.length) o = void 0;
1792 return { value: o && o[i++], done: !o };
1793 }
1794 };
1795 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
1796};
1797Object.defineProperty(exports, "__esModule", { value: true });
1798exports.MDCRippleFoundation = void 0;
1799var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
1800var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-ripple/constants.ts");
1801var util_1 = __webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts");
1802// Activation events registered on the root element of each instance for activation
1803var ACTIVATION_EVENT_TYPES = ['touchstart', 'pointerdown', 'mousedown', 'keydown'];
1804// Deactivation events registered on documentElement when a pointer-related down event occurs
1805var POINTER_DEACTIVATION_EVENT_TYPES = ['touchend', 'pointerup', 'mouseup', 'contextmenu'];
1806// simultaneous nested activations
1807var activatedTargets = [];
1808var MDCRippleFoundation = /** @class */function (_super) {
1809 __extends(MDCRippleFoundation, _super);
1810 function MDCRippleFoundation(adapter) {
1811 var _this = _super.call(this, __assign(__assign({}, MDCRippleFoundation.defaultAdapter), adapter)) || this;
1812 _this.activationAnimationHasEnded = false;
1813 _this.activationTimer = 0;
1814 _this.fgDeactivationRemovalTimer = 0;
1815 _this.fgScale = '0';
1816 _this.frame = { width: 0, height: 0 };
1817 _this.initialSize = 0;
1818 _this.layoutFrame = 0;
1819 _this.maxRadius = 0;
1820 _this.unboundedCoords = { left: 0, top: 0 };
1821 _this.activationState = _this.defaultActivationState();
1822 _this.activationTimerCallback = function () {
1823 _this.activationAnimationHasEnded = true;
1824 _this.runDeactivationUXLogicIfReady();
1825 };
1826 _this.activateHandler = function (e) {
1827 _this.activateImpl(e);
1828 };
1829 _this.deactivateHandler = function () {
1830 _this.deactivateImpl();
1831 };
1832 _this.focusHandler = function () {
1833 _this.handleFocus();
1834 };
1835 _this.blurHandler = function () {
1836 _this.handleBlur();
1837 };
1838 _this.resizeHandler = function () {
1839 _this.layout();
1840 };
1841 return _this;
1842 }
1843 Object.defineProperty(MDCRippleFoundation, "cssClasses", {
1844 get: function get() {
1845 return constants_1.cssClasses;
1846 },
1847 enumerable: false,
1848 configurable: true
1849 });
1850 Object.defineProperty(MDCRippleFoundation, "strings", {
1851 get: function get() {
1852 return constants_1.strings;
1853 },
1854 enumerable: false,
1855 configurable: true
1856 });
1857 Object.defineProperty(MDCRippleFoundation, "numbers", {
1858 get: function get() {
1859 return constants_1.numbers;
1860 },
1861 enumerable: false,
1862 configurable: true
1863 });
1864 Object.defineProperty(MDCRippleFoundation, "defaultAdapter", {
1865 get: function get() {
1866 return {
1867 addClass: function addClass() {
1868 return undefined;
1869 },
1870 browserSupportsCssVars: function browserSupportsCssVars() {
1871 return true;
1872 },
1873 computeBoundingRect: function computeBoundingRect() {
1874 return { top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 };
1875 },
1876 containsEventTarget: function containsEventTarget() {
1877 return true;
1878 },
1879 deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler() {
1880 return undefined;
1881 },
1882 deregisterInteractionHandler: function deregisterInteractionHandler() {
1883 return undefined;
1884 },
1885 deregisterResizeHandler: function deregisterResizeHandler() {
1886 return undefined;
1887 },
1888 getWindowPageOffset: function getWindowPageOffset() {
1889 return { x: 0, y: 0 };
1890 },
1891 isSurfaceActive: function isSurfaceActive() {
1892 return true;
1893 },
1894 isSurfaceDisabled: function isSurfaceDisabled() {
1895 return true;
1896 },
1897 isUnbounded: function isUnbounded() {
1898 return true;
1899 },
1900 registerDocumentInteractionHandler: function registerDocumentInteractionHandler() {
1901 return undefined;
1902 },
1903 registerInteractionHandler: function registerInteractionHandler() {
1904 return undefined;
1905 },
1906 registerResizeHandler: function registerResizeHandler() {
1907 return undefined;
1908 },
1909 removeClass: function removeClass() {
1910 return undefined;
1911 },
1912 updateCssVariable: function updateCssVariable() {
1913 return undefined;
1914 }
1915 };
1916 },
1917 enumerable: false,
1918 configurable: true
1919 });
1920 MDCRippleFoundation.prototype.init = function () {
1921 var _this = this;
1922 var supportsPressRipple = this.supportsPressRipple();
1923 this.registerRootHandlers(supportsPressRipple);
1924 if (supportsPressRipple) {
1925 var _a = MDCRippleFoundation.cssClasses,
1926 ROOT_1 = _a.ROOT,
1927 UNBOUNDED_1 = _a.UNBOUNDED;
1928 requestAnimationFrame(function () {
1929 _this.adapter.addClass(ROOT_1);
1930 if (_this.adapter.isUnbounded()) {
1931 _this.adapter.addClass(UNBOUNDED_1);
1932 // Unbounded ripples need layout logic applied immediately to set coordinates for both shade and ripple
1933 _this.layoutInternal();
1934 }
1935 });
1936 }
1937 };
1938 MDCRippleFoundation.prototype.destroy = function () {
1939 var _this = this;
1940 if (this.supportsPressRipple()) {
1941 if (this.activationTimer) {
1942 clearTimeout(this.activationTimer);
1943 this.activationTimer = 0;
1944 this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_ACTIVATION);
1945 }
1946 if (this.fgDeactivationRemovalTimer) {
1947 clearTimeout(this.fgDeactivationRemovalTimer);
1948 this.fgDeactivationRemovalTimer = 0;
1949 this.adapter.removeClass(MDCRippleFoundation.cssClasses.FG_DEACTIVATION);
1950 }
1951 var _a = MDCRippleFoundation.cssClasses,
1952 ROOT_2 = _a.ROOT,
1953 UNBOUNDED_2 = _a.UNBOUNDED;
1954 requestAnimationFrame(function () {
1955 _this.adapter.removeClass(ROOT_2);
1956 _this.adapter.removeClass(UNBOUNDED_2);
1957 _this.removeCssVars();
1958 });
1959 }
1960 this.deregisterRootHandlers();
1961 this.deregisterDeactivationHandlers();
1962 };
1963 /**
1964 * @param evt Optional event containing position information.
1965 */
1966 MDCRippleFoundation.prototype.activate = function (evt) {
1967 this.activateImpl(evt);
1968 };
1969 MDCRippleFoundation.prototype.deactivate = function () {
1970 this.deactivateImpl();
1971 };
1972 MDCRippleFoundation.prototype.layout = function () {
1973 var _this = this;
1974 if (this.layoutFrame) {
1975 cancelAnimationFrame(this.layoutFrame);
1976 }
1977 this.layoutFrame = requestAnimationFrame(function () {
1978 _this.layoutInternal();
1979 _this.layoutFrame = 0;
1980 });
1981 };
1982 MDCRippleFoundation.prototype.setUnbounded = function (unbounded) {
1983 var UNBOUNDED = MDCRippleFoundation.cssClasses.UNBOUNDED;
1984 if (unbounded) {
1985 this.adapter.addClass(UNBOUNDED);
1986 } else {
1987 this.adapter.removeClass(UNBOUNDED);
1988 }
1989 };
1990 MDCRippleFoundation.prototype.handleFocus = function () {
1991 var _this = this;
1992 requestAnimationFrame(function () {
1993 return _this.adapter.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
1994 });
1995 };
1996 MDCRippleFoundation.prototype.handleBlur = function () {
1997 var _this = this;
1998 requestAnimationFrame(function () {
1999 return _this.adapter.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
2000 });
2001 };
2002 /**
2003 * We compute this property so that we are not querying information about the client
2004 * until the point in time where the foundation requests it. This prevents scenarios where
2005 * client-side feature-detection may happen too early, such as when components are rendered on the server
2006 * and then initialized at mount time on the client.
2007 */
2008 MDCRippleFoundation.prototype.supportsPressRipple = function () {
2009 return this.adapter.browserSupportsCssVars();
2010 };
2011 MDCRippleFoundation.prototype.defaultActivationState = function () {
2012 return {
2013 activationEvent: undefined,
2014 hasDeactivationUXRun: false,
2015 isActivated: false,
2016 isProgrammatic: false,
2017 wasActivatedByPointer: false,
2018 wasElementMadeActive: false
2019 };
2020 };
2021 /**
2022 * supportsPressRipple Passed from init to save a redundant function call
2023 */
2024 MDCRippleFoundation.prototype.registerRootHandlers = function (supportsPressRipple) {
2025 var e_1, _a;
2026 if (supportsPressRipple) {
2027 try {
2028 for (var ACTIVATION_EVENT_TYPES_1 = __values(ACTIVATION_EVENT_TYPES), ACTIVATION_EVENT_TYPES_1_1 = ACTIVATION_EVENT_TYPES_1.next(); !ACTIVATION_EVENT_TYPES_1_1.done; ACTIVATION_EVENT_TYPES_1_1 = ACTIVATION_EVENT_TYPES_1.next()) {
2029 var evtType = ACTIVATION_EVENT_TYPES_1_1.value;
2030 this.adapter.registerInteractionHandler(evtType, this.activateHandler);
2031 }
2032 } catch (e_1_1) {
2033 e_1 = { error: e_1_1 };
2034 } finally {
2035 try {
2036 if (ACTIVATION_EVENT_TYPES_1_1 && !ACTIVATION_EVENT_TYPES_1_1.done && (_a = ACTIVATION_EVENT_TYPES_1.return)) _a.call(ACTIVATION_EVENT_TYPES_1);
2037 } finally {
2038 if (e_1) throw e_1.error;
2039 }
2040 }
2041 if (this.adapter.isUnbounded()) {
2042 this.adapter.registerResizeHandler(this.resizeHandler);
2043 }
2044 }
2045 this.adapter.registerInteractionHandler('focus', this.focusHandler);
2046 this.adapter.registerInteractionHandler('blur', this.blurHandler);
2047 };
2048 MDCRippleFoundation.prototype.registerDeactivationHandlers = function (evt) {
2049 var e_2, _a;
2050 if (evt.type === 'keydown') {
2051 this.adapter.registerInteractionHandler('keyup', this.deactivateHandler);
2052 } else {
2053 try {
2054 for (var POINTER_DEACTIVATION_EVENT_TYPES_1 = __values(POINTER_DEACTIVATION_EVENT_TYPES), POINTER_DEACTIVATION_EVENT_TYPES_1_1 = POINTER_DEACTIVATION_EVENT_TYPES_1.next(); !POINTER_DEACTIVATION_EVENT_TYPES_1_1.done; POINTER_DEACTIVATION_EVENT_TYPES_1_1 = POINTER_DEACTIVATION_EVENT_TYPES_1.next()) {
2055 var evtType = POINTER_DEACTIVATION_EVENT_TYPES_1_1.value;
2056 this.adapter.registerDocumentInteractionHandler(evtType, this.deactivateHandler);
2057 }
2058 } catch (e_2_1) {
2059 e_2 = { error: e_2_1 };
2060 } finally {
2061 try {
2062 if (POINTER_DEACTIVATION_EVENT_TYPES_1_1 && !POINTER_DEACTIVATION_EVENT_TYPES_1_1.done && (_a = POINTER_DEACTIVATION_EVENT_TYPES_1.return)) _a.call(POINTER_DEACTIVATION_EVENT_TYPES_1);
2063 } finally {
2064 if (e_2) throw e_2.error;
2065 }
2066 }
2067 }
2068 };
2069 MDCRippleFoundation.prototype.deregisterRootHandlers = function () {
2070 var e_3, _a;
2071 try {
2072 for (var ACTIVATION_EVENT_TYPES_2 = __values(ACTIVATION_EVENT_TYPES), ACTIVATION_EVENT_TYPES_2_1 = ACTIVATION_EVENT_TYPES_2.next(); !ACTIVATION_EVENT_TYPES_2_1.done; ACTIVATION_EVENT_TYPES_2_1 = ACTIVATION_EVENT_TYPES_2.next()) {
2073 var evtType = ACTIVATION_EVENT_TYPES_2_1.value;
2074 this.adapter.deregisterInteractionHandler(evtType, this.activateHandler);
2075 }
2076 } catch (e_3_1) {
2077 e_3 = { error: e_3_1 };
2078 } finally {
2079 try {
2080 if (ACTIVATION_EVENT_TYPES_2_1 && !ACTIVATION_EVENT_TYPES_2_1.done && (_a = ACTIVATION_EVENT_TYPES_2.return)) _a.call(ACTIVATION_EVENT_TYPES_2);
2081 } finally {
2082 if (e_3) throw e_3.error;
2083 }
2084 }
2085 this.adapter.deregisterInteractionHandler('focus', this.focusHandler);
2086 this.adapter.deregisterInteractionHandler('blur', this.blurHandler);
2087 if (this.adapter.isUnbounded()) {
2088 this.adapter.deregisterResizeHandler(this.resizeHandler);
2089 }
2090 };
2091 MDCRippleFoundation.prototype.deregisterDeactivationHandlers = function () {
2092 var e_4, _a;
2093 this.adapter.deregisterInteractionHandler('keyup', this.deactivateHandler);
2094 try {
2095 for (var POINTER_DEACTIVATION_EVENT_TYPES_2 = __values(POINTER_DEACTIVATION_EVENT_TYPES), POINTER_DEACTIVATION_EVENT_TYPES_2_1 = POINTER_DEACTIVATION_EVENT_TYPES_2.next(); !POINTER_DEACTIVATION_EVENT_TYPES_2_1.done; POINTER_DEACTIVATION_EVENT_TYPES_2_1 = POINTER_DEACTIVATION_EVENT_TYPES_2.next()) {
2096 var evtType = POINTER_DEACTIVATION_EVENT_TYPES_2_1.value;
2097 this.adapter.deregisterDocumentInteractionHandler(evtType, this.deactivateHandler);
2098 }
2099 } catch (e_4_1) {
2100 e_4 = { error: e_4_1 };
2101 } finally {
2102 try {
2103 if (POINTER_DEACTIVATION_EVENT_TYPES_2_1 && !POINTER_DEACTIVATION_EVENT_TYPES_2_1.done && (_a = POINTER_DEACTIVATION_EVENT_TYPES_2.return)) _a.call(POINTER_DEACTIVATION_EVENT_TYPES_2);
2104 } finally {
2105 if (e_4) throw e_4.error;
2106 }
2107 }
2108 };
2109 MDCRippleFoundation.prototype.removeCssVars = function () {
2110 var _this = this;
2111 var rippleStrings = MDCRippleFoundation.strings;
2112 var keys = Object.keys(rippleStrings);
2113 keys.forEach(function (key) {
2114 if (key.indexOf('VAR_') === 0) {
2115 _this.adapter.updateCssVariable(rippleStrings[key], null);
2116 }
2117 });
2118 };
2119 MDCRippleFoundation.prototype.activateImpl = function (evt) {
2120 var _this = this;
2121 if (this.adapter.isSurfaceDisabled()) {
2122 return;
2123 }
2124 var activationState = this.activationState;
2125 if (activationState.isActivated) {
2126 return;
2127 }
2128 // Avoid reacting to follow-on events fired by touch device after an already-processed user interaction
2129 var previousActivationEvent = this.previousActivationEvent;
2130 var isSameInteraction = previousActivationEvent && evt !== undefined && previousActivationEvent.type !== evt.type;
2131 if (isSameInteraction) {
2132 return;
2133 }
2134 activationState.isActivated = true;
2135 activationState.isProgrammatic = evt === undefined;
2136 activationState.activationEvent = evt;
2137 activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : evt !== undefined && (evt.type === 'mousedown' || evt.type === 'touchstart' || evt.type === 'pointerdown');
2138 var hasActivatedChild = evt !== undefined && activatedTargets.length > 0 && activatedTargets.some(function (target) {
2139 return _this.adapter.containsEventTarget(target);
2140 });
2141 if (hasActivatedChild) {
2142 // Immediately reset activation state, while preserving logic that prevents touch follow-on events
2143 this.resetActivationState();
2144 return;
2145 }
2146 if (evt !== undefined) {
2147 activatedTargets.push(evt.target);
2148 this.registerDeactivationHandlers(evt);
2149 }
2150 activationState.wasElementMadeActive = this.checkElementMadeActive(evt);
2151 if (activationState.wasElementMadeActive) {
2152 this.animateActivation();
2153 }
2154 requestAnimationFrame(function () {
2155 // Reset array on next frame after the current event has had a chance to bubble to prevent ancestor ripples
2156 activatedTargets = [];
2157 if (!activationState.wasElementMadeActive && evt !== undefined && (evt.key === ' ' || evt.keyCode === 32)) {
2158 // If space was pressed, try again within an rAF call to detect :active, because different UAs report
2159 // active states inconsistently when they're called within event handling code:
2160 // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971
2161 // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741
2162 // We try first outside rAF to support Edge, which does not exhibit this problem, but will crash if a CSS
2163 // variable is set within a rAF callback for a submit button interaction (#2241).
2164 activationState.wasElementMadeActive = _this.checkElementMadeActive(evt);
2165 if (activationState.wasElementMadeActive) {
2166 _this.animateActivation();
2167 }
2168 }
2169 if (!activationState.wasElementMadeActive) {
2170 // Reset activation state immediately if element was not made active.
2171 _this.activationState = _this.defaultActivationState();
2172 }
2173 });
2174 };
2175 MDCRippleFoundation.prototype.checkElementMadeActive = function (evt) {
2176 return evt !== undefined && evt.type === 'keydown' ? this.adapter.isSurfaceActive() : true;
2177 };
2178 MDCRippleFoundation.prototype.animateActivation = function () {
2179 var _this = this;
2180 var _a = MDCRippleFoundation.strings,
2181 VAR_FG_TRANSLATE_START = _a.VAR_FG_TRANSLATE_START,
2182 VAR_FG_TRANSLATE_END = _a.VAR_FG_TRANSLATE_END;
2183 var _b = MDCRippleFoundation.cssClasses,
2184 FG_DEACTIVATION = _b.FG_DEACTIVATION,
2185 FG_ACTIVATION = _b.FG_ACTIVATION;
2186 var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
2187 this.layoutInternal();
2188 var translateStart = '';
2189 var translateEnd = '';
2190 if (!this.adapter.isUnbounded()) {
2191 var _c = this.getFgTranslationCoordinates(),
2192 startPoint = _c.startPoint,
2193 endPoint = _c.endPoint;
2194 translateStart = startPoint.x + "px, " + startPoint.y + "px";
2195 translateEnd = endPoint.x + "px, " + endPoint.y + "px";
2196 }
2197 this.adapter.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
2198 this.adapter.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
2199 // Cancel any ongoing activation/deactivation animations
2200 clearTimeout(this.activationTimer);
2201 clearTimeout(this.fgDeactivationRemovalTimer);
2202 this.rmBoundedActivationClasses();
2203 this.adapter.removeClass(FG_DEACTIVATION);
2204 // Force layout in order to re-trigger the animation.
2205 this.adapter.computeBoundingRect();
2206 this.adapter.addClass(FG_ACTIVATION);
2207 this.activationTimer = setTimeout(function () {
2208 _this.activationTimerCallback();
2209 }, DEACTIVATION_TIMEOUT_MS);
2210 };
2211 MDCRippleFoundation.prototype.getFgTranslationCoordinates = function () {
2212 var _a = this.activationState,
2213 activationEvent = _a.activationEvent,
2214 wasActivatedByPointer = _a.wasActivatedByPointer;
2215 var startPoint;
2216 if (wasActivatedByPointer) {
2217 startPoint = util_1.getNormalizedEventCoords(activationEvent, this.adapter.getWindowPageOffset(), this.adapter.computeBoundingRect());
2218 } else {
2219 startPoint = {
2220 x: this.frame.width / 2,
2221 y: this.frame.height / 2
2222 };
2223 }
2224 // Center the element around the start point.
2225 startPoint = {
2226 x: startPoint.x - this.initialSize / 2,
2227 y: startPoint.y - this.initialSize / 2
2228 };
2229 var endPoint = {
2230 x: this.frame.width / 2 - this.initialSize / 2,
2231 y: this.frame.height / 2 - this.initialSize / 2
2232 };
2233 return { startPoint: startPoint, endPoint: endPoint };
2234 };
2235 MDCRippleFoundation.prototype.runDeactivationUXLogicIfReady = function () {
2236 var _this = this;
2237 // This method is called both when a pointing device is released, and when the activation animation ends.
2238 // The deactivation animation should only run after both of those occur.
2239 var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
2240 var _a = this.activationState,
2241 hasDeactivationUXRun = _a.hasDeactivationUXRun,
2242 isActivated = _a.isActivated;
2243 var activationHasEnded = hasDeactivationUXRun || !isActivated;
2244 if (activationHasEnded && this.activationAnimationHasEnded) {
2245 this.rmBoundedActivationClasses();
2246 this.adapter.addClass(FG_DEACTIVATION);
2247 this.fgDeactivationRemovalTimer = setTimeout(function () {
2248 _this.adapter.removeClass(FG_DEACTIVATION);
2249 }, constants_1.numbers.FG_DEACTIVATION_MS);
2250 }
2251 };
2252 MDCRippleFoundation.prototype.rmBoundedActivationClasses = function () {
2253 var FG_ACTIVATION = MDCRippleFoundation.cssClasses.FG_ACTIVATION;
2254 this.adapter.removeClass(FG_ACTIVATION);
2255 this.activationAnimationHasEnded = false;
2256 this.adapter.computeBoundingRect();
2257 };
2258 MDCRippleFoundation.prototype.resetActivationState = function () {
2259 var _this = this;
2260 this.previousActivationEvent = this.activationState.activationEvent;
2261 this.activationState = this.defaultActivationState();
2262 // Touch devices may fire additional events for the same interaction within a short time.
2263 // Store the previous event until it's safe to assume that subsequent events are for new interactions.
2264 setTimeout(function () {
2265 return _this.previousActivationEvent = undefined;
2266 }, MDCRippleFoundation.numbers.TAP_DELAY_MS);
2267 };
2268 MDCRippleFoundation.prototype.deactivateImpl = function () {
2269 var _this = this;
2270 var activationState = this.activationState;
2271 // This can happen in scenarios such as when you have a keyup event that blurs the element.
2272 if (!activationState.isActivated) {
2273 return;
2274 }
2275 var state = __assign({}, activationState);
2276 if (activationState.isProgrammatic) {
2277 requestAnimationFrame(function () {
2278 _this.animateDeactivation(state);
2279 });
2280 this.resetActivationState();
2281 } else {
2282 this.deregisterDeactivationHandlers();
2283 requestAnimationFrame(function () {
2284 _this.activationState.hasDeactivationUXRun = true;
2285 _this.animateDeactivation(state);
2286 _this.resetActivationState();
2287 });
2288 }
2289 };
2290 MDCRippleFoundation.prototype.animateDeactivation = function (_a) {
2291 var wasActivatedByPointer = _a.wasActivatedByPointer,
2292 wasElementMadeActive = _a.wasElementMadeActive;
2293 if (wasActivatedByPointer || wasElementMadeActive) {
2294 this.runDeactivationUXLogicIfReady();
2295 }
2296 };
2297 MDCRippleFoundation.prototype.layoutInternal = function () {
2298 var _this = this;
2299 this.frame = this.adapter.computeBoundingRect();
2300 var maxDim = Math.max(this.frame.height, this.frame.width);
2301 // Surface diameter is treated differently for unbounded vs. bounded ripples.
2302 // Unbounded ripple diameter is calculated smaller since the surface is expected to already be padded appropriately
2303 // to extend the hitbox, and the ripple is expected to meet the edges of the padded hitbox (which is typically
2304 // square). Bounded ripples, on the other hand, are fully expected to expand beyond the surface's longest diameter
2305 // (calculated based on the diagonal plus a constant padding), and are clipped at the surface's border via
2306 // `overflow: hidden`.
2307 var getBoundedRadius = function getBoundedRadius() {
2308 var hypotenuse = Math.sqrt(Math.pow(_this.frame.width, 2) + Math.pow(_this.frame.height, 2));
2309 return hypotenuse + MDCRippleFoundation.numbers.PADDING;
2310 };
2311 this.maxRadius = this.adapter.isUnbounded() ? maxDim : getBoundedRadius();
2312 // Ripple is sized as a fraction of the largest dimension of the surface, then scales up using a CSS scale transform
2313 var initialSize = Math.floor(maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE);
2314 // Unbounded ripple size should always be even number to equally center align.
2315 if (this.adapter.isUnbounded() && initialSize % 2 !== 0) {
2316 this.initialSize = initialSize - 1;
2317 } else {
2318 this.initialSize = initialSize;
2319 }
2320 this.fgScale = "" + this.maxRadius / this.initialSize;
2321 this.updateLayoutCssVars();
2322 };
2323 MDCRippleFoundation.prototype.updateLayoutCssVars = function () {
2324 var _a = MDCRippleFoundation.strings,
2325 VAR_FG_SIZE = _a.VAR_FG_SIZE,
2326 VAR_LEFT = _a.VAR_LEFT,
2327 VAR_TOP = _a.VAR_TOP,
2328 VAR_FG_SCALE = _a.VAR_FG_SCALE;
2329 this.adapter.updateCssVariable(VAR_FG_SIZE, this.initialSize + "px");
2330 this.adapter.updateCssVariable(VAR_FG_SCALE, this.fgScale);
2331 if (this.adapter.isUnbounded()) {
2332 this.unboundedCoords = {
2333 left: Math.round(this.frame.width / 2 - this.initialSize / 2),
2334 top: Math.round(this.frame.height / 2 - this.initialSize / 2)
2335 };
2336 this.adapter.updateCssVariable(VAR_LEFT, this.unboundedCoords.left + "px");
2337 this.adapter.updateCssVariable(VAR_TOP, this.unboundedCoords.top + "px");
2338 }
2339 };
2340 return MDCRippleFoundation;
2341}(foundation_1.MDCFoundation);
2342exports.MDCRippleFoundation = MDCRippleFoundation;
2343// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
2344exports.default = MDCRippleFoundation;
2345
2346/***/ }),
2347
2348/***/ "./packages/mdc-ripple/util.ts":
2349/*!*************************************!*\
2350 !*** ./packages/mdc-ripple/util.ts ***!
2351 \*************************************/
2352/*! no static exports found */
2353/***/ (function(module, exports, __webpack_require__) {
2354
2355"use strict";
2356
2357
2358Object.defineProperty(exports, "__esModule", { value: true });
2359exports.getNormalizedEventCoords = exports.supportsCssVariables = void 0;
2360/**
2361 * Stores result from supportsCssVariables to avoid redundant processing to
2362 * detect CSS custom variable support.
2363 */
2364var supportsCssVariables_;
2365function supportsCssVariables(windowObj, forceRefresh) {
2366 if (forceRefresh === void 0) {
2367 forceRefresh = false;
2368 }
2369 var CSS = windowObj.CSS;
2370 var supportsCssVars = supportsCssVariables_;
2371 if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
2372 return supportsCssVariables_;
2373 }
2374 var supportsFunctionPresent = CSS && typeof CSS.supports === 'function';
2375 if (!supportsFunctionPresent) {
2376 return false;
2377 }
2378 var explicitlySupportsCssVars = CSS.supports('--css-vars', 'yes');
2379 // See: https://bugs.webkit.org/show_bug.cgi?id=154669
2380 // See: README section on Safari
2381 var weAreFeatureDetectingSafari10plus = CSS.supports('(--css-vars: yes)') && CSS.supports('color', '#00000000');
2382 supportsCssVars = explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus;
2383 if (!forceRefresh) {
2384 supportsCssVariables_ = supportsCssVars;
2385 }
2386 return supportsCssVars;
2387}
2388exports.supportsCssVariables = supportsCssVariables;
2389function getNormalizedEventCoords(evt, pageOffset, clientRect) {
2390 if (!evt) {
2391 return { x: 0, y: 0 };
2392 }
2393 var x = pageOffset.x,
2394 y = pageOffset.y;
2395 var documentX = x + clientRect.left;
2396 var documentY = y + clientRect.top;
2397 var normalizedX;
2398 var normalizedY;
2399 // Determine touch point relative to the ripple container.
2400 if (evt.type === 'touchstart') {
2401 var touchEvent = evt;
2402 normalizedX = touchEvent.changedTouches[0].pageX - documentX;
2403 normalizedY = touchEvent.changedTouches[0].pageY - documentY;
2404 } else {
2405 var mouseEvent = evt;
2406 normalizedX = mouseEvent.pageX - documentX;
2407 normalizedY = mouseEvent.pageY - documentY;
2408 }
2409 return { x: normalizedX, y: normalizedY };
2410}
2411exports.getNormalizedEventCoords = getNormalizedEventCoords;
2412
2413/***/ }),
2414
2415/***/ "./packages/mdc-textfield/adapter.ts":
2416/*!*******************************************!*\
2417 !*** ./packages/mdc-textfield/adapter.ts ***!
2418 \*******************************************/
2419/*! no static exports found */
2420/***/ (function(module, exports, __webpack_require__) {
2421
2422"use strict";
2423
2424/**
2425 * @license
2426 * Copyright 2017 Google Inc.
2427 *
2428 * Permission is hereby granted, free of charge, to any person obtaining a copy
2429 * of this software and associated documentation files (the "Software"), to deal
2430 * in the Software without restriction, including without limitation the rights
2431 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2432 * copies of the Software, and to permit persons to whom the Software is
2433 * furnished to do so, subject to the following conditions:
2434 *
2435 * The above copyright notice and this permission notice shall be included in
2436 * all copies or substantial portions of the Software.
2437 *
2438 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2439 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2440 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2441 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2442 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2443 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2444 * THE SOFTWARE.
2445 */
2446
2447Object.defineProperty(exports, "__esModule", { value: true });
2448
2449/***/ }),
2450
2451/***/ "./packages/mdc-textfield/character-counter/adapter.ts":
2452/*!*************************************************************!*\
2453 !*** ./packages/mdc-textfield/character-counter/adapter.ts ***!
2454 \*************************************************************/
2455/*! no static exports found */
2456/***/ (function(module, exports, __webpack_require__) {
2457
2458"use strict";
2459
2460/**
2461 * @license
2462 * Copyright 2019 Google Inc.
2463 *
2464 * Permission is hereby granted, free of charge, to any person obtaining a copy
2465 * of this software and associated documentation files (the "Software"), to deal
2466 * in the Software without restriction, including without limitation the rights
2467 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2468 * copies of the Software, and to permit persons to whom the Software is
2469 * furnished to do so, subject to the following conditions:
2470 *
2471 * The above copyright notice and this permission notice shall be included in
2472 * all copies or substantial portions of the Software.
2473 *
2474 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2475 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2476 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2477 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2478 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2479 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2480 * THE SOFTWARE.
2481 */
2482
2483Object.defineProperty(exports, "__esModule", { value: true });
2484
2485/***/ }),
2486
2487/***/ "./packages/mdc-textfield/character-counter/component.ts":
2488/*!***************************************************************!*\
2489 !*** ./packages/mdc-textfield/character-counter/component.ts ***!
2490 \***************************************************************/
2491/*! no static exports found */
2492/***/ (function(module, exports, __webpack_require__) {
2493
2494"use strict";
2495
2496/**
2497 * @license
2498 * Copyright 2019 Google Inc.
2499 *
2500 * Permission is hereby granted, free of charge, to any person obtaining a copy
2501 * of this software and associated documentation files (the "Software"), to deal
2502 * in the Software without restriction, including without limitation the rights
2503 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2504 * copies of the Software, and to permit persons to whom the Software is
2505 * furnished to do so, subject to the following conditions:
2506 *
2507 * The above copyright notice and this permission notice shall be included in
2508 * all copies or substantial portions of the Software.
2509 *
2510 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2511 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2512 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2513 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2514 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2515 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2516 * THE SOFTWARE.
2517 */
2518
2519var __extends = this && this.__extends || function () {
2520 var _extendStatics = function extendStatics(d, b) {
2521 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
2522 d.__proto__ = b;
2523 } || function (d, b) {
2524 for (var p in b) {
2525 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
2526 }
2527 };
2528 return _extendStatics(d, b);
2529 };
2530 return function (d, b) {
2531 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
2532 _extendStatics(d, b);
2533 function __() {
2534 this.constructor = d;
2535 }
2536 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
2537 };
2538}();
2539Object.defineProperty(exports, "__esModule", { value: true });
2540exports.MDCTextFieldCharacterCounter = void 0;
2541var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
2542var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/character-counter/foundation.ts");
2543var MDCTextFieldCharacterCounter = /** @class */function (_super) {
2544 __extends(MDCTextFieldCharacterCounter, _super);
2545 function MDCTextFieldCharacterCounter() {
2546 return _super !== null && _super.apply(this, arguments) || this;
2547 }
2548 MDCTextFieldCharacterCounter.attachTo = function (root) {
2549 return new MDCTextFieldCharacterCounter(root);
2550 };
2551 Object.defineProperty(MDCTextFieldCharacterCounter.prototype, "foundationForTextField", {
2552 // Provided for access by MDCTextField component
2553 get: function get() {
2554 return this.foundation;
2555 },
2556 enumerable: false,
2557 configurable: true
2558 });
2559 MDCTextFieldCharacterCounter.prototype.getDefaultFoundation = function () {
2560 var _this = this;
2561 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
2562 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
2563 var adapter = {
2564 setContent: function setContent(content) {
2565 _this.root.textContent = content;
2566 }
2567 };
2568 return new foundation_1.MDCTextFieldCharacterCounterFoundation(adapter);
2569 };
2570 return MDCTextFieldCharacterCounter;
2571}(component_1.MDCComponent);
2572exports.MDCTextFieldCharacterCounter = MDCTextFieldCharacterCounter;
2573
2574/***/ }),
2575
2576/***/ "./packages/mdc-textfield/character-counter/constants.ts":
2577/*!***************************************************************!*\
2578 !*** ./packages/mdc-textfield/character-counter/constants.ts ***!
2579 \***************************************************************/
2580/*! no static exports found */
2581/***/ (function(module, exports, __webpack_require__) {
2582
2583"use strict";
2584
2585/**
2586 * @license
2587 * Copyright 2019 Google Inc.
2588 *
2589 * Permission is hereby granted, free of charge, to any person obtaining a copy
2590 * of this software and associated documentation files (the "Software"), to deal
2591 * in the Software without restriction, including without limitation the rights
2592 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2593 * copies of the Software, and to permit persons to whom the Software is
2594 * furnished to do so, subject to the following conditions:
2595 *
2596 * The above copyright notice and this permission notice shall be included in
2597 * all copies or substantial portions of the Software.
2598 *
2599 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2600 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2601 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2602 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2603 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2604 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2605 * THE SOFTWARE.
2606 */
2607
2608Object.defineProperty(exports, "__esModule", { value: true });
2609exports.cssClasses = exports.strings = void 0;
2610var cssClasses = {
2611 ROOT: 'mdc-text-field-character-counter'
2612};
2613exports.cssClasses = cssClasses;
2614var strings = {
2615 ROOT_SELECTOR: "." + cssClasses.ROOT
2616};
2617exports.strings = strings;
2618
2619/***/ }),
2620
2621/***/ "./packages/mdc-textfield/character-counter/foundation.ts":
2622/*!****************************************************************!*\
2623 !*** ./packages/mdc-textfield/character-counter/foundation.ts ***!
2624 \****************************************************************/
2625/*! no static exports found */
2626/***/ (function(module, exports, __webpack_require__) {
2627
2628"use strict";
2629
2630/**
2631 * @license
2632 * Copyright 2019 Google Inc.
2633 *
2634 * Permission is hereby granted, free of charge, to any person obtaining a copy
2635 * of this software and associated documentation files (the "Software"), to deal
2636 * in the Software without restriction, including without limitation the rights
2637 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2638 * copies of the Software, and to permit persons to whom the Software is
2639 * furnished to do so, subject to the following conditions:
2640 *
2641 * The above copyright notice and this permission notice shall be included in
2642 * all copies or substantial portions of the Software.
2643 *
2644 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2645 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2646 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2647 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2648 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2649 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2650 * THE SOFTWARE.
2651 */
2652
2653var __extends = this && this.__extends || function () {
2654 var _extendStatics = function extendStatics(d, b) {
2655 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
2656 d.__proto__ = b;
2657 } || function (d, b) {
2658 for (var p in b) {
2659 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
2660 }
2661 };
2662 return _extendStatics(d, b);
2663 };
2664 return function (d, b) {
2665 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
2666 _extendStatics(d, b);
2667 function __() {
2668 this.constructor = d;
2669 }
2670 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
2671 };
2672}();
2673var __assign = this && this.__assign || function () {
2674 __assign = Object.assign || function (t) {
2675 for (var s, i = 1, n = arguments.length; i < n; i++) {
2676 s = arguments[i];
2677 for (var p in s) {
2678 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
2679 }
2680 }
2681 return t;
2682 };
2683 return __assign.apply(this, arguments);
2684};
2685Object.defineProperty(exports, "__esModule", { value: true });
2686exports.MDCTextFieldCharacterCounterFoundation = void 0;
2687var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
2688var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/character-counter/constants.ts");
2689var MDCTextFieldCharacterCounterFoundation = /** @class */function (_super) {
2690 __extends(MDCTextFieldCharacterCounterFoundation, _super);
2691 function MDCTextFieldCharacterCounterFoundation(adapter) {
2692 return _super.call(this, __assign(__assign({}, MDCTextFieldCharacterCounterFoundation.defaultAdapter), adapter)) || this;
2693 }
2694 Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "cssClasses", {
2695 get: function get() {
2696 return constants_1.cssClasses;
2697 },
2698 enumerable: false,
2699 configurable: true
2700 });
2701 Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "strings", {
2702 get: function get() {
2703 return constants_1.strings;
2704 },
2705 enumerable: false,
2706 configurable: true
2707 });
2708 Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "defaultAdapter", {
2709 /**
2710 * See {@link MDCTextFieldCharacterCounterAdapter} for typing information on parameters and return types.
2711 */
2712 get: function get() {
2713 return {
2714 setContent: function setContent() {
2715 return undefined;
2716 }
2717 };
2718 },
2719 enumerable: false,
2720 configurable: true
2721 });
2722 MDCTextFieldCharacterCounterFoundation.prototype.setCounterValue = function (currentLength, maxLength) {
2723 currentLength = Math.min(currentLength, maxLength);
2724 this.adapter.setContent(currentLength + " / " + maxLength);
2725 };
2726 return MDCTextFieldCharacterCounterFoundation;
2727}(foundation_1.MDCFoundation);
2728exports.MDCTextFieldCharacterCounterFoundation = MDCTextFieldCharacterCounterFoundation;
2729// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
2730exports.default = MDCTextFieldCharacterCounterFoundation;
2731
2732/***/ }),
2733
2734/***/ "./packages/mdc-textfield/character-counter/index.ts":
2735/*!***********************************************************!*\
2736 !*** ./packages/mdc-textfield/character-counter/index.ts ***!
2737 \***********************************************************/
2738/*! no static exports found */
2739/***/ (function(module, exports, __webpack_require__) {
2740
2741"use strict";
2742
2743/**
2744 * @license
2745 * Copyright 2019 Google Inc.
2746 *
2747 * Permission is hereby granted, free of charge, to any person obtaining a copy
2748 * of this software and associated documentation files (the "Software"), to deal
2749 * in the Software without restriction, including without limitation the rights
2750 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2751 * copies of the Software, and to permit persons to whom the Software is
2752 * furnished to do so, subject to the following conditions:
2753 *
2754 * The above copyright notice and this permission notice shall be included in
2755 * all copies or substantial portions of the Software.
2756 *
2757 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2758 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2759 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2760 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2761 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2762 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2763 * THE SOFTWARE.
2764 */
2765
2766var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
2767 if (k2 === undefined) k2 = k;
2768 Object.defineProperty(o, k2, { enumerable: true, get: function get() {
2769 return m[k];
2770 } });
2771} : function (o, m, k, k2) {
2772 if (k2 === undefined) k2 = k;
2773 o[k2] = m[k];
2774});
2775var __exportStar = this && this.__exportStar || function (m, exports) {
2776 for (var p in m) {
2777 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2778 }
2779};
2780Object.defineProperty(exports, "__esModule", { value: true });
2781exports.characterCountStrings = exports.characterCountCssClasses = void 0;
2782__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-textfield/character-counter/adapter.ts"), exports);
2783__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/character-counter/component.ts"), exports);
2784__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/character-counter/foundation.ts"), exports);
2785var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/character-counter/constants.ts");
2786Object.defineProperty(exports, "characterCountCssClasses", { enumerable: true, get: function get() {
2787 return constants_1.cssClasses;
2788 } });
2789Object.defineProperty(exports, "characterCountStrings", { enumerable: true, get: function get() {
2790 return constants_1.strings;
2791 } });
2792
2793/***/ }),
2794
2795/***/ "./packages/mdc-textfield/component.ts":
2796/*!*********************************************!*\
2797 !*** ./packages/mdc-textfield/component.ts ***!
2798 \*********************************************/
2799/*! no static exports found */
2800/***/ (function(module, exports, __webpack_require__) {
2801
2802"use strict";
2803
2804/**
2805 * @license
2806 * Copyright 2016 Google Inc.
2807 *
2808 * Permission is hereby granted, free of charge, to any person obtaining a copy
2809 * of this software and associated documentation files (the "Software"), to deal
2810 * in the Software without restriction, including without limitation the rights
2811 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
2812 * copies of the Software, and to permit persons to whom the Software is
2813 * furnished to do so, subject to the following conditions:
2814 *
2815 * The above copyright notice and this permission notice shall be included in
2816 * all copies or substantial portions of the Software.
2817 *
2818 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
2819 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
2820 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2821 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
2822 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2823 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2824 * THE SOFTWARE.
2825 */
2826
2827var __extends = this && this.__extends || function () {
2828 var _extendStatics = function extendStatics(d, b) {
2829 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
2830 d.__proto__ = b;
2831 } || function (d, b) {
2832 for (var p in b) {
2833 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
2834 }
2835 };
2836 return _extendStatics(d, b);
2837 };
2838 return function (d, b) {
2839 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
2840 _extendStatics(d, b);
2841 function __() {
2842 this.constructor = d;
2843 }
2844 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
2845 };
2846}();
2847var __assign = this && this.__assign || function () {
2848 __assign = Object.assign || function (t) {
2849 for (var s, i = 1, n = arguments.length; i < n; i++) {
2850 s = arguments[i];
2851 for (var p in s) {
2852 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
2853 }
2854 }
2855 return t;
2856 };
2857 return __assign.apply(this, arguments);
2858};
2859var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
2860 if (k2 === undefined) k2 = k;
2861 Object.defineProperty(o, k2, { enumerable: true, get: function get() {
2862 return m[k];
2863 } });
2864} : function (o, m, k, k2) {
2865 if (k2 === undefined) k2 = k;
2866 o[k2] = m[k];
2867});
2868var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
2869 Object.defineProperty(o, "default", { enumerable: true, value: v });
2870} : function (o, v) {
2871 o["default"] = v;
2872});
2873var __importStar = this && this.__importStar || function (mod) {
2874 if (mod && mod.__esModule) return mod;
2875 var result = {};
2876 if (mod != null) for (var k in mod) {
2877 if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
2878 }__setModuleDefault(result, mod);
2879 return result;
2880};
2881Object.defineProperty(exports, "__esModule", { value: true });
2882exports.MDCTextField = void 0;
2883var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
2884var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts");
2885var ponyfill = __importStar(__webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"));
2886var component_2 = __webpack_require__(/*! @material/floating-label/component */ "./packages/mdc-floating-label/component.ts");
2887var component_3 = __webpack_require__(/*! @material/line-ripple/component */ "./packages/mdc-line-ripple/component.ts");
2888var component_4 = __webpack_require__(/*! @material/notched-outline/component */ "./packages/mdc-notched-outline/component.ts");
2889var component_5 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts");
2890var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts");
2891var component_6 = __webpack_require__(/*! ./character-counter/component */ "./packages/mdc-textfield/character-counter/component.ts");
2892var foundation_2 = __webpack_require__(/*! ./character-counter/foundation */ "./packages/mdc-textfield/character-counter/foundation.ts");
2893var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts");
2894var foundation_3 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/foundation.ts");
2895var component_7 = __webpack_require__(/*! ./helper-text/component */ "./packages/mdc-textfield/helper-text/component.ts");
2896var foundation_4 = __webpack_require__(/*! ./helper-text/foundation */ "./packages/mdc-textfield/helper-text/foundation.ts");
2897var component_8 = __webpack_require__(/*! ./icon/component */ "./packages/mdc-textfield/icon/component.ts");
2898var MDCTextField = /** @class */function (_super) {
2899 __extends(MDCTextField, _super);
2900 function MDCTextField() {
2901 return _super !== null && _super.apply(this, arguments) || this;
2902 }
2903 MDCTextField.attachTo = function (root) {
2904 return new MDCTextField(root);
2905 };
2906 MDCTextField.prototype.initialize = function (rippleFactory, lineRippleFactory, helperTextFactory, characterCounterFactory, iconFactory, labelFactory, outlineFactory) {
2907 if (rippleFactory === void 0) {
2908 rippleFactory = function rippleFactory(el, foundation) {
2909 return new component_5.MDCRipple(el, foundation);
2910 };
2911 }
2912 if (lineRippleFactory === void 0) {
2913 lineRippleFactory = function lineRippleFactory(el) {
2914 return new component_3.MDCLineRipple(el);
2915 };
2916 }
2917 if (helperTextFactory === void 0) {
2918 helperTextFactory = function helperTextFactory(el) {
2919 return new component_7.MDCTextFieldHelperText(el);
2920 };
2921 }
2922 if (characterCounterFactory === void 0) {
2923 characterCounterFactory = function characterCounterFactory(el) {
2924 return new component_6.MDCTextFieldCharacterCounter(el);
2925 };
2926 }
2927 if (iconFactory === void 0) {
2928 iconFactory = function iconFactory(el) {
2929 return new component_8.MDCTextFieldIcon(el);
2930 };
2931 }
2932 if (labelFactory === void 0) {
2933 labelFactory = function labelFactory(el) {
2934 return new component_2.MDCFloatingLabel(el);
2935 };
2936 }
2937 if (outlineFactory === void 0) {
2938 outlineFactory = function outlineFactory(el) {
2939 return new component_4.MDCNotchedOutline(el);
2940 };
2941 }
2942 this.input = this.root.querySelector(constants_1.strings.INPUT_SELECTOR);
2943 var labelElement = this.root.querySelector(constants_1.strings.LABEL_SELECTOR);
2944 this.label = labelElement ? labelFactory(labelElement) : null;
2945 var lineRippleElement = this.root.querySelector(constants_1.strings.LINE_RIPPLE_SELECTOR);
2946 this.lineRipple = lineRippleElement ? lineRippleFactory(lineRippleElement) : null;
2947 var outlineElement = this.root.querySelector(constants_1.strings.OUTLINE_SELECTOR);
2948 this.outline = outlineElement ? outlineFactory(outlineElement) : null;
2949 // Helper text
2950 var helperTextStrings = foundation_4.MDCTextFieldHelperTextFoundation.strings;
2951 var nextElementSibling = this.root.nextElementSibling;
2952 var hasHelperLine = nextElementSibling && nextElementSibling.classList.contains(constants_1.cssClasses.HELPER_LINE);
2953 var helperTextEl = hasHelperLine && nextElementSibling && nextElementSibling.querySelector(helperTextStrings.ROOT_SELECTOR);
2954 this.helperText = helperTextEl ? helperTextFactory(helperTextEl) : null;
2955 // Character counter
2956 var characterCounterStrings = foundation_2.MDCTextFieldCharacterCounterFoundation.strings;
2957 var characterCounterEl = this.root.querySelector(characterCounterStrings.ROOT_SELECTOR);
2958 // If character counter is not found in root element search in sibling element.
2959 if (!characterCounterEl && hasHelperLine && nextElementSibling) {
2960 characterCounterEl = nextElementSibling.querySelector(characterCounterStrings.ROOT_SELECTOR);
2961 }
2962 this.characterCounter = characterCounterEl ? characterCounterFactory(characterCounterEl) : null;
2963 // Leading icon
2964 var leadingIconEl = this.root.querySelector(constants_1.strings.LEADING_ICON_SELECTOR);
2965 this.leadingIcon = leadingIconEl ? iconFactory(leadingIconEl) : null;
2966 // Trailing icon
2967 var trailingIconEl = this.root.querySelector(constants_1.strings.TRAILING_ICON_SELECTOR);
2968 this.trailingIcon = trailingIconEl ? iconFactory(trailingIconEl) : null;
2969 // Prefix and Suffix
2970 this.prefix = this.root.querySelector(constants_1.strings.PREFIX_SELECTOR);
2971 this.suffix = this.root.querySelector(constants_1.strings.SUFFIX_SELECTOR);
2972 this.ripple = this.createRipple(rippleFactory);
2973 };
2974 MDCTextField.prototype.destroy = function () {
2975 if (this.ripple) {
2976 this.ripple.destroy();
2977 }
2978 if (this.lineRipple) {
2979 this.lineRipple.destroy();
2980 }
2981 if (this.helperText) {
2982 this.helperText.destroy();
2983 }
2984 if (this.characterCounter) {
2985 this.characterCounter.destroy();
2986 }
2987 if (this.leadingIcon) {
2988 this.leadingIcon.destroy();
2989 }
2990 if (this.trailingIcon) {
2991 this.trailingIcon.destroy();
2992 }
2993 if (this.label) {
2994 this.label.destroy();
2995 }
2996 if (this.outline) {
2997 this.outline.destroy();
2998 }
2999 _super.prototype.destroy.call(this);
3000 };
3001 /**
3002 * Initializes the Text Field's internal state based on the environment's
3003 * state.
3004 */
3005 MDCTextField.prototype.initialSyncWithDOM = function () {
3006 this.disabled = this.input.disabled;
3007 };
3008 Object.defineProperty(MDCTextField.prototype, "value", {
3009 get: function get() {
3010 return this.foundation.getValue();
3011 },
3012 /**
3013 * @param value The value to set on the input.
3014 */
3015 set: function set(value) {
3016 this.foundation.setValue(value);
3017 },
3018 enumerable: false,
3019 configurable: true
3020 });
3021 Object.defineProperty(MDCTextField.prototype, "disabled", {
3022 get: function get() {
3023 return this.foundation.isDisabled();
3024 },
3025 /**
3026 * @param disabled Sets the Text Field disabled or enabled.
3027 */
3028 set: function set(disabled) {
3029 this.foundation.setDisabled(disabled);
3030 },
3031 enumerable: false,
3032 configurable: true
3033 });
3034 Object.defineProperty(MDCTextField.prototype, "valid", {
3035 get: function get() {
3036 return this.foundation.isValid();
3037 },
3038 /**
3039 * @param valid Sets the Text Field valid or invalid.
3040 */
3041 set: function set(valid) {
3042 this.foundation.setValid(valid);
3043 },
3044 enumerable: false,
3045 configurable: true
3046 });
3047 Object.defineProperty(MDCTextField.prototype, "required", {
3048 get: function get() {
3049 return this.input.required;
3050 },
3051 /**
3052 * @param required Sets the Text Field to required.
3053 */
3054 set: function set(required) {
3055 this.input.required = required;
3056 },
3057 enumerable: false,
3058 configurable: true
3059 });
3060 Object.defineProperty(MDCTextField.prototype, "pattern", {
3061 get: function get() {
3062 return this.input.pattern;
3063 },
3064 /**
3065 * @param pattern Sets the input element's validation pattern.
3066 */
3067 set: function set(pattern) {
3068 this.input.pattern = pattern;
3069 },
3070 enumerable: false,
3071 configurable: true
3072 });
3073 Object.defineProperty(MDCTextField.prototype, "minLength", {
3074 get: function get() {
3075 return this.input.minLength;
3076 },
3077 /**
3078 * @param minLength Sets the input element's minLength.
3079 */
3080 set: function set(minLength) {
3081 this.input.minLength = minLength;
3082 },
3083 enumerable: false,
3084 configurable: true
3085 });
3086 Object.defineProperty(MDCTextField.prototype, "maxLength", {
3087 get: function get() {
3088 return this.input.maxLength;
3089 },
3090 /**
3091 * @param maxLength Sets the input element's maxLength.
3092 */
3093 set: function set(maxLength) {
3094 // Chrome throws exception if maxLength is set to a value less than zero
3095 if (maxLength < 0) {
3096 this.input.removeAttribute('maxLength');
3097 } else {
3098 this.input.maxLength = maxLength;
3099 }
3100 },
3101 enumerable: false,
3102 configurable: true
3103 });
3104 Object.defineProperty(MDCTextField.prototype, "min", {
3105 get: function get() {
3106 return this.input.min;
3107 },
3108 /**
3109 * @param min Sets the input element's min.
3110 */
3111 set: function set(min) {
3112 this.input.min = min;
3113 },
3114 enumerable: false,
3115 configurable: true
3116 });
3117 Object.defineProperty(MDCTextField.prototype, "max", {
3118 get: function get() {
3119 return this.input.max;
3120 },
3121 /**
3122 * @param max Sets the input element's max.
3123 */
3124 set: function set(max) {
3125 this.input.max = max;
3126 },
3127 enumerable: false,
3128 configurable: true
3129 });
3130 Object.defineProperty(MDCTextField.prototype, "step", {
3131 get: function get() {
3132 return this.input.step;
3133 },
3134 /**
3135 * @param step Sets the input element's step.
3136 */
3137 set: function set(step) {
3138 this.input.step = step;
3139 },
3140 enumerable: false,
3141 configurable: true
3142 });
3143 Object.defineProperty(MDCTextField.prototype, "helperTextContent", {
3144 /**
3145 * Sets the helper text element content.
3146 */
3147 set: function set(content) {
3148 this.foundation.setHelperTextContent(content);
3149 },
3150 enumerable: false,
3151 configurable: true
3152 });
3153 Object.defineProperty(MDCTextField.prototype, "leadingIconAriaLabel", {
3154 /**
3155 * Sets the aria label of the leading icon.
3156 */
3157 set: function set(label) {
3158 this.foundation.setLeadingIconAriaLabel(label);
3159 },
3160 enumerable: false,
3161 configurable: true
3162 });
3163 Object.defineProperty(MDCTextField.prototype, "leadingIconContent", {
3164 /**
3165 * Sets the text content of the leading icon.
3166 */
3167 set: function set(content) {
3168 this.foundation.setLeadingIconContent(content);
3169 },
3170 enumerable: false,
3171 configurable: true
3172 });
3173 Object.defineProperty(MDCTextField.prototype, "trailingIconAriaLabel", {
3174 /**
3175 * Sets the aria label of the trailing icon.
3176 */
3177 set: function set(label) {
3178 this.foundation.setTrailingIconAriaLabel(label);
3179 },
3180 enumerable: false,
3181 configurable: true
3182 });
3183 Object.defineProperty(MDCTextField.prototype, "trailingIconContent", {
3184 /**
3185 * Sets the text content of the trailing icon.
3186 */
3187 set: function set(content) {
3188 this.foundation.setTrailingIconContent(content);
3189 },
3190 enumerable: false,
3191 configurable: true
3192 });
3193 Object.defineProperty(MDCTextField.prototype, "useNativeValidation", {
3194 /**
3195 * Enables or disables the use of native validation. Use this for custom validation.
3196 * @param useNativeValidation Set this to false to ignore native input validation.
3197 */
3198 set: function set(useNativeValidation) {
3199 this.foundation.setUseNativeValidation(useNativeValidation);
3200 },
3201 enumerable: false,
3202 configurable: true
3203 });
3204 Object.defineProperty(MDCTextField.prototype, "prefixText", {
3205 /**
3206 * Gets the text content of the prefix, or null if it does not exist.
3207 */
3208 get: function get() {
3209 return this.prefix ? this.prefix.textContent : null;
3210 },
3211 /**
3212 * Sets the text content of the prefix, if it exists.
3213 */
3214 set: function set(prefixText) {
3215 if (this.prefix) {
3216 this.prefix.textContent = prefixText;
3217 }
3218 },
3219 enumerable: false,
3220 configurable: true
3221 });
3222 Object.defineProperty(MDCTextField.prototype, "suffixText", {
3223 /**
3224 * Gets the text content of the suffix, or null if it does not exist.
3225 */
3226 get: function get() {
3227 return this.suffix ? this.suffix.textContent : null;
3228 },
3229 /**
3230 * Sets the text content of the suffix, if it exists.
3231 */
3232 set: function set(suffixText) {
3233 if (this.suffix) {
3234 this.suffix.textContent = suffixText;
3235 }
3236 },
3237 enumerable: false,
3238 configurable: true
3239 });
3240 /**
3241 * Focuses the input element.
3242 */
3243 MDCTextField.prototype.focus = function () {
3244 this.input.focus();
3245 };
3246 /**
3247 * Recomputes the outline SVG path for the outline element.
3248 */
3249 MDCTextField.prototype.layout = function () {
3250 var openNotch = this.foundation.shouldFloat;
3251 this.foundation.notchOutline(openNotch);
3252 };
3253 MDCTextField.prototype.getDefaultFoundation = function () {
3254 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
3255 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
3256 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
3257 var adapter = __assign(__assign(__assign(__assign(__assign({}, this.getRootAdapterMethods()), this.getInputAdapterMethods()), this.getLabelAdapterMethods()), this.getLineRippleAdapterMethods()), this.getOutlineAdapterMethods());
3258 // tslint:enable:object-literal-sort-keys
3259 return new foundation_3.MDCTextFieldFoundation(adapter, this.getFoundationMap());
3260 };
3261 MDCTextField.prototype.getRootAdapterMethods = function () {
3262 var _this = this;
3263 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
3264 return {
3265 addClass: function addClass(className) {
3266 return _this.root.classList.add(className);
3267 },
3268 removeClass: function removeClass(className) {
3269 return _this.root.classList.remove(className);
3270 },
3271 hasClass: function hasClass(className) {
3272 return _this.root.classList.contains(className);
3273 },
3274 registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler(evtType, handler) {
3275 _this.listen(evtType, handler);
3276 },
3277 deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler(evtType, handler) {
3278 _this.unlisten(evtType, handler);
3279 },
3280 registerValidationAttributeChangeHandler: function registerValidationAttributeChangeHandler(handler) {
3281 var getAttributesList = function getAttributesList(mutationsList) {
3282 return mutationsList.map(function (mutation) {
3283 return mutation.attributeName;
3284 }).filter(function (attributeName) {
3285 return attributeName;
3286 });
3287 };
3288 var observer = new MutationObserver(function (mutationsList) {
3289 return handler(getAttributesList(mutationsList));
3290 });
3291 var config = { attributes: true };
3292 observer.observe(_this.input, config);
3293 return observer;
3294 },
3295 deregisterValidationAttributeChangeHandler: function deregisterValidationAttributeChangeHandler(observer) {
3296 observer.disconnect();
3297 }
3298 };
3299 // tslint:enable:object-literal-sort-keys
3300 };
3301 MDCTextField.prototype.getInputAdapterMethods = function () {
3302 var _this = this;
3303 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
3304 return {
3305 getNativeInput: function getNativeInput() {
3306 return _this.input;
3307 },
3308 setInputAttr: function setInputAttr(attr, value) {
3309 _this.input.setAttribute(attr, value);
3310 },
3311 removeInputAttr: function removeInputAttr(attr) {
3312 _this.input.removeAttribute(attr);
3313 },
3314 isFocused: function isFocused() {
3315 return document.activeElement === _this.input;
3316 },
3317 registerInputInteractionHandler: function registerInputInteractionHandler(evtType, handler) {
3318 _this.input.addEventListener(evtType, handler, events_1.applyPassive());
3319 },
3320 deregisterInputInteractionHandler: function deregisterInputInteractionHandler(evtType, handler) {
3321 _this.input.removeEventListener(evtType, handler, events_1.applyPassive());
3322 }
3323 };
3324 // tslint:enable:object-literal-sort-keys
3325 };
3326 MDCTextField.prototype.getLabelAdapterMethods = function () {
3327 var _this = this;
3328 return {
3329 floatLabel: function floatLabel(shouldFloat) {
3330 _this.label && _this.label.float(shouldFloat);
3331 },
3332 getLabelWidth: function getLabelWidth() {
3333 return _this.label ? _this.label.getWidth() : 0;
3334 },
3335 hasLabel: function hasLabel() {
3336 return Boolean(_this.label);
3337 },
3338 shakeLabel: function shakeLabel(shouldShake) {
3339 _this.label && _this.label.shake(shouldShake);
3340 },
3341 setLabelRequired: function setLabelRequired(isRequired) {
3342 _this.label && _this.label.setRequired(isRequired);
3343 }
3344 };
3345 };
3346 MDCTextField.prototype.getLineRippleAdapterMethods = function () {
3347 var _this = this;
3348 return {
3349 activateLineRipple: function activateLineRipple() {
3350 if (_this.lineRipple) {
3351 _this.lineRipple.activate();
3352 }
3353 },
3354 deactivateLineRipple: function deactivateLineRipple() {
3355 if (_this.lineRipple) {
3356 _this.lineRipple.deactivate();
3357 }
3358 },
3359 setLineRippleTransformOrigin: function setLineRippleTransformOrigin(normalizedX) {
3360 if (_this.lineRipple) {
3361 _this.lineRipple.setRippleCenter(normalizedX);
3362 }
3363 }
3364 };
3365 };
3366 MDCTextField.prototype.getOutlineAdapterMethods = function () {
3367 var _this = this;
3368 return {
3369 closeOutline: function closeOutline() {
3370 _this.outline && _this.outline.closeNotch();
3371 },
3372 hasOutline: function hasOutline() {
3373 return Boolean(_this.outline);
3374 },
3375 notchOutline: function notchOutline(labelWidth) {
3376 _this.outline && _this.outline.notch(labelWidth);
3377 }
3378 };
3379 };
3380 /**
3381 * @return A map of all subcomponents to subfoundations.
3382 */
3383 MDCTextField.prototype.getFoundationMap = function () {
3384 return {
3385 characterCounter: this.characterCounter ? this.characterCounter.foundationForTextField : undefined,
3386 helperText: this.helperText ? this.helperText.foundationForTextField : undefined,
3387 leadingIcon: this.leadingIcon ? this.leadingIcon.foundationForTextField : undefined,
3388 trailingIcon: this.trailingIcon ? this.trailingIcon.foundationForTextField : undefined
3389 };
3390 };
3391 MDCTextField.prototype.createRipple = function (rippleFactory) {
3392 var _this = this;
3393 var isTextArea = this.root.classList.contains(constants_1.cssClasses.TEXTAREA);
3394 var isOutlined = this.root.classList.contains(constants_1.cssClasses.OUTLINED);
3395 if (isTextArea || isOutlined) {
3396 return null;
3397 }
3398 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
3399 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
3400 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
3401 var adapter = __assign(__assign({}, component_5.MDCRipple.createAdapter(this)), { isSurfaceActive: function isSurfaceActive() {
3402 return ponyfill.matches(_this.input, ':active');
3403 }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
3404 _this.input.addEventListener(evtType, handler, events_1.applyPassive());
3405 }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
3406 _this.input.removeEventListener(evtType, handler, events_1.applyPassive());
3407 } });
3408 // tslint:enable:object-literal-sort-keys
3409 return rippleFactory(this.root, new foundation_1.MDCRippleFoundation(adapter));
3410 };
3411 return MDCTextField;
3412}(component_1.MDCComponent);
3413exports.MDCTextField = MDCTextField;
3414
3415/***/ }),
3416
3417/***/ "./packages/mdc-textfield/constants.ts":
3418/*!*********************************************!*\
3419 !*** ./packages/mdc-textfield/constants.ts ***!
3420 \*********************************************/
3421/*! no static exports found */
3422/***/ (function(module, exports, __webpack_require__) {
3423
3424"use strict";
3425
3426/**
3427 * @license
3428 * Copyright 2016 Google Inc.
3429 *
3430 * Permission is hereby granted, free of charge, to any person obtaining a copy
3431 * of this software and associated documentation files (the "Software"), to deal
3432 * in the Software without restriction, including without limitation the rights
3433 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3434 * copies of the Software, and to permit persons to whom the Software is
3435 * furnished to do so, subject to the following conditions:
3436 *
3437 * The above copyright notice and this permission notice shall be included in
3438 * all copies or substantial portions of the Software.
3439 *
3440 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3441 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3442 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3443 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3444 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3445 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3446 * THE SOFTWARE.
3447 */
3448
3449Object.defineProperty(exports, "__esModule", { value: true });
3450exports.ALWAYS_FLOAT_TYPES = exports.VALIDATION_ATTR_WHITELIST = exports.numbers = exports.strings = exports.cssClasses = void 0;
3451var strings = {
3452 ARIA_CONTROLS: 'aria-controls',
3453 ARIA_DESCRIBEDBY: 'aria-describedby',
3454 INPUT_SELECTOR: '.mdc-text-field__input',
3455 LABEL_SELECTOR: '.mdc-floating-label',
3456 LEADING_ICON_SELECTOR: '.mdc-text-field__icon--leading',
3457 LINE_RIPPLE_SELECTOR: '.mdc-line-ripple',
3458 OUTLINE_SELECTOR: '.mdc-notched-outline',
3459 PREFIX_SELECTOR: '.mdc-text-field__affix--prefix',
3460 SUFFIX_SELECTOR: '.mdc-text-field__affix--suffix',
3461 TRAILING_ICON_SELECTOR: '.mdc-text-field__icon--trailing'
3462};
3463exports.strings = strings;
3464var cssClasses = {
3465 DISABLED: 'mdc-text-field--disabled',
3466 FOCUSED: 'mdc-text-field--focused',
3467 HELPER_LINE: 'mdc-text-field-helper-line',
3468 INVALID: 'mdc-text-field--invalid',
3469 LABEL_FLOATING: 'mdc-text-field--label-floating',
3470 NO_LABEL: 'mdc-text-field--no-label',
3471 OUTLINED: 'mdc-text-field--outlined',
3472 ROOT: 'mdc-text-field',
3473 TEXTAREA: 'mdc-text-field--textarea',
3474 WITH_LEADING_ICON: 'mdc-text-field--with-leading-icon',
3475 WITH_TRAILING_ICON: 'mdc-text-field--with-trailing-icon',
3476 WITH_INTERNAL_COUNTER: 'mdc-text-field--with-internal-counter'
3477};
3478exports.cssClasses = cssClasses;
3479var numbers = {
3480 LABEL_SCALE: 0.75
3481};
3482exports.numbers = numbers;
3483/**
3484 * Whitelist based off of
3485 * https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/HTML5/Constraint_validation
3486 * under the "Validation-related attributes" section.
3487 */
3488var VALIDATION_ATTR_WHITELIST = ['pattern', 'min', 'max', 'required', 'step', 'minlength', 'maxlength'];
3489exports.VALIDATION_ATTR_WHITELIST = VALIDATION_ATTR_WHITELIST;
3490/**
3491 * Label should always float for these types as they show some UI even if value
3492 * is empty.
3493 */
3494var ALWAYS_FLOAT_TYPES = ['color', 'date', 'datetime-local', 'month', 'range', 'time', 'week'];
3495exports.ALWAYS_FLOAT_TYPES = ALWAYS_FLOAT_TYPES;
3496
3497/***/ }),
3498
3499/***/ "./packages/mdc-textfield/foundation.ts":
3500/*!**********************************************!*\
3501 !*** ./packages/mdc-textfield/foundation.ts ***!
3502 \**********************************************/
3503/*! no static exports found */
3504/***/ (function(module, exports, __webpack_require__) {
3505
3506"use strict";
3507
3508/**
3509 * @license
3510 * Copyright 2016 Google Inc.
3511 *
3512 * Permission is hereby granted, free of charge, to any person obtaining a copy
3513 * of this software and associated documentation files (the "Software"), to deal
3514 * in the Software without restriction, including without limitation the rights
3515 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3516 * copies of the Software, and to permit persons to whom the Software is
3517 * furnished to do so, subject to the following conditions:
3518 *
3519 * The above copyright notice and this permission notice shall be included in
3520 * all copies or substantial portions of the Software.
3521 *
3522 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3523 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3524 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3525 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3526 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3527 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3528 * THE SOFTWARE.
3529 */
3530
3531var __extends = this && this.__extends || function () {
3532 var _extendStatics = function extendStatics(d, b) {
3533 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
3534 d.__proto__ = b;
3535 } || function (d, b) {
3536 for (var p in b) {
3537 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
3538 }
3539 };
3540 return _extendStatics(d, b);
3541 };
3542 return function (d, b) {
3543 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
3544 _extendStatics(d, b);
3545 function __() {
3546 this.constructor = d;
3547 }
3548 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3549 };
3550}();
3551var __assign = this && this.__assign || function () {
3552 __assign = Object.assign || function (t) {
3553 for (var s, i = 1, n = arguments.length; i < n; i++) {
3554 s = arguments[i];
3555 for (var p in s) {
3556 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
3557 }
3558 }
3559 return t;
3560 };
3561 return __assign.apply(this, arguments);
3562};
3563var __values = this && this.__values || function (o) {
3564 var s = typeof Symbol === "function" && Symbol.iterator,
3565 m = s && o[s],
3566 i = 0;
3567 if (m) return m.call(o);
3568 if (o && typeof o.length === "number") return {
3569 next: function next() {
3570 if (o && i >= o.length) o = void 0;
3571 return { value: o && o[i++], done: !o };
3572 }
3573 };
3574 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
3575};
3576Object.defineProperty(exports, "__esModule", { value: true });
3577exports.MDCTextFieldFoundation = void 0;
3578var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
3579var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts");
3580var POINTERDOWN_EVENTS = ['mousedown', 'touchstart'];
3581var INTERACTION_EVENTS = ['click', 'keydown'];
3582var MDCTextFieldFoundation = /** @class */function (_super) {
3583 __extends(MDCTextFieldFoundation, _super);
3584 /**
3585 * @param adapter
3586 * @param foundationMap Map from subcomponent names to their subfoundations.
3587 */
3588 function MDCTextFieldFoundation(adapter, foundationMap) {
3589 if (foundationMap === void 0) {
3590 foundationMap = {};
3591 }
3592 var _this = _super.call(this, __assign(__assign({}, MDCTextFieldFoundation.defaultAdapter), adapter)) || this;
3593 _this.isFocused = false;
3594 _this.receivedUserInput = false;
3595 _this.valid = true;
3596 _this.useNativeValidation = true;
3597 _this.validateOnValueChange = true;
3598 _this.helperText = foundationMap.helperText;
3599 _this.characterCounter = foundationMap.characterCounter;
3600 _this.leadingIcon = foundationMap.leadingIcon;
3601 _this.trailingIcon = foundationMap.trailingIcon;
3602 _this.inputFocusHandler = function () {
3603 _this.activateFocus();
3604 };
3605 _this.inputBlurHandler = function () {
3606 _this.deactivateFocus();
3607 };
3608 _this.inputInputHandler = function () {
3609 _this.handleInput();
3610 };
3611 _this.setPointerXOffset = function (evt) {
3612 _this.setTransformOrigin(evt);
3613 };
3614 _this.textFieldInteractionHandler = function () {
3615 _this.handleTextFieldInteraction();
3616 };
3617 _this.validationAttributeChangeHandler = function (attributesList) {
3618 _this.handleValidationAttributeChange(attributesList);
3619 };
3620 return _this;
3621 }
3622 Object.defineProperty(MDCTextFieldFoundation, "cssClasses", {
3623 get: function get() {
3624 return constants_1.cssClasses;
3625 },
3626 enumerable: false,
3627 configurable: true
3628 });
3629 Object.defineProperty(MDCTextFieldFoundation, "strings", {
3630 get: function get() {
3631 return constants_1.strings;
3632 },
3633 enumerable: false,
3634 configurable: true
3635 });
3636 Object.defineProperty(MDCTextFieldFoundation, "numbers", {
3637 get: function get() {
3638 return constants_1.numbers;
3639 },
3640 enumerable: false,
3641 configurable: true
3642 });
3643 Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldAlwaysFloat", {
3644 get: function get() {
3645 var type = this.getNativeInput().type;
3646 return constants_1.ALWAYS_FLOAT_TYPES.indexOf(type) >= 0;
3647 },
3648 enumerable: false,
3649 configurable: true
3650 });
3651 Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldFloat", {
3652 get: function get() {
3653 return this.shouldAlwaysFloat || this.isFocused || !!this.getValue() || this.isBadInput();
3654 },
3655 enumerable: false,
3656 configurable: true
3657 });
3658 Object.defineProperty(MDCTextFieldFoundation.prototype, "shouldShake", {
3659 get: function get() {
3660 return !this.isFocused && !this.isValid() && !!this.getValue();
3661 },
3662 enumerable: false,
3663 configurable: true
3664 });
3665 Object.defineProperty(MDCTextFieldFoundation, "defaultAdapter", {
3666 /**
3667 * See {@link MDCTextFieldAdapter} for typing information on parameters and
3668 * return types.
3669 */
3670 get: function get() {
3671 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
3672 return {
3673 addClass: function addClass() {
3674 return undefined;
3675 },
3676 removeClass: function removeClass() {
3677 return undefined;
3678 },
3679 hasClass: function hasClass() {
3680 return true;
3681 },
3682 setInputAttr: function setInputAttr() {
3683 return undefined;
3684 },
3685 removeInputAttr: function removeInputAttr() {
3686 return undefined;
3687 },
3688 registerTextFieldInteractionHandler: function registerTextFieldInteractionHandler() {
3689 return undefined;
3690 },
3691 deregisterTextFieldInteractionHandler: function deregisterTextFieldInteractionHandler() {
3692 return undefined;
3693 },
3694 registerInputInteractionHandler: function registerInputInteractionHandler() {
3695 return undefined;
3696 },
3697 deregisterInputInteractionHandler: function deregisterInputInteractionHandler() {
3698 return undefined;
3699 },
3700 registerValidationAttributeChangeHandler: function registerValidationAttributeChangeHandler() {
3701 return new MutationObserver(function () {
3702 return undefined;
3703 });
3704 },
3705 deregisterValidationAttributeChangeHandler: function deregisterValidationAttributeChangeHandler() {
3706 return undefined;
3707 },
3708 getNativeInput: function getNativeInput() {
3709 return null;
3710 },
3711 isFocused: function isFocused() {
3712 return false;
3713 },
3714 activateLineRipple: function activateLineRipple() {
3715 return undefined;
3716 },
3717 deactivateLineRipple: function deactivateLineRipple() {
3718 return undefined;
3719 },
3720 setLineRippleTransformOrigin: function setLineRippleTransformOrigin() {
3721 return undefined;
3722 },
3723 shakeLabel: function shakeLabel() {
3724 return undefined;
3725 },
3726 floatLabel: function floatLabel() {
3727 return undefined;
3728 },
3729 setLabelRequired: function setLabelRequired() {
3730 return undefined;
3731 },
3732 hasLabel: function hasLabel() {
3733 return false;
3734 },
3735 getLabelWidth: function getLabelWidth() {
3736 return 0;
3737 },
3738 hasOutline: function hasOutline() {
3739 return false;
3740 },
3741 notchOutline: function notchOutline() {
3742 return undefined;
3743 },
3744 closeOutline: function closeOutline() {
3745 return undefined;
3746 }
3747 };
3748 // tslint:enable:object-literal-sort-keys
3749 },
3750 enumerable: false,
3751 configurable: true
3752 });
3753 MDCTextFieldFoundation.prototype.init = function () {
3754 var e_1, _a, e_2, _b;
3755 if (this.adapter.hasLabel() && this.getNativeInput().required) {
3756 this.adapter.setLabelRequired(true);
3757 }
3758 if (this.adapter.isFocused()) {
3759 this.inputFocusHandler();
3760 } else if (this.adapter.hasLabel() && this.shouldFloat) {
3761 this.notchOutline(true);
3762 this.adapter.floatLabel(true);
3763 this.styleFloating(true);
3764 }
3765 this.adapter.registerInputInteractionHandler('focus', this.inputFocusHandler);
3766 this.adapter.registerInputInteractionHandler('blur', this.inputBlurHandler);
3767 this.adapter.registerInputInteractionHandler('input', this.inputInputHandler);
3768 try {
3769 for (var POINTERDOWN_EVENTS_1 = __values(POINTERDOWN_EVENTS), POINTERDOWN_EVENTS_1_1 = POINTERDOWN_EVENTS_1.next(); !POINTERDOWN_EVENTS_1_1.done; POINTERDOWN_EVENTS_1_1 = POINTERDOWN_EVENTS_1.next()) {
3770 var evtType = POINTERDOWN_EVENTS_1_1.value;
3771 this.adapter.registerInputInteractionHandler(evtType, this.setPointerXOffset);
3772 }
3773 } catch (e_1_1) {
3774 e_1 = { error: e_1_1 };
3775 } finally {
3776 try {
3777 if (POINTERDOWN_EVENTS_1_1 && !POINTERDOWN_EVENTS_1_1.done && (_a = POINTERDOWN_EVENTS_1.return)) _a.call(POINTERDOWN_EVENTS_1);
3778 } finally {
3779 if (e_1) throw e_1.error;
3780 }
3781 }
3782 try {
3783 for (var INTERACTION_EVENTS_1 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next(); !INTERACTION_EVENTS_1_1.done; INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next()) {
3784 var evtType = INTERACTION_EVENTS_1_1.value;
3785 this.adapter.registerTextFieldInteractionHandler(evtType, this.textFieldInteractionHandler);
3786 }
3787 } catch (e_2_1) {
3788 e_2 = { error: e_2_1 };
3789 } finally {
3790 try {
3791 if (INTERACTION_EVENTS_1_1 && !INTERACTION_EVENTS_1_1.done && (_b = INTERACTION_EVENTS_1.return)) _b.call(INTERACTION_EVENTS_1);
3792 } finally {
3793 if (e_2) throw e_2.error;
3794 }
3795 }
3796 this.validationObserver = this.adapter.registerValidationAttributeChangeHandler(this.validationAttributeChangeHandler);
3797 this.setcharacterCounter(this.getValue().length);
3798 };
3799 MDCTextFieldFoundation.prototype.destroy = function () {
3800 var e_3, _a, e_4, _b;
3801 this.adapter.deregisterInputInteractionHandler('focus', this.inputFocusHandler);
3802 this.adapter.deregisterInputInteractionHandler('blur', this.inputBlurHandler);
3803 this.adapter.deregisterInputInteractionHandler('input', this.inputInputHandler);
3804 try {
3805 for (var POINTERDOWN_EVENTS_2 = __values(POINTERDOWN_EVENTS), POINTERDOWN_EVENTS_2_1 = POINTERDOWN_EVENTS_2.next(); !POINTERDOWN_EVENTS_2_1.done; POINTERDOWN_EVENTS_2_1 = POINTERDOWN_EVENTS_2.next()) {
3806 var evtType = POINTERDOWN_EVENTS_2_1.value;
3807 this.adapter.deregisterInputInteractionHandler(evtType, this.setPointerXOffset);
3808 }
3809 } catch (e_3_1) {
3810 e_3 = { error: e_3_1 };
3811 } finally {
3812 try {
3813 if (POINTERDOWN_EVENTS_2_1 && !POINTERDOWN_EVENTS_2_1.done && (_a = POINTERDOWN_EVENTS_2.return)) _a.call(POINTERDOWN_EVENTS_2);
3814 } finally {
3815 if (e_3) throw e_3.error;
3816 }
3817 }
3818 try {
3819 for (var INTERACTION_EVENTS_2 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next(); !INTERACTION_EVENTS_2_1.done; INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next()) {
3820 var evtType = INTERACTION_EVENTS_2_1.value;
3821 this.adapter.deregisterTextFieldInteractionHandler(evtType, this.textFieldInteractionHandler);
3822 }
3823 } catch (e_4_1) {
3824 e_4 = { error: e_4_1 };
3825 } finally {
3826 try {
3827 if (INTERACTION_EVENTS_2_1 && !INTERACTION_EVENTS_2_1.done && (_b = INTERACTION_EVENTS_2.return)) _b.call(INTERACTION_EVENTS_2);
3828 } finally {
3829 if (e_4) throw e_4.error;
3830 }
3831 }
3832 this.adapter.deregisterValidationAttributeChangeHandler(this.validationObserver);
3833 };
3834 /**
3835 * Handles user interactions with the Text Field.
3836 */
3837 MDCTextFieldFoundation.prototype.handleTextFieldInteraction = function () {
3838 var nativeInput = this.adapter.getNativeInput();
3839 if (nativeInput && nativeInput.disabled) {
3840 return;
3841 }
3842 this.receivedUserInput = true;
3843 };
3844 /**
3845 * Handles validation attribute changes
3846 */
3847 MDCTextFieldFoundation.prototype.handleValidationAttributeChange = function (attributesList) {
3848 var _this = this;
3849 attributesList.some(function (attributeName) {
3850 if (constants_1.VALIDATION_ATTR_WHITELIST.indexOf(attributeName) > -1) {
3851 _this.styleValidity(true);
3852 _this.adapter.setLabelRequired(_this.getNativeInput().required);
3853 return true;
3854 }
3855 return false;
3856 });
3857 if (attributesList.indexOf('maxlength') > -1) {
3858 this.setcharacterCounter(this.getValue().length);
3859 }
3860 };
3861 /**
3862 * Opens/closes the notched outline.
3863 */
3864 MDCTextFieldFoundation.prototype.notchOutline = function (openNotch) {
3865 if (!this.adapter.hasOutline() || !this.adapter.hasLabel()) {
3866 return;
3867 }
3868 if (openNotch) {
3869 var labelWidth = this.adapter.getLabelWidth() * constants_1.numbers.LABEL_SCALE;
3870 this.adapter.notchOutline(labelWidth);
3871 } else {
3872 this.adapter.closeOutline();
3873 }
3874 };
3875 /**
3876 * Activates the text field focus state.
3877 */
3878 MDCTextFieldFoundation.prototype.activateFocus = function () {
3879 this.isFocused = true;
3880 this.styleFocused(this.isFocused);
3881 this.adapter.activateLineRipple();
3882 if (this.adapter.hasLabel()) {
3883 this.notchOutline(this.shouldFloat);
3884 this.adapter.floatLabel(this.shouldFloat);
3885 this.styleFloating(this.shouldFloat);
3886 this.adapter.shakeLabel(this.shouldShake);
3887 }
3888 if (this.helperText && (this.helperText.isPersistent() || !this.helperText.isValidation() || !this.valid)) {
3889 this.helperText.showToScreenReader();
3890 }
3891 };
3892 /**
3893 * Sets the line ripple's transform origin, so that the line ripple activate
3894 * animation will animate out from the user's click location.
3895 */
3896 MDCTextFieldFoundation.prototype.setTransformOrigin = function (evt) {
3897 if (this.isDisabled() || this.adapter.hasOutline()) {
3898 return;
3899 }
3900 var touches = evt.touches;
3901 var targetEvent = touches ? touches[0] : evt;
3902 var targetClientRect = targetEvent.target.getBoundingClientRect();
3903 var normalizedX = targetEvent.clientX - targetClientRect.left;
3904 this.adapter.setLineRippleTransformOrigin(normalizedX);
3905 };
3906 /**
3907 * Handles input change of text input and text area.
3908 */
3909 MDCTextFieldFoundation.prototype.handleInput = function () {
3910 this.autoCompleteFocus();
3911 this.setcharacterCounter(this.getValue().length);
3912 };
3913 /**
3914 * Activates the Text Field's focus state in cases when the input value
3915 * changes without user input (e.g. programmatically).
3916 */
3917 MDCTextFieldFoundation.prototype.autoCompleteFocus = function () {
3918 if (!this.receivedUserInput) {
3919 this.activateFocus();
3920 }
3921 };
3922 /**
3923 * Deactivates the Text Field's focus state.
3924 */
3925 MDCTextFieldFoundation.prototype.deactivateFocus = function () {
3926 this.isFocused = false;
3927 this.adapter.deactivateLineRipple();
3928 var isValid = this.isValid();
3929 this.styleValidity(isValid);
3930 this.styleFocused(this.isFocused);
3931 if (this.adapter.hasLabel()) {
3932 this.notchOutline(this.shouldFloat);
3933 this.adapter.floatLabel(this.shouldFloat);
3934 this.styleFloating(this.shouldFloat);
3935 this.adapter.shakeLabel(this.shouldShake);
3936 }
3937 if (!this.shouldFloat) {
3938 this.receivedUserInput = false;
3939 }
3940 };
3941 MDCTextFieldFoundation.prototype.getValue = function () {
3942 return this.getNativeInput().value;
3943 };
3944 /**
3945 * @param value The value to set on the input Element.
3946 */
3947 MDCTextFieldFoundation.prototype.setValue = function (value) {
3948 // Prevent Safari from moving the caret to the end of the input when the
3949 // value has not changed.
3950 if (this.getValue() !== value) {
3951 this.getNativeInput().value = value;
3952 }
3953 this.setcharacterCounter(value.length);
3954 if (this.validateOnValueChange) {
3955 var isValid = this.isValid();
3956 this.styleValidity(isValid);
3957 }
3958 if (this.adapter.hasLabel()) {
3959 this.notchOutline(this.shouldFloat);
3960 this.adapter.floatLabel(this.shouldFloat);
3961 this.styleFloating(this.shouldFloat);
3962 if (this.validateOnValueChange) {
3963 this.adapter.shakeLabel(this.shouldShake);
3964 }
3965 }
3966 };
3967 /**
3968 * @return The custom validity state, if set; otherwise, the result of a
3969 * native validity check.
3970 */
3971 MDCTextFieldFoundation.prototype.isValid = function () {
3972 return this.useNativeValidation ? this.isNativeInputValid() : this.valid;
3973 };
3974 /**
3975 * @param isValid Sets the custom validity state of the Text Field.
3976 */
3977 MDCTextFieldFoundation.prototype.setValid = function (isValid) {
3978 this.valid = isValid;
3979 this.styleValidity(isValid);
3980 var shouldShake = !isValid && !this.isFocused && !!this.getValue();
3981 if (this.adapter.hasLabel()) {
3982 this.adapter.shakeLabel(shouldShake);
3983 }
3984 };
3985 /**
3986 * @param shouldValidate Whether or not validity should be updated on
3987 * value change.
3988 */
3989 MDCTextFieldFoundation.prototype.setValidateOnValueChange = function (shouldValidate) {
3990 this.validateOnValueChange = shouldValidate;
3991 };
3992 /**
3993 * @return Whether or not validity should be updated on value change. `true`
3994 * by default.
3995 */
3996 MDCTextFieldFoundation.prototype.getValidateOnValueChange = function () {
3997 return this.validateOnValueChange;
3998 };
3999 /**
4000 * Enables or disables the use of native validation. Use this for custom
4001 * validation.
4002 * @param useNativeValidation Set this to false to ignore native input
4003 * validation.
4004 */
4005 MDCTextFieldFoundation.prototype.setUseNativeValidation = function (useNativeValidation) {
4006 this.useNativeValidation = useNativeValidation;
4007 };
4008 MDCTextFieldFoundation.prototype.isDisabled = function () {
4009 return this.getNativeInput().disabled;
4010 };
4011 /**
4012 * @param disabled Sets the text-field disabled or enabled.
4013 */
4014 MDCTextFieldFoundation.prototype.setDisabled = function (disabled) {
4015 this.getNativeInput().disabled = disabled;
4016 this.styleDisabled(disabled);
4017 };
4018 /**
4019 * @param content Sets the content of the helper text.
4020 */
4021 MDCTextFieldFoundation.prototype.setHelperTextContent = function (content) {
4022 if (this.helperText) {
4023 this.helperText.setContent(content);
4024 }
4025 };
4026 /**
4027 * Sets the aria label of the leading icon.
4028 */
4029 MDCTextFieldFoundation.prototype.setLeadingIconAriaLabel = function (label) {
4030 if (this.leadingIcon) {
4031 this.leadingIcon.setAriaLabel(label);
4032 }
4033 };
4034 /**
4035 * Sets the text content of the leading icon.
4036 */
4037 MDCTextFieldFoundation.prototype.setLeadingIconContent = function (content) {
4038 if (this.leadingIcon) {
4039 this.leadingIcon.setContent(content);
4040 }
4041 };
4042 /**
4043 * Sets the aria label of the trailing icon.
4044 */
4045 MDCTextFieldFoundation.prototype.setTrailingIconAriaLabel = function (label) {
4046 if (this.trailingIcon) {
4047 this.trailingIcon.setAriaLabel(label);
4048 }
4049 };
4050 /**
4051 * Sets the text content of the trailing icon.
4052 */
4053 MDCTextFieldFoundation.prototype.setTrailingIconContent = function (content) {
4054 if (this.trailingIcon) {
4055 this.trailingIcon.setContent(content);
4056 }
4057 };
4058 /**
4059 * Sets character counter values that shows characters used and the total
4060 * character limit.
4061 */
4062 MDCTextFieldFoundation.prototype.setcharacterCounter = function (currentLength) {
4063 if (!this.characterCounter) {
4064 return;
4065 }
4066 var maxLength = this.getNativeInput().maxLength;
4067 if (maxLength === -1) {
4068 throw new Error('MDCTextFieldFoundation: Expected maxlength html property on text input or textarea.');
4069 }
4070 this.characterCounter.setCounterValue(currentLength, maxLength);
4071 };
4072 /**
4073 * @return True if the Text Field input fails in converting the user-supplied
4074 * value.
4075 */
4076 MDCTextFieldFoundation.prototype.isBadInput = function () {
4077 // The badInput property is not supported in IE 11 💩.
4078 return this.getNativeInput().validity.badInput || false;
4079 };
4080 /**
4081 * @return The result of native validity checking (ValidityState.valid).
4082 */
4083 MDCTextFieldFoundation.prototype.isNativeInputValid = function () {
4084 return this.getNativeInput().validity.valid;
4085 };
4086 /**
4087 * Styles the component based on the validity state.
4088 */
4089 MDCTextFieldFoundation.prototype.styleValidity = function (isValid) {
4090 var INVALID = MDCTextFieldFoundation.cssClasses.INVALID;
4091 if (isValid) {
4092 this.adapter.removeClass(INVALID);
4093 } else {
4094 this.adapter.addClass(INVALID);
4095 }
4096 if (this.helperText) {
4097 this.helperText.setValidity(isValid);
4098 // We dynamically set or unset aria-describedby for validation helper text
4099 // only, based on whether the field is valid
4100 var helperTextValidation = this.helperText.isValidation();
4101 if (!helperTextValidation) {
4102 return;
4103 }
4104 var helperTextVisible = this.helperText.isVisible();
4105 var helperTextId = this.helperText.getId();
4106 if (helperTextVisible && helperTextId) {
4107 this.adapter.setInputAttr(constants_1.strings.ARIA_DESCRIBEDBY, helperTextId);
4108 } else {
4109 this.adapter.removeInputAttr(constants_1.strings.ARIA_DESCRIBEDBY);
4110 }
4111 }
4112 };
4113 /**
4114 * Styles the component based on the focused state.
4115 */
4116 MDCTextFieldFoundation.prototype.styleFocused = function (isFocused) {
4117 var FOCUSED = MDCTextFieldFoundation.cssClasses.FOCUSED;
4118 if (isFocused) {
4119 this.adapter.addClass(FOCUSED);
4120 } else {
4121 this.adapter.removeClass(FOCUSED);
4122 }
4123 };
4124 /**
4125 * Styles the component based on the disabled state.
4126 */
4127 MDCTextFieldFoundation.prototype.styleDisabled = function (isDisabled) {
4128 var _a = MDCTextFieldFoundation.cssClasses,
4129 DISABLED = _a.DISABLED,
4130 INVALID = _a.INVALID;
4131 if (isDisabled) {
4132 this.adapter.addClass(DISABLED);
4133 this.adapter.removeClass(INVALID);
4134 } else {
4135 this.adapter.removeClass(DISABLED);
4136 }
4137 if (this.leadingIcon) {
4138 this.leadingIcon.setDisabled(isDisabled);
4139 }
4140 if (this.trailingIcon) {
4141 this.trailingIcon.setDisabled(isDisabled);
4142 }
4143 };
4144 /**
4145 * Styles the component based on the label floating state.
4146 */
4147 MDCTextFieldFoundation.prototype.styleFloating = function (isFloating) {
4148 var LABEL_FLOATING = MDCTextFieldFoundation.cssClasses.LABEL_FLOATING;
4149 if (isFloating) {
4150 this.adapter.addClass(LABEL_FLOATING);
4151 } else {
4152 this.adapter.removeClass(LABEL_FLOATING);
4153 }
4154 };
4155 /**
4156 * @return The native text input element from the host environment, or an
4157 * object with the same shape for unit tests.
4158 */
4159 MDCTextFieldFoundation.prototype.getNativeInput = function () {
4160 // this.adapter may be undefined in foundation unit tests. This happens when
4161 // testdouble is creating a mock object and invokes the
4162 // shouldShake/shouldFloat getters (which in turn call getValue(), which
4163 // calls this method) before init() has been called from the MDCTextField
4164 // constructor. To work around that issue, we return a dummy object.
4165 var nativeInput = this.adapter ? this.adapter.getNativeInput() : null;
4166 return nativeInput || {
4167 disabled: false,
4168 maxLength: -1,
4169 required: false,
4170 type: 'input',
4171 validity: {
4172 badInput: false,
4173 valid: true
4174 },
4175 value: ''
4176 };
4177 };
4178 return MDCTextFieldFoundation;
4179}(foundation_1.MDCFoundation);
4180exports.MDCTextFieldFoundation = MDCTextFieldFoundation;
4181// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
4182exports.default = MDCTextFieldFoundation;
4183
4184/***/ }),
4185
4186/***/ "./packages/mdc-textfield/helper-text/adapter.ts":
4187/*!*******************************************************!*\
4188 !*** ./packages/mdc-textfield/helper-text/adapter.ts ***!
4189 \*******************************************************/
4190/*! no static exports found */
4191/***/ (function(module, exports, __webpack_require__) {
4192
4193"use strict";
4194
4195/**
4196 * @license
4197 * Copyright 2017 Google Inc.
4198 *
4199 * Permission is hereby granted, free of charge, to any person obtaining a copy
4200 * of this software and associated documentation files (the "Software"), to deal
4201 * in the Software without restriction, including without limitation the rights
4202 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4203 * copies of the Software, and to permit persons to whom the Software is
4204 * furnished to do so, subject to the following conditions:
4205 *
4206 * The above copyright notice and this permission notice shall be included in
4207 * all copies or substantial portions of the Software.
4208 *
4209 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4210 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4211 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4212 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4213 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4214 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4215 * THE SOFTWARE.
4216 */
4217
4218Object.defineProperty(exports, "__esModule", { value: true });
4219
4220/***/ }),
4221
4222/***/ "./packages/mdc-textfield/helper-text/component.ts":
4223/*!*********************************************************!*\
4224 !*** ./packages/mdc-textfield/helper-text/component.ts ***!
4225 \*********************************************************/
4226/*! no static exports found */
4227/***/ (function(module, exports, __webpack_require__) {
4228
4229"use strict";
4230
4231/**
4232 * @license
4233 * Copyright 2017 Google Inc.
4234 *
4235 * Permission is hereby granted, free of charge, to any person obtaining a copy
4236 * of this software and associated documentation files (the "Software"), to deal
4237 * in the Software without restriction, including without limitation the rights
4238 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4239 * copies of the Software, and to permit persons to whom the Software is
4240 * furnished to do so, subject to the following conditions:
4241 *
4242 * The above copyright notice and this permission notice shall be included in
4243 * all copies or substantial portions of the Software.
4244 *
4245 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4246 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4247 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4248 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4249 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4250 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4251 * THE SOFTWARE.
4252 */
4253
4254var __extends = this && this.__extends || function () {
4255 var _extendStatics = function extendStatics(d, b) {
4256 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
4257 d.__proto__ = b;
4258 } || function (d, b) {
4259 for (var p in b) {
4260 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
4261 }
4262 };
4263 return _extendStatics(d, b);
4264 };
4265 return function (d, b) {
4266 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
4267 _extendStatics(d, b);
4268 function __() {
4269 this.constructor = d;
4270 }
4271 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
4272 };
4273}();
4274Object.defineProperty(exports, "__esModule", { value: true });
4275exports.MDCTextFieldHelperText = void 0;
4276var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
4277var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/helper-text/foundation.ts");
4278var MDCTextFieldHelperText = /** @class */function (_super) {
4279 __extends(MDCTextFieldHelperText, _super);
4280 function MDCTextFieldHelperText() {
4281 return _super !== null && _super.apply(this, arguments) || this;
4282 }
4283 MDCTextFieldHelperText.attachTo = function (root) {
4284 return new MDCTextFieldHelperText(root);
4285 };
4286 Object.defineProperty(MDCTextFieldHelperText.prototype, "foundationForTextField", {
4287 // Provided for access by MDCTextField component
4288 get: function get() {
4289 return this.foundation;
4290 },
4291 enumerable: false,
4292 configurable: true
4293 });
4294 MDCTextFieldHelperText.prototype.getDefaultFoundation = function () {
4295 var _this = this;
4296 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
4297 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
4298 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
4299 var adapter = {
4300 addClass: function addClass(className) {
4301 return _this.root.classList.add(className);
4302 },
4303 removeClass: function removeClass(className) {
4304 return _this.root.classList.remove(className);
4305 },
4306 hasClass: function hasClass(className) {
4307 return _this.root.classList.contains(className);
4308 },
4309 getAttr: function getAttr(attr) {
4310 return _this.root.getAttribute(attr);
4311 },
4312 setAttr: function setAttr(attr, value) {
4313 return _this.root.setAttribute(attr, value);
4314 },
4315 removeAttr: function removeAttr(attr) {
4316 return _this.root.removeAttribute(attr);
4317 },
4318 setContent: function setContent(content) {
4319 _this.root.textContent = content;
4320 }
4321 };
4322 // tslint:enable:object-literal-sort-keys
4323 return new foundation_1.MDCTextFieldHelperTextFoundation(adapter);
4324 };
4325 return MDCTextFieldHelperText;
4326}(component_1.MDCComponent);
4327exports.MDCTextFieldHelperText = MDCTextFieldHelperText;
4328
4329/***/ }),
4330
4331/***/ "./packages/mdc-textfield/helper-text/constants.ts":
4332/*!*********************************************************!*\
4333 !*** ./packages/mdc-textfield/helper-text/constants.ts ***!
4334 \*********************************************************/
4335/*! no static exports found */
4336/***/ (function(module, exports, __webpack_require__) {
4337
4338"use strict";
4339
4340/**
4341 * @license
4342 * Copyright 2016 Google Inc.
4343 *
4344 * Permission is hereby granted, free of charge, to any person obtaining a copy
4345 * of this software and associated documentation files (the "Software"), to deal
4346 * in the Software without restriction, including without limitation the rights
4347 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4348 * copies of the Software, and to permit persons to whom the Software is
4349 * furnished to do so, subject to the following conditions:
4350 *
4351 * The above copyright notice and this permission notice shall be included in
4352 * all copies or substantial portions of the Software.
4353 *
4354 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4355 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4356 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4357 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4358 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4359 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4360 * THE SOFTWARE.
4361 */
4362
4363Object.defineProperty(exports, "__esModule", { value: true });
4364exports.cssClasses = exports.strings = void 0;
4365var cssClasses = {
4366 HELPER_TEXT_PERSISTENT: 'mdc-text-field-helper-text--persistent',
4367 HELPER_TEXT_VALIDATION_MSG: 'mdc-text-field-helper-text--validation-msg',
4368 ROOT: 'mdc-text-field-helper-text'
4369};
4370exports.cssClasses = cssClasses;
4371var strings = {
4372 ARIA_HIDDEN: 'aria-hidden',
4373 ROLE: 'role',
4374 ROOT_SELECTOR: "." + cssClasses.ROOT
4375};
4376exports.strings = strings;
4377
4378/***/ }),
4379
4380/***/ "./packages/mdc-textfield/helper-text/foundation.ts":
4381/*!**********************************************************!*\
4382 !*** ./packages/mdc-textfield/helper-text/foundation.ts ***!
4383 \**********************************************************/
4384/*! no static exports found */
4385/***/ (function(module, exports, __webpack_require__) {
4386
4387"use strict";
4388
4389/**
4390 * @license
4391 * Copyright 2017 Google Inc.
4392 *
4393 * Permission is hereby granted, free of charge, to any person obtaining a copy
4394 * of this software and associated documentation files (the "Software"), to deal
4395 * in the Software without restriction, including without limitation the rights
4396 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4397 * copies of the Software, and to permit persons to whom the Software is
4398 * furnished to do so, subject to the following conditions:
4399 *
4400 * The above copyright notice and this permission notice shall be included in
4401 * all copies or substantial portions of the Software.
4402 *
4403 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4404 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4405 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4406 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4407 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4408 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4409 * THE SOFTWARE.
4410 */
4411
4412var __extends = this && this.__extends || function () {
4413 var _extendStatics = function extendStatics(d, b) {
4414 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
4415 d.__proto__ = b;
4416 } || function (d, b) {
4417 for (var p in b) {
4418 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
4419 }
4420 };
4421 return _extendStatics(d, b);
4422 };
4423 return function (d, b) {
4424 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
4425 _extendStatics(d, b);
4426 function __() {
4427 this.constructor = d;
4428 }
4429 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
4430 };
4431}();
4432var __assign = this && this.__assign || function () {
4433 __assign = Object.assign || function (t) {
4434 for (var s, i = 1, n = arguments.length; i < n; i++) {
4435 s = arguments[i];
4436 for (var p in s) {
4437 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
4438 }
4439 }
4440 return t;
4441 };
4442 return __assign.apply(this, arguments);
4443};
4444Object.defineProperty(exports, "__esModule", { value: true });
4445exports.MDCTextFieldHelperTextFoundation = void 0;
4446var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
4447var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/helper-text/constants.ts");
4448var MDCTextFieldHelperTextFoundation = /** @class */function (_super) {
4449 __extends(MDCTextFieldHelperTextFoundation, _super);
4450 function MDCTextFieldHelperTextFoundation(adapter) {
4451 return _super.call(this, __assign(__assign({}, MDCTextFieldHelperTextFoundation.defaultAdapter), adapter)) || this;
4452 }
4453 Object.defineProperty(MDCTextFieldHelperTextFoundation, "cssClasses", {
4454 get: function get() {
4455 return constants_1.cssClasses;
4456 },
4457 enumerable: false,
4458 configurable: true
4459 });
4460 Object.defineProperty(MDCTextFieldHelperTextFoundation, "strings", {
4461 get: function get() {
4462 return constants_1.strings;
4463 },
4464 enumerable: false,
4465 configurable: true
4466 });
4467 Object.defineProperty(MDCTextFieldHelperTextFoundation, "defaultAdapter", {
4468 /**
4469 * See {@link MDCTextFieldHelperTextAdapter} for typing information on parameters and return types.
4470 */
4471 get: function get() {
4472 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
4473 return {
4474 addClass: function addClass() {
4475 return undefined;
4476 },
4477 removeClass: function removeClass() {
4478 return undefined;
4479 },
4480 hasClass: function hasClass() {
4481 return false;
4482 },
4483 getAttr: function getAttr() {
4484 return null;
4485 },
4486 setAttr: function setAttr() {
4487 return undefined;
4488 },
4489 removeAttr: function removeAttr() {
4490 return undefined;
4491 },
4492 setContent: function setContent() {
4493 return undefined;
4494 }
4495 };
4496 // tslint:enable:object-literal-sort-keys
4497 },
4498 enumerable: false,
4499 configurable: true
4500 });
4501 MDCTextFieldHelperTextFoundation.prototype.getId = function () {
4502 return this.adapter.getAttr('id');
4503 };
4504 MDCTextFieldHelperTextFoundation.prototype.isVisible = function () {
4505 return this.adapter.getAttr(constants_1.strings.ARIA_HIDDEN) !== 'true';
4506 };
4507 /**
4508 * Sets the content of the helper text field.
4509 */
4510 MDCTextFieldHelperTextFoundation.prototype.setContent = function (content) {
4511 this.adapter.setContent(content);
4512 };
4513 MDCTextFieldHelperTextFoundation.prototype.isPersistent = function () {
4514 return this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
4515 };
4516 /**
4517 * @param isPersistent Sets the persistency of the helper text.
4518 */
4519 MDCTextFieldHelperTextFoundation.prototype.setPersistent = function (isPersistent) {
4520 if (isPersistent) {
4521 this.adapter.addClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
4522 } else {
4523 this.adapter.removeClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
4524 }
4525 };
4526 /**
4527 * @return whether the helper text acts as an error validation message.
4528 */
4529 MDCTextFieldHelperTextFoundation.prototype.isValidation = function () {
4530 return this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
4531 };
4532 /**
4533 * @param isValidation True to make the helper text act as an error validation message.
4534 */
4535 MDCTextFieldHelperTextFoundation.prototype.setValidation = function (isValidation) {
4536 if (isValidation) {
4537 this.adapter.addClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
4538 } else {
4539 this.adapter.removeClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
4540 }
4541 };
4542 /**
4543 * Makes the helper text visible to the screen reader.
4544 */
4545 MDCTextFieldHelperTextFoundation.prototype.showToScreenReader = function () {
4546 this.adapter.removeAttr(constants_1.strings.ARIA_HIDDEN);
4547 };
4548 /**
4549 * Sets the validity of the helper text based on the input validity.
4550 */
4551 MDCTextFieldHelperTextFoundation.prototype.setValidity = function (inputIsValid) {
4552 var helperTextIsPersistent = this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_PERSISTENT);
4553 var helperTextIsValidationMsg = this.adapter.hasClass(constants_1.cssClasses.HELPER_TEXT_VALIDATION_MSG);
4554 var validationMsgNeedsDisplay = helperTextIsValidationMsg && !inputIsValid;
4555 if (validationMsgNeedsDisplay) {
4556 this.showToScreenReader();
4557 // If role is already alert, refresh it to trigger another announcement
4558 // from screenreader.
4559 if (this.adapter.getAttr(constants_1.strings.ROLE) === 'alert') {
4560 this.refreshAlertRole();
4561 } else {
4562 this.adapter.setAttr(constants_1.strings.ROLE, 'alert');
4563 }
4564 } else {
4565 this.adapter.removeAttr(constants_1.strings.ROLE);
4566 }
4567 if (!helperTextIsPersistent && !validationMsgNeedsDisplay) {
4568 this.hide();
4569 }
4570 };
4571 /**
4572 * Hides the help text from screen readers.
4573 */
4574 MDCTextFieldHelperTextFoundation.prototype.hide = function () {
4575 this.adapter.setAttr(constants_1.strings.ARIA_HIDDEN, 'true');
4576 };
4577 MDCTextFieldHelperTextFoundation.prototype.refreshAlertRole = function () {
4578 var _this = this;
4579 this.adapter.removeAttr(constants_1.strings.ROLE);
4580 requestAnimationFrame(function () {
4581 _this.adapter.setAttr(constants_1.strings.ROLE, 'alert');
4582 });
4583 };
4584 return MDCTextFieldHelperTextFoundation;
4585}(foundation_1.MDCFoundation);
4586exports.MDCTextFieldHelperTextFoundation = MDCTextFieldHelperTextFoundation;
4587// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
4588exports.default = MDCTextFieldHelperTextFoundation;
4589
4590/***/ }),
4591
4592/***/ "./packages/mdc-textfield/helper-text/index.ts":
4593/*!*****************************************************!*\
4594 !*** ./packages/mdc-textfield/helper-text/index.ts ***!
4595 \*****************************************************/
4596/*! no static exports found */
4597/***/ (function(module, exports, __webpack_require__) {
4598
4599"use strict";
4600
4601/**
4602 * @license
4603 * Copyright 2019 Google Inc.
4604 *
4605 * Permission is hereby granted, free of charge, to any person obtaining a copy
4606 * of this software and associated documentation files (the "Software"), to deal
4607 * in the Software without restriction, including without limitation the rights
4608 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4609 * copies of the Software, and to permit persons to whom the Software is
4610 * furnished to do so, subject to the following conditions:
4611 *
4612 * The above copyright notice and this permission notice shall be included in
4613 * all copies or substantial portions of the Software.
4614 *
4615 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4616 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4617 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4618 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4619 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4620 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4621 * THE SOFTWARE.
4622 */
4623
4624var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
4625 if (k2 === undefined) k2 = k;
4626 Object.defineProperty(o, k2, { enumerable: true, get: function get() {
4627 return m[k];
4628 } });
4629} : function (o, m, k, k2) {
4630 if (k2 === undefined) k2 = k;
4631 o[k2] = m[k];
4632});
4633var __exportStar = this && this.__exportStar || function (m, exports) {
4634 for (var p in m) {
4635 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
4636 }
4637};
4638Object.defineProperty(exports, "__esModule", { value: true });
4639exports.helperTextStrings = exports.helperTextCssClasses = void 0;
4640__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-textfield/helper-text/adapter.ts"), exports);
4641__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/helper-text/component.ts"), exports);
4642__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/helper-text/foundation.ts"), exports);
4643var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/helper-text/constants.ts");
4644Object.defineProperty(exports, "helperTextCssClasses", { enumerable: true, get: function get() {
4645 return constants_1.cssClasses;
4646 } });
4647Object.defineProperty(exports, "helperTextStrings", { enumerable: true, get: function get() {
4648 return constants_1.strings;
4649 } });
4650
4651/***/ }),
4652
4653/***/ "./packages/mdc-textfield/icon/adapter.ts":
4654/*!************************************************!*\
4655 !*** ./packages/mdc-textfield/icon/adapter.ts ***!
4656 \************************************************/
4657/*! no static exports found */
4658/***/ (function(module, exports, __webpack_require__) {
4659
4660"use strict";
4661
4662/**
4663 * @license
4664 * Copyright 2017 Google Inc.
4665 *
4666 * Permission is hereby granted, free of charge, to any person obtaining a copy
4667 * of this software and associated documentation files (the "Software"), to deal
4668 * in the Software without restriction, including without limitation the rights
4669 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4670 * copies of the Software, and to permit persons to whom the Software is
4671 * furnished to do so, subject to the following conditions:
4672 *
4673 * The above copyright notice and this permission notice shall be included in
4674 * all copies or substantial portions of the Software.
4675 *
4676 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4677 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4678 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4679 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4680 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4681 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4682 * THE SOFTWARE.
4683 */
4684
4685Object.defineProperty(exports, "__esModule", { value: true });
4686
4687/***/ }),
4688
4689/***/ "./packages/mdc-textfield/icon/component.ts":
4690/*!**************************************************!*\
4691 !*** ./packages/mdc-textfield/icon/component.ts ***!
4692 \**************************************************/
4693/*! no static exports found */
4694/***/ (function(module, exports, __webpack_require__) {
4695
4696"use strict";
4697
4698/**
4699 * @license
4700 * Copyright 2017 Google Inc.
4701 *
4702 * Permission is hereby granted, free of charge, to any person obtaining a copy
4703 * of this software and associated documentation files (the "Software"), to deal
4704 * in the Software without restriction, including without limitation the rights
4705 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4706 * copies of the Software, and to permit persons to whom the Software is
4707 * furnished to do so, subject to the following conditions:
4708 *
4709 * The above copyright notice and this permission notice shall be included in
4710 * all copies or substantial portions of the Software.
4711 *
4712 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4713 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4714 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4715 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4716 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4717 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4718 * THE SOFTWARE.
4719 */
4720
4721var __extends = this && this.__extends || function () {
4722 var _extendStatics = function extendStatics(d, b) {
4723 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
4724 d.__proto__ = b;
4725 } || function (d, b) {
4726 for (var p in b) {
4727 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
4728 }
4729 };
4730 return _extendStatics(d, b);
4731 };
4732 return function (d, b) {
4733 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
4734 _extendStatics(d, b);
4735 function __() {
4736 this.constructor = d;
4737 }
4738 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
4739 };
4740}();
4741Object.defineProperty(exports, "__esModule", { value: true });
4742exports.MDCTextFieldIcon = void 0;
4743var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
4744var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/icon/foundation.ts");
4745var MDCTextFieldIcon = /** @class */function (_super) {
4746 __extends(MDCTextFieldIcon, _super);
4747 function MDCTextFieldIcon() {
4748 return _super !== null && _super.apply(this, arguments) || this;
4749 }
4750 MDCTextFieldIcon.attachTo = function (root) {
4751 return new MDCTextFieldIcon(root);
4752 };
4753 Object.defineProperty(MDCTextFieldIcon.prototype, "foundationForTextField", {
4754 // Provided for access by MDCTextField component
4755 get: function get() {
4756 return this.foundation;
4757 },
4758 enumerable: false,
4759 configurable: true
4760 });
4761 MDCTextFieldIcon.prototype.getDefaultFoundation = function () {
4762 var _this = this;
4763 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
4764 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
4765 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
4766 var adapter = {
4767 getAttr: function getAttr(attr) {
4768 return _this.root.getAttribute(attr);
4769 },
4770 setAttr: function setAttr(attr, value) {
4771 return _this.root.setAttribute(attr, value);
4772 },
4773 removeAttr: function removeAttr(attr) {
4774 return _this.root.removeAttribute(attr);
4775 },
4776 setContent: function setContent(content) {
4777 _this.root.textContent = content;
4778 },
4779 registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
4780 return _this.listen(evtType, handler);
4781 },
4782 deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
4783 return _this.unlisten(evtType, handler);
4784 },
4785 notifyIconAction: function notifyIconAction() {
4786 return _this.emit(foundation_1.MDCTextFieldIconFoundation.strings.ICON_EVENT, {} /* evtData */, true /* shouldBubble */);
4787 }
4788 };
4789 // tslint:enable:object-literal-sort-keys
4790 return new foundation_1.MDCTextFieldIconFoundation(adapter);
4791 };
4792 return MDCTextFieldIcon;
4793}(component_1.MDCComponent);
4794exports.MDCTextFieldIcon = MDCTextFieldIcon;
4795
4796/***/ }),
4797
4798/***/ "./packages/mdc-textfield/icon/constants.ts":
4799/*!**************************************************!*\
4800 !*** ./packages/mdc-textfield/icon/constants.ts ***!
4801 \**************************************************/
4802/*! no static exports found */
4803/***/ (function(module, exports, __webpack_require__) {
4804
4805"use strict";
4806
4807/**
4808 * @license
4809 * Copyright 2016 Google Inc.
4810 *
4811 * Permission is hereby granted, free of charge, to any person obtaining a copy
4812 * of this software and associated documentation files (the "Software"), to deal
4813 * in the Software without restriction, including without limitation the rights
4814 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4815 * copies of the Software, and to permit persons to whom the Software is
4816 * furnished to do so, subject to the following conditions:
4817 *
4818 * The above copyright notice and this permission notice shall be included in
4819 * all copies or substantial portions of the Software.
4820 *
4821 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4822 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4823 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4824 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4825 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4826 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4827 * THE SOFTWARE.
4828 */
4829
4830Object.defineProperty(exports, "__esModule", { value: true });
4831exports.cssClasses = exports.strings = void 0;
4832var strings = {
4833 ICON_EVENT: 'MDCTextField:icon',
4834 ICON_ROLE: 'button'
4835};
4836exports.strings = strings;
4837var cssClasses = {
4838 ROOT: 'mdc-text-field__icon'
4839};
4840exports.cssClasses = cssClasses;
4841
4842/***/ }),
4843
4844/***/ "./packages/mdc-textfield/icon/foundation.ts":
4845/*!***************************************************!*\
4846 !*** ./packages/mdc-textfield/icon/foundation.ts ***!
4847 \***************************************************/
4848/*! no static exports found */
4849/***/ (function(module, exports, __webpack_require__) {
4850
4851"use strict";
4852
4853/**
4854 * @license
4855 * Copyright 2017 Google Inc.
4856 *
4857 * Permission is hereby granted, free of charge, to any person obtaining a copy
4858 * of this software and associated documentation files (the "Software"), to deal
4859 * in the Software without restriction, including without limitation the rights
4860 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4861 * copies of the Software, and to permit persons to whom the Software is
4862 * furnished to do so, subject to the following conditions:
4863 *
4864 * The above copyright notice and this permission notice shall be included in
4865 * all copies or substantial portions of the Software.
4866 *
4867 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4868 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4869 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4870 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4871 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4872 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4873 * THE SOFTWARE.
4874 */
4875
4876var __extends = this && this.__extends || function () {
4877 var _extendStatics = function extendStatics(d, b) {
4878 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
4879 d.__proto__ = b;
4880 } || function (d, b) {
4881 for (var p in b) {
4882 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
4883 }
4884 };
4885 return _extendStatics(d, b);
4886 };
4887 return function (d, b) {
4888 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
4889 _extendStatics(d, b);
4890 function __() {
4891 this.constructor = d;
4892 }
4893 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
4894 };
4895}();
4896var __assign = this && this.__assign || function () {
4897 __assign = Object.assign || function (t) {
4898 for (var s, i = 1, n = arguments.length; i < n; i++) {
4899 s = arguments[i];
4900 for (var p in s) {
4901 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
4902 }
4903 }
4904 return t;
4905 };
4906 return __assign.apply(this, arguments);
4907};
4908var __values = this && this.__values || function (o) {
4909 var s = typeof Symbol === "function" && Symbol.iterator,
4910 m = s && o[s],
4911 i = 0;
4912 if (m) return m.call(o);
4913 if (o && typeof o.length === "number") return {
4914 next: function next() {
4915 if (o && i >= o.length) o = void 0;
4916 return { value: o && o[i++], done: !o };
4917 }
4918 };
4919 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
4920};
4921Object.defineProperty(exports, "__esModule", { value: true });
4922exports.MDCTextFieldIconFoundation = void 0;
4923var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
4924var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/icon/constants.ts");
4925var INTERACTION_EVENTS = ['click', 'keydown'];
4926var MDCTextFieldIconFoundation = /** @class */function (_super) {
4927 __extends(MDCTextFieldIconFoundation, _super);
4928 function MDCTextFieldIconFoundation(adapter) {
4929 var _this = _super.call(this, __assign(__assign({}, MDCTextFieldIconFoundation.defaultAdapter), adapter)) || this;
4930 _this.savedTabIndex = null;
4931 _this.interactionHandler = function (evt) {
4932 _this.handleInteraction(evt);
4933 };
4934 return _this;
4935 }
4936 Object.defineProperty(MDCTextFieldIconFoundation, "strings", {
4937 get: function get() {
4938 return constants_1.strings;
4939 },
4940 enumerable: false,
4941 configurable: true
4942 });
4943 Object.defineProperty(MDCTextFieldIconFoundation, "cssClasses", {
4944 get: function get() {
4945 return constants_1.cssClasses;
4946 },
4947 enumerable: false,
4948 configurable: true
4949 });
4950 Object.defineProperty(MDCTextFieldIconFoundation, "defaultAdapter", {
4951 /**
4952 * See {@link MDCTextFieldIconAdapter} for typing information on parameters and return types.
4953 */
4954 get: function get() {
4955 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
4956 return {
4957 getAttr: function getAttr() {
4958 return null;
4959 },
4960 setAttr: function setAttr() {
4961 return undefined;
4962 },
4963 removeAttr: function removeAttr() {
4964 return undefined;
4965 },
4966 setContent: function setContent() {
4967 return undefined;
4968 },
4969 registerInteractionHandler: function registerInteractionHandler() {
4970 return undefined;
4971 },
4972 deregisterInteractionHandler: function deregisterInteractionHandler() {
4973 return undefined;
4974 },
4975 notifyIconAction: function notifyIconAction() {
4976 return undefined;
4977 }
4978 };
4979 // tslint:enable:object-literal-sort-keys
4980 },
4981 enumerable: false,
4982 configurable: true
4983 });
4984 MDCTextFieldIconFoundation.prototype.init = function () {
4985 var e_1, _a;
4986 this.savedTabIndex = this.adapter.getAttr('tabindex');
4987 try {
4988 for (var INTERACTION_EVENTS_1 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next(); !INTERACTION_EVENTS_1_1.done; INTERACTION_EVENTS_1_1 = INTERACTION_EVENTS_1.next()) {
4989 var evtType = INTERACTION_EVENTS_1_1.value;
4990 this.adapter.registerInteractionHandler(evtType, this.interactionHandler);
4991 }
4992 } catch (e_1_1) {
4993 e_1 = { error: e_1_1 };
4994 } finally {
4995 try {
4996 if (INTERACTION_EVENTS_1_1 && !INTERACTION_EVENTS_1_1.done && (_a = INTERACTION_EVENTS_1.return)) _a.call(INTERACTION_EVENTS_1);
4997 } finally {
4998 if (e_1) throw e_1.error;
4999 }
5000 }
5001 };
5002 MDCTextFieldIconFoundation.prototype.destroy = function () {
5003 var e_2, _a;
5004 try {
5005 for (var INTERACTION_EVENTS_2 = __values(INTERACTION_EVENTS), INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next(); !INTERACTION_EVENTS_2_1.done; INTERACTION_EVENTS_2_1 = INTERACTION_EVENTS_2.next()) {
5006 var evtType = INTERACTION_EVENTS_2_1.value;
5007 this.adapter.deregisterInteractionHandler(evtType, this.interactionHandler);
5008 }
5009 } catch (e_2_1) {
5010 e_2 = { error: e_2_1 };
5011 } finally {
5012 try {
5013 if (INTERACTION_EVENTS_2_1 && !INTERACTION_EVENTS_2_1.done && (_a = INTERACTION_EVENTS_2.return)) _a.call(INTERACTION_EVENTS_2);
5014 } finally {
5015 if (e_2) throw e_2.error;
5016 }
5017 }
5018 };
5019 MDCTextFieldIconFoundation.prototype.setDisabled = function (disabled) {
5020 if (!this.savedTabIndex) {
5021 return;
5022 }
5023 if (disabled) {
5024 this.adapter.setAttr('tabindex', '-1');
5025 this.adapter.removeAttr('role');
5026 } else {
5027 this.adapter.setAttr('tabindex', this.savedTabIndex);
5028 this.adapter.setAttr('role', constants_1.strings.ICON_ROLE);
5029 }
5030 };
5031 MDCTextFieldIconFoundation.prototype.setAriaLabel = function (label) {
5032 this.adapter.setAttr('aria-label', label);
5033 };
5034 MDCTextFieldIconFoundation.prototype.setContent = function (content) {
5035 this.adapter.setContent(content);
5036 };
5037 MDCTextFieldIconFoundation.prototype.handleInteraction = function (evt) {
5038 var isEnterKey = evt.key === 'Enter' || evt.keyCode === 13;
5039 if (evt.type === 'click' || isEnterKey) {
5040 evt.preventDefault(); // stop click from causing host label to focus
5041 // input
5042 this.adapter.notifyIconAction();
5043 }
5044 };
5045 return MDCTextFieldIconFoundation;
5046}(foundation_1.MDCFoundation);
5047exports.MDCTextFieldIconFoundation = MDCTextFieldIconFoundation;
5048// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
5049exports.default = MDCTextFieldIconFoundation;
5050
5051/***/ }),
5052
5053/***/ "./packages/mdc-textfield/icon/index.ts":
5054/*!**********************************************!*\
5055 !*** ./packages/mdc-textfield/icon/index.ts ***!
5056 \**********************************************/
5057/*! no static exports found */
5058/***/ (function(module, exports, __webpack_require__) {
5059
5060"use strict";
5061
5062/**
5063 * @license
5064 * Copyright 2019 Google Inc.
5065 *
5066 * Permission is hereby granted, free of charge, to any person obtaining a copy
5067 * of this software and associated documentation files (the "Software"), to deal
5068 * in the Software without restriction, including without limitation the rights
5069 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5070 * copies of the Software, and to permit persons to whom the Software is
5071 * furnished to do so, subject to the following conditions:
5072 *
5073 * The above copyright notice and this permission notice shall be included in
5074 * all copies or substantial portions of the Software.
5075 *
5076 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5077 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5078 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
5079 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
5080 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
5081 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5082 * THE SOFTWARE.
5083 */
5084
5085var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
5086 if (k2 === undefined) k2 = k;
5087 Object.defineProperty(o, k2, { enumerable: true, get: function get() {
5088 return m[k];
5089 } });
5090} : function (o, m, k, k2) {
5091 if (k2 === undefined) k2 = k;
5092 o[k2] = m[k];
5093});
5094var __exportStar = this && this.__exportStar || function (m, exports) {
5095 for (var p in m) {
5096 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
5097 }
5098};
5099Object.defineProperty(exports, "__esModule", { value: true });
5100exports.iconStrings = exports.iconCssClasses = void 0;
5101__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-textfield/icon/adapter.ts"), exports);
5102__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/icon/component.ts"), exports);
5103__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/icon/foundation.ts"), exports);
5104var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-textfield/icon/constants.ts");
5105Object.defineProperty(exports, "iconCssClasses", { enumerable: true, get: function get() {
5106 return constants_1.cssClasses;
5107 } });
5108Object.defineProperty(exports, "iconStrings", { enumerable: true, get: function get() {
5109 return constants_1.strings;
5110 } });
5111
5112/***/ }),
5113
5114/***/ "./packages/mdc-textfield/index.ts":
5115/*!*****************************************!*\
5116 !*** ./packages/mdc-textfield/index.ts ***!
5117 \*****************************************/
5118/*! no static exports found */
5119/***/ (function(module, exports, __webpack_require__) {
5120
5121"use strict";
5122
5123/**
5124 * @license
5125 * Copyright 2019 Google Inc.
5126 *
5127 * Permission is hereby granted, free of charge, to any person obtaining a copy
5128 * of this software and associated documentation files (the "Software"), to deal
5129 * in the Software without restriction, including without limitation the rights
5130 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5131 * copies of the Software, and to permit persons to whom the Software is
5132 * furnished to do so, subject to the following conditions:
5133 *
5134 * The above copyright notice and this permission notice shall be included in
5135 * all copies or substantial portions of the Software.
5136 *
5137 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5138 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5139 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
5140 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
5141 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
5142 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5143 * THE SOFTWARE.
5144 */
5145
5146var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
5147 if (k2 === undefined) k2 = k;
5148 Object.defineProperty(o, k2, { enumerable: true, get: function get() {
5149 return m[k];
5150 } });
5151} : function (o, m, k, k2) {
5152 if (k2 === undefined) k2 = k;
5153 o[k2] = m[k];
5154});
5155var __exportStar = this && this.__exportStar || function (m, exports) {
5156 for (var p in m) {
5157 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
5158 }
5159};
5160Object.defineProperty(exports, "__esModule", { value: true });
5161__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-textfield/adapter.ts"), exports);
5162__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-textfield/component.ts"), exports);
5163__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-textfield/constants.ts"), exports);
5164__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-textfield/foundation.ts"), exports);
5165__exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-textfield/types.ts"), exports);
5166__exportStar(__webpack_require__(/*! ./character-counter/index */ "./packages/mdc-textfield/character-counter/index.ts"), exports);
5167__exportStar(__webpack_require__(/*! ./helper-text/index */ "./packages/mdc-textfield/helper-text/index.ts"), exports);
5168__exportStar(__webpack_require__(/*! ./icon/index */ "./packages/mdc-textfield/icon/index.ts"), exports);
5169
5170/***/ }),
5171
5172/***/ "./packages/mdc-textfield/types.ts":
5173/*!*****************************************!*\
5174 !*** ./packages/mdc-textfield/types.ts ***!
5175 \*****************************************/
5176/*! no static exports found */
5177/***/ (function(module, exports, __webpack_require__) {
5178
5179"use strict";
5180
5181/**
5182 * @license
5183 * Copyright 2019 Google Inc.
5184 *
5185 * Permission is hereby granted, free of charge, to any person obtaining a copy
5186 * of this software and associated documentation files (the "Software"), to deal
5187 * in the Software without restriction, including without limitation the rights
5188 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5189 * copies of the Software, and to permit persons to whom the Software is
5190 * furnished to do so, subject to the following conditions:
5191 *
5192 * The above copyright notice and this permission notice shall be included in
5193 * all copies or substantial portions of the Software.
5194 *
5195 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5196 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5197 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
5198 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
5199 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
5200 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5201 * THE SOFTWARE.
5202 */
5203
5204Object.defineProperty(exports, "__esModule", { value: true });
5205
5206/***/ })
5207
5208/******/ });
5209});
5210//# sourceMappingURL=mdc.textfield.js.map
\No newline at end of file