UNPKG

@material/icon-button

Version:
1,182 lines (1,124 loc) • 83.8 kB
/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://github.com/material-components/material-components-web/blob/master/LICENSE */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define("@material/icon-button", [], factory); else if(typeof exports === 'object') exports["icon-button"] = factory(); else root["mdc"] = root["mdc"] || {}, root["mdc"]["icon-button"] = 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, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = "./packages/mdc-icon-button/index.ts"); /******/ }) /************************************************************************/ /******/ ({ /***/ "./packages/mdc-base/component.ts": /*!****************************************!*\ !*** ./packages/mdc-base/component.ts ***! \****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var __read = this && this.__read || function (o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) { ar.push(r.value); } } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; }; var __spreadArray = this && this.__spreadArray || function (to, from) { for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) { to[j] = from[i]; }return to; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.MDCComponent = void 0; var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-base/foundation.ts"); var MDCComponent = /** @class */function () { function MDCComponent(root, foundation) { var args = []; for (var _i = 2; _i < arguments.length; _i++) { args[_i - 2] = arguments[_i]; } this.root = root; this.initialize.apply(this, __spreadArray([], __read(args))); // Note that we initialize foundation here and not within the constructor's // default param so that this.root is defined and can be used within the // foundation class. this.foundation = foundation === undefined ? this.getDefaultFoundation() : foundation; this.foundation.init(); this.initialSyncWithDOM(); } MDCComponent.attachTo = function (root) { // Subclasses which extend MDCBase should provide an attachTo() method that takes a root element and // returns an instantiated component with its root set to that element. Also note that in the cases of // subclasses, an explicit foundation class will not have to be passed in; it will simply be initialized // from getDefaultFoundation(). return new MDCComponent(root, new foundation_1.MDCFoundation({})); }; /* istanbul ignore next: method param only exists for typing purposes; it does not need to be unit tested */ MDCComponent.prototype.initialize = function () { var _args = []; for (var _i = 0; _i < arguments.length; _i++) { _args[_i] = arguments[_i]; } // Subclasses can override this to do any additional setup work that would be considered part of a // "constructor". Essentially, it is a hook into the parent constructor before the foundation is // initialized. Any additional arguments besides root and foundation will be passed in here. }; MDCComponent.prototype.getDefaultFoundation = function () { // Subclasses must override this method to return a properly configured foundation class for the // component. throw new Error('Subclasses must override getDefaultFoundation to return a properly configured ' + 'foundation class'); }; MDCComponent.prototype.initialSyncWithDOM = function () { // Subclasses should override this method if they need to perform work to synchronize with a host DOM // object. An example of this would be a form control wrapper that needs to synchronize its internal state // to some property or attribute of the host DOM. Please note: this is *not* the place to perform DOM // reads/writes that would cause layout / paint, as this is called synchronously from within the constructor. }; MDCComponent.prototype.destroy = function () { // Subclasses may implement this method to release any resources / deregister any listeners they have // attached. An example of this might be deregistering a resize event from the window object. this.foundation.destroy(); }; MDCComponent.prototype.listen = function (evtType, handler, options) { this.root.addEventListener(evtType, handler, options); }; MDCComponent.prototype.unlisten = function (evtType, handler, options) { this.root.removeEventListener(evtType, handler, options); }; /** * Fires a cross-browser-compatible custom event from the component root of the given type, with the given data. */ MDCComponent.prototype.emit = function (evtType, evtData, shouldBubble) { if (shouldBubble === void 0) { shouldBubble = false; } var evt; if (typeof CustomEvent === 'function') { evt = new CustomEvent(evtType, { bubbles: shouldBubble, detail: evtData }); } else { evt = document.createEvent('CustomEvent'); evt.initCustomEvent(evtType, shouldBubble, false, evtData); } this.root.dispatchEvent(evt); }; return MDCComponent; }(); exports.MDCComponent = MDCComponent; // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. exports.default = MDCComponent; /***/ }), /***/ "./packages/mdc-base/foundation.ts": /*!*****************************************!*\ !*** ./packages/mdc-base/foundation.ts ***! \*****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.MDCFoundation = void 0; var MDCFoundation = /** @class */function () { function MDCFoundation(adapter) { if (adapter === void 0) { adapter = {}; } this.adapter = adapter; } Object.defineProperty(MDCFoundation, "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 {}; }, enumerable: false, configurable: true }); Object.defineProperty(MDCFoundation, "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 {}; }, enumerable: false, configurable: true }); Object.defineProperty(MDCFoundation, "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 {}; }, enumerable: false, configurable: true }); Object.defineProperty(MDCFoundation, "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 {}; }, enumerable: false, configurable: true }); MDCFoundation.prototype.init = function () { // Subclasses should override this method to perform initialization routines (registering events, etc.) }; MDCFoundation.prototype.destroy = function () { // Subclasses should override this method to perform de-initialization routines (de-registering events, etc.) }; return MDCFoundation; }(); exports.MDCFoundation = MDCFoundation; // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. exports.default = MDCFoundation; /***/ }), /***/ "./packages/mdc-dom/events.ts": /*!************************************!*\ !*** ./packages/mdc-dom/events.ts ***! \************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.applyPassive = void 0; /** * Determine whether the current browser supports passive event listeners, and * if so, use them. */ function applyPassive(globalObj) { if (globalObj === void 0) { globalObj = window; } return supportsPassiveOption(globalObj) ? { passive: true } : false; } exports.applyPassive = applyPassive; function supportsPassiveOption(globalObj) { if (globalObj === void 0) { globalObj = window; } // See // https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener var passiveSupported = false; try { var options = { // This function will be called when the browser // attempts to access the passive property. get passive() { passiveSupported = true; return false; } }; var handler = function handler() {}; globalObj.document.addEventListener('test', handler, options); globalObj.document.removeEventListener('test', handler, options); } catch (err) { passiveSupported = false; } return passiveSupported; } /***/ }), /***/ "./packages/mdc-dom/ponyfill.ts": /*!**************************************!*\ !*** ./packages/mdc-dom/ponyfill.ts ***! \**************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.estimateScrollWidth = exports.matches = exports.closest = void 0; /** * @fileoverview A "ponyfill" is a polyfill that doesn't modify the global prototype chain. * This makes ponyfills safer than traditional polyfills, especially for libraries like MDC. */ function closest(element, selector) { if (element.closest) { return element.closest(selector); } var el = element; while (el) { if (matches(el, selector)) { return el; } el = el.parentElement; } return null; } exports.closest = closest; function matches(element, selector) { var nativeMatches = element.matches || element.webkitMatchesSelector || element.msMatchesSelector; return nativeMatches.call(element, selector); } exports.matches = matches; /** * Used to compute the estimated scroll width of elements. When an element is * hidden due to display: none; being applied to a parent element, the width is * returned as 0. However, the element will have a true width once no longer * inside a display: none context. This method computes an estimated width when * the element is hidden or returns the true width when the element is visble. * @param {Element} element the element whose width to estimate */ function estimateScrollWidth(element) { // Check the offsetParent. If the element inherits display: none from any // parent, the offsetParent property will be null (see // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent). // This check ensures we only clone the node when necessary. var htmlEl = element; if (htmlEl.offsetParent !== null) { return htmlEl.scrollWidth; } var clone = htmlEl.cloneNode(true); clone.style.setProperty('position', 'absolute'); clone.style.setProperty('transform', 'translate(-9999px, -9999px)'); document.documentElement.appendChild(clone); var scrollWidth = clone.scrollWidth; document.documentElement.removeChild(clone); return scrollWidth; } exports.estimateScrollWidth = estimateScrollWidth; /***/ }), /***/ "./packages/mdc-icon-button/adapter.ts": /*!*********************************************!*\ !*** ./packages/mdc-icon-button/adapter.ts ***! \*********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ Object.defineProperty(exports, "__esModule", { value: true }); /***/ }), /***/ "./packages/mdc-icon-button/component.ts": /*!***********************************************!*\ !*** ./packages/mdc-icon-button/component.ts ***! \***********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var __extends = this && this.__extends || function () { var _extendStatics = function extendStatics(d, b) { _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; } || function (d, b) { for (var p in b) { if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); Object.defineProperty(exports, "__esModule", { value: true }); exports.MDCIconButtonToggle = void 0; var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-icon-button/foundation.ts"); var strings = foundation_1.MDCIconButtonToggleFoundation.strings; var MDCIconButtonToggle = /** @class */function (_super) { __extends(MDCIconButtonToggle, _super); function MDCIconButtonToggle() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.rippleComponent = _this.createRipple(); return _this; } MDCIconButtonToggle.attachTo = function (root) { return new MDCIconButtonToggle(root); }; MDCIconButtonToggle.prototype.initialSyncWithDOM = function () { var _this = this; this.handleClick = function () { _this.foundation.handleClick(); }; this.listen('click', this.handleClick); }; MDCIconButtonToggle.prototype.destroy = function () { this.unlisten('click', this.handleClick); this.ripple.destroy(); _super.prototype.destroy.call(this); }; MDCIconButtonToggle.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = { addClass: function addClass(className) { return _this.root.classList.add(className); }, hasClass: function hasClass(className) { return _this.root.classList.contains(className); }, notifyChange: function notifyChange(evtData) { _this.emit(strings.CHANGE_EVENT, evtData); }, removeClass: function removeClass(className) { return _this.root.classList.remove(className); }, getAttr: function getAttr(attrName) { return _this.root.getAttribute(attrName); }, setAttr: function setAttr(attrName, attrValue) { return _this.root.setAttribute(attrName, attrValue); } }; return new foundation_1.MDCIconButtonToggleFoundation(adapter); }; Object.defineProperty(MDCIconButtonToggle.prototype, "ripple", { get: function get() { return this.rippleComponent; }, enumerable: false, configurable: true }); Object.defineProperty(MDCIconButtonToggle.prototype, "on", { get: function get() { return this.foundation.isOn(); }, set: function set(isOn) { this.foundation.toggle(isOn); }, enumerable: false, configurable: true }); MDCIconButtonToggle.prototype.createRipple = function () { var ripple = new component_2.MDCRipple(this.root); ripple.unbounded = true; return ripple; }; return MDCIconButtonToggle; }(component_1.MDCComponent); exports.MDCIconButtonToggle = MDCIconButtonToggle; /***/ }), /***/ "./packages/mdc-icon-button/constants.ts": /*!***********************************************!*\ !*** ./packages/mdc-icon-button/constants.ts ***! \***********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.strings = exports.cssClasses = void 0; exports.cssClasses = { ICON_BUTTON_ON: 'mdc-icon-button--on', ROOT: 'mdc-icon-button' }; exports.strings = { ARIA_LABEL: 'aria-label', ARIA_PRESSED: 'aria-pressed', DATA_ARIA_LABEL_OFF: 'data-aria-label-off', DATA_ARIA_LABEL_ON: 'data-aria-label-on', CHANGE_EVENT: 'MDCIconButtonToggle:change' }; /***/ }), /***/ "./packages/mdc-icon-button/foundation.ts": /*!************************************************!*\ !*** ./packages/mdc-icon-button/foundation.ts ***! \************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2018 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var __extends = this && this.__extends || function () { var _extendStatics = function extendStatics(d, b) { _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; } || function (d, b) { for (var p in b) { if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); var __assign = this && this.__assign || function () { __assign = Object.assign || function (t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) { if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } } return t; }; return __assign.apply(this, arguments); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.MDCIconButtonToggleFoundation = void 0; var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-icon-button/constants.ts"); var MDCIconButtonToggleFoundation = /** @class */function (_super) { __extends(MDCIconButtonToggleFoundation, _super); function MDCIconButtonToggleFoundation(adapter) { var _this = _super.call(this, __assign(__assign({}, MDCIconButtonToggleFoundation.defaultAdapter), adapter)) || this; /** * Whether the icon button has an aria label that changes depending on * toggled state. */ _this.hasToggledAriaLabel = false; return _this; } Object.defineProperty(MDCIconButtonToggleFoundation, "cssClasses", { get: function get() { return constants_1.cssClasses; }, enumerable: false, configurable: true }); Object.defineProperty(MDCIconButtonToggleFoundation, "strings", { get: function get() { return constants_1.strings; }, enumerable: false, configurable: true }); Object.defineProperty(MDCIconButtonToggleFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, hasClass: function hasClass() { return false; }, notifyChange: function notifyChange() { return undefined; }, removeClass: function removeClass() { return undefined; }, getAttr: function getAttr() { return null; }, setAttr: function setAttr() { return undefined; } }; }, enumerable: false, configurable: true }); MDCIconButtonToggleFoundation.prototype.init = function () { var ariaLabelOn = this.adapter.getAttr(constants_1.strings.DATA_ARIA_LABEL_ON); var ariaLabelOff = this.adapter.getAttr(constants_1.strings.DATA_ARIA_LABEL_OFF); if (ariaLabelOn && ariaLabelOff) { if (this.adapter.getAttr(constants_1.strings.ARIA_PRESSED) !== null) { throw new Error('MDCIconButtonToggleFoundation: Button should not set ' + '`aria-pressed` if it has a toggled aria label.'); } this.hasToggledAriaLabel = true; } else { this.adapter.setAttr(constants_1.strings.ARIA_PRESSED, String(this.isOn())); } }; MDCIconButtonToggleFoundation.prototype.handleClick = function () { this.toggle(); this.adapter.notifyChange({ isOn: this.isOn() }); }; MDCIconButtonToggleFoundation.prototype.isOn = function () { return this.adapter.hasClass(constants_1.cssClasses.ICON_BUTTON_ON); }; MDCIconButtonToggleFoundation.prototype.toggle = function (isOn) { if (isOn === void 0) { isOn = !this.isOn(); } // Toggle UI based on state. if (isOn) { this.adapter.addClass(constants_1.cssClasses.ICON_BUTTON_ON); } else { this.adapter.removeClass(constants_1.cssClasses.ICON_BUTTON_ON); } // Toggle aria attributes based on state. if (this.hasToggledAriaLabel) { var ariaLabel = isOn ? this.adapter.getAttr(constants_1.strings.DATA_ARIA_LABEL_ON) : this.adapter.getAttr(constants_1.strings.DATA_ARIA_LABEL_OFF); this.adapter.setAttr(constants_1.strings.ARIA_LABEL, ariaLabel || ''); } else { this.adapter.setAttr(constants_1.strings.ARIA_PRESSED, "" + isOn); } }; return MDCIconButtonToggleFoundation; }(foundation_1.MDCFoundation); exports.MDCIconButtonToggleFoundation = MDCIconButtonToggleFoundation; // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. exports.default = MDCIconButtonToggleFoundation; /***/ }), /***/ "./packages/mdc-icon-button/index.ts": /*!*******************************************!*\ !*** ./packages/mdc-icon-button/index.ts ***! \*******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function get() { return m[k]; } }); } : function (o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); var __exportStar = this && this.__exportStar || function (m, exports) { for (var p in m) { if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); } }; Object.defineProperty(exports, "__esModule", { value: true }); __exportStar(__webpack_require__(/*! ./adapter */ "./packages/mdc-icon-button/adapter.ts"), exports); __exportStar(__webpack_require__(/*! ./component */ "./packages/mdc-icon-button/component.ts"), exports); __exportStar(__webpack_require__(/*! ./constants */ "./packages/mdc-icon-button/constants.ts"), exports); __exportStar(__webpack_require__(/*! ./foundation */ "./packages/mdc-icon-button/foundation.ts"), exports); __exportStar(__webpack_require__(/*! ./types */ "./packages/mdc-icon-button/types.ts"), exports); /***/ }), /***/ "./packages/mdc-icon-button/types.ts": /*!*******************************************!*\ !*** ./packages/mdc-icon-button/types.ts ***! \*******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2019 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ Object.defineProperty(exports, "__esModule", { value: true }); /***/ }), /***/ "./packages/mdc-ripple/component.ts": /*!******************************************!*\ !*** ./packages/mdc-ripple/component.ts ***! \******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ var __extends = this && this.__extends || function () { var _extendStatics = function extendStatics(d, b) { _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; } || function (d, b) { for (var p in b) { if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function get() { return m[k]; } }); } : function (o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; }); var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); } : function (o, v) { o["default"] = v; }); var __importStar = this && this.__importStar || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) { if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); }__setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.MDCRipple = void 0; var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); var events_1 = __webpack_require__(/*! @material/dom/events */ "./packages/mdc-dom/events.ts"); var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-ripple/foundation.ts"); var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-ripple/util.ts")); var MDCRipple = /** @class */function (_super) { __extends(MDCRipple, _super); function MDCRipple() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.disabled = false; return _this; } MDCRipple.attachTo = function (root, opts) { if (opts === void 0) { opts = { isUnbounded: undefined }; } var ripple = new MDCRipple(root); // Only override unbounded behavior if option is explicitly specified if (opts.isUnbounded !== undefined) { ripple.unbounded = opts.isUnbounded; } return ripple; }; MDCRipple.createAdapter = function (instance) { return { addClass: function addClass(className) { return instance.root.classList.add(className); }, browserSupportsCssVars: function browserSupportsCssVars() { return util.supportsCssVariables(window); }, computeBoundingRect: function computeBoundingRect() { return instance.root.getBoundingClientRect(); }, containsEventTarget: function containsEventTarget(target) { return instance.root.contains(target); }, deregisterDocumentInteractionHandler: function deregisterDocumentInteractionHandler(evtType, handler) { return document.documentElement.removeEventListener(evtType, handler, events_1.applyPassive()); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return instance.root.removeEventListener(evtType, handler, events_1.applyPassive()); }, deregisterResizeHandler: function deregisterResizeHandler(handler) { return window.removeEventListener('resize', handler); }, getWindowPageOffset: function getWindowPageOffset() { return { x: window.pageXOffset, y: window.pageYOffset }; }, isSurfaceActive: function isSurfaceActive() { return ponyfill_1.matches(instance.root, ':active'); }, isSurfaceDisabled: function isSurfaceDisabled() { return Boolean(instance.disabled); }, isUnbounded: function isUnbounded() { return Boolean(instance.unbounded); }, registerDocumentInteractionHandler: function registerDocumentInteractionHandler(evtType, handler) { return document.documentElement.addEventListener(evtType, handler, events_1.applyPassive()); }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return instance.root.addEventListener(evtType, handler, events_1.applyPassive()); }, registerResizeHandler: function registerResizeHandler(handler) { return window.addEventListener('resize', handler); }, removeClass: function removeClass(className) { return instance.root.classList.remove(className); }, updateCssVariable: function updateCssVariable(varName, value) { return instance.root.style.setProperty(varName, value); } }; }; Object.defineProperty(MDCRipple.prototype, "unbounded", { get: function get() { return Boolean(this.isUnbounded); }, set: function set(unbounded) { this.isUnbounded = Boolean(unbounded); this.setUnbounded(); }, enumerable: false, configurable: true }); MDCRipple.prototype.activate = function () { this.foundation.activate(); }; MDCRipple.prototype.deactivate = function () { this.foundation.deactivate(); }; MDCRipple.prototype.layout = function () { this.foundation.layout(); }; MDCRipple.prototype.getDefaultFoundation = function () { return new foundation_1.MDCRippleFoundation(MDCRipple.createAdapter(this)); }; MDCRipple.prototype.initialSyncWithDOM = function () { var root = this.root; this.isUnbounded = 'mdcRippleIsUnbounded' in root.dataset; }; /** * Closure Compiler throws an access control error when directly accessing a * protected or private property inside a getter/setter, like unbounded above. * By accessing the protected property inside a method, we solve that problem. * That's why this function exists. */ MDCRipple.prototype.setUnbounded = function () { this.foundation.setUnbounded(Boolean(this.isUnbounded)); }; return MDCRipple; }(component_1.MDCComponent); exports.MDCRipple = MDCRipple; /***/ }), /***/ "./packages/mdc-ripple/constants.ts": /*!******************************************!*\ !*** ./packages/mdc-ripple/constants.ts ***! \******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2016 Google Inc. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without