Socket
Socket
Sign inDemoInstall

@material/textfield

Package Overview
Dependencies
5
Maintainers
1
Versions
1702
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.1 to 0.2.2

1238

dist/mdc.textfield.js

@@ -29,5 +29,5 @@ /*!

/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };

@@ -39,3 +39,3 @@

/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ module.l = true;

@@ -53,2 +53,28 @@ /******/ // Return the exports of the module

/******/ // identity function for calling harmony imports with the correct context
/******/ __webpack_require__.i = function(value) { return value; };
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/ // 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__

@@ -58,3 +84,3 @@ /******/ __webpack_require__.p = "/assets/";

/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ return __webpack_require__(__webpack_require__.s = 48);
/******/ })

@@ -65,711 +91,697 @@ /************************************************************************/

/***/ 0:
/***/ function(module, exports, __webpack_require__) {
/***/ (function(module, __webpack_exports__, __webpack_require__) {
module.exports = __webpack_require__(32);
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__foundation__ = __webpack_require__(1);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MDCFoundation", function() { return __WEBPACK_IMPORTED_MODULE_0__foundation__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__component__ = __webpack_require__(2);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MDCComponent", function() { return __WEBPACK_IMPORTED_MODULE_1__component__["a"]; });
/**
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/***/ },
/***/ 3:
/***/ function(module, exports, __webpack_require__) {
'use strict';
/***/ }),
Object.defineProperty(exports, "__esModule", {
value: true
});
/***/ 1:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
var _foundation = __webpack_require__(4);
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
Object.defineProperty(exports, 'MDCFoundation', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_foundation).default;
}
});
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _component = __webpack_require__(5);
/**
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, 'MDCComponent', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_component).default;
}
});
var MDCFoundation = function () {
_createClass(MDCFoundation, null, [{
key: "cssClasses",
get: function get() {
// 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 {};
}
}, {
key: "strings",
get: function get() {
// Classes extending MDCFoundation should implement this method to return an object which exports all
// semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
return {};
}
}, {
key: "numbers",
get: function get() {
// 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 {};
}
}, {
key: "defaultAdapter",
get: function get() {
// 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 {};
}
}]);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function MDCFoundation() {
var adapter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
/***/ },
_classCallCheck(this, MDCFoundation);
/***/ 4:
/***/ function(module, exports) {
this.adapter_ = adapter;
}
"use strict";
_createClass(MDCFoundation, [{
key: "init",
value: function init() {
// Subclasses should override this method to perform initialization routines (registering events, etc.)
}
}, {
key: "destroy",
value: function destroy() {
// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
}
}]);
Object.defineProperty(exports, "__esModule", {
value: true
});
return MDCFoundation;
}();
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
/* harmony default export */ __webpack_exports__["a"] = MDCFoundation;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/***/ }),
/**
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/***/ 2:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
var MDCFoundation = function () {
_createClass(MDCFoundation, null, [{
key: "cssClasses",
get: function get() {
// 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 {};
}
}, {
key: "strings",
get: function get() {
// Classes extending MDCFoundation should implement this method to return an object which exports all
// semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
return {};
}
}, {
key: "numbers",
get: function get() {
// 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 {};
}
}, {
key: "defaultAdapter",
get: function get() {
// 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 {};
}
}]);
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__foundation__ = __webpack_require__(1);
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function MDCFoundation() {
var adapter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
_classCallCheck(this, MDCFoundation);
/**
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
this.adapter_ = adapter;
}
_createClass(MDCFoundation, [{
key: "init",
value: function init() {
// Subclasses should override this method to perform initialization routines (registering events, etc.)
}
}, {
key: "destroy",
value: function destroy() {
// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
}
}]);
return MDCFoundation;
}();
var MDCComponent = function () {
_createClass(MDCComponent, null, [{
key: 'attachTo',
value: function attachTo(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 __WEBPACK_IMPORTED_MODULE_0__foundation__["a" /* default */]());
}
}]);
exports.default = MDCFoundation;
function MDCComponent(root) {
var foundation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
/***/ },
_classCallCheck(this, MDCComponent);
/***/ 5:
/***/ function(module, exports, __webpack_require__) {
this.root_ = root;
'use strict';
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
Object.defineProperty(exports, "__esModule", {
value: true
});
this.initialize.apply(this, 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();
}
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
_createClass(MDCComponent, [{
key: 'initialize',
value: function initialize() /* ...args */{
// 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.
}
}, {
key: 'getDefaultFoundation',
value: function getDefaultFoundation() {
// 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');
}
}, {
key: 'initialSyncWithDOM',
value: function initialSyncWithDOM() {
// 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.
}
}, {
key: 'destroy',
value: function destroy() {
// 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();
}
var _foundation = __webpack_require__(4);
// Wrapper method to add an event listener to the component's root element. This is most useful when
// listening for custom events.
var _foundation2 = _interopRequireDefault(_foundation);
}, {
key: 'listen',
value: function listen(evtType, handler) {
this.root_.addEventListener(evtType, handler);
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Wrapper method to remove an event listener to the component's root element. This is most useful when
// unlistening for custom events.
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
}, {
key: 'unlisten',
value: function unlisten(evtType, handler) {
this.root_.removeEventListener(evtType, handler);
}
var MDCComponent = function () {
_createClass(MDCComponent, null, [{
key: 'attachTo',
value: function attachTo(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 _foundation2.default());
}
}]);
// Fires a cross-browser-compatible custom event from the component root of the given type,
// with the given data.
function MDCComponent(root) {
var foundation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getDefaultFoundation();
}, {
key: 'emit',
value: function emit(evtType, evtData) {
var evt = void 0;
if (typeof CustomEvent === 'function') {
evt = new CustomEvent(evtType, { detail: evtData });
} else {
evt = document.createEvent('CustomEvent');
evt.initCustomEvent(evtType, false, false, evtData);
}
_classCallCheck(this, MDCComponent);
this.root_.dispatchEvent(evt);
}
}]);
this.root_ = root;
return MDCComponent;
}();
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
/* harmony default export */ __webpack_exports__["a"] = MDCComponent;
this.initialize.apply(this, args);
this.foundation_ = foundation;
this.foundation_.init();
this.initialSyncWithDOM();
}
/***/ }),
_createClass(MDCComponent, [{
key: 'initialize',
value: function initialize() /* ...args */{
// 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.
}
}, {
key: 'getDefaultFoundation',
value: function getDefaultFoundation() {
// 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');
}
}, {
key: 'initialSyncWithDOM',
value: function initialSyncWithDOM() {
// 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.
}
}, {
key: 'destroy',
value: function destroy() {
// 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();
}
/***/ 21:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
// Wrapper method to add an event listener to the component's root element. This is most useful when
// listening for custom events.
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__material_base__ = __webpack_require__(0);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation__ = __webpack_require__(35);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MDCTextfieldFoundation", function() { return __WEBPACK_IMPORTED_MODULE_1__foundation__["a"]; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCTextfield", function() { return MDCTextfield; });
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
}, {
key: 'listen',
value: function listen(evtType, handler) {
this.root_.addEventListener(evtType, handler);
}
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
// Wrapper method to remove an event listener to the component's root element. This is most useful when
// unlistening for custom events.
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
}, {
key: 'unlisten',
value: function unlisten(evtType, handler) {
this.root_.removeEventListener(evtType, handler);
}
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
// Fires a cross-browser-compatible custom event from the component root of the given type,
// with the given data.
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
}, {
key: 'emit',
value: function emit(evtType, evtData) {
var evt = void 0;
if (typeof CustomEvent === 'function') {
evt = new CustomEvent(evtType, { detail: evtData });
} else {
evt = document.createEvent('CustomEvent');
evt.initCustomEvent(evtType, false, false, evtData);
}
/**
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
this.root_.dispatchEvent(evt);
}
}]);
return MDCComponent;
}();
exports.default = MDCComponent;
/***/ },
/***/ 32:
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.MDCTextfield = exports.MDCTextfieldFoundation = undefined;
var cssClasses = __WEBPACK_IMPORTED_MODULE_1__foundation__["a" /* default */].cssClasses;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var MDCTextfield = function (_MDCComponent) {
_inherits(MDCTextfield, _MDCComponent);
var _base = __webpack_require__(3);
_createClass(MDCTextfield, null, [{
key: 'attachTo',
value: function attachTo(root) {
return new MDCTextfield(root);
}
}]);
var _foundation = __webpack_require__(33);
function MDCTextfield() {
var _ref;
var _foundation2 = _interopRequireDefault(_foundation);
_classCallCheck(this, MDCTextfield);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _this = _possibleConstructorReturn(this, (_ref = MDCTextfield.__proto__ || Object.getPrototypeOf(MDCTextfield)).call.apply(_ref, [this].concat(args)));
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
var input = _this.input_;
_this.helptextElement = input.hasAttribute('aria-controls') ? document.getElementById(input.getAttribute('aria-controls')) : null;
return _this;
}
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
_createClass(MDCTextfield, [{
key: 'initialSyncWithDom',
value: function initialSyncWithDom() {
this.disabled = this.input_.disabled;
}
}, {
key: 'getDefaultFoundation',
value: function getDefaultFoundation() {
var _this2 = this;
exports.MDCTextfieldFoundation = _foundation2.default;
var cssClasses = _foundation2.default.cssClasses;
return new __WEBPACK_IMPORTED_MODULE_1__foundation__["a" /* default */](_extends({
addClass: function addClass(className) {
return _this2.root_.classList.add(className);
},
removeClass: function removeClass(className) {
return _this2.root_.classList.remove(className);
},
addClassToLabel: function addClassToLabel(className) {
var label = _this2.label_;
if (label) {
label.classList.add(className);
}
},
removeClassFromLabel: function removeClassFromLabel(className) {
var label = _this2.label_;
if (label) {
label.classList.remove(className);
}
}
}, this.getInputAdapterMethods_(), this.getHelptextAdapterMethods_()));
}
}, {
key: 'getInputAdapterMethods_',
value: function getInputAdapterMethods_() {
var _this3 = this;
var MDCTextfield = exports.MDCTextfield = function (_MDCComponent) {
_inherits(MDCTextfield, _MDCComponent);
return {
registerInputFocusHandler: function registerInputFocusHandler(handler) {
return _this3.input_.addEventListener('focus', handler);
},
registerInputBlurHandler: function registerInputBlurHandler(handler) {
return _this3.input_.addEventListener('blur', handler);
},
registerInputInputHandler: function registerInputInputHandler(handler) {
return _this3.input_.addEventListener('input', handler);
},
registerInputKeydownHandler: function registerInputKeydownHandler(handler) {
return _this3.input_.addEventListener('keydown', handler);
},
deregisterInputFocusHandler: function deregisterInputFocusHandler(handler) {
return _this3.input_.removeEventListener('focus', handler);
},
deregisterInputBlurHandler: function deregisterInputBlurHandler(handler) {
return _this3.input_.removeEventListener('blur', handler);
},
deregisterInputInputHandler: function deregisterInputInputHandler(handler) {
return _this3.input_.removeEventListener('input', handler);
},
deregisterInputKeydownHandler: function deregisterInputKeydownHandler(handler) {
return _this3.input_.removeEventListener('keydown', handler);
},
getNativeInput: function getNativeInput() {
return _this3.input_;
}
};
}
}, {
key: 'getHelptextAdapterMethods_',
value: function getHelptextAdapterMethods_() {
var _this4 = this;
_createClass(MDCTextfield, null, [{
key: 'attachTo',
value: function attachTo(root) {
return new MDCTextfield(root);
}
}]);
return {
addClassToHelptext: function addClassToHelptext(className) {
if (_this4.helptextElement) {
_this4.helptextElement.classList.add(className);
}
},
removeClassFromHelptext: function removeClassFromHelptext(className) {
if (_this4.helptextElement) {
_this4.helptextElement.classList.remove(className);
}
},
helptextHasClass: function helptextHasClass(className) {
if (!_this4.helptextElement) {
return false;
}
return _this4.helptextElement.classList.contains(className);
},
setHelptextAttr: function setHelptextAttr(name, value) {
if (_this4.helptextElement) {
_this4.helptextElement.setAttribute(name, value);
}
},
removeHelptextAttr: function removeHelptextAttr(name) {
if (_this4.helptextElement) {
_this4.helptextElement.removeAttribute(name);
}
}
};
}
}, {
key: 'disabled',
get: function get() {
return this.foundation_.isDisabled();
},
set: function set(disabled) {
this.foundation_.setDisabled(disabled);
}
}, {
key: 'input_',
get: function get() {
return this.root_.querySelector('.' + cssClasses.ROOT + '__input');
}
}, {
key: 'label_',
get: function get() {
return this.root_.querySelector('.' + cssClasses.ROOT + '__label');
}
}]);
function MDCTextfield() {
var _ref;
return MDCTextfield;
}(__WEBPACK_IMPORTED_MODULE_0__material_base__["MDCComponent"]);
_classCallCheck(this, MDCTextfield);
/***/ }),
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
/***/ 35:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
var _this = _possibleConstructorReturn(this, (_ref = MDCTextfield.__proto__ || Object.getPrototypeOf(MDCTextfield)).call.apply(_ref, [this].concat(args)));
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__material_base__ = __webpack_require__(0);
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var input = _this.input_;
_this.helptextElement = input.hasAttribute('aria-controls') ? document.getElementById(input.getAttribute('aria-controls')) : null;
return _this;
}
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
_createClass(MDCTextfield, [{
key: 'initialSyncWithDom',
value: function initialSyncWithDom() {
this.disabled = this.input_.disabled;
}
}, {
key: 'getDefaultFoundation',
value: function getDefaultFoundation() {
var _this2 = this;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
return new _foundation2.default(_extends({
addClass: function addClass(className) {
return _this2.root_.classList.add(className);
},
removeClass: function removeClass(className) {
return _this2.root_.classList.remove(className);
},
addClassToLabel: function addClassToLabel(className) {
var label = _this2.label_;
if (label) {
label.classList.add(className);
}
},
removeClassFromLabel: function removeClassFromLabel(className) {
var label = _this2.label_;
if (label) {
label.classList.remove(className);
}
}
}, this.getInputAdapterMethods_(), this.getHelptextAdapterMethods_()));
}
}, {
key: 'getInputAdapterMethods_',
value: function getInputAdapterMethods_() {
var _this3 = this;
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
return {
registerInputFocusHandler: function registerInputFocusHandler(handler) {
return _this3.input_.addEventListener('focus', handler);
},
registerInputBlurHandler: function registerInputBlurHandler(handler) {
return _this3.input_.addEventListener('blur', handler);
},
registerInputInputHandler: function registerInputInputHandler(handler) {
return _this3.input_.addEventListener('input', handler);
},
registerInputKeydownHandler: function registerInputKeydownHandler(handler) {
return _this3.input_.addEventListener('keydown', handler);
},
deregisterInputFocusHandler: function deregisterInputFocusHandler(handler) {
return _this3.input_.removeEventListener('focus', handler);
},
deregisterInputBlurHandler: function deregisterInputBlurHandler(handler) {
return _this3.input_.removeEventListener('blur', handler);
},
deregisterInputInputHandler: function deregisterInputInputHandler(handler) {
return _this3.input_.removeEventListener('input', handler);
},
deregisterInputKeydownHandler: function deregisterInputKeydownHandler(handler) {
return _this3.input_.removeEventListener('keydown', handler);
},
getNativeInput: function getNativeInput() {
return _this3.input_;
}
};
}
}, {
key: 'getHelptextAdapterMethods_',
value: function getHelptextAdapterMethods_() {
var _this4 = this;
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
return {
addClassToHelptext: function addClassToHelptext(className) {
if (_this4.helptextElement) {
_this4.helptextElement.classList.add(className);
}
},
removeClassFromHelptext: function removeClassFromHelptext(className) {
if (_this4.helptextElement) {
_this4.helptextElement.classList.remove(className);
}
},
helptextHasClass: function helptextHasClass(className) {
if (!_this4.helptextElement) {
return false;
}
return _this4.helptextElement.classList.contains(className);
},
setHelptextAttr: function setHelptextAttr(name, value) {
if (_this4.helptextElement) {
_this4.helptextElement.setAttribute(name, value);
}
},
removeHelptextAttr: function removeHelptextAttr(name) {
if (_this4.helptextElement) {
_this4.helptextElement.removeAttribute(name);
}
}
};
}
}, {
key: 'disabled',
get: function get() {
return this.foundation_.isDisabled();
},
set: function set(disabled) {
this.foundation_.setDisabled(disabled);
}
}, {
key: 'input_',
get: function get() {
return this.root_.querySelector('.' + cssClasses.ROOT + '__input');
}
}, {
key: 'label_',
get: function get() {
return this.root_.querySelector('.' + cssClasses.ROOT + '__label');
}
}]);
/**
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
return MDCTextfield;
}(_base.MDCComponent);
/***/ },
/***/ 33:
/***/ function(module, exports, __webpack_require__) {
var ROOT = 'mdc-textfield';
'use strict';
var MDCTextfieldFoundation = function (_MDCFoundation) {
_inherits(MDCTextfieldFoundation, _MDCFoundation);
Object.defineProperty(exports, "__esModule", {
value: true
});
_createClass(MDCTextfieldFoundation, null, [{
key: 'cssClasses',
get: function get() {
return {
ROOT: ROOT,
UPGRADED: ROOT + '--upgraded',
DISABLED: ROOT + '--disabled',
FOCUSED: ROOT + '--focused',
INVALID: ROOT + '--invalid',
HELPTEXT_PERSISTENT: ROOT + '-helptext--persistent',
HELPTEXT_VALIDATION_MSG: ROOT + '-helptext--validation-msg',
LABEL_FLOAT_ABOVE: ROOT + '__label--float-above'
};
}
}, {
key: 'strings',
get: function get() {
return {
ARIA_HIDDEN: 'aria-hidden',
ROLE: 'role'
};
}
}, {
key: 'defaultAdapter',
get: function get() {
return {
addClass: function addClass() /* className: string */{},
removeClass: function removeClass() /* className: string */{},
addClassToLabel: function addClassToLabel() /* className: string */{},
removeClassFromLabel: function removeClassFromLabel() /* className: string */{},
addClassToHelptext: function addClassToHelptext() /* className: string */{},
removeClassFromHelptext: function removeClassFromHelptext() /* className: string */{},
helptextHasClass: function helptextHasClass() {
return (/* className: string */ /* boolean */false
);
},
registerInputFocusHandler: function registerInputFocusHandler() /* handler: EventListener */{},
deregisterInputFocusHandler: function deregisterInputFocusHandler() /* handler: EventListener */{},
registerInputBlurHandler: function registerInputBlurHandler() /* handler: EventListener */{},
deregisterInputBlurHandler: function deregisterInputBlurHandler() /* handler: EventListener */{},
registerInputInputHandler: function registerInputInputHandler() /* handler: EventListener */{},
deregisterInputInputHandler: function deregisterInputInputHandler() /* handler: EventListener */{},
registerInputKeydownHandler: function registerInputKeydownHandler() /* handler: EventListener */{},
deregisterInputKeydownHandler: function deregisterInputKeydownHandler() /* handler: EventListener */{},
setHelptextAttr: function setHelptextAttr() /* name: string, value: string */{},
removeHelptextAttr: function removeHelptextAttr() /* name: string */{},
getNativeInput: function getNativeInput() {
return (/* HTMLInputElement */{}
);
}
};
}
}]);
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function MDCTextfieldFoundation() {
var adapter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
_classCallCheck(this, MDCTextfieldFoundation);
var _base = __webpack_require__(3);
var _this = _possibleConstructorReturn(this, (MDCTextfieldFoundation.__proto__ || Object.getPrototypeOf(MDCTextfieldFoundation)).call(this, _extends(MDCTextfieldFoundation.defaultAdapter, adapter)));
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
_this.receivedUserInput_ = false;
_this.inputFocusHandler_ = function () {
return _this.activateFocus_();
};
_this.inputBlurHandler_ = function () {
return _this.deactivateFocus_();
};
_this.inputInputHandler_ = function () {
return _this.autoCompleteFocus_();
};
_this.inputKeydownHandler_ = function () {
return _this.receivedUserInput_ = true;
};
return _this;
}
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
_createClass(MDCTextfieldFoundation, [{
key: 'init',
value: function init() {
this.adapter_.addClass(MDCTextfieldFoundation.cssClasses.UPGRADED);
this.adapter_.registerInputFocusHandler(this.inputFocusHandler_);
this.adapter_.registerInputBlurHandler(this.inputBlurHandler_);
this.adapter_.registerInputInputHandler(this.inputInputHandler_);
this.adapter_.registerInputKeydownHandler(this.inputKeydownHandler_);
}
}, {
key: 'destroy',
value: function destroy() {
this.adapter_.removeClass(MDCTextfieldFoundation.cssClasses.UPGRADED);
this.adapter_.deregisterInputFocusHandler(this.inputFocusHandler_);
this.adapter_.deregisterInputBlurHandler(this.inputBlurHandler_);
this.adapter_.deregisterInputInputHandler(this.inputInputHandler_);
this.adapter_.deregisterInputKeydownHandler(this.inputKeydownHandler_);
}
}, {
key: 'activateFocus_',
value: function activateFocus_() {
var _MDCTextfieldFoundati = MDCTextfieldFoundation.cssClasses,
FOCUSED = _MDCTextfieldFoundati.FOCUSED,
LABEL_FLOAT_ABOVE = _MDCTextfieldFoundati.LABEL_FLOAT_ABOVE;
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /**
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
this.adapter_.addClass(FOCUSED);
this.adapter_.addClassToLabel(LABEL_FLOAT_ABOVE);
this.showHelptext_();
}
}, {
key: 'autoCompleteFocus_',
value: function autoCompleteFocus_() {
if (!this.receivedUserInput_) {
this.activateFocus_();
}
}
}, {
key: 'showHelptext_',
value: function showHelptext_() {
var ARIA_HIDDEN = MDCTextfieldFoundation.strings.ARIA_HIDDEN;
var ROOT = 'mdc-textfield';
this.adapter_.removeHelptextAttr(ARIA_HIDDEN);
}
}, {
key: 'deactivateFocus_',
value: function deactivateFocus_() {
var _MDCTextfieldFoundati2 = MDCTextfieldFoundation.cssClasses,
FOCUSED = _MDCTextfieldFoundati2.FOCUSED,
INVALID = _MDCTextfieldFoundati2.INVALID,
LABEL_FLOAT_ABOVE = _MDCTextfieldFoundati2.LABEL_FLOAT_ABOVE;
var MDCTextfieldFoundation = function (_MDCFoundation) {
_inherits(MDCTextfieldFoundation, _MDCFoundation);
var input = this.getNativeInput_();
var isValid = input.checkValidity();
_createClass(MDCTextfieldFoundation, null, [{
key: 'cssClasses',
get: function get() {
return {
ROOT: ROOT,
UPGRADED: ROOT + '--upgraded',
DISABLED: ROOT + '--disabled',
FOCUSED: ROOT + '--focused',
INVALID: ROOT + '--invalid',
HELPTEXT_PERSISTENT: ROOT + '-helptext--persistent',
HELPTEXT_VALIDATION_MSG: ROOT + '-helptext--validation-msg',
LABEL_FLOAT_ABOVE: ROOT + '__label--float-above'
};
}
}, {
key: 'strings',
get: function get() {
return {
ARIA_HIDDEN: 'aria-hidden',
ROLE: 'role'
};
}
}, {
key: 'defaultAdapter',
get: function get() {
return {
addClass: function addClass() /* className: string */{},
removeClass: function removeClass() /* className: string */{},
addClassToLabel: function addClassToLabel() /* className: string */{},
removeClassFromLabel: function removeClassFromLabel() /* className: string */{},
addClassToHelptext: function addClassToHelptext() /* className: string */{},
removeClassFromHelptext: function removeClassFromHelptext() /* className: string */{},
helptextHasClass: function helptextHasClass() {
return (/* className: string */ /* boolean */false
);
},
registerInputFocusHandler: function registerInputFocusHandler() /* handler: EventListener */{},
deregisterInputFocusHandler: function deregisterInputFocusHandler() /* handler: EventListener */{},
registerInputBlurHandler: function registerInputBlurHandler() /* handler: EventListener */{},
deregisterInputBlurHandler: function deregisterInputBlurHandler() /* handler: EventListener */{},
registerInputInputHandler: function registerInputInputHandler() /* handler: EventListener */{},
deregisterInputInputHandler: function deregisterInputInputHandler() /* handler: EventListener */{},
registerInputKeydownHandler: function registerInputKeydownHandler() /* handler: EventListener */{},
deregisterInputKeydownHandler: function deregisterInputKeydownHandler() /* handler: EventListener */{},
setHelptextAttr: function setHelptextAttr() /* name: string, value: string */{},
removeHelptextAttr: function removeHelptextAttr() /* name: string */{},
getNativeInput: function getNativeInput() {
return (/* HTMLInputElement */{}
);
}
};
}
}]);
this.adapter_.removeClass(FOCUSED);
if (!input.value) {
this.adapter_.removeClassFromLabel(LABEL_FLOAT_ABOVE);
this.receivedUserInput_ = false;
}
if (isValid) {
this.adapter_.removeClass(INVALID);
} else {
this.adapter_.addClass(INVALID);
}
this.updateHelptextOnDeactivation_(isValid);
}
}, {
key: 'updateHelptextOnDeactivation_',
value: function updateHelptextOnDeactivation_(isValid) {
var _MDCTextfieldFoundati3 = MDCTextfieldFoundation.cssClasses,
HELPTEXT_PERSISTENT = _MDCTextfieldFoundati3.HELPTEXT_PERSISTENT,
HELPTEXT_VALIDATION_MSG = _MDCTextfieldFoundati3.HELPTEXT_VALIDATION_MSG;
var ROLE = MDCTextfieldFoundation.strings.ROLE;
function MDCTextfieldFoundation() {
var adapter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var helptextIsPersistent = this.adapter_.helptextHasClass(HELPTEXT_PERSISTENT);
var helptextIsValidationMsg = this.adapter_.helptextHasClass(HELPTEXT_VALIDATION_MSG);
var validationMsgNeedsDisplay = helptextIsValidationMsg && !isValid;
_classCallCheck(this, MDCTextfieldFoundation);
if (validationMsgNeedsDisplay) {
this.adapter_.setHelptextAttr(ROLE, 'alert');
} else {
this.adapter_.removeHelptextAttr(ROLE);
}
var _this = _possibleConstructorReturn(this, (MDCTextfieldFoundation.__proto__ || Object.getPrototypeOf(MDCTextfieldFoundation)).call(this, _extends(MDCTextfieldFoundation.defaultAdapter, adapter)));
if (helptextIsPersistent || validationMsgNeedsDisplay) {
return;
}
this.hideHelptext_();
}
}, {
key: 'hideHelptext_',
value: function hideHelptext_() {
var ARIA_HIDDEN = MDCTextfieldFoundation.strings.ARIA_HIDDEN;
_this.receivedUserInput_ = false;
_this.inputFocusHandler_ = function () {
return _this.activateFocus_();
};
_this.inputBlurHandler_ = function () {
return _this.deactivateFocus_();
};
_this.inputInputHandler_ = function () {
return _this.autoCompleteFocus_();
};
_this.inputKeydownHandler_ = function () {
return _this.receivedUserInput_ = true;
};
return _this;
}
this.adapter_.setHelptextAttr(ARIA_HIDDEN, 'true');
}
}, {
key: 'isDisabled',
value: function isDisabled() {
return this.getNativeInput_().disabled;
}
}, {
key: 'setDisabled',
value: function setDisabled(disabled) {
var DISABLED = MDCTextfieldFoundation.cssClasses.DISABLED;
_createClass(MDCTextfieldFoundation, [{
key: 'init',
value: function init() {
this.adapter_.addClass(MDCTextfieldFoundation.cssClasses.UPGRADED);
this.adapter_.registerInputFocusHandler(this.inputFocusHandler_);
this.adapter_.registerInputBlurHandler(this.inputBlurHandler_);
this.adapter_.registerInputInputHandler(this.inputInputHandler_);
this.adapter_.registerInputKeydownHandler(this.inputKeydownHandler_);
}
}, {
key: 'destroy',
value: function destroy() {
this.adapter_.removeClass(MDCTextfieldFoundation.cssClasses.UPGRADED);
this.adapter_.deregisterInputFocusHandler(this.inputFocusHandler_);
this.adapter_.deregisterInputBlurHandler(this.inputBlurHandler_);
this.adapter_.deregisterInputInputHandler(this.inputInputHandler_);
this.adapter_.deregisterInputKeydownHandler(this.inputKeydownHandler_);
}
}, {
key: 'activateFocus_',
value: function activateFocus_() {
var _MDCTextfieldFoundati = MDCTextfieldFoundation.cssClasses,
FOCUSED = _MDCTextfieldFoundati.FOCUSED,
LABEL_FLOAT_ABOVE = _MDCTextfieldFoundati.LABEL_FLOAT_ABOVE;
this.getNativeInput_().disabled = disabled;
if (disabled) {
this.adapter_.addClass(DISABLED);
} else {
this.adapter_.removeClass(DISABLED);
}
}
}, {
key: 'getNativeInput_',
value: function getNativeInput_() {
return this.adapter_.getNativeInput() || {
checkValidity: function checkValidity() {
return true;
},
value: '',
disabled: false
};
}
}]);
this.adapter_.addClass(FOCUSED);
this.adapter_.addClassToLabel(LABEL_FLOAT_ABOVE);
this.showHelptext_();
}
}, {
key: 'autoCompleteFocus_',
value: function autoCompleteFocus_() {
if (!this.receivedUserInput_) {
this.activateFocus_();
}
}
}, {
key: 'showHelptext_',
value: function showHelptext_() {
var ARIA_HIDDEN = MDCTextfieldFoundation.strings.ARIA_HIDDEN;
return MDCTextfieldFoundation;
}(__WEBPACK_IMPORTED_MODULE_0__material_base__["MDCFoundation"]);
this.adapter_.removeHelptextAttr(ARIA_HIDDEN);
}
}, {
key: 'deactivateFocus_',
value: function deactivateFocus_() {
var _MDCTextfieldFoundati2 = MDCTextfieldFoundation.cssClasses,
FOCUSED = _MDCTextfieldFoundati2.FOCUSED,
INVALID = _MDCTextfieldFoundati2.INVALID,
LABEL_FLOAT_ABOVE = _MDCTextfieldFoundati2.LABEL_FLOAT_ABOVE;
/* harmony default export */ __webpack_exports__["a"] = MDCTextfieldFoundation;
var input = this.getNativeInput_();
var isValid = input.checkValidity();
/***/ }),
this.adapter_.removeClass(FOCUSED);
if (!input.value) {
this.adapter_.removeClassFromLabel(LABEL_FLOAT_ABOVE);
this.receivedUserInput_ = false;
}
if (isValid) {
this.adapter_.removeClass(INVALID);
} else {
this.adapter_.addClass(INVALID);
}
this.updateHelptextOnDeactivation_(isValid);
}
}, {
key: 'updateHelptextOnDeactivation_',
value: function updateHelptextOnDeactivation_(isValid) {
var _MDCTextfieldFoundati3 = MDCTextfieldFoundation.cssClasses,
HELPTEXT_PERSISTENT = _MDCTextfieldFoundati3.HELPTEXT_PERSISTENT,
HELPTEXT_VALIDATION_MSG = _MDCTextfieldFoundati3.HELPTEXT_VALIDATION_MSG;
var ROLE = MDCTextfieldFoundation.strings.ROLE;
/***/ 48:
/***/ (function(module, exports, __webpack_require__) {
var helptextIsPersistent = this.adapter_.helptextHasClass(HELPTEXT_PERSISTENT);
var helptextIsValidationMsg = this.adapter_.helptextHasClass(HELPTEXT_VALIDATION_MSG);
var validationMsgNeedsDisplay = helptextIsValidationMsg && !isValid;
module.exports = __webpack_require__(21);
if (validationMsgNeedsDisplay) {
this.adapter_.setHelptextAttr(ROLE, 'alert');
} else {
this.adapter_.removeHelptextAttr(ROLE);
}
if (helptextIsPersistent || validationMsgNeedsDisplay) {
return;
}
this.hideHelptext_();
}
}, {
key: 'hideHelptext_',
value: function hideHelptext_() {
var ARIA_HIDDEN = MDCTextfieldFoundation.strings.ARIA_HIDDEN;
/***/ })
this.adapter_.setHelptextAttr(ARIA_HIDDEN, 'true');
}
}, {
key: 'isDisabled',
value: function isDisabled() {
return this.getNativeInput_().disabled;
}
}, {
key: 'setDisabled',
value: function setDisabled(disabled) {
var DISABLED = MDCTextfieldFoundation.cssClasses.DISABLED;
this.getNativeInput_().disabled = disabled;
if (disabled) {
this.adapter_.addClass(DISABLED);
} else {
this.adapter_.removeClass(DISABLED);
}
}
}, {
key: 'getNativeInput_',
value: function getNativeInput_() {
return this.adapter_.getNativeInput() || {
checkValidity: function checkValidity() {
return true;
},
value: '',
disabled: false
};
}
}]);
return MDCTextfieldFoundation;
}(_base.MDCFoundation);
exports.default = MDCTextfieldFoundation;
/***/ }
/******/ })
});
;
/******/ });
});

@@ -6,2 +6,2 @@ /*!

*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.textfield=t():(e.mdc=e.mdc||{},e.mdc.textfield=t())}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="/assets/",t(0)}({0:function(e,t,n){e.exports=n(33)},1:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(2);Object.defineProperty(t,"MDCFoundation",{enumerable:!0,get:function(){return r(i).default}});var u=n(3);Object.defineProperty(t,"MDCComponent",{enumerable:!0,get:function(){return r(u).default}})},2:function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n(this,e),this.adapter_=t}return r(e,null,[{key:"cssClasses",get:function(){return{}}},{key:"strings",get:function(){return{}}},{key:"numbers",get:function(){return{}}},{key:"defaultAdapter",get:function(){return{}}}]),r(e,[{key:"init",value:function(){}},{key:"destroy",value:function(){}}]),e}();t.default=i},3:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=n(2),a=r(o),s=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getDefaultFoundation();i(this,e),this.root_=t;for(var r=arguments.length,u=Array(r>2?r-2:0),o=2;o<r;o++)u[o-2]=arguments[o];this.initialize.apply(this,u),this.foundation_=n,this.foundation_.init(),this.initialSyncWithDOM()}return u(e,null,[{key:"attachTo",value:function(t){return new e(t,new a.default)}}]),u(e,[{key:"initialize",value:function(){}},{key:"getDefaultFoundation",value:function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")}},{key:"initialSyncWithDOM",value:function(){}},{key:"destroy",value:function(){this.foundation_.destroy()}},{key:"listen",value:function(e,t){this.root_.addEventListener(e,t)}},{key:"unlisten",value:function(e,t){this.root_.removeEventListener(e,t)}},{key:"emit",value:function(e,t){var n=void 0;"function"==typeof CustomEvent?n=new CustomEvent(e,{detail:t}):(n=document.createEvent("CustomEvent"),n.initCustomEvent(e,!1,!1,t)),this.root_.dispatchEvent(n)}}]),e}();t.default=s},32:function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(1),l="mdc-textfield",c=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,o(t.defaultAdapter,e)));return n.receivedUserInput_=!1,n.inputFocusHandler_=function(){return n.activateFocus_()},n.inputBlurHandler_=function(){return n.deactivateFocus_()},n.inputInputHandler_=function(){return n.autoCompleteFocus_()},n.inputKeydownHandler_=function(){return n.receivedUserInput_=!0},n}return u(t,e),a(t,null,[{key:"cssClasses",get:function(){return{ROOT:l,UPGRADED:l+"--upgraded",DISABLED:l+"--disabled",FOCUSED:l+"--focused",INVALID:l+"--invalid",HELPTEXT_PERSISTENT:l+"-helptext--persistent",HELPTEXT_VALIDATION_MSG:l+"-helptext--validation-msg",LABEL_FLOAT_ABOVE:l+"__label--float-above"}}},{key:"strings",get:function(){return{ARIA_HIDDEN:"aria-hidden",ROLE:"role"}}},{key:"defaultAdapter",get:function(){return{addClass:function(){},removeClass:function(){},addClassToLabel:function(){},removeClassFromLabel:function(){},addClassToHelptext:function(){},removeClassFromHelptext:function(){},helptextHasClass:function(){return!1},registerInputFocusHandler:function(){},deregisterInputFocusHandler:function(){},registerInputBlurHandler:function(){},deregisterInputBlurHandler:function(){},registerInputInputHandler:function(){},deregisterInputInputHandler:function(){},registerInputKeydownHandler:function(){},deregisterInputKeydownHandler:function(){},setHelptextAttr:function(){},removeHelptextAttr:function(){},getNativeInput:function(){return{}}}}}]),a(t,[{key:"init",value:function(){this.adapter_.addClass(t.cssClasses.UPGRADED),this.adapter_.registerInputFocusHandler(this.inputFocusHandler_),this.adapter_.registerInputBlurHandler(this.inputBlurHandler_),this.adapter_.registerInputInputHandler(this.inputInputHandler_),this.adapter_.registerInputKeydownHandler(this.inputKeydownHandler_)}},{key:"destroy",value:function(){this.adapter_.removeClass(t.cssClasses.UPGRADED),this.adapter_.deregisterInputFocusHandler(this.inputFocusHandler_),this.adapter_.deregisterInputBlurHandler(this.inputBlurHandler_),this.adapter_.deregisterInputInputHandler(this.inputInputHandler_),this.adapter_.deregisterInputKeydownHandler(this.inputKeydownHandler_)}},{key:"activateFocus_",value:function(){var e=t.cssClasses,n=e.FOCUSED,r=e.LABEL_FLOAT_ABOVE;this.adapter_.addClass(n),this.adapter_.addClassToLabel(r),this.showHelptext_()}},{key:"autoCompleteFocus_",value:function(){this.receivedUserInput_||this.activateFocus_()}},{key:"showHelptext_",value:function(){var e=t.strings.ARIA_HIDDEN;this.adapter_.removeHelptextAttr(e)}},{key:"deactivateFocus_",value:function(){var e=t.cssClasses,n=e.FOCUSED,r=e.INVALID,i=e.LABEL_FLOAT_ABOVE,u=this.getNativeInput_(),o=u.checkValidity();this.adapter_.removeClass(n),u.value||(this.adapter_.removeClassFromLabel(i),this.receivedUserInput_=!1),o?this.adapter_.removeClass(r):this.adapter_.addClass(r),this.updateHelptextOnDeactivation_(o)}},{key:"updateHelptextOnDeactivation_",value:function(e){var n=t.cssClasses,r=n.HELPTEXT_PERSISTENT,i=n.HELPTEXT_VALIDATION_MSG,u=t.strings.ROLE,o=this.adapter_.helptextHasClass(r),a=this.adapter_.helptextHasClass(i),s=a&&!e;s?this.adapter_.setHelptextAttr(u,"alert"):this.adapter_.removeHelptextAttr(u),o||s||this.hideHelptext_()}},{key:"hideHelptext_",value:function(){var e=t.strings.ARIA_HIDDEN;this.adapter_.setHelptextAttr(e,"true")}},{key:"isDisabled",value:function(){return this.getNativeInput_().disabled}},{key:"setDisabled",value:function(e){var n=t.cssClasses.DISABLED;this.getNativeInput_().disabled=e,e?this.adapter_.addClass(n):this.adapter_.removeClass(n)}},{key:"getNativeInput_",value:function(){return this.adapter_.getNativeInput()||{checkValidity:function(){return!0},value:"",disabled:!1}}}]),t}(s.MDCFoundation);t.default=c},33:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.MDCTextfield=t.MDCTextfieldFoundation=void 0;var a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(1),c=n(32),d=r(c);t.MDCTextfieldFoundation=d.default;var p=d.default.cssClasses;t.MDCTextfield=function(e){function t(){var e;i(this,t);for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];var a=u(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(r))),s=a.input_;return a.helptextElement=s.hasAttribute("aria-controls")?document.getElementById(s.getAttribute("aria-controls")):null,a}return o(t,e),s(t,null,[{key:"attachTo",value:function(e){return new t(e)}}]),s(t,[{key:"initialSyncWithDom",value:function(){this.disabled=this.input_.disabled}},{key:"getDefaultFoundation",value:function(){var e=this;return new d.default(a({addClass:function(t){return e.root_.classList.add(t)},removeClass:function(t){return e.root_.classList.remove(t)},addClassToLabel:function(t){var n=e.label_;n&&n.classList.add(t)},removeClassFromLabel:function(t){var n=e.label_;n&&n.classList.remove(t)}},this.getInputAdapterMethods_(),this.getHelptextAdapterMethods_()))}},{key:"getInputAdapterMethods_",value:function(){var e=this;return{registerInputFocusHandler:function(t){return e.input_.addEventListener("focus",t)},registerInputBlurHandler:function(t){return e.input_.addEventListener("blur",t)},registerInputInputHandler:function(t){return e.input_.addEventListener("input",t)},registerInputKeydownHandler:function(t){return e.input_.addEventListener("keydown",t)},deregisterInputFocusHandler:function(t){return e.input_.removeEventListener("focus",t)},deregisterInputBlurHandler:function(t){return e.input_.removeEventListener("blur",t)},deregisterInputInputHandler:function(t){return e.input_.removeEventListener("input",t)},deregisterInputKeydownHandler:function(t){return e.input_.removeEventListener("keydown",t)},getNativeInput:function(){return e.input_}}}},{key:"getHelptextAdapterMethods_",value:function(){var e=this;return{addClassToHelptext:function(t){e.helptextElement&&e.helptextElement.classList.add(t)},removeClassFromHelptext:function(t){e.helptextElement&&e.helptextElement.classList.remove(t)},helptextHasClass:function(t){return!!e.helptextElement&&e.helptextElement.classList.contains(t)},setHelptextAttr:function(t,n){e.helptextElement&&e.helptextElement.setAttribute(t,n)},removeHelptextAttr:function(t){e.helptextElement&&e.helptextElement.removeAttribute(t)}}}},{key:"disabled",get:function(){return this.foundation_.isDisabled()},set:function(e){this.foundation_.setDisabled(e)}},{key:"input_",get:function(){return this.root_.querySelector("."+p.ROOT+"__input")}},{key:"label_",get:function(){return this.root_.querySelector("."+p.ROOT+"__label")}}]),t}(l.MDCComponent)}})});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.textfield=e():(t.mdc=t.mdc||{},t.mdc.textfield=e())}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/assets/",e(e.s=48)}({0:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(1);n.d(e,"MDCFoundation",function(){return r.a});var i=n(2);n.d(e,"MDCComponent",function(){return i.a})},1:function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r(this,t),this.adapter_=e}return i(t,null,[{key:"cssClasses",get:function(){return{}}},{key:"strings",get:function(){return{}}},{key:"numbers",get:function(){return{}}},{key:"defaultAdapter",get:function(){return{}}}]),i(t,[{key:"init",value:function(){}},{key:"destroy",value:function(){}}]),t}();e.a=o},2:function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var i=n(1),o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;r(this,t),this.root_=e;for(var i=arguments.length,o=Array(i>2?i-2:0),u=2;u<i;u++)o[u-2]=arguments[u];this.initialize.apply(this,o),this.foundation_=void 0===n?this.getDefaultFoundation():n,this.foundation_.init(),this.initialSyncWithDOM()}return o(t,null,[{key:"attachTo",value:function(e){return new t(e,new i.a)}}]),o(t,[{key:"initialize",value:function(){}},{key:"getDefaultFoundation",value:function(){throw new Error("Subclasses must override getDefaultFoundation to return a properly configured foundation class")}},{key:"initialSyncWithDOM",value:function(){}},{key:"destroy",value:function(){this.foundation_.destroy()}},{key:"listen",value:function(t,e){this.root_.addEventListener(t,e)}},{key:"unlisten",value:function(t,e){this.root_.removeEventListener(t,e)}},{key:"emit",value:function(t,e){var n=void 0;"function"==typeof CustomEvent?n=new CustomEvent(t,{detail:e}):(n=document.createEvent("CustomEvent"),n.initCustomEvent(t,!1,!1,e)),this.root_.dispatchEvent(n)}}]),t}();e.a=u},21:function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(0),a=n(35);n.d(e,"MDCTextfieldFoundation",function(){return a.a}),n.d(e,"MDCTextfield",function(){return d});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},l=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),c=a.a.cssClasses,d=function(t){function e(){var t;r(this,e);for(var n=arguments.length,o=Array(n),u=0;u<n;u++)o[u]=arguments[u];var a=i(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(o))),s=a.input_;return a.helptextElement=s.hasAttribute("aria-controls")?document.getElementById(s.getAttribute("aria-controls")):null,a}return o(e,t),l(e,null,[{key:"attachTo",value:function(t){return new e(t)}}]),l(e,[{key:"initialSyncWithDom",value:function(){this.disabled=this.input_.disabled}},{key:"getDefaultFoundation",value:function(){var t=this;return new a.a(s({addClass:function(e){return t.root_.classList.add(e)},removeClass:function(e){return t.root_.classList.remove(e)},addClassToLabel:function(e){var n=t.label_;n&&n.classList.add(e)},removeClassFromLabel:function(e){var n=t.label_;n&&n.classList.remove(e)}},this.getInputAdapterMethods_(),this.getHelptextAdapterMethods_()))}},{key:"getInputAdapterMethods_",value:function(){var t=this;return{registerInputFocusHandler:function(e){return t.input_.addEventListener("focus",e)},registerInputBlurHandler:function(e){return t.input_.addEventListener("blur",e)},registerInputInputHandler:function(e){return t.input_.addEventListener("input",e)},registerInputKeydownHandler:function(e){return t.input_.addEventListener("keydown",e)},deregisterInputFocusHandler:function(e){return t.input_.removeEventListener("focus",e)},deregisterInputBlurHandler:function(e){return t.input_.removeEventListener("blur",e)},deregisterInputInputHandler:function(e){return t.input_.removeEventListener("input",e)},deregisterInputKeydownHandler:function(e){return t.input_.removeEventListener("keydown",e)},getNativeInput:function(){return t.input_}}}},{key:"getHelptextAdapterMethods_",value:function(){var t=this;return{addClassToHelptext:function(e){t.helptextElement&&t.helptextElement.classList.add(e)},removeClassFromHelptext:function(e){t.helptextElement&&t.helptextElement.classList.remove(e)},helptextHasClass:function(e){return!!t.helptextElement&&t.helptextElement.classList.contains(e)},setHelptextAttr:function(e,n){t.helptextElement&&t.helptextElement.setAttribute(e,n)},removeHelptextAttr:function(e){t.helptextElement&&t.helptextElement.removeAttribute(e)}}}},{key:"disabled",get:function(){return this.foundation_.isDisabled()},set:function(t){this.foundation_.setDisabled(t)}},{key:"input_",get:function(){return this.root_.querySelector("."+c.ROOT+"__input")}},{key:"label_",get:function(){return this.root_.querySelector("."+c.ROOT+"__label")}}]),e}(u.MDCComponent)},35:function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}var u=n(0),a=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l="mdc-textfield",c=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};r(this,e);var n=i(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,a(e.defaultAdapter,t)));return n.receivedUserInput_=!1,n.inputFocusHandler_=function(){return n.activateFocus_()},n.inputBlurHandler_=function(){return n.deactivateFocus_()},n.inputInputHandler_=function(){return n.autoCompleteFocus_()},n.inputKeydownHandler_=function(){return n.receivedUserInput_=!0},n}return o(e,t),s(e,null,[{key:"cssClasses",get:function(){return{ROOT:l,UPGRADED:l+"--upgraded",DISABLED:l+"--disabled",FOCUSED:l+"--focused",INVALID:l+"--invalid",HELPTEXT_PERSISTENT:l+"-helptext--persistent",HELPTEXT_VALIDATION_MSG:l+"-helptext--validation-msg",LABEL_FLOAT_ABOVE:l+"__label--float-above"}}},{key:"strings",get:function(){return{ARIA_HIDDEN:"aria-hidden",ROLE:"role"}}},{key:"defaultAdapter",get:function(){return{addClass:function(){},removeClass:function(){},addClassToLabel:function(){},removeClassFromLabel:function(){},addClassToHelptext:function(){},removeClassFromHelptext:function(){},helptextHasClass:function(){return!1},registerInputFocusHandler:function(){},deregisterInputFocusHandler:function(){},registerInputBlurHandler:function(){},deregisterInputBlurHandler:function(){},registerInputInputHandler:function(){},deregisterInputInputHandler:function(){},registerInputKeydownHandler:function(){},deregisterInputKeydownHandler:function(){},setHelptextAttr:function(){},removeHelptextAttr:function(){},getNativeInput:function(){return{}}}}}]),s(e,[{key:"init",value:function(){this.adapter_.addClass(e.cssClasses.UPGRADED),this.adapter_.registerInputFocusHandler(this.inputFocusHandler_),this.adapter_.registerInputBlurHandler(this.inputBlurHandler_),this.adapter_.registerInputInputHandler(this.inputInputHandler_),this.adapter_.registerInputKeydownHandler(this.inputKeydownHandler_)}},{key:"destroy",value:function(){this.adapter_.removeClass(e.cssClasses.UPGRADED),this.adapter_.deregisterInputFocusHandler(this.inputFocusHandler_),this.adapter_.deregisterInputBlurHandler(this.inputBlurHandler_),this.adapter_.deregisterInputInputHandler(this.inputInputHandler_),this.adapter_.deregisterInputKeydownHandler(this.inputKeydownHandler_)}},{key:"activateFocus_",value:function(){var t=e.cssClasses,n=t.FOCUSED,r=t.LABEL_FLOAT_ABOVE;this.adapter_.addClass(n),this.adapter_.addClassToLabel(r),this.showHelptext_()}},{key:"autoCompleteFocus_",value:function(){this.receivedUserInput_||this.activateFocus_()}},{key:"showHelptext_",value:function(){var t=e.strings.ARIA_HIDDEN;this.adapter_.removeHelptextAttr(t)}},{key:"deactivateFocus_",value:function(){var t=e.cssClasses,n=t.FOCUSED,r=t.INVALID,i=t.LABEL_FLOAT_ABOVE,o=this.getNativeInput_(),u=o.checkValidity();this.adapter_.removeClass(n),o.value||(this.adapter_.removeClassFromLabel(i),this.receivedUserInput_=!1),u?this.adapter_.removeClass(r):this.adapter_.addClass(r),this.updateHelptextOnDeactivation_(u)}},{key:"updateHelptextOnDeactivation_",value:function(t){var n=e.cssClasses,r=n.HELPTEXT_PERSISTENT,i=n.HELPTEXT_VALIDATION_MSG,o=e.strings.ROLE,u=this.adapter_.helptextHasClass(r),a=this.adapter_.helptextHasClass(i),s=a&&!t;s?this.adapter_.setHelptextAttr(o,"alert"):this.adapter_.removeHelptextAttr(o),u||s||this.hideHelptext_()}},{key:"hideHelptext_",value:function(){var t=e.strings.ARIA_HIDDEN;this.adapter_.setHelptextAttr(t,"true")}},{key:"isDisabled",value:function(){return this.getNativeInput_().disabled}},{key:"setDisabled",value:function(t){var n=e.cssClasses.DISABLED;this.getNativeInput_().disabled=t,t?this.adapter_.addClass(n):this.adapter_.removeClass(n)}},{key:"getNativeInput_",value:function(){return this.adapter_.getNativeInput()||{checkValidity:function(){return!0},value:"",disabled:!1}}}]),e}(u.MDCFoundation);e.a=c},48:function(t,e,n){t.exports=n(21)}})});
{
"name": "@material/textfield",
"description": "The Material Components for the web text field component",
"version": "0.2.1",
"version": "0.2.2",
"license": "Apache-2.0",
"keywords": [
"material components",
"material design",
"textfield"
],
"main": "index.js",

@@ -12,8 +17,8 @@ "repository": {

"dependencies": {
"@material/animation": "^0.1.3",
"@material/base": "^0.1.1",
"@material/rtl": "^0.1.1",
"@material/theme": "^0.1.1",
"@material/typography": "^0.1.1"
"@material/animation": "^0.1.4",
"@material/base": "^0.1.2",
"@material/rtl": "^0.1.2",
"@material/theme": "^0.1.2",
"@material/typography": "^0.2.0"
}
}

@@ -231,3 +231,3 @@ # MDC Textfield

```javascript
mdc.textfield.attachTo(document.querySelector('.mdc-textfield'));
mdc.textfield.MDCTextfield.attachTo(document.querySelector('.mdc-textfield'));
```

@@ -234,0 +234,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc