/** * @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([], 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, { 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/material-components-web/index.ts"); /******/ }) /************************************************************************/ /******/ ({ /***/ "./packages/material-components-web/index.ts": /*!***************************************************!*\ !*** ./packages/material-components-web/index.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 __importDefault = this && this.__importDefault || function (mod) { return mod && mod.__esModule ? mod : { "default": mod }; }; var __importStar = this && this.__importStar || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) { if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; }result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var index_1 = __importDefault(__webpack_require__(/*! @material/auto-init/index */ "./packages/mdc-auto-init/index.ts")); exports.autoInit = index_1.default; var base = __importStar(__webpack_require__(/*! @material/base/index */ "./packages/mdc-base/index.ts")); exports.base = base; var checkbox = __importStar(__webpack_require__(/*! @material/checkbox/index */ "./packages/mdc-checkbox/index.ts")); exports.checkbox = checkbox; var chips = __importStar(__webpack_require__(/*! @material/chips/index */ "./packages/mdc-chips/index.ts")); exports.chips = chips; var circularProgress = __importStar(__webpack_require__(/*! @material/circular-progress/index */ "./packages/mdc-circular-progress/index.ts")); exports.circularProgress = circularProgress; var dataTable = __importStar(__webpack_require__(/*! @material/data-table/index */ "./packages/mdc-data-table/index.ts")); exports.dataTable = dataTable; var dialog = __importStar(__webpack_require__(/*! @material/dialog/index */ "./packages/mdc-dialog/index.ts")); exports.dialog = dialog; var dom = __importStar(__webpack_require__(/*! @material/dom/index */ "./packages/mdc-dom/index.ts")); exports.dom = dom; var drawer = __importStar(__webpack_require__(/*! @material/drawer/index */ "./packages/mdc-drawer/index.ts")); exports.drawer = drawer; var floatingLabel = __importStar(__webpack_require__(/*! @material/floating-label/index */ "./packages/mdc-floating-label/index.ts")); exports.floatingLabel = floatingLabel; var formField = __importStar(__webpack_require__(/*! @material/form-field/index */ "./packages/mdc-form-field/index.ts")); exports.formField = formField; var iconButton = __importStar(__webpack_require__(/*! @material/icon-button/index */ "./packages/mdc-icon-button/index.ts")); exports.iconButton = iconButton; var lineRipple = __importStar(__webpack_require__(/*! @material/line-ripple/index */ "./packages/mdc-line-ripple/index.ts")); exports.lineRipple = lineRipple; var linearProgress = __importStar(__webpack_require__(/*! @material/linear-progress/index */ "./packages/mdc-linear-progress/index.ts")); exports.linearProgress = linearProgress; var list = __importStar(__webpack_require__(/*! @material/list/index */ "./packages/mdc-list/index.ts")); exports.list = list; var menuSurface = __importStar(__webpack_require__(/*! @material/menu-surface/index */ "./packages/mdc-menu-surface/index.ts")); exports.menuSurface = menuSurface; var menu = __importStar(__webpack_require__(/*! @material/menu/index */ "./packages/mdc-menu/index.ts")); exports.menu = menu; var notchedOutline = __importStar(__webpack_require__(/*! @material/notched-outline/index */ "./packages/mdc-notched-outline/index.ts")); exports.notchedOutline = notchedOutline; var radio = __importStar(__webpack_require__(/*! @material/radio/index */ "./packages/mdc-radio/index.ts")); exports.radio = radio; var ripple = __importStar(__webpack_require__(/*! @material/ripple/index */ "./packages/mdc-ripple/index.ts")); exports.ripple = ripple; var select = __importStar(__webpack_require__(/*! @material/select/index */ "./packages/mdc-select/index.ts")); exports.select = select; var slider = __importStar(__webpack_require__(/*! @material/slider/index */ "./packages/mdc-slider/index.ts")); exports.slider = slider; var snackbar = __importStar(__webpack_require__(/*! @material/snackbar/index */ "./packages/mdc-snackbar/index.ts")); exports.snackbar = snackbar; var switchControl = __importStar(__webpack_require__(/*! @material/switch/index */ "./packages/mdc-switch/index.ts")); exports.switchControl = switchControl; var tabBar = __importStar(__webpack_require__(/*! @material/tab-bar/index */ "./packages/mdc-tab-bar/index.ts")); exports.tabBar = tabBar; var tabIndicator = __importStar(__webpack_require__(/*! @material/tab-indicator/index */ "./packages/mdc-tab-indicator/index.ts")); exports.tabIndicator = tabIndicator; var tabScroller = __importStar(__webpack_require__(/*! @material/tab-scroller/index */ "./packages/mdc-tab-scroller/index.ts")); exports.tabScroller = tabScroller; var tab = __importStar(__webpack_require__(/*! @material/tab/index */ "./packages/mdc-tab/index.ts")); exports.tab = tab; var textField = __importStar(__webpack_require__(/*! @material/textfield/index */ "./packages/mdc-textfield/index.ts")); exports.textField = textField; var topAppBar = __importStar(__webpack_require__(/*! @material/top-app-bar/index */ "./packages/mdc-top-app-bar/index.ts")); exports.topAppBar = topAppBar; // Register all components index_1.default.register('MDCCheckbox', checkbox.MDCCheckbox); index_1.default.register('MDCChip', chips.MDCChip); index_1.default.register('MDCChipSet', chips.MDCChipSet); index_1.default.register('MDCCircularProgress', circularProgress.MDCCircularProgress); index_1.default.register('MDCDataTable', dataTable.MDCDataTable); index_1.default.register('MDCDialog', dialog.MDCDialog); index_1.default.register('MDCDrawer', drawer.MDCDrawer); index_1.default.register('MDCFloatingLabel', floatingLabel.MDCFloatingLabel); index_1.default.register('MDCFormField', formField.MDCFormField); index_1.default.register('MDCIconButtonToggle', iconButton.MDCIconButtonToggle); index_1.default.register('MDCLineRipple', lineRipple.MDCLineRipple); index_1.default.register('MDCLinearProgress', linearProgress.MDCLinearProgress); index_1.default.register('MDCList', list.MDCList); index_1.default.register('MDCMenu', menu.MDCMenu); index_1.default.register('MDCMenuSurface', menuSurface.MDCMenuSurface); index_1.default.register('MDCNotchedOutline', notchedOutline.MDCNotchedOutline); index_1.default.register('MDCRadio', radio.MDCRadio); index_1.default.register('MDCRipple', ripple.MDCRipple); index_1.default.register('MDCSelect', select.MDCSelect); index_1.default.register('MDCSlider', slider.MDCSlider); index_1.default.register('MDCSnackbar', snackbar.MDCSnackbar); index_1.default.register('MDCSwitch', switchControl.MDCSwitch); index_1.default.register('MDCTabBar', tabBar.MDCTabBar); index_1.default.register('MDCTextField', textField.MDCTextField); index_1.default.register('MDCTopAppBar', topAppBar.MDCTopAppBar); /***/ }), /***/ "./packages/mdc-animation/util.ts": /*!****************************************!*\ !*** ./packages/mdc-animation/util.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 }); var cssPropertyNameMap = { animation: { prefixed: '-webkit-animation', standard: 'animation' }, transform: { prefixed: '-webkit-transform', standard: 'transform' }, transition: { prefixed: '-webkit-transition', standard: 'transition' } }; var jsEventTypeMap = { animationend: { cssProperty: 'animation', prefixed: 'webkitAnimationEnd', standard: 'animationend' }, animationiteration: { cssProperty: 'animation', prefixed: 'webkitAnimationIteration', standard: 'animationiteration' }, animationstart: { cssProperty: 'animation', prefixed: 'webkitAnimationStart', standard: 'animationstart' }, transitionend: { cssProperty: 'transition', prefixed: 'webkitTransitionEnd', standard: 'transitionend' } }; function isWindow(windowObj) { return Boolean(windowObj.document) && typeof windowObj.document.createElement === 'function'; } function getCorrectPropertyName(windowObj, cssProperty) { if (isWindow(windowObj) && cssProperty in cssPropertyNameMap) { var el = windowObj.document.createElement('div'); var _a = cssPropertyNameMap[cssProperty], standard = _a.standard, prefixed = _a.prefixed; var isStandard = standard in el.style; return isStandard ? standard : prefixed; } return cssProperty; } exports.getCorrectPropertyName = getCorrectPropertyName; function getCorrectEventName(windowObj, eventType) { if (isWindow(windowObj) && eventType in jsEventTypeMap) { var el = windowObj.document.createElement('div'); var _a = jsEventTypeMap[eventType], standard = _a.standard, prefixed = _a.prefixed, cssProperty = _a.cssProperty; var isStandard = cssProperty in el.style; return isStandard ? standard : prefixed; } return eventType; } exports.getCorrectEventName = getCorrectEventName; /***/ }), /***/ "./packages/mdc-auto-init/constants.ts": /*!*********************************************!*\ !*** ./packages/mdc-auto-init/constants.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.strings = { AUTO_INIT_ATTR: 'data-mdc-auto-init', AUTO_INIT_STATE_ATTR: 'data-mdc-auto-init-state', INITIALIZED_STATE: 'initialized' }; /***/ }), /***/ "./packages/mdc-auto-init/index.ts": /*!*****************************************!*\ !*** ./packages/mdc-auto-init/index.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 __values = this && this.__values || function (o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function next() { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; Object.defineProperty(exports, "__esModule", { value: true }); var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-auto-init/constants.ts"); var AUTO_INIT_ATTR = constants_1.strings.AUTO_INIT_ATTR, AUTO_INIT_STATE_ATTR = constants_1.strings.AUTO_INIT_STATE_ATTR, INITIALIZED_STATE = constants_1.strings.INITIALIZED_STATE; var registry = {}; var CONSOLE_WARN = console.warn.bind(console); // tslint:disable-line:no-console function emit(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); } document.dispatchEvent(evt); } /* istanbul ignore next: optional argument is not a branch statement */ /** * Auto-initializes all MDC components on a page. */ function mdcAutoInit(root) { var e_1, _a; if (root === void 0) { root = document; } var components = []; var nodes = [].slice.call(root.querySelectorAll("[" + AUTO_INIT_ATTR + "]")); nodes = nodes.filter(function (node) { return node.getAttribute(AUTO_INIT_STATE_ATTR) !== INITIALIZED_STATE; }); try { for (var nodes_1 = __values(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) { var node = nodes_1_1.value; var ctorName = node.getAttribute(AUTO_INIT_ATTR); if (!ctorName) { throw new Error('(mdc-auto-init) Constructor name must be given.'); } var Constructor = registry[ctorName]; // tslint:disable-line:variable-name if (typeof Constructor !== 'function') { throw new Error("(mdc-auto-init) Could not find constructor in registry for " + ctorName); } // TODO: Should we make an eslint rule for an attachTo() static method? // See https://github.com/Microsoft/TypeScript/issues/14600 for discussion of static interface support in TS var component = Constructor.attachTo(node); Object.defineProperty(node, ctorName, { configurable: true, enumerable: false, value: component, writable: false }); components.push(component); node.setAttribute(AUTO_INIT_STATE_ATTR, INITIALIZED_STATE); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1); } finally { if (e_1) throw e_1.error; } } emit('MDCAutoInit:End', {}); return components; } exports.mdcAutoInit = mdcAutoInit; // Constructor is PascalCased because it is a direct reference to a class, rather than an instance of a class. // tslint:disable-next-line:variable-name mdcAutoInit.register = function (componentName, Constructor, warn) { if (warn === void 0) { warn = CONSOLE_WARN; } if (typeof Constructor !== 'function') { throw new Error("(mdc-auto-init) Invalid Constructor value: " + Constructor + ". Expected function."); } var registryValue = registry[componentName]; if (registryValue) { warn("(mdc-auto-init) Overriding registration for " + componentName + " with " + Constructor + ". Was: " + registryValue); } registry[componentName] = Constructor; }; mdcAutoInit.deregister = function (componentName) { delete registry[componentName]; }; /** @nocollapse */ mdcAutoInit.deregisterAll = function () { var keys = Object.keys(registry); keys.forEach(this.deregister, this); }; // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. exports.default = mdcAutoInit; /***/ }), /***/ "./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 __spread = this && this.__spread || function () { for (var ar = [], i = 0; i < arguments.length; i++) { ar = ar.concat(__read(arguments[i])); }return ar; }; Object.defineProperty(exports, "__esModule", { value: true }); 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, __spread(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 }); 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: true, 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: true, 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: true, 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: true, 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-base/index.ts": /*!************************************!*\ !*** ./packages/mdc-base/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. */ function __export(m) { for (var p in m) { if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__(/*! ./component */ "./packages/mdc-base/component.ts")); __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-base/foundation.ts")); /***/ }), /***/ "./packages/mdc-checkbox/component.ts": /*!********************************************!*\ !*** ./packages/mdc-checkbox/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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _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 }); var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts"); 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 component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); var foundation_1 = __webpack_require__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-checkbox/constants.ts"); var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-checkbox/foundation.ts"); var CB_PROTO_PROPS = ['checked', 'indeterminate']; var MDCCheckbox = /** @class */function (_super) { __extends(MDCCheckbox, _super); function MDCCheckbox() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.ripple_ = _this.createRipple_(); return _this; } MDCCheckbox.attachTo = function (root) { return new MDCCheckbox(root); }; Object.defineProperty(MDCCheckbox.prototype, "ripple", { get: function get() { return this.ripple_; }, enumerable: true, configurable: true }); Object.defineProperty(MDCCheckbox.prototype, "checked", { get: function get() { return this.nativeControl_.checked; }, set: function set(checked) { this.nativeControl_.checked = checked; }, enumerable: true, configurable: true }); Object.defineProperty(MDCCheckbox.prototype, "indeterminate", { get: function get() { return this.nativeControl_.indeterminate; }, set: function set(indeterminate) { this.nativeControl_.indeterminate = indeterminate; }, enumerable: true, configurable: true }); Object.defineProperty(MDCCheckbox.prototype, "disabled", { get: function get() { return this.nativeControl_.disabled; }, set: function set(disabled) { this.foundation.setDisabled(disabled); }, enumerable: true, configurable: true }); Object.defineProperty(MDCCheckbox.prototype, "value", { get: function get() { return this.nativeControl_.value; }, set: function set(value) { this.nativeControl_.value = value; }, enumerable: true, configurable: true }); MDCCheckbox.prototype.initialize = function () { var DATA_INDETERMINATE_ATTR = constants_1.strings.DATA_INDETERMINATE_ATTR; this.nativeControl_.indeterminate = this.nativeControl_.getAttribute(DATA_INDETERMINATE_ATTR) === 'true'; this.nativeControl_.removeAttribute(DATA_INDETERMINATE_ATTR); }; MDCCheckbox.prototype.initialSyncWithDOM = function () { var _this = this; this.handleChange_ = function () { return _this.foundation.handleChange(); }; this.handleAnimationEnd_ = function () { return _this.foundation.handleAnimationEnd(); }; this.nativeControl_.addEventListener('change', this.handleChange_); this.listen(util_1.getCorrectEventName(window, 'animationend'), this.handleAnimationEnd_); this.installPropertyChangeHooks_(); }; MDCCheckbox.prototype.destroy = function () { this.ripple_.destroy(); this.nativeControl_.removeEventListener('change', this.handleChange_); this.unlisten(util_1.getCorrectEventName(window, 'animationend'), this.handleAnimationEnd_); this.uninstallPropertyChangeHooks_(); _super.prototype.destroy.call(this); }; MDCCheckbox.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // 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); }, forceLayout: function forceLayout() { return _this.root.offsetWidth; }, hasNativeControl: function hasNativeControl() { return !!_this.nativeControl_; }, isAttachedToDOM: function isAttachedToDOM() { return Boolean(_this.root.parentNode); }, isChecked: function isChecked() { return _this.checked; }, isIndeterminate: function isIndeterminate() { return _this.indeterminate; }, removeClass: function removeClass(className) { _this.root.classList.remove(className); }, removeNativeControlAttr: function removeNativeControlAttr(attr) { _this.nativeControl_.removeAttribute(attr); }, setNativeControlAttr: function setNativeControlAttr(attr, value) { _this.nativeControl_.setAttribute(attr, value); }, setNativeControlDisabled: function setNativeControlDisabled(disabled) { _this.nativeControl_.disabled = disabled; } }; return new foundation_2.MDCCheckboxFoundation(adapter); }; MDCCheckbox.prototype.createRipple_ = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return _this.nativeControl_.removeEventListener(evtType, handler, events_1.applyPassive()); }, isSurfaceActive: function isSurfaceActive() { return ponyfill_1.matches(_this.nativeControl_, ':active'); }, isUnbounded: function isUnbounded() { return true; }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return _this.nativeControl_.addEventListener(evtType, handler, events_1.applyPassive()); } }); return new component_2.MDCRipple(this.root, new foundation_1.MDCRippleFoundation(adapter)); }; MDCCheckbox.prototype.installPropertyChangeHooks_ = function () { var _this = this; var nativeCb = this.nativeControl_; var cbProto = Object.getPrototypeOf(nativeCb); CB_PROTO_PROPS.forEach(function (controlState) { var desc = Object.getOwnPropertyDescriptor(cbProto, controlState); // We have to check for this descriptor, since some browsers (Safari) don't support its return. // See: https://bugs.webkit.org/show_bug.cgi?id=49739 if (!validDescriptor(desc)) { return; } // Type cast is needed for compatibility with Closure Compiler. var nativeGetter = desc.get; var nativeCbDesc = { configurable: desc.configurable, enumerable: desc.enumerable, get: nativeGetter, set: function set(state) { desc.set.call(nativeCb, state); _this.foundation.handleChange(); } }; Object.defineProperty(nativeCb, controlState, nativeCbDesc); }); }; MDCCheckbox.prototype.uninstallPropertyChangeHooks_ = function () { var nativeCb = this.nativeControl_; var cbProto = Object.getPrototypeOf(nativeCb); CB_PROTO_PROPS.forEach(function (controlState) { var desc = Object.getOwnPropertyDescriptor(cbProto, controlState); if (!validDescriptor(desc)) { return; } Object.defineProperty(nativeCb, controlState, desc); }); }; Object.defineProperty(MDCCheckbox.prototype, "nativeControl_", { get: function get() { var NATIVE_CONTROL_SELECTOR = constants_1.strings.NATIVE_CONTROL_SELECTOR; var el = this.root.querySelector(NATIVE_CONTROL_SELECTOR); if (!el) { throw new Error("Checkbox component requires a " + NATIVE_CONTROL_SELECTOR + " element"); } return el; }, enumerable: true, configurable: true }); return MDCCheckbox; }(component_1.MDCComponent); exports.MDCCheckbox = MDCCheckbox; function validDescriptor(inputPropDesc) { return !!inputPropDesc && typeof inputPropDesc.set === 'function'; } /***/ }), /***/ "./packages/mdc-checkbox/constants.ts": /*!********************************************!*\ !*** ./packages/mdc-checkbox/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 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.cssClasses = { ANIM_CHECKED_INDETERMINATE: 'mdc-checkbox--anim-checked-indeterminate', ANIM_CHECKED_UNCHECKED: 'mdc-checkbox--anim-checked-unchecked', ANIM_INDETERMINATE_CHECKED: 'mdc-checkbox--anim-indeterminate-checked', ANIM_INDETERMINATE_UNCHECKED: 'mdc-checkbox--anim-indeterminate-unchecked', ANIM_UNCHECKED_CHECKED: 'mdc-checkbox--anim-unchecked-checked', ANIM_UNCHECKED_INDETERMINATE: 'mdc-checkbox--anim-unchecked-indeterminate', BACKGROUND: 'mdc-checkbox__background', CHECKED: 'mdc-checkbox--checked', CHECKMARK: 'mdc-checkbox__checkmark', CHECKMARK_PATH: 'mdc-checkbox__checkmark-path', DISABLED: 'mdc-checkbox--disabled', INDETERMINATE: 'mdc-checkbox--indeterminate', MIXEDMARK: 'mdc-checkbox__mixedmark', NATIVE_CONTROL: 'mdc-checkbox__native-control', ROOT: 'mdc-checkbox', SELECTED: 'mdc-checkbox--selected', UPGRADED: 'mdc-checkbox--upgraded' }; exports.strings = { ARIA_CHECKED_ATTR: 'aria-checked', ARIA_CHECKED_INDETERMINATE_VALUE: 'mixed', DATA_INDETERMINATE_ATTR: 'data-indeterminate', NATIVE_CONTROL_SELECTOR: '.mdc-checkbox__native-control', TRANSITION_STATE_CHECKED: 'checked', TRANSITION_STATE_INDETERMINATE: 'indeterminate', TRANSITION_STATE_INIT: 'init', TRANSITION_STATE_UNCHECKED: 'unchecked' }; exports.numbers = { ANIM_END_LATCH_MS: 250 }; /***/ }), /***/ "./packages/mdc-checkbox/foundation.ts": /*!*********************************************!*\ !*** ./packages/mdc-checkbox/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. */ 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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _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 }); var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-checkbox/constants.ts"); var MDCCheckboxFoundation = /** @class */function (_super) { __extends(MDCCheckboxFoundation, _super); function MDCCheckboxFoundation(adapter) { var _this = _super.call(this, __assign(__assign({}, MDCCheckboxFoundation.defaultAdapter), adapter)) || this; _this.currentCheckState_ = constants_1.strings.TRANSITION_STATE_INIT; _this.currentAnimationClass_ = ''; _this.animEndLatchTimer_ = 0; _this.enableAnimationEndHandler_ = false; return _this; } Object.defineProperty(MDCCheckboxFoundation, "cssClasses", { get: function get() { return constants_1.cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCCheckboxFoundation, "strings", { get: function get() { return constants_1.strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCCheckboxFoundation, "numbers", { get: function get() { return constants_1.numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCCheckboxFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, forceLayout: function forceLayout() { return undefined; }, hasNativeControl: function hasNativeControl() { return false; }, isAttachedToDOM: function isAttachedToDOM() { return false; }, isChecked: function isChecked() { return false; }, isIndeterminate: function isIndeterminate() { return false; }, removeClass: function removeClass() { return undefined; }, removeNativeControlAttr: function removeNativeControlAttr() { return undefined; }, setNativeControlAttr: function setNativeControlAttr() { return undefined; }, setNativeControlDisabled: function setNativeControlDisabled() { return undefined; } }; }, enumerable: true, configurable: true }); MDCCheckboxFoundation.prototype.init = function () { this.currentCheckState_ = this.determineCheckState_(); this.updateAriaChecked_(); this.adapter.addClass(constants_1.cssClasses.UPGRADED); }; MDCCheckboxFoundation.prototype.destroy = function () { clearTimeout(this.animEndLatchTimer_); }; MDCCheckboxFoundation.prototype.setDisabled = function (disabled) { this.adapter.setNativeControlDisabled(disabled); if (disabled) { this.adapter.addClass(constants_1.cssClasses.DISABLED); } else { this.adapter.removeClass(constants_1.cssClasses.DISABLED); } }; /** * Handles the animationend event for the checkbox */ MDCCheckboxFoundation.prototype.handleAnimationEnd = function () { var _this = this; if (!this.enableAnimationEndHandler_) { return; } clearTimeout(this.animEndLatchTimer_); this.animEndLatchTimer_ = setTimeout(function () { _this.adapter.removeClass(_this.currentAnimationClass_); _this.enableAnimationEndHandler_ = false; }, constants_1.numbers.ANIM_END_LATCH_MS); }; /** * Handles the change event for the checkbox */ MDCCheckboxFoundation.prototype.handleChange = function () { this.transitionCheckState_(); }; MDCCheckboxFoundation.prototype.transitionCheckState_ = function () { if (!this.adapter.hasNativeControl()) { return; } var oldState = this.currentCheckState_; var newState = this.determineCheckState_(); if (oldState === newState) { return; } this.updateAriaChecked_(); var TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED; var SELECTED = constants_1.cssClasses.SELECTED; if (newState === TRANSITION_STATE_UNCHECKED) { this.adapter.removeClass(SELECTED); } else { this.adapter.addClass(SELECTED); } // Check to ensure that there isn't a previously existing animation class, in case for example // the user interacted with the checkbox before the animation was finished. if (this.currentAnimationClass_.length > 0) { clearTimeout(this.animEndLatchTimer_); this.adapter.forceLayout(); this.adapter.removeClass(this.currentAnimationClass_); } this.currentAnimationClass_ = this.getTransitionAnimationClass_(oldState, newState); this.currentCheckState_ = newState; // Check for parentNode so that animations are only run when the element is attached // to the DOM. if (this.adapter.isAttachedToDOM() && this.currentAnimationClass_.length > 0) { this.adapter.addClass(this.currentAnimationClass_); this.enableAnimationEndHandler_ = true; } }; MDCCheckboxFoundation.prototype.determineCheckState_ = function () { var TRANSITION_STATE_INDETERMINATE = constants_1.strings.TRANSITION_STATE_INDETERMINATE, TRANSITION_STATE_CHECKED = constants_1.strings.TRANSITION_STATE_CHECKED, TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED; if (this.adapter.isIndeterminate()) { return TRANSITION_STATE_INDETERMINATE; } return this.adapter.isChecked() ? TRANSITION_STATE_CHECKED : TRANSITION_STATE_UNCHECKED; }; MDCCheckboxFoundation.prototype.getTransitionAnimationClass_ = function (oldState, newState) { var TRANSITION_STATE_INIT = constants_1.strings.TRANSITION_STATE_INIT, TRANSITION_STATE_CHECKED = constants_1.strings.TRANSITION_STATE_CHECKED, TRANSITION_STATE_UNCHECKED = constants_1.strings.TRANSITION_STATE_UNCHECKED; var _a = MDCCheckboxFoundation.cssClasses, ANIM_UNCHECKED_CHECKED = _a.ANIM_UNCHECKED_CHECKED, ANIM_UNCHECKED_INDETERMINATE = _a.ANIM_UNCHECKED_INDETERMINATE, ANIM_CHECKED_UNCHECKED = _a.ANIM_CHECKED_UNCHECKED, ANIM_CHECKED_INDETERMINATE = _a.ANIM_CHECKED_INDETERMINATE, ANIM_INDETERMINATE_CHECKED = _a.ANIM_INDETERMINATE_CHECKED, ANIM_INDETERMINATE_UNCHECKED = _a.ANIM_INDETERMINATE_UNCHECKED; switch (oldState) { case TRANSITION_STATE_INIT: if (newState === TRANSITION_STATE_UNCHECKED) { return ''; } return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED; case TRANSITION_STATE_UNCHECKED: return newState === TRANSITION_STATE_CHECKED ? ANIM_UNCHECKED_CHECKED : ANIM_UNCHECKED_INDETERMINATE; case TRANSITION_STATE_CHECKED: return newState === TRANSITION_STATE_UNCHECKED ? ANIM_CHECKED_UNCHECKED : ANIM_CHECKED_INDETERMINATE; default: // TRANSITION_STATE_INDETERMINATE return newState === TRANSITION_STATE_CHECKED ? ANIM_INDETERMINATE_CHECKED : ANIM_INDETERMINATE_UNCHECKED; } }; MDCCheckboxFoundation.prototype.updateAriaChecked_ = function () { // Ensure aria-checked is set to mixed if checkbox is in indeterminate state. if (this.adapter.isIndeterminate()) { this.adapter.setNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR, constants_1.strings.ARIA_CHECKED_INDETERMINATE_VALUE); } else { // The on/off state does not need to keep track of aria-checked, since // the screenreader uses the checked property on the checkbox element. this.adapter.removeNativeControlAttr(constants_1.strings.ARIA_CHECKED_ATTR); } }; return MDCCheckboxFoundation; }(foundation_1.MDCFoundation); exports.MDCCheckboxFoundation = MDCCheckboxFoundation; // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. exports.default = MDCCheckboxFoundation; /***/ }), /***/ "./packages/mdc-checkbox/index.ts": /*!****************************************!*\ !*** ./packages/mdc-checkbox/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. */ function __export(m) { for (var p in m) { if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__(/*! ./component */ "./packages/mdc-checkbox/component.ts")); __export(__webpack_require__(/*! ./constants */ "./packages/mdc-checkbox/constants.ts")); __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-checkbox/foundation.ts")); /***/ }), /***/ "./packages/mdc-chips/chip-set/component.ts": /*!**************************************************!*\ !*** ./packages/mdc-chips/chip-set/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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); Object.defineProperty(exports, "__esModule", { value: true }); var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); var announce_1 = __webpack_require__(/*! @material/dom/announce */ "./packages/mdc-dom/announce.ts"); var component_2 = __webpack_require__(/*! ../chip/component */ "./packages/mdc-chips/chip/component.ts"); var foundation_1 = __webpack_require__(/*! ../chip/foundation */ "./packages/mdc-chips/chip/foundation.ts"); var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-chips/chip-set/foundation.ts"); var _a = foundation_1.MDCChipFoundation.strings, INTERACTION_EVENT = _a.INTERACTION_EVENT, SELECTION_EVENT = _a.SELECTION_EVENT, REMOVAL_EVENT = _a.REMOVAL_EVENT, NAVIGATION_EVENT = _a.NAVIGATION_EVENT; var CHIP_SELECTOR = foundation_2.MDCChipSetFoundation.strings.CHIP_SELECTOR; var idCounter = 0; var MDCChipSet = /** @class */function (_super) { __extends(MDCChipSet, _super); function MDCChipSet() { return _super !== null && _super.apply(this, arguments) || this; } MDCChipSet.attachTo = function (root) { return new MDCChipSet(root); }; Object.defineProperty(MDCChipSet.prototype, "chips", { get: function get() { return this.chips_.slice(); }, enumerable: true, configurable: true }); Object.defineProperty(MDCChipSet.prototype, "selectedChipIds", { /** * @return An array of the IDs of all selected chips. */ get: function get() { return this.foundation.getSelectedChipIds(); }, enumerable: true, configurable: true }); /** * @param chipFactory A function which creates a new MDCChip. */ MDCChipSet.prototype.initialize = function (chipFactory) { if (chipFactory === void 0) { chipFactory = function chipFactory(el) { return new component_2.MDCChip(el); }; } this.chipFactory_ = chipFactory; this.chips_ = this.instantiateChips_(this.chipFactory_); }; MDCChipSet.prototype.initialSyncWithDOM = function () { var _this = this; this.chips_.forEach(function (chip) { if (chip.id && chip.selected) { _this.foundation.select(chip.id); } }); this.handleChipInteraction_ = function (evt) { return _this.foundation.handleChipInteraction(evt.detail); }; this.handleChipSelection_ = function (evt) { return _this.foundation.handleChipSelection(evt.detail); }; this.handleChipRemoval_ = function (evt) { return _this.foundation.handleChipRemoval(evt.detail); }; this.handleChipNavigation_ = function (evt) { return _this.foundation.handleChipNavigation(evt.detail); }; this.listen(INTERACTION_EVENT, this.handleChipInteraction_); this.listen(SELECTION_EVENT, this.handleChipSelection_); this.listen(REMOVAL_EVENT, this.handleChipRemoval_); this.listen(NAVIGATION_EVENT, this.handleChipNavigation_); }; MDCChipSet.prototype.destroy = function () { this.chips_.forEach(function (chip) { chip.destroy(); }); this.unlisten(INTERACTION_EVENT, this.handleChipInteraction_); this.unlisten(SELECTION_EVENT, this.handleChipSelection_); this.unlisten(REMOVAL_EVENT, this.handleChipRemoval_); this.unlisten(NAVIGATION_EVENT, this.handleChipNavigation_); _super.prototype.destroy.call(this); }; /** * Adds a new chip object to the chip set from the given chip element. */ MDCChipSet.prototype.addChip = function (chipEl) { chipEl.id = chipEl.id || "mdc-chip-" + ++idCounter; this.chips_.push(this.chipFactory_(chipEl)); }; MDCChipSet.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = { announceMessage: function announceMessage(message) { announce_1.announce(message); }, focusChipPrimaryActionAtIndex: function focusChipPrimaryActionAtIndex(index) { _this.chips_[index].focusPrimaryAction(); }, focusChipTrailingActionAtIndex: function focusChipTrailingActionAtIndex(index) { _this.chips_[index].focusTrailingAction(); }, getChipListCount: function getChipListCount() { return _this.chips_.length; }, getIndexOfChipById: function getIndexOfChipById(chipId) { return _this.findChipIndex_(chipId); }, hasClass: function hasClass(className) { return _this.root.classList.contains(className); }, isRTL: function isRTL() { return window.getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl'; }, removeChipAtIndex: function removeChipAtIndex(index) { if (index >= 0 && index < _this.chips_.length) { _this.chips_[index].destroy(); _this.chips_[index].remove(); _this.chips_.splice(index, 1); } }, removeFocusFromChipAtIndex: function removeFocusFromChipAtIndex(index) { _this.chips_[index].removeFocus(); }, selectChipAtIndex: function selectChipAtIndex(index, selected, shouldNotifyClients) { if (index >= 0 && index < _this.chips_.length) { _this.chips_[index].setSelectedFromChipSet(selected, shouldNotifyClients); } } }; return new foundation_2.MDCChipSetFoundation(adapter); }; /** * Instantiates chip components on all of the chip set's child chip elements. */ MDCChipSet.prototype.instantiateChips_ = function (chipFactory) { var chipElements = [].slice.call(this.root.querySelectorAll(CHIP_SELECTOR)); return chipElements.map(function (el) { el.id = el.id || "mdc-chip-" + ++idCounter; return chipFactory(el); }); }; /** * Returns the index of the chip with the given id, or -1 if the chip does not exist. */ MDCChipSet.prototype.findChipIndex_ = function (chipId) { for (var i = 0; i < this.chips_.length; i++) { if (this.chips_[i].id === chipId) { return i; } } return -1; }; return MDCChipSet; }(component_1.MDCComponent); exports.MDCChipSet = MDCChipSet; /***/ }), /***/ "./packages/mdc-chips/chip-set/constants.ts": /*!**************************************************!*\ !*** ./packages/mdc-chips/chip-set/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 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 = { CHIP_SELECTOR: '.mdc-chip' }; exports.cssClasses = { CHOICE: 'mdc-chip-set--choice', FILTER: 'mdc-chip-set--filter' }; /***/ }), /***/ "./packages/mdc-chips/chip-set/foundation.ts": /*!***************************************************!*\ !*** ./packages/mdc-chips/chip-set/foundation.ts ***! \***************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2017 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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _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 }); var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); var constants_1 = __webpack_require__(/*! ../chip/constants */ "./packages/mdc-chips/chip/constants.ts"); var constants_2 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip-set/constants.ts"); var MDCChipSetFoundation = /** @class */function (_super) { __extends(MDCChipSetFoundation, _super); function MDCChipSetFoundation(adapter) { var _this = _super.call(this, __assign(__assign({}, MDCChipSetFoundation.defaultAdapter), adapter)) || this; /** * The ids of the selected chips in the set. Only used for choice chip set or filter chip set. */ _this.selectedChipIds_ = []; return _this; } Object.defineProperty(MDCChipSetFoundation, "strings", { get: function get() { return constants_2.strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCChipSetFoundation, "cssClasses", { get: function get() { return constants_2.cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCChipSetFoundation, "defaultAdapter", { get: function get() { return { announceMessage: function announceMessage() { return undefined; }, focusChipPrimaryActionAtIndex: function focusChipPrimaryActionAtIndex() { return undefined; }, focusChipTrailingActionAtIndex: function focusChipTrailingActionAtIndex() { return undefined; }, getChipListCount: function getChipListCount() { return -1; }, getIndexOfChipById: function getIndexOfChipById() { return -1; }, hasClass: function hasClass() { return false; }, isRTL: function isRTL() { return false; }, removeChipAtIndex: function removeChipAtIndex() { return undefined; }, removeFocusFromChipAtIndex: function removeFocusFromChipAtIndex() { return undefined; }, selectChipAtIndex: function selectChipAtIndex() { return undefined; } }; }, enumerable: true, configurable: true }); /** * Returns an array of the IDs of all selected chips. */ MDCChipSetFoundation.prototype.getSelectedChipIds = function () { return this.selectedChipIds_.slice(); }; /** * Selects the chip with the given id. Deselects all other chips if the chip set is of the choice variant. * Does not notify clients of the updated selection state. */ MDCChipSetFoundation.prototype.select = function (chipId) { this.select_(chipId, false); }; /** * Handles a chip interaction event */ MDCChipSetFoundation.prototype.handleChipInteraction = function (_a) { var chipId = _a.chipId; var index = this.adapter.getIndexOfChipById(chipId); this.removeFocusFromChipsExcept_(index); if (this.adapter.hasClass(constants_2.cssClasses.CHOICE) || this.adapter.hasClass(constants_2.cssClasses.FILTER)) { this.toggleSelect_(chipId); } }; /** * Handles a chip selection event, used to handle discrepancy when selection state is set directly on the Chip. */ MDCChipSetFoundation.prototype.handleChipSelection = function (_a) { var chipId = _a.chipId, selected = _a.selected, shouldIgnore = _a.shouldIgnore; // Early exit if we should ignore the event if (shouldIgnore) { return; } var chipIsSelected = this.selectedChipIds_.indexOf(chipId) >= 0; if (selected && !chipIsSelected) { this.select(chipId); } else if (!selected && chipIsSelected) { this.deselect_(chipId); } }; /** * Handles the event when a chip is removed. */ MDCChipSetFoundation.prototype.handleChipRemoval = function (_a) { var chipId = _a.chipId, removedAnnouncement = _a.removedAnnouncement; if (removedAnnouncement) { this.adapter.announceMessage(removedAnnouncement); } var index = this.adapter.getIndexOfChipById(chipId); this.deselectAndNotifyClients_(chipId); this.adapter.removeChipAtIndex(index); var maxIndex = this.adapter.getChipListCount() - 1; var nextIndex = Math.min(index, maxIndex); this.removeFocusFromChipsExcept_(nextIndex); // After removing a chip, we should focus the trailing action for the next chip. this.adapter.focusChipTrailingActionAtIndex(nextIndex); }; /** * Handles a chip navigation event. */ MDCChipSetFoundation.prototype.handleChipNavigation = function (_a) { var chipId = _a.chipId, key = _a.key, source = _a.source; var maxIndex = this.adapter.getChipListCount() - 1; var index = this.adapter.getIndexOfChipById(chipId); // Early exit if the index is out of range or the key is unusable if (index === -1 || !constants_1.navigationKeys.has(key)) { return; } var isRTL = this.adapter.isRTL(); var isLeftKey = key === constants_1.strings.ARROW_LEFT_KEY || key === constants_1.strings.IE_ARROW_LEFT_KEY; var isRightKey = key === constants_1.strings.ARROW_RIGHT_KEY || key === constants_1.strings.IE_ARROW_RIGHT_KEY; var isDownKey = key === constants_1.strings.ARROW_DOWN_KEY || key === constants_1.strings.IE_ARROW_DOWN_KEY; var shouldIncrement = !isRTL && isRightKey || isRTL && isLeftKey || isDownKey; var isHome = key === constants_1.strings.HOME_KEY; var isEnd = key === constants_1.strings.END_KEY; if (shouldIncrement) { index++; } else if (isHome) { index = 0; } else if (isEnd) { index = maxIndex; } else { index--; } // Early exit if the index is out of bounds if (index < 0 || index > maxIndex) { return; } this.removeFocusFromChipsExcept_(index); this.focusChipAction_(index, key, source); }; MDCChipSetFoundation.prototype.focusChipAction_ = function (index, key, source) { var shouldJumpChips = constants_1.jumpChipKeys.has(key); if (shouldJumpChips && source === constants_1.EventSource.PRIMARY) { return this.adapter.focusChipPrimaryActionAtIndex(index); } if (shouldJumpChips && source === constants_1.EventSource.TRAILING) { return this.adapter.focusChipTrailingActionAtIndex(index); } var dir = this.getDirection_(key); if (dir === constants_1.Direction.LEFT) { return this.adapter.focusChipTrailingActionAtIndex(index); } if (dir === constants_1.Direction.RIGHT) { return this.adapter.focusChipPrimaryActionAtIndex(index); } }; MDCChipSetFoundation.prototype.getDirection_ = function (key) { var isRTL = this.adapter.isRTL(); var isLeftKey = key === constants_1.strings.ARROW_LEFT_KEY || key === constants_1.strings.IE_ARROW_LEFT_KEY; var isRightKey = key === constants_1.strings.ARROW_RIGHT_KEY || key === constants_1.strings.IE_ARROW_RIGHT_KEY; if (!isRTL && isLeftKey || isRTL && isRightKey) { return constants_1.Direction.LEFT; } return constants_1.Direction.RIGHT; }; /** * Deselects the chip with the given id and optionally notifies clients. */ MDCChipSetFoundation.prototype.deselect_ = function (chipId, shouldNotifyClients) { if (shouldNotifyClients === void 0) { shouldNotifyClients = false; } var index = this.selectedChipIds_.indexOf(chipId); if (index >= 0) { this.selectedChipIds_.splice(index, 1); var chipIndex = this.adapter.getIndexOfChipById(chipId); this.adapter.selectChipAtIndex(chipIndex, /** isSelected */false, shouldNotifyClients); } }; /** * Deselects the chip with the given id and notifies clients. */ MDCChipSetFoundation.prototype.deselectAndNotifyClients_ = function (chipId) { this.deselect_(chipId, true); }; /** * Toggles selection of the chip with the given id. */ MDCChipSetFoundation.prototype.toggleSelect_ = function (chipId) { if (this.selectedChipIds_.indexOf(chipId) >= 0) { this.deselectAndNotifyClients_(chipId); } else { this.selectAndNotifyClients_(chipId); } }; MDCChipSetFoundation.prototype.removeFocusFromChipsExcept_ = function (index) { var chipCount = this.adapter.getChipListCount(); for (var i = 0; i < chipCount; i++) { if (i !== index) { this.adapter.removeFocusFromChipAtIndex(i); } } }; MDCChipSetFoundation.prototype.selectAndNotifyClients_ = function (chipId) { this.select_(chipId, true); }; MDCChipSetFoundation.prototype.select_ = function (chipId, shouldNotifyClients) { if (this.selectedChipIds_.indexOf(chipId) >= 0) { return; } if (this.adapter.hasClass(constants_2.cssClasses.CHOICE) && this.selectedChipIds_.length > 0) { var previouslySelectedChip = this.selectedChipIds_[0]; var previouslySelectedIndex = this.adapter.getIndexOfChipById(previouslySelectedChip); this.selectedChipIds_ = []; this.adapter.selectChipAtIndex(previouslySelectedIndex, /** isSelected */false, shouldNotifyClients); } this.selectedChipIds_.push(chipId); var index = this.adapter.getIndexOfChipById(chipId); this.adapter.selectChipAtIndex(index, /** isSelected */true, shouldNotifyClients); }; return MDCChipSetFoundation; }(foundation_1.MDCFoundation); exports.MDCChipSetFoundation = MDCChipSetFoundation; // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. exports.default = MDCChipSetFoundation; /***/ }), /***/ "./packages/mdc-chips/chip-set/index.ts": /*!**********************************************!*\ !*** ./packages/mdc-chips/chip-set/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. */ function __export(m) { for (var p in m) { if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__(/*! ./component */ "./packages/mdc-chips/chip-set/component.ts")); __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-chips/chip-set/foundation.ts")); var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip-set/constants.ts"); exports.chipSetCssClasses = constants_1.cssClasses; exports.chipSetStrings = constants_1.strings; /***/ }), /***/ "./packages/mdc-chips/chip/component.ts": /*!**********************************************!*\ !*** ./packages/mdc-chips/chip/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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _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 }); 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__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); var component_3 = __webpack_require__(/*! ../trailingaction/component */ "./packages/mdc-chips/trailingaction/component.ts"); var constants_1 = __webpack_require__(/*! ../trailingaction/constants */ "./packages/mdc-chips/trailingaction/constants.ts"); var constants_2 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip/constants.ts"); var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-chips/chip/foundation.ts"); var MDCChip = /** @class */function (_super) { __extends(MDCChip, _super); function MDCChip() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(MDCChip.prototype, "selected", { /** * @return Whether the chip is selected. */ get: function get() { return this.foundation.isSelected(); }, /** * Sets selected state on the chip. */ set: function set(selected) { this.foundation.setSelected(selected); }, enumerable: true, configurable: true }); Object.defineProperty(MDCChip.prototype, "shouldRemoveOnTrailingIconClick", { /** * @return Whether a trailing icon click should trigger exit/removal of the chip. */ get: function get() { return this.foundation.getShouldRemoveOnTrailingIconClick(); }, /** * Sets whether a trailing icon click should trigger exit/removal of the chip. */ set: function set(shouldRemove) { this.foundation.setShouldRemoveOnTrailingIconClick(shouldRemove); }, enumerable: true, configurable: true }); Object.defineProperty(MDCChip.prototype, "setShouldFocusPrimaryActionOnClick", { /** * Sets whether a clicking on the chip should focus the primary action. */ set: function set(shouldFocus) { this.foundation.setShouldFocusPrimaryActionOnClick(shouldFocus); }, enumerable: true, configurable: true }); Object.defineProperty(MDCChip.prototype, "ripple", { get: function get() { return this.ripple_; }, enumerable: true, configurable: true }); Object.defineProperty(MDCChip.prototype, "id", { get: function get() { return this.root.id; }, enumerable: true, configurable: true }); MDCChip.attachTo = function (root) { return new MDCChip(root); }; MDCChip.prototype.initialize = function (rippleFactory, trailingActionFactory) { var _this = this; if (rippleFactory === void 0) { rippleFactory = function rippleFactory(el, foundation) { return new component_2.MDCRipple(el, foundation); }; } if (trailingActionFactory === void 0) { trailingActionFactory = function trailingActionFactory(el) { return new component_3.MDCChipTrailingAction(el); }; } this.leadingIcon_ = this.root.querySelector(constants_2.strings.LEADING_ICON_SELECTOR); this.checkmark_ = this.root.querySelector(constants_2.strings.CHECKMARK_SELECTOR); this.primaryAction_ = this.root.querySelector(constants_2.strings.PRIMARY_ACTION_SELECTOR); var trailingActionEl = this.root.querySelector(constants_2.strings.TRAILING_ACTION_SELECTOR); if (trailingActionEl) { this.trailingAction_ = trailingActionFactory(trailingActionEl); } // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var rippleAdapter = __assign(__assign({}, component_2.MDCRipple.createAdapter(this)), { computeBoundingRect: function computeBoundingRect() { return _this.foundation.getDimensions(); } }); this.ripple_ = rippleFactory(this.root, new foundation_1.MDCRippleFoundation(rippleAdapter)); }; MDCChip.prototype.initialSyncWithDOM = function () { var _this = this; // Custom events this.handleTrailingActionInteraction_ = function () { _this.foundation.handleTrailingActionInteraction(); }; this.handleTrailingActionNavigation_ = function (evt) { _this.foundation.handleTrailingActionNavigation(evt); }; // Native events this.handleClick_ = function () { _this.foundation.handleClick(); }; this.handleKeydown_ = function (evt) { _this.foundation.handleKeydown(evt); }; this.handleTransitionEnd_ = function (evt) { _this.foundation.handleTransitionEnd(evt); }; this.handleFocusIn_ = function (evt) { _this.foundation.handleFocusIn(evt); }; this.handleFocusOut_ = function (evt) { _this.foundation.handleFocusOut(evt); }; this.listen('transitionend', this.handleTransitionEnd_); this.listen('click', this.handleClick_); this.listen('keydown', this.handleKeydown_); this.listen('focusin', this.handleFocusIn_); this.listen('focusout', this.handleFocusOut_); if (this.trailingAction_) { this.listen(constants_1.strings.INTERACTION_EVENT, this.handleTrailingActionInteraction_); this.listen(constants_1.strings.NAVIGATION_EVENT, this.handleTrailingActionNavigation_); } }; MDCChip.prototype.destroy = function () { this.ripple_.destroy(); this.unlisten('transitionend', this.handleTransitionEnd_); this.unlisten('keydown', this.handleKeydown_); this.unlisten('click', this.handleClick_); this.unlisten('focusin', this.handleFocusIn_); this.unlisten('focusout', this.handleFocusOut_); if (this.trailingAction_) { this.unlisten(constants_1.strings.INTERACTION_EVENT, this.handleTrailingActionInteraction_); this.unlisten(constants_1.strings.NAVIGATION_EVENT, this.handleTrailingActionNavigation_); } _super.prototype.destroy.call(this); }; /** * Begins the exit animation which leads to removal of the chip. */ MDCChip.prototype.beginExit = function () { this.foundation.beginExit(); }; MDCChip.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // 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); }, addClassToLeadingIcon: function addClassToLeadingIcon(className) { if (_this.leadingIcon_) { _this.leadingIcon_.classList.add(className); } }, eventTargetHasClass: function eventTargetHasClass(target, className) { return target ? target.classList.contains(className) : false; }, focusPrimaryAction: function focusPrimaryAction() { if (_this.primaryAction_) { _this.primaryAction_.focus(); } }, focusTrailingAction: function focusTrailingAction() { if (_this.trailingAction_) { _this.trailingAction_.focus(); } }, getAttribute: function getAttribute(attr) { return _this.root.getAttribute(attr); }, getCheckmarkBoundingClientRect: function getCheckmarkBoundingClientRect() { return _this.checkmark_ ? _this.checkmark_.getBoundingClientRect() : null; }, getComputedStyleValue: function getComputedStyleValue(propertyName) { return window.getComputedStyle(_this.root).getPropertyValue(propertyName); }, getRootBoundingClientRect: function getRootBoundingClientRect() { return _this.root.getBoundingClientRect(); }, hasClass: function hasClass(className) { return _this.root.classList.contains(className); }, hasLeadingIcon: function hasLeadingIcon() { return !!_this.leadingIcon_; }, isRTL: function isRTL() { return window.getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl'; }, isTrailingActionNavigable: function isTrailingActionNavigable() { if (_this.trailingAction_) { return _this.trailingAction_.isNavigable(); } return false; }, notifyInteraction: function notifyInteraction() { return _this.emit(constants_2.strings.INTERACTION_EVENT, { chipId: _this.id }, true /* shouldBubble */); }, notifyNavigation: function notifyNavigation(key, source) { return _this.emit(constants_2.strings.NAVIGATION_EVENT, { chipId: _this.id, key: key, source: source }, true /* shouldBubble */); }, notifyRemoval: function notifyRemoval(removedAnnouncement) { _this.emit(constants_2.strings.REMOVAL_EVENT, { chipId: _this.id, removedAnnouncement: removedAnnouncement }, true /* shouldBubble */); }, notifySelection: function notifySelection(selected, shouldIgnore) { return _this.emit(constants_2.strings.SELECTION_EVENT, { chipId: _this.id, selected: selected, shouldIgnore: shouldIgnore }, true /* shouldBubble */); }, notifyTrailingIconInteraction: function notifyTrailingIconInteraction() { return _this.emit(constants_2.strings.TRAILING_ICON_INTERACTION_EVENT, { chipId: _this.id }, true /* shouldBubble */); }, notifyEditStart: function notifyEditStart() {}, notifyEditFinish: function notifyEditFinish() {}, removeClass: function removeClass(className) { return _this.root.classList.remove(className); }, removeClassFromLeadingIcon: function removeClassFromLeadingIcon(className) { if (_this.leadingIcon_) { _this.leadingIcon_.classList.remove(className); } }, removeTrailingActionFocus: function removeTrailingActionFocus() { if (_this.trailingAction_) { _this.trailingAction_.removeFocus(); } }, setPrimaryActionAttr: function setPrimaryActionAttr(attr, value) { if (_this.primaryAction_) { _this.primaryAction_.setAttribute(attr, value); } }, setStyleProperty: function setStyleProperty(propertyName, value) { return _this.root.style.setProperty(propertyName, value); } }; return new foundation_2.MDCChipFoundation(adapter); }; MDCChip.prototype.setSelectedFromChipSet = function (selected, shouldNotifyClients) { this.foundation.setSelectedFromChipSet(selected, shouldNotifyClients); }; MDCChip.prototype.focusPrimaryAction = function () { this.foundation.focusPrimaryAction(); }; MDCChip.prototype.focusTrailingAction = function () { this.foundation.focusTrailingAction(); }; MDCChip.prototype.removeFocus = function () { this.foundation.removeFocus(); }; MDCChip.prototype.remove = function () { var parent = this.root.parentNode; if (parent !== null) { parent.removeChild(this.root); } }; return MDCChip; }(component_1.MDCComponent); exports.MDCChip = MDCChip; /***/ }), /***/ "./packages/mdc-chips/chip/constants.ts": /*!**********************************************!*\ !*** ./packages/mdc-chips/chip/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 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 }); var Direction; (function (Direction) { Direction["LEFT"] = "left"; Direction["RIGHT"] = "right"; })(Direction = exports.Direction || (exports.Direction = {})); var EventSource; (function (EventSource) { EventSource["PRIMARY"] = "primary"; EventSource["TRAILING"] = "trailing"; EventSource["NONE"] = "none"; })(EventSource = exports.EventSource || (exports.EventSource = {})); exports.strings = { ADDED_ANNOUNCEMENT_ATTRIBUTE: 'data-mdc-chip-added-announcement', ARIA_CHECKED: 'aria-checked', ARROW_DOWN_KEY: 'ArrowDown', ARROW_LEFT_KEY: 'ArrowLeft', ARROW_RIGHT_KEY: 'ArrowRight', ARROW_UP_KEY: 'ArrowUp', BACKSPACE_KEY: 'Backspace', CHECKMARK_SELECTOR: '.mdc-chip__checkmark', DELETE_KEY: 'Delete', END_KEY: 'End', ENTER_KEY: 'Enter', ENTRY_ANIMATION_NAME: 'mdc-chip-entry', HOME_KEY: 'Home', IE_ARROW_DOWN_KEY: 'Down', IE_ARROW_LEFT_KEY: 'Left', IE_ARROW_RIGHT_KEY: 'Right', IE_ARROW_UP_KEY: 'Up', IE_DELETE_KEY: 'Del', INTERACTION_EVENT: 'MDCChip:interaction', LEADING_ICON_SELECTOR: '.mdc-chip__icon--leading', NAVIGATION_EVENT: 'MDCChip:navigation', PRIMARY_ACTION_SELECTOR: '.mdc-chip__primary-action', REMOVED_ANNOUNCEMENT_ATTRIBUTE: 'data-mdc-chip-removed-announcement', REMOVAL_EVENT: 'MDCChip:removal', SELECTION_EVENT: 'MDCChip:selection', SPACEBAR_KEY: ' ', TAB_INDEX: 'tabindex', TRAILING_ACTION_SELECTOR: '.mdc-chip-trailing-action', TRAILING_ICON_INTERACTION_EVENT: 'MDCChip:trailingIconInteraction', TRAILING_ICON_SELECTOR: '.mdc-chip__icon--trailing' }; exports.cssClasses = { CHECKMARK: 'mdc-chip__checkmark', CHIP_EXIT: 'mdc-chip--exit', DELETABLE: 'mdc-chip--deletable', EDITABLE: 'mdc-chip--editable', EDITING: 'mdc-chip--editing', HIDDEN_LEADING_ICON: 'mdc-chip__icon--leading-hidden', LEADING_ICON: 'mdc-chip__icon--leading', PRIMARY_ACTION: 'mdc-chip__primary-action', PRIMARY_ACTION_FOCUSED: 'mdc-chip--primary-action-focused', SELECTED: 'mdc-chip--selected', TEXT: 'mdc-chip__text', TRAILING_ACTION: 'mdc-chip__trailing-action', TRAILING_ICON: 'mdc-chip__icon--trailing' }; exports.navigationKeys = new Set(); // IE11 has no support for new Set with iterable so we need to initialize this by hand exports.navigationKeys.add(exports.strings.ARROW_LEFT_KEY); exports.navigationKeys.add(exports.strings.ARROW_RIGHT_KEY); exports.navigationKeys.add(exports.strings.ARROW_DOWN_KEY); exports.navigationKeys.add(exports.strings.ARROW_UP_KEY); exports.navigationKeys.add(exports.strings.END_KEY); exports.navigationKeys.add(exports.strings.HOME_KEY); exports.navigationKeys.add(exports.strings.IE_ARROW_LEFT_KEY); exports.navigationKeys.add(exports.strings.IE_ARROW_RIGHT_KEY); exports.navigationKeys.add(exports.strings.IE_ARROW_DOWN_KEY); exports.navigationKeys.add(exports.strings.IE_ARROW_UP_KEY); exports.jumpChipKeys = new Set(); // IE11 has no support for new Set with iterable so we need to initialize this by hand exports.jumpChipKeys.add(exports.strings.ARROW_UP_KEY); exports.jumpChipKeys.add(exports.strings.ARROW_DOWN_KEY); exports.jumpChipKeys.add(exports.strings.HOME_KEY); exports.jumpChipKeys.add(exports.strings.END_KEY); exports.jumpChipKeys.add(exports.strings.IE_ARROW_UP_KEY); exports.jumpChipKeys.add(exports.strings.IE_ARROW_DOWN_KEY); /***/ }), /***/ "./packages/mdc-chips/chip/foundation.ts": /*!***********************************************!*\ !*** ./packages/mdc-chips/chip/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. */ 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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _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 }); var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip/constants.ts"); var emptyClientRect = { bottom: 0, height: 0, left: 0, right: 0, top: 0, width: 0 }; var FocusBehavior; (function (FocusBehavior) { FocusBehavior[FocusBehavior["SHOULD_FOCUS"] = 0] = "SHOULD_FOCUS"; FocusBehavior[FocusBehavior["SHOULD_NOT_FOCUS"] = 1] = "SHOULD_NOT_FOCUS"; })(FocusBehavior || (FocusBehavior = {})); var MDCChipFoundation = /** @class */function (_super) { __extends(MDCChipFoundation, _super); function MDCChipFoundation(adapter) { var _this = _super.call(this, __assign(__assign({}, MDCChipFoundation.defaultAdapter), adapter)) || this; /** Whether a trailing icon click should immediately trigger exit/removal of the chip. */ _this.shouldRemoveOnTrailingIconClick_ = true; /** * Whether the primary action should receive focus on click. Should only be * set to true for clients who programmatically give focus to a different * element on the page when a chip is clicked (like a menu). */ _this.shouldFocusPrimaryActionOnClick_ = true; return _this; } Object.defineProperty(MDCChipFoundation, "strings", { get: function get() { return constants_1.strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCChipFoundation, "cssClasses", { get: function get() { return constants_1.cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCChipFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, addClassToLeadingIcon: function addClassToLeadingIcon() { return undefined; }, eventTargetHasClass: function eventTargetHasClass() { return false; }, focusPrimaryAction: function focusPrimaryAction() { return undefined; }, focusTrailingAction: function focusTrailingAction() { return undefined; }, getAttribute: function getAttribute() { return null; }, getCheckmarkBoundingClientRect: function getCheckmarkBoundingClientRect() { return emptyClientRect; }, getComputedStyleValue: function getComputedStyleValue() { return ''; }, getRootBoundingClientRect: function getRootBoundingClientRect() { return emptyClientRect; }, hasClass: function hasClass() { return false; }, hasLeadingIcon: function hasLeadingIcon() { return false; }, isRTL: function isRTL() { return false; }, isTrailingActionNavigable: function isTrailingActionNavigable() { return false; }, notifyEditFinish: function notifyEditFinish() { return undefined; }, notifyEditStart: function notifyEditStart() { return undefined; }, notifyInteraction: function notifyInteraction() { return undefined; }, notifyNavigation: function notifyNavigation() { return undefined; }, notifyRemoval: function notifyRemoval() { return undefined; }, notifySelection: function notifySelection() { return undefined; }, notifyTrailingIconInteraction: function notifyTrailingIconInteraction() { return undefined; }, removeClass: function removeClass() { return undefined; }, removeClassFromLeadingIcon: function removeClassFromLeadingIcon() { return undefined; }, removeTrailingActionFocus: function removeTrailingActionFocus() { return undefined; }, setPrimaryActionAttr: function setPrimaryActionAttr() { return undefined; }, setStyleProperty: function setStyleProperty() { return undefined; } }; }, enumerable: true, configurable: true }); MDCChipFoundation.prototype.isSelected = function () { return this.adapter.hasClass(constants_1.cssClasses.SELECTED); }; MDCChipFoundation.prototype.isEditable = function () { return this.adapter.hasClass(constants_1.cssClasses.EDITABLE); }; MDCChipFoundation.prototype.isEditing = function () { return this.adapter.hasClass(constants_1.cssClasses.EDITING); }; MDCChipFoundation.prototype.setSelected = function (selected) { this.setSelected_(selected); this.notifySelection_(selected); }; MDCChipFoundation.prototype.setSelectedFromChipSet = function (selected, shouldNotifyClients) { this.setSelected_(selected); if (shouldNotifyClients) { this.notifyIgnoredSelection_(selected); } }; MDCChipFoundation.prototype.getShouldRemoveOnTrailingIconClick = function () { return this.shouldRemoveOnTrailingIconClick_; }; MDCChipFoundation.prototype.setShouldRemoveOnTrailingIconClick = function (shouldRemove) { this.shouldRemoveOnTrailingIconClick_ = shouldRemove; }; MDCChipFoundation.prototype.setShouldFocusPrimaryActionOnClick = function (shouldFocus) { this.shouldFocusPrimaryActionOnClick_ = shouldFocus; }; MDCChipFoundation.prototype.getDimensions = function () { var _this = this; var getRootRect = function getRootRect() { return _this.adapter.getRootBoundingClientRect(); }; var getCheckmarkRect = function getCheckmarkRect() { return _this.adapter.getCheckmarkBoundingClientRect(); }; // When a chip has a checkmark and not a leading icon, the bounding rect changes in size depending on the current // size of the checkmark. if (!this.adapter.hasLeadingIcon()) { var checkmarkRect = getCheckmarkRect(); if (checkmarkRect) { var rootRect = getRootRect(); // Checkmark is a square, meaning the client rect's width and height are identical once the animation completes. // However, the checkbox is initially hidden by setting the width to 0. // To account for an initial width of 0, we use the checkbox's height instead (which equals the end-state width) // when adding it to the root client rect's width. return { bottom: rootRect.bottom, height: rootRect.height, left: rootRect.left, right: rootRect.right, top: rootRect.top, width: rootRect.width + checkmarkRect.height }; } } return getRootRect(); }; /** * Begins the exit animation which leads to removal of the chip. */ MDCChipFoundation.prototype.beginExit = function () { this.adapter.addClass(constants_1.cssClasses.CHIP_EXIT); }; MDCChipFoundation.prototype.handleClick = function () { this.adapter.notifyInteraction(); this.setPrimaryActionFocusable_(this.getFocusBehavior_()); }; MDCChipFoundation.prototype.handleDoubleClick = function () { if (this.isEditable()) { this.startEditing(); } }; /** * Handles a transition end event on the root element. */ MDCChipFoundation.prototype.handleTransitionEnd = function (evt) { var _this = this; // Handle transition end event on the chip when it is about to be removed. var shouldHandle = this.adapter.eventTargetHasClass(evt.target, constants_1.cssClasses.CHIP_EXIT); var widthIsAnimating = evt.propertyName === 'width'; var opacityIsAnimating = evt.propertyName === 'opacity'; if (shouldHandle && opacityIsAnimating) { // See: https://css-tricks.com/using-css-transitions-auto-dimensions/#article-header-id-5 var chipWidth_1 = this.adapter.getComputedStyleValue('width'); // On the next frame (once we get the computed width), explicitly set the chip's width // to its current pixel width, so we aren't transitioning out of 'auto'. requestAnimationFrame(function () { _this.adapter.setStyleProperty('width', chipWidth_1); // To mitigate jitter, start transitioning padding and margin before width. _this.adapter.setStyleProperty('padding', '0'); _this.adapter.setStyleProperty('margin', '0'); // On the next frame (once width is explicitly set), transition width to 0. requestAnimationFrame(function () { _this.adapter.setStyleProperty('width', '0'); }); }); return; } if (shouldHandle && widthIsAnimating) { this.removeFocus(); var removedAnnouncement = this.adapter.getAttribute(constants_1.strings.REMOVED_ANNOUNCEMENT_ATTRIBUTE); this.adapter.notifyRemoval(removedAnnouncement); } // Handle a transition end event on the leading icon or checkmark, since the transition end event bubbles. if (!opacityIsAnimating) { return; } var shouldHideLeadingIcon = this.adapter.eventTargetHasClass(evt.target, constants_1.cssClasses.LEADING_ICON) && this.adapter.hasClass(constants_1.cssClasses.SELECTED); var shouldShowLeadingIcon = this.adapter.eventTargetHasClass(evt.target, constants_1.cssClasses.CHECKMARK) && !this.adapter.hasClass(constants_1.cssClasses.SELECTED); if (shouldHideLeadingIcon) { this.adapter.addClassToLeadingIcon(constants_1.cssClasses.HIDDEN_LEADING_ICON); return; } if (shouldShowLeadingIcon) { this.adapter.removeClassFromLeadingIcon(constants_1.cssClasses.HIDDEN_LEADING_ICON); return; } }; MDCChipFoundation.prototype.handleFocusIn = function (evt) { // Early exit if the event doesn't come from the primary action if (!this.eventFromPrimaryAction_(evt)) { return; } this.adapter.addClass(constants_1.cssClasses.PRIMARY_ACTION_FOCUSED); }; MDCChipFoundation.prototype.handleFocusOut = function (evt) { // Early exit if the event doesn't come from the primary action if (!this.eventFromPrimaryAction_(evt)) { return; } if (this.isEditing()) { this.finishEditing(); } this.adapter.removeClass(constants_1.cssClasses.PRIMARY_ACTION_FOCUSED); }; /** * Handles an interaction event on the trailing icon element. This is used to * prevent the ripple from activating on interaction with the trailing icon. */ MDCChipFoundation.prototype.handleTrailingActionInteraction = function () { this.adapter.notifyTrailingIconInteraction(); this.removeChip_(); }; /** * Handles a keydown event from the root element. */ MDCChipFoundation.prototype.handleKeydown = function (evt) { if (this.isEditing()) { if (this.shouldFinishEditing(evt)) { evt.preventDefault(); this.finishEditing(); } // When editing, the foundation should only handle key events that finish // the editing process. return; } if (this.isEditable()) { if (this.shouldStartEditing(evt)) { evt.preventDefault(); this.startEditing(); } } if (this.shouldNotifyInteraction_(evt)) { this.adapter.notifyInteraction(); this.setPrimaryActionFocusable_(this.getFocusBehavior_()); return; } if (this.isDeleteAction_(evt)) { evt.preventDefault(); this.removeChip_(); return; } // Early exit if the key is not usable if (!constants_1.navigationKeys.has(evt.key)) { return; } // Prevent default behavior for movement keys which could include scrolling evt.preventDefault(); this.focusNextAction_(evt.key, constants_1.EventSource.PRIMARY); }; MDCChipFoundation.prototype.handleTrailingActionNavigation = function (evt) { return this.focusNextAction_(evt.detail.key, constants_1.EventSource.TRAILING); }; /** * Called by the chip set to remove focus from the chip actions. */ MDCChipFoundation.prototype.removeFocus = function () { this.adapter.setPrimaryActionAttr(constants_1.strings.TAB_INDEX, '-1'); this.adapter.removeTrailingActionFocus(); }; /** * Called by the chip set to focus the primary action. * */ MDCChipFoundation.prototype.focusPrimaryAction = function () { this.setPrimaryActionFocusable_(FocusBehavior.SHOULD_FOCUS); }; /** * Called by the chip set to focus the trailing action (if present), otherwise * gives focus to the trailing action. */ MDCChipFoundation.prototype.focusTrailingAction = function () { var trailingActionIsNavigable = this.adapter.isTrailingActionNavigable(); if (trailingActionIsNavigable) { this.adapter.setPrimaryActionAttr(constants_1.strings.TAB_INDEX, '-1'); this.adapter.focusTrailingAction(); return; } this.focusPrimaryAction(); }; MDCChipFoundation.prototype.setPrimaryActionFocusable_ = function (focusBehavior) { this.adapter.setPrimaryActionAttr(constants_1.strings.TAB_INDEX, '0'); if (focusBehavior === FocusBehavior.SHOULD_FOCUS) { this.adapter.focusPrimaryAction(); } this.adapter.removeTrailingActionFocus(); }; MDCChipFoundation.prototype.getFocusBehavior_ = function () { if (this.shouldFocusPrimaryActionOnClick_) { return FocusBehavior.SHOULD_FOCUS; } return FocusBehavior.SHOULD_NOT_FOCUS; }; MDCChipFoundation.prototype.focusNextAction_ = function (key, source) { var isTrailingActionNavigable = this.adapter.isTrailingActionNavigable(); var dir = this.getDirection_(key); // Early exit if the key should jump chips if (constants_1.jumpChipKeys.has(key) || !isTrailingActionNavigable) { return this.adapter.notifyNavigation(key, source); } if (source === constants_1.EventSource.PRIMARY && dir === constants_1.Direction.RIGHT) { return this.focusTrailingAction(); } if (source === constants_1.EventSource.TRAILING && dir === constants_1.Direction.LEFT) { return this.focusPrimaryAction(); } this.adapter.notifyNavigation(key, constants_1.EventSource.NONE); }; MDCChipFoundation.prototype.getDirection_ = function (key) { var isRTL = this.adapter.isRTL(); var isLeftKey = key === constants_1.strings.ARROW_LEFT_KEY || key === constants_1.strings.IE_ARROW_LEFT_KEY; var isRightKey = key === constants_1.strings.ARROW_RIGHT_KEY || key === constants_1.strings.IE_ARROW_RIGHT_KEY; if (!isRTL && isLeftKey || isRTL && isRightKey) { return constants_1.Direction.LEFT; } return constants_1.Direction.RIGHT; }; MDCChipFoundation.prototype.removeChip_ = function () { if (this.shouldRemoveOnTrailingIconClick_) { this.beginExit(); } }; MDCChipFoundation.prototype.shouldStartEditing = function (evt) { return this.eventFromPrimaryAction_(evt) && evt.key === constants_1.strings.ENTER_KEY; }; MDCChipFoundation.prototype.shouldFinishEditing = function (evt) { return evt.key === constants_1.strings.ENTER_KEY; }; MDCChipFoundation.prototype.shouldNotifyInteraction_ = function (evt) { return evt.key === constants_1.strings.ENTER_KEY || evt.key === constants_1.strings.SPACEBAR_KEY; }; MDCChipFoundation.prototype.isDeleteAction_ = function (evt) { var isDeletable = this.adapter.hasClass(constants_1.cssClasses.DELETABLE); return isDeletable && (evt.key === constants_1.strings.BACKSPACE_KEY || evt.key === constants_1.strings.DELETE_KEY || evt.key === constants_1.strings.IE_DELETE_KEY); }; MDCChipFoundation.prototype.setSelected_ = function (selected) { if (selected) { this.adapter.addClass(constants_1.cssClasses.SELECTED); this.adapter.setPrimaryActionAttr(constants_1.strings.ARIA_CHECKED, 'true'); } else { this.adapter.removeClass(constants_1.cssClasses.SELECTED); this.adapter.setPrimaryActionAttr(constants_1.strings.ARIA_CHECKED, 'false'); } }; MDCChipFoundation.prototype.notifySelection_ = function (selected) { this.adapter.notifySelection(selected, false); }; MDCChipFoundation.prototype.notifyIgnoredSelection_ = function (selected) { this.adapter.notifySelection(selected, true); }; MDCChipFoundation.prototype.eventFromPrimaryAction_ = function (evt) { return this.adapter.eventTargetHasClass(evt.target, constants_1.cssClasses.PRIMARY_ACTION); }; MDCChipFoundation.prototype.startEditing = function () { this.adapter.addClass(constants_1.cssClasses.EDITING); this.adapter.notifyEditStart(); }; MDCChipFoundation.prototype.finishEditing = function () { this.adapter.removeClass(constants_1.cssClasses.EDITING); this.adapter.notifyEditFinish(); }; return MDCChipFoundation; }(foundation_1.MDCFoundation); exports.MDCChipFoundation = MDCChipFoundation; // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. exports.default = MDCChipFoundation; /***/ }), /***/ "./packages/mdc-chips/chip/index.ts": /*!******************************************!*\ !*** ./packages/mdc-chips/chip/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. */ function __export(m) { for (var p in m) { if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__(/*! ./component */ "./packages/mdc-chips/chip/component.ts")); __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-chips/chip/foundation.ts")); var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/chip/constants.ts"); exports.chipCssClasses = constants_1.cssClasses; exports.chipStrings = constants_1.strings; /***/ }), /***/ "./packages/mdc-chips/index.ts": /*!*************************************!*\ !*** ./packages/mdc-chips/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. */ function __export(m) { for (var p in m) { if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__(/*! ./trailingaction/index */ "./packages/mdc-chips/trailingaction/index.ts")); __export(__webpack_require__(/*! ./chip/index */ "./packages/mdc-chips/chip/index.ts")); __export(__webpack_require__(/*! ./chip-set/index */ "./packages/mdc-chips/chip-set/index.ts")); /***/ }), /***/ "./packages/mdc-chips/trailingaction/component.ts": /*!********************************************************!*\ !*** ./packages/mdc-chips/trailingaction/component.ts ***! \********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2020 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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); Object.defineProperty(exports, "__esModule", { value: true }); 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__(/*! @material/ripple/foundation */ "./packages/mdc-ripple/foundation.ts"); var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/trailingaction/constants.ts"); var foundation_2 = __webpack_require__(/*! ./foundation */ "./packages/mdc-chips/trailingaction/foundation.ts"); var MDCChipTrailingAction = /** @class */function (_super) { __extends(MDCChipTrailingAction, _super); function MDCChipTrailingAction() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(MDCChipTrailingAction.prototype, "ripple", { get: function get() { return this.ripple_; }, enumerable: true, configurable: true }); MDCChipTrailingAction.attachTo = function (root) { return new MDCChipTrailingAction(root); }; MDCChipTrailingAction.prototype.initialize = function (rippleFactory) { if (rippleFactory === void 0) { rippleFactory = function rippleFactory(el, foundation) { return new component_2.MDCRipple(el, foundation); }; } // DO NOT INLINE this variable. For backward compatibility, foundations take // a Partial. To ensure we don't accidentally omit any // methods, we need a separate, strongly typed adapter variable. var rippleAdapter = component_2.MDCRipple.createAdapter(this); this.ripple_ = rippleFactory(this.root, new foundation_1.MDCRippleFoundation(rippleAdapter)); }; MDCChipTrailingAction.prototype.initialSyncWithDOM = function () { var _this = this; this.handleClick_ = function (evt) { _this.foundation.handleClick(evt); }; this.handleKeydown_ = function (evt) { _this.foundation.handleKeydown(evt); }; this.listen('click', this.handleClick_); this.listen('keydown', this.handleKeydown_); }; MDCChipTrailingAction.prototype.destroy = function () { this.ripple_.destroy(); this.unlisten('click', this.handleClick_); this.unlisten('keydown', this.handleKeydown_); _super.prototype.destroy.call(this); }; MDCChipTrailingAction.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take // a Partial. To ensure we don't accidentally omit any // methods, we need a separate, strongly typed adapter variable. var adapter = { focus: function focus() { // TODO(b/157231863): Migate MDCComponent#root to HTMLElement _this.root.focus(); }, getAttribute: function getAttribute(attr) { return _this.root.getAttribute(attr); }, notifyInteraction: function notifyInteraction(trigger) { return _this.emit(constants_1.strings.INTERACTION_EVENT, { trigger: trigger }, true /* shouldBubble */); }, notifyNavigation: function notifyNavigation(key) { _this.emit(constants_1.strings.NAVIGATION_EVENT, { key: key }, true /* shouldBubble */); }, setAttribute: function setAttribute(attr, value) { _this.root.setAttribute(attr, value); } }; return new foundation_2.MDCChipTrailingActionFoundation(adapter); }; MDCChipTrailingAction.prototype.isNavigable = function () { return this.foundation.isNavigable(); }; MDCChipTrailingAction.prototype.focus = function () { this.foundation.focus(); }; MDCChipTrailingAction.prototype.removeFocus = function () { this.foundation.removeFocus(); }; return MDCChipTrailingAction; }(component_1.MDCComponent); exports.MDCChipTrailingAction = MDCChipTrailingAction; /***/ }), /***/ "./packages/mdc-chips/trailingaction/constants.ts": /*!********************************************************!*\ !*** ./packages/mdc-chips/trailingaction/constants.ts ***! \********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2020 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 }); var InteractionTrigger; (function (InteractionTrigger) { InteractionTrigger[InteractionTrigger["UNSPECIFIED"] = 0] = "UNSPECIFIED"; InteractionTrigger[InteractionTrigger["CLICK"] = 1] = "CLICK"; InteractionTrigger[InteractionTrigger["BACKSPACE_KEY"] = 2] = "BACKSPACE_KEY"; InteractionTrigger[InteractionTrigger["DELETE_KEY"] = 3] = "DELETE_KEY"; InteractionTrigger[InteractionTrigger["SPACEBAR_KEY"] = 4] = "SPACEBAR_KEY"; InteractionTrigger[InteractionTrigger["ENTER_KEY"] = 5] = "ENTER_KEY"; })(InteractionTrigger = exports.InteractionTrigger || (exports.InteractionTrigger = {})); exports.strings = { ARIA_HIDDEN: 'aria-hidden', INTERACTION_EVENT: 'MDCChipTrailingAction:interaction', NAVIGATION_EVENT: 'MDCChipTrailingAction:navigation', TAB_INDEX: 'tabindex' }; /***/ }), /***/ "./packages/mdc-chips/trailingaction/foundation.ts": /*!*********************************************************!*\ !*** ./packages/mdc-chips/trailingaction/foundation.ts ***! \*********************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2020 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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _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 }); var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); var keyboard_1 = __webpack_require__(/*! @material/dom/keyboard */ "./packages/mdc-dom/keyboard.ts"); var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/trailingaction/constants.ts"); var MDCChipTrailingActionFoundation = /** @class */function (_super) { __extends(MDCChipTrailingActionFoundation, _super); function MDCChipTrailingActionFoundation(adapter) { return _super.call(this, __assign(__assign({}, MDCChipTrailingActionFoundation.defaultAdapter), adapter)) || this; } Object.defineProperty(MDCChipTrailingActionFoundation, "strings", { get: function get() { return constants_1.strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCChipTrailingActionFoundation, "defaultAdapter", { get: function get() { return { focus: function focus() { return undefined; }, getAttribute: function getAttribute() { return null; }, setAttribute: function setAttribute() { return undefined; }, notifyInteraction: function notifyInteraction() { return undefined; }, notifyNavigation: function notifyNavigation() { return undefined; } }; }, enumerable: true, configurable: true }); MDCChipTrailingActionFoundation.prototype.handleClick = function (evt) { evt.stopPropagation(); this.adapter.notifyInteraction(constants_1.InteractionTrigger.CLICK); }; MDCChipTrailingActionFoundation.prototype.handleKeydown = function (evt) { evt.stopPropagation(); var key = keyboard_1.normalizeKey(evt); if (this.shouldNotifyInteractionFromKey_(key)) { var trigger = this.getTriggerFromKey_(key); this.adapter.notifyInteraction(trigger); return; } if (keyboard_1.isNavigationEvent(evt)) { this.adapter.notifyNavigation(key); return; } }; MDCChipTrailingActionFoundation.prototype.removeFocus = function () { this.adapter.setAttribute(constants_1.strings.TAB_INDEX, '-1'); }; MDCChipTrailingActionFoundation.prototype.focus = function () { this.adapter.setAttribute(constants_1.strings.TAB_INDEX, '0'); this.adapter.focus(); }; MDCChipTrailingActionFoundation.prototype.isNavigable = function () { return this.adapter.getAttribute(constants_1.strings.ARIA_HIDDEN) !== 'true'; }; MDCChipTrailingActionFoundation.prototype.shouldNotifyInteractionFromKey_ = function (key) { var isFromActionKey = key === keyboard_1.KEY.ENTER || key === keyboard_1.KEY.SPACEBAR; var isFromDeleteKey = key === keyboard_1.KEY.BACKSPACE || key === keyboard_1.KEY.DELETE; return isFromActionKey || isFromDeleteKey; }; MDCChipTrailingActionFoundation.prototype.getTriggerFromKey_ = function (key) { if (key === keyboard_1.KEY.SPACEBAR) { return constants_1.InteractionTrigger.SPACEBAR_KEY; } if (key === keyboard_1.KEY.ENTER) { return constants_1.InteractionTrigger.ENTER_KEY; } if (key === keyboard_1.KEY.DELETE) { return constants_1.InteractionTrigger.DELETE_KEY; } if (key === keyboard_1.KEY.BACKSPACE) { return constants_1.InteractionTrigger.BACKSPACE_KEY; } // Default case, should never be returned return constants_1.InteractionTrigger.UNSPECIFIED; }; return MDCChipTrailingActionFoundation; }(foundation_1.MDCFoundation); exports.MDCChipTrailingActionFoundation = MDCChipTrailingActionFoundation; // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. exports.default = MDCChipTrailingActionFoundation; /***/ }), /***/ "./packages/mdc-chips/trailingaction/index.ts": /*!****************************************************!*\ !*** ./packages/mdc-chips/trailingaction/index.ts ***! \****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2020 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. */ function __export(m) { for (var p in m) { if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__(/*! ./component */ "./packages/mdc-chips/trailingaction/component.ts")); __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-chips/trailingaction/foundation.ts")); var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-chips/trailingaction/constants.ts"); exports.trailingActionStrings = constants_1.strings; /***/ }), /***/ "./packages/mdc-circular-progress/component.ts": /*!*****************************************************!*\ !*** ./packages/mdc-circular-progress/component.ts ***! \*****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2020 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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); Object.defineProperty(exports, "__esModule", { value: true }); var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-circular-progress/foundation.ts"); var MDCCircularProgress = /** @class */function (_super) { __extends(MDCCircularProgress, _super); function MDCCircularProgress() { return _super !== null && _super.apply(this, arguments) || this; } MDCCircularProgress.prototype.initialize = function () { this.determinateCircle_ = this.root.querySelector(foundation_1.MDCCircularProgressFoundation.strings.DETERMINATE_CIRCLE_SELECTOR); }; MDCCircularProgress.attachTo = function (root) { return new MDCCircularProgress(root); }; Object.defineProperty(MDCCircularProgress.prototype, "determinate", { /** * Sets whether the progress indicator is in determinate mode. * @param isDeterminate Whether the indicator should be determinate. */ set: function set(value) { this.foundation.setDeterminate(value); }, enumerable: true, configurable: true }); Object.defineProperty(MDCCircularProgress.prototype, "progress", { /** * Sets the current progress value. In indeterminate mode, this has no * visual effect but will be reflected if the indicator is switched to * determinate mode. * @param value The current progress value, which must be between 0 and 1. */ set: function set(value) { this.foundation.setProgress(value); }, enumerable: true, configurable: true }); Object.defineProperty(MDCCircularProgress.prototype, "isClosed", { /** * Whether the progress indicator is hidden. */ get: function get() { return this.foundation.isClosed(); }, enumerable: true, configurable: true }); /** * Shows the progress indicator. */ MDCCircularProgress.prototype.open = function () { this.foundation.open(); }; /** * Hides the progress indicator. */ MDCCircularProgress.prototype.close = function () { this.foundation.close(); }; MDCCircularProgress.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take // a Partial. 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); }, getDeterminateCircleAttribute: function getDeterminateCircleAttribute(attributeName) { return _this.determinateCircle_.getAttribute(attributeName); }, hasClass: function hasClass(className) { return _this.root.classList.contains(className); }, removeClass: function removeClass(className) { return _this.root.classList.remove(className); }, removeAttribute: function removeAttribute(attributeName) { return _this.root.removeAttribute(attributeName); }, setAttribute: function setAttribute(attributeName, value) { return _this.root.setAttribute(attributeName, value); }, setDeterminateCircleAttribute: function setDeterminateCircleAttribute(attributeName, value) { return _this.determinateCircle_.setAttribute(attributeName, value); } }; return new foundation_1.MDCCircularProgressFoundation(adapter); }; return MDCCircularProgress; }(component_1.MDCComponent); exports.MDCCircularProgress = MDCCircularProgress; /***/ }), /***/ "./packages/mdc-circular-progress/constants.ts": /*!*****************************************************!*\ !*** ./packages/mdc-circular-progress/constants.ts ***! \*****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2020 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 }); /** * CSS class names used in component. */ exports.cssClasses = { INDETERMINATE_CLASS: 'mdc-circular-progress--indeterminate', CLOSED_CLASS: 'mdc-circular-progress--closed' }; /** * Attributes and selectors used in component. */ exports.strings = { DETERMINATE_CIRCLE_SELECTOR: '.mdc-circular-progress__determinate-circle', ARIA_VALUENOW: 'aria-valuenow', RADIUS: 'r', STROKE_DASHOFFSET: 'stroke-dashoffset' }; /***/ }), /***/ "./packages/mdc-circular-progress/foundation.ts": /*!******************************************************!*\ !*** ./packages/mdc-circular-progress/foundation.ts ***! \******************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2020 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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _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 }); var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-circular-progress/constants.ts"); var MDCCircularProgressFoundation = /** @class */function (_super) { __extends(MDCCircularProgressFoundation, _super); function MDCCircularProgressFoundation(adapter) { return _super.call(this, __assign(__assign({}, MDCCircularProgressFoundation.defaultAdapter), adapter)) || this; } Object.defineProperty(MDCCircularProgressFoundation, "cssClasses", { get: function get() { return constants_1.cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCCircularProgressFoundation, "strings", { get: function get() { return constants_1.strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCCircularProgressFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, getDeterminateCircleAttribute: function getDeterminateCircleAttribute() { return null; }, hasClass: function hasClass() { return false; }, removeClass: function removeClass() { return undefined; }, removeAttribute: function removeAttribute() { return undefined; }, setAttribute: function setAttribute() { return undefined; }, setDeterminateCircleAttribute: function setDeterminateCircleAttribute() { return undefined; } }; }, enumerable: true, configurable: true }); MDCCircularProgressFoundation.prototype.init = function () { this.isClosed_ = this.adapter.hasClass(constants_1.cssClasses.CLOSED_CLASS); this.isDeterminate_ = !this.adapter.hasClass(constants_1.cssClasses.INDETERMINATE_CLASS); this.progress_ = 0; if (this.isDeterminate_) { this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, this.progress_.toString()); } this.radius_ = Number(this.adapter.getDeterminateCircleAttribute(constants_1.strings.RADIUS)); }; MDCCircularProgressFoundation.prototype.isDeterminate = function () { return this.isDeterminate_; }; MDCCircularProgressFoundation.prototype.getProgress = function () { return this.progress_; }; /** * @return Returns whether the progress indicator is hidden. */ MDCCircularProgressFoundation.prototype.isClosed = function () { return this.isClosed_; }; /** * Sets whether the progress indicator is in determinate mode. * @param isDeterminate Whether the indicator should be determinate. */ MDCCircularProgressFoundation.prototype.setDeterminate = function (isDeterminate) { this.isDeterminate_ = isDeterminate; if (this.isDeterminate_) { this.adapter.removeClass(constants_1.cssClasses.INDETERMINATE_CLASS); this.setProgress(this.progress_); } else { this.adapter.addClass(constants_1.cssClasses.INDETERMINATE_CLASS); this.adapter.removeAttribute(constants_1.strings.ARIA_VALUENOW); } }; /** * Sets the current progress value. In indeterminate mode, this has no * visual effect but will be reflected if the indicator is switched to * determinate mode. * @param value The current progress value, which must be between 0 and 1. */ MDCCircularProgressFoundation.prototype.setProgress = function (value) { this.progress_ = value; if (this.isDeterminate_) { var unfilledArcLength = (1 - this.progress_) * (2 * Math.PI * this.radius_); this.adapter.setDeterminateCircleAttribute(constants_1.strings.STROKE_DASHOFFSET, "" + unfilledArcLength); this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, this.progress_.toString()); } }; /** * Shows the progress indicator. */ MDCCircularProgressFoundation.prototype.open = function () { this.isClosed_ = false; this.adapter.removeClass(constants_1.cssClasses.CLOSED_CLASS); }; /** * Hides the progress indicator */ MDCCircularProgressFoundation.prototype.close = function () { this.isClosed_ = true; this.adapter.addClass(constants_1.cssClasses.CLOSED_CLASS); }; return MDCCircularProgressFoundation; }(foundation_1.MDCFoundation); exports.MDCCircularProgressFoundation = MDCCircularProgressFoundation; // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. exports.default = MDCCircularProgressFoundation; /***/ }), /***/ "./packages/mdc-circular-progress/index.ts": /*!*************************************************!*\ !*** ./packages/mdc-circular-progress/index.ts ***! \*************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2020 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. */ function __export(m) { for (var p in m) { if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__(/*! ./component */ "./packages/mdc-circular-progress/component.ts")); __export(__webpack_require__(/*! ./constants */ "./packages/mdc-circular-progress/constants.ts")); __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-circular-progress/foundation.ts")); /***/ }), /***/ "./packages/mdc-data-table/component.ts": /*!**********************************************!*\ !*** ./packages/mdc-data-table/component.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 _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 __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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); Object.defineProperty(exports, "__esModule", { value: true }); var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); var component_2 = __webpack_require__(/*! @material/checkbox/component */ "./packages/mdc-checkbox/component.ts"); var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-data-table/constants.ts"); var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-data-table/foundation.ts"); /** * Implementation of `MDCDataTableFoundation` */ var MDCDataTable = /** @class */function (_super) { __extends(MDCDataTable, _super); function MDCDataTable() { return _super !== null && _super.apply(this, arguments) || this; } MDCDataTable.attachTo = function (root) { return new MDCDataTable(root); }; MDCDataTable.prototype.initialize = function (checkboxFactory) { if (checkboxFactory === void 0) { checkboxFactory = function checkboxFactory(el) { return new component_2.MDCCheckbox(el); }; } this.checkboxFactory = checkboxFactory; }; MDCDataTable.prototype.initialSyncWithDOM = function () { var _this = this; this.headerRow = this.root.querySelector("." + constants_1.cssClasses.HEADER_ROW); this.handleHeaderRowCheckboxChange = function () { return _this.foundation.handleHeaderRowCheckboxChange(); }; this.headerRow.addEventListener('change', this.handleHeaderRowCheckboxChange); this.headerRowClickListener = function (event) { _this.handleHeaderRowClick(event); }; this.headerRow.addEventListener('click', this.headerRowClickListener); this.content = this.root.querySelector("." + constants_1.cssClasses.CONTENT); this.handleRowCheckboxChange = function (event) { return _this.foundation.handleRowCheckboxChange(event); }; this.content.addEventListener('change', this.handleRowCheckboxChange); this.layout(); }; /** * Re-initializes header row checkbox and row checkboxes when selectable rows are added or removed from table. */ MDCDataTable.prototype.layout = function () { this.foundation.layout(); }; /** * @return Returns array of header row cell elements. */ MDCDataTable.prototype.getHeaderCells = function () { return [].slice.call(this.root.querySelectorAll(constants_1.selectors.HEADER_CELL)); }; /** * @return Returns array of row elements. */ MDCDataTable.prototype.getRows = function () { return this.foundation.getRows(); }; /** * @return Returns array of selected row ids. */ MDCDataTable.prototype.getSelectedRowIds = function () { return this.foundation.getSelectedRowIds(); }; /** * Sets selected row ids. Overwrites previously selected rows. * @param rowIds Array of row ids that needs to be selected. */ MDCDataTable.prototype.setSelectedRowIds = function (rowIds) { this.foundation.setSelectedRowIds(rowIds); }; MDCDataTable.prototype.destroy = function () { this.headerRow.removeEventListener('change', this.handleHeaderRowCheckboxChange); this.headerRow.removeEventListener('click', this.headerRowClickListener); this.content.removeEventListener('change', this.handleRowCheckboxChange); this.headerRowCheckbox.destroy(); this.rowCheckboxList.forEach(function (checkbox) { checkbox.destroy(); }); }; MDCDataTable.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { _this.root.classList.add(className); }, removeClass: function removeClass(className) { _this.root.classList.remove(className); }, getHeaderCellElements: function getHeaderCellElements() { return _this.getHeaderCells(); }, getHeaderCellCount: function getHeaderCellCount() { return _this.getHeaderCells().length; }, getAttributeByHeaderCellIndex: function getAttributeByHeaderCellIndex(index, attribute) { return _this.getHeaderCells()[index].getAttribute(attribute); }, setAttributeByHeaderCellIndex: function setAttributeByHeaderCellIndex(index, attribute, value) { _this.getHeaderCells()[index].setAttribute(attribute, value); }, setClassNameByHeaderCellIndex: function setClassNameByHeaderCellIndex(index, className) { _this.getHeaderCells()[index].classList.add(className); }, removeClassNameByHeaderCellIndex: function removeClassNameByHeaderCellIndex(index, className) { _this.getHeaderCells()[index].classList.remove(className); }, notifySortAction: function notifySortAction(data) { _this.emit(constants_1.events.SORTED, data, /** shouldBubble */true); }, getTableBodyHeight: function getTableBodyHeight() { var tableBody = _this.root.querySelector(constants_1.selectors.CONTENT); if (!tableBody) { throw new Error('MDCDataTable: Table body element not found.'); } return tableBody.getBoundingClientRect().height + "px"; }, getTableHeaderHeight: function getTableHeaderHeight() { var tableHeader = _this.root.querySelector(constants_1.selectors.HEADER_ROW); if (!tableHeader) { throw new Error('MDCDataTable: Table header element not found.'); } return tableHeader.getBoundingClientRect().height + "px"; }, setProgressIndicatorStyles: function setProgressIndicatorStyles(styles) { var progressIndicator = _this.root.querySelector(constants_1.selectors.PROGRESS_INDICATOR); if (!progressIndicator) { throw new Error('MDCDataTable: Progress indicator element not found.'); } _extends(progressIndicator.style, styles); }, addClassAtRowIndex: function addClassAtRowIndex(rowIndex, className) { _this.getRows()[rowIndex].classList.add(className); }, getRowCount: function getRowCount() { return _this.getRows().length; }, getRowElements: function getRowElements() { return [].slice.call(_this.root.querySelectorAll(constants_1.selectors.ROW)); }, getRowIdAtIndex: function getRowIdAtIndex(rowIndex) { return _this.getRows()[rowIndex].getAttribute(constants_1.dataAttributes.ROW_ID); }, getRowIndexByChildElement: function getRowIndexByChildElement(el) { return _this.getRows().indexOf(ponyfill_1.closest(el, constants_1.selectors.ROW)); }, getSelectedRowCount: function getSelectedRowCount() { return _this.root.querySelectorAll(constants_1.selectors.ROW_SELECTED).length; }, isCheckboxAtRowIndexChecked: function isCheckboxAtRowIndexChecked(rowIndex) { return _this.rowCheckboxList[rowIndex].checked; }, isHeaderRowCheckboxChecked: function isHeaderRowCheckboxChecked() { return _this.headerRowCheckbox.checked; }, isRowsSelectable: function isRowsSelectable() { return !!_this.root.querySelector(constants_1.selectors.ROW_CHECKBOX); }, notifyRowSelectionChanged: function notifyRowSelectionChanged(data) { _this.emit(constants_1.events.ROW_SELECTION_CHANGED, { row: _this.getRowByIndex(data.rowIndex), rowId: _this.getRowIdByIndex(data.rowIndex), rowIndex: data.rowIndex, selected: data.selected }, /** shouldBubble */true); }, notifySelectedAll: function notifySelectedAll() { _this.emit(constants_1.events.SELECTED_ALL, {}, /** shouldBubble */true); }, notifyUnselectedAll: function notifyUnselectedAll() { _this.emit(constants_1.events.UNSELECTED_ALL, {}, /** shouldBubble */true); }, registerHeaderRowCheckbox: function registerHeaderRowCheckbox() { if (_this.headerRowCheckbox) { _this.headerRowCheckbox.destroy(); } var checkboxEl = _this.root.querySelector(constants_1.selectors.HEADER_ROW_CHECKBOX); _this.headerRowCheckbox = _this.checkboxFactory(checkboxEl); }, registerRowCheckboxes: function registerRowCheckboxes() { if (_this.rowCheckboxList) { _this.rowCheckboxList.forEach(function (checkbox) { checkbox.destroy(); }); } _this.rowCheckboxList = []; _this.getRows().forEach(function (rowEl) { var checkbox = _this.checkboxFactory(rowEl.querySelector(constants_1.selectors.ROW_CHECKBOX)); _this.rowCheckboxList.push(checkbox); }); }, removeClassAtRowIndex: function removeClassAtRowIndex(rowIndex, className) { _this.getRows()[rowIndex].classList.remove(className); }, setAttributeAtRowIndex: function setAttributeAtRowIndex(rowIndex, attr, value) { _this.getRows()[rowIndex].setAttribute(attr, value); }, setHeaderRowCheckboxChecked: function setHeaderRowCheckboxChecked(checked) { _this.headerRowCheckbox.checked = checked; }, setHeaderRowCheckboxIndeterminate: function setHeaderRowCheckboxIndeterminate(indeterminate) { _this.headerRowCheckbox.indeterminate = indeterminate; }, setRowCheckboxCheckedAtIndex: function setRowCheckboxCheckedAtIndex(rowIndex, checked) { _this.rowCheckboxList[rowIndex].checked = checked; }, setSortStatusLabelByHeaderCellIndex: function setSortStatusLabelByHeaderCellIndex(columnIndex, sortValue) { var headerCell = _this.getHeaderCells()[columnIndex]; var sortStatusLabel = headerCell.querySelector(constants_1.selectors.SORT_STATUS_LABEL); if (!sortStatusLabel) return; sortStatusLabel.textContent = _this.getSortStatusMessageBySortValue(sortValue); } }; return new foundation_1.MDCDataTableFoundation(adapter); }; MDCDataTable.prototype.getRowByIndex = function (index) { return this.getRows()[index]; }; MDCDataTable.prototype.getRowIdByIndex = function (index) { return this.getRowByIndex(index).getAttribute(constants_1.dataAttributes.ROW_ID); }; MDCDataTable.prototype.handleHeaderRowClick = function (event) { var headerCell = ponyfill_1.closest(event.target, constants_1.selectors.HEADER_CELL_WITH_SORT); if (!headerCell) { return; } var columnId = headerCell.getAttribute(constants_1.dataAttributes.COLUMN_ID); var columnIndex = this.getHeaderCells().indexOf(headerCell); if (columnIndex === -1) { return; } this.foundation.handleSortAction({ columnId: columnId, columnIndex: columnIndex, headerCell: headerCell }); }; MDCDataTable.prototype.getSortStatusMessageBySortValue = function (sortValue) { switch (sortValue) { case constants_1.SortValue.ASCENDING: return constants_1.messages.SORTED_IN_ASCENDING; case constants_1.SortValue.DESCENDING: return constants_1.messages.SORTED_IN_DESCENDING; default: return ''; } }; return MDCDataTable; }(component_1.MDCComponent); exports.MDCDataTable = MDCDataTable; /***/ }), /***/ "./packages/mdc-data-table/constants.ts": /*!**********************************************!*\ !*** ./packages/mdc-data-table/constants.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 }); /** * CSS class names used in component. */ exports.cssClasses = { CELL: 'mdc-data-table__cell', CELL_NUMERIC: 'mdc-data-table__cell--numeric', CONTENT: 'mdc-data-table__content', HEADER_CELL: 'mdc-data-table__header-cell', HEADER_CELL_LABEL: 'mdc-data-table__header-cell-label', HEADER_CELL_SORTED: 'mdc-data-table__header-cell--sorted', HEADER_CELL_SORTED_DESCENDING: 'mdc-data-table__header-cell--sorted-descending', HEADER_CELL_WITH_SORT: 'mdc-data-table__header-cell--with-sort', HEADER_CELL_WRAPPER: 'mdc-data-table__header-cell-wrapper', HEADER_ROW: 'mdc-data-table__header-row', HEADER_ROW_CHECKBOX: 'mdc-data-table__header-row-checkbox', IN_PROGRESS: 'mdc-data-table--in-progress', PROGRESS_INDICATOR: 'mdc-data-table__progress-indicator', ROOT: 'mdc-data-table', ROW: 'mdc-data-table__row', ROW_CHECKBOX: 'mdc-data-table__row-checkbox', ROW_SELECTED: 'mdc-data-table__row--selected', SORT_ICON_BUTTON: 'mdc-data-table__sort-icon-button', SORT_STATUS_LABEL: 'mdc-data-table__sort-status-label', PAGINATION_ROWS_PER_PAGE_SELECT: 'mdc-data-table__pagination-rows-per-page-select', PAGINATION_ROWS_PER_PAGE_LABEL: 'mdc-data-table__pagination-rows-per-page-label' }; /** * DOM attributes used in component. */ exports.attributes = { ARIA_SELECTED: 'aria-selected', ARIA_SORT: 'aria-sort' }; /** * List of data attributes used in component. */ exports.dataAttributes = { COLUMN_ID: 'data-column-id', ROW_ID: 'data-row-id' }; /** * CSS selectors used in component. */ exports.selectors = { CONTENT: "." + exports.cssClasses.CONTENT, HEADER_CELL: "." + exports.cssClasses.HEADER_CELL, HEADER_CELL_WITH_SORT: "." + exports.cssClasses.HEADER_CELL_WITH_SORT, HEADER_ROW: "." + exports.cssClasses.HEADER_ROW, HEADER_ROW_CHECKBOX: "." + exports.cssClasses.HEADER_ROW_CHECKBOX, PROGRESS_INDICATOR: "." + exports.cssClasses.PROGRESS_INDICATOR, ROW: "." + exports.cssClasses.ROW, ROW_CHECKBOX: "." + exports.cssClasses.ROW_CHECKBOX, ROW_SELECTED: "." + exports.cssClasses.ROW_SELECTED, SORT_ICON_BUTTON: "." + exports.cssClasses.SORT_ICON_BUTTON, SORT_STATUS_LABEL: "." + exports.cssClasses.SORT_STATUS_LABEL }; /** * Messages used in component. */ exports.messages = { SORTED_IN_DESCENDING: 'Sorted in descending order', SORTED_IN_ASCENDING: 'Sorted in ascending order' }; /** * Attributes and selectors used in component. * @deprecated Use `attributes`, `dataAttributes` and `selectors` instead. */ exports.strings = { ARIA_SELECTED: exports.attributes.ARIA_SELECTED, ARIA_SORT: exports.attributes.ARIA_SORT, DATA_ROW_ID_ATTR: exports.dataAttributes.ROW_ID, HEADER_ROW_CHECKBOX_SELECTOR: exports.selectors.HEADER_ROW_CHECKBOX, ROW_CHECKBOX_SELECTOR: exports.selectors.ROW_CHECKBOX, ROW_SELECTED_SELECTOR: exports.selectors.ROW_SELECTED, ROW_SELECTOR: exports.selectors.ROW }; /** * Sort values defined by ARIA. * See https://www.w3.org/WAI/PF/aria/states_and_properties#aria-sort */ var SortValue; (function (SortValue) { // Items are sorted in ascending order by this column. SortValue["ASCENDING"] = "ascending"; // Items are sorted in descending order by this column. SortValue["DESCENDING"] = "descending"; // There is no defined sort applied to the column. SortValue["NONE"] = "none"; // A sort algorithm other than ascending or descending has been applied. SortValue["OTHER"] = "other"; })(SortValue = exports.SortValue || (exports.SortValue = {})); /** * Event names used in component. */ exports.events = { ROW_SELECTION_CHANGED: 'MDCDataTable:rowSelectionChanged', SELECTED_ALL: 'MDCDataTable:selectedAll', UNSELECTED_ALL: 'MDCDataTable:unselectedAll', SORTED: 'MDCDataTable:sorted' }; /***/ }), /***/ "./packages/mdc-data-table/foundation.ts": /*!***********************************************!*\ !*** ./packages/mdc-data-table/foundation.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 __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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _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); }; var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __generator = this && this.__generator || function (thisArg, body) { var _ = { label: 0, sent: function sent() { if (t[0] & 1) throw t[1];return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) { try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0:case 1: t = op;break; case 4: _.label++;return { value: op[1], done: false }; case 5: _.label++;y = op[1];op = [0];continue; case 7: op = _.ops.pop();_.trys.pop();continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0;continue; } if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { _.label = op[1];break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1];t = op;break; } if (t && _.label < t[2]) { _.label = t[2];_.ops.push(op);break; } if (t[2]) _.ops.pop(); _.trys.pop();continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e];y = 0; } finally { f = t = 0; } }if (op[0] & 5) throw op[1];return { value: op[0] ? op[1] : void 0, done: true }; } }; Object.defineProperty(exports, "__esModule", { value: true }); var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-data-table/constants.ts"); /** * The Foundation of data table component containing pure business logic, any * logic requiring DOM manipulation are delegated to adapter methods. */ var MDCDataTableFoundation = /** @class */function (_super) { __extends(MDCDataTableFoundation, _super); function MDCDataTableFoundation(adapter) { return _super.call(this, __assign(__assign({}, MDCDataTableFoundation.defaultAdapter), adapter)) || this; } Object.defineProperty(MDCDataTableFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, addClassAtRowIndex: function addClassAtRowIndex() { return undefined; }, getAttributeByHeaderCellIndex: function getAttributeByHeaderCellIndex() { return ''; }, getHeaderCellCount: function getHeaderCellCount() { return 0; }, getHeaderCellElements: function getHeaderCellElements() { return []; }, getRowCount: function getRowCount() { return 0; }, getRowElements: function getRowElements() { return []; }, getRowIdAtIndex: function getRowIdAtIndex() { return ''; }, getRowIndexByChildElement: function getRowIndexByChildElement() { return 0; }, getSelectedRowCount: function getSelectedRowCount() { return 0; }, getTableBodyHeight: function getTableBodyHeight() { return ''; }, getTableHeaderHeight: function getTableHeaderHeight() { return ''; }, isCheckboxAtRowIndexChecked: function isCheckboxAtRowIndexChecked() { return false; }, isHeaderRowCheckboxChecked: function isHeaderRowCheckboxChecked() { return false; }, isRowsSelectable: function isRowsSelectable() { return false; }, notifyRowSelectionChanged: function notifyRowSelectionChanged() { return undefined; }, notifySelectedAll: function notifySelectedAll() { return undefined; }, notifySortAction: function notifySortAction() { return undefined; }, notifyUnselectedAll: function notifyUnselectedAll() { return undefined; }, registerHeaderRowCheckbox: function registerHeaderRowCheckbox() { return undefined; }, registerRowCheckboxes: function registerRowCheckboxes() { return undefined; }, removeClass: function removeClass() { return undefined; }, removeClassAtRowIndex: function removeClassAtRowIndex() { return undefined; }, removeClassNameByHeaderCellIndex: function removeClassNameByHeaderCellIndex() { return undefined; }, setAttributeAtRowIndex: function setAttributeAtRowIndex() { return undefined; }, setAttributeByHeaderCellIndex: function setAttributeByHeaderCellIndex() { return undefined; }, setClassNameByHeaderCellIndex: function setClassNameByHeaderCellIndex() { return undefined; }, setHeaderRowCheckboxChecked: function setHeaderRowCheckboxChecked() { return undefined; }, setHeaderRowCheckboxIndeterminate: function setHeaderRowCheckboxIndeterminate() { return undefined; }, setProgressIndicatorStyles: function setProgressIndicatorStyles() { return undefined; }, setRowCheckboxCheckedAtIndex: function setRowCheckboxCheckedAtIndex() { return undefined; }, setSortStatusLabelByHeaderCellIndex: function setSortStatusLabelByHeaderCellIndex() { return undefined; } }; }, enumerable: true, configurable: true }); /** * Re-initializes header row checkbox and row checkboxes when selectable rows are added or removed from table. * Use this if registering checkbox is synchronous. */ MDCDataTableFoundation.prototype.layout = function () { if (this.adapter.isRowsSelectable()) { this.adapter.registerHeaderRowCheckbox(); this.adapter.registerRowCheckboxes(); this.setHeaderRowCheckboxState(); } }; /** * Re-initializes header row checkbox and row checkboxes when selectable rows are added or removed from table. * Use this if registering checkbox is asynchronous. */ MDCDataTableFoundation.prototype.layoutAsync = function () { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { switch (_a.label) { case 0: if (!this.adapter.isRowsSelectable()) return [3 /*break*/, 3]; return [4 /*yield*/, this.adapter.registerHeaderRowCheckbox()]; case 1: _a.sent(); return [4 /*yield*/, this.adapter.registerRowCheckboxes()]; case 2: _a.sent(); this.setHeaderRowCheckboxState(); _a.label = 3; case 3: return [2 /*return*/]; } }); }); }; /** * @return Returns array of row elements. */ MDCDataTableFoundation.prototype.getRows = function () { return this.adapter.getRowElements(); }; /** * @return Array of header cell elements. */ MDCDataTableFoundation.prototype.getHeaderCells = function () { return this.adapter.getHeaderCellElements(); }; /** * Sets selected row ids. Overwrites previously selected rows. * @param rowIds Array of row ids that needs to be selected. */ MDCDataTableFoundation.prototype.setSelectedRowIds = function (rowIds) { for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) { var rowId = this.adapter.getRowIdAtIndex(rowIndex); var isSelected = false; if (rowId && rowIds.indexOf(rowId) >= 0) { isSelected = true; } this.adapter.setRowCheckboxCheckedAtIndex(rowIndex, isSelected); this.selectRowAtIndex(rowIndex, isSelected); } this.setHeaderRowCheckboxState(); }; /** * @return Returns array of all row ids. */ MDCDataTableFoundation.prototype.getRowIds = function () { var rowIds = []; for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) { rowIds.push(this.adapter.getRowIdAtIndex(rowIndex)); } return rowIds; }; /** * @return Returns array of selected row ids. */ MDCDataTableFoundation.prototype.getSelectedRowIds = function () { var selectedRowIds = []; for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) { if (this.adapter.isCheckboxAtRowIndexChecked(rowIndex)) { selectedRowIds.push(this.adapter.getRowIdAtIndex(rowIndex)); } } return selectedRowIds; }; /** * Handles header row checkbox change event. */ MDCDataTableFoundation.prototype.handleHeaderRowCheckboxChange = function () { var isHeaderChecked = this.adapter.isHeaderRowCheckboxChecked(); for (var rowIndex = 0; rowIndex < this.adapter.getRowCount(); rowIndex++) { this.adapter.setRowCheckboxCheckedAtIndex(rowIndex, isHeaderChecked); this.selectRowAtIndex(rowIndex, isHeaderChecked); } if (isHeaderChecked) { this.adapter.notifySelectedAll(); } else { this.adapter.notifyUnselectedAll(); } }; /** * Handles change event originated from row checkboxes. */ MDCDataTableFoundation.prototype.handleRowCheckboxChange = function (event) { var rowIndex = this.adapter.getRowIndexByChildElement(event.target); if (rowIndex === -1) { return; } var selected = this.adapter.isCheckboxAtRowIndexChecked(rowIndex); this.selectRowAtIndex(rowIndex, selected); this.setHeaderRowCheckboxState(); var rowId = this.adapter.getRowIdAtIndex(rowIndex); this.adapter.notifyRowSelectionChanged({ rowId: rowId, rowIndex: rowIndex, selected: selected }); }; /** * Handles sort action on sortable header cell. */ MDCDataTableFoundation.prototype.handleSortAction = function (eventData) { var columnId = eventData.columnId, columnIndex = eventData.columnIndex, headerCell = eventData.headerCell; // Reset sort attributes / classes on other header cells. for (var index = 0; index < this.adapter.getHeaderCellCount(); index++) { if (index === columnIndex) { continue; } this.adapter.removeClassNameByHeaderCellIndex(index, constants_1.cssClasses.HEADER_CELL_SORTED); this.adapter.removeClassNameByHeaderCellIndex(index, constants_1.cssClasses.HEADER_CELL_SORTED_DESCENDING); this.adapter.setAttributeByHeaderCellIndex(index, constants_1.strings.ARIA_SORT, constants_1.SortValue.NONE); this.adapter.setSortStatusLabelByHeaderCellIndex(index, constants_1.SortValue.NONE); } // Set appropriate sort attributes / classes on target header cell. this.adapter.setClassNameByHeaderCellIndex(columnIndex, constants_1.cssClasses.HEADER_CELL_SORTED); var currentSortValue = this.adapter.getAttributeByHeaderCellIndex(columnIndex, constants_1.strings.ARIA_SORT); var sortValue = constants_1.SortValue.NONE; // Set to descending if sorted on ascending order. if (currentSortValue === constants_1.SortValue.ASCENDING) { this.adapter.setClassNameByHeaderCellIndex(columnIndex, constants_1.cssClasses.HEADER_CELL_SORTED_DESCENDING); this.adapter.setAttributeByHeaderCellIndex(columnIndex, constants_1.strings.ARIA_SORT, constants_1.SortValue.DESCENDING); sortValue = constants_1.SortValue.DESCENDING; // Set to ascending if sorted on descending order. } else if (currentSortValue === constants_1.SortValue.DESCENDING) { this.adapter.removeClassNameByHeaderCellIndex(columnIndex, constants_1.cssClasses.HEADER_CELL_SORTED_DESCENDING); this.adapter.setAttributeByHeaderCellIndex(columnIndex, constants_1.strings.ARIA_SORT, constants_1.SortValue.ASCENDING); sortValue = constants_1.SortValue.ASCENDING; } else { // Set to ascending by default when not sorted. this.adapter.setAttributeByHeaderCellIndex(columnIndex, constants_1.strings.ARIA_SORT, constants_1.SortValue.ASCENDING); sortValue = constants_1.SortValue.ASCENDING; } this.adapter.setSortStatusLabelByHeaderCellIndex(columnIndex, sortValue); this.adapter.notifySortAction({ columnId: columnId, columnIndex: columnIndex, headerCell: headerCell, sortValue: sortValue }); }; /** * Shows progress indicator blocking only the table body content when in * loading state. */ MDCDataTableFoundation.prototype.showProgress = function () { var height = this.adapter.getTableBodyHeight(); var top = this.adapter.getTableHeaderHeight(); this.adapter.setProgressIndicatorStyles({ height: height, top: top }); this.adapter.addClass(constants_1.cssClasses.IN_PROGRESS); }; /** * Hides progress indicator when data table is finished loading. */ MDCDataTableFoundation.prototype.hideProgress = function () { this.adapter.removeClass(constants_1.cssClasses.IN_PROGRESS); }; /** * Updates header row checkbox state based on number of rows selected. */ MDCDataTableFoundation.prototype.setHeaderRowCheckboxState = function () { if (this.adapter.getSelectedRowCount() === this.adapter.getRowCount()) { this.adapter.setHeaderRowCheckboxChecked(true); this.adapter.setHeaderRowCheckboxIndeterminate(false); } else if (this.adapter.getSelectedRowCount() === 0) { this.adapter.setHeaderRowCheckboxIndeterminate(false); this.adapter.setHeaderRowCheckboxChecked(false); } else { this.adapter.setHeaderRowCheckboxIndeterminate(true); this.adapter.setHeaderRowCheckboxChecked(false); } }; /** * Sets the attributes of row element based on selection state. */ MDCDataTableFoundation.prototype.selectRowAtIndex = function (rowIndex, selected) { if (selected) { this.adapter.addClassAtRowIndex(rowIndex, constants_1.cssClasses.ROW_SELECTED); this.adapter.setAttributeAtRowIndex(rowIndex, constants_1.strings.ARIA_SELECTED, 'true'); } else { this.adapter.removeClassAtRowIndex(rowIndex, constants_1.cssClasses.ROW_SELECTED); this.adapter.setAttributeAtRowIndex(rowIndex, constants_1.strings.ARIA_SELECTED, 'false'); } }; return MDCDataTableFoundation; }(foundation_1.MDCFoundation); exports.MDCDataTableFoundation = MDCDataTableFoundation; /***/ }), /***/ "./packages/mdc-data-table/index.ts": /*!******************************************!*\ !*** ./packages/mdc-data-table/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. */ function __export(m) { for (var p in m) { if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__(/*! ./component */ "./packages/mdc-data-table/component.ts")); __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-data-table/foundation.ts")); __export(__webpack_require__(/*! ./constants */ "./packages/mdc-data-table/constants.ts")); /***/ }), /***/ "./packages/mdc-dialog/component.ts": /*!******************************************!*\ !*** ./packages/mdc-dialog/component.ts ***! \******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2017 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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); var __values = this && this.__values || function (o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function next() { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; var __importStar = this && this.__importStar || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) { if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; }result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); var focus_trap_1 = __webpack_require__(/*! @material/dom/focus-trap */ "./packages/mdc-dom/focus-trap.ts"); var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); var component_2 = __webpack_require__(/*! @material/ripple/component */ "./packages/mdc-ripple/component.ts"); var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-dialog/foundation.ts"); var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-dialog/util.ts")); var strings = foundation_1.MDCDialogFoundation.strings; var MDCDialog = /** @class */function (_super) { __extends(MDCDialog, _super); function MDCDialog() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(MDCDialog.prototype, "isOpen", { get: function get() { return this.foundation.isOpen(); }, enumerable: true, configurable: true }); Object.defineProperty(MDCDialog.prototype, "escapeKeyAction", { get: function get() { return this.foundation.getEscapeKeyAction(); }, set: function set(action) { this.foundation.setEscapeKeyAction(action); }, enumerable: true, configurable: true }); Object.defineProperty(MDCDialog.prototype, "scrimClickAction", { get: function get() { return this.foundation.getScrimClickAction(); }, set: function set(action) { this.foundation.setScrimClickAction(action); }, enumerable: true, configurable: true }); Object.defineProperty(MDCDialog.prototype, "autoStackButtons", { get: function get() { return this.foundation.getAutoStackButtons(); }, set: function set(autoStack) { this.foundation.setAutoStackButtons(autoStack); }, enumerable: true, configurable: true }); MDCDialog.attachTo = function (root) { return new MDCDialog(root); }; MDCDialog.prototype.initialize = function (focusTrapFactory) { var e_1, _a; if (focusTrapFactory === void 0) { focusTrapFactory = function focusTrapFactory(el, focusOptions) { return new focus_trap_1.FocusTrap(el, focusOptions); }; } var container = this.root.querySelector(strings.CONTAINER_SELECTOR); if (!container) { throw new Error("Dialog component requires a " + strings.CONTAINER_SELECTOR + " container element"); } this.container_ = container; this.content_ = this.root.querySelector(strings.CONTENT_SELECTOR); this.buttons_ = [].slice.call(this.root.querySelectorAll(strings.BUTTON_SELECTOR)); this.defaultButton_ = this.root.querySelector("[" + strings.BUTTON_DEFAULT_ATTRIBUTE + "]"); this.focusTrapFactory_ = focusTrapFactory; this.buttonRipples_ = []; try { for (var _b = __values(this.buttons_), _c = _b.next(); !_c.done; _c = _b.next()) { var buttonEl = _c.value; this.buttonRipples_.push(new component_2.MDCRipple(buttonEl)); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } }; MDCDialog.prototype.initialSyncWithDOM = function () { var _this = this; this.focusTrap_ = util.createFocusTrapInstance(this.container_, this.focusTrapFactory_, this.getInitialFocusEl_() || undefined); this.handleClick_ = this.foundation.handleClick.bind(this.foundation); this.handleKeydown_ = this.foundation.handleKeydown.bind(this.foundation); this.handleDocumentKeydown_ = this.foundation.handleDocumentKeydown.bind(this.foundation); this.handleLayout_ = this.layout.bind(this); var LAYOUT_EVENTS = ['resize', 'orientationchange']; this.handleOpening_ = function () { LAYOUT_EVENTS.forEach(function (evtType) { return window.addEventListener(evtType, _this.handleLayout_); }); document.addEventListener('keydown', _this.handleDocumentKeydown_); }; this.handleClosing_ = function () { LAYOUT_EVENTS.forEach(function (evtType) { return window.removeEventListener(evtType, _this.handleLayout_); }); document.removeEventListener('keydown', _this.handleDocumentKeydown_); }; this.listen('click', this.handleClick_); this.listen('keydown', this.handleKeydown_); this.listen(strings.OPENING_EVENT, this.handleOpening_); this.listen(strings.CLOSING_EVENT, this.handleClosing_); }; MDCDialog.prototype.destroy = function () { this.unlisten('click', this.handleClick_); this.unlisten('keydown', this.handleKeydown_); this.unlisten(strings.OPENING_EVENT, this.handleOpening_); this.unlisten(strings.CLOSING_EVENT, this.handleClosing_); this.handleClosing_(); this.buttonRipples_.forEach(function (ripple) { return ripple.destroy(); }); _super.prototype.destroy.call(this); }; MDCDialog.prototype.layout = function () { this.foundation.layout(); }; MDCDialog.prototype.open = function () { this.foundation.open(); }; MDCDialog.prototype.close = function (action) { if (action === void 0) { action = ''; } this.foundation.close(action); }; MDCDialog.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = { addBodyClass: function addBodyClass(className) { return document.body.classList.add(className); }, addClass: function addClass(className) { return _this.root.classList.add(className); }, areButtonsStacked: function areButtonsStacked() { return util.areTopsMisaligned(_this.buttons_); }, clickDefaultButton: function clickDefaultButton() { return _this.defaultButton_ && _this.defaultButton_.click(); }, eventTargetMatches: function eventTargetMatches(target, selector) { return target ? ponyfill_1.matches(target, selector) : false; }, getActionFromEvent: function getActionFromEvent(evt) { if (!evt.target) { return ''; } var element = ponyfill_1.closest(evt.target, "[" + strings.ACTION_ATTRIBUTE + "]"); return element && element.getAttribute(strings.ACTION_ATTRIBUTE); }, getInitialFocusEl: function getInitialFocusEl() { return _this.getInitialFocusEl_(); }, hasClass: function hasClass(className) { return _this.root.classList.contains(className); }, isContentScrollable: function isContentScrollable() { return util.isScrollable(_this.content_); }, notifyClosed: function notifyClosed(action) { return _this.emit(strings.CLOSED_EVENT, action ? { action: action } : {}); }, notifyClosing: function notifyClosing(action) { return _this.emit(strings.CLOSING_EVENT, action ? { action: action } : {}); }, notifyOpened: function notifyOpened() { return _this.emit(strings.OPENED_EVENT, {}); }, notifyOpening: function notifyOpening() { return _this.emit(strings.OPENING_EVENT, {}); }, releaseFocus: function releaseFocus() { return _this.focusTrap_.releaseFocus(); }, removeBodyClass: function removeBodyClass(className) { return document.body.classList.remove(className); }, removeClass: function removeClass(className) { return _this.root.classList.remove(className); }, reverseButtons: function reverseButtons() { _this.buttons_.reverse(); _this.buttons_.forEach(function (button) { button.parentElement.appendChild(button); }); }, trapFocus: function trapFocus() { return _this.focusTrap_.trapFocus(); } }; return new foundation_1.MDCDialogFoundation(adapter); }; MDCDialog.prototype.getInitialFocusEl_ = function () { return document.querySelector("[" + strings.INITIAL_FOCUS_ATTRIBUTE + "]"); }; return MDCDialog; }(component_1.MDCComponent); exports.MDCDialog = MDCDialog; /***/ }), /***/ "./packages/mdc-dialog/constants.ts": /*!******************************************!*\ !*** ./packages/mdc-dialog/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 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.cssClasses = { CLOSING: 'mdc-dialog--closing', OPEN: 'mdc-dialog--open', OPENING: 'mdc-dialog--opening', SCROLLABLE: 'mdc-dialog--scrollable', SCROLL_LOCK: 'mdc-dialog-scroll-lock', STACKED: 'mdc-dialog--stacked' }; exports.strings = { ACTION_ATTRIBUTE: 'data-mdc-dialog-action', BUTTON_DEFAULT_ATTRIBUTE: 'data-mdc-dialog-button-default', BUTTON_SELECTOR: '.mdc-dialog__button', CLOSED_EVENT: 'MDCDialog:closed', CLOSE_ACTION: 'close', CLOSING_EVENT: 'MDCDialog:closing', CONTAINER_SELECTOR: '.mdc-dialog__container', CONTENT_SELECTOR: '.mdc-dialog__content', DESTROY_ACTION: 'destroy', INITIAL_FOCUS_ATTRIBUTE: 'data-mdc-dialog-initial-focus', OPENED_EVENT: 'MDCDialog:opened', OPENING_EVENT: 'MDCDialog:opening', SCRIM_SELECTOR: '.mdc-dialog__scrim', SUPPRESS_DEFAULT_PRESS_SELECTOR: ['textarea', '.mdc-menu .mdc-list-item'].join(', '), SURFACE_SELECTOR: '.mdc-dialog__surface' }; exports.numbers = { DIALOG_ANIMATION_CLOSE_TIME_MS: 75, DIALOG_ANIMATION_OPEN_TIME_MS: 150 }; /***/ }), /***/ "./packages/mdc-dialog/foundation.ts": /*!*******************************************!*\ !*** ./packages/mdc-dialog/foundation.ts ***! \*******************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2017 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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _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 }); var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-dialog/constants.ts"); var MDCDialogFoundation = /** @class */function (_super) { __extends(MDCDialogFoundation, _super); function MDCDialogFoundation(adapter) { var _this = _super.call(this, __assign(__assign({}, MDCDialogFoundation.defaultAdapter), adapter)) || this; _this.isOpen_ = false; _this.animationFrame_ = 0; _this.animationTimer_ = 0; _this.layoutFrame_ = 0; _this.escapeKeyAction_ = constants_1.strings.CLOSE_ACTION; _this.scrimClickAction_ = constants_1.strings.CLOSE_ACTION; _this.autoStackButtons_ = true; _this.areButtonsStacked_ = false; return _this; } Object.defineProperty(MDCDialogFoundation, "cssClasses", { get: function get() { return constants_1.cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCDialogFoundation, "strings", { get: function get() { return constants_1.strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCDialogFoundation, "numbers", { get: function get() { return constants_1.numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCDialogFoundation, "defaultAdapter", { get: function get() { return { addBodyClass: function addBodyClass() { return undefined; }, addClass: function addClass() { return undefined; }, areButtonsStacked: function areButtonsStacked() { return false; }, clickDefaultButton: function clickDefaultButton() { return undefined; }, eventTargetMatches: function eventTargetMatches() { return false; }, getActionFromEvent: function getActionFromEvent() { return ''; }, getInitialFocusEl: function getInitialFocusEl() { return null; }, hasClass: function hasClass() { return false; }, isContentScrollable: function isContentScrollable() { return false; }, notifyClosed: function notifyClosed() { return undefined; }, notifyClosing: function notifyClosing() { return undefined; }, notifyOpened: function notifyOpened() { return undefined; }, notifyOpening: function notifyOpening() { return undefined; }, releaseFocus: function releaseFocus() { return undefined; }, removeBodyClass: function removeBodyClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, reverseButtons: function reverseButtons() { return undefined; }, trapFocus: function trapFocus() { return undefined; } }; }, enumerable: true, configurable: true }); MDCDialogFoundation.prototype.init = function () { if (this.adapter.hasClass(constants_1.cssClasses.STACKED)) { this.setAutoStackButtons(false); } }; MDCDialogFoundation.prototype.destroy = function () { if (this.isOpen_) { this.close(constants_1.strings.DESTROY_ACTION); } if (this.animationTimer_) { clearTimeout(this.animationTimer_); this.handleAnimationTimerEnd_(); } if (this.layoutFrame_) { cancelAnimationFrame(this.layoutFrame_); this.layoutFrame_ = 0; } }; MDCDialogFoundation.prototype.open = function () { var _this = this; this.isOpen_ = true; this.adapter.notifyOpening(); this.adapter.addClass(constants_1.cssClasses.OPENING); // Wait a frame once display is no longer "none", to establish basis for animation this.runNextAnimationFrame_(function () { _this.adapter.addClass(constants_1.cssClasses.OPEN); _this.adapter.addBodyClass(constants_1.cssClasses.SCROLL_LOCK); _this.layout(); _this.animationTimer_ = setTimeout(function () { _this.handleAnimationTimerEnd_(); _this.adapter.trapFocus(_this.adapter.getInitialFocusEl()); _this.adapter.notifyOpened(); }, constants_1.numbers.DIALOG_ANIMATION_OPEN_TIME_MS); }); }; MDCDialogFoundation.prototype.close = function (action) { var _this = this; if (action === void 0) { action = ''; } if (!this.isOpen_) { // Avoid redundant close calls (and events), e.g. from keydown on elements that inherently emit click return; } this.isOpen_ = false; this.adapter.notifyClosing(action); this.adapter.addClass(constants_1.cssClasses.CLOSING); this.adapter.removeClass(constants_1.cssClasses.OPEN); this.adapter.removeBodyClass(constants_1.cssClasses.SCROLL_LOCK); cancelAnimationFrame(this.animationFrame_); this.animationFrame_ = 0; clearTimeout(this.animationTimer_); this.animationTimer_ = setTimeout(function () { _this.adapter.releaseFocus(); _this.handleAnimationTimerEnd_(); _this.adapter.notifyClosed(action); }, constants_1.numbers.DIALOG_ANIMATION_CLOSE_TIME_MS); }; MDCDialogFoundation.prototype.isOpen = function () { return this.isOpen_; }; MDCDialogFoundation.prototype.getEscapeKeyAction = function () { return this.escapeKeyAction_; }; MDCDialogFoundation.prototype.setEscapeKeyAction = function (action) { this.escapeKeyAction_ = action; }; MDCDialogFoundation.prototype.getScrimClickAction = function () { return this.scrimClickAction_; }; MDCDialogFoundation.prototype.setScrimClickAction = function (action) { this.scrimClickAction_ = action; }; MDCDialogFoundation.prototype.getAutoStackButtons = function () { return this.autoStackButtons_; }; MDCDialogFoundation.prototype.setAutoStackButtons = function (autoStack) { this.autoStackButtons_ = autoStack; }; MDCDialogFoundation.prototype.layout = function () { var _this = this; if (this.layoutFrame_) { cancelAnimationFrame(this.layoutFrame_); } this.layoutFrame_ = requestAnimationFrame(function () { _this.layoutInternal_(); _this.layoutFrame_ = 0; }); }; /** Handles click on the dialog root element. */ MDCDialogFoundation.prototype.handleClick = function (evt) { var isScrim = this.adapter.eventTargetMatches(evt.target, constants_1.strings.SCRIM_SELECTOR); // Check for scrim click first since it doesn't require querying ancestors. if (isScrim && this.scrimClickAction_ !== '') { this.close(this.scrimClickAction_); } else { var action = this.adapter.getActionFromEvent(evt); if (action) { this.close(action); } } }; /** Handles keydown on the dialog root element. */ MDCDialogFoundation.prototype.handleKeydown = function (evt) { var isEnter = evt.key === 'Enter' || evt.keyCode === 13; if (!isEnter) { return; } var action = this.adapter.getActionFromEvent(evt); if (action) { // Action button callback is handled in `handleClick`, // since space/enter keydowns on buttons trigger click events. return; } var isDefault = !this.adapter.eventTargetMatches(evt.target, constants_1.strings.SUPPRESS_DEFAULT_PRESS_SELECTOR); if (isEnter && isDefault) { this.adapter.clickDefaultButton(); } }; /** Handles keydown on the document. */ MDCDialogFoundation.prototype.handleDocumentKeydown = function (evt) { var isEscape = evt.key === 'Escape' || evt.keyCode === 27; if (isEscape && this.escapeKeyAction_ !== '') { this.close(this.escapeKeyAction_); } }; MDCDialogFoundation.prototype.layoutInternal_ = function () { if (this.autoStackButtons_) { this.detectStackedButtons_(); } this.detectScrollableContent_(); }; MDCDialogFoundation.prototype.handleAnimationTimerEnd_ = function () { this.animationTimer_ = 0; this.adapter.removeClass(constants_1.cssClasses.OPENING); this.adapter.removeClass(constants_1.cssClasses.CLOSING); }; /** * Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior. */ MDCDialogFoundation.prototype.runNextAnimationFrame_ = function (callback) { var _this = this; cancelAnimationFrame(this.animationFrame_); this.animationFrame_ = requestAnimationFrame(function () { _this.animationFrame_ = 0; clearTimeout(_this.animationTimer_); _this.animationTimer_ = setTimeout(callback, 0); }); }; MDCDialogFoundation.prototype.detectStackedButtons_ = function () { // Remove the class first to let us measure the buttons' natural positions. this.adapter.removeClass(constants_1.cssClasses.STACKED); var areButtonsStacked = this.adapter.areButtonsStacked(); if (areButtonsStacked) { this.adapter.addClass(constants_1.cssClasses.STACKED); } if (areButtonsStacked !== this.areButtonsStacked_) { this.adapter.reverseButtons(); this.areButtonsStacked_ = areButtonsStacked; } }; MDCDialogFoundation.prototype.detectScrollableContent_ = function () { // Remove the class first to let us measure the natural height of the content. this.adapter.removeClass(constants_1.cssClasses.SCROLLABLE); if (this.adapter.isContentScrollable()) { this.adapter.addClass(constants_1.cssClasses.SCROLLABLE); } }; return MDCDialogFoundation; }(foundation_1.MDCFoundation); exports.MDCDialogFoundation = MDCDialogFoundation; // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. exports.default = MDCDialogFoundation; /***/ }), /***/ "./packages/mdc-dialog/index.ts": /*!**************************************!*\ !*** ./packages/mdc-dialog/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. */ function __export(m) { for (var p in m) { if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } } var __importStar = this && this.__importStar || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) { if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; }result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-dialog/util.ts")); exports.util = util; __export(__webpack_require__(/*! ./component */ "./packages/mdc-dialog/component.ts")); __export(__webpack_require__(/*! ./constants */ "./packages/mdc-dialog/constants.ts")); __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-dialog/foundation.ts")); /***/ }), /***/ "./packages/mdc-dialog/util.ts": /*!*************************************!*\ !*** ./packages/mdc-dialog/util.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 }); function createFocusTrapInstance(surfaceEl, focusTrapFactory, initialFocusEl) { return focusTrapFactory(surfaceEl, { initialFocusEl: initialFocusEl }); } exports.createFocusTrapInstance = createFocusTrapInstance; function isScrollable(el) { return el ? el.scrollHeight > el.offsetHeight : false; } exports.isScrollable = isScrollable; function areTopsMisaligned(els) { var tops = new Set(); [].forEach.call(els, function (el) { return tops.add(el.offsetTop); }); return tops.size > 1; } exports.areTopsMisaligned = areTopsMisaligned; /***/ }), /***/ "./packages/mdc-dom/announce.ts": /*!**************************************!*\ !*** ./packages/mdc-dom/announce.ts ***! \**************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2020 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 }); /** * Priorities for the announce function */ var AnnouncerPriority; (function (AnnouncerPriority) { AnnouncerPriority["POLITE"] = "polite"; AnnouncerPriority["ASSERTIVE"] = "assertive"; })(AnnouncerPriority = exports.AnnouncerPriority || (exports.AnnouncerPriority = {})); /** * Announces the given message with optional priority, defaulting to "polite" */ function announce(message, priority) { Announcer.getInstance().say(message, priority); } exports.announce = announce; var Announcer = /** @class */function () { // Constructor made private to ensure only the singleton is used function Announcer() { this.liveRegions = new Map(); } Announcer.getInstance = function () { if (!Announcer.instance) { Announcer.instance = new Announcer(); } return Announcer.instance; }; Announcer.prototype.say = function (message, priority) { if (priority === void 0) { priority = AnnouncerPriority.POLITE; } var liveRegion = this.getLiveRegion(priority); // Reset the region to pick up the message, even if the message is the // exact same as before. liveRegion.textContent = ''; // Timeout is necessary for screen readers like NVDA and VoiceOver. setTimeout(function () { liveRegion.textContent = message; document.addEventListener('click', clearLiveRegion); }, 1); function clearLiveRegion() { liveRegion.textContent = ''; document.removeEventListener('click', clearLiveRegion); } }; Announcer.prototype.getLiveRegion = function (priority) { var existingLiveRegion = this.liveRegions.get(priority); if (existingLiveRegion && document.body.contains(existingLiveRegion)) { return existingLiveRegion; } var liveRegion = this.createLiveRegion(priority); this.liveRegions.set(priority, liveRegion); return liveRegion; }; Announcer.prototype.createLiveRegion = function (priority) { var el = document.createElement('div'); el.style.position = 'absolute'; el.style.top = '-9999px'; el.style.left = '-9999px'; el.style.height = '1px'; el.style.overflow = 'hidden'; el.setAttribute('aria-atomic', 'true'); el.setAttribute('aria-live', priority); document.body.appendChild(el); return el; }; return Announcer; }(); /***/ }), /***/ "./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 }); /** * 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/focus-trap.ts": /*!****************************************!*\ !*** ./packages/mdc-dom/focus-trap.ts ***! \****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2020 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 }); var FOCUS_SENTINEL_CLASS = 'mdc-dom-focus-sentinel'; /** * Utility to trap focus in a given root element, e.g. for modal components such * as dialogs. The root should have at least one focusable child element, * for setting initial focus when trapping focus. * Also tracks the previously focused element, and restores focus to that * element when releasing focus. */ var FocusTrap = /** @class */function () { function FocusTrap(root, options) { if (options === void 0) { options = {}; } this.root = root; this.options = options; // Previously focused element before trapping focus. this.elFocusedBeforeTrapFocus = null; } /** * Traps focus in `root`. Also focuses on either `initialFocusEl` if set; * otherwises sets initial focus to the first focusable child element. */ FocusTrap.prototype.trapFocus = function () { var focusableEls = this.getFocusableElements(this.root); if (focusableEls.length === 0) { throw new Error('FocusTrap: Element must have at least one focusable child.'); } this.elFocusedBeforeTrapFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null; this.wrapTabFocus(this.root, focusableEls); if (!this.options.skipInitialFocus) { this.focusInitialElement(focusableEls, this.options.initialFocusEl); } }; /** * Releases focus from `root`. Also restores focus to the previously focused * element. */ FocusTrap.prototype.releaseFocus = function () { [].slice.call(this.root.querySelectorAll("." + FOCUS_SENTINEL_CLASS)).forEach(function (sentinelEl) { sentinelEl.parentElement.removeChild(sentinelEl); }); if (this.elFocusedBeforeTrapFocus) { this.elFocusedBeforeTrapFocus.focus(); } }; /** * Wraps tab focus within `el` by adding two hidden sentinel divs which are * used to mark the beginning and the end of the tabbable region. When * focused, these sentinel elements redirect focus to the first/last * children elements of the tabbable region, ensuring that focus is trapped * within that region. */ FocusTrap.prototype.wrapTabFocus = function (el, focusableEls) { var sentinelStart = this.createSentinel(); var sentinelEnd = this.createSentinel(); sentinelStart.addEventListener('focus', function () { if (focusableEls.length > 0) { focusableEls[focusableEls.length - 1].focus(); } }); sentinelEnd.addEventListener('focus', function () { if (focusableEls.length > 0) { focusableEls[0].focus(); } }); el.insertBefore(sentinelStart, el.children[0]); el.appendChild(sentinelEnd); }; /** * Focuses on `initialFocusEl` if defined and a child of the root element. * Otherwise, focuses on the first focusable child element of the root. */ FocusTrap.prototype.focusInitialElement = function (focusableEls, initialFocusEl) { var focusIndex = 0; if (initialFocusEl) { focusIndex = Math.max(focusableEls.indexOf(initialFocusEl), 0); } focusableEls[focusIndex].focus(); }; FocusTrap.prototype.getFocusableElements = function (root) { var focusableEls = [].slice.call(root.querySelectorAll('[autofocus], [tabindex], a, input, textarea, select, button')); return focusableEls.filter(function (el) { var isDisabledOrHidden = el.getAttribute('aria-disabled') === 'true' || el.getAttribute('disabled') != null || el.getAttribute('hidden') != null || el.getAttribute('aria-hidden') === 'true'; var isTabbableAndVisible = el.tabIndex >= 0 && el.getBoundingClientRect().width > 0 && !el.classList.contains(FOCUS_SENTINEL_CLASS) && !isDisabledOrHidden; var isProgrammaticallyHidden = false; if (isTabbableAndVisible) { var style = getComputedStyle(el); isProgrammaticallyHidden = style.display === 'none' || style.visibility === 'hidden'; } return isTabbableAndVisible && !isProgrammaticallyHidden; }); }; FocusTrap.prototype.createSentinel = function () { var sentinel = document.createElement('div'); sentinel.setAttribute('tabindex', '0'); // Don't announce in screen readers. sentinel.setAttribute('aria-hidden', 'true'); sentinel.classList.add(FOCUS_SENTINEL_CLASS); return sentinel; }; return FocusTrap; }(); exports.FocusTrap = FocusTrap; /***/ }), /***/ "./packages/mdc-dom/index.ts": /*!***********************************!*\ !*** ./packages/mdc-dom/index.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 __importStar = this && this.__importStar || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) { if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; }result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var events = __importStar(__webpack_require__(/*! ./events */ "./packages/mdc-dom/events.ts")); exports.events = events; var focusTrap = __importStar(__webpack_require__(/*! ./focus-trap */ "./packages/mdc-dom/focus-trap.ts")); exports.focusTrap = focusTrap; var keyboard = __importStar(__webpack_require__(/*! ./keyboard */ "./packages/mdc-dom/keyboard.ts")); exports.keyboard = keyboard; var ponyfill = __importStar(__webpack_require__(/*! ./ponyfill */ "./packages/mdc-dom/ponyfill.ts")); exports.ponyfill = ponyfill; /***/ }), /***/ "./packages/mdc-dom/keyboard.ts": /*!**************************************!*\ !*** ./packages/mdc-dom/keyboard.ts ***! \**************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2020 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 }); /** * KEY provides normalized string values for keys. */ exports.KEY = { UNKNOWN: 'Unknown', BACKSPACE: 'Backspace', ENTER: 'Enter', SPACEBAR: 'Spacebar', PAGE_UP: 'PageUp', PAGE_DOWN: 'PageDown', END: 'End', HOME: 'Home', ARROW_LEFT: 'ArrowLeft', ARROW_UP: 'ArrowUp', ARROW_RIGHT: 'ArrowRight', ARROW_DOWN: 'ArrowDown', DELETE: 'Delete', ESCAPE: 'Escape' }; var normalizedKeys = new Set(); // IE11 has no support for new Map with iterable so we need to initialize this // by hand. normalizedKeys.add(exports.KEY.BACKSPACE); normalizedKeys.add(exports.KEY.ENTER); normalizedKeys.add(exports.KEY.SPACEBAR); normalizedKeys.add(exports.KEY.PAGE_UP); normalizedKeys.add(exports.KEY.PAGE_DOWN); normalizedKeys.add(exports.KEY.END); normalizedKeys.add(exports.KEY.HOME); normalizedKeys.add(exports.KEY.ARROW_LEFT); normalizedKeys.add(exports.KEY.ARROW_UP); normalizedKeys.add(exports.KEY.ARROW_RIGHT); normalizedKeys.add(exports.KEY.ARROW_DOWN); normalizedKeys.add(exports.KEY.DELETE); normalizedKeys.add(exports.KEY.ESCAPE); var KEY_CODE = { BACKSPACE: 8, ENTER: 13, SPACEBAR: 32, PAGE_UP: 33, PAGE_DOWN: 34, END: 35, HOME: 36, ARROW_LEFT: 37, ARROW_UP: 38, ARROW_RIGHT: 39, ARROW_DOWN: 40, DELETE: 46, ESCAPE: 27 }; var mappedKeyCodes = new Map(); // IE11 has no support for new Map with iterable so we need to initialize this // by hand. mappedKeyCodes.set(KEY_CODE.BACKSPACE, exports.KEY.BACKSPACE); mappedKeyCodes.set(KEY_CODE.ENTER, exports.KEY.ENTER); mappedKeyCodes.set(KEY_CODE.SPACEBAR, exports.KEY.SPACEBAR); mappedKeyCodes.set(KEY_CODE.PAGE_UP, exports.KEY.PAGE_UP); mappedKeyCodes.set(KEY_CODE.PAGE_DOWN, exports.KEY.PAGE_DOWN); mappedKeyCodes.set(KEY_CODE.END, exports.KEY.END); mappedKeyCodes.set(KEY_CODE.HOME, exports.KEY.HOME); mappedKeyCodes.set(KEY_CODE.ARROW_LEFT, exports.KEY.ARROW_LEFT); mappedKeyCodes.set(KEY_CODE.ARROW_UP, exports.KEY.ARROW_UP); mappedKeyCodes.set(KEY_CODE.ARROW_RIGHT, exports.KEY.ARROW_RIGHT); mappedKeyCodes.set(KEY_CODE.ARROW_DOWN, exports.KEY.ARROW_DOWN); mappedKeyCodes.set(KEY_CODE.DELETE, exports.KEY.DELETE); mappedKeyCodes.set(KEY_CODE.ESCAPE, exports.KEY.ESCAPE); var navigationKeys = new Set(); // IE11 has no support for new Set with iterable so we need to initialize this // by hand. navigationKeys.add(exports.KEY.PAGE_UP); navigationKeys.add(exports.KEY.PAGE_DOWN); navigationKeys.add(exports.KEY.END); navigationKeys.add(exports.KEY.HOME); navigationKeys.add(exports.KEY.ARROW_LEFT); navigationKeys.add(exports.KEY.ARROW_UP); navigationKeys.add(exports.KEY.ARROW_RIGHT); navigationKeys.add(exports.KEY.ARROW_DOWN); /** * normalizeKey returns the normalized string for a navigational action. */ function normalizeKey(evt) { var key = evt.key; // If the event already has a normalized key, return it if (normalizedKeys.has(key)) { return key; } // tslint:disable-next-line:deprecation var mappedKey = mappedKeyCodes.get(evt.keyCode); if (mappedKey) { return mappedKey; } return exports.KEY.UNKNOWN; } exports.normalizeKey = normalizeKey; /** * isNavigationEvent returns whether the event is a navigation event */ function isNavigationEvent(evt) { return navigationKeys.has(normalizeKey(evt)); } exports.isNavigationEvent = isNavigationEvent; /***/ }), /***/ "./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 }); /** * @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-drawer/component.ts": /*!******************************************!*\ !*** ./packages/mdc-drawer/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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); var __importStar = this && this.__importStar || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) { if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; }result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); var focus_trap_1 = __webpack_require__(/*! @material/dom/focus-trap */ "./packages/mdc-dom/focus-trap.ts"); var component_2 = __webpack_require__(/*! @material/list/component */ "./packages/mdc-list/component.ts"); var foundation_1 = __webpack_require__(/*! @material/list/foundation */ "./packages/mdc-list/foundation.ts"); var foundation_2 = __webpack_require__(/*! ./dismissible/foundation */ "./packages/mdc-drawer/dismissible/foundation.ts"); var foundation_3 = __webpack_require__(/*! ./modal/foundation */ "./packages/mdc-drawer/modal/foundation.ts"); var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-drawer/util.ts")); var cssClasses = foundation_2.MDCDismissibleDrawerFoundation.cssClasses, strings = foundation_2.MDCDismissibleDrawerFoundation.strings; /** * @events `MDCDrawer:closed {}` Emits when the navigation drawer has closed. * @events `MDCDrawer:opened {}` Emits when the navigation drawer has opened. */ var MDCDrawer = /** @class */function (_super) { __extends(MDCDrawer, _super); function MDCDrawer() { return _super !== null && _super.apply(this, arguments) || this; } MDCDrawer.attachTo = function (root) { return new MDCDrawer(root); }; Object.defineProperty(MDCDrawer.prototype, "open", { /** * @return boolean Proxies to the foundation's `open`/`close` methods. * Also returns true if drawer is in the open position. */ get: function get() { return this.foundation.isOpen(); }, /** * Toggles the drawer open and closed. */ set: function set(isOpen) { if (isOpen) { this.foundation.open(); } else { this.foundation.close(); } }, enumerable: true, configurable: true }); Object.defineProperty(MDCDrawer.prototype, "list", { get: function get() { return this.list_; }, enumerable: true, configurable: true }); MDCDrawer.prototype.initialize = function (focusTrapFactory, listFactory) { if (focusTrapFactory === void 0) { focusTrapFactory = function focusTrapFactory(el) { return new focus_trap_1.FocusTrap(el); }; } if (listFactory === void 0) { listFactory = function listFactory(el) { return new component_2.MDCList(el); }; } var listEl = this.root.querySelector("." + foundation_1.MDCListFoundation.cssClasses.ROOT); if (listEl) { this.list_ = listFactory(listEl); this.list_.wrapFocus = true; } this.focusTrapFactory_ = focusTrapFactory; }; MDCDrawer.prototype.initialSyncWithDOM = function () { var _this = this; var MODAL = cssClasses.MODAL; var SCRIM_SELECTOR = strings.SCRIM_SELECTOR; this.scrim_ = this.root.parentNode.querySelector(SCRIM_SELECTOR); if (this.scrim_ && this.root.classList.contains(MODAL)) { this.handleScrimClick_ = function () { return _this.foundation.handleScrimClick(); }; this.scrim_.addEventListener('click', this.handleScrimClick_); this.focusTrap_ = util.createFocusTrapInstance(this.root, this.focusTrapFactory_); } this.handleKeydown_ = function (evt) { return _this.foundation.handleKeydown(evt); }; this.handleTransitionEnd_ = function (evt) { return _this.foundation.handleTransitionEnd(evt); }; this.listen('keydown', this.handleKeydown_); this.listen('transitionend', this.handleTransitionEnd_); }; MDCDrawer.prototype.destroy = function () { this.unlisten('keydown', this.handleKeydown_); this.unlisten('transitionend', this.handleTransitionEnd_); if (this.list_) { this.list_.destroy(); } var MODAL = cssClasses.MODAL; if (this.scrim_ && this.handleScrimClick_ && this.root.classList.contains(MODAL)) { this.scrim_.removeEventListener('click', this.handleScrimClick_); // Ensure drawer is closed to hide scrim and release focus this.open = false; } }; MDCDrawer.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { return _this.root.classList.add(className); }, removeClass: function removeClass(className) { return _this.root.classList.remove(className); }, hasClass: function hasClass(className) { return _this.root.classList.contains(className); }, elementHasClass: function elementHasClass(element, className) { return element.classList.contains(className); }, saveFocus: function saveFocus() { return _this.previousFocus_ = document.activeElement; }, restoreFocus: function restoreFocus() { var previousFocus = _this.previousFocus_; if (previousFocus && previousFocus.focus && _this.root.contains(document.activeElement)) { previousFocus.focus(); } }, focusActiveNavigationItem: function focusActiveNavigationItem() { var activeNavItemEl = _this.root.querySelector("." + foundation_1.MDCListFoundation.cssClasses.LIST_ITEM_ACTIVATED_CLASS); if (activeNavItemEl) { activeNavItemEl.focus(); } }, notifyClose: function notifyClose() { return _this.emit(strings.CLOSE_EVENT, {}, true /* shouldBubble */); }, notifyOpen: function notifyOpen() { return _this.emit(strings.OPEN_EVENT, {}, true /* shouldBubble */); }, trapFocus: function trapFocus() { return _this.focusTrap_.trapFocus(); }, releaseFocus: function releaseFocus() { return _this.focusTrap_.releaseFocus(); } }; // tslint:enable:object-literal-sort-keys var DISMISSIBLE = cssClasses.DISMISSIBLE, MODAL = cssClasses.MODAL; if (this.root.classList.contains(DISMISSIBLE)) { return new foundation_2.MDCDismissibleDrawerFoundation(adapter); } else if (this.root.classList.contains(MODAL)) { return new foundation_3.MDCModalDrawerFoundation(adapter); } else { throw new Error("MDCDrawer: Failed to instantiate component. Supported variants are " + DISMISSIBLE + " and " + MODAL + "."); } }; return MDCDrawer; }(component_1.MDCComponent); exports.MDCDrawer = MDCDrawer; /***/ }), /***/ "./packages/mdc-drawer/constants.ts": /*!******************************************!*\ !*** ./packages/mdc-drawer/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 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 }); var cssClasses = { ANIMATE: 'mdc-drawer--animate', CLOSING: 'mdc-drawer--closing', DISMISSIBLE: 'mdc-drawer--dismissible', MODAL: 'mdc-drawer--modal', OPEN: 'mdc-drawer--open', OPENING: 'mdc-drawer--opening', ROOT: 'mdc-drawer' }; exports.cssClasses = cssClasses; var strings = { APP_CONTENT_SELECTOR: '.mdc-drawer-app-content', CLOSE_EVENT: 'MDCDrawer:closed', OPEN_EVENT: 'MDCDrawer:opened', SCRIM_SELECTOR: '.mdc-drawer-scrim' }; exports.strings = strings; /***/ }), /***/ "./packages/mdc-drawer/dismissible/foundation.ts": /*!*******************************************************!*\ !*** ./packages/mdc-drawer/dismissible/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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _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 }); var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); var constants_1 = __webpack_require__(/*! ../constants */ "./packages/mdc-drawer/constants.ts"); var MDCDismissibleDrawerFoundation = /** @class */function (_super) { __extends(MDCDismissibleDrawerFoundation, _super); function MDCDismissibleDrawerFoundation(adapter) { var _this = _super.call(this, __assign(__assign({}, MDCDismissibleDrawerFoundation.defaultAdapter), adapter)) || this; _this.animationFrame_ = 0; _this.animationTimer_ = 0; return _this; } Object.defineProperty(MDCDismissibleDrawerFoundation, "strings", { get: function get() { return constants_1.strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCDismissibleDrawerFoundation, "cssClasses", { get: function get() { return constants_1.cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCDismissibleDrawerFoundation, "defaultAdapter", { get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, hasClass: function hasClass() { return false; }, elementHasClass: function elementHasClass() { return false; }, notifyClose: function notifyClose() { return undefined; }, notifyOpen: function notifyOpen() { return undefined; }, saveFocus: function saveFocus() { return undefined; }, restoreFocus: function restoreFocus() { return undefined; }, focusActiveNavigationItem: function focusActiveNavigationItem() { return undefined; }, trapFocus: function trapFocus() { return undefined; }, releaseFocus: function releaseFocus() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCDismissibleDrawerFoundation.prototype.destroy = function () { if (this.animationFrame_) { cancelAnimationFrame(this.animationFrame_); } if (this.animationTimer_) { clearTimeout(this.animationTimer_); } }; /** * Opens the drawer from the closed state. */ MDCDismissibleDrawerFoundation.prototype.open = function () { var _this = this; if (this.isOpen() || this.isOpening() || this.isClosing()) { return; } this.adapter.addClass(constants_1.cssClasses.OPEN); this.adapter.addClass(constants_1.cssClasses.ANIMATE); // Wait a frame once display is no longer "none", to establish basis for animation this.runNextAnimationFrame_(function () { _this.adapter.addClass(constants_1.cssClasses.OPENING); }); this.adapter.saveFocus(); }; /** * Closes the drawer from the open state. */ MDCDismissibleDrawerFoundation.prototype.close = function () { if (!this.isOpen() || this.isOpening() || this.isClosing()) { return; } this.adapter.addClass(constants_1.cssClasses.CLOSING); }; /** * Returns true if the drawer is in the open position. * @return true if drawer is in open state. */ MDCDismissibleDrawerFoundation.prototype.isOpen = function () { return this.adapter.hasClass(constants_1.cssClasses.OPEN); }; /** * Returns true if the drawer is animating open. * @return true if drawer is animating open. */ MDCDismissibleDrawerFoundation.prototype.isOpening = function () { return this.adapter.hasClass(constants_1.cssClasses.OPENING) || this.adapter.hasClass(constants_1.cssClasses.ANIMATE); }; /** * Returns true if the drawer is animating closed. * @return true if drawer is animating closed. */ MDCDismissibleDrawerFoundation.prototype.isClosing = function () { return this.adapter.hasClass(constants_1.cssClasses.CLOSING); }; /** * Keydown handler to close drawer when key is escape. */ MDCDismissibleDrawerFoundation.prototype.handleKeydown = function (evt) { var keyCode = evt.keyCode, key = evt.key; var isEscape = key === 'Escape' || keyCode === 27; if (isEscape) { this.close(); } }; /** * Handles the `transitionend` event when the drawer finishes opening/closing. */ MDCDismissibleDrawerFoundation.prototype.handleTransitionEnd = function (evt) { var OPENING = constants_1.cssClasses.OPENING, CLOSING = constants_1.cssClasses.CLOSING, OPEN = constants_1.cssClasses.OPEN, ANIMATE = constants_1.cssClasses.ANIMATE, ROOT = constants_1.cssClasses.ROOT; // In Edge, transitionend on ripple pseudo-elements yields a target without classList, so check for Element first. var isRootElement = this.isElement_(evt.target) && this.adapter.elementHasClass(evt.target, ROOT); if (!isRootElement) { return; } if (this.isClosing()) { this.adapter.removeClass(OPEN); this.closed_(); this.adapter.restoreFocus(); this.adapter.notifyClose(); } else { this.adapter.focusActiveNavigationItem(); this.opened_(); this.adapter.notifyOpen(); } this.adapter.removeClass(ANIMATE); this.adapter.removeClass(OPENING); this.adapter.removeClass(CLOSING); }; /** * Extension point for when drawer finishes open animation. */ MDCDismissibleDrawerFoundation.prototype.opened_ = function () {}; // tslint:disable-line:no-empty /** * Extension point for when drawer finishes close animation. */ MDCDismissibleDrawerFoundation.prototype.closed_ = function () {}; // tslint:disable-line:no-empty /** * Runs the given logic on the next animation frame, using setTimeout to factor in Firefox reflow behavior. */ MDCDismissibleDrawerFoundation.prototype.runNextAnimationFrame_ = function (callback) { var _this = this; cancelAnimationFrame(this.animationFrame_); this.animationFrame_ = requestAnimationFrame(function () { _this.animationFrame_ = 0; clearTimeout(_this.animationTimer_); _this.animationTimer_ = setTimeout(callback, 0); }); }; MDCDismissibleDrawerFoundation.prototype.isElement_ = function (element) { // In Edge, transitionend on ripple pseudo-elements yields a target without classList. return Boolean(element.classList); }; return MDCDismissibleDrawerFoundation; }(foundation_1.MDCFoundation); exports.MDCDismissibleDrawerFoundation = MDCDismissibleDrawerFoundation; // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. exports.default = MDCDismissibleDrawerFoundation; /***/ }), /***/ "./packages/mdc-drawer/index.ts": /*!**************************************!*\ !*** ./packages/mdc-drawer/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. */ function __export(m) { for (var p in m) { if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } } var __importStar = this && this.__importStar || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) { if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; }result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var util = __importStar(__webpack_require__(/*! ./util */ "./packages/mdc-drawer/util.ts")); exports.util = util; __export(__webpack_require__(/*! ./component */ "./packages/mdc-drawer/component.ts")); __export(__webpack_require__(/*! ./constants */ "./packages/mdc-drawer/constants.ts")); __export(__webpack_require__(/*! ./dismissible/foundation */ "./packages/mdc-drawer/dismissible/foundation.ts")); __export(__webpack_require__(/*! ./modal/foundation */ "./packages/mdc-drawer/modal/foundation.ts")); /***/ }), /***/ "./packages/mdc-drawer/modal/foundation.ts": /*!*************************************************!*\ !*** ./packages/mdc-drawer/modal/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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); Object.defineProperty(exports, "__esModule", { value: true }); var foundation_1 = __webpack_require__(/*! ../dismissible/foundation */ "./packages/mdc-drawer/dismissible/foundation.ts"); /* istanbul ignore next: subclass is not a branch statement */ var MDCModalDrawerFoundation = /** @class */function (_super) { __extends(MDCModalDrawerFoundation, _super); function MDCModalDrawerFoundation() { return _super !== null && _super.apply(this, arguments) || this; } /** * Handles click event on scrim. */ MDCModalDrawerFoundation.prototype.handleScrimClick = function () { this.close(); }; /** * Called when drawer finishes open animation. */ MDCModalDrawerFoundation.prototype.opened_ = function () { this.adapter.trapFocus(); }; /** * Called when drawer finishes close animation. */ MDCModalDrawerFoundation.prototype.closed_ = function () { this.adapter.releaseFocus(); }; return MDCModalDrawerFoundation; }(foundation_1.MDCDismissibleDrawerFoundation); exports.MDCModalDrawerFoundation = MDCModalDrawerFoundation; // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. exports.default = MDCModalDrawerFoundation; /***/ }), /***/ "./packages/mdc-drawer/util.ts": /*!*************************************!*\ !*** ./packages/mdc-drawer/util.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 }); function createFocusTrapInstance(surfaceEl, focusTrapFactory) { return focusTrapFactory(surfaceEl, { // Component handles focusing on active nav item. skipInitialFocus: true }); } exports.createFocusTrapInstance = createFocusTrapInstance; /***/ }), /***/ "./packages/mdc-floating-label/component.ts": /*!**************************************************!*\ !*** ./packages/mdc-floating-label/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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); Object.defineProperty(exports, "__esModule", { value: true }); var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-floating-label/foundation.ts"); var MDCFloatingLabel = /** @class */function (_super) { __extends(MDCFloatingLabel, _super); function MDCFloatingLabel() { return _super !== null && _super.apply(this, arguments) || this; } MDCFloatingLabel.attachTo = function (root) { return new MDCFloatingLabel(root); }; /** * Styles the label to produce the label shake for errors. * @param shouldShake If true, shakes the label by adding a CSS class; otherwise, stops shaking by removing the class. */ MDCFloatingLabel.prototype.shake = function (shouldShake) { this.foundation.shake(shouldShake); }; /** * Styles the label to float/dock. * @param shouldFloat If true, floats the label by adding a CSS class; otherwise, docks it by removing the class. */ MDCFloatingLabel.prototype.float = function (shouldFloat) { this.foundation.float(shouldFloat); }; /** * Styles the label as required. * @param isRequired If true, adds an asterisk to the label, indicating that it is required. */ MDCFloatingLabel.prototype.setRequired = function (isRequired) { this.foundation.setRequired(isRequired); }; MDCFloatingLabel.prototype.getWidth = function () { return this.foundation.getWidth(); }; MDCFloatingLabel.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { return _this.root.classList.add(className); }, removeClass: function removeClass(className) { return _this.root.classList.remove(className); }, getWidth: function getWidth() { return ponyfill_1.estimateScrollWidth(_this.root); }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { return _this.listen(evtType, handler); }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { return _this.unlisten(evtType, handler); } }; // tslint:enable:object-literal-sort-keys return new foundation_1.MDCFloatingLabelFoundation(adapter); }; return MDCFloatingLabel; }(component_1.MDCComponent); exports.MDCFloatingLabel = MDCFloatingLabel; /***/ }), /***/ "./packages/mdc-floating-label/constants.ts": /*!**************************************************!*\ !*** ./packages/mdc-floating-label/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 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.cssClasses = { LABEL_FLOAT_ABOVE: 'mdc-floating-label--float-above', LABEL_REQUIRED: 'mdc-floating-label--required', LABEL_SHAKE: 'mdc-floating-label--shake', ROOT: 'mdc-floating-label' }; /***/ }), /***/ "./packages/mdc-floating-label/foundation.ts": /*!***************************************************!*\ !*** ./packages/mdc-floating-label/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. */ 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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _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 }); var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-floating-label/constants.ts"); var MDCFloatingLabelFoundation = /** @class */function (_super) { __extends(MDCFloatingLabelFoundation, _super); function MDCFloatingLabelFoundation(adapter) { var _this = _super.call(this, __assign(__assign({}, MDCFloatingLabelFoundation.defaultAdapter), adapter)) || this; _this.shakeAnimationEndHandler_ = function () { return _this.handleShakeAnimationEnd_(); }; return _this; } Object.defineProperty(MDCFloatingLabelFoundation, "cssClasses", { get: function get() { return constants_1.cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFloatingLabelFoundation, "defaultAdapter", { /** * See {@link MDCFloatingLabelAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, getWidth: function getWidth() { return 0; }, registerInteractionHandler: function registerInteractionHandler() { return undefined; }, deregisterInteractionHandler: function deregisterInteractionHandler() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCFloatingLabelFoundation.prototype.init = function () { this.adapter.registerInteractionHandler('animationend', this.shakeAnimationEndHandler_); }; MDCFloatingLabelFoundation.prototype.destroy = function () { this.adapter.deregisterInteractionHandler('animationend', this.shakeAnimationEndHandler_); }; /** * Returns the width of the label element. */ MDCFloatingLabelFoundation.prototype.getWidth = function () { return this.adapter.getWidth(); }; /** * Styles the label to produce a shake animation to indicate an error. * @param shouldShake If true, adds the shake CSS class; otherwise, removes shake class. */ MDCFloatingLabelFoundation.prototype.shake = function (shouldShake) { var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE; if (shouldShake) { this.adapter.addClass(LABEL_SHAKE); } else { this.adapter.removeClass(LABEL_SHAKE); } }; /** * Styles the label to float or dock. * @param shouldFloat If true, adds the float CSS class; otherwise, removes float and shake classes to dock the label. */ MDCFloatingLabelFoundation.prototype.float = function (shouldFloat) { var _a = MDCFloatingLabelFoundation.cssClasses, LABEL_FLOAT_ABOVE = _a.LABEL_FLOAT_ABOVE, LABEL_SHAKE = _a.LABEL_SHAKE; if (shouldFloat) { this.adapter.addClass(LABEL_FLOAT_ABOVE); } else { this.adapter.removeClass(LABEL_FLOAT_ABOVE); this.adapter.removeClass(LABEL_SHAKE); } }; /** * Styles the label as required. * @param isRequired If true, adds an asterisk to the label, indicating that it is required. */ MDCFloatingLabelFoundation.prototype.setRequired = function (isRequired) { var LABEL_REQUIRED = MDCFloatingLabelFoundation.cssClasses.LABEL_REQUIRED; if (isRequired) { this.adapter.addClass(LABEL_REQUIRED); } else { this.adapter.removeClass(LABEL_REQUIRED); } }; MDCFloatingLabelFoundation.prototype.handleShakeAnimationEnd_ = function () { var LABEL_SHAKE = MDCFloatingLabelFoundation.cssClasses.LABEL_SHAKE; this.adapter.removeClass(LABEL_SHAKE); }; return MDCFloatingLabelFoundation; }(foundation_1.MDCFoundation); exports.MDCFloatingLabelFoundation = MDCFloatingLabelFoundation; // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. exports.default = MDCFloatingLabelFoundation; /***/ }), /***/ "./packages/mdc-floating-label/index.ts": /*!**********************************************!*\ !*** ./packages/mdc-floating-label/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. */ function __export(m) { for (var p in m) { if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__(/*! ./component */ "./packages/mdc-floating-label/component.ts")); __export(__webpack_require__(/*! ./constants */ "./packages/mdc-floating-label/constants.ts")); __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-floating-label/foundation.ts")); /***/ }), /***/ "./packages/mdc-form-field/component.ts": /*!**********************************************!*\ !*** ./packages/mdc-form-field/component.ts ***! \**********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2017 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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); Object.defineProperty(exports, "__esModule", { value: true }); var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-form-field/foundation.ts"); var MDCFormField = /** @class */function (_super) { __extends(MDCFormField, _super); function MDCFormField() { return _super !== null && _super.apply(this, arguments) || this; } MDCFormField.attachTo = function (root) { return new MDCFormField(root); }; MDCFormField.prototype.labelEl = function () { var LABEL_SELECTOR = foundation_1.MDCFormFieldFoundation.strings.LABEL_SELECTOR; return this.root.querySelector(LABEL_SELECTOR); }; MDCFormField.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = { activateInputRipple: function activateInputRipple() { if (_this.input && _this.input.ripple) { _this.input.ripple.activate(); } }, deactivateInputRipple: function deactivateInputRipple() { if (_this.input && _this.input.ripple) { _this.input.ripple.deactivate(); } }, deregisterInteractionHandler: function deregisterInteractionHandler(evtType, handler) { var labelEl = _this.labelEl(); if (labelEl) { labelEl.removeEventListener(evtType, handler); } }, registerInteractionHandler: function registerInteractionHandler(evtType, handler) { var labelEl = _this.labelEl(); if (labelEl) { labelEl.addEventListener(evtType, handler); } } }; return new foundation_1.MDCFormFieldFoundation(adapter); }; return MDCFormField; }(component_1.MDCComponent); exports.MDCFormField = MDCFormField; /***/ }), /***/ "./packages/mdc-form-field/constants.ts": /*!**********************************************!*\ !*** ./packages/mdc-form-field/constants.ts ***! \**********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2017 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.cssClasses = { ROOT: 'mdc-form-field' }; exports.strings = { LABEL_SELECTOR: '.mdc-form-field > label' }; /***/ }), /***/ "./packages/mdc-form-field/foundation.ts": /*!***********************************************!*\ !*** ./packages/mdc-form-field/foundation.ts ***! \***********************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2017 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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _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 }); var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-form-field/constants.ts"); var MDCFormFieldFoundation = /** @class */function (_super) { __extends(MDCFormFieldFoundation, _super); function MDCFormFieldFoundation(adapter) { var _this = _super.call(this, __assign(__assign({}, MDCFormFieldFoundation.defaultAdapter), adapter)) || this; _this.click = function () { _this.handleClick(); }; return _this; } Object.defineProperty(MDCFormFieldFoundation, "cssClasses", { get: function get() { return constants_1.cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFormFieldFoundation, "strings", { get: function get() { return constants_1.strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCFormFieldFoundation, "defaultAdapter", { get: function get() { return { activateInputRipple: function activateInputRipple() { return undefined; }, deactivateInputRipple: function deactivateInputRipple() { return undefined; }, deregisterInteractionHandler: function deregisterInteractionHandler() { return undefined; }, registerInteractionHandler: function registerInteractionHandler() { return undefined; } }; }, enumerable: true, configurable: true }); MDCFormFieldFoundation.prototype.init = function () { this.adapter.registerInteractionHandler('click', this.click); }; MDCFormFieldFoundation.prototype.destroy = function () { this.adapter.deregisterInteractionHandler('click', this.click); }; MDCFormFieldFoundation.prototype.handleClick = function () { var _this = this; this.adapter.activateInputRipple(); requestAnimationFrame(function () { _this.adapter.deactivateInputRipple(); }); }; return MDCFormFieldFoundation; }(foundation_1.MDCFoundation); exports.MDCFormFieldFoundation = MDCFormFieldFoundation; // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. exports.default = MDCFormFieldFoundation; /***/ }), /***/ "./packages/mdc-form-field/index.ts": /*!******************************************!*\ !*** ./packages/mdc-form-field/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. */ function __export(m) { for (var p in m) { if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__(/*! ./component */ "./packages/mdc-form-field/component.ts")); __export(__webpack_require__(/*! ./constants */ "./packages/mdc-form-field/constants.ts")); __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-form-field/foundation.ts")); /***/ }), /***/ "./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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); Object.defineProperty(exports, "__esModule", { value: true }); 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. // 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: true, configurable: true }); Object.defineProperty(MDCIconButtonToggle.prototype, "on", { get: function get() { return this.foundation.isOn(); }, set: function set(isOn) { this.foundation.toggle(isOn); }, enumerable: true, 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.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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _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 }); 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: true, configurable: true }); Object.defineProperty(MDCIconButtonToggleFoundation, "strings", { get: function get() { return constants_1.strings; }, enumerable: true, 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: true, 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. */ function __export(m) { for (var p in m) { if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__(/*! ./component */ "./packages/mdc-icon-button/component.ts")); __export(__webpack_require__(/*! ./constants */ "./packages/mdc-icon-button/constants.ts")); __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-icon-button/foundation.ts")); /***/ }), /***/ "./packages/mdc-line-ripple/component.ts": /*!***********************************************!*\ !*** ./packages/mdc-line-ripple/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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); Object.defineProperty(exports, "__esModule", { value: true }); var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-line-ripple/foundation.ts"); var MDCLineRipple = /** @class */function (_super) { __extends(MDCLineRipple, _super); function MDCLineRipple() { return _super !== null && _super.apply(this, arguments) || this; } MDCLineRipple.attachTo = function (root) { return new MDCLineRipple(root); }; /** * Activates the line ripple */ MDCLineRipple.prototype.activate = function () { this.foundation.activate(); }; /** * Deactivates the line ripple */ MDCLineRipple.prototype.deactivate = function () { this.foundation.deactivate(); }; /** * Sets the transform origin given a user's click location. * The `rippleCenter` is the x-coordinate of the middle of the ripple. */ MDCLineRipple.prototype.setRippleCenter = function (xCoordinate) { this.foundation.setRippleCenter(xCoordinate); }; MDCLineRipple.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. var adapter = { addClass: function addClass(className) { return _this.root.classList.add(className); }, removeClass: function removeClass(className) { return _this.root.classList.remove(className); }, hasClass: function hasClass(className) { return _this.root.classList.contains(className); }, setStyle: function setStyle(propertyName, value) { return _this.root.style.setProperty(propertyName, value); }, registerEventHandler: function registerEventHandler(evtType, handler) { return _this.listen(evtType, handler); }, deregisterEventHandler: function deregisterEventHandler(evtType, handler) { return _this.unlisten(evtType, handler); } }; // tslint:enable:object-literal-sort-keys return new foundation_1.MDCLineRippleFoundation(adapter); }; return MDCLineRipple; }(component_1.MDCComponent); exports.MDCLineRipple = MDCLineRipple; /***/ }), /***/ "./packages/mdc-line-ripple/constants.ts": /*!***********************************************!*\ !*** ./packages/mdc-line-ripple/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 }); var cssClasses = { LINE_RIPPLE_ACTIVE: 'mdc-line-ripple--active', LINE_RIPPLE_DEACTIVATING: 'mdc-line-ripple--deactivating' }; exports.cssClasses = cssClasses; /***/ }), /***/ "./packages/mdc-line-ripple/foundation.ts": /*!************************************************!*\ !*** ./packages/mdc-line-ripple/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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _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 }); var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-line-ripple/constants.ts"); var MDCLineRippleFoundation = /** @class */function (_super) { __extends(MDCLineRippleFoundation, _super); function MDCLineRippleFoundation(adapter) { var _this = _super.call(this, __assign(__assign({}, MDCLineRippleFoundation.defaultAdapter), adapter)) || this; _this.transitionEndHandler_ = function (evt) { return _this.handleTransitionEnd(evt); }; return _this; } Object.defineProperty(MDCLineRippleFoundation, "cssClasses", { get: function get() { return constants_1.cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCLineRippleFoundation, "defaultAdapter", { /** * See {@link MDCLineRippleAdapter} for typing information on parameters and return types. */ get: function get() { // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface. return { addClass: function addClass() { return undefined; }, removeClass: function removeClass() { return undefined; }, hasClass: function hasClass() { return false; }, setStyle: function setStyle() { return undefined; }, registerEventHandler: function registerEventHandler() { return undefined; }, deregisterEventHandler: function deregisterEventHandler() { return undefined; } }; // tslint:enable:object-literal-sort-keys }, enumerable: true, configurable: true }); MDCLineRippleFoundation.prototype.init = function () { this.adapter.registerEventHandler('transitionend', this.transitionEndHandler_); }; MDCLineRippleFoundation.prototype.destroy = function () { this.adapter.deregisterEventHandler('transitionend', this.transitionEndHandler_); }; MDCLineRippleFoundation.prototype.activate = function () { this.adapter.removeClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING); this.adapter.addClass(constants_1.cssClasses.LINE_RIPPLE_ACTIVE); }; MDCLineRippleFoundation.prototype.setRippleCenter = function (xCoordinate) { this.adapter.setStyle('transform-origin', xCoordinate + "px center"); }; MDCLineRippleFoundation.prototype.deactivate = function () { this.adapter.addClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING); }; MDCLineRippleFoundation.prototype.handleTransitionEnd = function (evt) { // Wait for the line ripple to be either transparent or opaque // before emitting the animation end event var isDeactivating = this.adapter.hasClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING); if (evt.propertyName === 'opacity') { if (isDeactivating) { this.adapter.removeClass(constants_1.cssClasses.LINE_RIPPLE_ACTIVE); this.adapter.removeClass(constants_1.cssClasses.LINE_RIPPLE_DEACTIVATING); } } }; return MDCLineRippleFoundation; }(foundation_1.MDCFoundation); exports.MDCLineRippleFoundation = MDCLineRippleFoundation; // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. exports.default = MDCLineRippleFoundation; /***/ }), /***/ "./packages/mdc-line-ripple/index.ts": /*!*******************************************!*\ !*** ./packages/mdc-line-ripple/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. */ function __export(m) { for (var p in m) { if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__(/*! ./component */ "./packages/mdc-line-ripple/component.ts")); __export(__webpack_require__(/*! ./constants */ "./packages/mdc-line-ripple/constants.ts")); __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-line-ripple/foundation.ts")); /***/ }), /***/ "./packages/mdc-linear-progress/component.ts": /*!***************************************************!*\ !*** ./packages/mdc-linear-progress/component.ts ***! \***************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2017 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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); Object.defineProperty(exports, "__esModule", { value: true }); var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-linear-progress/foundation.ts"); var MDCLinearProgress = /** @class */function (_super) { __extends(MDCLinearProgress, _super); function MDCLinearProgress() { return _super !== null && _super.apply(this, arguments) || this; } MDCLinearProgress.attachTo = function (root) { return new MDCLinearProgress(root); }; Object.defineProperty(MDCLinearProgress.prototype, "determinate", { set: function set(value) { this.foundation.setDeterminate(value); }, enumerable: true, configurable: true }); Object.defineProperty(MDCLinearProgress.prototype, "progress", { set: function set(value) { this.foundation.setProgress(value); }, enumerable: true, configurable: true }); Object.defineProperty(MDCLinearProgress.prototype, "buffer", { set: function set(value) { this.foundation.setBuffer(value); }, enumerable: true, configurable: true }); Object.defineProperty(MDCLinearProgress.prototype, "reverse", { set: function set(value) { this.foundation.setReverse(value); }, enumerable: true, configurable: true }); MDCLinearProgress.prototype.open = function () { this.foundation.open(); }; MDCLinearProgress.prototype.close = function () { this.foundation.close(); }; MDCLinearProgress.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = { addClass: function addClass(className) { _this.root.classList.add(className); }, forceLayout: function forceLayout() { _this.root.getBoundingClientRect(); }, setBufferBarStyle: function setBufferBarStyle(styleProperty, value) { var bufferBar = _this.root.querySelector(foundation_1.MDCLinearProgressFoundation.strings.BUFFER_BAR_SELECTOR); if (bufferBar) { bufferBar.style.setProperty(styleProperty, value); } }, setPrimaryBarStyle: function setPrimaryBarStyle(styleProperty, value) { var primaryBar = _this.root.querySelector(foundation_1.MDCLinearProgressFoundation.strings.PRIMARY_BAR_SELECTOR); if (primaryBar) { primaryBar.style.setProperty(styleProperty, value); } }, hasClass: function hasClass(className) { return _this.root.classList.contains(className); }, removeAttribute: function removeAttribute(attributeName) { _this.root.removeAttribute(attributeName); }, removeClass: function removeClass(className) { _this.root.classList.remove(className); }, setAttribute: function setAttribute(attributeName, value) { _this.root.setAttribute(attributeName, value); } }; return new foundation_1.MDCLinearProgressFoundation(adapter); }; return MDCLinearProgress; }(component_1.MDCComponent); exports.MDCLinearProgress = MDCLinearProgress; /***/ }), /***/ "./packages/mdc-linear-progress/constants.ts": /*!***************************************************!*\ !*** ./packages/mdc-linear-progress/constants.ts ***! \***************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2017 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.cssClasses = { CLOSED_CLASS: 'mdc-linear-progress--closed', INDETERMINATE_CLASS: 'mdc-linear-progress--indeterminate', REVERSED_CLASS: 'mdc-linear-progress--reversed' }; exports.strings = { ARIA_VALUENOW: 'aria-valuenow', BUFFER_BAR_SELECTOR: '.mdc-linear-progress__buffer-bar', FLEX_BASIS: 'flex-basis', PRIMARY_BAR_SELECTOR: '.mdc-linear-progress__primary-bar' }; /***/ }), /***/ "./packages/mdc-linear-progress/foundation.ts": /*!****************************************************!*\ !*** ./packages/mdc-linear-progress/foundation.ts ***! \****************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2017 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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _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 }); var util_1 = __webpack_require__(/*! @material/animation/util */ "./packages/mdc-animation/util.ts"); var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-linear-progress/constants.ts"); var MDCLinearProgressFoundation = /** @class */function (_super) { __extends(MDCLinearProgressFoundation, _super); function MDCLinearProgressFoundation(adapter) { return _super.call(this, __assign(__assign({}, MDCLinearProgressFoundation.defaultAdapter), adapter)) || this; } Object.defineProperty(MDCLinearProgressFoundation, "cssClasses", { get: function get() { return constants_1.cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCLinearProgressFoundation, "strings", { get: function get() { return constants_1.strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCLinearProgressFoundation, "defaultAdapter", { get: function get() { return { addClass: function addClass() { return undefined; }, forceLayout: function forceLayout() { return undefined; }, setBufferBarStyle: function setBufferBarStyle() { return null; }, setPrimaryBarStyle: function setPrimaryBarStyle() { return null; }, hasClass: function hasClass() { return false; }, removeAttribute: function removeAttribute() { return undefined; }, removeClass: function removeClass() { return undefined; }, setAttribute: function setAttribute() { return undefined; } }; }, enumerable: true, configurable: true }); MDCLinearProgressFoundation.prototype.init = function () { this.isDeterminate = !this.adapter.hasClass(constants_1.cssClasses.INDETERMINATE_CLASS); this.isReversed = this.adapter.hasClass(constants_1.cssClasses.REVERSED_CLASS); this.progress = 0; this.buffer = 1; }; MDCLinearProgressFoundation.prototype.setDeterminate = function (isDeterminate) { this.isDeterminate = isDeterminate; if (this.isDeterminate) { this.adapter.removeClass(constants_1.cssClasses.INDETERMINATE_CLASS); this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, this.progress.toString()); this.setPrimaryBarProgress(this.progress); this.setBufferBarProgress(this.buffer); return; } if (this.isReversed) { // Adding/removing REVERSED_CLASS starts a translate animation, while // adding INDETERMINATE_CLASS starts a scale animation. Here, we reset // the translate animation in order to keep it in sync with the new // scale animation that will start from adding INDETERMINATE_CLASS // below. this.adapter.removeClass(constants_1.cssClasses.REVERSED_CLASS); this.adapter.forceLayout(); this.adapter.addClass(constants_1.cssClasses.REVERSED_CLASS); } this.adapter.addClass(constants_1.cssClasses.INDETERMINATE_CLASS); this.adapter.removeAttribute(constants_1.strings.ARIA_VALUENOW); this.setPrimaryBarProgress(1); this.setBufferBarProgress(1); }; MDCLinearProgressFoundation.prototype.getDeterminate = function () { return this.isDeterminate; }; MDCLinearProgressFoundation.prototype.setProgress = function (value) { this.progress = value; if (this.isDeterminate) { this.setPrimaryBarProgress(value); this.adapter.setAttribute(constants_1.strings.ARIA_VALUENOW, value.toString()); } }; MDCLinearProgressFoundation.prototype.getProgress = function () { return this.progress; }; MDCLinearProgressFoundation.prototype.setBuffer = function (value) { this.buffer = value; if (this.isDeterminate) { this.setBufferBarProgress(value); } }; MDCLinearProgressFoundation.prototype.setReverse = function (isReversed) { this.isReversed = isReversed; if (!this.isDeterminate) { // Adding INDETERMINATE_CLASS starts a scale animation, while // adding/removing REVERSED_CLASS starts a translate animation. Here, we // reset the scale animation in order to keep it in sync with the new // translate animation that will start from adding/removing REVERSED_CLASS // below. this.adapter.removeClass(constants_1.cssClasses.INDETERMINATE_CLASS); this.adapter.forceLayout(); this.adapter.addClass(constants_1.cssClasses.INDETERMINATE_CLASS); } if (this.isReversed) { this.adapter.addClass(constants_1.cssClasses.REVERSED_CLASS); return; } this.adapter.removeClass(constants_1.cssClasses.REVERSED_CLASS); }; MDCLinearProgressFoundation.prototype.open = function () { this.adapter.removeClass(constants_1.cssClasses.CLOSED_CLASS); }; MDCLinearProgressFoundation.prototype.close = function () { this.adapter.addClass(constants_1.cssClasses.CLOSED_CLASS); }; MDCLinearProgressFoundation.prototype.setPrimaryBarProgress = function (progressValue) { var value = "scaleX(" + progressValue + ")"; // Accessing `window` without a `typeof` check will throw on Node environments. var transformProp = typeof window !== 'undefined' ? util_1.getCorrectPropertyName(window, 'transform') : 'transform'; this.adapter.setPrimaryBarStyle(transformProp, value); }; MDCLinearProgressFoundation.prototype.setBufferBarProgress = function (progressValue) { var value = progressValue * 100 + "%"; this.adapter.setBufferBarStyle(constants_1.strings.FLEX_BASIS, value); }; return MDCLinearProgressFoundation; }(foundation_1.MDCFoundation); exports.MDCLinearProgressFoundation = MDCLinearProgressFoundation; // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. exports.default = MDCLinearProgressFoundation; /***/ }), /***/ "./packages/mdc-linear-progress/index.ts": /*!***********************************************!*\ !*** ./packages/mdc-linear-progress/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. */ function __export(m) { for (var p in m) { if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__(/*! ./component */ "./packages/mdc-linear-progress/component.ts")); __export(__webpack_require__(/*! ./constants */ "./packages/mdc-linear-progress/constants.ts")); __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-linear-progress/foundation.ts")); /***/ }), /***/ "./packages/mdc-list/component.ts": /*!****************************************!*\ !*** ./packages/mdc-list/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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); Object.defineProperty(exports, "__esModule", { value: true }); var component_1 = __webpack_require__(/*! @material/base/component */ "./packages/mdc-base/component.ts"); var ponyfill_1 = __webpack_require__(/*! @material/dom/ponyfill */ "./packages/mdc-dom/ponyfill.ts"); var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts"); var foundation_1 = __webpack_require__(/*! ./foundation */ "./packages/mdc-list/foundation.ts"); var MDCList = /** @class */function (_super) { __extends(MDCList, _super); function MDCList() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(MDCList.prototype, "vertical", { set: function set(value) { this.foundation.setVerticalOrientation(value); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "listElements", { get: function get() { return [].slice.call(this.root.querySelectorAll("." + constants_1.cssClasses.LIST_ITEM_CLASS)); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "wrapFocus", { set: function set(value) { this.foundation.setWrapFocus(value); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "typeaheadInProgress", { /** * @return Whether typeahead is currently matching a user-specified prefix. */ get: function get() { return this.foundation.isTypeaheadInProgress(); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "hasTypeahead", { /** * Sets whether typeahead functionality is enabled on the list. * @param hasTypeahead Whether typeahead is enabled. */ set: function set(hasTypeahead) { this.foundation.setHasTypeahead(hasTypeahead); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "singleSelection", { set: function set(isSingleSelectionList) { this.foundation.setSingleSelection(isSingleSelectionList); }, enumerable: true, configurable: true }); Object.defineProperty(MDCList.prototype, "selectedIndex", { get: function get() { return this.foundation.getSelectedIndex(); }, set: function set(index) { this.foundation.setSelectedIndex(index); }, enumerable: true, configurable: true }); MDCList.attachTo = function (root) { return new MDCList(root); }; MDCList.prototype.initialSyncWithDOM = function () { this.handleClick_ = this.handleClickEvent_.bind(this); this.handleKeydown_ = this.handleKeydownEvent_.bind(this); this.focusInEventListener_ = this.handleFocusInEvent_.bind(this); this.focusOutEventListener_ = this.handleFocusOutEvent_.bind(this); this.listen('keydown', this.handleKeydown_); this.listen('click', this.handleClick_); this.listen('focusin', this.focusInEventListener_); this.listen('focusout', this.focusOutEventListener_); this.layout(); this.initializeListType(); }; MDCList.prototype.destroy = function () { this.unlisten('keydown', this.handleKeydown_); this.unlisten('click', this.handleClick_); this.unlisten('focusin', this.focusInEventListener_); this.unlisten('focusout', this.focusOutEventListener_); }; MDCList.prototype.layout = function () { var direction = this.root.getAttribute(constants_1.strings.ARIA_ORIENTATION); this.vertical = direction !== constants_1.strings.ARIA_ORIENTATION_HORIZONTAL; // List items need to have at least tabindex=-1 to be focusable. [].slice.call(this.root.querySelectorAll('.mdc-list-item:not([tabindex])')).forEach(function (el) { el.setAttribute('tabindex', '-1'); }); // Child button/a elements are not tabbable until the list item is focused. [].slice.call(this.root.querySelectorAll(constants_1.strings.FOCUSABLE_CHILD_ELEMENTS)).forEach(function (el) { return el.setAttribute('tabindex', '-1'); }); this.foundation.layout(); }; /** * Extracts the primary text from a list item. * @param item The list item element. * @return The primary text in the element. */ MDCList.prototype.getPrimaryText = function (item) { var primaryText = item.querySelector("." + constants_1.cssClasses.LIST_ITEM_PRIMARY_TEXT_CLASS); if (primaryText) { return primaryText.textContent || ''; } var singleLineText = item.querySelector("." + constants_1.cssClasses.LIST_ITEM_TEXT_CLASS); return singleLineText && singleLineText.textContent || ''; }; /** * Initialize selectedIndex value based on pre-selected checkbox list items, single selection or radio. */ MDCList.prototype.initializeListType = function () { var _this = this; var checkboxListItems = this.root.querySelectorAll(constants_1.strings.ARIA_ROLE_CHECKBOX_SELECTOR); var singleSelectedListItem = this.root.querySelector("\n ." + constants_1.cssClasses.LIST_ITEM_ACTIVATED_CLASS + ",\n ." + constants_1.cssClasses.LIST_ITEM_SELECTED_CLASS + "\n "); var radioSelectedListItem = this.root.querySelector(constants_1.strings.ARIA_CHECKED_RADIO_SELECTOR); if (checkboxListItems.length) { var preselectedItems = this.root.querySelectorAll(constants_1.strings.ARIA_CHECKED_CHECKBOX_SELECTOR); this.selectedIndex = [].map.call(preselectedItems, function (listItem) { return _this.listElements.indexOf(listItem); }); } else if (singleSelectedListItem) { if (singleSelectedListItem.classList.contains(constants_1.cssClasses.LIST_ITEM_ACTIVATED_CLASS)) { this.foundation.setUseActivatedClass(true); } this.singleSelection = true; this.selectedIndex = this.listElements.indexOf(singleSelectedListItem); } else if (radioSelectedListItem) { this.selectedIndex = this.listElements.indexOf(radioSelectedListItem); } }; /** * Updates the list item at itemIndex to the desired isEnabled state. * @param itemIndex Index of the list item * @param isEnabled Sets the list item to enabled or disabled. */ MDCList.prototype.setEnabled = function (itemIndex, isEnabled) { this.foundation.setEnabled(itemIndex, isEnabled); }; /** * Given the next desired character from the user, adds it to the typeahead * buffer. Then, attempts to find the next option matching the buffer. Wraps * around if at the end of options. * * @param nextChar The next character to add to the prefix buffer. * @param startingIndex The index from which to start matching. Defaults to * the currently focused index. * @return The index of the matched item. */ MDCList.prototype.typeaheadMatchItem = function (nextChar, startingIndex) { return this.foundation.typeaheadMatchItem(nextChar, startingIndex, /** skipFocus */true); }; MDCList.prototype.getDefaultFoundation = function () { var _this = this; // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial. // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable. var adapter = { addClassForElementIndex: function addClassForElementIndex(index, className) { var element = _this.listElements[index]; if (element) { element.classList.add(className); } }, focusItemAtIndex: function focusItemAtIndex(index) { var element = _this.listElements[index]; if (element) { element.focus(); } }, getAttributeForElementIndex: function getAttributeForElementIndex(index, attr) { return _this.listElements[index].getAttribute(attr); }, getFocusedElementIndex: function getFocusedElementIndex() { return _this.listElements.indexOf(document.activeElement); }, getListItemCount: function getListItemCount() { return _this.listElements.length; }, getPrimaryTextAtIndex: function getPrimaryTextAtIndex(index) { return _this.getPrimaryText(_this.listElements[index]); }, hasCheckboxAtIndex: function hasCheckboxAtIndex(index) { var listItem = _this.listElements[index]; return !!listItem.querySelector(constants_1.strings.CHECKBOX_SELECTOR); }, hasRadioAtIndex: function hasRadioAtIndex(index) { var listItem = _this.listElements[index]; return !!listItem.querySelector(constants_1.strings.RADIO_SELECTOR); }, isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex(index) { var listItem = _this.listElements[index]; var toggleEl = listItem.querySelector(constants_1.strings.CHECKBOX_SELECTOR); return toggleEl.checked; }, isFocusInsideList: function isFocusInsideList() { return _this.root.contains(document.activeElement); }, isRootFocused: function isRootFocused() { return document.activeElement === _this.root; }, listItemAtIndexHasClass: function listItemAtIndexHasClass(index, className) { return _this.listElements[index].classList.contains(className); }, notifyAction: function notifyAction(index) { _this.emit(constants_1.strings.ACTION_EVENT, { index: index }, /** shouldBubble */true); }, removeClassForElementIndex: function removeClassForElementIndex(index, className) { var element = _this.listElements[index]; if (element) { element.classList.remove(className); } }, setAttributeForElementIndex: function setAttributeForElementIndex(index, attr, value) { var element = _this.listElements[index]; if (element) { element.setAttribute(attr, value); } }, setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex(index, isChecked) { var listItem = _this.listElements[index]; var toggleEl = listItem.querySelector(constants_1.strings.CHECKBOX_RADIO_SELECTOR); toggleEl.checked = isChecked; var event = document.createEvent('Event'); event.initEvent('change', true, true); toggleEl.dispatchEvent(event); }, setTabIndexForListItemChildren: function setTabIndexForListItemChildren(listItemIndex, tabIndexValue) { var element = _this.listElements[listItemIndex]; var listItemChildren = [].slice.call(element.querySelectorAll(constants_1.strings.CHILD_ELEMENTS_TO_TOGGLE_TABINDEX)); listItemChildren.forEach(function (el) { return el.setAttribute('tabindex', tabIndexValue); }); } }; return new foundation_1.MDCListFoundation(adapter); }; /** * Used to figure out which list item this event is targetting. Or returns -1 if * there is no list item */ MDCList.prototype.getListItemIndex_ = function (evt) { var eventTarget = evt.target; var nearestParent = ponyfill_1.closest(eventTarget, "." + constants_1.cssClasses.LIST_ITEM_CLASS + ", ." + constants_1.cssClasses.ROOT); // Get the index of the element if it is a list item. if (nearestParent && ponyfill_1.matches(nearestParent, "." + constants_1.cssClasses.LIST_ITEM_CLASS)) { return this.listElements.indexOf(nearestParent); } return -1; }; /** * Used to figure out which element was clicked before sending the event to the foundation. */ MDCList.prototype.handleFocusInEvent_ = function (evt) { var index = this.getListItemIndex_(evt); this.foundation.handleFocusIn(evt, index); }; /** * Used to figure out which element was clicked before sending the event to the foundation. */ MDCList.prototype.handleFocusOutEvent_ = function (evt) { var index = this.getListItemIndex_(evt); this.foundation.handleFocusOut(evt, index); }; /** * Used to figure out which element was focused when keydown event occurred before sending the event to the * foundation. */ MDCList.prototype.handleKeydownEvent_ = function (evt) { var index = this.getListItemIndex_(evt); var target = evt.target; this.foundation.handleKeydown(evt, target.classList.contains(constants_1.cssClasses.LIST_ITEM_CLASS), index); }; /** * Used to figure out which element was clicked before sending the event to the foundation. */ MDCList.prototype.handleClickEvent_ = function (evt) { var index = this.getListItemIndex_(evt); var target = evt.target; // Toggle the checkbox only if it's not the target of the event, or the checkbox will have 2 change events. var toggleCheckbox = !ponyfill_1.matches(target, constants_1.strings.CHECKBOX_RADIO_SELECTOR); this.foundation.handleClick(index, toggleCheckbox); }; return MDCList; }(component_1.MDCComponent); exports.MDCList = MDCList; /***/ }), /***/ "./packages/mdc-list/constants.ts": /*!****************************************!*\ !*** ./packages/mdc-list/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 }); var cssClasses = { LIST_ITEM_ACTIVATED_CLASS: 'mdc-list-item--activated', LIST_ITEM_CLASS: 'mdc-list-item', LIST_ITEM_DISABLED_CLASS: 'mdc-list-item--disabled', LIST_ITEM_SELECTED_CLASS: 'mdc-list-item--selected', LIST_ITEM_TEXT_CLASS: 'mdc-list-item__text', LIST_ITEM_PRIMARY_TEXT_CLASS: 'mdc-list-item__primary-text', ROOT: 'mdc-list' }; exports.cssClasses = cssClasses; var strings = { ACTION_EVENT: 'MDCList:action', ARIA_CHECKED: 'aria-checked', ARIA_CHECKED_CHECKBOX_SELECTOR: '[role="checkbox"][aria-checked="true"]', ARIA_CHECKED_RADIO_SELECTOR: '[role="radio"][aria-checked="true"]', ARIA_CURRENT: 'aria-current', ARIA_DISABLED: 'aria-disabled', ARIA_ORIENTATION: 'aria-orientation', ARIA_ORIENTATION_HORIZONTAL: 'horizontal', ARIA_ROLE_CHECKBOX_SELECTOR: '[role="checkbox"]', ARIA_SELECTED: 'aria-selected', CHECKBOX_RADIO_SELECTOR: 'input[type="checkbox"], input[type="radio"]', CHECKBOX_SELECTOR: 'input[type="checkbox"]', CHILD_ELEMENTS_TO_TOGGLE_TABINDEX: "\n ." + cssClasses.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses.LIST_ITEM_CLASS + " a\n ", FOCUSABLE_CHILD_ELEMENTS: "\n ." + cssClasses.LIST_ITEM_CLASS + " button:not(:disabled),\n ." + cssClasses.LIST_ITEM_CLASS + " a,\n ." + cssClasses.LIST_ITEM_CLASS + " input[type=\"radio\"]:not(:disabled),\n ." + cssClasses.LIST_ITEM_CLASS + " input[type=\"checkbox\"]:not(:disabled)\n ", RADIO_SELECTOR: 'input[type="radio"]' }; exports.strings = strings; var numbers = { UNSET_INDEX: -1, TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS: 300 }; exports.numbers = numbers; /***/ }), /***/ "./packages/mdc-list/events.ts": /*!*************************************!*\ !*** ./packages/mdc-list/events.ts ***! \*************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2020 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 }); var ELEMENTS_KEY_ALLOWED_IN = ['input', 'button', 'textarea', 'select']; /** * Ensures that preventDefault is only called if the containing element * doesn't consume the event, and it will cause an unintended scroll. * * @param evt keyboard event to be prevented. */ exports.preventDefaultEvent = function (evt) { var target = evt.target; if (!target) { return; } var tagName = ("" + target.tagName).toLowerCase(); if (ELEMENTS_KEY_ALLOWED_IN.indexOf(tagName) === -1) { evt.preventDefault(); } }; /***/ }), /***/ "./packages/mdc-list/foundation.ts": /*!*****************************************!*\ !*** ./packages/mdc-list/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 (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _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); }; var __importStar = this && this.__importStar || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) { if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; }result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); var foundation_1 = __webpack_require__(/*! @material/base/foundation */ "./packages/mdc-base/foundation.ts"); var keyboard_1 = __webpack_require__(/*! @material/dom/keyboard */ "./packages/mdc-dom/keyboard.ts"); var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts"); var typeahead = __importStar(__webpack_require__(/*! ./typeahead */ "./packages/mdc-list/typeahead.ts")); var events_1 = __webpack_require__(/*! ./events */ "./packages/mdc-list/events.ts"); function isNumberArray(selectedIndex) { return selectedIndex instanceof Array; } var MDCListFoundation = /** @class */function (_super) { __extends(MDCListFoundation, _super); function MDCListFoundation(adapter) { var _this = _super.call(this, __assign(__assign({}, MDCListFoundation.defaultAdapter), adapter)) || this; _this.wrapFocus_ = false; _this.isVertical_ = true; _this.isSingleSelectionList_ = false; _this.selectedIndex_ = constants_1.numbers.UNSET_INDEX; _this.focusedItemIndex = constants_1.numbers.UNSET_INDEX; _this.useActivatedClass_ = false; _this.ariaCurrentAttrValue_ = null; _this.isCheckboxList_ = false; _this.isRadioList_ = false; _this.hasTypeahead = false; // Transiently holds current typeahead prefix from user. _this.typeaheadState = typeahead.initState(); _this.sortedIndexByFirstChar = new Map(); return _this; } Object.defineProperty(MDCListFoundation, "strings", { get: function get() { return constants_1.strings; }, enumerable: true, configurable: true }); Object.defineProperty(MDCListFoundation, "cssClasses", { get: function get() { return constants_1.cssClasses; }, enumerable: true, configurable: true }); Object.defineProperty(MDCListFoundation, "numbers", { get: function get() { return constants_1.numbers; }, enumerable: true, configurable: true }); Object.defineProperty(MDCListFoundation, "defaultAdapter", { get: function get() { return { addClassForElementIndex: function addClassForElementIndex() { return undefined; }, focusItemAtIndex: function focusItemAtIndex() { return undefined; }, getAttributeForElementIndex: function getAttributeForElementIndex() { return null; }, getFocusedElementIndex: function getFocusedElementIndex() { return 0; }, getListItemCount: function getListItemCount() { return 0; }, hasCheckboxAtIndex: function hasCheckboxAtIndex() { return false; }, hasRadioAtIndex: function hasRadioAtIndex() { return false; }, isCheckboxCheckedAtIndex: function isCheckboxCheckedAtIndex() { return false; }, isFocusInsideList: function isFocusInsideList() { return false; }, isRootFocused: function isRootFocused() { return false; }, listItemAtIndexHasClass: function listItemAtIndexHasClass() { return false; }, notifyAction: function notifyAction() { return undefined; }, removeClassForElementIndex: function removeClassForElementIndex() { return undefined; }, setAttributeForElementIndex: function setAttributeForElementIndex() { return undefined; }, setCheckedCheckboxOrRadioAtIndex: function setCheckedCheckboxOrRadioAtIndex() { return undefined; }, setTabIndexForListItemChildren: function setTabIndexForListItemChildren() { return undefined; }, getPrimaryTextAtIndex: function getPrimaryTextAtIndex() { return ''; } }; }, enumerable: true, configurable: true }); MDCListFoundation.prototype.layout = function () { if (this.adapter.getListItemCount() === 0) { return; } if (this.adapter.hasCheckboxAtIndex(0)) { this.isCheckboxList_ = true; } else if (this.adapter.hasRadioAtIndex(0)) { this.isRadioList_ = true; } if (this.hasTypeahead) { this.sortedIndexByFirstChar = this.typeaheadInitSortedIndex(); } }; /** * Sets the private wrapFocus_ variable. */ MDCListFoundation.prototype.setWrapFocus = function (value) { this.wrapFocus_ = value; }; /** * Sets the isVertical_ private variable. */ MDCListFoundation.prototype.setVerticalOrientation = function (value) { this.isVertical_ = value; }; /** * Sets the isSingleSelectionList_ private variable. */ MDCListFoundation.prototype.setSingleSelection = function (value) { this.isSingleSelectionList_ = value; }; /** * Sets whether typeahead is enabled on the list. * @param hasTypeahead Whether typeahead is enabled. */ MDCListFoundation.prototype.setHasTypeahead = function (hasTypeahead) { this.hasTypeahead = hasTypeahead; if (hasTypeahead) { this.sortedIndexByFirstChar = this.typeaheadInitSortedIndex(); } }; /** * @return Whether typeahead is currently matching a user-specified prefix. */ MDCListFoundation.prototype.isTypeaheadInProgress = function () { return this.hasTypeahead && typeahead.isTypingInProgress(this.typeaheadState); }; /** * Sets the useActivatedClass_ private variable. */ MDCListFoundation.prototype.setUseActivatedClass = function (useActivated) { this.useActivatedClass_ = useActivated; }; MDCListFoundation.prototype.getSelectedIndex = function () { return this.selectedIndex_; }; MDCListFoundation.prototype.setSelectedIndex = function (index) { if (!this.isIndexValid_(index)) { return; } if (this.isCheckboxList_) { this.setCheckboxAtIndex_(index); } else if (this.isRadioList_) { this.setRadioAtIndex_(index); } else { this.setSingleSelectionAtIndex_(index); } }; /** * Focus in handler for the list items. */ MDCListFoundation.prototype.handleFocusIn = function (_, listItemIndex) { if (listItemIndex >= 0) { this.focusedItemIndex = listItemIndex; this.adapter.setTabIndexForListItemChildren(listItemIndex, '0'); } }; /** * Focus out handler for the list items. */ MDCListFoundation.prototype.handleFocusOut = function (_, listItemIndex) { var _this = this; if (listItemIndex >= 0) { this.adapter.setTabIndexForListItemChildren(listItemIndex, '-1'); } /** * Between Focusout & Focusin some browsers do not have focus on any element. Setting a delay to wait till the focus * is moved to next element. */ setTimeout(function () { if (!_this.adapter.isFocusInsideList()) { _this.setTabindexToFirstSelectedItem_(); } }, 0); }; /** * Key handler for the list. */ MDCListFoundation.prototype.handleKeydown = function (event, isRootListItem, listItemIndex) { var _this = this; var isArrowLeft = keyboard_1.normalizeKey(event) === 'ArrowLeft'; var isArrowUp = keyboard_1.normalizeKey(event) === 'ArrowUp'; var isArrowRight = keyboard_1.normalizeKey(event) === 'ArrowRight'; var isArrowDown = keyboard_1.normalizeKey(event) === 'ArrowDown'; var isHome = keyboard_1.normalizeKey(event) === 'Home'; var isEnd = keyboard_1.normalizeKey(event) === 'End'; var isEnter = keyboard_1.normalizeKey(event) === 'Enter'; var isSpace = keyboard_1.normalizeKey(event) === 'Spacebar'; if (this.adapter.isRootFocused()) { if (isArrowUp || isEnd) { event.preventDefault(); this.focusLastElement(); } else if (isArrowDown || isHome) { event.preventDefault(); this.focusFirstElement(); } if (this.hasTypeahead) { var handleKeydownOpts = { event: event, focusItemAtIndex: function focusItemAtIndex(index) { _this.focusItemAtIndex(index); }, focusedItemIndex: -1, isTargetListItem: isRootListItem, sortedIndexByFirstChar: this.sortedIndexByFirstChar, isItemAtIndexDisabled: function isItemAtIndexDisabled(index) { return _this.adapter.listItemAtIndexHasClass(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS); } }; typeahead.handleKeydown(handleKeydownOpts, this.typeaheadState); } return; } var currentIndex = this.adapter.getFocusedElementIndex(); if (currentIndex === -1) { currentIndex = listItemIndex; if (currentIndex < 0) { // If this event doesn't have a mdc-list-item ancestor from the // current list (not from a sublist), return early. return; } } if (this.isVertical_ && isArrowDown || !this.isVertical_ && isArrowRight) { events_1.preventDefaultEvent(event); this.focusNextElement(currentIndex); } else if (this.isVertical_ && isArrowUp || !this.isVertical_ && isArrowLeft) { events_1.preventDefaultEvent(event); this.focusPrevElement(currentIndex); } else if (isHome) { events_1.preventDefaultEvent(event); this.focusFirstElement(); } else if (isEnd) { events_1.preventDefaultEvent(event); this.focusLastElement(); } else if (isEnter || isSpace) { if (isRootListItem) { // Return early if enter key is pressed on anchor element which triggers synthetic MouseEvent event. var target = event.target; if (target && target.tagName === 'A' && isEnter) { return; } events_1.preventDefaultEvent(event); if (this.adapter.listItemAtIndexHasClass(currentIndex, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS)) { return; } if (!this.isTypeaheadInProgress()) { if (this.isSelectableList_()) { this.setSelectedIndexOnAction_(currentIndex); } this.adapter.notifyAction(currentIndex); } } } if (this.hasTypeahead) { var handleKeydownOpts = { event: event, focusItemAtIndex: function focusItemAtIndex(index) { _this.focusItemAtIndex(index); }, focusedItemIndex: this.focusedItemIndex, isTargetListItem: isRootListItem, sortedIndexByFirstChar: this.sortedIndexByFirstChar, isItemAtIndexDisabled: function isItemAtIndexDisabled(index) { return _this.adapter.listItemAtIndexHasClass(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS); } }; typeahead.handleKeydown(handleKeydownOpts, this.typeaheadState); } }; /** * Click handler for the list. */ MDCListFoundation.prototype.handleClick = function (index, toggleCheckbox) { if (index === constants_1.numbers.UNSET_INDEX) { return; } this.setTabindexAtIndex_(index); this.focusedItemIndex = index; if (this.adapter.listItemAtIndexHasClass(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS)) { return; } if (this.isSelectableList_()) { this.setSelectedIndexOnAction_(index, toggleCheckbox); } this.adapter.notifyAction(index); }; /** * Focuses the next element on the list. */ MDCListFoundation.prototype.focusNextElement = function (index) { var count = this.adapter.getListItemCount(); var nextIndex = index + 1; if (nextIndex >= count) { if (this.wrapFocus_) { nextIndex = 0; } else { // Return early because last item is already focused. return index; } } this.focusItemAtIndex(nextIndex); return nextIndex; }; /** * Focuses the previous element on the list. */ MDCListFoundation.prototype.focusPrevElement = function (index) { var prevIndex = index - 1; if (prevIndex < 0) { if (this.wrapFocus_) { prevIndex = this.adapter.getListItemCount() - 1; } else { // Return early because first item is already focused. return index; } } this.focusItemAtIndex(prevIndex); return prevIndex; }; MDCListFoundation.prototype.focusFirstElement = function () { this.focusItemAtIndex(0); return 0; }; MDCListFoundation.prototype.focusLastElement = function () { var lastIndex = this.adapter.getListItemCount() - 1; this.focusItemAtIndex(lastIndex); return lastIndex; }; /** * @param itemIndex Index of the list item * @param isEnabled Sets the list item to enabled or disabled. */ MDCListFoundation.prototype.setEnabled = function (itemIndex, isEnabled) { if (!this.isIndexValid_(itemIndex)) { return; } if (isEnabled) { this.adapter.removeClassForElementIndex(itemIndex, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS); this.adapter.setAttributeForElementIndex(itemIndex, constants_1.strings.ARIA_DISABLED, 'false'); } else { this.adapter.addClassForElementIndex(itemIndex, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS); this.adapter.setAttributeForElementIndex(itemIndex, constants_1.strings.ARIA_DISABLED, 'true'); } }; MDCListFoundation.prototype.setSingleSelectionAtIndex_ = function (index) { if (this.selectedIndex_ === index) { return; } var selectedClassName = constants_1.cssClasses.LIST_ITEM_SELECTED_CLASS; if (this.useActivatedClass_) { selectedClassName = constants_1.cssClasses.LIST_ITEM_ACTIVATED_CLASS; } if (this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) { this.adapter.removeClassForElementIndex(this.selectedIndex_, selectedClassName); } this.adapter.addClassForElementIndex(index, selectedClassName); this.setAriaForSingleSelectionAtIndex_(index); this.selectedIndex_ = index; }; /** * Sets aria attribute for single selection at given index. */ MDCListFoundation.prototype.setAriaForSingleSelectionAtIndex_ = function (index) { // Detect the presence of aria-current and get the value only during list initialization when it is in unset state. if (this.selectedIndex_ === constants_1.numbers.UNSET_INDEX) { this.ariaCurrentAttrValue_ = this.adapter.getAttributeForElementIndex(index, constants_1.strings.ARIA_CURRENT); } var isAriaCurrent = this.ariaCurrentAttrValue_ !== null; var ariaAttribute = isAriaCurrent ? constants_1.strings.ARIA_CURRENT : constants_1.strings.ARIA_SELECTED; if (this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) { this.adapter.setAttributeForElementIndex(this.selectedIndex_, ariaAttribute, 'false'); } var ariaAttributeValue = isAriaCurrent ? this.ariaCurrentAttrValue_ : 'true'; this.adapter.setAttributeForElementIndex(index, ariaAttribute, ariaAttributeValue); }; /** * Toggles radio at give index. Radio doesn't change the checked state if it is already checked. */ MDCListFoundation.prototype.setRadioAtIndex_ = function (index) { this.adapter.setCheckedCheckboxOrRadioAtIndex(index, true); if (this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) { this.adapter.setAttributeForElementIndex(this.selectedIndex_, constants_1.strings.ARIA_CHECKED, 'false'); } this.adapter.setAttributeForElementIndex(index, constants_1.strings.ARIA_CHECKED, 'true'); this.selectedIndex_ = index; }; MDCListFoundation.prototype.setCheckboxAtIndex_ = function (index) { for (var i = 0; i < this.adapter.getListItemCount(); i++) { var isChecked = false; if (index.indexOf(i) >= 0) { isChecked = true; } this.adapter.setCheckedCheckboxOrRadioAtIndex(i, isChecked); this.adapter.setAttributeForElementIndex(i, constants_1.strings.ARIA_CHECKED, isChecked ? 'true' : 'false'); } this.selectedIndex_ = index; }; MDCListFoundation.prototype.setTabindexAtIndex_ = function (index) { if (this.focusedItemIndex === constants_1.numbers.UNSET_INDEX && index !== 0) { // If no list item was selected set first list item's tabindex to -1. // Generally, tabindex is set to 0 on first list item of list that has no preselected items. this.adapter.setAttributeForElementIndex(0, 'tabindex', '-1'); } else if (this.focusedItemIndex >= 0 && this.focusedItemIndex !== index) { this.adapter.setAttributeForElementIndex(this.focusedItemIndex, 'tabindex', '-1'); } this.adapter.setAttributeForElementIndex(index, 'tabindex', '0'); }; /** * @return Return true if it is single selectin list, checkbox list or radio list. */ MDCListFoundation.prototype.isSelectableList_ = function () { return this.isSingleSelectionList_ || this.isCheckboxList_ || this.isRadioList_; }; MDCListFoundation.prototype.setTabindexToFirstSelectedItem_ = function () { var targetIndex = 0; if (this.isSelectableList_()) { if (typeof this.selectedIndex_ === 'number' && this.selectedIndex_ !== constants_1.numbers.UNSET_INDEX) { targetIndex = this.selectedIndex_; } else if (isNumberArray(this.selectedIndex_) && this.selectedIndex_.length > 0) { targetIndex = this.selectedIndex_.reduce(function (currentIndex, minIndex) { return Math.min(currentIndex, minIndex); }); } } this.setTabindexAtIndex_(targetIndex); }; MDCListFoundation.prototype.isIndexValid_ = function (index) { var _this = this; if (index instanceof Array) { if (!this.isCheckboxList_) { throw new Error('MDCListFoundation: Array of index is only supported for checkbox based list'); } if (index.length === 0) { return true; } else { return index.some(function (i) { return _this.isIndexInRange_(i); }); } } else if (typeof index === 'number') { if (this.isCheckboxList_) { throw new Error('MDCListFoundation: Expected array of index for checkbox based list but got number: ' + index); } return this.isIndexInRange_(index); } else { return false; } }; MDCListFoundation.prototype.isIndexInRange_ = function (index) { var listSize = this.adapter.getListItemCount(); return index >= 0 && index < listSize; }; /** * Sets selected index on user action, toggles checkbox / radio based on toggleCheckbox value. * User interaction should not toggle list item(s) when disabled. */ MDCListFoundation.prototype.setSelectedIndexOnAction_ = function (index, toggleCheckbox) { if (toggleCheckbox === void 0) { toggleCheckbox = true; } if (this.isCheckboxList_) { this.toggleCheckboxAtIndex_(index, toggleCheckbox); } else { this.setSelectedIndex(index); } }; MDCListFoundation.prototype.toggleCheckboxAtIndex_ = function (index, toggleCheckbox) { var isChecked = this.adapter.isCheckboxCheckedAtIndex(index); if (toggleCheckbox) { isChecked = !isChecked; this.adapter.setCheckedCheckboxOrRadioAtIndex(index, isChecked); } this.adapter.setAttributeForElementIndex(index, constants_1.strings.ARIA_CHECKED, isChecked ? 'true' : 'false'); // If none of the checkbox items are selected and selectedIndex is not initialized then provide a default value. var selectedIndexes = this.selectedIndex_ === constants_1.numbers.UNSET_INDEX ? [] : this.selectedIndex_.slice(); if (isChecked) { selectedIndexes.push(index); } else { selectedIndexes = selectedIndexes.filter(function (i) { return i !== index; }); } this.selectedIndex_ = selectedIndexes; }; MDCListFoundation.prototype.focusItemAtIndex = function (index) { this.setTabindexAtIndex_(index); this.adapter.focusItemAtIndex(index); this.focusedItemIndex = index; }; /** * Given the next desired character from the user, adds it to the typeahead * buffer. Then, attempts to find the next option matching the buffer. Wraps * around if at the end of options. * * @param nextChar The next character to add to the prefix buffer. * @param startingIndex The index from which to start matching. Only relevant * when starting a new match sequence. To start a new match sequence, * clear the buffer using `clearTypeaheadBuffer`, or wait for the buffer * to clear after a set interval defined in list foundation. Defaults to * the currently focused index. * @return The index of the matched item, or -1 if no match. */ MDCListFoundation.prototype.typeaheadMatchItem = function (nextChar, startingIndex, skipFocus) { var _this = this; if (skipFocus === void 0) { skipFocus = false; } var opts = { focusItemAtIndex: function focusItemAtIndex(index) { _this.focusItemAtIndex(index); }, focusedItemIndex: startingIndex ? startingIndex : this.focusedItemIndex, nextChar: nextChar, sortedIndexByFirstChar: this.sortedIndexByFirstChar, skipFocus: skipFocus, isItemAtIndexDisabled: function isItemAtIndexDisabled(index) { return _this.adapter.listItemAtIndexHasClass(index, constants_1.cssClasses.LIST_ITEM_DISABLED_CLASS); } }; return typeahead.matchItem(opts, this.typeaheadState); }; /** * Initializes the MDCListTextAndIndex data structure by indexing the current * list items by primary text. * * @return The primary texts of all the list items sorted by first character. */ MDCListFoundation.prototype.typeaheadInitSortedIndex = function () { return typeahead.initSortedIndex(this.adapter.getListItemCount(), this.adapter.getPrimaryTextAtIndex); }; /** * Clears the typeahead buffer. */ MDCListFoundation.prototype.clearTypeaheadBuffer = function () { typeahead.clearBuffer(this.typeaheadState); }; return MDCListFoundation; }(foundation_1.MDCFoundation); exports.MDCListFoundation = MDCListFoundation; // tslint:disable-next-line:no-default-export Needed for backward compatibility with MDC Web v0.44.0 and earlier. exports.default = MDCListFoundation; /***/ }), /***/ "./packages/mdc-list/index.ts": /*!************************************!*\ !*** ./packages/mdc-list/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. */ function __export(m) { for (var p in m) { if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } } Object.defineProperty(exports, "__esModule", { value: true }); __export(__webpack_require__(/*! ./component */ "./packages/mdc-list/component.ts")); __export(__webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts")); __export(__webpack_require__(/*! ./foundation */ "./packages/mdc-list/foundation.ts")); /***/ }), /***/ "./packages/mdc-list/typeahead.ts": /*!****************************************!*\ !*** ./packages/mdc-list/typeahead.ts ***! \****************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * @license * Copyright 2020 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 }); var keyboard_1 = __webpack_require__(/*! @material/dom/keyboard */ "./packages/mdc-dom/keyboard.ts"); var constants_1 = __webpack_require__(/*! ./constants */ "./packages/mdc-list/constants.ts"); var events_1 = __webpack_require__(/*! ./events */ "./packages/mdc-list/events.ts"); /** * Initializes a state object for typeahead. Use the same reference for calls to * typeahead functions. * * @return The current state of the typeahead process. Each state reference * represents a typeahead instance as the reference is typically mutated * in-place. */ function initState() { var state = { bufferClearTimeout: 0, currentFirstChar: '', sortedIndexCursor: 0, typeaheadBuffer: '' }; return state; } exports.initState = initState; /** * Initializes typeahead state by indexing the current list items by primary * text into the sortedIndexByFirstChar data structure. * * @param listItemCount numer of items in the list * @param getPrimaryTextByItemIndex function that returns the primary text at a * given index * * @return Map that maps the first character of the primary text to the full * list text and it's index */ function initSortedIndex(listItemCount, getPrimaryTextByItemIndex) { var sortedIndexByFirstChar = new Map(); // Aggregate item text to index mapping for (var i = 0; i < listItemCount; i++) { var primaryText = getPrimaryTextByItemIndex(i).trim(); if (!primaryText) { continue; } var firstChar = primaryText[0].toLowerCase(); if (!sortedIndexByFirstChar.has(firstChar)) { sortedIndexByFirstChar.set(firstChar, []); } sortedIndexByFirstChar.get(firstChar).push({ text: primaryText.toLowerCase(), index: i }); } // Sort the mapping // TODO(b/157162694): Investigate replacing forEach with Map.values() sortedIndexByFirstChar.forEach(function (values) { values.sort(function (first, second) { return first.index - second.index; }); }); return sortedIndexByFirstChar; } exports.initSortedIndex = initSortedIndex; /** * Given the next desired character from the user, it attempts to find the next * list option matching the buffer. Wraps around if at the end of options. * * @param opts Options and accessors * - nextChar - the next character to match against items * - sortedIndexByFirstChar - output of `initSortedIndex(...)` * - focusedItemIndex - the index of the currently focused item * - focusItemAtIndex - function that focuses a list item at given index * - skipFocus - whether or not to focus the matched item * - isItemAtIndexDisabled - function that determines whether an item at a * given index is disabled * @param state The typeahead state instance. See `initState`. * * @return The index of the matched item, or -1 if no match. */ function matchItem(opts, state) { var nextChar = opts.nextChar, focusItemAtIndex = opts.focusItemAtIndex, sortedIndexByFirstChar = opts.sortedIndexByFirstChar, focusedItemIndex = opts.focusedItemIndex, skipFocus = opts.skipFocus, isItemAtIndexDisabled = opts.isItemAtIndexDisabled; clearTimeout(state.bufferClearTimeout); state.bufferClearTimeout = setTimeout(function () { clearBuffer(state); }, constants_1.numbers.TYPEAHEAD_BUFFER_CLEAR_TIMEOUT_MS); state.typeaheadBuffer = state.typeaheadBuffer + nextChar; var index; if (state.typeaheadBuffer.length === 1) { index = matchFirstChar(sortedIndexByFirstChar, focusedItemIndex, isItemAtIndexDisabled, state); } else { index = matchAllChars(sortedIndexByFirstChar, isItemAtIndexDisabled, state); } if (index !== -1 && !skipFocus) { focusItemAtIndex(index); } return index; } exports.matchItem = matchItem; /** * Matches the user's single input character in the buffer to the * next option that begins with such character. Wraps around if at * end of options. Returns -1 if no match is found. */ function matchFirstChar(sortedIndexByFirstChar, focusedItemIndex, isItemAtIndexDisabled, state) { var firstChar = state.typeaheadBuffer[0]; var itemsMatchingFirstChar = sortedIndexByFirstChar.get(firstChar); if (!itemsMatchingFirstChar) { return -1; } // Has the same firstChar been recently matched? // Also, did starting index remain the same between key presses? // If both hold true, simply increment index. if (firstChar === state.currentFirstChar && itemsMatchingFirstChar[state.sortedIndexCursor].index === focusedItemIndex) { state.sortedIndexCursor = (state.sortedIndexCursor + 1) % itemsMatchingFirstChar.length; var newIndex = itemsMatchingFirstChar[state.sortedIndexCursor].index; if (!isItemAtIndexDisabled(newIndex)) { return newIndex; } } // If we're here, it means one of the following happened: // - either firstChar or startingIndex has changed, invalidating the // cursor. // - The next item of typeahead is disabled, so we have to look further. state.currentFirstChar = firstChar; var newCursorPosition = -1; var cursorPosition; // Find the first non-disabled item as a fallback. for (cursorPosition = 0; cursorPosition < itemsMatchingFirstChar.length; cursorPosition++) { if (!isItemAtIndexDisabled(itemsMatchingFirstChar[cursorPosition].index)) { newCursorPosition = cursorPosition; break; } } // Advance cursor to first item matching the firstChar that is positioned // after starting item. Cursor is unchanged from fallback if there's no // such item. for (; cursorPosition < itemsMatchingFirstChar.length; cursorPosition++) { if (itemsMatchingFirstChar[cursorPosition].index > focusedItemIndex && !isItemAtIndexDisabled(itemsMatchingFirstChar[cursorPosition].index)) { newCursorPosition = cursorPosition; break; } } if (newCursorPosition !== -1) { state.sortedIndexCursor = newCursorPosition; return itemsMatchingFirstChar[state.sortedIndexCursor].index; } return -1; } /** * Attempts to find the next item that matches all of the typeahead buffer. * Wraps around if at end of options. Returns -1 if no match is found. */ function matchAllChars(sortedIndexByFirstChar, isItemAtIndexDisabled, state) { var firstChar = state.typeaheadBuffer[0]; var itemsMatchingFirstChar = sortedIndexByFirstChar.get(firstChar); if (!itemsMatchingFirstChar) { return -1; } // Do nothing if text already matches var startingItem = itemsMatchingFirstChar[state.sortedIndexCursor]; if (startingItem.text.lastIndexOf(state.typeaheadBuffer, 0) === 0 && !isItemAtIndexDisabled(startingItem.index)) { return startingItem.index; } // Find next item that matches completely; if no match, we'll eventually // loop around to same position var cursorPosition = (state.sortedIndexCursor + 1) % itemsMatchingFirstChar.length; var nextCursorPosition = -1; while (cursorPosition !== state.sortedIndexCursor) { var currentItem = itemsMatchingFirstChar[cursorPosition]; var matches = currentItem.text.lastIndexOf(state.typeaheadBuffer, 0) === 0; var isEnabled = !isItemAtIndexDisabled(currentItem.index); if (matches && isEnabled) { nextCursorPosition = cursorPosition; break; } cursorPosition = (cursorPosition + 1) % itemsMatchingFirstChar.length; } if (nextCursorPosition !== -1) { state.sortedIndexCursor = nextCursorPosition; return itemsMatchingFirstChar[state.sortedIndexCursor].index; } return -1; } /** * Whether or not the given typeahead instaance state is currently typing. * * @param state The typeahead state instance. See `initState`. */ function isTypingInProgress(state) { return state.typeaheadBuffer.length > 0; } exports.isTypingInProgress = isTypingInProgress; /** * Clears the typeahaed buffer so that it resets item matching to the first * character. * * @param state The typeahead state instance. See `initState`. */ function clearBuffer(state) { state.typeaheadBuffer = ''; } exports.clearBuffer = clearBuffer; /** * Given a keydown event, it calculates whether or not to automatically focus a * list item depending on what was typed mimicing the typeahead functionality of * a standard