@material/textfield
Advanced tools
Comparing version 0.25.0 to 0.26.0
@@ -18,2 +18,6 @@ /** | ||
/* eslint-disable no-unused-vars */ | ||
import MDCTextFieldBottomLineFoundation from './bottom-line/foundation'; | ||
import MDCTextFieldHelperTextFoundation from './helper-text/foundation'; | ||
/* eslint no-unused-vars: [2, {"args": "none"}] */ | ||
@@ -104,33 +108,21 @@ | ||
/** | ||
* Adds a class to the bottom line element. | ||
* @param {string} className | ||
*/ | ||
addClassToBottomLine(className) {} | ||
/** | ||
* Removes a class from the bottom line element. | ||
* @param {string} className | ||
*/ | ||
removeClassFromBottomLine(className) {} | ||
/** | ||
* Adds a class to the help text element. Note that in our code we check for | ||
* whether or not we have a help text element and if we don't, we simply | ||
* Adds a class to the helper text element. Note that in our code we check for | ||
* whether or not we have a helper text element and if we don't, we simply | ||
* return. | ||
* @param {string} className | ||
*/ | ||
addClassToHelptext(className) {} | ||
addClassToHelperText(className) {} | ||
/** | ||
* Removes a class from the help text element. | ||
* Removes a class from the helper text element. | ||
* @param {string} className | ||
*/ | ||
removeClassFromHelptext(className) {} | ||
removeClassFromHelperText(className) {} | ||
/** | ||
* Returns whether or not the help text element contains the given class. | ||
* Returns whether or not the helper text element contains the given class. | ||
* @param {string} className | ||
* @return {boolean} | ||
*/ | ||
helptextHasClass(className) {} | ||
helperTextHasClass(className) {} | ||
@@ -152,32 +144,33 @@ /** | ||
/** | ||
* Registers an event listener on the bottom line element for a "transitionend" event. | ||
* Registers an event listener on the bottom line element for a given event. | ||
* @param {string} evtType | ||
* @param {function(!Event): undefined} handler | ||
*/ | ||
registerTransitionEndHandler(handler) {} | ||
registerBottomLineEventHandler(evtType, handler) {} | ||
/** | ||
* Deregisters an event listener on the bottom line element for a "transitionend" event. | ||
* Deregisters an event listener on the bottom line element for a given event. | ||
* @param {string} evtType | ||
* @param {function(!Event): undefined} handler | ||
*/ | ||
deregisterTransitionEndHandler(handler) {} | ||
deregisterBottomLineEventHandler(evtType, handler) {} | ||
/** | ||
* Sets an attribute with a given value on the bottom line element. | ||
* @param {string} attr | ||
* Sets an attribute with a given value on the helper text element. | ||
* @param {string} name | ||
* @param {string} value | ||
*/ | ||
setBottomLineAttr(attr, value) {} | ||
setHelperTextAttr(name, value) {} | ||
/** | ||
* Sets an attribute with a given value on the help text element. | ||
* Removes an attribute from the helper text element. | ||
* @param {string} name | ||
* @param {string} value | ||
*/ | ||
setHelptextAttr(name, value) {} | ||
removeHelperTextAttr(name) {} | ||
/** | ||
* Removes an attribute from the help text element. | ||
* @param {string} name | ||
* Sets the text content for the help text element | ||
* @param {string} content | ||
*/ | ||
removeHelptextAttr(name) {} | ||
setHelperTextContent(content) {} | ||
@@ -195,4 +188,18 @@ /** | ||
getNativeInput() {} | ||
/** | ||
* Returns the foundation for the bottom line element. Returns undefined if | ||
* there is no bottom line element. | ||
* @return {?MDCTextFieldBottomLineFoundation} | ||
*/ | ||
getBottomLineFoundation() {} | ||
/** | ||
* Returns the foundation for the helper text element. Returns undefined if | ||
* there is no helper text element. | ||
* @return {?MDCTextFieldHelperTextFoundation} | ||
*/ | ||
getHelperTextFoundation() {} | ||
} | ||
export {MDCTextFieldAdapter, NativeInputType}; |
@@ -20,4 +20,3 @@ /** | ||
const strings = { | ||
ARIA_HIDDEN: 'aria-hidden', | ||
ROLE: 'role', | ||
ARIA_CONTROLS: 'aria-controls', | ||
INPUT_SELECTOR: '.mdc-text-field__input', | ||
@@ -37,4 +36,2 @@ LABEL_SELECTOR: '.mdc-text-field__label', | ||
INVALID: 'mdc-text-field--invalid', | ||
HELPTEXT_PERSISTENT: 'mdc-text-field-helptext--persistent', | ||
HELPTEXT_VALIDATION_MSG: 'mdc-text-field-helptext--validation-msg', | ||
LABEL_FLOAT_ABOVE: 'mdc-text-field__label--float-above', | ||
@@ -45,5 +42,4 @@ LABEL_SHAKE: 'mdc-text-field__label--shake', | ||
TEXTAREA: 'mdc-text-field--textarea', | ||
BOTTOM_LINE_ACTIVE: 'mdc-text-field__bottom-line--active', | ||
}; | ||
export {cssClasses, strings}; |
@@ -6,4 +6,20 @@ /*! | ||
*/ | ||
!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(i){if(n[i])return n[i].exports;var a=n[i]={i:i,l:!1,exports:{}};return t[i].call(a.exports,a,a.exports,e),a.l=!0,a.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},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=95)}({0:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),r=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,t),this.adapter_=e}return a(t,null,[{key:"cssClasses",get:function(){return{}}},{key:"strings",get:function(){return{}}},{key:"numbers",get:function(){return{}}},{key:"defaultAdapter",get:function(){return{}}}]),a(t,[{key:"init",value:function(){}},{key:"destroy",value:function(){}}]),t}();e.a=r},1:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=n(0),r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;i(this,t),this.root_=e;for(var a=arguments.length,r=Array(a>2?a-2:0),o=2;o<a;o++)r[o-2]=arguments[o];this.initialize.apply(this,r),this.foundation_=void 0===n?this.getDefaultFoundation():n,this.foundation_.init(),this.initialSyncWithDOM()}return r(t,null,[{key:"attachTo",value:function(e){return new t(e,new a.a)}}]),r(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=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=void 0;"function"==typeof CustomEvent?i=new CustomEvent(t,{detail:e,bubbles:n}):(i=document.createEvent("CustomEvent"),i.initCustomEvent(t,n,!1,e)),this.root_.dispatchEvent(i)}}]),t}();e.a=o},2:function(t,e,n){"use strict";function i(t){var e=t.document,n=e.createElement("div");n.className="mdc-ripple-surface--test-edge-var-bug",e.body.appendChild(n);var i=t.getComputedStyle(n),a=null!==i&&"solid"===i.borderTopStyle;return n.remove(),a}function a(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("boolean"==typeof u&&!e)return u;if(t.CSS&&"function"==typeof t.CSS.supports){var n=t.CSS.supports("--css-vars","yes"),a=t.CSS.supports("(--css-vars: yes)")&&t.CSS.supports("color","#00000000");return u=!(!n&&!a||i(t))}}function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(void 0===c||e){var n=!1;try{t.document.addEventListener("test",null,{get passive(){n=!0}})}catch(t){}c=n}return!!c&&{passive:!0}}function o(t){return["webkitMatchesSelector","msMatchesSelector","matches"].filter(function(e){return e in t}).pop()}function s(t,e,n){var i=e.x,a=e.y,r=i+n.left,o=a+n.top,s=void 0,u=void 0;return"touchstart"===t.type?(s=t.changedTouches[0].pageX-r,u=t.changedTouches[0].pageY-o):(s=t.pageX-r,u=t.pageY-o),{x:s,y:u}}Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"supportsCssVariables",function(){return a}),n.d(e,"applyPassive",function(){return r}),n.d(e,"getMatchesProperty",function(){return o}),n.d(e,"getNormalizedEventCoords",function(){return s});/** | ||
!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(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},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=99)}({0:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),a=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,t),this.adapter_=e}return r(t,null,[{key:"cssClasses",get:function(){return{}}},{key:"strings",get:function(){return{}}},{key:"numbers",get:function(){return{}}},{key:"defaultAdapter",get:function(){return{}}}]),r(t,[{key:"init",value:function(){}},{key:"destroy",value:function(){}}]),t}();e.a=a},1:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=n(0),a=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),o=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;i(this,t),this.root_=e;for(var r=arguments.length,a=Array(r>2?r-2:0),o=2;o<r;o++)a[o-2]=arguments[o];this.initialize.apply(this,a),this.foundation_=void 0===n?this.getDefaultFoundation():n,this.foundation_.init(),this.initialSyncWithDOM()}return a(t,null,[{key:"attachTo",value:function(e){return new t(e,new r.a)}}]),a(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=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=void 0;"function"==typeof CustomEvent?i=new CustomEvent(t,{detail:e,bubbles:n}):(i=document.createEvent("CustomEvent"),i.initCustomEvent(t,n,!1,e)),this.root_.dispatchEvent(i)}}]),t}();e.a=o},100:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(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 a(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}),n.d(e,"MDCTextField",function(){return _});var o=n(1),u=n(5),s=n(23),c=(n(24),n(103)),l=n(104),f=n(105);n.d(e,"MDCTextFieldFoundation",function(){return c.a});var d=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},p=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),v=function t(e,n,i){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,n);if(void 0===r){var a=Object.getPrototypeOf(e);return null===a?void 0:t(a,n,i)}if("value"in r)return r.value;var o=r.get;if(void 0!==o)return o.call(i)},_=function(t){function e(){var t;i(this,e);for(var n=arguments.length,a=Array(n),o=0;o<n;o++)a[o]=arguments[o];var u=r(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(a)));return u.input_,u.label_,u.ripple,u.bottomLine_,u.helperText_,u.icon_,u}return a(e,t),p(e,[{key:"initialize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return new u.MDCRipple(t)},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(t){return new l.a(t)};if(this.input_=this.root_.querySelector(s.b.INPUT_SELECTOR),this.label_=this.root_.querySelector(s.b.LABEL_SELECTOR),this.ripple=null,this.root_.classList.contains(s.a.BOX)&&(this.ripple=t(this.root_)),!this.root_.classList.contains(s.a.TEXTAREA)){var n=this.root_.querySelector(s.b.BOTTOM_LINE_SELECTOR);n&&(this.bottomLine_=e(n))}if(this.input_.hasAttribute(s.b.ARIA_CONTROLS)){var i=document.getElementById(this.input_.getAttribute(s.b.ARIA_CONTROLS));i&&(this.helperText_=new f.a(i))}this.root_.classList.contains(s.a.TEXT_FIELD_ICON)||(this.icon_=this.root_.querySelector(s.b.ICON_SELECTOR))}},{key:"destroy",value:function(){this.ripple&&this.ripple.destroy(),this.bottomLine_&&this.bottomLine_.destroy(),this.helperText_&&this.helperText_.destroy(),v(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"destroy",this).call(this)}},{key:"initialSyncWithDom",value:function(){this.disabled=this.input_.disabled}},{key:"getDefaultFoundation",value:function(){var t=this;return new c.a(d({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)},eventTargetHasClass:function(t,e){return t.classList.contains(e)},registerTextFieldInteractionHandler:function(e,n){return t.root_.addEventListener(e,n)},deregisterTextFieldInteractionHandler:function(e,n){return t.root_.removeEventListener(e,n)},notifyIconAction:function(){return t.emit(c.a.strings.ICON_EVENT,{})},registerBottomLineEventHandler:function(e,n){t.bottomLine_&&t.bottomLine_.listen(e,n)},deregisterBottomLineEventHandler:function(e,n){t.bottomLine_&&t.bottomLine_.unlisten(e,n)},getBottomLineFoundation:function(){if(t.bottomLine_)return t.bottomLine_.foundation},getHelperTextFoundation:function(){if(t.helperText_)return t.helperText_.foundation}},this.getInputAdapterMethods_(),this.getIconAdapterMethods_()))}},{key:"getIconAdapterMethods_",value:function(){var t=this;return{setIconAttr:function(e,n){t.icon_&&t.icon_.setAttribute(e,n)}}}},{key:"getInputAdapterMethods_",value:function(){var t=this;return{registerInputInteractionHandler:function(e,n){return t.input_.addEventListener(e,n)},deregisterInputInteractionHandler:function(e,n){return t.input_.removeEventListener(e,n)},getNativeInput:function(){return t.input_}}}},{key:"disabled",get:function(){return this.foundation_.isDisabled()},set:function(t){this.foundation_.setDisabled(t)}},{key:"valid",set:function(t){this.foundation_.setValid(t)}},{key:"helperTextContent",set:function(t){this.foundation_.setHelperTextContent(t)}}],[{key:"attachTo",value:function(t){return new e(t)}}]),e}(o.a)},101:function(t,e,n){"use strict";n.d(e,"b",function(){return i}),n.d(e,"a",function(){return r});/** | ||
* @license | ||
* Copyright 2017 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. | ||
*/ | ||
var i={ANIMATION_END_EVENT:"MDCTextFieldBottomLine:animation-end"},r={BOTTOM_LINE_ACTIVE:"mdc-text-field__bottom-line--active"}},102:function(t,e,n){"use strict";n.d(e,"b",function(){return i}),n.d(e,"a",function(){return r});/** | ||
* @license | ||
* Copyright 2016 Google Inc. All Rights Reserved. | ||
@@ -23,3 +39,3 @@ * | ||
*/ | ||
var u=void 0,c=void 0},22:function(t,e,n){"use strict";n.d(e,"a",function(){return a}),n.d(e,"b",function(){return i});/** | ||
var i={ARIA_HIDDEN:"aria-hidden",ROLE:"role"},r={HELPER_TEXT_PERSISTENT:"mdc-text-field-helper-text--persistent",HELPER_TEXT_VALIDATION_MSG:"mdc-text-field-helper-text--validation-msg"}},103:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(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 a(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 o=n(0),u=(n(24),n(18)),s=n(23),c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},l=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),f=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var n=r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,c(e.defaultAdapter,t)));return n.isFocused_=!1,n.receivedUserInput_=!1,n.useCustomValidityChecking_=!1,n.inputFocusHandler_=function(){return n.activateFocus()},n.inputBlurHandler_=function(){return n.deactivateFocus()},n.inputInputHandler_=function(){return n.autoCompleteFocus()},n.setPointerXOffset_=function(t){return n.setBottomLineTransformOrigin(t)},n.textFieldInteractionHandler_=function(t){return n.handleTextFieldInteraction(t)},n.bottomLineAnimationEndHandler_=function(){return n.handleBottomLineAnimationEnd()},n}return a(e,t),l(e,null,[{key:"cssClasses",get:function(){return s.a}},{key:"strings",get:function(){return s.b}},{key:"defaultAdapter",get:function(){return{addClass:function(){},removeClass:function(){},addClassToLabel:function(){},removeClassFromLabel:function(){},setIconAttr:function(){},eventTargetHasClass:function(){},registerTextFieldInteractionHandler:function(){},deregisterTextFieldInteractionHandler:function(){},notifyIconAction:function(){},registerInputInteractionHandler:function(){},deregisterInputInteractionHandler:function(){},registerBottomLineEventHandler:function(){},deregisterBottomLineEventHandler:function(){},getNativeInput:function(){},getBottomLineFoundation:function(){},getHelperTextFoundation:function(){}}}}]),l(e,[{key:"init",value:function(){var t=this;this.adapter_.addClass(e.cssClasses.UPGRADED),this.getNativeInput_().value&&this.adapter_.addClassToLabel(e.cssClasses.LABEL_FLOAT_ABOVE),this.adapter_.registerInputInteractionHandler("focus",this.inputFocusHandler_),this.adapter_.registerInputInteractionHandler("blur",this.inputBlurHandler_),this.adapter_.registerInputInteractionHandler("input",this.inputInputHandler_),["mousedown","touchstart"].forEach(function(e){t.adapter_.registerInputInteractionHandler(e,t.setPointerXOffset_)}),["click","keydown"].forEach(function(e){t.adapter_.registerTextFieldInteractionHandler(e,t.textFieldInteractionHandler_)}),this.adapter_.registerBottomLineEventHandler(u.a.strings.ANIMATION_END_EVENT,this.bottomLineAnimationEndHandler_)}},{key:"destroy",value:function(){var t=this;this.adapter_.removeClass(e.cssClasses.UPGRADED),this.adapter_.deregisterInputInteractionHandler("focus",this.inputFocusHandler_),this.adapter_.deregisterInputInteractionHandler("blur",this.inputBlurHandler_),this.adapter_.deregisterInputInteractionHandler("input",this.inputInputHandler_),["mousedown","touchstart"].forEach(function(e){t.adapter_.deregisterInputInteractionHandler(e,t.setPointerXOffset_)}),["click","keydown"].forEach(function(e){t.adapter_.deregisterTextFieldInteractionHandler(e,t.textFieldInteractionHandler_)}),this.adapter_.deregisterBottomLineEventHandler(u.a.strings.ANIMATION_END_EVENT,this.bottomLineAnimationEndHandler_)}},{key:"handleTextFieldInteraction",value:function(t){if(!this.adapter_.getNativeInput().disabled){this.receivedUserInput_=!0;var n=t.target,i=t.type,r=e.cssClasses.TEXT_FIELD_ICON,a=this.adapter_.eventTargetHasClass(n,r),o="click"===i||"Enter"===t.key||13===t.keyCode;a&&o&&this.adapter_.notifyIconAction()}}},{key:"activateFocus",value:function(){var t=e.cssClasses,n=t.FOCUSED,i=t.LABEL_FLOAT_ABOVE,r=t.LABEL_SHAKE;this.adapter_.addClass(n);var a=this.adapter_.getBottomLineFoundation();a&&a.activate(),this.adapter_.addClassToLabel(i),this.adapter_.removeClassFromLabel(r);var o=this.adapter_.getHelperTextFoundation();o&&o.showToScreenReader(),this.isFocused_=!0}},{key:"setBottomLineTransformOrigin",value:function(t){var e=this.adapter_.getBottomLineFoundation();e&&e.setTransformOrigin(t)}},{key:"autoCompleteFocus",value:function(){this.receivedUserInput_||this.activateFocus()}},{key:"handleBottomLineAnimationEnd",value:function(){var t=this.adapter_.getBottomLineFoundation();!this.isFocused_&&t&&t.deactivate()}},{key:"deactivateFocus",value:function(){var t=e.cssClasses,n=t.FOCUSED,i=t.LABEL_FLOAT_ABOVE,r=t.LABEL_SHAKE,a=this.getNativeInput_();this.isFocused_=!1,this.adapter_.removeClass(n),this.adapter_.removeClassFromLabel(r),a.value||this.isBadInput_()||(this.adapter_.removeClassFromLabel(i),this.receivedUserInput_=!1),this.useCustomValidityChecking_||this.changeValidity_(a.checkValidity())}},{key:"changeValidity_",value:function(t){var n=e.cssClasses,i=n.INVALID,r=n.LABEL_SHAKE;t?this.adapter_.removeClass(i):(this.adapter_.addClassToLabel(r),this.adapter_.addClass(i));var a=this.adapter_.getHelperTextFoundation();a&&a.setValidity(t)}},{key:"isBadInput_",value:function(){var t=this.getNativeInput_();return t.validity?t.validity.badInput:t.badInput}},{key:"isDisabled",value:function(){return this.getNativeInput_().disabled}},{key:"setDisabled",value:function(t){var n=e.cssClasses,i=n.DISABLED,r=n.INVALID;this.getNativeInput_().disabled=t,t?(this.adapter_.addClass(i),this.adapter_.removeClass(r),this.adapter_.setIconAttr("tabindex","-1")):(this.adapter_.removeClass(i),this.adapter_.setIconAttr("tabindex","0"))}},{key:"setHelperTextContent",value:function(t){var e=this.adapter_.getHelperTextFoundation();e&&e.setContent(t)}},{key:"getNativeInput_",value:function(){return this.adapter_.getNativeInput()||{checkValidity:function(){return!0},value:"",disabled:!1,badInput:!1}}},{key:"setValid",value:function(t){this.useCustomValidityChecking_=!0,this.changeValidity_(t)}}]),e}(o.a);e.a=f},104:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(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 a(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)}n.d(e,"a",function(){return l});var o=n(1),u=(n(25),n(18)),s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),l=function(t){function e(){return i(this,e),r(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),c(e,[{key:"getDefaultFoundation",value:function(){var t=this;return new u.a(s({addClass:function(e){return t.root_.classList.add(e)},removeClass:function(e){return t.root_.classList.remove(e)},setAttr:function(e,n){return t.root_.setAttribute(e,n)},registerEventHandler:function(e,n){return t.root_.addEventListener(e,n)},deregisterEventHandler:function(e,n){return t.root_.removeEventListener(e,n)},notifyAnimationEnd:function(){t.emit(u.a.strings.ANIMATION_END_EVENT,{})}}))}},{key:"foundation",get:function(){return this.foundation_}}],[{key:"attachTo",value:function(t){return new e(t)}}]),e}(o.a)},105:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(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 a(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)}n.d(e,"a",function(){return l});var o=n(1),u=(n(27),n(26)),s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),l=function(t){function e(){return i(this,e),r(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return a(e,t),c(e,[{key:"getDefaultFoundation",value:function(){var t=this;return new u.a(s({addClass:function(e){return t.root_.classList.add(e)},removeClass:function(e){return t.root_.classList.remove(e)},hasClass:function(e){return t.root_.classList.contains(e)},setAttr:function(e,n){return t.root_.setAttribute(e,n)},removeAttr:function(e){return t.root_.removeAttribute(e)},setContent:function(e){t.root_.textContent=e}}))}},{key:"foundation",get:function(){return this.foundation_}}],[{key:"attachTo",value:function(t){return new e(t)}}]),e}(o.a)},18:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(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 a(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 o=n(0),u=(n(25),n(101)),s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),l=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var n=r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,s(e.defaultAdapter,t)));return n.transitionEndHandler_=function(t){return n.handleTransitionEnd(t)},n}return a(e,t),c(e,null,[{key:"cssClasses",get:function(){return u.a}},{key:"strings",get:function(){return u.b}},{key:"defaultAdapter",get:function(){return{addClass:function(){},removeClass:function(){},setAttr:function(){},registerEventHandler:function(){},deregisterEventHandler:function(){},notifyAnimationEnd:function(){}}}}]),c(e,[{key:"init",value:function(){this.adapter_.registerEventHandler("transitionend",this.transitionEndHandler_)}},{key:"destroy",value:function(){this.adapter_.deregisterEventHandler("transitionend",this.transitionEndHandler_)}},{key:"activate",value:function(){this.adapter_.addClass(u.a.BOTTOM_LINE_ACTIVE)}},{key:"setTransformOrigin",value:function(t){var e=t.target.getBoundingClientRect(),n={x:t.clientX,y:t.clientY},i=n.x-e.left,r="transform-origin: "+i+"px center";this.adapter_.setAttr("style",r)}},{key:"deactivate",value:function(){this.adapter_.removeClass(u.a.BOTTOM_LINE_ACTIVE)}},{key:"handleTransitionEnd",value:function(t){"opacity"===t.propertyName&&this.adapter_.notifyAnimationEnd()}}]),e}(o.a);e.a=l},2:function(t,e,n){"use strict";function i(t){var e=t.document,n=e.createElement("div");n.className="mdc-ripple-surface--test-edge-var-bug",e.body.appendChild(n);var i=t.getComputedStyle(n),r=null!==i&&"solid"===i.borderTopStyle;return n.remove(),r}function r(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("boolean"==typeof s&&!e)return s;if(t.CSS&&"function"==typeof t.CSS.supports){var n=t.CSS.supports("--css-vars","yes"),r=t.CSS.supports("(--css-vars: yes)")&&t.CSS.supports("color","#00000000");return s=!(!n&&!r||i(t))}}function a(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(void 0===c||e){var n=!1;try{t.document.addEventListener("test",null,{get passive(){n=!0}})}catch(t){}c=n}return!!c&&{passive:!0}}function o(t){return["webkitMatchesSelector","msMatchesSelector","matches"].filter(function(e){return e in t}).pop()}function u(t,e,n){var i=e.x,r=e.y,a=i+n.left,o=r+n.top,u=void 0,s=void 0;return"touchstart"===t.type?(u=t.changedTouches[0].pageX-a,s=t.changedTouches[0].pageY-o):(u=t.pageX-a,s=t.pageY-o),{x:u,y:s}}Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"supportsCssVariables",function(){return r}),n.d(e,"applyPassive",function(){return a}),n.d(e,"getMatchesProperty",function(){return o}),n.d(e,"getNormalizedEventCoords",function(){return u});/** | ||
* @license | ||
@@ -40,3 +56,3 @@ * Copyright 2016 Google Inc. All Rights Reserved. | ||
*/ | ||
var i={ARIA_HIDDEN:"aria-hidden",ROLE:"role",INPUT_SELECTOR:".mdc-text-field__input",LABEL_SELECTOR:".mdc-text-field__label",ICON_SELECTOR:".mdc-text-field__icon",ICON_EVENT:"MDCTextField:icon",BOTTOM_LINE_SELECTOR:".mdc-text-field__bottom-line"},a={ROOT:"mdc-text-field",UPGRADED:"mdc-text-field--upgraded",DISABLED:"mdc-text-field--disabled",FOCUSED:"mdc-text-field--focused",INVALID:"mdc-text-field--invalid",HELPTEXT_PERSISTENT:"mdc-text-field-helptext--persistent",HELPTEXT_VALIDATION_MSG:"mdc-text-field-helptext--validation-msg",LABEL_FLOAT_ABOVE:"mdc-text-field__label--float-above",LABEL_SHAKE:"mdc-text-field__label--shake",BOX:"mdc-text-field--box",TEXT_FIELD_ICON:"mdc-text-field__icon",TEXTAREA:"mdc-text-field--textarea",BOTTOM_LINE_ACTIVE:"mdc-text-field__bottom-line--active"}},23:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();!function(){function t(){i(this,t)}a(t,[{key:"addClass",value:function(t){}},{key:"removeClass",value:function(t){}},{key:"addClassToLabel",value:function(t){}},{key:"removeClassFromLabel",value:function(t){}},{key:"setIconAttr",value:function(t,e){}},{key:"eventTargetHasClass",value:function(t,e){}},{key:"registerTextFieldInteractionHandler",value:function(t,e){}},{key:"deregisterTextFieldInteractionHandler",value:function(t,e){}},{key:"notifyIconAction",value:function(){}},{key:"addClassToBottomLine",value:function(t){}},{key:"removeClassFromBottomLine",value:function(t){}},{key:"addClassToHelptext",value:function(t){}},{key:"removeClassFromHelptext",value:function(t){}},{key:"helptextHasClass",value:function(t){}},{key:"registerInputInteractionHandler",value:function(t,e){}},{key:"deregisterInputInteractionHandler",value:function(t,e){}},{key:"registerTransitionEndHandler",value:function(t){}},{key:"deregisterTransitionEndHandler",value:function(t){}},{key:"setBottomLineAttr",value:function(t,e){}},{key:"setHelptextAttr",value:function(t,e){}},{key:"removeHelptextAttr",value:function(t){}},{key:"getNativeInput",value:function(){}}])}()},3:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();!function(){function t(){i(this,t)}a(t,[{key:"browserSupportsCssVars",value:function(){}},{key:"isUnbounded",value:function(){}},{key:"isSurfaceActive",value:function(){}},{key:"isSurfaceDisabled",value:function(){}},{key:"addClass",value:function(t){}},{key:"removeClass",value:function(t){}},{key:"registerInteractionHandler",value:function(t,e){}},{key:"deregisterInteractionHandler",value:function(t,e){}},{key:"registerResizeHandler",value:function(t){}},{key:"deregisterResizeHandler",value:function(t){}},{key:"updateCssVariable",value:function(t,e){}},{key:"computeBoundingRect",value:function(){}},{key:"getWindowPageOffset",value:function(){}}])}()},5:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(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 r(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}),n.d(e,"MDCRipple",function(){return l});var o=n(1),s=(n(3),n(6)),u=n(2);n.d(e,"MDCRippleFoundation",function(){return s.a}),n.d(e,"util",function(){return u});var c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),l=function(t){function e(){var t;i(this,e);for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];var s=a(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(r)));return s.disabled=!1,s.unbounded_,s}return r(e,t),c(e,[{key:"activate",value:function(){this.foundation_.activate()}},{key:"deactivate",value:function(){this.foundation_.deactivate()}},{key:"layout",value:function(){this.foundation_.layout()}},{key:"getDefaultFoundation",value:function(){return new s.a(e.createAdapter(this))}},{key:"initialSyncWithDOM",value:function(){this.unbounded="mdcRippleIsUnbounded"in this.root_.dataset}},{key:"unbounded",get:function(){return this.unbounded_},set:function(t){var e=s.a.cssClasses.UNBOUNDED;this.unbounded_=Boolean(t),this.unbounded_?this.root_.classList.add(e):this.root_.classList.remove(e)}}],[{key:"attachTo",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.isUnbounded,a=void 0===i?void 0:i,r=new e(t);return void 0!==a&&(r.unbounded=a),r}},{key:"createAdapter",value:function(t){var e=u.getMatchesProperty(HTMLElement.prototype);return{browserSupportsCssVars:function(){return u.supportsCssVariables(window)},isUnbounded:function(){return t.unbounded},isSurfaceActive:function(){return t.root_[e](":active")},isSurfaceDisabled:function(){return t.disabled},addClass:function(e){return t.root_.classList.add(e)},removeClass:function(e){return t.root_.classList.remove(e)},registerInteractionHandler:function(e,n){return t.root_.addEventListener(e,n,u.applyPassive())},deregisterInteractionHandler:function(e,n){return t.root_.removeEventListener(e,n,u.applyPassive())},registerResizeHandler:function(t){return window.addEventListener("resize",t)},deregisterResizeHandler:function(t){return window.removeEventListener("resize",t)},updateCssVariable:function(e,n){return t.root_.style.setProperty(e,n)},computeBoundingRect:function(){return t.root_.getBoundingClientRect()},getWindowPageOffset:function(){return{x:window.pageXOffset,y:window.pageYOffset}}}}}]),e}(o.a),d=function t(){i(this,t)};d.prototype.root_,d.prototype.unbounded,d.prototype.disabled},6:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(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 r(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 o=n(0),s=(n(3),n(7)),u=n(2),c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},l=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),d={mouseup:"mousedown",pointerup:"pointerdown",touchend:"touchstart",keyup:"keydown",blur:"focus"},f=function(t){function e(t){i(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,c(e.defaultAdapter,t)));return n.layoutFrame_=0,n.frame_={width:0,height:0},n.activationState_=n.defaultActivationState_(),n.xfDuration_=0,n.initialSize_=0,n.maxRadius_=0,n.listenerInfos_=[{activate:"touchstart",deactivate:"touchend"},{activate:"pointerdown",deactivate:"pointerup"},{activate:"mousedown",deactivate:"mouseup"},{activate:"keydown",deactivate:"keyup"},{focus:"focus",blur:"blur"}],n.listeners_={activate:function(t){return n.activate_(t)},deactivate:function(t){return n.deactivate_(t)},focus:function(){return requestAnimationFrame(function(){return n.adapter_.addClass(e.cssClasses.BG_FOCUSED)})},blur:function(){return requestAnimationFrame(function(){return n.adapter_.removeClass(e.cssClasses.BG_FOCUSED)})}},n.resizeHandler_=function(){return n.layout()},n.unboundedCoords_={left:0,top:0},n.fgScale_=0,n.activationTimer_=0,n.fgDeactivationRemovalTimer_=0,n.activationAnimationHasEnded_=!1,n.activationTimerCallback_=function(){n.activationAnimationHasEnded_=!0,n.runDeactivationUXLogicIfReady_()},n}return r(e,t),l(e,null,[{key:"cssClasses",get:function(){return s.a}},{key:"strings",get:function(){return s.c}},{key:"numbers",get:function(){return s.b}},{key:"defaultAdapter",get:function(){return{browserSupportsCssVars:function(){},isUnbounded:function(){},isSurfaceActive:function(){},isSurfaceDisabled:function(){},addClass:function(){},removeClass:function(){},registerInteractionHandler:function(){},deregisterInteractionHandler:function(){},registerResizeHandler:function(){},deregisterResizeHandler:function(){},updateCssVariable:function(){},computeBoundingRect:function(){},getWindowPageOffset:function(){}}}}]),l(e,[{key:"isSupported_",value:function(){return this.adapter_.browserSupportsCssVars()}},{key:"defaultActivationState_",value:function(){return{isActivated:!1,hasDeactivationUXRun:!1,wasActivatedByPointer:!1,wasElementMadeActive:!1,activationStartTime:0,activationEvent:null,isProgrammatic:!1}}},{key:"init",value:function(){var t=this;if(this.isSupported_()){this.addEventListeners_();var n=e.cssClasses,i=n.ROOT,a=n.UNBOUNDED;requestAnimationFrame(function(){t.adapter_.addClass(i),t.adapter_.isUnbounded()&&t.adapter_.addClass(a),t.layoutInternal_()})}}},{key:"addEventListeners_",value:function(){var t=this;this.listenerInfos_.forEach(function(e){Object.keys(e).forEach(function(n){t.adapter_.registerInteractionHandler(e[n],t.listeners_[n])})}),this.adapter_.registerResizeHandler(this.resizeHandler_)}},{key:"activate_",value:function(t){var e=this;if(!this.adapter_.isSurfaceDisabled()){var n=this.activationState_;n.isActivated||(n.isActivated=!0,n.isProgrammatic=null===t,n.activationEvent=t,n.wasActivatedByPointer=!n.isProgrammatic&&("mousedown"===t.type||"touchstart"===t.type||"pointerdown"===t.type),n.activationStartTime=Date.now(),requestAnimationFrame(function(){n.wasElementMadeActive=!t||"keydown"!==t.type||e.adapter_.isSurfaceActive(),n.wasElementMadeActive?e.animateActivation_():e.activationState_=e.defaultActivationState_()}))}}},{key:"activate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.activate_(t)}},{key:"animateActivation_",value:function(){var t=this,n=e.strings,i=n.VAR_FG_TRANSLATE_START,a=n.VAR_FG_TRANSLATE_END,r=e.cssClasses,o=r.BG_ACTIVE_FILL,s=r.FG_DEACTIVATION,u=r.FG_ACTIVATION,c=e.numbers.DEACTIVATION_TIMEOUT_MS,l="",d="";if(!this.adapter_.isUnbounded()){var f=this.getFgTranslationCoordinates_(),p=f.startPoint,v=f.endPoint;l=p.x+"px, "+p.y+"px",d=v.x+"px, "+v.y+"px"}this.adapter_.updateCssVariable(i,l),this.adapter_.updateCssVariable(a,d),clearTimeout(this.activationTimer_),clearTimeout(this.fgDeactivationRemovalTimer_),this.rmBoundedActivationClasses_(),this.adapter_.removeClass(s),this.adapter_.computeBoundingRect(),this.adapter_.addClass(o),this.adapter_.addClass(u),this.activationTimer_=setTimeout(function(){return t.activationTimerCallback_()},c)}},{key:"getFgTranslationCoordinates_",value:function(){var t=this.activationState_,e=t.activationEvent,n=t.wasActivatedByPointer,i=void 0;return i=n?Object(u.getNormalizedEventCoords)(e,this.adapter_.getWindowPageOffset(),this.adapter_.computeBoundingRect()):{x:this.frame_.width/2,y:this.frame_.height/2},i={x:i.x-this.initialSize_/2,y:i.y-this.initialSize_/2},{startPoint:i,endPoint:{x:this.frame_.width/2-this.initialSize_/2,y:this.frame_.height/2-this.initialSize_/2}}}},{key:"runDeactivationUXLogicIfReady_",value:function(){var t=this,n=e.cssClasses.FG_DEACTIVATION,i=this.activationState_,a=i.hasDeactivationUXRun,r=i.isActivated;(a||!r)&&this.activationAnimationHasEnded_&&(this.rmBoundedActivationClasses_(),this.adapter_.addClass(n),this.fgDeactivationRemovalTimer_=setTimeout(function(){t.adapter_.removeClass(n)},s.b.FG_DEACTIVATION_MS))}},{key:"rmBoundedActivationClasses_",value:function(){var t=e.cssClasses,n=t.BG_ACTIVE_FILL,i=t.FG_ACTIVATION;this.adapter_.removeClass(n),this.adapter_.removeClass(i),this.activationAnimationHasEnded_=!1,this.adapter_.computeBoundingRect()}},{key:"deactivate_",value:function(t){var e=this,n=this.activationState_;if(n.isActivated){if(n.isProgrammatic){var i=c({},n);return requestAnimationFrame(function(){return e.animateDeactivation_(null,i)}),void(this.activationState_=this.defaultActivationState_())}var a=d[t.type],r=n.activationEvent.type,o=a===r,s=o;n.wasActivatedByPointer&&(s="mouseup"===t.type);var u=c({},n);requestAnimationFrame(function(){o&&(e.activationState_.hasDeactivationUXRun=!0,e.animateDeactivation_(t,u)),s&&(e.activationState_=e.defaultActivationState_())})}}},{key:"deactivate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.deactivate_(t)}},{key:"animateDeactivation_",value:function(t,n){var i=n.wasActivatedByPointer,a=n.wasElementMadeActive,r=e.cssClasses.BG_FOCUSED;(i||a)&&(this.adapter_.removeClass(r),this.runDeactivationUXLogicIfReady_())}},{key:"destroy",value:function(){var t=this;if(this.isSupported_()){this.removeEventListeners_();var n=e.cssClasses,i=n.ROOT,a=n.UNBOUNDED;requestAnimationFrame(function(){t.adapter_.removeClass(i),t.adapter_.removeClass(a),t.removeCssVars_()})}}},{key:"removeEventListeners_",value:function(){var t=this;this.listenerInfos_.forEach(function(e){Object.keys(e).forEach(function(n){t.adapter_.deregisterInteractionHandler(e[n],t.listeners_[n])})}),this.adapter_.deregisterResizeHandler(this.resizeHandler_)}},{key:"removeCssVars_",value:function(){var t=this,n=e.strings;Object.keys(n).forEach(function(e){0===e.indexOf("VAR_")&&t.adapter_.updateCssVariable(n[e],null)})}},{key:"layout",value:function(){var t=this;this.layoutFrame_&&cancelAnimationFrame(this.layoutFrame_),this.layoutFrame_=requestAnimationFrame(function(){t.layoutInternal_(),t.layoutFrame_=0})}},{key:"layoutInternal_",value:function(){this.frame_=this.adapter_.computeBoundingRect();var t=Math.max(this.frame_.height,this.frame_.width),n=Math.sqrt(Math.pow(this.frame_.width,2)+Math.pow(this.frame_.height,2));this.initialSize_=t*e.numbers.INITIAL_ORIGIN_SCALE,this.maxRadius_=n+e.numbers.PADDING,this.fgScale_=this.maxRadius_/this.initialSize_,this.xfDuration_=1e3*Math.sqrt(this.maxRadius_/1024),this.updateLayoutCssVars_()}},{key:"updateLayoutCssVars_",value:function(){var t=e.strings,n=t.VAR_FG_SIZE,i=t.VAR_LEFT,a=t.VAR_TOP,r=t.VAR_FG_SCALE;this.adapter_.updateCssVariable(n,this.initialSize_+"px"),this.adapter_.updateCssVariable(r,this.fgScale_),this.adapter_.isUnbounded()&&(this.unboundedCoords_={left:Math.round(this.frame_.width/2-this.initialSize_/2),top:Math.round(this.frame_.height/2-this.initialSize_/2)},this.adapter_.updateCssVariable(i,this.unboundedCoords_.left+"px"),this.adapter_.updateCssVariable(a,this.unboundedCoords_.top+"px"))}}]),e}(o.a);e.a=f},7:function(t,e,n){"use strict";n.d(e,"a",function(){return i}),n.d(e,"c",function(){return a}),n.d(e,"b",function(){return r});/** | ||
var s=void 0,c=void 0},23:function(t,e,n){"use strict";n.d(e,"a",function(){return r}),n.d(e,"b",function(){return i});/** | ||
* @license | ||
@@ -57,2 +73,18 @@ * Copyright 2016 Google Inc. All Rights Reserved. | ||
*/ | ||
var i={ROOT:"mdc-ripple-upgraded",UNBOUNDED:"mdc-ripple-upgraded--unbounded",BG_FOCUSED:"mdc-ripple-upgraded--background-focused",BG_ACTIVE_FILL:"mdc-ripple-upgraded--background-active-fill",FG_ACTIVATION:"mdc-ripple-upgraded--foreground-activation",FG_DEACTIVATION:"mdc-ripple-upgraded--foreground-deactivation"},a={VAR_FG_SIZE:"--mdc-ripple-fg-size",VAR_LEFT:"--mdc-ripple-left",VAR_TOP:"--mdc-ripple-top",VAR_FG_SCALE:"--mdc-ripple-fg-scale",VAR_FG_TRANSLATE_START:"--mdc-ripple-fg-translate-start",VAR_FG_TRANSLATE_END:"--mdc-ripple-fg-translate-end"},r={PADDING:10,INITIAL_ORIGIN_SCALE:.6,DEACTIVATION_TIMEOUT_MS:300,FG_DEACTIVATION_MS:83}},95:function(t,e,n){t.exports=n(96)},96:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(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 r(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}),n.d(e,"MDCTextField",function(){return p});var o=n(1),s=n(5),u=n(22),c=(n(23),n(97));n.d(e,"MDCTextFieldFoundation",function(){return c.a});var l=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},d=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),f=function t(e,n,i){null===e&&(e=Function.prototype);var a=Object.getOwnPropertyDescriptor(e,n);if(void 0===a){var r=Object.getPrototypeOf(e);return null===r?void 0:t(r,n,i)}if("value"in a)return a.value;var o=a.get;if(void 0!==o)return o.call(i)},p=function(t){function e(){var t;i(this,e);for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];var s=a(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(r)));return s.input_,s.label_,s.helptextElement,s.ripple,s.bottomLine_,s.icon_,s}return r(e,t),d(e,[{key:"initialize",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(t){return new s.MDCRipple(t)};this.input_=this.root_.querySelector(u.b.INPUT_SELECTOR),this.label_=this.root_.querySelector(u.b.LABEL_SELECTOR),this.helptextElement=null,this.ripple=null,this.input_.hasAttribute("aria-controls")&&(this.helptextElement=document.getElementById(this.input_.getAttribute("aria-controls"))),this.root_.classList.contains(u.a.BOX)&&(this.ripple=t(this.root_)),this.root_.classList.contains(u.a.TEXTAREA)||(this.bottomLine_=this.root_.querySelector(u.b.BOTTOM_LINE_SELECTOR)),this.root_.classList.contains(u.a.TEXT_FIELD_ICON)||(this.icon_=this.root_.querySelector(u.b.ICON_SELECTOR))}},{key:"destroy",value:function(){this.ripple&&this.ripple.destroy(),f(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"destroy",this).call(this)}},{key:"initialSyncWithDom",value:function(){this.disabled=this.input_.disabled}},{key:"getDefaultFoundation",value:function(){var t=this;return new c.a(l({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)},eventTargetHasClass:function(t,e){return t.classList.contains(e)},registerTextFieldInteractionHandler:function(e,n){return t.root_.addEventListener(e,n)},deregisterTextFieldInteractionHandler:function(e,n){return t.root_.removeEventListener(e,n)},notifyIconAction:function(){return t.emit(c.a.strings.ICON_EVENT,{})}},this.getInputAdapterMethods_(),this.getHelptextAdapterMethods_(),this.getBottomLineAdapterMethods_(),this.getIconAdapterMethods_()))}},{key:"getIconAdapterMethods_",value:function(){var t=this;return{setIconAttr:function(e,n){t.icon_&&t.icon_.setAttribute(e,n)}}}},{key:"getBottomLineAdapterMethods_",value:function(){var t=this;return{addClassToBottomLine:function(e){t.bottomLine_&&t.bottomLine_.classList.add(e)},removeClassFromBottomLine:function(e){t.bottomLine_&&t.bottomLine_.classList.remove(e)},setBottomLineAttr:function(e,n){t.bottomLine_&&t.bottomLine_.setAttribute(e,n)},registerTransitionEndHandler:function(e){t.bottomLine_&&t.bottomLine_.addEventListener("transitionend",e)},deregisterTransitionEndHandler:function(e){t.bottomLine_&&t.bottomLine_.removeEventListener("transitionend",e)}}}},{key:"getInputAdapterMethods_",value:function(){var t=this;return{registerInputInteractionHandler:function(e,n){return t.input_.addEventListener(e,n)},deregisterInputInteractionHandler:function(e,n){return t.input_.removeEventListener(e,n)},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:"valid",set:function(t){this.foundation_.setValid(t)}}],[{key:"attachTo",value:function(t){return new e(t)}}]),e}(o.a)},97:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(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 r(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 o=n(0),s=(n(23),n(22)),u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),l=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var n=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,u(e.defaultAdapter,t)));return n.isFocused_=!1,n.receivedUserInput_=!1,n.useCustomValidityChecking_=!1,n.inputFocusHandler_=function(){return n.activateFocus()},n.inputBlurHandler_=function(){return n.deactivateFocus()},n.inputInputHandler_=function(){return n.autoCompleteFocus()},n.setPointerXOffset_=function(t){return n.animateBottomLine(t)},n.textFieldInteractionHandler_=function(t){return n.handleTextFieldInteraction(t)},n.transitionEndHandler_=function(t){return n.handleBottomLineAnimationEnd(t)},n}return r(e,t),c(e,null,[{key:"cssClasses",get:function(){return s.a}},{key:"strings",get:function(){return s.b}},{key:"defaultAdapter",get:function(){return{addClass:function(){},removeClass:function(){},addClassToLabel:function(){},removeClassFromLabel:function(){},setIconAttr:function(){},eventTargetHasClass:function(){},registerTextFieldInteractionHandler:function(){},deregisterTextFieldInteractionHandler:function(){},notifyIconAction:function(){},addClassToBottomLine:function(){},removeClassFromBottomLine:function(){},addClassToHelptext:function(){},removeClassFromHelptext:function(){},helptextHasClass:function(){return!1},registerInputInteractionHandler:function(){},deregisterInputInteractionHandler:function(){},registerTransitionEndHandler:function(){},deregisterTransitionEndHandler:function(){},setBottomLineAttr:function(){},setHelptextAttr:function(){},removeHelptextAttr:function(){},getNativeInput:function(){}}}}]),c(e,[{key:"init",value:function(){var t=this;this.adapter_.addClass(e.cssClasses.UPGRADED),this.getNativeInput_().value&&this.adapter_.addClassToLabel(e.cssClasses.LABEL_FLOAT_ABOVE),this.adapter_.registerInputInteractionHandler("focus",this.inputFocusHandler_),this.adapter_.registerInputInteractionHandler("blur",this.inputBlurHandler_),this.adapter_.registerInputInteractionHandler("input",this.inputInputHandler_),["mousedown","touchstart"].forEach(function(e){t.adapter_.registerInputInteractionHandler(e,t.setPointerXOffset_)}),["click","keydown"].forEach(function(e){t.adapter_.registerTextFieldInteractionHandler(e,t.textFieldInteractionHandler_)}),this.adapter_.registerTransitionEndHandler(this.transitionEndHandler_)}},{key:"destroy",value:function(){var t=this;this.adapter_.removeClass(e.cssClasses.UPGRADED),this.adapter_.deregisterInputInteractionHandler("focus",this.inputFocusHandler_),this.adapter_.deregisterInputInteractionHandler("blur",this.inputBlurHandler_),this.adapter_.deregisterInputInteractionHandler("input",this.inputInputHandler_),["mousedown","touchstart"].forEach(function(e){t.adapter_.deregisterInputInteractionHandler(e,t.setPointerXOffset_)}),["click","keydown"].forEach(function(e){t.adapter_.deregisterTextFieldInteractionHandler(e,t.textFieldInteractionHandler_)}),this.adapter_.deregisterTransitionEndHandler(this.transitionEndHandler_)}},{key:"handleTextFieldInteraction",value:function(t){if(!this.adapter_.getNativeInput().disabled){this.receivedUserInput_=!0;var n=t.target,i=t.type,a=e.cssClasses.TEXT_FIELD_ICON,r=this.adapter_.eventTargetHasClass(n,a),o="click"===i||"Enter"===t.key||13===t.keyCode;r&&o&&this.adapter_.notifyIconAction()}}},{key:"activateFocus",value:function(){var t=e.cssClasses,n=t.BOTTOM_LINE_ACTIVE,i=t.FOCUSED,a=t.LABEL_FLOAT_ABOVE,r=t.LABEL_SHAKE;this.adapter_.addClass(i),this.adapter_.addClassToBottomLine(n),this.adapter_.addClassToLabel(a),this.adapter_.removeClassFromLabel(r),this.showHelptext_(),this.isFocused_=!0}},{key:"animateBottomLine",value:function(t){var e=t.target.getBoundingClientRect(),n={x:t.clientX,y:t.clientY},i=n.x-e.left,a="transform-origin: "+i+"px center";this.adapter_.setBottomLineAttr("style",a)}},{key:"autoCompleteFocus",value:function(){this.receivedUserInput_||this.activateFocus()}},{key:"showHelptext_",value:function(){var t=e.strings.ARIA_HIDDEN;this.adapter_.removeHelptextAttr(t)}},{key:"handleBottomLineAnimationEnd",value:function(t){var n=e.cssClasses.BOTTOM_LINE_ACTIVE;"opacity"!==t.propertyName||this.isFocused_||this.adapter_.removeClassFromBottomLine(n)}},{key:"deactivateFocus",value:function(){var t=e.cssClasses,n=t.FOCUSED,i=t.LABEL_FLOAT_ABOVE,a=t.LABEL_SHAKE,r=this.getNativeInput_();this.isFocused_=!1,this.adapter_.removeClass(n),this.adapter_.removeClassFromLabel(a),r.value||this.isBadInput_()||(this.adapter_.removeClassFromLabel(i),this.receivedUserInput_=!1),this.useCustomValidityChecking_||this.changeValidity_(r.checkValidity())}},{key:"changeValidity_",value:function(t){var n=e.cssClasses,i=n.INVALID,a=n.LABEL_SHAKE;t?this.adapter_.removeClass(i):(this.adapter_.addClassToLabel(a),this.adapter_.addClass(i)),this.updateHelptext_(t)}},{key:"updateHelptext_",value:function(t){var n=e.cssClasses,i=n.HELPTEXT_PERSISTENT,a=n.HELPTEXT_VALIDATION_MSG,r=e.strings.ROLE,o=this.adapter_.helptextHasClass(i),s=this.adapter_.helptextHasClass(a),u=s&&!t;u?this.adapter_.setHelptextAttr(r,"alert"):this.adapter_.removeHelptextAttr(r),o||u||this.hideHelptext_()}},{key:"hideHelptext_",value:function(){var t=e.strings.ARIA_HIDDEN;this.adapter_.setHelptextAttr(t,"true")}},{key:"isBadInput_",value:function(){var t=this.getNativeInput_();return t.validity?t.validity.badInput:t.badInput}},{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_.setIconAttr("tabindex","-1")):(this.adapter_.removeClass(n),this.adapter_.setIconAttr("tabindex","0"))}},{key:"getNativeInput_",value:function(){return this.adapter_.getNativeInput()||{checkValidity:function(){return!0},value:"",disabled:!1,badInput:!1}}},{key:"setValid",value:function(t){this.useCustomValidityChecking_=!0,this.changeValidity_(t)}}]),e}(o.a);e.a=l}})}); | ||
var i={ARIA_CONTROLS:"aria-controls",INPUT_SELECTOR:".mdc-text-field__input",LABEL_SELECTOR:".mdc-text-field__label",ICON_SELECTOR:".mdc-text-field__icon",ICON_EVENT:"MDCTextField:icon",BOTTOM_LINE_SELECTOR:".mdc-text-field__bottom-line"},r={ROOT:"mdc-text-field",UPGRADED:"mdc-text-field--upgraded",DISABLED:"mdc-text-field--disabled",FOCUSED:"mdc-text-field--focused",INVALID:"mdc-text-field--invalid",LABEL_FLOAT_ABOVE:"mdc-text-field__label--float-above",LABEL_SHAKE:"mdc-text-field__label--shake",BOX:"mdc-text-field--box",TEXT_FIELD_ICON:"mdc-text-field__icon",TEXTAREA:"mdc-text-field--textarea"}},24:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=(n(18),n(26),function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}());!function(){function t(){i(this,t)}r(t,[{key:"addClass",value:function(t){}},{key:"removeClass",value:function(t){}},{key:"addClassToLabel",value:function(t){}},{key:"removeClassFromLabel",value:function(t){}},{key:"setIconAttr",value:function(t,e){}},{key:"eventTargetHasClass",value:function(t,e){}},{key:"registerTextFieldInteractionHandler",value:function(t,e){}},{key:"deregisterTextFieldInteractionHandler",value:function(t,e){}},{key:"notifyIconAction",value:function(){}},{key:"addClassToHelperText",value:function(t){}},{key:"removeClassFromHelperText",value:function(t){}},{key:"helperTextHasClass",value:function(t){}},{key:"registerInputInteractionHandler",value:function(t,e){}},{key:"deregisterInputInteractionHandler",value:function(t,e){}},{key:"registerBottomLineEventHandler",value:function(t,e){}},{key:"deregisterBottomLineEventHandler",value:function(t,e){}},{key:"setHelperTextAttr",value:function(t,e){}},{key:"removeHelperTextAttr",value:function(t){}},{key:"setHelperTextContent",value:function(t){}},{key:"getNativeInput",value:function(){}},{key:"getBottomLineFoundation",value:function(){}},{key:"getHelperTextFoundation",value:function(){}}])}()},25:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();!function(){function t(){i(this,t)}r(t,[{key:"addClass",value:function(t){}},{key:"removeClass",value:function(t){}},{key:"setAttr",value:function(t,e){}},{key:"registerEventHandler",value:function(t,e){}},{key:"deregisterEventHandler",value:function(t,e){}},{key:"notifyAnimationEnd",value:function(){}}])}()},26:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(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 a(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 o=n(0),u=(n(27),n(102)),s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),l=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i(this,e),r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,s(e.defaultAdapter,t)))}return a(e,t),c(e,null,[{key:"cssClasses",get:function(){return u.a}},{key:"strings",get:function(){return u.b}},{key:"defaultAdapter",get:function(){return{addClass:function(){},removeClass:function(){},hasClass:function(){},setAttr:function(){},removeAttr:function(){},setContent:function(){}}}}]),c(e,[{key:"setContent",value:function(t){this.adapter_.setContent(t)}},{key:"showToScreenReader",value:function(){this.adapter_.removeAttr(u.b.ARIA_HIDDEN)}},{key:"setValidity",value:function(t){var e=this.adapter_.hasClass(u.a.HELPER_TEXT_PERSISTENT),n=this.adapter_.hasClass(u.a.HELPER_TEXT_VALIDATION_MSG),i=n&&!t;i?this.adapter_.setAttr(u.b.ROLE,"alert"):this.adapter_.removeAttr(u.b.ROLE),e||i||this.hide_()}},{key:"hide_",value:function(){this.adapter_.setAttr(u.b.ARIA_HIDDEN,"true")}}]),e}(o.a);e.a=l},27:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();!function(){function t(){i(this,t)}r(t,[{key:"addClass",value:function(t){}},{key:"removeClass",value:function(t){}},{key:"hasClass",value:function(t){}},{key:"setAttr",value:function(t,e){}},{key:"removeAttr",value:function(t){}},{key:"setContent",value:function(t){}}])}()},3:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}();!function(){function t(){i(this,t)}r(t,[{key:"browserSupportsCssVars",value:function(){}},{key:"isUnbounded",value:function(){}},{key:"isSurfaceActive",value:function(){}},{key:"isSurfaceDisabled",value:function(){}},{key:"addClass",value:function(t){}},{key:"removeClass",value:function(t){}},{key:"registerInteractionHandler",value:function(t,e){}},{key:"deregisterInteractionHandler",value:function(t,e){}},{key:"registerResizeHandler",value:function(t){}},{key:"deregisterResizeHandler",value:function(t){}},{key:"updateCssVariable",value:function(t,e){}},{key:"computeBoundingRect",value:function(){}},{key:"getWindowPageOffset",value:function(){}}])}()},5:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(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 a(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}),n.d(e,"MDCRipple",function(){return l});var o=n(1),u=(n(3),n(6)),s=n(2);n.d(e,"MDCRippleFoundation",function(){return u.a}),n.d(e,"util",function(){return s});var c=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),l=function(t){function e(){var t;i(this,e);for(var n=arguments.length,a=Array(n),o=0;o<n;o++)a[o]=arguments[o];var u=r(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(a)));return u.disabled=!1,u.unbounded_,u}return a(e,t),c(e,[{key:"activate",value:function(){this.foundation_.activate()}},{key:"deactivate",value:function(){this.foundation_.deactivate()}},{key:"layout",value:function(){this.foundation_.layout()}},{key:"getDefaultFoundation",value:function(){return new u.a(e.createAdapter(this))}},{key:"initialSyncWithDOM",value:function(){this.unbounded="mdcRippleIsUnbounded"in this.root_.dataset}},{key:"unbounded",get:function(){return this.unbounded_},set:function(t){var e=u.a.cssClasses.UNBOUNDED;this.unbounded_=Boolean(t),this.unbounded_?this.root_.classList.add(e):this.root_.classList.remove(e)}}],[{key:"attachTo",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.isUnbounded,r=void 0===i?void 0:i,a=new e(t);return void 0!==r&&(a.unbounded=r),a}},{key:"createAdapter",value:function(t){var e=s.getMatchesProperty(HTMLElement.prototype);return{browserSupportsCssVars:function(){return s.supportsCssVariables(window)},isUnbounded:function(){return t.unbounded},isSurfaceActive:function(){return t.root_[e](":active")},isSurfaceDisabled:function(){return t.disabled},addClass:function(e){return t.root_.classList.add(e)},removeClass:function(e){return t.root_.classList.remove(e)},registerInteractionHandler:function(e,n){return t.root_.addEventListener(e,n,s.applyPassive())},deregisterInteractionHandler:function(e,n){return t.root_.removeEventListener(e,n,s.applyPassive())},registerResizeHandler:function(t){return window.addEventListener("resize",t)},deregisterResizeHandler:function(t){return window.removeEventListener("resize",t)},updateCssVariable:function(e,n){return t.root_.style.setProperty(e,n)},computeBoundingRect:function(){return t.root_.getBoundingClientRect()},getWindowPageOffset:function(){return{x:window.pageXOffset,y:window.pageYOffset}}}}}]),e}(o.a),f=function t(){i(this,t)};f.prototype.root_,f.prototype.unbounded,f.prototype.disabled},6:function(t,e,n){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(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 a(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 o=n(0),u=(n(3),n(7)),s=n(2),c=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},l=function(){function t(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}}(),f={mouseup:"mousedown",pointerup:"pointerdown",touchend:"touchstart",keyup:"keydown",blur:"focus"},d=function(t){function e(t){i(this,e);var n=r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,c(e.defaultAdapter,t)));return n.layoutFrame_=0,n.frame_={width:0,height:0},n.activationState_=n.defaultActivationState_(),n.xfDuration_=0,n.initialSize_=0,n.maxRadius_=0,n.listenerInfos_=[{activate:"touchstart",deactivate:"touchend"},{activate:"pointerdown",deactivate:"pointerup"},{activate:"mousedown",deactivate:"mouseup"},{activate:"keydown",deactivate:"keyup"},{focus:"focus",blur:"blur"}],n.listeners_={activate:function(t){return n.activate_(t)},deactivate:function(t){return n.deactivate_(t)},focus:function(){return requestAnimationFrame(function(){return n.adapter_.addClass(e.cssClasses.BG_FOCUSED)})},blur:function(){return requestAnimationFrame(function(){return n.adapter_.removeClass(e.cssClasses.BG_FOCUSED)})}},n.resizeHandler_=function(){return n.layout()},n.unboundedCoords_={left:0,top:0},n.fgScale_=0,n.activationTimer_=0,n.fgDeactivationRemovalTimer_=0,n.activationAnimationHasEnded_=!1,n.activationTimerCallback_=function(){n.activationAnimationHasEnded_=!0,n.runDeactivationUXLogicIfReady_()},n}return a(e,t),l(e,null,[{key:"cssClasses",get:function(){return u.a}},{key:"strings",get:function(){return u.c}},{key:"numbers",get:function(){return u.b}},{key:"defaultAdapter",get:function(){return{browserSupportsCssVars:function(){},isUnbounded:function(){},isSurfaceActive:function(){},isSurfaceDisabled:function(){},addClass:function(){},removeClass:function(){},registerInteractionHandler:function(){},deregisterInteractionHandler:function(){},registerResizeHandler:function(){},deregisterResizeHandler:function(){},updateCssVariable:function(){},computeBoundingRect:function(){},getWindowPageOffset:function(){}}}}]),l(e,[{key:"isSupported_",value:function(){return this.adapter_.browserSupportsCssVars()}},{key:"defaultActivationState_",value:function(){return{isActivated:!1,hasDeactivationUXRun:!1,wasActivatedByPointer:!1,wasElementMadeActive:!1,activationStartTime:0,activationEvent:null,isProgrammatic:!1}}},{key:"init",value:function(){var t=this;if(this.isSupported_()){this.addEventListeners_();var n=e.cssClasses,i=n.ROOT,r=n.UNBOUNDED;requestAnimationFrame(function(){t.adapter_.addClass(i),t.adapter_.isUnbounded()&&t.adapter_.addClass(r),t.layoutInternal_()})}}},{key:"addEventListeners_",value:function(){var t=this;this.listenerInfos_.forEach(function(e){Object.keys(e).forEach(function(n){t.adapter_.registerInteractionHandler(e[n],t.listeners_[n])})}),this.adapter_.registerResizeHandler(this.resizeHandler_)}},{key:"activate_",value:function(t){var e=this;if(!this.adapter_.isSurfaceDisabled()){var n=this.activationState_;n.isActivated||(n.isActivated=!0,n.isProgrammatic=null===t,n.activationEvent=t,n.wasActivatedByPointer=!n.isProgrammatic&&("mousedown"===t.type||"touchstart"===t.type||"pointerdown"===t.type),n.activationStartTime=Date.now(),requestAnimationFrame(function(){n.wasElementMadeActive=!t||"keydown"!==t.type||e.adapter_.isSurfaceActive(),n.wasElementMadeActive?e.animateActivation_():e.activationState_=e.defaultActivationState_()}))}}},{key:"activate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.activate_(t)}},{key:"animateActivation_",value:function(){var t=this,n=e.strings,i=n.VAR_FG_TRANSLATE_START,r=n.VAR_FG_TRANSLATE_END,a=e.cssClasses,o=a.BG_ACTIVE_FILL,u=a.FG_DEACTIVATION,s=a.FG_ACTIVATION,c=e.numbers.DEACTIVATION_TIMEOUT_MS,l="",f="";if(!this.adapter_.isUnbounded()){var d=this.getFgTranslationCoordinates_(),p=d.startPoint,v=d.endPoint;l=p.x+"px, "+p.y+"px",f=v.x+"px, "+v.y+"px"}this.adapter_.updateCssVariable(i,l),this.adapter_.updateCssVariable(r,f),clearTimeout(this.activationTimer_),clearTimeout(this.fgDeactivationRemovalTimer_),this.rmBoundedActivationClasses_(),this.adapter_.removeClass(u),this.adapter_.computeBoundingRect(),this.adapter_.addClass(o),this.adapter_.addClass(s),this.activationTimer_=setTimeout(function(){return t.activationTimerCallback_()},c)}},{key:"getFgTranslationCoordinates_",value:function(){var t=this.activationState_,e=t.activationEvent,n=t.wasActivatedByPointer,i=void 0;return i=n?Object(s.getNormalizedEventCoords)(e,this.adapter_.getWindowPageOffset(),this.adapter_.computeBoundingRect()):{x:this.frame_.width/2,y:this.frame_.height/2},i={x:i.x-this.initialSize_/2,y:i.y-this.initialSize_/2},{startPoint:i,endPoint:{x:this.frame_.width/2-this.initialSize_/2,y:this.frame_.height/2-this.initialSize_/2}}}},{key:"runDeactivationUXLogicIfReady_",value:function(){var t=this,n=e.cssClasses.FG_DEACTIVATION,i=this.activationState_,r=i.hasDeactivationUXRun,a=i.isActivated;(r||!a)&&this.activationAnimationHasEnded_&&(this.rmBoundedActivationClasses_(),this.adapter_.addClass(n),this.fgDeactivationRemovalTimer_=setTimeout(function(){t.adapter_.removeClass(n)},u.b.FG_DEACTIVATION_MS))}},{key:"rmBoundedActivationClasses_",value:function(){var t=e.cssClasses,n=t.BG_ACTIVE_FILL,i=t.FG_ACTIVATION;this.adapter_.removeClass(n),this.adapter_.removeClass(i),this.activationAnimationHasEnded_=!1,this.adapter_.computeBoundingRect()}},{key:"deactivate_",value:function(t){var e=this,n=this.activationState_;if(n.isActivated){if(n.isProgrammatic){var i=c({},n);return requestAnimationFrame(function(){return e.animateDeactivation_(null,i)}),void(this.activationState_=this.defaultActivationState_())}var r=f[t.type],a=n.activationEvent.type,o=r===a,u=o;n.wasActivatedByPointer&&(u="mouseup"===t.type);var s=c({},n);requestAnimationFrame(function(){o&&(e.activationState_.hasDeactivationUXRun=!0,e.animateDeactivation_(t,s)),u&&(e.activationState_=e.defaultActivationState_())})}}},{key:"deactivate",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.deactivate_(t)}},{key:"animateDeactivation_",value:function(t,n){var i=n.wasActivatedByPointer,r=n.wasElementMadeActive,a=e.cssClasses.BG_FOCUSED;(i||r)&&(this.adapter_.removeClass(a),this.runDeactivationUXLogicIfReady_())}},{key:"destroy",value:function(){var t=this;if(this.isSupported_()){this.removeEventListeners_();var n=e.cssClasses,i=n.ROOT,r=n.UNBOUNDED;requestAnimationFrame(function(){t.adapter_.removeClass(i),t.adapter_.removeClass(r),t.removeCssVars_()})}}},{key:"removeEventListeners_",value:function(){var t=this;this.listenerInfos_.forEach(function(e){Object.keys(e).forEach(function(n){t.adapter_.deregisterInteractionHandler(e[n],t.listeners_[n])})}),this.adapter_.deregisterResizeHandler(this.resizeHandler_)}},{key:"removeCssVars_",value:function(){var t=this,n=e.strings;Object.keys(n).forEach(function(e){0===e.indexOf("VAR_")&&t.adapter_.updateCssVariable(n[e],null)})}},{key:"layout",value:function(){var t=this;this.layoutFrame_&&cancelAnimationFrame(this.layoutFrame_),this.layoutFrame_=requestAnimationFrame(function(){t.layoutInternal_(),t.layoutFrame_=0})}},{key:"layoutInternal_",value:function(){this.frame_=this.adapter_.computeBoundingRect();var t=Math.max(this.frame_.height,this.frame_.width),n=Math.sqrt(Math.pow(this.frame_.width,2)+Math.pow(this.frame_.height,2));this.initialSize_=t*e.numbers.INITIAL_ORIGIN_SCALE,this.maxRadius_=n+e.numbers.PADDING,this.fgScale_=this.maxRadius_/this.initialSize_,this.xfDuration_=1e3*Math.sqrt(this.maxRadius_/1024),this.updateLayoutCssVars_()}},{key:"updateLayoutCssVars_",value:function(){var t=e.strings,n=t.VAR_FG_SIZE,i=t.VAR_LEFT,r=t.VAR_TOP,a=t.VAR_FG_SCALE;this.adapter_.updateCssVariable(n,this.initialSize_+"px"),this.adapter_.updateCssVariable(a,this.fgScale_),this.adapter_.isUnbounded()&&(this.unboundedCoords_={left:Math.round(this.frame_.width/2-this.initialSize_/2),top:Math.round(this.frame_.height/2-this.initialSize_/2)},this.adapter_.updateCssVariable(i,this.unboundedCoords_.left+"px"),this.adapter_.updateCssVariable(r,this.unboundedCoords_.top+"px"))}}]),e}(o.a);e.a=d},7:function(t,e,n){"use strict";n.d(e,"a",function(){return i}),n.d(e,"c",function(){return r}),n.d(e,"b",function(){return a});/** | ||
* @license | ||
* 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. | ||
*/ | ||
var i={ROOT:"mdc-ripple-upgraded",UNBOUNDED:"mdc-ripple-upgraded--unbounded",BG_FOCUSED:"mdc-ripple-upgraded--background-focused",BG_ACTIVE_FILL:"mdc-ripple-upgraded--background-active-fill",FG_ACTIVATION:"mdc-ripple-upgraded--foreground-activation",FG_DEACTIVATION:"mdc-ripple-upgraded--foreground-deactivation"},r={VAR_FG_SIZE:"--mdc-ripple-fg-size",VAR_LEFT:"--mdc-ripple-left",VAR_TOP:"--mdc-ripple-top",VAR_FG_SCALE:"--mdc-ripple-fg-scale",VAR_FG_TRANSLATE_START:"--mdc-ripple-fg-translate-start",VAR_FG_TRANSLATE_END:"--mdc-ripple-fg-translate-end"},a={PADDING:10,INITIAL_ORIGIN_SCALE:.6,DEACTIVATION_TIMEOUT_MS:300,FG_DEACTIVATION_MS:83}},99:function(t,e,n){t.exports=n(100)}})}); |
@@ -20,2 +20,3 @@ /** | ||
import {MDCTextFieldAdapter, NativeInputType} from './adapter'; | ||
import MDCTextFieldBottomLineFoundation from './bottom-line/foundation'; | ||
import {cssClasses, strings} from './constants'; | ||
@@ -55,15 +56,9 @@ | ||
notifyIconAction: () => {}, | ||
addClassToBottomLine: () => {}, | ||
removeClassFromBottomLine: () => {}, | ||
addClassToHelptext: () => {}, | ||
removeClassFromHelptext: () => {}, | ||
helptextHasClass: () => false, | ||
registerInputInteractionHandler: () => {}, | ||
deregisterInputInteractionHandler: () => {}, | ||
registerTransitionEndHandler: () => {}, | ||
deregisterTransitionEndHandler: () => {}, | ||
setBottomLineAttr: () => {}, | ||
setHelptextAttr: () => {}, | ||
removeHelptextAttr: () => {}, | ||
registerBottomLineEventHandler: () => {}, | ||
deregisterBottomLineEventHandler: () => {}, | ||
getNativeInput: () => {}, | ||
getBottomLineFoundation: () => {}, | ||
getHelperTextFoundation: () => {}, | ||
}); | ||
@@ -91,7 +86,7 @@ } | ||
/** @private {function(!Event): undefined} */ | ||
this.setPointerXOffset_ = (evt) => this.animateBottomLine(evt); | ||
this.setPointerXOffset_ = (evt) => this.setBottomLineTransformOrigin(evt); | ||
/** @private {function(!Event): undefined} */ | ||
this.textFieldInteractionHandler_ = (evt) => this.handleTextFieldInteraction(evt); | ||
/** @private {function(!Event): undefined} */ | ||
this.transitionEndHandler_ = (evt) => this.handleBottomLineAnimationEnd(evt); | ||
this.bottomLineAnimationEndHandler_ = () => this.handleBottomLineAnimationEnd(); | ||
} | ||
@@ -115,3 +110,4 @@ | ||
}); | ||
this.adapter_.registerTransitionEndHandler(this.transitionEndHandler_); | ||
this.adapter_.registerBottomLineEventHandler( | ||
MDCTextFieldBottomLineFoundation.strings.ANIMATION_END_EVENT, this.bottomLineAnimationEndHandler_); | ||
} | ||
@@ -130,3 +126,4 @@ | ||
}); | ||
this.adapter_.deregisterTransitionEndHandler(this.transitionEndHandler_); | ||
this.adapter_.deregisterBottomLineEventHandler( | ||
MDCTextFieldBottomLineFoundation.strings.ANIMATION_END_EVENT, this.bottomLineAnimationEndHandler_); | ||
} | ||
@@ -159,8 +156,14 @@ | ||
activateFocus() { | ||
const {BOTTOM_LINE_ACTIVE, FOCUSED, LABEL_FLOAT_ABOVE, LABEL_SHAKE} = MDCTextFieldFoundation.cssClasses; | ||
const {FOCUSED, LABEL_FLOAT_ABOVE, LABEL_SHAKE} = MDCTextFieldFoundation.cssClasses; | ||
this.adapter_.addClass(FOCUSED); | ||
this.adapter_.addClassToBottomLine(BOTTOM_LINE_ACTIVE); | ||
const bottomLine = this.adapter_.getBottomLineFoundation(); | ||
if (bottomLine) { | ||
bottomLine.activate(); | ||
} | ||
this.adapter_.addClassToLabel(LABEL_FLOAT_ABOVE); | ||
this.adapter_.removeClassFromLabel(LABEL_SHAKE); | ||
this.showHelptext_(); | ||
const helperText = this.adapter_.getHelperTextFoundation(); | ||
if (helperText) { | ||
helperText.showToScreenReader(); | ||
} | ||
this.isFocused_ = true; | ||
@@ -170,13 +173,11 @@ } | ||
/** | ||
* Animates the bottom line out from the user's click location. | ||
* Sets the bottom line's transform origin, so that the bottom line activate | ||
* animation will animate out from the user's click location. | ||
* @param {!Event} evt | ||
*/ | ||
animateBottomLine(evt) { | ||
const targetClientRect = evt.target.getBoundingClientRect(); | ||
const evtCoords = {x: evt.clientX, y: evt.clientY}; | ||
const normalizedX = evtCoords.x - targetClientRect.left; | ||
const attributeString = | ||
`transform-origin: ${normalizedX}px center`; | ||
this.adapter_.setBottomLineAttr('style', attributeString); | ||
setBottomLineTransformOrigin(evt) { | ||
const bottomLine = this.adapter_.getBottomLineFoundation(); | ||
if (bottomLine) { | ||
bottomLine.setTransformOrigin(evt); | ||
} | ||
} | ||
@@ -195,23 +196,12 @@ | ||
/** | ||
* Makes the help text visible to screen readers. | ||
* @private | ||
* Handles when bottom line animation ends, performing actions that must wait | ||
* for animations to finish. | ||
*/ | ||
showHelptext_() { | ||
const {ARIA_HIDDEN} = MDCTextFieldFoundation.strings; | ||
this.adapter_.removeHelptextAttr(ARIA_HIDDEN); | ||
} | ||
/** | ||
* Executes when the bottom line's transition animation ends, performing | ||
* actions that must wait for animations to finish. | ||
* @param {!Event} evt | ||
*/ | ||
handleBottomLineAnimationEnd(evt) { | ||
const {BOTTOM_LINE_ACTIVE} = MDCTextFieldFoundation.cssClasses; | ||
handleBottomLineAnimationEnd() { | ||
const bottomLine = this.adapter_.getBottomLineFoundation(); | ||
// We need to wait for the bottom line to be entirely transparent | ||
// before removing the class. If we do not, we see the line start to | ||
// scale down before disappearing | ||
if (evt.propertyName === 'opacity' && !this.isFocused_) { | ||
this.adapter_.removeClassFromBottomLine(BOTTOM_LINE_ACTIVE); | ||
if (!this.isFocused_ && bottomLine) { | ||
bottomLine.deactivate(); | ||
} | ||
@@ -254,39 +244,9 @@ } | ||
} | ||
this.updateHelptext_(isValid); | ||
} | ||
/** | ||
* Updates the state of the Text Field's help text based on validity and | ||
* the Text Field's options. | ||
* @param {boolean} isValid | ||
*/ | ||
updateHelptext_(isValid) { | ||
const {HELPTEXT_PERSISTENT, HELPTEXT_VALIDATION_MSG} = MDCTextFieldFoundation.cssClasses; | ||
const {ROLE} = MDCTextFieldFoundation.strings; | ||
const helptextIsPersistent = this.adapter_.helptextHasClass(HELPTEXT_PERSISTENT); | ||
const helptextIsValidationMsg = this.adapter_.helptextHasClass(HELPTEXT_VALIDATION_MSG); | ||
const validationMsgNeedsDisplay = helptextIsValidationMsg && !isValid; | ||
if (validationMsgNeedsDisplay) { | ||
this.adapter_.setHelptextAttr(ROLE, 'alert'); | ||
} else { | ||
this.adapter_.removeHelptextAttr(ROLE); | ||
const helperText = this.adapter_.getHelperTextFoundation(); | ||
if (helperText) { | ||
helperText.setValidity(isValid); | ||
} | ||
if (helptextIsPersistent || validationMsgNeedsDisplay) { | ||
return; | ||
} | ||
this.hideHelptext_(); | ||
} | ||
/** | ||
* Hides the help text from screen readers. | ||
* @private | ||
*/ | ||
hideHelptext_() { | ||
const {ARIA_HIDDEN} = MDCTextFieldFoundation.strings; | ||
this.adapter_.setHelptextAttr(ARIA_HIDDEN, 'true'); | ||
} | ||
/** | ||
* @return {boolean} True if the Text Field input fails validity checks. | ||
@@ -311,6 +271,7 @@ * @private | ||
setDisabled(disabled) { | ||
const {DISABLED} = MDCTextFieldFoundation.cssClasses; | ||
const {DISABLED, INVALID} = MDCTextFieldFoundation.cssClasses; | ||
this.getNativeInput_().disabled = disabled; | ||
if (disabled) { | ||
this.adapter_.addClass(DISABLED); | ||
this.adapter_.removeClass(INVALID); | ||
this.adapter_.setIconAttr('tabindex', '-1'); | ||
@@ -324,2 +285,12 @@ } else { | ||
/** | ||
* @param {string} content Sets the content of the helper text. | ||
*/ | ||
setHelperTextContent(content) { | ||
const helperText = this.adapter_.getHelperTextFoundation(); | ||
if (helperText) { | ||
helperText.setContent(content); | ||
} | ||
} | ||
/** | ||
* @return {!Element|!NativeInputType} The native text input from the | ||
@@ -326,0 +297,0 @@ * host environment, or a dummy if none exists. |
146
index.js
@@ -24,2 +24,4 @@ /** | ||
import MDCTextFieldFoundation from './foundation'; | ||
import {MDCTextFieldBottomLine} from './bottom-line'; | ||
import {MDCTextFieldHelperText} from './helper-text'; | ||
@@ -40,8 +42,8 @@ /** | ||
this.label_; | ||
/** @type {?Element} */ | ||
this.helptextElement; | ||
/** @type {?MDCRipple} */ | ||
this.ripple; | ||
/** @private {?Element} */ | ||
/** @private {?MDCTextFieldBottomLine} */ | ||
this.bottomLine_; | ||
/** @private {?MDCTextFieldHelperText} */ | ||
this.helperText_; | ||
/** @private {?Element} */ | ||
@@ -62,11 +64,11 @@ this.icon_; | ||
* creates a new MDCRipple. | ||
* @param {(function(!Element): !MDCTextFieldBottomLine)=} bottomLineFactory A function which | ||
* creates a new MDCTextFieldBottomLine. | ||
*/ | ||
initialize(rippleFactory = (el) => new MDCRipple(el)) { | ||
initialize( | ||
rippleFactory = (el) => new MDCRipple(el), | ||
bottomLineFactory = (el) => new MDCTextFieldBottomLine(el)) { | ||
this.input_ = this.root_.querySelector(strings.INPUT_SELECTOR); | ||
this.label_ = this.root_.querySelector(strings.LABEL_SELECTOR); | ||
this.helptextElement = null; | ||
this.ripple = null; | ||
if (this.input_.hasAttribute('aria-controls')) { | ||
this.helptextElement = document.getElementById(this.input_.getAttribute('aria-controls')); | ||
} | ||
if (this.root_.classList.contains(cssClasses.BOX)) { | ||
@@ -76,4 +78,13 @@ this.ripple = rippleFactory(this.root_); | ||
if (!this.root_.classList.contains(cssClasses.TEXTAREA)) { | ||
this.bottomLine_ = this.root_.querySelector(strings.BOTTOM_LINE_SELECTOR); | ||
const bottomLineElement = this.root_.querySelector(strings.BOTTOM_LINE_SELECTOR); | ||
if (bottomLineElement) { | ||
this.bottomLine_ = bottomLineFactory(bottomLineElement); | ||
} | ||
}; | ||
if (this.input_.hasAttribute(strings.ARIA_CONTROLS)) { | ||
const helperTextElement = document.getElementById(this.input_.getAttribute(strings.ARIA_CONTROLS)); | ||
if (helperTextElement) { | ||
this.helperText_ = new MDCTextFieldHelperText(helperTextElement); | ||
} | ||
} | ||
if (!this.root_.classList.contains(cssClasses.TEXT_FIELD_ICON)) { | ||
@@ -88,2 +99,8 @@ this.icon_ = this.root_.querySelector(strings.ICON_SELECTOR); | ||
} | ||
if (this.bottomLine_) { | ||
this.bottomLine_.destroy(); | ||
} | ||
if (this.helperText_) { | ||
this.helperText_.destroy(); | ||
} | ||
super.destroy(); | ||
@@ -122,2 +139,10 @@ } | ||
/** | ||
* Sets the helper text element content. | ||
* @param {string} content | ||
*/ | ||
set helperTextContent(content) { | ||
this.foundation_.setHelperTextContent(content); | ||
} | ||
/** | ||
* @return {!MDCTextFieldFoundation} | ||
@@ -145,6 +170,26 @@ */ | ||
notifyIconAction: () => this.emit(MDCTextFieldFoundation.strings.ICON_EVENT, {}), | ||
registerBottomLineEventHandler: (evtType, handler) => { | ||
if (this.bottomLine_) { | ||
this.bottomLine_.listen(evtType, handler); | ||
} | ||
}, | ||
deregisterBottomLineEventHandler: (evtType, handler) => { | ||
if (this.bottomLine_) { | ||
this.bottomLine_.unlisten(evtType, handler); | ||
} | ||
}, | ||
getBottomLineFoundation: () => { | ||
if (this.bottomLine_) { | ||
return this.bottomLine_.foundation; | ||
} | ||
return undefined; | ||
}, | ||
getHelperTextFoundation: () => { | ||
if (this.helperText_) { | ||
return this.helperText_.foundation; | ||
} | ||
return undefined; | ||
}, | ||
}, | ||
this.getInputAdapterMethods_(), | ||
this.getHelptextAdapterMethods_(), | ||
this.getBottomLineAdapterMethods_(), | ||
this.getIconAdapterMethods_()))); | ||
@@ -170,41 +215,2 @@ } | ||
* @return {!{ | ||
* addClassToBottomLine: function(string): undefined, | ||
* removeClassFromBottomLine: function(string): undefined, | ||
* setBottomLineAttr: function(string, string): undefined, | ||
* registerTransitionEndHandler: function(function()): undefined, | ||
* deregisterTransitionEndHandler: function(function()): undefined, | ||
* }} | ||
*/ | ||
getBottomLineAdapterMethods_() { | ||
return { | ||
addClassToBottomLine: (className) => { | ||
if (this.bottomLine_) { | ||
this.bottomLine_.classList.add(className); | ||
} | ||
}, | ||
removeClassFromBottomLine: (className) => { | ||
if (this.bottomLine_) { | ||
this.bottomLine_.classList.remove(className); | ||
} | ||
}, | ||
setBottomLineAttr: (attr, value) => { | ||
if (this.bottomLine_) { | ||
this.bottomLine_.setAttribute(attr, value); | ||
} | ||
}, | ||
registerTransitionEndHandler: (handler) => { | ||
if (this.bottomLine_) { | ||
this.bottomLine_.addEventListener('transitionend', handler); | ||
} | ||
}, | ||
deregisterTransitionEndHandler: (handler) => { | ||
if (this.bottomLine_) { | ||
this.bottomLine_.removeEventListener('transitionend', handler); | ||
} | ||
}, | ||
}; | ||
} | ||
/** | ||
* @return {!{ | ||
* registerInputInteractionHandler: function(string, function()): undefined, | ||
@@ -222,44 +228,4 @@ * deregisterInputInteractionHandler: function(string, function()): undefined, | ||
} | ||
/** | ||
* @return {!{ | ||
* addClassToHelptext: function(string): undefined, | ||
* removeClassFromHelptext: function(string): undefined, | ||
* helptextHasClass: function(string): boolean, | ||
* setHelptextAttr: function(string, string): undefined, | ||
* removeHelptextAttr: function(string): undefined, | ||
* }} | ||
*/ | ||
getHelptextAdapterMethods_() { | ||
return { | ||
addClassToHelptext: (className) => { | ||
if (this.helptextElement) { | ||
this.helptextElement.classList.add(className); | ||
} | ||
}, | ||
removeClassFromHelptext: (className) => { | ||
if (this.helptextElement) { | ||
this.helptextElement.classList.remove(className); | ||
} | ||
}, | ||
helptextHasClass: (className) => { | ||
if (!this.helptextElement) { | ||
return false; | ||
} | ||
return this.helptextElement.classList.contains(className); | ||
}, | ||
setHelptextAttr: (name, value) => { | ||
if (this.helptextElement) { | ||
this.helptextElement.setAttribute(name, value); | ||
} | ||
}, | ||
removeHelptextAttr: (name) => { | ||
if (this.helptextElement) { | ||
this.helptextElement.removeAttribute(name); | ||
} | ||
}, | ||
}; | ||
} | ||
} | ||
export {MDCTextField, MDCTextFieldFoundation}; |
{ | ||
"name": "@material/textfield", | ||
"description": "The Material Components for the web text field component", | ||
"version": "0.25.0", | ||
"version": "0.26.0", | ||
"license": "Apache-2.0", | ||
@@ -20,3 +20,3 @@ "keywords": [ | ||
"@material/base": "^0.24.0", | ||
"@material/ripple": "^0.25.0", | ||
"@material/ripple": "^0.26.0", | ||
"@material/rtl": "^0.1.8", | ||
@@ -23,0 +23,0 @@ "@material/theme": "^0.25.0", |
@@ -103,50 +103,2 @@ <!--docs: | ||
### Using help text | ||
MDC Text Fields can include help text that is useful for providing supplemental | ||
information to users, as well for validation messages (covered below). | ||
```html | ||
<div class="mdc-text-field"> | ||
<input type="text" id="username" class="mdc-text-field__input" aria-controls="username-helptext"> | ||
<label for="username" class="mdc-text-field__label">Username</label> | ||
<div class="mdc-text-field__bottom-line"></div> | ||
</div> | ||
<p id="username-helptext" class="mdc-text-field-helptext" aria-hidden="true"> | ||
This will be displayed on your public profile | ||
</p> | ||
``` | ||
Help text appears on input field focus and disappears on input field blur by default when using | ||
the text-field JS component. | ||
#### Persistent help text | ||
If you'd like the help text to always be visible, add the | ||
`mdc-text-field-helptext--persistent` modifier class to the element. | ||
```html | ||
<div class="mdc-text-field"> | ||
<input type="email" id="email" class="mdc-text-field__input"> | ||
<label for="email" class="mdc-text-field__label">Email address</label> | ||
<div class="mdc-text-field__bottom-line"></div> | ||
</div> | ||
<p class="mdc-text-field-helptext mdc-text-field-helptext--persistent"> | ||
We will <em>never</em> share your email address with third parties | ||
</p> | ||
``` | ||
#### Help text and accessibility | ||
Note that in every example where the help text is dependent on the state of the input element, we | ||
assign an id to the `mdc-text-field-helptext` element and set that id to the value of the | ||
`aria-controls` attribute on the input element. We recommend doing this as well as it will help | ||
indicate to assistive devices that the display of the help text is dependent on the interaction with | ||
the input element. | ||
When using our vanilla JS component, if it sees that the input element has an `aria-controls` | ||
attribute, it will look for an element with the id specified and treat it as the text field's help | ||
text element, taking care of adding/removing `aria-hidden` and other a11y attributes. This can also | ||
be done programmatically, which is described below. | ||
### Validation | ||
@@ -166,25 +118,5 @@ | ||
By default an input's validity is checked via `checkValidity()` on blur, and the styles are updated | ||
accordingly. Set the MDCTextField.valid variable to set the input's validity explicitly. MDC TextField | ||
accordingly. Set the MDCTextField.valid field to set the input's validity explicitly. MDC TextField | ||
automatically appends an asterisk to the label text if the required attribute is set. | ||
Help text can be used to provide additional validation messages. Use | ||
`mdc-text-field-helptext--validation-msg` to provide styles for using the help text as a validation | ||
message. This can be easily combined with `mdc-text-field-helptext--persistent` to provide a robust | ||
UX for client-side form field validation. | ||
```html | ||
<div class="mdc-text-field"> | ||
<input required minlength=8 type="password" class="mdc-text-field__input" id="pw" | ||
aria-controls="pw-validation-msg"> | ||
<label for="pw" class="mdc-text-field__label">Choose password</label> | ||
<div class="mdc-text-field__bottom-line"></div> | ||
</div> | ||
<p class="mdc-text-field-helptext | ||
mdc-text-field-helptext--persistent | ||
mdc-text-field-helptext--validation-msg" | ||
id="pw-validation-msg"> | ||
Must be at least 8 characters long | ||
</p> | ||
``` | ||
### Leading and Trailing Icons | ||
@@ -272,3 +204,3 @@ Leading and trailing icons can be added to MDC Text Fields as visual indicators | ||
Note that Text field boxes support all of the same features as normal text-fields, including help | ||
Note that Text field boxes support all of the same features as normal text-fields, including helper | ||
text, validation, and dense UI. | ||
@@ -372,9 +304,2 @@ | ||
##### MDCTextField.helptextElement | ||
HTMLLabelElement. This is a normal property (non-accessor) that holds a reference to the element | ||
being used as the text field's "help text". It defaults to `null`. If the text field's input element | ||
contains an `aria-controls` attribute on instantiation of the component, it will look for an element | ||
with the corresponding id within the document and automatically assign it to this property. | ||
##### MDCTextField.disabled | ||
@@ -411,13 +336,9 @@ | ||
| removeClassFromBottomLine(className: string) => void | Removes a class from the bottom line element | | ||
| addClassToHelptext(className: string) => void | Adds a class to the help text element. Note that in our code we check for whether or not we have a help text element and if we don't, we simply return. | | ||
| removeClassFromHelptext(className: string) => void | Removes a class from the help text element. | | ||
| helptextHasClass(className: string) => boolean | Returns whether or not the help text element contains the current class | | ||
| registerInputInteractionHandler(evtType: string, handler: EventListener) => void | Registers an event listener on the native input element for a given event | | ||
| deregisterInputInteractionHandler(evtType: string, handler: EventListener) => void | Deregisters an event listener on the native input element for a given event | | ||
| registerTransitionEndHandler(handler: EventListener) => void | Registers an event listener on the bottom line element for a "transitionend" event | | ||
| deregisterTransitionEndHandler(handler: EventListener) => void | Deregisters an event listener on the bottom line element for a "transitionend" event | | ||
| setBottomLineAttr(attr: string, value: string) => void | Sets an attribute with a given value on the bottom line element | | ||
| setHelptextAttr(name: string, value: string) => void | Sets an attribute with a given value on the help text element | | ||
| removeHelptextAttr(name: string) => void | Removes an attribute from the help text element | | ||
| registerBottomLineEventHandler(evtType: string, handler: EventListener) => void | Registers an event listener on the bottom line element for a given event | | ||
| deregisterBottomLineEventHandler(evtType: string, handler: EventListener) => void | Deregisters an event listener on the bottom line element for a given event | | ||
| getNativeInput() => {value: string, disabled: boolean, badInput: boolean, checkValidity: () => boolean}? | Returns an object representing the native text input element, with a similar API shape. The object returned should include the `value`, `disabled` and `badInput` properties, as well as the `checkValidity()` function. We _never_ alter the value within our code, however we _do_ update the disabled property, so if you choose to duck-type the return value for this method in your implementation it's important to keep this in mind. Also note that this method can return null, which the foundation will handle gracefully. | | ||
| getBottomLineFoundation() => MDCTextFieldBottomLineFoundation | Returns the instance of the bottom line element's foundation | | ||
| getHelperTextFoundation() => MDCTextFieldHelperTextFoundation | Returns the instance of the helper text element's foundation | | ||
@@ -460,2 +381,6 @@ #### The full foundation API | ||
##### MDCTextField.helperTextContent | ||
Sets the content of the helper text, if it exists. | ||
### Theming | ||
@@ -462,0 +387,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
332947
26
5269
386
1
+ Added@material/ripple@0.26.0(transitive)
- Removed@material/ripple@0.25.0(transitive)
Updated@material/ripple@^0.26.0