UNPKG

36.9 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([], factory);
13 else if(typeof exports === 'object')
14 exports["floatingLabel"] = factory();
15 else
16 root["mdc"] = root["mdc"] || {}, root["mdc"]["floatingLabel"] = 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-floating-label/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 default param so that
177 // this.root_ is defined and can be used within the foundation class.
178 this.foundation = foundation === undefined ? this.getDefaultFoundation() : foundation;
179 this.foundation.init();
180 this.initialSyncWithDOM();
181 }
182 MDCComponent.attachTo = function (root) {
183 // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and
184 // returns an instantiated component with its root set to that element. Also note that in the cases of
185 // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized
186 // from getDefaultFoundation().
187 return new MDCComponent(root, new foundation_1.MDCFoundation({}));
188 };
189 /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */
190 MDCComponent.prototype.initialize = function () {
191 var _args = [];
192 for (var _i = 0; _i < arguments.length; _i++) {
193 _args[_i] = arguments[_i];
194 }
195 // Subclasses can override this to do any additional setup work that would be considered part of a
196 // "constructor". Essentially, it is a hook into the parent constructor before the foundation is
197 // initialized. Any additional arguments besides root and foundation will be passed in here.
198 };
199 MDCComponent.prototype.getDefaultFoundation = function () {
200 // Subclasses must override this method to return a properly configured foundation class for the
201 // component.
202 throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class');
203 };
204 MDCComponent.prototype.initialSyncWithDOM = function () {
205 // Subclasses should override this method if they need to perform work to synchronize with a host DOM
206 // object. An example of this would be a form control wrapper that needs to synchronize its internal state
207 // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM
208 // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor.
209 };
210 MDCComponent.prototype.destroy = function () {
211 // Subclasses may implement this method to release any resources / deregister any listeners they have
212 // attached. An example of this might be deregistering a resize event from the window object.
213 this.foundation.destroy();
214 };
215 MDCComponent.prototype.listen = function (evtType, handler, options) {
216 this.root.addEventListener(evtType, handler, options);
217 };
218 MDCComponent.prototype.unlisten = function (evtType, handler, options) {
219 this.root.removeEventListener(evtType, handler, options);
220 };
221 /**
222 * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data.
223 */
224 MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) {
225 if (shouldBubble === void 0) {
226 shouldBubble = false;
227 }
228 var evt;
229 if (typeof CustomEvent === 'function') {
230 evt = new CustomEvent(evtType, {
231 bubbles: shouldBubble,
232 detail: evtData
233 });
234 } else {
235 evt = document.createEvent('CustomEvent');
236 evt.initCustomEvent(evtType, shouldBubble, false, evtData);
237 }
238 this.root.dispatchEvent(evt);
239 };
240 return MDCComponent;
241}();
242exports.MDCComponent = MDCComponent;
243// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
244exports.default = MDCComponent;
245
246/***/ }),
247
248/***/ "./packages/mdc-base/foundation.ts":
249/*!*****************************************!*\
250 !*** ./packages/mdc-base/foundation.ts ***!
251 \*****************************************/
252/*! no static exports found */
253/***/ (function(module, exports, __webpack_require__) {
254
255"use strict";
256
257/**
258 * @license
259 * Copyright 2016 Google Inc.
260 *
261 * Permission is hereby granted, free of charge, to any person obtaining a copy
262 * of this software and associated documentation files (the "Software"), to deal
263 * in the Software without restriction, including without limitation the rights
264 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
265 * copies of the Software, and to permit persons to whom the Software is
266 * furnished to do so, subject to the following conditions:
267 *
268 * The above copyright notice and this permission notice shall be included in
269 * all copies or substantial portions of the Software.
270 *
271 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
272 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
273 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
274 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
275 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
276 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
277 * THE SOFTWARE.
278 */
279
280Object.defineProperty(exports, "__esModule", { value: true });
281exports.MDCFoundation = void 0;
282var MDCFoundation = /** @class */function () {
283 function MDCFoundation(adapter) {
284 if (adapter === void 0) {
285 adapter = {};
286 }
287 this.adapter = adapter;
288 }
289 Object.defineProperty(MDCFoundation, "cssClasses", {
290 get: function get() {
291 // Classes extending MDCFoundation should implement this method to return an object which exports every
292 // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}
293 return {};
294 },
295 enumerable: false,
296 configurable: true
297 });
298 Object.defineProperty(MDCFoundation, "strings", {
299 get: function get() {
300 // Classes extending MDCFoundation should implement this method to return an object which exports all
301 // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
302 return {};
303 },
304 enumerable: false,
305 configurable: true
306 });
307 Object.defineProperty(MDCFoundation, "numbers", {
308 get: function get() {
309 // Classes extending MDCFoundation should implement this method to return an object which exports all
310 // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}
311 return {};
312 },
313 enumerable: false,
314 configurable: true
315 });
316 Object.defineProperty(MDCFoundation, "defaultAdapter", {
317 get: function get() {
318 // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient
319 // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter
320 // validation.
321 return {};
322 },
323 enumerable: false,
324 configurable: true
325 });
326 MDCFoundation.prototype.init = function () {
327 // Subclasses should override this method to perform initialization routines (registering events, etc.)
328 };
329 MDCFoundation.prototype.destroy = function () {
330 // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
331 };
332 return MDCFoundation;
333}();
334exports.MDCFoundation = MDCFoundation;
335// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
336exports.default = MDCFoundation;
337
338/***/ }),
339
340/***/ "./packages/mdc-dom/ponyfill.ts":
341/*!**************************************!*\
342 !*** ./packages/mdc-dom/ponyfill.ts ***!
343 \**************************************/
344/*! no static exports found */
345/***/ (function(module, exports, __webpack_require__) {
346
347"use strict";
348
349/**
350 * @license
351 * Copyright 2018 Google Inc.
352 *
353 * Permission is hereby granted, free of charge, to any person obtaining a copy
354 * of this software and associated documentation files (the "Software"), to deal
355 * in the Software without restriction, including without limitation the rights
356 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
357 * copies of the Software, and to permit persons to whom the Software is
358 * furnished to do so, subject to the following conditions:
359 *
360 * The above copyright notice and this permission notice shall be included in
361 * all copies or substantial portions of the Software.
362 *
363 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
364 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
365 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
366 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
367 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
368 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
369 * THE SOFTWARE.
370 */
371
372Object.defineProperty(exports, "__esModule", { value: true });
373exports.estimateScrollWidth = exports.matches = exports.closest = void 0;
374/**
375 * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain.
376 * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC.
377 */
378function closest(element, selector) {
379 if (element.closest) {
380 return element.closest(selector);
381 }
382 var el = element;
383 while (el) {
384 if (matches(el, selector)) {
385 return el;
386 }
387 el = el.parentElement;
388 }
389 return null;
390}
391exports.closest = closest;
392function matches(element, selector) {
393 var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector;
394 return nativeMatches.call(element, selector);
395}
396exports.matches = matches;
397/**
398 * Used to compute the estimated scroll width of elements. When an element is
399 * hidden due to display: none; being applied to a parent element, the width is
400 * returned as 0. However, the element will have a true width once no longer
401 * inside a display: none context. This method computes an estimated width when
402 * the element is hidden or returns the true width when the element is visble.
403 * @param {Element} element the element whose width to estimate
404 */
405function estimateScrollWidth(element) {
406 // Check the offsetParent. If the element inherits display: none from any
407 // parent, the offsetParent property will be null (see
408 // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent).
409 // This check ensures we only clone the node when necessary.
410 var htmlEl = element;
411 if (htmlEl.offsetParent !== null) {
412 return htmlEl.scrollWidth;
413 }
414 var clone = htmlEl.cloneNode(true);
415 clone.style.setProperty('position', 'absolute');
416 clone.style.setProperty('transform', 'translate(-9999px, -9999px)');
417 document.documentElement.appendChild(clone);
418 var scrollWidth = clone.scrollWidth;
419 document.documentElement.removeChild(clone);
420 return scrollWidth;
421}
422exports.estimateScrollWidth = estimateScrollWidth;
423
424/***/ }),
425
426/***/ "./packages/mdc-floating-label/adapter.ts":
427/*!************************************************!*\
428 !*** ./packages/mdc-floating-label/adapter.ts ***!
429 \************************************************/
430/*! no static exports found */
431/***/ (function(module, exports, __webpack_require__) {
432
433"use strict";
434
435/**
436 * @license
437 * Copyright 2017 Google Inc.
438 *
439 * Permission is hereby granted, free of charge, to any person obtaining a copy
440 * of this software and associated documentation files (the "Software"), to deal
441 * in the Software without restriction, including without limitation the rights
442 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
443 * copies of the Software, and to permit persons to whom the Software is
444 * furnished to do so, subject to the following conditions:
445 *
446 * The above copyright notice and this permission notice shall be included in
447 * all copies or substantial portions of the Software.
448 *
449 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
450 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
451 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
452 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
453 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
454 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
455 * THE SOFTWARE.
456 */
457
458Object.defineProperty(exports, "__esModule", { value: true });
459
460/***/ }),
461
462/***/ "./packages/mdc-floating-label/component.ts":
463/*!**************************************************!*\
464 !*** ./packages/mdc-floating-label/component.ts ***!
465 \**************************************************/
466/*! no static exports found */
467/***/ (function(module, exports, __webpack_require__) {
468
469"use strict";
470
471/**
472 * @license
473 * Copyright 2016 Google Inc.
474 *
475 * Permission is hereby granted, free of charge, to any person obtaining a copy
476 * of this software and associated documentation files (the "Software"), to deal
477 * in the Software without restriction, including without limitation the rights
478 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
479 * copies of the Software, and to permit persons to whom the Software is
480 * furnished to do so, subject to the following conditions:
481 *
482 * The above copyright notice and this permission notice shall be included in
483 * all copies or substantial portions of the Software.
484 *
485 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
486 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
487 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
488 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
489 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
490 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
491 * THE SOFTWARE.
492 */
493
494var __extends = this && this.__extends || function () {
495 var _extendStatics = function extendStatics(d, b) {
496 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
497 d.__proto__ = b;
498 } || function (d, b) {
499 for (var p in b) {
500 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
501 }
502 };
503 return _extendStatics(d, b);
504 };
505 return function (d, b) {
506 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
507 _extendStatics(d, b);
508 function __() {
509 this.constructor = d;
510 }
511 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
512 };
513}();
514Object.defineProperty(exports, "__esModule", { value: true });
515exports.MDCFloatingLabel = void 0;
516var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts");
517var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts");
518var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-floating-label/foundation.ts");
519var MDCFloatingLabel = /** @class */function (_super) {
520 __extends(MDCFloatingLabel, _super);
521 function MDCFloatingLabel() {
522 return _super !== null && _super.apply(this, arguments) || this;
523 }
524 MDCFloatingLabel.attachTo = function (root) {
525 return new MDCFloatingLabel(root);
526 };
527 /**
528 * Styles the label to produce the label shake for errors.
529 * @param shouldShake If true, shakes the label by adding a CSS class; otherwise, stops shaking by removing the class.
530 */
531 MDCFloatingLabel.prototype.shake = function (shouldShake) {
532 this.foundation.shake(shouldShake);
533 };
534 /**
535 * Styles the label to float/dock.
536 * @param shouldFloat If true, floats the label by adding a CSS class; otherwise, docks it by removing the class.
537 */
538 MDCFloatingLabel.prototype.float = function (shouldFloat) {
539 this.foundation.float(shouldFloat);
540 };
541 /**
542 * Styles the label as required.
543 * @param isRequired If true, adds an asterisk to the label, indicating that it is required.
544 */
545 MDCFloatingLabel.prototype.setRequired = function (isRequired) {
546 this.foundation.setRequired(isRequired);
547 };
548 MDCFloatingLabel.prototype.getWidth = function () {
549 return this.foundation.getWidth();
550 };
551 MDCFloatingLabel.prototype.getDefaultFoundation = function () {
552 var _this = this;
553 // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
554 // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
555 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
556 var adapter = {
557 addClass: function addClass(className) {
558 return _this.root.classList.add(className);
559 },
560 removeClass: function removeClass(className) {
561 return _this.root.classList.remove(className);
562 },
563 getWidth: function getWidth() {
564 return ponyfill_1.estimateScrollWidth(_this.root);
565 },
566 registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
567 return _this.listen(evtType, handler);
568 },
569 deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
570 return _this.unlisten(evtType, handler);
571 }
572 };
573 // tslint:enable:object-literal-sort-keys
574 return new foundation_1.MDCFloatingLabelFoundation(adapter);
575 };
576 return MDCFloatingLabel;
577}(component_1.MDCComponent);
578exports.MDCFloatingLabel = MDCFloatingLabel;
579
580/***/ }),
581
582/***/ "./packages/mdc-floating-label/constants.ts":
583/*!**************************************************!*\
584 !*** ./packages/mdc-floating-label/constants.ts ***!
585 \**************************************************/
586/*! no static exports found */
587/***/ (function(module, exports, __webpack_require__) {
588
589"use strict";
590
591/**
592 * @license
593 * Copyright 2016 Google Inc.
594 *
595 * Permission is hereby granted, free of charge, to any person obtaining a copy
596 * of this software and associated documentation files (the "Software"), to deal
597 * in the Software without restriction, including without limitation the rights
598 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
599 * copies of the Software, and to permit persons to whom the Software is
600 * furnished to do so, subject to the following conditions:
601 *
602 * The above copyright notice and this permission notice shall be included in
603 * all copies or substantial portions of the Software.
604 *
605 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
606 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
607 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
608 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
609 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
610 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
611 * THE SOFTWARE.
612 */
613
614Object.defineProperty(exports, "__esModule", { value: true });
615exports.cssClasses = void 0;
616exports.cssClasses = {
617 LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above',
618 LABEL_REQUIRED: 'mdc-floating-label--required',
619 LABEL_SHAKE: 'mdc-floating-label--shake',
620 ROOT: 'mdc-floating-label'
621};
622
623/***/ }),
624
625/***/ "./packages/mdc-floating-label/foundation.ts":
626/*!***************************************************!*\
627 !*** ./packages/mdc-floating-label/foundation.ts ***!
628 \***************************************************/
629/*! no static exports found */
630/***/ (function(module, exports, __webpack_require__) {
631
632"use strict";
633
634/**
635 * @license
636 * Copyright 2016 Google Inc.
637 *
638 * Permission is hereby granted, free of charge, to any person obtaining a copy
639 * of this software and associated documentation files (the "Software"), to deal
640 * in the Software without restriction, including without limitation the rights
641 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
642 * copies of the Software, and to permit persons to whom the Software is
643 * furnished to do so, subject to the following conditions:
644 *
645 * The above copyright notice and this permission notice shall be included in
646 * all copies or substantial portions of the Software.
647 *
648 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
649 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
650 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
651 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
652 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
653 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
654 * THE SOFTWARE.
655 */
656
657var __extends = this && this.__extends || function () {
658 var _extendStatics = function extendStatics(d, b) {
659 _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
660 d.__proto__ = b;
661 } || function (d, b) {
662 for (var p in b) {
663 if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
664 }
665 };
666 return _extendStatics(d, b);
667 };
668 return function (d, b) {
669 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
670 _extendStatics(d, b);
671 function __() {
672 this.constructor = d;
673 }
674 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
675 };
676}();
677var __assign = this && this.__assign || function () {
678 __assign = Object.assign || function (t) {
679 for (var s, i = 1, n = arguments.length; i < n; i++) {
680 s = arguments[i];
681 for (var p in s) {
682 if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
683 }
684 }
685 return t;
686 };
687 return __assign.apply(this, arguments);
688};
689Object.defineProperty(exports, "__esModule", { value: true });
690exports.MDCFloatingLabelFoundation = void 0;
691var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts");
692var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-floating-label/constants.ts");
693var MDCFloatingLabelFoundation = /** @class */function (_super) {
694 __extends(MDCFloatingLabelFoundation, _super);
695 function MDCFloatingLabelFoundation(adapter) {
696 var _this = _super.call(this, __assign(__assign({}, MDCFloatingLabelFoundation.defaultAdapter), adapter)) || this;
697 _this.shakeAnimationEndHandler_ = function () {
698 return _this.handleShakeAnimationEnd_();
699 };
700 return _this;
701 }
702 Object.defineProperty(MDCFloatingLabelFoundation, "cssClasses", {
703 get: function get() {
704 return constants_1.cssClasses;
705 },
706 enumerable: false,
707 configurable: true
708 });
709 Object.defineProperty(MDCFloatingLabelFoundation, "defaultAdapter", {
710 /**
711 * See {@link MDCFloatingLabelAdapter} for typing information on parameters and return types.
712 */
713 get: function get() {
714 // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
715 return {
716 addClass: function addClass() {
717 return undefined;
718 },
719 removeClass: function removeClass() {
720 return undefined;
721 },
722 getWidth: function getWidth() {
723 return 0;
724 },
725 registerInteractionHandler: function registerInteractionHandler() {
726 return undefined;
727 },
728 deregisterInteractionHandler: function deregisterInteractionHandler() {
729 return undefined;
730 }
731 };
732 // tslint:enable:object-literal-sort-keys
733 },
734 enumerable: false,
735 configurable: true
736 });
737 MDCFloatingLabelFoundation.prototype.init = function () {
738 this.adapter.registerInteractionHandler('animationend', this.shakeAnimationEndHandler_);
739 };
740 MDCFloatingLabelFoundation.prototype.destroy = function () {
741 this.adapter.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler_);
742 };
743 /**
744 * Returns the width of the label element.
745 */
746 MDCFloatingLabelFoundation.prototype.getWidth = function () {
747 return this.adapter.getWidth();
748 };
749 /**
750 * Styles the label to produce a shake animation to indicate an error.
751 * @param shouldShake If true, adds the shake CSS class; otherwise, removes shake class.
752 */
753 MDCFloatingLabelFoundation.prototype.shake = function (shouldShake) {
754 var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
755 if (shouldShake) {
756 this.adapter.addClass(LABEL_SHAKE);
757 } else {
758 this.adapter.removeClass(LABEL_SHAKE);
759 }
760 };
761 /**
762 * Styles the label to float or dock.
763 * @param shouldFloat If true, adds the float CSS class; otherwise, removes float and shake classes to dock the label.
764 */
765 MDCFloatingLabelFoundation.prototype.float = function (shouldFloat) {
766 var _a = MDCFloatingLabelFoundation.cssClasses,
767 LABEL_FLOAT_ABOVE = _a.LABEL_FLOAT_ABOVE,
768 LABEL_SHAKE = _a.LABEL_SHAKE;
769 if (shouldFloat) {
770 this.adapter.addClass(LABEL_FLOAT_ABOVE);
771 } else {
772 this.adapter.removeClass(LABEL_FLOAT_ABOVE);
773 this.adapter.removeClass(LABEL_SHAKE);
774 }
775 };
776 /**
777 * Styles the label as required.
778 * @param isRequired If true, adds an asterisk to the label, indicating that it is required.
779 */
780 MDCFloatingLabelFoundation.prototype.setRequired = function (isRequired) {
781 var LABEL_REQUIRED = MDCFloatingLabelFoundation.cssClasses.LABEL_REQUIRED;
782 if (isRequired) {
783 this.adapter.addClass(LABEL_REQUIRED);
784 } else {
785 this.adapter.removeClass(LABEL_REQUIRED);
786 }
787 };
788 MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd_ = function () {
789 var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE;
790 this.adapter.removeClass(LABEL_SHAKE);
791 };
792 return MDCFloatingLabelFoundation;
793}(foundation_1.MDCFoundation);
794exports.MDCFloatingLabelFoundation = MDCFloatingLabelFoundation;
795// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
796exports.default = MDCFloatingLabelFoundation;
797
798/***/ }),
799
800/***/ "./packages/mdc-floating-label/index.ts":
801/*!**********************************************!*\
802 !*** ./packages/mdc-floating-label/index.ts ***!
803 \**********************************************/
804/*! no static exports found */
805/***/ (function(module, exports, __webpack_require__) {
806
807"use strict";
808
809/**
810 * @license
811 * Copyright 2019 Google Inc.
812 *
813 * Permission is hereby granted, free of charge, to any person obtaining a copy
814 * of this software and associated documentation files (the "Software"), to deal
815 * in the Software without restriction, including without limitation the rights
816 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
817 * copies of the Software, and to permit persons to whom the Software is
818 * furnished to do so, subject to the following conditions:
819 *
820 * The above copyright notice and this permission notice shall be included in
821 * all copies or substantial portions of the Software.
822 *
823 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
824 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
825 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
826 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
827 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
828 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
829 * THE SOFTWARE.
830 */
831
832var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
833 if (k2 === undefined) k2 = k;
834 Object.defineProperty(o, k2, { enumerable: true, get: function get() {
835 return m[k];
836 } });
837} : function (o, m, k, k2) {
838 if (k2 === undefined) k2 = k;
839 o[k2] = m[k];
840});
841var __exportStar = this && this.__exportStar || function (m, exports) {
842 for (var p in m) {
843 if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
844 }
845};
846Object.defineProperty(exports, "__esModule", { value: true });
847__exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-floating-label/adapter.ts"), exports);
848__exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-floating-label/component.ts"), exports);
849__exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-floating-label/constants.ts"), exports);
850__exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-floating-label/foundation.ts"), exports);
851
852/***/ })
853
854/******/ });
855});
856//# sourceMappingURL=mdc.floatingLabel.js.map
\No newline at end of file