omim
Version:
Material Design for Omi.
1,040 lines (982 loc) • 301 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("omi"));
else if(typeof define === 'function' && define.amd)
define(["omi"], factory);
else if(typeof exports === 'object')
exports["MTextField"] = factory(require("omi"));
else
root["MTextField"] = factory(root["Omi"]);
})(window, function(__WEBPACK_EXTERNAL_MODULE_omi__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "./src/text-field/index.tsx");
/******/ })
/************************************************************************/
/******/ ({
/***/ "./node_modules/@material/base/component.js":
/*!**************************************************!*\
!*** ./node_modules/@material/base/component.js ***!
\**************************************************/
/*! exports provided: MDCComponent, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCComponent", function() { return MDCComponent; });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
/* harmony import */ var _foundation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation */ "./node_modules/@material/base/foundation.js");
/**
* @license
* Copyright 2016 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var MDCComponent = /** @class */ (function () {
function MDCComponent(root, foundation) {
var args = [];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}
this.root_ = root;
this.initialize.apply(this, tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"](args));
// Note that we initialize foundation here and not within the constructor's default param so that
// this.root_ is defined and can be used within the foundation class.
this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation;
this.foundation_.init();
this.initialSyncWithDOM();
}
MDCComponent.attachTo = function (root) {
// Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and
// returns an instantiated component with its root set to that element. Also note that in the cases of
// subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized
// from getDefaultFoundation().
return new MDCComponent(root, new _foundation__WEBPACK_IMPORTED_MODULE_1__["MDCFoundation"]({}));
};
/* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */
MDCComponent.prototype.initialize = function () {
var _args = [];
for (var _i = 0; _i < arguments.length; _i++) {
_args[_i] = arguments[_i];
}
// Subclasses can override this to do any additional setup work that would be considered part of a
// "constructor". Essentially, it is a hook into the parent constructor before the foundation is
// initialized. Any additional arguments besides root and foundation will be passed in here.
};
MDCComponent.prototype.getDefaultFoundation = function () {
// Subclasses must override this method to return a properly configured foundation class for the
// component.
throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' +
'foundation class');
};
MDCComponent.prototype.initialSyncWithDOM = function () {
// Subclasses should override this method if they need to perform work to synchronize with a host DOM
// object. An example of this would be a form control wrapper that needs to synchronize its internal state
// to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM
// reads/writes that would cause layout / paint, as this is called synchronously from within the constructor.
};
MDCComponent.prototype.destroy = function () {
// Subclasses may implement this method to release any resources / deregister any listeners they have
// attached. An example of this might be deregistering a resize event from the window object.
this.foundation_.destroy();
};
MDCComponent.prototype.listen = function (evtType, handler) {
this.root_.addEventListener(evtType, handler);
};
MDCComponent.prototype.unlisten = function (evtType, handler) {
this.root_.removeEventListener(evtType, handler);
};
/**
* Fires a cross-browser-compatible custom event from the component root of the given type, with the given data.
*/
MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) {
if (shouldBubble === void 0) { shouldBubble = false; }
var evt;
if (typeof CustomEvent === 'function') {
evt = new CustomEvent(evtType, {
bubbles: shouldBubble,
detail: evtData,
});
}
else {
evt = document.createEvent('CustomEvent');
evt.initCustomEvent(evtType, shouldBubble, false, evtData);
}
this.root_.dispatchEvent(evt);
};
return MDCComponent;
}());
// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
/* harmony default export */ __webpack_exports__["default"] = (MDCComponent);
//# sourceMappingURL=component.js.map
/***/ }),
/***/ "./node_modules/@material/base/foundation.js":
/*!***************************************************!*\
!*** ./node_modules/@material/base/foundation.js ***!
\***************************************************/
/*! exports provided: MDCFoundation, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCFoundation", function() { return MDCFoundation; });
/**
* @license
* Copyright 2016 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var MDCFoundation = /** @class */ (function () {
function MDCFoundation(adapter) {
if (adapter === void 0) { adapter = {}; }
this.adapter_ = adapter;
}
Object.defineProperty(MDCFoundation, "cssClasses", {
get: function () {
// Classes extending MDCFoundation should implement this method to return an object which exports every
// CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}
return {};
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCFoundation, "strings", {
get: function () {
// Classes extending MDCFoundation should implement this method to return an object which exports all
// semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
return {};
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCFoundation, "numbers", {
get: function () {
// Classes extending MDCFoundation should implement this method to return an object which exports all
// of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}
return {};
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCFoundation, "defaultAdapter", {
get: function () {
// Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient
// way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter
// validation.
return {};
},
enumerable: true,
configurable: true
});
MDCFoundation.prototype.init = function () {
// Subclasses should override this method to perform initialization routines (registering events, etc.)
};
MDCFoundation.prototype.destroy = function () {
// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
};
return MDCFoundation;
}());
// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
/* harmony default export */ __webpack_exports__["default"] = (MDCFoundation);
//# sourceMappingURL=foundation.js.map
/***/ }),
/***/ "./node_modules/@material/dom/index.js":
/*!*********************************************!*\
!*** ./node_modules/@material/dom/index.js ***!
\*********************************************/
/*! exports provided: ponyfill */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _ponyfill__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ponyfill */ "./node_modules/@material/dom/ponyfill.js");
/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "ponyfill", function() { return _ponyfill__WEBPACK_IMPORTED_MODULE_0__; });
/**
* @license
* Copyright 2018 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
//# sourceMappingURL=index.js.map
/***/ }),
/***/ "./node_modules/@material/dom/ponyfill.js":
/*!************************************************!*\
!*** ./node_modules/@material/dom/ponyfill.js ***!
\************************************************/
/*! exports provided: closest, matches */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "closest", function() { return closest; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "matches", function() { return matches; });
/**
* @license
* Copyright 2018 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain.
* This makes ponyfills safer than traditional polyfills, especially for libraries like MDC.
*/
function closest(element, selector) {
if (element.closest) {
return element.closest(selector);
}
var el = element;
while (el) {
if (matches(el, selector)) {
return el;
}
el = el.parentElement;
}
return null;
}
function matches(element, selector) {
var nativeMatches = element.matches
|| element.webkitMatchesSelector
|| element.msMatchesSelector;
return nativeMatches.call(element, selector);
}
//# sourceMappingURL=ponyfill.js.map
/***/ }),
/***/ "./node_modules/@material/textfield/character-counter/component.js":
/*!*************************************************************************!*\
!*** ./node_modules/@material/textfield/character-counter/component.js ***!
\*************************************************************************/
/*! exports provided: MDCTextFieldCharacterCounter */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCTextFieldCharacterCounter", function() { return MDCTextFieldCharacterCounter; });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
/* harmony import */ var _material_base_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @material/base/component */ "./node_modules/@material/base/component.js");
/* harmony import */ var _foundation__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./foundation */ "./node_modules/@material/textfield/character-counter/foundation.js");
/**
* @license
* Copyright 2019 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var MDCTextFieldCharacterCounter = /** @class */ (function (_super) {
tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](MDCTextFieldCharacterCounter, _super);
function MDCTextFieldCharacterCounter() {
return _super !== null && _super.apply(this, arguments) || this;
}
MDCTextFieldCharacterCounter.attachTo = function (root) {
return new MDCTextFieldCharacterCounter(root);
};
Object.defineProperty(MDCTextFieldCharacterCounter.prototype, "foundation", {
get: function () {
return this.foundation_;
},
enumerable: true,
configurable: true
});
MDCTextFieldCharacterCounter.prototype.getDefaultFoundation = function () {
var _this = this;
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
var adapter = {
setContent: function (content) {
_this.root_.textContent = content;
},
};
return new _foundation__WEBPACK_IMPORTED_MODULE_2__["MDCTextFieldCharacterCounterFoundation"](adapter);
};
return MDCTextFieldCharacterCounter;
}(_material_base_component__WEBPACK_IMPORTED_MODULE_1__["MDCComponent"]));
//# sourceMappingURL=component.js.map
/***/ }),
/***/ "./node_modules/@material/textfield/character-counter/constants.js":
/*!*************************************************************************!*\
!*** ./node_modules/@material/textfield/character-counter/constants.js ***!
\*************************************************************************/
/*! exports provided: strings, cssClasses */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "strings", function() { return strings; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cssClasses", function() { return cssClasses; });
/**
* @license
* Copyright 2019 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var cssClasses = {
ROOT: 'mdc-text-field-character-counter',
};
var strings = {
ROOT_SELECTOR: "." + cssClasses.ROOT,
};
//# sourceMappingURL=constants.js.map
/***/ }),
/***/ "./node_modules/@material/textfield/character-counter/foundation.js":
/*!**************************************************************************!*\
!*** ./node_modules/@material/textfield/character-counter/foundation.js ***!
\**************************************************************************/
/*! exports provided: MDCTextFieldCharacterCounterFoundation, default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCTextFieldCharacterCounterFoundation", function() { return MDCTextFieldCharacterCounterFoundation; });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
/* harmony import */ var _material_base_foundation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @material/base/foundation */ "./node_modules/@material/base/foundation.js");
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./constants */ "./node_modules/@material/textfield/character-counter/constants.js");
/**
* @license
* Copyright 2019 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var MDCTextFieldCharacterCounterFoundation = /** @class */ (function (_super) {
tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](MDCTextFieldCharacterCounterFoundation, _super);
function MDCTextFieldCharacterCounterFoundation(adapter) {
return _super.call(this, tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"]({}, MDCTextFieldCharacterCounterFoundation.defaultAdapter, adapter)) || this;
}
Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "cssClasses", {
get: function () {
return _constants__WEBPACK_IMPORTED_MODULE_2__["cssClasses"];
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "strings", {
get: function () {
return _constants__WEBPACK_IMPORTED_MODULE_2__["strings"];
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCTextFieldCharacterCounterFoundation, "defaultAdapter", {
/**
* See {@link MDCTextFieldCharacterCounterAdapter} for typing information on parameters and return types.
*/
get: function () {
return {
setContent: function () { return undefined; },
};
},
enumerable: true,
configurable: true
});
MDCTextFieldCharacterCounterFoundation.prototype.setCounterValue = function (currentLength, maxLength) {
currentLength = Math.min(currentLength, maxLength);
this.adapter_.setContent(currentLength + " / " + maxLength);
};
return MDCTextFieldCharacterCounterFoundation;
}(_material_base_foundation__WEBPACK_IMPORTED_MODULE_1__["MDCFoundation"]));
// tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier.
/* harmony default export */ __webpack_exports__["default"] = (MDCTextFieldCharacterCounterFoundation);
//# sourceMappingURL=foundation.js.map
/***/ }),
/***/ "./node_modules/@material/textfield/character-counter/index.js":
/*!*********************************************************************!*\
!*** ./node_modules/@material/textfield/character-counter/index.js ***!
\*********************************************************************/
/*! exports provided: MDCTextFieldCharacterCounter, MDCTextFieldCharacterCounterFoundation */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./component */ "./node_modules/@material/textfield/character-counter/component.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDCTextFieldCharacterCounter", function() { return _component__WEBPACK_IMPORTED_MODULE_0__["MDCTextFieldCharacterCounter"]; });
/* harmony import */ var _foundation__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation */ "./node_modules/@material/textfield/character-counter/foundation.js");
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MDCTextFieldCharacterCounterFoundation", function() { return _foundation__WEBPACK_IMPORTED_MODULE_1__["MDCTextFieldCharacterCounterFoundation"]; });
/**
* @license
* Copyright 2019 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
//# sourceMappingURL=index.js.map
/***/ }),
/***/ "./node_modules/@material/textfield/component.js":
/*!*******************************************************!*\
!*** ./node_modules/@material/textfield/component.js ***!
\*******************************************************/
/*! exports provided: MDCTextField */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCTextField", function() { return MDCTextField; });
/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
/* harmony import */ var _material_base_component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @material/base/component */ "./node_modules/@material/base/component.js");
/* harmony import */ var _material_dom_ponyfill__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @material/dom/ponyfill */ "./node_modules/@material/dom/ponyfill.js");
/* harmony import */ var _material_floating_label_index__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @material/floating-label/index */ "./node_modules/@material/textfield/node_modules/@material/floating-label/index.js");
/* harmony import */ var _material_line_ripple_index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @material/line-ripple/index */ "./node_modules/@material/textfield/node_modules/@material/line-ripple/index.js");
/* harmony import */ var _material_notched_outline_index__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @material/notched-outline/index */ "./node_modules/@material/textfield/node_modules/@material/notched-outline/index.js");
/* harmony import */ var _material_ripple_component__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @material/ripple/component */ "./node_modules/@material/textfield/node_modules/@material/ripple/component.js");
/* harmony import */ var _material_ripple_foundation__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @material/ripple/foundation */ "./node_modules/@material/textfield/node_modules/@material/ripple/foundation.js");
/* harmony import */ var _character_counter_index__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./character-counter/index */ "./node_modules/@material/textfield/character-counter/index.js");
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./constants */ "./node_modules/@material/textfield/constants.js");
/* harmony import */ var _foundation__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./foundation */ "./node_modules/@material/textfield/foundation.js");
/* harmony import */ var _helper_text_index__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./helper-text/index */ "./node_modules/@material/textfield/helper-text/index.js");
/* harmony import */ var _icon_index__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./icon/index */ "./node_modules/@material/textfield/icon/index.js");
/**
* @license
* Copyright 2016 Google Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
var MDCTextField = /** @class */ (function (_super) {
tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](MDCTextField, _super);
function MDCTextField() {
return _super !== null && _super.apply(this, arguments) || this;
}
MDCTextField.attachTo = function (root) {
return new MDCTextField(root);
};
MDCTextField.prototype.initialize = function (rippleFactory, lineRippleFactory, helperTextFactory, characterCounterFactory, iconFactory, labelFactory, outlineFactory) {
if (rippleFactory === void 0) { rippleFactory = function (el, foundation) { return new _material_ripple_component__WEBPACK_IMPORTED_MODULE_6__["MDCRipple"](el, foundation); }; }
if (lineRippleFactory === void 0) { lineRippleFactory = function (el) { return new _material_line_ripple_index__WEBPACK_IMPORTED_MODULE_4__["MDCLineRipple"](el); }; }
if (helperTextFactory === void 0) { helperTextFactory = function (el) { return new _helper_text_index__WEBPACK_IMPORTED_MODULE_11__["MDCTextFieldHelperText"](el); }; }
if (characterCounterFactory === void 0) { characterCounterFactory = function (el) { return new _character_counter_index__WEBPACK_IMPORTED_MODULE_8__["MDCTextFieldCharacterCounter"](el); }; }
if (iconFactory === void 0) { iconFactory = function (el) { return new _icon_index__WEBPACK_IMPORTED_MODULE_12__["MDCTextFieldIcon"](el); }; }
if (labelFactory === void 0) { labelFactory = function (el) { return new _material_floating_label_index__WEBPACK_IMPORTED_MODULE_3__["MDCFloatingLabel"](el); }; }
if (outlineFactory === void 0) { outlineFactory = function (el) { return new _material_notched_outline_index__WEBPACK_IMPORTED_MODULE_5__["MDCNotchedOutline"](el); }; }
this.input_ = this.root_.querySelector(_constants__WEBPACK_IMPORTED_MODULE_9__["strings"].INPUT_SELECTOR);
var labelElement = this.root_.querySelector(_constants__WEBPACK_IMPORTED_MODULE_9__["strings"].LABEL_SELECTOR);
this.label_ = labelElement ? labelFactory(labelElement) : null;
var lineRippleElement = this.root_.querySelector(_constants__WEBPACK_IMPORTED_MODULE_9__["strings"].LINE_RIPPLE_SELECTOR);
this.lineRipple_ = lineRippleElement ? lineRippleFactory(lineRippleElement) : null;
var outlineElement = this.root_.querySelector(_constants__WEBPACK_IMPORTED_MODULE_9__["strings"].OUTLINE_SELECTOR);
this.outline_ = outlineElement ? outlineFactory(outlineElement) : null;
// Helper text
var helperTextStrings = _helper_text_index__WEBPACK_IMPORTED_MODULE_11__["MDCTextFieldHelperTextFoundation"].strings;
var nextElementSibling = this.root_.nextElementSibling;
var hasHelperLine = (nextElementSibling && nextElementSibling.classList.contains(_constants__WEBPACK_IMPORTED_MODULE_9__["cssClasses"].HELPER_LINE));
var helperTextEl = hasHelperLine && nextElementSibling && nextElementSibling.querySelector(helperTextStrings.ROOT_SELECTOR);
this.helperText_ = helperTextEl ? helperTextFactory(helperTextEl) : null;
// Character counter
var characterCounterStrings = _character_counter_index__WEBPACK_IMPORTED_MODULE_8__["MDCTextFieldCharacterCounterFoundation"].strings;
var characterCounterEl = this.root_.querySelector(characterCounterStrings.ROOT_SELECTOR);
// If character counter is not found in root element search in sibling element.
if (!characterCounterEl && hasHelperLine && nextElementSibling) {
characterCounterEl = nextElementSibling.querySelector(characterCounterStrings.ROOT_SELECTOR);
}
this.characterCounter_ = characterCounterEl ? characterCounterFactory(characterCounterEl) : null;
this.leadingIcon_ = null;
this.trailingIcon_ = null;
var iconElements = this.root_.querySelectorAll(_constants__WEBPACK_IMPORTED_MODULE_9__["strings"].ICON_SELECTOR);
if (iconElements.length > 0) {
if (iconElements.length > 1) { // Has both icons.
this.leadingIcon_ = iconFactory(iconElements[0]);
this.trailingIcon_ = iconFactory(iconElements[1]);
}
else {
if (this.root_.classList.contains(_constants__WEBPACK_IMPORTED_MODULE_9__["cssClasses"].WITH_LEADING_ICON)) {
this.leadingIcon_ = iconFactory(iconElements[0]);
}
else {
this.trailingIcon_ = iconFactory(iconElements[0]);
}
}
}
this.ripple = this.createRipple_(rippleFactory);
};
MDCTextField.prototype.destroy = function () {
if (this.ripple) {
this.ripple.destroy();
}
if (this.lineRipple_) {
this.lineRipple_.destroy();
}
if (this.helperText_) {
this.helperText_.destroy();
}
if (this.characterCounter_) {
this.characterCounter_.destroy();
}
if (this.leadingIcon_) {
this.leadingIcon_.destroy();
}
if (this.trailingIcon_) {
this.trailingIcon_.destroy();
}
if (this.label_) {
this.label_.destroy();
}
if (this.outline_) {
this.outline_.destroy();
}
_super.prototype.destroy.call(this);
};
/**
* Initializes the Text Field's internal state based on the environment's
* state.
*/
MDCTextField.prototype.initialSyncWithDOM = function () {
this.disabled = this.input_.disabled;
};
Object.defineProperty(MDCTextField.prototype, "value", {
get: function () {
return this.foundation_.getValue();
},
/**
* @param value The value to set on the input.
*/
set: function (value) {
this.foundation_.setValue(value);
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCTextField.prototype, "disabled", {
get: function () {
return this.foundation_.isDisabled();
},
/**
* @param disabled Sets the Text Field disabled or enabled.
*/
set: function (disabled) {
this.foundation_.setDisabled(disabled);
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCTextField.prototype, "valid", {
get: function () {
return this.foundation_.isValid();
},
/**
* @param valid Sets the Text Field valid or invalid.
*/
set: function (valid) {
this.foundation_.setValid(valid);
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCTextField.prototype, "required", {
get: function () {
return this.input_.required;
},
/**
* @param required Sets the Text Field to required.
*/
set: function (required) {
this.input_.required = required;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCTextField.prototype, "pattern", {
get: function () {
return this.input_.pattern;
},
/**
* @param pattern Sets the input element's validation pattern.
*/
set: function (pattern) {
this.input_.pattern = pattern;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCTextField.prototype, "minLength", {
get: function () {
return this.input_.minLength;
},
/**
* @param minLength Sets the input element's minLength.
*/
set: function (minLength) {
this.input_.minLength = minLength;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCTextField.prototype, "maxLength", {
get: function () {
return this.input_.maxLength;
},
/**
* @param maxLength Sets the input element's maxLength.
*/
set: function (maxLength) {
// Chrome throws exception if maxLength is set to a value less than zero
if (maxLength < 0) {
this.input_.removeAttribute('maxLength');
}
else {
this.input_.maxLength = maxLength;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCTextField.prototype, "min", {
get: function () {
return this.input_.min;
},
/**
* @param min Sets the input element's min.
*/
set: function (min) {
this.input_.min = min;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCTextField.prototype, "max", {
get: function () {
return this.input_.max;
},
/**
* @param max Sets the input element's max.
*/
set: function (max) {
this.input_.max = max;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCTextField.prototype, "step", {
get: function () {
return this.input_.step;
},
/**
* @param step Sets the input element's step.
*/
set: function (step) {
this.input_.step = step;
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCTextField.prototype, "helperTextContent", {
/**
* Sets the helper text element content.
*/
set: function (content) {
this.foundation_.setHelperTextContent(content);
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCTextField.prototype, "leadingIconAriaLabel", {
/**
* Sets the aria label of the leading icon.
*/
set: function (label) {
this.foundation_.setLeadingIconAriaLabel(label);
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCTextField.prototype, "leadingIconContent", {
/**
* Sets the text content of the leading icon.
*/
set: function (content) {
this.foundation_.setLeadingIconContent(content);
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCTextField.prototype, "trailingIconAriaLabel", {
/**
* Sets the aria label of the trailing icon.
*/
set: function (label) {
this.foundation_.setTrailingIconAriaLabel(label);
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCTextField.prototype, "trailingIconContent", {
/**
* Sets the text content of the trailing icon.
*/
set: function (content) {
this.foundation_.setTrailingIconContent(content);
},
enumerable: true,
configurable: true
});
Object.defineProperty(MDCTextField.prototype, "useNativeValidation", {
/**
* Enables or disables the use of native validation. Use this for custom validation.
* @param useNativeValidation Set this to false to ignore native input validation.
*/
set: function (useNativeValidation) {
this.foundation_.setUseNativeValidation(useNativeValidation);
},
enumerable: true,
configurable: true
});
/**
* Focuses the input element.
*/
MDCTextField.prototype.focus = function () {
this.input_.focus();
};
/**
* Recomputes the outline SVG path for the outline element.
*/
MDCTextField.prototype.layout = function () {
var openNotch = this.foundation_.shouldFloat;
this.foundation_.notchOutline(openNotch);
};
MDCTextField.prototype.getDefaultFoundation = function () {
// DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
// To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
var adapter = tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"]({}, this.getRootAdapterMethods_(), this.getInputAdapterMethods_(), this.getLabelAdapterMethods_(), this.getLineRippleAdapterMethods_(), this.getOutlineAdapterMethods_());
// tslint:enable:object-literal-sort-keys
return new _foundation__WEBPACK_IMPORTED_MODULE_10__["MDCTextFieldFoundation"](adapter, this.getFoundationMap_());
};
MDCTextField.prototype.getRootAdapterMethods_ = function () {
var _this = this;
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
return {
addClass: function (className) { return _this.root_.classList.add(className); },
removeClass: function (className) { return _this.root_.classList.remove(className); },
hasClass: function (className) { return _this.root_.classList.contains(className); },
registerTextFieldInteractionHandler: function (evtType, handler) { return _this.listen(evtType, handler); },
deregisterTextFieldInteractionHandler: function (evtType, handler) { return _this.unlisten(evtType, handler); },
registerValidationAttributeChangeHandler: function (handler) {
var getAttributesList = function (mutationsList) {
return mutationsList
.map(function (mutation) { return mutation.attributeName; })
.filter(function (attributeName) { return attributeName; });
};
var observer = new MutationObserver(function (mutationsList) { return handler(getAttributesList(mutationsList)); });
var config = { attributes: true };
observer.observe(_this.input_, config);
return observer;
},
deregisterValidationAttributeChangeHandler: function (observer) { return observer.disconnect(); },
};
// tslint:enable:object-literal-sort-keys
};
MDCTextField.prototype.getInputAdapterMethods_ = function () {
var _this = this;
// tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
return {
getNativeInput: function () { return _this.input_; },
isFocused: function () { return document.activeElement === _this.input_; },
registerInputInteractionHandler: fu