1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167 |
- /*!
- Material Components for the web
- Copyright (c) 2017 Google Inc.
- License: Apache-2.0
- */
- (function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory();
- else if(typeof define === 'function' && define.amd)
- define([], factory);
- else if(typeof exports === 'object')
- exports["textfield"] = factory();
- else
- root["mdc"] = root["mdc"] || {}, root["mdc"]["textfield"] = factory();
- })(this, function() {
- return /******/ (function(modules) { // webpackBootstrap
- /******/ // The module cache
- /******/ var installedModules = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/
- /******/ // Check if module is in cache
- /******/ if(installedModules[moduleId]) {
- /******/ return installedModules[moduleId].exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = installedModules[moduleId] = {
- /******/ i: moduleId,
- /******/ l: false,
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Flag the module as loaded
- /******/ module.l = true;
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /******/
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = modules;
- /******/
- /******/ // expose the module cache
- /******/ __webpack_require__.c = installedModules;
- /******/
- /******/ // identity function for calling harmony imports with the correct context
- /******/ __webpack_require__.i = function(value) { return value; };
- /******/
- /******/ // define getter function for harmony exports
- /******/ __webpack_require__.d = function(exports, name, getter) {
- /******/ if(!__webpack_require__.o(exports, name)) {
- /******/ Object.defineProperty(exports, name, {
- /******/ configurable: false,
- /******/ enumerable: true,
- /******/ get: getter
- /******/ });
- /******/ }
- /******/ };
- /******/
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = function(module) {
- /******/ var getter = module && module.__esModule ?
- /******/ function getDefault() { return module['default']; } :
- /******/ function getModuleExports() { return module; };
- /******/ __webpack_require__.d(getter, 'a', getter);
- /******/ return getter;
- /******/ };
- /******/
- /******/ // Object.prototype.hasOwnProperty.call
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
- /******/
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "/assets/";
- /******/
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(__webpack_require__.s = 98);
- /******/ })
- /************************************************************************/
- /******/ ({
- /***/ 0:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- /**
- * Copyright 2016 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * @template A
- */
- var MDCFoundation = function () {
- _createClass(MDCFoundation, null, [{
- key: "cssClasses",
- /** @return enum{cssClasses} */
- get: function get() {
- // Classes extending MDCFoundation should implement this method to return an object which exports every
- // CSS class the foundation class needs as a property. e.g. {ACTIVE: 'mdc-component--active'}
- return {};
- }
- /** @return enum{strings} */
- }, {
- key: "strings",
- get: function get() {
- // Classes extending MDCFoundation should implement this method to return an object which exports all
- // semantic strings as constants. e.g. {ARIA_ROLE: 'tablist'}
- return {};
- }
- /** @return enum{numbers} */
- }, {
- key: "numbers",
- get: function get() {
- // Classes extending MDCFoundation should implement this method to return an object which exports all
- // of its semantic numbers as constants. e.g. {ANIMATION_DELAY_MS: 350}
- return {};
- }
- /** @return {!Object} */
- }, {
- key: "defaultAdapter",
- get: function get() {
- // Classes extending MDCFoundation may choose to implement this getter in order to provide a convenient
- // way of viewing the necessary methods of an adapter. In the future, this could also be used for adapter
- // validation.
- return {};
- }
- /**
- * @param {A=} adapter
- */
- }]);
- function MDCFoundation() {
- var adapter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- _classCallCheck(this, MDCFoundation);
- /** @protected {!A} */
- this.adapter_ = adapter;
- }
- _createClass(MDCFoundation, [{
- key: "init",
- value: function init() {
- // Subclasses should override this method to perform initialization routines (registering events, etc.)
- }
- }, {
- key: "destroy",
- value: function destroy() {
- // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
- }
- }]);
- return MDCFoundation;
- }();
- /* harmony default export */ __webpack_exports__["a"] = (MDCFoundation);
- /***/ }),
- /***/ 1:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__foundation__ = __webpack_require__(0);
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- /**
- * Copyright 2016 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * @template F
- */
- var MDCComponent = function () {
- _createClass(MDCComponent, null, [{
- key: 'attachTo',
- /**
- * @param {!Element} root
- * @return {!MDCComponent}
- */
- value: function attachTo(root) {
- // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and
- // returns an instantiated component with its root set to that element. Also note that in the cases of
- // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized
- // from getDefaultFoundation().
- return new MDCComponent(root, new __WEBPACK_IMPORTED_MODULE_0__foundation__["a" /* default */]());
- }
- /**
- * @param {!Element} root
- * @param {F=} foundation
- * @param {...?} args
- */
- }]);
- function MDCComponent(root) {
- var foundation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
- _classCallCheck(this, MDCComponent);
- /** @protected {!Element} */
- this.root_ = root;
- for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
- args[_key - 2] = arguments[_key];
- }
- this.initialize.apply(this, args);
- // Note that we initialize foundation here and not within the constructor's default param so that
- // this.root_ is defined and can be used within the foundation class.
- /** @protected {!F} */
- this.foundation_ = foundation === undefined ? this.getDefaultFoundation() : foundation;
- this.foundation_.init();
- this.initialSyncWithDOM();
- }
- _createClass(MDCComponent, [{
- key: 'initialize',
- value: function initialize() /* ...args */{}
- // Subclasses can override this to do any additional setup work that would be considered part of a
- // "constructor". Essentially, it is a hook into the parent constructor before the foundation is
- // initialized. Any additional arguments besides root and foundation will be passed in here.
- /**
- * @return {!F} foundation
- */
- }, {
- key: 'getDefaultFoundation',
- value: function getDefaultFoundation() {
- // Subclasses must override this method to return a properly configured foundation class for the
- // component.
- throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class');
- }
- }, {
- key: 'initialSyncWithDOM',
- value: function initialSyncWithDOM() {
- // Subclasses should override this method if they need to perform work to synchronize with a host DOM
- // object. An example of this would be a form control wrapper that needs to synchronize its internal state
- // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM
- // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor.
- }
- }, {
- key: 'destroy',
- value: function destroy() {
- // Subclasses may implement this method to release any resources / deregister any listeners they have
- // attached. An example of this might be deregistering a resize event from the window object.
- this.foundation_.destroy();
- }
- /**
- * Wrapper method to add an event listener to the component's root element. This is most useful when
- * listening for custom events.
- * @param {string} evtType
- * @param {!Function} handler
- */
- }, {
- key: 'listen',
- value: function listen(evtType, handler) {
- this.root_.addEventListener(evtType, handler);
- }
- /**
- * Wrapper method to remove an event listener to the component's root element. This is most useful when
- * unlistening for custom events.
- * @param {string} evtType
- * @param {!Function} handler
- */
- }, {
- key: 'unlisten',
- value: function unlisten(evtType, handler) {
- this.root_.removeEventListener(evtType, handler);
- }
- /**
- * Fires a cross-browser-compatible custom event from the component root of the given type,
- * with the given data.
- * @param {string} evtType
- * @param {!Object} evtData
- * @param {boolean=} shouldBubble
- */
- }, {
- key: 'emit',
- value: function emit(evtType, evtData) {
- var shouldBubble = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
- var evt = void 0;
- if (typeof CustomEvent === 'function') {
- evt = new CustomEvent(evtType, {
- detail: evtData,
- bubbles: shouldBubble
- });
- } else {
- evt = document.createEvent('CustomEvent');
- evt.initCustomEvent(evtType, shouldBubble, false, evtData);
- }
- this.root_.dispatchEvent(evt);
- }
- }]);
- return MDCComponent;
- }();
- /* harmony default export */ __webpack_exports__["a"] = (MDCComponent);
- /***/ }),
- /***/ 2:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__foundation__ = __webpack_require__(0);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__component__ = __webpack_require__(1);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__selection_control__ = __webpack_require__(3);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MDCFoundation", function() { return __WEBPACK_IMPORTED_MODULE_0__foundation__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MDCComponent", function() { return __WEBPACK_IMPORTED_MODULE_1__component__["a"]; });
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "SelectionControlState", function() { return __WEBPACK_IMPORTED_MODULE_2__selection_control__["a"]; });
- /**
- * Copyright 2016 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /***/ }),
- /***/ 22:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return strings; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return cssClasses; });
- /**
- * 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 strings = {
- ARIA_HIDDEN: 'aria-hidden',
- ROLE: 'role',
- INPUT_SELECTOR: '.mdc-textfield__input',
- LABEL_SELECTOR: '.mdc-textfield__label'
- };
- var cssClasses = {
- ROOT: 'mdc-textfield',
- UPGRADED: 'mdc-textfield--upgraded',
- DISABLED: 'mdc-textfield--disabled',
- FOCUSED: 'mdc-textfield--focused',
- INVALID: 'mdc-textfield--invalid',
- HELPTEXT_PERSISTENT: 'mdc-textfield-helptext--persistent',
- HELPTEXT_VALIDATION_MSG: 'mdc-textfield-helptext--validation-msg',
- LABEL_FLOAT_ABOVE: 'mdc-textfield__label--float-above',
- BOX: 'mdc-textfield--box'
- };
- /***/ }),
- /***/ 3:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SelectionControlState; });
- /**
- * 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.
- */
- /**
- * @typedef {!{
- * checked: boolean,
- * indeterminate: boolean,
- * disabled: boolean,
- * value: ?string
- * }}
- */
- var SelectionControlState = void 0;
- /***/ }),
- /***/ 36:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCTextfield", function() { return MDCTextfield; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__material_base__ = __webpack_require__(2);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__material_ripple__ = __webpack_require__(6);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constants__ = __webpack_require__(22);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__foundation__ = __webpack_require__(75);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MDCTextfieldFoundation", function() { return __WEBPACK_IMPORTED_MODULE_3__foundation__["a"]; });
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- /**
- * Copyright 2016 Google Inc. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var MDCTextfield = function (_MDCComponent) {
- _inherits(MDCTextfield, _MDCComponent);
- function MDCTextfield() {
- _classCallCheck(this, MDCTextfield);
- return _possibleConstructorReturn(this, (MDCTextfield.__proto__ || Object.getPrototypeOf(MDCTextfield)).apply(this, arguments));
- }
- _createClass(MDCTextfield, [{
- key: 'initialize',
- value: function initialize() {
- var rippleFactory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function (el) {
- return new __WEBPACK_IMPORTED_MODULE_1__material_ripple__["MDCRipple"](el);
- };
- this.input_ = this.root_.querySelector(__WEBPACK_IMPORTED_MODULE_2__constants__["a" /* strings */].INPUT_SELECTOR);
- this.label_ = this.root_.querySelector(__WEBPACK_IMPORTED_MODULE_2__constants__["a" /* 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(__WEBPACK_IMPORTED_MODULE_2__constants__["b" /* cssClasses */].BOX)) {
- this.ripple = rippleFactory(this.root_);
- };
- }
- }, {
- key: 'destroy',
- value: function destroy() {
- if (this.ripple) {
- this.ripple.destroy();
- }
- _get(MDCTextfield.prototype.__proto__ || Object.getPrototypeOf(MDCTextfield.prototype), 'destroy', this).call(this);
- }
- }, {
- key: 'initialSyncWithDom',
- value: function initialSyncWithDom() {
- this.disabled = this.input_.disabled;
- }
- }, {
- key: 'getDefaultFoundation',
- value: function getDefaultFoundation() {
- var _this2 = this;
- return new __WEBPACK_IMPORTED_MODULE_3__foundation__["a" /* default */](_extends({
- addClass: function addClass(className) {
- return _this2.root_.classList.add(className);
- },
- removeClass: function removeClass(className) {
- return _this2.root_.classList.remove(className);
- },
- addClassToLabel: function addClassToLabel(className) {
- var label = _this2.label_;
- if (label) {
- label.classList.add(className);
- }
- },
- removeClassFromLabel: function removeClassFromLabel(className) {
- var label = _this2.label_;
- if (label) {
- label.classList.remove(className);
- }
- }
- }, this.getInputAdapterMethods_(), this.getHelptextAdapterMethods_()));
- }
- }, {
- key: 'getInputAdapterMethods_',
- value: function getInputAdapterMethods_() {
- var _this3 = this;
- return {
- registerInputFocusHandler: function registerInputFocusHandler(handler) {
- return _this3.input_.addEventListener('focus', handler);
- },
- registerInputBlurHandler: function registerInputBlurHandler(handler) {
- return _this3.input_.addEventListener('blur', handler);
- },
- registerInputInputHandler: function registerInputInputHandler(handler) {
- return _this3.input_.addEventListener('input', handler);
- },
- registerInputKeydownHandler: function registerInputKeydownHandler(handler) {
- return _this3.input_.addEventListener('keydown', handler);
- },
- deregisterInputFocusHandler: function deregisterInputFocusHandler(handler) {
- return _this3.input_.removeEventListener('focus', handler);
- },
- deregisterInputBlurHandler: function deregisterInputBlurHandler(handler) {
- return _this3.input_.removeEventListener('blur', handler);
- },
- deregisterInputInputHandler: function deregisterInputInputHandler(handler) {
- return _this3.input_.removeEventListener('input', handler);
- },
- deregisterInputKeydownHandler: function deregisterInputKeydownHandler(handler) {
- return _this3.input_.removeEventListener('keydown', handler);
- },
- getNativeInput: function getNativeInput() {
- return _this3.input_;
- }
- };
- }
- }, {
- key: 'getHelptextAdapterMethods_',
- value: function getHelptextAdapterMethods_() {
- var _this4 = this;
- return {
- addClassToHelptext: function addClassToHelptext(className) {
- if (_this4.helptextElement) {
- _this4.helptextElement.classList.add(className);
- }
- },
- removeClassFromHelptext: function removeClassFromHelptext(className) {
- if (_this4.helptextElement) {
- _this4.helptextElement.classList.remove(className);
- }
- },
- helptextHasClass: function helptextHasClass(className) {
- if (!_this4.helptextElement) {
- return false;
- }
- return _this4.helptextElement.classList.contains(className);
- },
- setHelptextAttr: function setHelptextAttr(name, value) {
- if (_this4.helptextElement) {
- _this4.helptextElement.setAttribute(name, value);
- }
- },
- removeHelptextAttr: function removeHelptextAttr(name) {
- if (_this4.helptextElement) {
- _this4.helptextElement.removeAttribute(name);
- }
- }
- };
- }
- }, {
- key: 'disabled',
- get: function get() {
- return this.foundation_.isDisabled();
- },
- set: function set(disabled) {
- this.foundation_.setDisabled(disabled);
- }
- }], [{
- key: 'attachTo',
- value: function attachTo(root) {
- return new MDCTextfield(root);
- }
- }]);
- return MDCTextfield;
- }(__WEBPACK_IMPORTED_MODULE_0__material_base__["MDCComponent"]);
- /***/ }),
- /***/ 4:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- /**
- * 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.
- */
- /* eslint no-unused-vars: [2, {"args": "none"}] */
- /**
- * Adapter for MDC Ripple. Provides an interface for managing
- * - classes
- * - dom
- * - CSS variables
- * - position
- * - dimensions
- * - scroll position
- * - event handlers
- * - unbounded, active and disabled states
- *
- * Additionally, provides type information for the adapter to the Closure
- * compiler.
- *
- * Implement this adapter for your framework of choice to delegate updates to
- * the component in your framework of choice. See architecture documentation
- * for more details.
- * https://github.com/material-components/material-components-web/blob/master/docs/architecture.md
- *
- * @record
- */
- var MDCRippleAdapter = function () {
- function MDCRippleAdapter() {
- _classCallCheck(this, MDCRippleAdapter);
- }
- _createClass(MDCRippleAdapter, [{
- key: "browserSupportsCssVars",
- /** @return {boolean} */
- value: function browserSupportsCssVars() {}
- /** @return {boolean} */
- }, {
- key: "isUnbounded",
- value: function isUnbounded() {}
- /** @return {boolean} */
- }, {
- key: "isSurfaceActive",
- value: function isSurfaceActive() {}
- /** @return {boolean} */
- }, {
- key: "isSurfaceDisabled",
- value: function isSurfaceDisabled() {}
- /** @param {string} className */
- }, {
- key: "addClass",
- value: function addClass(className) {}
- /** @param {string} className */
- }, {
- key: "removeClass",
- value: function removeClass(className) {}
- /**
- * @param {string} evtType
- * @param {!Function} handler
- */
- }, {
- key: "registerInteractionHandler",
- value: function registerInteractionHandler(evtType, handler) {}
- /**
- * @param {string} evtType
- * @param {!Function} handler
- */
- }, {
- key: "deregisterInteractionHandler",
- value: function deregisterInteractionHandler(evtType, handler) {}
- /**
- * @param {!Function} handler
- */
- }, {
- key: "registerResizeHandler",
- value: function registerResizeHandler(handler) {}
- /**
- * @param {!Function} handler
- */
- }, {
- key: "deregisterResizeHandler",
- value: function deregisterResizeHandler(handler) {}
- /**
- * @param {string} varName
- * @param {?number|string} value
- */
- }, {
- key: "updateCssVariable",
- value: function updateCssVariable(varName, value) {}
- /** @return {!ClientRect} */
- }, {
- key: "computeBoundingRect",
- value: function computeBoundingRect() {}
- /** @return {{x: number, y: number}} */
- }, {
- key: "getWindowPageOffset",
- value: function getWindowPageOffset() {}
- }]);
- return MDCRippleAdapter;
- }();
- /* unused harmony default export */ var _unused_webpack_default_export = (MDCRippleAdapter);
- /***/ }),
- /***/ 5:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
- /* harmony export (immutable) */ __webpack_exports__["supportsCssVariables"] = supportsCssVariables;
- /* harmony export (immutable) */ __webpack_exports__["applyPassive"] = applyPassive;
- /* harmony export (immutable) */ __webpack_exports__["getMatchesProperty"] = getMatchesProperty;
- /* harmony export (immutable) */ __webpack_exports__["getNormalizedEventCoords"] = getNormalizedEventCoords;
- /**
- * 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.
- */
- /**
- * Stores result from supportsCssVariables to avoid redundant processing to detect CSS custom variable support.
- * @private {boolean|undefined}
- */
- var supportsCssVariables_ = void 0;
- /**
- * Stores result from applyPassive to avoid redundant processing to detect passive event listener support.
- * @private {boolean|undefined}
- */
- var supportsPassive_ = void 0;
- /**
- * @param {!Window} windowObj
- * @return {boolean}
- */
- function detectEdgePseudoVarBug(windowObj) {
- // Detect versions of Edge with buggy var() support
- // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/
- var document = windowObj.document;
- var className = 'test-edge-css-var';
- var styleNode = document.createElement('style');
- document.head.appendChild(styleNode);
- var sheet = styleNode.sheet;
- // Internet Explorer 11 requires indices to always be specified to insertRule
- sheet.insertRule(':root { --' + className + ': 1px solid #000; }', 0);
- sheet.insertRule('.' + className + ' { visibility: hidden; }', 1);
- sheet.insertRule('.' + className + '::before { border: var(--' + className + '); }', 2);
- var node = document.createElement('div');
- node.className = className;
- document.body.appendChild(node);
- // Bug exists if ::before style ends up propagating to the parent element
- var hasPseudoVarBug = windowObj.getComputedStyle(node).borderTopStyle === 'solid';
- node.remove();
- styleNode.remove();
- return hasPseudoVarBug;
- }
- /**
- * @param {!Window} windowObj
- * @param {boolean=} forceRefresh
- * @return {boolean|undefined}
- */
- function supportsCssVariables(windowObj) {
- var forceRefresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- if (typeof supportsCssVariables_ === 'boolean' && !forceRefresh) {
- return supportsCssVariables_;
- }
- var supportsFunctionPresent = windowObj.CSS && typeof windowObj.CSS.supports === 'function';
- if (!supportsFunctionPresent) {
- return;
- }
- var explicitlySupportsCssVars = windowObj.CSS.supports('--css-vars', 'yes');
- // See: https://bugs.webkit.org/show_bug.cgi?id=154669
- // See: README section on Safari
- var weAreFeatureDetectingSafari10plus = windowObj.CSS.supports('(--css-vars: yes)') && windowObj.CSS.supports('color', '#00000000');
- if (explicitlySupportsCssVars || weAreFeatureDetectingSafari10plus) {
- supportsCssVariables_ = !detectEdgePseudoVarBug(windowObj);
- } else {
- supportsCssVariables_ = false;
- }
- return supportsCssVariables_;
- }
- //
- /**
- * Determine whether the current browser supports passive event listeners, and if so, use them.
- * @param {!Window=} globalObj
- * @param {boolean=} forceRefresh
- * @return {boolean|{passive: boolean}}
- */
- function applyPassive() {
- var globalObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
- var forceRefresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- if (supportsPassive_ === undefined || forceRefresh) {
- var isSupported = false;
- try {
- globalObj.document.addEventListener('test', null, { get passive() {
- isSupported = true;
- } });
- } catch (e) {}
- supportsPassive_ = isSupported;
- }
- return supportsPassive_ ? { passive: true } : false;
- }
- /**
- * @param {!Object} HTMLElementPrototype
- * @return {!Array<string>}
- */
- function getMatchesProperty(HTMLElementPrototype) {
- return ['webkitMatchesSelector', 'msMatchesSelector', 'matches'].filter(function (p) {
- return p in HTMLElementPrototype;
- }).pop();
- }
- /**
- * @param {!Event} ev
- * @param {!{x: number, y: number}} pageOffset
- * @param {!ClientRect} clientRect
- * @return {!{x: number, y: number}}
- */
- function getNormalizedEventCoords(ev, pageOffset, clientRect) {
- var x = pageOffset.x,
- y = pageOffset.y;
- var documentX = x + clientRect.left;
- var documentY = y + clientRect.top;
- var normalizedX = void 0;
- var normalizedY = void 0;
- // Determine touch point relative to the ripple container.
- if (ev.type === 'touchstart') {
- normalizedX = ev.changedTouches[0].pageX - documentX;
- normalizedY = ev.changedTouches[0].pageY - documentY;
- } else {
- normalizedX = ev.pageX - documentX;
- normalizedY = ev.pageY - documentY;
- }
- return { x: normalizedX, y: normalizedY };
- }
- /***/ }),
- /***/ 6:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCRipple", function() { return MDCRipple; });
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__material_base_component__ = __webpack_require__(1);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__adapter__ = __webpack_require__(4);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation__ = __webpack_require__(8);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util__ = __webpack_require__(5);
- /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MDCRippleFoundation", function() { return __WEBPACK_IMPORTED_MODULE_2__foundation__["a"]; });
- /* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "util", function() { return __WEBPACK_IMPORTED_MODULE_3__util__; });
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- /**
- * Copyright 2016 Google Inc. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * @extends MDCComponent<!MDCRippleFoundation>
- */
- var MDCRipple = function (_MDCComponent) {
- _inherits(MDCRipple, _MDCComponent);
- /** @param {...?} args */
- function MDCRipple() {
- var _ref;
- _classCallCheck(this, MDCRipple);
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- /** @type {boolean} */
- var _this = _possibleConstructorReturn(this, (_ref = MDCRipple.__proto__ || Object.getPrototypeOf(MDCRipple)).call.apply(_ref, [this].concat(args)));
- _this.disabled = false;
- /** @private {boolean} */
- _this.unbounded_;
- return _this;
- }
- /**
- * @param {!Element} root
- * @param {{isUnbounded: (boolean|undefined)}=} options
- * @return {!MDCRipple}
- */
- _createClass(MDCRipple, [{
- key: 'activate',
- value: function activate() {
- this.foundation_.activate();
- }
- }, {
- key: 'deactivate',
- value: function deactivate() {
- this.foundation_.deactivate();
- }
- }, {
- key: 'layout',
- value: function layout() {
- this.foundation_.layout();
- }
- /** @return {!MDCRippleFoundation} */
- }, {
- key: 'getDefaultFoundation',
- value: function getDefaultFoundation() {
- return new __WEBPACK_IMPORTED_MODULE_2__foundation__["a" /* default */](MDCRipple.createAdapter(this));
- }
- }, {
- key: 'initialSyncWithDOM',
- value: function initialSyncWithDOM() {
- this.unbounded = 'mdcRippleIsUnbounded' in this.root_.dataset;
- }
- }, {
- key: 'unbounded',
- /** @return {boolean} */
- get: function get() {
- return this.unbounded_;
- }
- /** @param {boolean} unbounded */
- ,
- set: function set(unbounded) {
- var UNBOUNDED = __WEBPACK_IMPORTED_MODULE_2__foundation__["a" /* default */].cssClasses.UNBOUNDED;
- this.unbounded_ = Boolean(unbounded);
- if (this.unbounded_) {
- this.root_.classList.add(UNBOUNDED);
- } else {
- this.root_.classList.remove(UNBOUNDED);
- }
- }
- }], [{
- key: 'attachTo',
- value: function attachTo(root) {
- var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
- _ref2$isUnbounded = _ref2.isUnbounded,
- isUnbounded = _ref2$isUnbounded === undefined ? undefined : _ref2$isUnbounded;
- var ripple = new MDCRipple(root);
- // Only override unbounded behavior if option is explicitly specified
- if (isUnbounded !== undefined) {
- ripple.unbounded = /** @type {boolean} */isUnbounded;
- }
- return ripple;
- }
- /**
- * @param {!RippleCapableSurface} instance
- * @return {!MDCRippleAdapter}
- */
- }, {
- key: 'createAdapter',
- value: function createAdapter(instance) {
- var MATCHES = __WEBPACK_IMPORTED_MODULE_3__util__["getMatchesProperty"](HTMLElement.prototype);
- return {
- browserSupportsCssVars: function browserSupportsCssVars() {
- return __WEBPACK_IMPORTED_MODULE_3__util__["supportsCssVariables"](window);
- },
- isUnbounded: function isUnbounded() {
- return instance.unbounded;
- },
- isSurfaceActive: function isSurfaceActive() {
- return instance.root_[MATCHES](':active');
- },
- isSurfaceDisabled: function isSurfaceDisabled() {
- return instance.disabled;
- },
- addClass: function addClass(className) {
- return instance.root_.classList.add(className);
- },
- removeClass: function removeClass(className) {
- return instance.root_.classList.remove(className);
- },
- registerInteractionHandler: function registerInteractionHandler(evtType, handler) {
- return instance.root_.addEventListener(evtType, handler, __WEBPACK_IMPORTED_MODULE_3__util__["applyPassive"]());
- },
- deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) {
- return instance.root_.removeEventListener(evtType, handler, __WEBPACK_IMPORTED_MODULE_3__util__["applyPassive"]());
- },
- registerResizeHandler: function registerResizeHandler(handler) {
- return window.addEventListener('resize', handler);
- },
- deregisterResizeHandler: function deregisterResizeHandler(handler) {
- return window.removeEventListener('resize', handler);
- },
- updateCssVariable: function updateCssVariable(varName, value) {
- return instance.root_.style.setProperty(varName, value);
- },
- computeBoundingRect: function computeBoundingRect() {
- return instance.root_.getBoundingClientRect();
- },
- getWindowPageOffset: function getWindowPageOffset() {
- return { x: window.pageXOffset, y: window.pageYOffset };
- }
- };
- }
- }]);
- return MDCRipple;
- }(__WEBPACK_IMPORTED_MODULE_0__material_base_component__["a" /* default */]);
- /**
- * See Material Design spec for more details on when to use ripples.
- * https://material.io/guidelines/motion/choreography.html#choreography-creation
- * @record
- */
- var RippleCapableSurface = function RippleCapableSurface() {
- _classCallCheck(this, RippleCapableSurface);
- };
- /** @protected {!Element} */
- RippleCapableSurface.prototype.root_;
- /**
- * Whether or not the ripple bleeds out of the bounds of the element.
- * @type {boolean|undefined}
- */
- RippleCapableSurface.prototype.unbounded;
- /**
- * Whether or not the ripple is attached to a disabled component.
- * @type {boolean|undefined}
- */
- RippleCapableSurface.prototype.disabled;
- /***/ }),
- /***/ 7:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return cssClasses; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return strings; });
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return numbers; });
- /**
- * 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 cssClasses = {
- // Ripple is a special case where the "root" component is really a "mixin" of sorts,
- // given that it's an 'upgrade' to an existing component. That being said it is the root
- // CSS class that all other CSS classes derive from.
- 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'
- };
- var strings = {
- VAR_SURFACE_WIDTH: '--mdc-ripple-surface-width',
- VAR_SURFACE_HEIGHT: '--mdc-ripple-surface-height',
- 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'
- };
- var numbers = {
- PADDING: 10,
- INITIAL_ORIGIN_SCALE: 0.6,
- DEACTIVATION_TIMEOUT_MS: 300,
- FG_DEACTIVATION_MS: 83
- };
- /***/ }),
- /***/ 75:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__material_base__ = __webpack_require__(2);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__constants__ = __webpack_require__(22);
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- /**
- * Copyright 2016 Google Inc. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- var MDCTextfieldFoundation = function (_MDCFoundation) {
- _inherits(MDCTextfieldFoundation, _MDCFoundation);
- _createClass(MDCTextfieldFoundation, null, [{
- key: 'cssClasses',
- get: function get() {
- return __WEBPACK_IMPORTED_MODULE_1__constants__["b" /* cssClasses */];
- }
- }, {
- key: 'strings',
- get: function get() {
- return __WEBPACK_IMPORTED_MODULE_1__constants__["a" /* strings */];
- }
- }, {
- key: 'defaultAdapter',
- get: function get() {
- return {
- addClass: function addClass() /* className: string */{},
- removeClass: function removeClass() /* className: string */{},
- addClassToLabel: function addClassToLabel() /* className: string */{},
- removeClassFromLabel: function removeClassFromLabel() /* className: string */{},
- addClassToHelptext: function addClassToHelptext() /* className: string */{},
- removeClassFromHelptext: function removeClassFromHelptext() /* className: string */{},
- helptextHasClass: function helptextHasClass() {
- return (/* className: string */ /* boolean */false
- );
- },
- registerInputFocusHandler: function registerInputFocusHandler() /* handler: EventListener */{},
- deregisterInputFocusHandler: function deregisterInputFocusHandler() /* handler: EventListener */{},
- registerInputBlurHandler: function registerInputBlurHandler() /* handler: EventListener */{},
- deregisterInputBlurHandler: function deregisterInputBlurHandler() /* handler: EventListener */{},
- registerInputInputHandler: function registerInputInputHandler() /* handler: EventListener */{},
- deregisterInputInputHandler: function deregisterInputInputHandler() /* handler: EventListener */{},
- registerInputKeydownHandler: function registerInputKeydownHandler() /* handler: EventListener */{},
- deregisterInputKeydownHandler: function deregisterInputKeydownHandler() /* handler: EventListener */{},
- setHelptextAttr: function setHelptextAttr() /* name: string, value: string */{},
- removeHelptextAttr: function removeHelptextAttr() /* name: string */{},
- getNativeInput: function getNativeInput() {
- return (/* HTMLInputElement */{}
- );
- }
- };
- }
- }]);
- function MDCTextfieldFoundation() {
- var adapter = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- _classCallCheck(this, MDCTextfieldFoundation);
- var _this = _possibleConstructorReturn(this, (MDCTextfieldFoundation.__proto__ || Object.getPrototypeOf(MDCTextfieldFoundation)).call(this, _extends(MDCTextfieldFoundation.defaultAdapter, adapter)));
- _this.receivedUserInput_ = false;
- _this.inputFocusHandler_ = function () {
- return _this.activateFocus_();
- };
- _this.inputBlurHandler_ = function () {
- return _this.deactivateFocus_();
- };
- _this.inputInputHandler_ = function () {
- return _this.autoCompleteFocus_();
- };
- _this.inputKeydownHandler_ = function () {
- return _this.receivedUserInput_ = true;
- };
- return _this;
- }
- _createClass(MDCTextfieldFoundation, [{
- key: 'init',
- value: function init() {
- this.adapter_.addClass(MDCTextfieldFoundation.cssClasses.UPGRADED);
- this.adapter_.registerInputFocusHandler(this.inputFocusHandler_);
- this.adapter_.registerInputBlurHandler(this.inputBlurHandler_);
- this.adapter_.registerInputInputHandler(this.inputInputHandler_);
- this.adapter_.registerInputKeydownHandler(this.inputKeydownHandler_);
- // Ensure label does not collide with any pre-filled value.
- if (this.getNativeInput_().value) {
- this.adapter_.addClassToLabel(MDCTextfieldFoundation.cssClasses.LABEL_FLOAT_ABOVE);
- }
- }
- }, {
- key: 'destroy',
- value: function destroy() {
- this.adapter_.removeClass(MDCTextfieldFoundation.cssClasses.UPGRADED);
- this.adapter_.deregisterInputFocusHandler(this.inputFocusHandler_);
- this.adapter_.deregisterInputBlurHandler(this.inputBlurHandler_);
- this.adapter_.deregisterInputInputHandler(this.inputInputHandler_);
- this.adapter_.deregisterInputKeydownHandler(this.inputKeydownHandler_);
- }
- }, {
- key: 'activateFocus_',
- value: function activateFocus_() {
- var _MDCTextfieldFoundati = MDCTextfieldFoundation.cssClasses,
- FOCUSED = _MDCTextfieldFoundati.FOCUSED,
- LABEL_FLOAT_ABOVE = _MDCTextfieldFoundati.LABEL_FLOAT_ABOVE;
- this.adapter_.addClass(FOCUSED);
- this.adapter_.addClassToLabel(LABEL_FLOAT_ABOVE);
- this.showHelptext_();
- }
- }, {
- key: 'autoCompleteFocus_',
- value: function autoCompleteFocus_() {
- if (!this.receivedUserInput_) {
- this.activateFocus_();
- }
- }
- }, {
- key: 'showHelptext_',
- value: function showHelptext_() {
- var ARIA_HIDDEN = MDCTextfieldFoundation.strings.ARIA_HIDDEN;
- this.adapter_.removeHelptextAttr(ARIA_HIDDEN);
- }
- }, {
- key: 'deactivateFocus_',
- value: function deactivateFocus_() {
- var _MDCTextfieldFoundati2 = MDCTextfieldFoundation.cssClasses,
- FOCUSED = _MDCTextfieldFoundati2.FOCUSED,
- INVALID = _MDCTextfieldFoundati2.INVALID,
- LABEL_FLOAT_ABOVE = _MDCTextfieldFoundati2.LABEL_FLOAT_ABOVE;
- var input = this.getNativeInput_();
- var isValid = input.checkValidity();
- this.adapter_.removeClass(FOCUSED);
- if (!input.value && !this.isBadInput_()) {
- this.adapter_.removeClassFromLabel(LABEL_FLOAT_ABOVE);
- this.receivedUserInput_ = false;
- }
- if (isValid) {
- this.adapter_.removeClass(INVALID);
- } else {
- this.adapter_.addClass(INVALID);
- }
- this.updateHelptextOnDeactivation_(isValid);
- }
- }, {
- key: 'updateHelptextOnDeactivation_',
- value: function updateHelptextOnDeactivation_(isValid) {
- var _MDCTextfieldFoundati3 = MDCTextfieldFoundation.cssClasses,
- HELPTEXT_PERSISTENT = _MDCTextfieldFoundati3.HELPTEXT_PERSISTENT,
- HELPTEXT_VALIDATION_MSG = _MDCTextfieldFoundati3.HELPTEXT_VALIDATION_MSG;
- var ROLE = MDCTextfieldFoundation.strings.ROLE;
- var helptextIsPersistent = this.adapter_.helptextHasClass(HELPTEXT_PERSISTENT);
- var helptextIsValidationMsg = this.adapter_.helptextHasClass(HELPTEXT_VALIDATION_MSG);
- var validationMsgNeedsDisplay = helptextIsValidationMsg && !isValid;
- if (validationMsgNeedsDisplay) {
- this.adapter_.setHelptextAttr(ROLE, 'alert');
- } else {
- this.adapter_.removeHelptextAttr(ROLE);
- }
- if (helptextIsPersistent || validationMsgNeedsDisplay) {
- return;
- }
- this.hideHelptext_();
- }
- }, {
- key: 'hideHelptext_',
- value: function hideHelptext_() {
- var ARIA_HIDDEN = MDCTextfieldFoundation.strings.ARIA_HIDDEN;
- this.adapter_.setHelptextAttr(ARIA_HIDDEN, 'true');
- }
- }, {
- key: 'isBadInput_',
- value: function isBadInput_() {
- var input = this.getNativeInput_();
- return input.validity ? input.validity.badInput : input.badInput;
- }
- }, {
- key: 'isDisabled',
- value: function isDisabled() {
- return this.getNativeInput_().disabled;
- }
- }, {
- key: 'setDisabled',
- value: function setDisabled(disabled) {
- var DISABLED = MDCTextfieldFoundation.cssClasses.DISABLED;
- this.getNativeInput_().disabled = disabled;
- if (disabled) {
- this.adapter_.addClass(DISABLED);
- } else {
- this.adapter_.removeClass(DISABLED);
- }
- }
- }, {
- key: 'getNativeInput_',
- value: function getNativeInput_() {
- return this.adapter_.getNativeInput() || {
- checkValidity: function checkValidity() {
- return true;
- },
- value: '',
- disabled: false,
- badInput: false
- };
- }
- }]);
- return MDCTextfieldFoundation;
- }(__WEBPACK_IMPORTED_MODULE_0__material_base__["MDCFoundation"]);
- /* harmony default export */ __webpack_exports__["a"] = (MDCTextfieldFoundation);
- /***/ }),
- /***/ 8:
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__material_base_foundation__ = __webpack_require__(0);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__adapter__ = __webpack_require__(4);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constants__ = __webpack_require__(7);
- /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util__ = __webpack_require__(5);
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
- /**
- * Copyright 2016 Google Inc. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * @typedef {!{
- * isActivated: (boolean|undefined),
- * hasDeactivationUXRun: (boolean|undefined),
- * wasActivatedByPointer: (boolean|undefined),
- * wasElementMadeActive: (boolean|undefined),
- * activationStartTime: (number|undefined),
- * activationEvent: Event,
- * isProgrammatic: (boolean|undefined)
- * }}
- */
- var ActivationStateType = void 0;
- /**
- * @typedef {!{
- * activate: (string|undefined),
- * deactivate: (string|undefined),
- * focus: (string|undefined),
- * blur: (string|undefined)
- * }}
- */
- var ListenerInfoType = void 0;
- /**
- * @typedef {!{
- * activate: function(!Event),
- * deactivate: function(!Event),
- * focus: function(),
- * blur: function()
- * }}
- */
- var ListenersType = void 0;
- /**
- * @typedef {!{
- * x: number,
- * y: number
- * }}
- */
- var PointType = void 0;
- /**
- * @enum {string}
- */
- var DEACTIVATION_ACTIVATION_PAIRS = {
- mouseup: 'mousedown',
- pointerup: 'pointerdown',
- touchend: 'touchstart',
- keyup: 'keydown',
- blur: 'focus'
- };
- /**
- * @extends {MDCFoundation<!MDCRippleAdapter>}
- */
- var MDCRippleFoundation = function (_MDCFoundation) {
- _inherits(MDCRippleFoundation, _MDCFoundation);
- _createClass(MDCRippleFoundation, [{
- key: 'isSupported_',
- /**
- * We compute this property so that we are not querying information about the client
- * until the point in time where the foundation requests it. This prevents scenarios where
- * client-side feature-detection may happen too early, such as when components are rendered on the server
- * and then initialized at mount time on the client.
- * @return {boolean}
- */
- get: function get() {
- return this.adapter_.browserSupportsCssVars();
- }
- }], [{
- key: 'cssClasses',
- get: function get() {
- return __WEBPACK_IMPORTED_MODULE_2__constants__["a" /* cssClasses */];
- }
- }, {
- key: 'strings',
- get: function get() {
- return __WEBPACK_IMPORTED_MODULE_2__constants__["b" /* strings */];
- }
- }, {
- key: 'numbers',
- get: function get() {
- return __WEBPACK_IMPORTED_MODULE_2__constants__["c" /* numbers */];
- }
- }, {
- key: 'defaultAdapter',
- get: function get() {
- return {
- browserSupportsCssVars: function browserSupportsCssVars() /* boolean - cached */{},
- isUnbounded: function isUnbounded() /* boolean */{},
- isSurfaceActive: function isSurfaceActive() /* boolean */{},
- isSurfaceDisabled: function isSurfaceDisabled() /* boolean */{},
- addClass: function addClass() /* className: string */{},
- removeClass: function removeClass() /* className: string */{},
- registerInteractionHandler: function registerInteractionHandler() /* evtType: string, handler: EventListener */{},
- deregisterInteractionHandler: function deregisterInteractionHandler() /* evtType: string, handler: EventListener */{},
- registerResizeHandler: function registerResizeHandler() /* handler: EventListener */{},
- deregisterResizeHandler: function deregisterResizeHandler() /* handler: EventListener */{},
- updateCssVariable: function updateCssVariable() /* varName: string, value: string */{},
- computeBoundingRect: function computeBoundingRect() /* ClientRect */{},
- getWindowPageOffset: function getWindowPageOffset() /* {x: number, y: number} */{}
- };
- }
- }]);
- function MDCRippleFoundation(adapter) {
- _classCallCheck(this, MDCRippleFoundation);
- /** @private {number} */
- var _this = _possibleConstructorReturn(this, (MDCRippleFoundation.__proto__ || Object.getPrototypeOf(MDCRippleFoundation)).call(this, _extends(MDCRippleFoundation.defaultAdapter, adapter)));
- _this.layoutFrame_ = 0;
- /** @private {!ClientRect} */
- _this.frame_ = /** @type {!ClientRect} */{ width: 0, height: 0 };
- /** @private {!ActivationStateType} */
- _this.activationState_ = _this.defaultActivationState_();
- /** @private {number} */
- _this.xfDuration_ = 0;
- /** @private {number} */
- _this.initialSize_ = 0;
- /** @private {number} */
- _this.maxRadius_ = 0;
- /** @private {!Array<{ListenerInfoType}>} */
- _this.listenerInfos_ = [{ activate: 'touchstart', deactivate: 'touchend' }, { activate: 'pointerdown', deactivate: 'pointerup' }, { activate: 'mousedown', deactivate: 'mouseup' }, { activate: 'keydown', deactivate: 'keyup' }, { focus: 'focus', blur: 'blur' }];
- /** @private {!ListenersType} */
- _this.listeners_ = {
- activate: function activate(e) {
- return _this.activate_(e);
- },
- deactivate: function deactivate(e) {
- return _this.deactivate_(e);
- },
- focus: function focus() {
- return requestAnimationFrame(function () {
- return _this.adapter_.addClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
- });
- },
- blur: function blur() {
- return requestAnimationFrame(function () {
- return _this.adapter_.removeClass(MDCRippleFoundation.cssClasses.BG_FOCUSED);
- });
- }
- };
- /** @private {!Function} */
- _this.resizeHandler_ = function () {
- return _this.layout();
- };
- /** @private {!{left: number, top:number}} */
- _this.unboundedCoords_ = {
- left: 0,
- top: 0
- };
- /** @private {number} */
- _this.fgScale_ = 0;
- /** @private {number} */
- _this.activationTimer_ = 0;
- /** @private {number} */
- _this.fgDeactivationRemovalTimer_ = 0;
- /** @private {boolean} */
- _this.activationAnimationHasEnded_ = false;
- /** @private {!Function} */
- _this.activationTimerCallback_ = function () {
- _this.activationAnimationHasEnded_ = true;
- _this.runDeactivationUXLogicIfReady_();
- };
- return _this;
- }
- /**
- * @return {!ActivationStateType}
- */
- _createClass(MDCRippleFoundation, [{
- key: 'defaultActivationState_',
- value: function defaultActivationState_() {
- return {
- isActivated: false,
- hasDeactivationUXRun: false,
- wasActivatedByPointer: false,
- wasElementMadeActive: false,
- activationStartTime: 0,
- activationEvent: null,
- isProgrammatic: false
- };
- }
- }, {
- key: 'init',
- value: function init() {
- var _this2 = this;
- if (!this.isSupported_) {
- return;
- }
- this.addEventListeners_();
- var _MDCRippleFoundation$ = MDCRippleFoundation.cssClasses,
- ROOT = _MDCRippleFoundation$.ROOT,
- UNBOUNDED = _MDCRippleFoundation$.UNBOUNDED;
- requestAnimationFrame(function () {
- _this2.adapter_.addClass(ROOT);
- if (_this2.adapter_.isUnbounded()) {
- _this2.adapter_.addClass(UNBOUNDED);
- }
- _this2.layoutInternal_();
- });
- }
- /** @private */
- }, {
- key: 'addEventListeners_',
- value: function addEventListeners_() {
- var _this3 = this;
- this.listenerInfos_.forEach(function (info) {
- Object.keys(info).forEach(function (k) {
- _this3.adapter_.registerInteractionHandler(info[k], _this3.listeners_[k]);
- });
- });
- this.adapter_.registerResizeHandler(this.resizeHandler_);
- }
- /**
- * @param {Event} e
- * @private
- */
- }, {
- key: 'activate_',
- value: function activate_(e) {
- var _this4 = this;
- if (this.adapter_.isSurfaceDisabled()) {
- return;
- }
- var activationState = this.activationState_;
- if (activationState.isActivated) {
- return;
- }
- activationState.isActivated = true;
- activationState.isProgrammatic = e === null;
- activationState.activationEvent = e;
- activationState.wasActivatedByPointer = activationState.isProgrammatic ? false : e.type === 'mousedown' || e.type === 'touchstart' || e.type === 'pointerdown';
- activationState.activationStartTime = Date.now();
- requestAnimationFrame(function () {
- // This needs to be wrapped in an rAF call b/c web browsers
- // report active states inconsistently when they're called within
- // event handling code:
- // - https://bugs.chromium.org/p/chromium/issues/detail?id=635971
- // - https://bugzilla.mozilla.org/show_bug.cgi?id=1293741
- activationState.wasElementMadeActive = e && e.type === 'keydown' ? _this4.adapter_.isSurfaceActive() : true;
- if (activationState.wasElementMadeActive) {
- _this4.animateActivation_();
- } else {
- // Reset activation state immediately if element was not made active.
- _this4.activationState_ = _this4.defaultActivationState_();
- }
- });
- }
- }, {
- key: 'activate',
- value: function activate() {
- this.activate_(null);
- }
- /** @private */
- }, {
- key: 'animateActivation_',
- value: function animateActivation_() {
- var _this5 = this;
- var _MDCRippleFoundation$2 = MDCRippleFoundation.strings,
- VAR_FG_TRANSLATE_START = _MDCRippleFoundation$2.VAR_FG_TRANSLATE_START,
- VAR_FG_TRANSLATE_END = _MDCRippleFoundation$2.VAR_FG_TRANSLATE_END;
- var _MDCRippleFoundation$3 = MDCRippleFoundation.cssClasses,
- BG_ACTIVE_FILL = _MDCRippleFoundation$3.BG_ACTIVE_FILL,
- FG_DEACTIVATION = _MDCRippleFoundation$3.FG_DEACTIVATION,
- FG_ACTIVATION = _MDCRippleFoundation$3.FG_ACTIVATION;
- var DEACTIVATION_TIMEOUT_MS = MDCRippleFoundation.numbers.DEACTIVATION_TIMEOUT_MS;
- var translateStart = '';
- var translateEnd = '';
- if (!this.adapter_.isUnbounded()) {
- var _getFgTranslationCoor = this.getFgTranslationCoordinates_(),
- startPoint = _getFgTranslationCoor.startPoint,
- endPoint = _getFgTranslationCoor.endPoint;
- translateStart = startPoint.x + 'px, ' + startPoint.y + 'px';
- translateEnd = endPoint.x + 'px, ' + endPoint.y + 'px';
- }
- this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_START, translateStart);
- this.adapter_.updateCssVariable(VAR_FG_TRANSLATE_END, translateEnd);
- // Cancel any ongoing activation/deactivation animations
- clearTimeout(this.activationTimer_);
- clearTimeout(this.fgDeactivationRemovalTimer_);
- this.rmBoundedActivationClasses_();
- this.adapter_.removeClass(FG_DEACTIVATION);
- // Force layout in order to re-trigger the animation.
- this.adapter_.computeBoundingRect();
- this.adapter_.addClass(BG_ACTIVE_FILL);
- this.adapter_.addClass(FG_ACTIVATION);
- this.activationTimer_ = setTimeout(function () {
- return _this5.activationTimerCallback_();
- }, DEACTIVATION_TIMEOUT_MS);
- }
- /**
- * @private
- * @return {{startPoint: PointType, endPoint: PointType}}
- */
- }, {
- key: 'getFgTranslationCoordinates_',
- value: function getFgTranslationCoordinates_() {
- var activationState = this.activationState_;
- var activationEvent = activationState.activationEvent,
- wasActivatedByPointer = activationState.wasActivatedByPointer;
- var startPoint = void 0;
- if (wasActivatedByPointer) {
- startPoint = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__util__["getNormalizedEventCoords"])(
- /** @type {!Event} */activationEvent, this.adapter_.getWindowPageOffset(), this.adapter_.computeBoundingRect());
- } else {
- startPoint = {
- x: this.frame_.width / 2,
- y: this.frame_.height / 2
- };
- }
- // Center the element around the start point.
- startPoint = {
- x: startPoint.x - this.initialSize_ / 2,
- y: startPoint.y - this.initialSize_ / 2
- };
- var endPoint = {
- x: this.frame_.width / 2 - this.initialSize_ / 2,
- y: this.frame_.height / 2 - this.initialSize_ / 2
- };
- return { startPoint: startPoint, endPoint: endPoint };
- }
- /** @private */
- }, {
- key: 'runDeactivationUXLogicIfReady_',
- value: function runDeactivationUXLogicIfReady_() {
- var _this6 = this;
- var FG_DEACTIVATION = MDCRippleFoundation.cssClasses.FG_DEACTIVATION;
- var _activationState_ = this.activationState_,
- hasDeactivationUXRun = _activationState_.hasDeactivationUXRun,
- isActivated = _activationState_.isActivated;
- var activationHasEnded = hasDeactivationUXRun || !isActivated;
- if (activationHasEnded && this.activationAnimationHasEnded_) {
- this.rmBoundedActivationClasses_();
- this.adapter_.addClass(FG_DEACTIVATION);
- this.fgDeactivationRemovalTimer_ = setTimeout(function () {
- _this6.adapter_.removeClass(FG_DEACTIVATION);
- }, __WEBPACK_IMPORTED_MODULE_2__constants__["c" /* numbers */].FG_DEACTIVATION_MS);
- }
- }
- /** @private */
- }, {
- key: 'rmBoundedActivationClasses_',
- value: function rmBoundedActivationClasses_() {
- var _MDCRippleFoundation$4 = MDCRippleFoundation.cssClasses,
- BG_ACTIVE_FILL = _MDCRippleFoundation$4.BG_ACTIVE_FILL,
- FG_ACTIVATION = _MDCRippleFoundation$4.FG_ACTIVATION;
- this.adapter_.removeClass(BG_ACTIVE_FILL);
- this.adapter_.removeClass(FG_ACTIVATION);
- this.activationAnimationHasEnded_ = false;
- this.adapter_.computeBoundingRect();
- }
- /**
- * @param {Event} e
- * @private
- */
- }, {
- key: 'deactivate_',
- value: function deactivate_(e) {
- var _this7 = this;
- var activationState = this.activationState_;
- // This can happen in scenarios such as when you have a keyup event that blurs the element.
- if (!activationState.isActivated) {
- return;
- }
- // Programmatic deactivation.
- if (activationState.isProgrammatic) {
- var evtObject = null;
- var _state = /** @type {!ActivationStateType} */_extends({}, activationState);
- requestAnimationFrame(function () {
- return _this7.animateDeactivation_(evtObject, _state);
- });
- this.activationState_ = this.defaultActivationState_();
- return;
- }
- var actualActivationType = DEACTIVATION_ACTIVATION_PAIRS[e.type];
- var expectedActivationType = activationState.activationEvent.type;
- // NOTE: Pointer events are tricky - https://patrickhlauke.github.io/touch/tests/results/
- // Essentially, what we need to do here is decouple the deactivation UX from the actual
- // deactivation state itself. This way, touch/pointer events in sequence do not trample one
- // another.
- var needsDeactivationUX = actualActivationType === expectedActivationType;
- var needsActualDeactivation = needsDeactivationUX;
- if (activationState.wasActivatedByPointer) {
- needsActualDeactivation = e.type === 'mouseup';
- }
- var state = /** @type {!ActivationStateType} */_extends({}, activationState);
- requestAnimationFrame(function () {
- if (needsDeactivationUX) {
- _this7.activationState_.hasDeactivationUXRun = true;
- _this7.animateDeactivation_(e, state);
- }
- if (needsActualDeactivation) {
- _this7.activationState_ = _this7.defaultActivationState_();
- }
- });
- }
- }, {
- key: 'deactivate',
- value: function deactivate() {
- this.deactivate_(null);
- }
- /**
- * @param {Event} e
- * @param {!ActivationStateType} options
- * @private
- */
- }, {
- key: 'animateDeactivation_',
- value: function animateDeactivation_(e, _ref) {
- var wasActivatedByPointer = _ref.wasActivatedByPointer,
- wasElementMadeActive = _ref.wasElementMadeActive;
- var BG_FOCUSED = MDCRippleFoundation.cssClasses.BG_FOCUSED;
- if (wasActivatedByPointer || wasElementMadeActive) {
- // Remove class left over by element being focused
- this.adapter_.removeClass(BG_FOCUSED);
- this.runDeactivationUXLogicIfReady_();
- }
- }
- }, {
- key: 'destroy',
- value: function destroy() {
- var _this8 = this;
- if (!this.isSupported_) {
- return;
- }
- this.removeEventListeners_();
- var _MDCRippleFoundation$5 = MDCRippleFoundation.cssClasses,
- ROOT = _MDCRippleFoundation$5.ROOT,
- UNBOUNDED = _MDCRippleFoundation$5.UNBOUNDED;
- requestAnimationFrame(function () {
- _this8.adapter_.removeClass(ROOT);
- _this8.adapter_.removeClass(UNBOUNDED);
- _this8.removeCssVars_();
- });
- }
- /** @private */
- }, {
- key: 'removeEventListeners_',
- value: function removeEventListeners_() {
- var _this9 = this;
- this.listenerInfos_.forEach(function (info) {
- Object.keys(info).forEach(function (k) {
- _this9.adapter_.deregisterInteractionHandler(info[k], _this9.listeners_[k]);
- });
- });
- this.adapter_.deregisterResizeHandler(this.resizeHandler_);
- }
- /** @private */
- }, {
- key: 'removeCssVars_',
- value: function removeCssVars_() {
- var _this10 = this;
- var strings = MDCRippleFoundation.strings;
- Object.keys(strings).forEach(function (k) {
- if (k.indexOf('VAR_') === 0) {
- _this10.adapter_.updateCssVariable(strings[k], null);
- }
- });
- }
- }, {
- key: 'layout',
- value: function layout() {
- var _this11 = this;
- if (this.layoutFrame_) {
- cancelAnimationFrame(this.layoutFrame_);
- }
- this.layoutFrame_ = requestAnimationFrame(function () {
- _this11.layoutInternal_();
- _this11.layoutFrame_ = 0;
- });
- }
- /** @private */
- }, {
- key: 'layoutInternal_',
- value: function layoutInternal_() {
- this.frame_ = this.adapter_.computeBoundingRect();
- var maxDim = Math.max(this.frame_.height, this.frame_.width);
- var surfaceDiameter = Math.sqrt(Math.pow(this.frame_.width, 2) + Math.pow(this.frame_.height, 2));
- // 60% of the largest dimension of the surface
- this.initialSize_ = maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE;
- // Diameter of the surface + 10px
- this.maxRadius_ = surfaceDiameter + MDCRippleFoundation.numbers.PADDING;
- this.fgScale_ = this.maxRadius_ / this.initialSize_;
- this.xfDuration_ = 1000 * Math.sqrt(this.maxRadius_ / 1024);
- this.updateLayoutCssVars_();
- }
- /** @private */
- }, {
- key: 'updateLayoutCssVars_',
- value: function updateLayoutCssVars_() {
- var _MDCRippleFoundation$6 = MDCRippleFoundation.strings,
- VAR_SURFACE_WIDTH = _MDCRippleFoundation$6.VAR_SURFACE_WIDTH,
- VAR_SURFACE_HEIGHT = _MDCRippleFoundation$6.VAR_SURFACE_HEIGHT,
- VAR_FG_SIZE = _MDCRippleFoundation$6.VAR_FG_SIZE,
- VAR_LEFT = _MDCRippleFoundation$6.VAR_LEFT,
- VAR_TOP = _MDCRippleFoundation$6.VAR_TOP,
- VAR_FG_SCALE = _MDCRippleFoundation$6.VAR_FG_SCALE;
- this.adapter_.updateCssVariable(VAR_SURFACE_WIDTH, this.frame_.width + 'px');
- this.adapter_.updateCssVariable(VAR_SURFACE_HEIGHT, this.frame_.height + 'px');
- this.adapter_.updateCssVariable(VAR_FG_SIZE, this.initialSize_ + 'px');
- this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_);
- if (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(VAR_LEFT, this.unboundedCoords_.left + 'px');
- this.adapter_.updateCssVariable(VAR_TOP, this.unboundedCoords_.top + 'px');
- }
- }
- }]);
- return MDCRippleFoundation;
- }(__WEBPACK_IMPORTED_MODULE_0__material_base_foundation__["a" /* default */]);
- /* harmony default export */ __webpack_exports__["a"] = (MDCRippleFoundation);
- /***/ }),
- /***/ 98:
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(36);
- /***/ })
- /******/ });
- });
|