material-components-web
Version:
Modular and customizable Material Design UI components for the web
1,365 lines (1,155 loc) • 565 kB
JavaScript
/*!
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["mdc"] = factory();
else
root["mdc"] = 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;
/******/
/******/ // 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 = 23);
/******/ })
/************************************************************************/
/******/ ([
/* 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"); } }
/**
* @license
* 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";
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__(2);
/* 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"]; });
/**
* @license
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/***/ }),
/* 2 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"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"); } }
/**
* @license
* 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);
/***/ }),
/* 3 */
/***/ (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__(2);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__adapter__ = __webpack_require__(13);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__foundation__ = __webpack_require__(26);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__util__ = __webpack_require__(6);
/* 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; }
/**
* @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.
*/
/**
* @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;
/***/ }),
/* 4 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCSelectionControlState", function() { return MDCSelectionControlState; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MDCSelectionControl", function() { return MDCSelectionControl; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__material_ripple__ = __webpack_require__(3);
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"); } }
/**
* @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.
*/
/* eslint-disable no-unused-vars */
/* eslint-enable no-unused-vars */
/**
* @typedef {!{
* checked: boolean,
* indeterminate: boolean,
* disabled: boolean,
* value: ?string
* }}
*/
var MDCSelectionControlState = void 0;
/**
* @record
*/
var MDCSelectionControl = function () {
function MDCSelectionControl() {
_classCallCheck(this, MDCSelectionControl);
}
_createClass(MDCSelectionControl, [{
key: 'ripple',
/** @return {?MDCRipple} */
get: function get() {}
}]);
return MDCSelectionControl;
}();
/***/ }),
/* 5 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return transformStyleProperties; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getCorrectEventName; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getCorrectPropertyName; });
/**
* @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.
*/
/**
* @typedef {{
* noPrefix: string,
* webkitPrefix: string,
* styleProperty: string
* }}
*/
var VendorPropertyMapType = void 0;
/** @const {Object<string, !VendorPropertyMapType>} */
var eventTypeMap = {
'animationstart': {
noPrefix: 'animationstart',
webkitPrefix: 'webkitAnimationStart',
styleProperty: 'animation'
},
'animationend': {
noPrefix: 'animationend',
webkitPrefix: 'webkitAnimationEnd',
styleProperty: 'animation'
},
'animationiteration': {
noPrefix: 'animationiteration',
webkitPrefix: 'webkitAnimationIteration',
styleProperty: 'animation'
},
'transitionend': {
noPrefix: 'transitionend',
webkitPrefix: 'webkitTransitionEnd',
styleProperty: 'transition'
}
};
/** @const {Object<string, !VendorPropertyMapType>} */
var cssPropertyMap = {
'animation': {
noPrefix: 'animation',
webkitPrefix: '-webkit-animation'
},
'transform': {
noPrefix: 'transform',
webkitPrefix: '-webkit-transform'
},
'transition': {
noPrefix: 'transition',
webkitPrefix: '-webkit-transition'
}
};
/**
* @param {!Object} windowObj
* @return {boolean}
*/
function hasProperShape(windowObj) {
return windowObj['document'] !== undefined && typeof windowObj['document']['createElement'] === 'function';
}
/**
* @param {string} eventType
* @return {boolean}
*/
function eventFoundInMaps(eventType) {
return eventType in eventTypeMap || eventType in cssPropertyMap;
}
/**
* @param {string} eventType
* @param {!Object<string, !VendorPropertyMapType>} map
* @param {!Element} el
* @return {string}
*/
function getJavaScriptEventName(eventType, map, el) {
return map[eventType].styleProperty in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix;
}
/**
* Helper function to determine browser prefix for CSS3 animation events
* and property names.
* @param {!Object} windowObj
* @param {string} eventType
* @return {string}
*/
function getAnimationName(windowObj, eventType) {
if (!hasProperShape(windowObj) || !eventFoundInMaps(eventType)) {
return eventType;
}
var map = /** @type {!Object<string, !VendorPropertyMapType>} */eventType in eventTypeMap ? eventTypeMap : cssPropertyMap;
var el = windowObj['document']['createElement']('div');
var eventName = '';
if (map === eventTypeMap) {
eventName = getJavaScriptEventName(eventType, map, el);
} else {
eventName = map[eventType].noPrefix in el.style ? map[eventType].noPrefix : map[eventType].webkitPrefix;
}
return eventName;
}
// Public functions to access getAnimationName() for JavaScript events or CSS
// property names.
var transformStyleProperties = ['transform', 'WebkitTransform', 'MozTransform', 'OTransform', 'MSTransform'];
/**
* @param {!Object} windowObj
* @param {string} eventType
* @return {string}
*/
function getCorrectEventName(windowObj, eventType) {
return getAnimationName(windowObj, eventType);
}
/**
* @param {!Object} windowObj
* @param {string} eventType
* @return {string}
*/
function getCorrectPropertyName(windowObj, eventType) {
return getAnimationName(windowObj, eventType);
}
/***/ }),
/* 6 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "supportsCssVariables", function() { return supportsCssVariables; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "applyPassive", function() { return applyPassive; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getMatchesProperty", function() { return getMatchesProperty; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNormalizedEventCoords", function() { return getNormalizedEventCoords; });
/**
* @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.
*/
/**
* 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 node = document.createElement('div');
node.className = 'mdc-ripple-surface--test-edge-var-bug';
document.body.appendChild(node);
// The bug exists if ::before style ends up propagating to the parent element.
// Additionally, getComputedStyle returns null in iframes with display: "none" in Firefox,
// but Firefox is known to support CSS custom properties correctly.
// See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397
var computedStyle = windowObj.getComputedStyle(node);
var hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid';
node.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 };
}
/***/ }),
/* 7 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constants__ = __webpack_require__(40);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__constants__["a"]; });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__foundation__ = __webpack_require__(41);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_1__foundation__["a"]; });
/**
* 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.
*/
/***/ }),
/* 8 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony export (immutable) */ __webpack_exports__["remapEvent"] = remapEvent;
/* harmony export (immutable) */ __webpack_exports__["getTransformPropertyName"] = getTransformPropertyName;
/* harmony export (immutable) */ __webpack_exports__["supportsCssCustomProperties"] = supportsCssCustomProperties;
/* harmony export (immutable) */ __webpack_exports__["applyPassive"] = applyPassive;
/* harmony export (immutable) */ __webpack_exports__["saveElementTabState"] = saveElementTabState;
/* harmony export (immutable) */ __webpack_exports__["restoreElementTabState"] = restoreElementTabState;
/**
* 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 TAB_DATA = 'data-mdc-tabindex';
var TAB_DATA_HANDLED = 'data-mdc-tabindex-handled';
var storedTransformPropertyName_ = void 0;
var supportsPassive_ = void 0;
// Remap touch events to pointer events, if the browser doesn't support touch events.
function remapEvent(eventName) {
var globalObj = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window;
if (!('ontouchstart' in globalObj.document)) {
switch (eventName) {
case 'touchstart':
return 'pointerdown';
case 'touchmove':
return 'pointermove';
case 'touchend':
return 'pointerup';
default:
return eventName;
}
}
return eventName;
}
// Choose the correct transform property to use on the current browser.
function getTransformPropertyName() {
var globalObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
var forceRefresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (storedTransformPropertyName_ === undefined || forceRefresh) {
var el = globalObj.document.createElement('div');
var transformPropertyName = 'transform' in el.style ? 'transform' : '-webkit-transform';
storedTransformPropertyName_ = transformPropertyName;
}
return storedTransformPropertyName_;
}
// Determine whether the current browser supports CSS properties.
function supportsCssCustomProperties() {
var globalObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
if ('CSS' in globalObj) {
return globalObj.CSS.supports('(--color: red)');
}
return false;
}
// Determine whether the current browser supports passive event listeners, and if so, use them.
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;
}
// Save the tab state for an element.
function saveElementTabState(el) {
if (el.hasAttribute('tabindex')) {
el.setAttribute(TAB_DATA, el.getAttribute('tabindex'));
}
el.setAttribute(TAB_DATA_HANDLED, true);
}
// Restore the tab state for an element, if it was saved.
function restoreElementTabState(el) {
// Only modify elements we've already handled, in case anything was dynamically added since we saved state.
if (el.hasAttribute(TAB_DATA_HANDLED)) {
if (el.hasAttribute(TAB_DATA)) {
el.setAttribute('tabindex', el.getAttribute(TAB_DATA));
el.removeAttribute(TAB_DATA);
} else {
el.removeAttribute('tabindex');
}
el.removeAttribute(TAB_DATA_HANDLED);
}
}
/***/ }),
/* 9 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__util__ = __webpack_require__(10);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__simple__ = __webpack_require__(60);
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MDCSimpleMenu", function() { return __WEBPACK_IMPORTED_MODULE_1__simple__["a"]; });
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "MDCSimpleMenuFoundation", function() { return __WEBPACK_IMPORTED_MODULE_1__simple__["b"]; });
/* harmony reexport (module object) */ __webpack_require__.d(__webpack_exports__, "util", function() { return __WEBPACK_IMPORTED_MODULE_0__util__; });
/**
* @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.
*/
/***/ }),
/* 10 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getTransformPropertyName", function() { return getTransformPropertyName; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "clamp", function() { return clamp; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bezierProgress", function() { return bezierProgress; });
/**
* 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.
*/
/** @type {string|undefined} */
var storedTransformPropertyName_ = void 0;
/**
* Returns the name of the correct transform property to use on the current browser.
* @param {!Window} globalObj
* @param {boolean=} forceRefresh
* @return {string}
*/
function getTransformPropertyName(globalObj) {
var forceRefresh = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
if (storedTransformPropertyName_ === undefined || forceRefresh) {
var el = globalObj.document.createElement('div');
var transformPropertyName = 'transform' in el.style ? 'transform' : 'webkitTransform';
storedTransformPropertyName_ = transformPropertyName;
}
return storedTransformPropertyName_;
}
/**
* Clamps a value between the minimum and the maximum, returning the clamped value.
* @param {number} value
* @param {number} min
* @param {number} max
* @return {number}
*/
function clamp(value) {
var min = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var max = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
return Math.min(max, Math.max(min, value));
}
/**
* Returns the easing value to apply at time t, for a given cubic bezier curve.
* Control points P0 and P3 are assumed to be (0,0) and (1,1), respectively.
* Parameters are as follows:
* - time: The current time in the animation, scaled between 0 and 1.
* - x1: The x value of control point P1.
* - y1: The y value of control point P1.
* - x2: The x value of control point P2.
* - y2: The y value of control point P2.
* @param {number} time
* @param {number} x1
* @param {number} y1
* @param {number} x2
* @param {number} y2
* @return {number}
*/
function bezierProgress(time, x1, y1, x2, y2) {
return getBezierCoordinate_(solvePositionFromXValue_(time, x1, x2), y1, y2);
}
/**
* Compute a single coordinate at a position point between 0 and 1.
* c1 and c2 are the matching coordinate on control points P1 and P2, respectively.
* Control points P0 and P3 are assumed to be (0,0) and (1,1), respectively.
* Adapted from https://github.com/google/closure-library/blob/master/closure/goog/math/bezier.js.
* @param {number} t
* @param {number} c1
* @param {number} c2
* @return {number}
*/
function getBezierCoordinate_(t, c1, c2) {
// Special case start and end.
if (t === 0 || t === 1) {
return t;
}
// Step one - from 4 points to 3
var ic0 = t * c1;
var ic1 = c1 + t * (c2 - c1);
var ic2 = c2 + t * (1 - c2);
// Step two - from 3 points to 2
ic0 += t * (ic1 - ic0);
ic1 += t * (ic2 - ic1);
// Final step - last point
return ic0 + t * (ic1 - ic0);
}
/**
* Project a point onto the Bezier curve, from a given X. Calculates the position t along the curve.
* Adapted from https://github.com/google/closure-library/blob/master/closure/goog/math/bezier.js.
* @param {number} xVal
* @param {number} x1
* @param {number} x2
* @return {number}
*/
function solvePositionFromXValue_(xVal, x1, x2) {
var EPSILON = 1e-6;
var MAX_ITERATIONS = 8;
if (xVal <= 0) {
return 0;
} else if (xVal >= 1) {
return 1;
}
// Initial estimate of t using linear interpolation.
var t = xVal;
// Try gradient descent to solve for t. If it works, it is very fast.
var tMin = 0;
var tMax = 1;
var value = 0;
for (var i = 0; i < MAX_ITERATIONS; i++) {
value = getBezierCoordinate_(t, x1, x2);
var derivative = (getBezierCoordinate_(t + EPSILON, x1, x2) - value) / EPSILON;
if (Math.abs(value - xVal) < EPSILON) {
return t;
} else if (Math.abs(derivative) < EPSILON) {
break;
} else {
if (value < xVal) {
tMin = t;
} else {
tMax = t;
}
t -= (value - xVal) / derivative;
}
}
// If the gradient descent got stuck in a local minimum, e.g. because
// the derivative was close to 0, use a Dichotomy refinement instead.
// We limit the number of interations to 8.
for (var _i = 0; Math.abs(value - xVal) > EPSILON && _i < MAX_ITERATIONS; _i++) {
if (value < xVal) {
tMin = t;
t = (t + tMax) / 2;
} else {
tMax = t;
t = (t + tMin) / 2;
}
value = getBezierCoordinate_(t, x1, x2);
}
return t;
}
/***/ }),
/* 11 */
/***/ (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__(21);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__constants__ = __webpack_require__(83);
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; }
/**
* @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, ei